Contiki 2.5
contiki-client-main.c
1 /*
2  * Copyright (c) 2007, Takahide Matsutsuka.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following
12  * disclaimer in the documentation and/or other materials provided
13  * with the distribution.
14  * 3. The name of the author may not be used to endorse or promote
15  * products derived from this software without specific prior
16  * written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
19  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
22  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
24  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  * $Id: contiki-client-main.c,v 1.2 2007/11/28 06:14:11 matsutsuka Exp $
31  *
32  */
33 
34 /*
35  * \file
36  * This is a sample main file with slip network.
37  * \author
38  * Takahide Matsutsuka <markn@markn.org>
39  */
40 
41 //#define WITH_LOADER_ARCH 1
42 
43 #include "contiki.h"
44 
45 /* devices */
46 #include "net/uip.h"
47 #include "net/uip-fw-drv.h"
48 #include "dev/slip.h"
49 #include "dev/rs232.h"
50 #include "sys/process.h"
51 
52 /* desktop programs */
53 #include "program-handler.h"
54 //#include "process-list-dsc.h"
55 
56 /* network programs */
57 #include "netconf-dsc.h"
58 #include "www-dsc.h"
59 #include "telnet-dsc.h"
60 //#include "dhcp-dsc.h"
61 #include "email-dsc.h"
62 #include "ftp-dsc.h"
63 #include "irc-dsc.h"
64 
65 
66 /*---------------------------------------------------------------------------*/
67 /* inteface */
68 static struct uip_fw_netif slipif =
69  {UIP_FW_NETIF(0, 0, 0, 0, 0, 0, 0, 0, slip_send)};
70 
71 /* ip address of contiki */
72 const uip_ipaddr_t hostaddr = { { 10, 0, 1, 10 } };
73 
74 PROCESS_NAME(netconf_process);
75 PROCESS_NAME(email_process);
76 PROCESS_NAME(www_process);
77 PROCESS_NAME(simpletelnet_process);
78 PROCESS_NAME(ftp_process);
79 PROCESS_NAME(irc_process);
80 
81 /*---------------------------------------------------------------------------*/
82 int
83 main(void)
84 {
85  /* initialize process manager. */
86  process_init();
87 
88  uip_init();
89  uip_sethostaddr(&hostaddr);
90  uip_fw_default(&slipif);
91 
92  /* start services */
93  process_start(&etimer_process, NULL);
94  process_start(&ctk_process, NULL);
95 // process_start(&program_handler_process, NULL);
96  process_start(&tcpip_process, NULL);
97  process_start(&slip_process, NULL);
98  process_start(&uip_fw_process, NULL);
99  process_start(&rs232_process, NULL);
100 
101 // process_start(&email_process, NULL);
102 // process_start(&www_process, NULL);
103 // process_start(&ftp_process, NULL);
104 // process_start(&irc_process, NULL);
105 
106 // process_start(&netconf_process, NULL);
107  process_start(&simpletelnet_process, NULL);
108 
109 #if 0
110  /* register programs to the program handler */
111  program_handler_add(&processes_dsc, "Processes", 1);
112  program_handler_add(&netconf_dsc, "Network conf", 1);
113  program_handler_add(&email_dsc, "E-mail", 1);
114  program_handler_add(&irc_dsc, "IRC", 1);
115  program_handler_add(&vnc_dsc, "VNC client", 1);
116  program_handler_add(&dhcp_dsc, "DHCP client", 1);
117 #endif
118  while(1) {
119  process_run();
121  }
122 }