adamdunkels | 1103ef9 | 2003-04-02 09:17:18 +0000 | [diff] [blame] | 1 | /* |
| 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 | * |
adamdunkels | 12ebc1a | 2003-08-11 22:19:19 +0000 | [diff] [blame^] | 35 | * $Id: contiki-main.c,v 1.6 2003/08/11 22:19:42 adamdunkels Exp $ |
adamdunkels | 1103ef9 | 2003-04-02 09:17:18 +0000 | [diff] [blame] | 36 | * |
| 37 | */ |
| 38 | |
| 39 | |
| 40 | #include "ctk.h" |
| 41 | #include "ctk-draw.h" |
| 42 | #include "dispatcher.h" |
| 43 | |
adamdunkels | 34bda13 | 2003-04-08 18:20:17 +0000 | [diff] [blame] | 44 | #include "program-handler.h" |
adamdunkels | 1103ef9 | 2003-04-02 09:17:18 +0000 | [diff] [blame] | 45 | |
adamdunkels | c8fc230 | 2003-05-28 05:22:39 +0000 | [diff] [blame] | 46 | #include "tapdev-drv.h" |
| 47 | |
adamdunkels | 1103ef9 | 2003-04-02 09:17:18 +0000 | [diff] [blame] | 48 | #include "uip_main.h" |
| 49 | #include "uip.h" |
| 50 | #include "uip_arp.h" |
| 51 | |
adamdunkels | 1354b51 | 2003-04-17 20:07:23 +0000 | [diff] [blame] | 52 | #include "about-dsc.h" |
| 53 | #include "netconf-dsc.h" |
| 54 | #include "processes-dsc.h" |
adamdunkels | 12ebc1a | 2003-08-11 22:19:19 +0000 | [diff] [blame^] | 55 | #include "calc-dsc.h" |
adamdunkels | 1354b51 | 2003-04-17 20:07:23 +0000 | [diff] [blame] | 56 | |
adamdunkels | 12ebc1a | 2003-08-11 22:19:19 +0000 | [diff] [blame^] | 57 | #include "telnet-dsc.h" |
adamdunkels | 1354b51 | 2003-04-17 20:07:23 +0000 | [diff] [blame] | 58 | #include "www-dsc.h" |
adamdunkels | c8fc230 | 2003-05-28 05:22:39 +0000 | [diff] [blame] | 59 | #include "webserver-dsc.h" |
adamdunkels | 1354b51 | 2003-04-17 20:07:23 +0000 | [diff] [blame] | 60 | |
adamdunkels | 12ebc1a | 2003-08-11 22:19:19 +0000 | [diff] [blame^] | 61 | #include "presenter-dsc.h" |
| 62 | |
| 63 | #include "wget-dsc.h" |
| 64 | |
| 65 | #include "email-dsc.h" |
| 66 | |
adamdunkels | 1103ef9 | 2003-04-02 09:17:18 +0000 | [diff] [blame] | 67 | static gint |
| 68 | idle_callback(gpointer data) |
| 69 | { |
| 70 | ek_signals(); |
| 71 | ek_idle(); |
| 72 | return TRUE; |
| 73 | } |
| 74 | /*-----------------------------------------------------------------------------------*/ |
| 75 | int |
| 76 | main(int argc, char **argv) |
| 77 | { |
adamdunkels | 1354b51 | 2003-04-17 20:07:23 +0000 | [diff] [blame] | 78 | u16_t addr[2]; |
| 79 | |
adamdunkels | 12ebc1a | 2003-08-11 22:19:19 +0000 | [diff] [blame^] | 80 | ek_init(); |
| 81 | dispatcher_init(); |
| 82 | |
| 83 | |
adamdunkels | 1103ef9 | 2003-04-02 09:17:18 +0000 | [diff] [blame] | 84 | uip_init(); |
| 85 | uip_main_init(); |
| 86 | resolv_init(); |
| 87 | |
adamdunkels | 1354b51 | 2003-04-17 20:07:23 +0000 | [diff] [blame] | 88 | /* 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 | |
adamdunkels | c8fc230 | 2003-05-28 05:22:39 +0000 | [diff] [blame] | 99 | tapdev_drv_init(); |
adamdunkels | 1103ef9 | 2003-04-02 09:17:18 +0000 | [diff] [blame] | 100 | |
adamdunkels | f695969 | 2003-04-15 21:19:47 +0000 | [diff] [blame] | 101 | ctk_gtksim_init(); |
adamdunkels | 1103ef9 | 2003-04-02 09:17:18 +0000 | [diff] [blame] | 102 | ctk_init(); |
adamdunkels | 1354b51 | 2003-04-17 20:07:23 +0000 | [diff] [blame] | 103 | |
adamdunkels | 34bda13 | 2003-04-08 18:20:17 +0000 | [diff] [blame] | 104 | program_handler_init(); |
adamdunkels | 1103ef9 | 2003-04-02 09:17:18 +0000 | [diff] [blame] | 105 | |
| 106 | gtk_timeout_add(20, idle_callback, NULL); |
adamdunkels | 1354b51 | 2003-04-17 20:07:23 +0000 | [diff] [blame] | 107 | |
| 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); |
adamdunkels | 12ebc1a | 2003-08-11 22:19:19 +0000 | [diff] [blame^] | 114 | |
adamdunkels | c8fc230 | 2003-05-28 05:22:39 +0000 | [diff] [blame] | 115 | program_handler_add(&webserver_dsc, "Web server", 1); |
adamdunkels | 12ebc1a | 2003-08-11 22:19:19 +0000 | [diff] [blame^] | 116 | 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);*/ |
adamdunkels | c8fc230 | 2003-05-28 05:22:39 +0000 | [diff] [blame] | 125 | |
adamdunkels | 1103ef9 | 2003-04-02 09:17:18 +0000 | [diff] [blame] | 126 | |
adamdunkels | 12ebc1a | 2003-08-11 22:19:19 +0000 | [diff] [blame^] | 127 | /* ctk_redraw();*/ |
adamdunkels | 1103ef9 | 2003-04-02 09:17:18 +0000 | [diff] [blame] | 128 | gtk_main(); |
| 129 | |
| 130 | return 0; |
| 131 | |
| 132 | argv = argv; |
| 133 | argc = argc; |
| 134 | } |
| 135 | /*-----------------------------------------------------------------------------------*/ |