Applications have been modified to support !UIP_UDP and !CTK_CONF_WINDOWCLOSE.

This commit is contained in:
matsutsuka 2007-09-29 04:12:15 +00:00
parent 4381f4b964
commit 7dd756dd36
4 changed files with 43 additions and 9 deletions

View file

@ -29,7 +29,7 @@
* *
* This file is part of the Contiki desktop environment for the C64. * 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; *cptr = 0;
addrptr = &addr[0]; addrptr = &addr[0];
#if UIP_UDP
if(uiplib_ipaddrconv(smtpserver, (unsigned char *)addr) == 0) { if(uiplib_ipaddrconv(smtpserver, (unsigned char *)addr) == 0) {
addrptr = resolv_lookup(smtpserver); addrptr = resolv_lookup(smtpserver);
if(addrptr == NULL) { if(addrptr == NULL) {
@ -181,6 +182,9 @@ applyconfig(void)
return; return;
} }
} }
#else /* UIP_UDP */
uiplib_ipaddrconv(smtpserver, (unsigned char *)addr);
#endif /* UIP_UDP */
smtp_configure("contiki", addrptr); smtp_configure("contiki", addrptr);
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
@ -303,6 +307,7 @@ PROCESS_THREAD(email_process, ev, data)
email_quit(); email_quit();
} }
} }
#if UIP_UDP
} else if(ev == resolv_event_found) { } else if(ev == resolv_event_found) {
if(strcmp(data, smtpserver) == 0) { if(strcmp(data, smtpserver) == 0) {
if(resolv_lookup(smtpserver) != NULL) { if(resolv_lookup(smtpserver) != NULL) {
@ -313,6 +318,7 @@ PROCESS_THREAD(email_process, ev, data)
} }
CTK_WIDGET_REDRAW(&statuslabel); CTK_WIDGET_REDRAW(&statuslabel);
} }
#endif /* UIP_UDP */
} else if(ev == PROCESS_EVENT_EXIT) { } else if(ev == PROCESS_EVENT_EXIT) {
email_quit(); email_quit();
} }

View file

@ -30,7 +30,7 @@
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
* $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. */ /* 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(); quit();
} else if(ev == tcpip_event) { } else if(ev == tcpip_event) {
ftpc_appcall(data); ftpc_appcall(data);
#if UIP_UDP
} else if(ev == resolv_event_found) { } else if(ev == resolv_event_found) {
/* Either found a hostname, or not. */ /* Either found a hostname, or not. */
if((char *)data != NULL && if((char *)data != NULL &&
@ -381,8 +382,11 @@ PROCESS_THREAD(ftp_process, ev, data)
} else { } else {
show_statustext("Host not found: ", hostname); show_statustext("Host not found: ", hostname);
} }
#endif /* UIP_UDP */
} else if(ev == ctk_signal_window_close && } else if(
#if CTK_CONF_WINDOWCLOSE
ev == ctk_signal_window_close &&
#endif /* CTK_CONF_WINDOWCLOSE */
data == (process_data_t)&window) { data == (process_data_t)&window) {
quit(); quit();
} else if(ev == ctk_signal_widget_activate) { } else if(ev == ctk_signal_widget_activate) {
@ -417,6 +421,7 @@ PROCESS_THREAD(ftp_process, ev, data)
ftpc_close(connection); ftpc_close(connection);
} else if((struct ctk_button *)data == &connectbutton) { } else if((struct ctk_button *)data == &connectbutton) {
ctk_dialog_close(); ctk_dialog_close();
#if UIP_UDP
if(uiplib_ipaddrconv(hostname, (unsigned char *)ipaddr) == 0) { if(uiplib_ipaddrconv(hostname, (unsigned char *)ipaddr) == 0) {
ipaddrptr = resolv_lookup(hostname); ipaddrptr = resolv_lookup(hostname);
if(ipaddrptr == NULL) { if(ipaddrptr == NULL) {
@ -429,7 +434,12 @@ PROCESS_THREAD(ftp_process, ev, data)
} else { } else {
connection = ftpc_connect(ipaddr, HTONS(21)); connection = ftpc_connect(ipaddr, HTONS(21));
show_statustext("Connecting to ", hostname); 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) { /* if((struct ctk_button *)data == &closebutton) {
ftpc_close(connection); ftpc_close(connection);

View file

@ -30,7 +30,7 @@
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
* $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" #include "contiki-conf.h"
@ -230,8 +230,10 @@ PROCESS_THREAD(irc_process, ev, data)
if(ev == PROCESS_EVENT_EXIT) { if(ev == PROCESS_EVENT_EXIT) {
quit(); quit();
#if CTK_CONF_WINDOWCLOSE
} else if(ev == ctk_signal_window_close) { } else if(ev == ctk_signal_window_close) {
quit(); quit();
#endif /* CTK_CONF_WINDOWCLOSE */
} else if(ev == tcpip_event) { } else if(ev == tcpip_event) {
ircc_appcall(data); ircc_appcall(data);
} else if(ev == ctk_signal_widget_activate) { } else if(ev == ctk_signal_widget_activate) {
@ -243,6 +245,7 @@ PROCESS_THREAD(irc_process, ev, data)
ctk_window_close(&setupwindow); ctk_window_close(&setupwindow);
ctk_window_open(&window); ctk_window_open(&window);
ipaddr = serveraddr; ipaddr = serveraddr;
#if UIP_UDP
if(uiplib_ipaddrconv(server, (u8_t *)serveraddr) == 0) { if(uiplib_ipaddrconv(server, (u8_t *)serveraddr) == 0) {
ipaddr = resolv_lookup(server); ipaddr = resolv_lookup(server);
if(ipaddr == NULL) { if(ipaddr == NULL) {
@ -251,11 +254,15 @@ PROCESS_THREAD(irc_process, ev, data)
uip_ipaddr_copy(serveraddr, ipaddr); uip_ipaddr_copy(serveraddr, ipaddr);
} }
} }
#else /* UIP_UDP */
uiplib_ipaddrconv(server, (u8_t *)serveraddr);
#endif /* UIP_UDP */
if(ipaddr != NULL) { if(ipaddr != NULL) {
ircc_connect(&s, server, serveraddr, nick); ircc_connect(&s, server, serveraddr, nick);
} }
} }
#if UIP_UDP
} else if(ev == resolv_event_found) { } else if(ev == resolv_event_found) {
ipaddr = resolv_lookup(server); ipaddr = resolv_lookup(server);
@ -265,7 +272,7 @@ PROCESS_THREAD(irc_process, ev, data)
uip_ipaddr_copy(serveraddr, ipaddr); uip_ipaddr_copy(serveraddr, ipaddr);
ircc_connect(&s, server, serveraddr, nick); ircc_connect(&s, server, serveraddr, nick);
} }
#endif /* UIP_UDP */
} else if(ev == ctk_signal_keypress) { } else if(ev == ctk_signal_keypress) {
c = (ctk_arch_key_t)data; c = (ctk_arch_key_t)data;
if(c == CH_ENTER) { if(c == CH_ENTER) {

View file

@ -29,7 +29,7 @@
* *
* This file is part of the Contiki desktop environment * 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 char gateway[17];
static struct ctk_textentry gatewaytextentry = static struct ctk_textentry gatewaytextentry =
{CTK_TEXTENTRY(11, 5, 16, 1, gateway, 16)}; {CTK_TEXTENTRY(11, 5, 16, 1, gateway, 16)};
#if UIP_UDP
static struct ctk_label dnsserverlabel = static struct ctk_label dnsserverlabel =
{CTK_LABEL(0, 7, 10, 1, "DNS server")}; {CTK_LABEL(0, 7, 10, 1, "DNS server")};
static char dnsserver[17]; static char dnsserver[17];
static struct ctk_textentry dnsservertextentry = static struct ctk_textentry dnsservertextentry =
{CTK_TEXTENTRY(11, 7, 16, 1, dnsserver, 16)}; {CTK_TEXTENTRY(11, 7, 16, 1, dnsserver, 16)};
#endif /* UIP_UDP */
static struct ctk_button tcpipclosebutton = static struct ctk_button tcpipclosebutton =
{CTK_BUTTON(0, 9, 2, "Ok")}; {CTK_BUTTON(0, 9, 2, "Ok")};
@ -109,10 +111,12 @@ makestrings(void)
uip_getdraddr(&addr); uip_getdraddr(&addr);
makeaddr(&addr, gateway); makeaddr(&addr, gateway);
#if UIP_UDP
addrptr = resolv_getserver(); addrptr = resolv_getserver();
if(addrptr != NULL) { if(addrptr != NULL) {
makeaddr(addrptr, dnsserver); makeaddr(addrptr, dnsserver);
} }
#endif /* UIP_UDP */
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
static void static void
@ -144,10 +148,12 @@ apply_tcpipconfig(void)
uip_setdraddr(&addr); uip_setdraddr(&addr);
} }
#if UIP_UDP
nullterminate(dnsserver); nullterminate(dnsserver);
if(uiplib_ipaddrconv(dnsserver, (unsigned char *)&addr)) { if(uiplib_ipaddrconv(dnsserver, (unsigned char *)&addr)) {
resolv_conf(&addr); resolv_conf(&addr);
} }
#endif /* UIP_UDP */
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
static void static void
@ -171,8 +177,10 @@ PROCESS_THREAD(netconf_process, ev, data)
CTK_WIDGET_ADD(&tcpipwindow, &netmasktextentry); CTK_WIDGET_ADD(&tcpipwindow, &netmasktextentry);
CTK_WIDGET_ADD(&tcpipwindow, &gatewaylabel); CTK_WIDGET_ADD(&tcpipwindow, &gatewaylabel);
CTK_WIDGET_ADD(&tcpipwindow, &gatewaytextentry); CTK_WIDGET_ADD(&tcpipwindow, &gatewaytextentry);
#if UIP_UDP
CTK_WIDGET_ADD(&tcpipwindow, &dnsserverlabel); CTK_WIDGET_ADD(&tcpipwindow, &dnsserverlabel);
CTK_WIDGET_ADD(&tcpipwindow, &dnsservertextentry); CTK_WIDGET_ADD(&tcpipwindow, &dnsservertextentry);
#endif /* UIP_UDP */
CTK_WIDGET_ADD(&tcpipwindow, &tcpipclosebutton); CTK_WIDGET_ADD(&tcpipwindow, &tcpipclosebutton);
CTK_WIDGET_FOCUS(&tcpipwindow, &ipaddrtextentry); CTK_WIDGET_FOCUS(&tcpipwindow, &ipaddrtextentry);
@ -192,7 +200,10 @@ PROCESS_THREAD(netconf_process, ev, data)
ctk_window_close(&tcpipwindow); ctk_window_close(&tcpipwindow);
netconf_quit(); 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) { ev == PROCESS_EVENT_EXIT) {
ctk_window_close(&tcpipwindow); ctk_window_close(&tcpipwindow);
netconf_quit(); netconf_quit();