blob: 3a2ef401d6bf2b6e5ce45ffc8902b02192f33b60 [file] [log] [blame]
adamdunkels1103ef92003-04-02 09:17:18 +00001/*
2 * Copyright (c) 2002, Adam Dunkels.
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. All advertising materials mentioning features or use of this
15 * software must display the following acknowledgement:
16 * This product includes software developed by Adam Dunkels.
17 * 4. The name of the author may not be used to endorse or promote
18 * products derived from this software without specific prior
19 * written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
22 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
25 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 * This file is part of the Contiki desktop environment
34 *
adamdunkels3cb4de82003-09-04 19:19:36 +000035 * $Id: contiki-main.c,v 1.9 2003/09/04 19:19:36 adamdunkels Exp $
adamdunkels1103ef92003-04-02 09:17:18 +000036 *
37 */
38
39
40#include "ctk.h"
41#include "ctk-draw.h"
42#include "dispatcher.h"
43
adamdunkels34bda132003-04-08 18:20:17 +000044#include "program-handler.h"
adamdunkels1103ef92003-04-02 09:17:18 +000045
adamdunkelsc8fc2302003-05-28 05:22:39 +000046#include "tapdev-drv.h"
47
adamdunkels1103ef92003-04-02 09:17:18 +000048#include "uip_main.h"
49#include "uip.h"
50#include "uip_arp.h"
51
adamdunkels1354b512003-04-17 20:07:23 +000052#include "about-dsc.h"
53#include "netconf-dsc.h"
54#include "processes-dsc.h"
adamdunkels12ebc1a2003-08-11 22:19:19 +000055#include "calc-dsc.h"
adamdunkels1354b512003-04-17 20:07:23 +000056
adamdunkels12ebc1a2003-08-11 22:19:19 +000057#include "telnet-dsc.h"
adamdunkels1354b512003-04-17 20:07:23 +000058#include "www-dsc.h"
adamdunkelsc8fc2302003-05-28 05:22:39 +000059#include "webserver-dsc.h"
adamdunkels1354b512003-04-17 20:07:23 +000060
adamdunkels779035a2003-09-01 22:24:52 +000061/*#include "presenter-dsc.h"*/
adamdunkels12ebc1a2003-08-11 22:19:19 +000062
63#include "wget-dsc.h"
64
65#include "email-dsc.h"
adamdunkelsc8d51892003-08-31 22:20:52 +000066/*#include "maze-dsc.h"*/
67
68#include "telnetd-dsc.h"
69
70#include "resolv.h"
71#include "ctk-vncserver.h"
72
73#include <gdk/gdktypes.h>
74#include <gtk/gtk.h>
75
76
adamdunkels12ebc1a2003-08-11 22:19:19 +000077
adamdunkels1103ef92003-04-02 09:17:18 +000078static gint
79idle_callback(gpointer data)
80{
adamdunkelsc8d51892003-08-31 22:20:52 +000081 dispatcher_process_signal();
82 dispatcher_process_idle();
83
adamdunkels1103ef92003-04-02 09:17:18 +000084 return TRUE;
85}
86/*-----------------------------------------------------------------------------------*/
87int
88main(int argc, char **argv)
89{
adamdunkels1354b512003-04-17 20:07:23 +000090 u16_t addr[2];
91
adamdunkelsc8d51892003-08-31 22:20:52 +000092 /* ek_init();*/
adamdunkels12ebc1a2003-08-11 22:19:19 +000093 dispatcher_init();
94
95
adamdunkels1103ef92003-04-02 09:17:18 +000096 uip_init();
adamdunkels1103ef92003-04-02 09:17:18 +000097 resolv_init();
98
adamdunkels1354b512003-04-17 20:07:23 +000099 /* XXX: just for making it easier to test. */
100 uip_ipaddr(addr, 192,168,1,2);
101 uip_sethostaddr(addr);
102
103 uip_ipaddr(addr, 192,168,1,1);
104 uip_setdraddr(addr);
105
106 uip_ipaddr(addr, 255,255,255,0);
107 uip_setnetmask(addr);
108
109
adamdunkelsc8fc2302003-05-28 05:22:39 +0000110 tapdev_drv_init();
adamdunkelsc8d51892003-08-31 22:20:52 +0000111
112#if WITH_CTKVNC
113 ctk_init();
114 ctk_vncserver_init(NULL);
115#else
adamdunkelsf6959692003-04-15 21:19:47 +0000116 ctk_gtksim_init();
adamdunkels1103ef92003-04-02 09:17:18 +0000117 ctk_init();
adamdunkelsc8d51892003-08-31 22:20:52 +0000118#endif
adamdunkels1354b512003-04-17 20:07:23 +0000119
adamdunkels34bda132003-04-08 18:20:17 +0000120 program_handler_init();
adamdunkels1103ef92003-04-02 09:17:18 +0000121
122 gtk_timeout_add(20, idle_callback, NULL);
adamdunkels1354b512003-04-17 20:07:23 +0000123
124 /* vnc_init();*/
125 program_handler_add(&about_dsc, "About", 1);
126 program_handler_add(&netconf_dsc, "Network setup", 1);
127 program_handler_add(&processes_dsc, "Processes", 0);
128
129 program_handler_add(&www_dsc, "Web browser", 1);
adamdunkels12ebc1a2003-08-11 22:19:19 +0000130
adamdunkelsc8fc2302003-05-28 05:22:39 +0000131 program_handler_add(&webserver_dsc, "Web server", 1);
adamdunkels12ebc1a2003-08-11 22:19:19 +0000132 program_handler_add(&telnet_dsc, "Telnet", 1);
133
134 program_handler_add(&calc_dsc, "Calculator", 0);
135
136 /* program_handler_add(&presenter_dsc, "Presenter", 1);*/
137
138 program_handler_add(&email_dsc, "E-mail", 1);
adamdunkelsc8d51892003-08-31 22:20:52 +0000139
140 program_handler_add(&telnetd_dsc, "Telnet daemon", 1);
141 /* program_handler_add(&maze_dsc, "3D maze", 1);*/
adamdunkels12ebc1a2003-08-11 22:19:19 +0000142
143 /*program_handler_add(&wget_dsc, "Web downloader", 1);*/
adamdunkels1103ef92003-04-02 09:17:18 +0000144
adamdunkels12ebc1a2003-08-11 22:19:19 +0000145 /* ctk_redraw();*/
adamdunkels3cb4de82003-09-04 19:19:36 +0000146 /* maze_init();*/
adamdunkels1103ef92003-04-02 09:17:18 +0000147 gtk_main();
148
149 return 0;
150
151 argv = argv;
152 argc = argc;
153}
154/*-----------------------------------------------------------------------------------*/