From 7dd756dd36464376719aa66593b6378bc3c20c36 Mon Sep 17 00:00:00 2001 From: matsutsuka Date: Sat, 29 Sep 2007 04:12:15 +0000 Subject: [PATCH] Applications have been modified to support !UIP_UDP and !CTK_CONF_WINDOWCLOSE. --- apps/email/email.c | 8 +++++++- apps/ftp/ftp.c | 18 ++++++++++++++---- apps/irc/irc.c | 11 +++++++++-- apps/netconf/netconf.c | 15 +++++++++++++-- 4 files changed, 43 insertions(+), 9 deletions(-) diff --git a/apps/email/email.c b/apps/email/email.c index 6563a7e0a..58a3a9abd 100644 --- a/apps/email/email.c +++ b/apps/email/email.c @@ -29,7 +29,7 @@ * * This file is part of the Contiki desktop environment for the C64. * - * $Id: email.c,v 1.1 2006/06/17 22:41:11 adamdunkels Exp $ + * $Id: email.c,v 1.2 2007/09/29 04:12:15 matsutsuka Exp $ * */ @@ -173,6 +173,7 @@ applyconfig(void) *cptr = 0; addrptr = &addr[0]; +#if UIP_UDP if(uiplib_ipaddrconv(smtpserver, (unsigned char *)addr) == 0) { addrptr = resolv_lookup(smtpserver); if(addrptr == NULL) { @@ -181,6 +182,9 @@ applyconfig(void) return; } } +#else /* UIP_UDP */ + uiplib_ipaddrconv(smtpserver, (unsigned char *)addr); +#endif /* UIP_UDP */ smtp_configure("contiki", addrptr); } /*-----------------------------------------------------------------------------------*/ @@ -303,6 +307,7 @@ PROCESS_THREAD(email_process, ev, data) email_quit(); } } +#if UIP_UDP } else if(ev == resolv_event_found) { if(strcmp(data, smtpserver) == 0) { if(resolv_lookup(smtpserver) != NULL) { @@ -313,6 +318,7 @@ PROCESS_THREAD(email_process, ev, data) } CTK_WIDGET_REDRAW(&statuslabel); } +#endif /* UIP_UDP */ } else if(ev == PROCESS_EVENT_EXIT) { email_quit(); } diff --git a/apps/ftp/ftp.c b/apps/ftp/ftp.c index 92a219acb..5c1bc135b 100644 --- a/apps/ftp/ftp.c +++ b/apps/ftp/ftp.c @@ -30,7 +30,7 @@ * * Author: Adam Dunkels * - * $Id: ftp.c,v 1.2 2006/08/21 21:36:18 oliverschmidt Exp $ + * $Id: ftp.c,v 1.3 2007/09/29 04:12:15 matsutsuka Exp $ */ /* Note to self: It would be nice to have a "View" option in the download dialog. */ @@ -372,6 +372,7 @@ PROCESS_THREAD(ftp_process, ev, data) quit(); } else if(ev == tcpip_event) { ftpc_appcall(data); +#if UIP_UDP } else if(ev == resolv_event_found) { /* Either found a hostname, or not. */ if((char *)data != NULL && @@ -381,8 +382,11 @@ PROCESS_THREAD(ftp_process, ev, data) } else { show_statustext("Host not found: ", hostname); } - - } else if(ev == ctk_signal_window_close && +#endif /* UIP_UDP */ + } else if( +#if CTK_CONF_WINDOWCLOSE + ev == ctk_signal_window_close && +#endif /* CTK_CONF_WINDOWCLOSE */ data == (process_data_t)&window) { quit(); } else if(ev == ctk_signal_widget_activate) { @@ -417,6 +421,7 @@ PROCESS_THREAD(ftp_process, ev, data) ftpc_close(connection); } else if((struct ctk_button *)data == &connectbutton) { ctk_dialog_close(); +#if UIP_UDP if(uiplib_ipaddrconv(hostname, (unsigned char *)ipaddr) == 0) { ipaddrptr = resolv_lookup(hostname); if(ipaddrptr == NULL) { @@ -429,7 +434,12 @@ PROCESS_THREAD(ftp_process, ev, data) } else { connection = ftpc_connect(ipaddr, HTONS(21)); show_statustext("Connecting to ", hostname); - } + } +#else /* UIP_UDP */ + uiplib_ipaddrconv(hostname, (unsigned char *)ipaddr); + connection = ftpc_connect(ipaddr, HTONS(21)); + show_statustext("Connecting to ", hostname); +#endif /* UIP_UDP */ } /* if((struct ctk_button *)data == &closebutton) { ftpc_close(connection); diff --git a/apps/irc/irc.c b/apps/irc/irc.c index a0697919f..383c906e5 100644 --- a/apps/irc/irc.c +++ b/apps/irc/irc.c @@ -30,7 +30,7 @@ * * Author: Adam Dunkels * - * $Id: irc.c,v 1.2 2006/08/21 21:39:01 oliverschmidt Exp $ + * $Id: irc.c,v 1.3 2007/09/29 04:12:16 matsutsuka Exp $ */ #include "contiki-conf.h" @@ -230,8 +230,10 @@ PROCESS_THREAD(irc_process, ev, data) if(ev == PROCESS_EVENT_EXIT) { quit(); +#if CTK_CONF_WINDOWCLOSE } else if(ev == ctk_signal_window_close) { quit(); +#endif /* CTK_CONF_WINDOWCLOSE */ } else if(ev == tcpip_event) { ircc_appcall(data); } else if(ev == ctk_signal_widget_activate) { @@ -243,6 +245,7 @@ PROCESS_THREAD(irc_process, ev, data) ctk_window_close(&setupwindow); ctk_window_open(&window); ipaddr = serveraddr; +#if UIP_UDP if(uiplib_ipaddrconv(server, (u8_t *)serveraddr) == 0) { ipaddr = resolv_lookup(server); if(ipaddr == NULL) { @@ -251,11 +254,15 @@ PROCESS_THREAD(irc_process, ev, data) uip_ipaddr_copy(serveraddr, ipaddr); } } +#else /* UIP_UDP */ + uiplib_ipaddrconv(server, (u8_t *)serveraddr); +#endif /* UIP_UDP */ if(ipaddr != NULL) { ircc_connect(&s, server, serveraddr, nick); } } +#if UIP_UDP } else if(ev == resolv_event_found) { ipaddr = resolv_lookup(server); @@ -265,7 +272,7 @@ PROCESS_THREAD(irc_process, ev, data) uip_ipaddr_copy(serveraddr, ipaddr); ircc_connect(&s, server, serveraddr, nick); } - +#endif /* UIP_UDP */ } else if(ev == ctk_signal_keypress) { c = (ctk_arch_key_t)data; if(c == CH_ENTER) { diff --git a/apps/netconf/netconf.c b/apps/netconf/netconf.c index baf9bf841..13685d7f0 100644 --- a/apps/netconf/netconf.c +++ b/apps/netconf/netconf.c @@ -29,7 +29,7 @@ * * This file is part of the Contiki desktop environment * - * $Id: netconf.c,v 1.5 2006/09/18 23:27:42 oliverschmidt Exp $ + * $Id: netconf.c,v 1.6 2007/09/29 04:12:16 matsutsuka Exp $ * */ @@ -55,11 +55,13 @@ static struct ctk_label gatewaylabel = static char gateway[17]; static struct ctk_textentry gatewaytextentry = {CTK_TEXTENTRY(11, 5, 16, 1, gateway, 16)}; +#if UIP_UDP static struct ctk_label dnsserverlabel = {CTK_LABEL(0, 7, 10, 1, "DNS server")}; static char dnsserver[17]; static struct ctk_textentry dnsservertextentry = {CTK_TEXTENTRY(11, 7, 16, 1, dnsserver, 16)}; +#endif /* UIP_UDP */ static struct ctk_button tcpipclosebutton = {CTK_BUTTON(0, 9, 2, "Ok")}; @@ -109,10 +111,12 @@ makestrings(void) uip_getdraddr(&addr); makeaddr(&addr, gateway); +#if UIP_UDP addrptr = resolv_getserver(); if(addrptr != NULL) { makeaddr(addrptr, dnsserver); } +#endif /* UIP_UDP */ } /*-----------------------------------------------------------------------------------*/ static void @@ -144,10 +148,12 @@ apply_tcpipconfig(void) uip_setdraddr(&addr); } +#if UIP_UDP nullterminate(dnsserver); if(uiplib_ipaddrconv(dnsserver, (unsigned char *)&addr)) { resolv_conf(&addr); } +#endif /* UIP_UDP */ } /*-----------------------------------------------------------------------------------*/ static void @@ -171,8 +177,10 @@ PROCESS_THREAD(netconf_process, ev, data) CTK_WIDGET_ADD(&tcpipwindow, &netmasktextentry); CTK_WIDGET_ADD(&tcpipwindow, &gatewaylabel); CTK_WIDGET_ADD(&tcpipwindow, &gatewaytextentry); +#if UIP_UDP CTK_WIDGET_ADD(&tcpipwindow, &dnsserverlabel); CTK_WIDGET_ADD(&tcpipwindow, &dnsservertextentry); +#endif /* UIP_UDP */ CTK_WIDGET_ADD(&tcpipwindow, &tcpipclosebutton); CTK_WIDGET_FOCUS(&tcpipwindow, &ipaddrtextentry); @@ -192,7 +200,10 @@ PROCESS_THREAD(netconf_process, ev, data) ctk_window_close(&tcpipwindow); netconf_quit(); } - } else if(ev == ctk_signal_window_close || + } else if( +#if CTK_CONF_WINDOWCLOSE + ev == ctk_signal_window_close || +#endif ev == PROCESS_EVENT_EXIT) { ctk_window_close(&tcpipwindow); netconf_quit();