blob: 1f7cc08bf67d123ca581177c58527a59466e8588 [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 *
adamdunkels12ebc1a2003-08-11 22:19:19 +000035 * $Id: contiki-main.c,v 1.6 2003/08/11 22:19:42 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
adamdunkels12ebc1a2003-08-11 22:19:19 +000061#include "presenter-dsc.h"
62
63#include "wget-dsc.h"
64
65#include "email-dsc.h"
66
adamdunkels1103ef92003-04-02 09:17:18 +000067static gint
68idle_callback(gpointer data)
69{
70 ek_signals();
71 ek_idle();
72 return TRUE;
73}
74/*-----------------------------------------------------------------------------------*/
75int
76main(int argc, char **argv)
77{
adamdunkels1354b512003-04-17 20:07:23 +000078 u16_t addr[2];
79
adamdunkels12ebc1a2003-08-11 22:19:19 +000080 ek_init();
81 dispatcher_init();
82
83
adamdunkels1103ef92003-04-02 09:17:18 +000084 uip_init();
85 uip_main_init();
86 resolv_init();
87
adamdunkels1354b512003-04-17 20:07:23 +000088 /* XXX: just for making it easier to test. */
89 uip_ipaddr(addr, 192,168,1,2);
90 uip_sethostaddr(addr);
91
92 uip_ipaddr(addr, 192,168,1,1);
93 uip_setdraddr(addr);
94
95 uip_ipaddr(addr, 255,255,255,0);
96 uip_setnetmask(addr);
97
98
adamdunkelsc8fc2302003-05-28 05:22:39 +000099 tapdev_drv_init();
adamdunkels1103ef92003-04-02 09:17:18 +0000100
adamdunkelsf6959692003-04-15 21:19:47 +0000101 ctk_gtksim_init();
adamdunkels1103ef92003-04-02 09:17:18 +0000102 ctk_init();
adamdunkels1354b512003-04-17 20:07:23 +0000103
adamdunkels34bda132003-04-08 18:20:17 +0000104 program_handler_init();
adamdunkels1103ef92003-04-02 09:17:18 +0000105
106 gtk_timeout_add(20, idle_callback, NULL);
adamdunkels1354b512003-04-17 20:07:23 +0000107
108 /* vnc_init();*/
109 program_handler_add(&about_dsc, "About", 1);
110 program_handler_add(&netconf_dsc, "Network setup", 1);
111 program_handler_add(&processes_dsc, "Processes", 0);
112
113 program_handler_add(&www_dsc, "Web browser", 1);
adamdunkels12ebc1a2003-08-11 22:19:19 +0000114
adamdunkelsc8fc2302003-05-28 05:22:39 +0000115 program_handler_add(&webserver_dsc, "Web server", 1);
adamdunkels12ebc1a2003-08-11 22:19:19 +0000116 program_handler_add(&telnet_dsc, "Telnet", 1);
117
118 program_handler_add(&calc_dsc, "Calculator", 0);
119
120 /* program_handler_add(&presenter_dsc, "Presenter", 1);*/
121
122 program_handler_add(&email_dsc, "E-mail", 1);
123
124 /*program_handler_add(&wget_dsc, "Web downloader", 1);*/
adamdunkelsc8fc2302003-05-28 05:22:39 +0000125
adamdunkels1103ef92003-04-02 09:17:18 +0000126
adamdunkels12ebc1a2003-08-11 22:19:19 +0000127 /* ctk_redraw();*/
adamdunkels1103ef92003-04-02 09:17:18 +0000128 gtk_main();
129
130 return 0;
131
132 argv = argv;
133 argc = argc;
134}
135/*-----------------------------------------------------------------------------------*/