Added support for socket descriptors

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@318 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2007-09-01 18:06:15 +00:00
parent c60f939f91
commit 29aeec7b8a
44 changed files with 1900 additions and 1205 deletions
+15 -15
View File
@@ -31,11 +31,12 @@
*
* This file is part of the uIP TCP/IP stack.
*
* $Id: main.c,v 1.2 2007-08-30 23:57:58 patacongo Exp $
* $Id: main.c,v 1.3 2007-09-01 18:06:12 patacongo Exp $
*
*/
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <net/uip/uip.h>
@@ -63,12 +64,11 @@
int user_start(int argc, char *argv[])
{
int i;
uip_ipaddr_t ipaddr;
#if defined(CONFIG_EXAMPLE_UIP_DHCPC)
uint16 mac[6] = {1, 2, 3, 4, 5, 6};
#endif
#ifdef CONFIG_EXAMPLE_UIP_SMTP
#if defined(CONFIG_EXAMPLE_UIP_DHCPC) || defined(CONFIG_EXAMPLE_UIP_SMTP)
void *handle;
#endif
@@ -84,10 +84,20 @@ int user_start(int argc, char *argv[])
#elif defined(CONFIG_EXAMPLE_UIP_TELNETD)
telnetd_init();
#elif defined(CONFIG_EXAMPLE_UIP_DHCPC)
dhcpc_init(&mac, 6);
handle = dhcpc_open(&mac, 6);
if (handle)
{
struct dhcpc_state ds;
(void)dhcpc_request(handle, &ds);
uip_sethostaddr(ds.ipaddr);
uip_setnetmask(ds.netmask);
uip_setdraddr(ds.default_router);
resolv_conf(ds.dnsaddr);
dhcpc_close(handle);
}
#elif defined(CONFIG_EXAMPLE_UIP_SMTP)
uip_ipaddr(ipaddr, 127, 0, 0, 1);
handle = smtp_init();
handle = smtp_open();
if (handle)
{
smtp_configure("localhost", ipaddr);
@@ -131,16 +141,6 @@ void resolv_found(char *name, uint16 *ipaddr)
}
}
#ifdef __DHCPC_H__
void dhcpc_configured(const struct dhcpc_state *s)
{
uip_sethostaddr(s->ipaddr);
uip_setnetmask(s->netmask);
uip_setdraddr(s->default_router);
resolv_conf(s->dnsaddr);
}
#endif /* __DHCPC_H__ */
void webclient_closed(void)
{
printf("Webclient: connection closed\n");