diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-09-16 22:12:04 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-09-16 22:12:04 +0000 |
commit | 9e15c4be04516ac9957f33ea179a188cc2a081a0 (patch) | |
tree | 77fe706483352a68b683ecde64215d54cbc89f4f /nuttx/examples/uip/main.c | |
parent | 4077a70fc256a7dd65febe986f176b8ac62091fc (diff) | |
download | px4-nuttx-9e15c4be04516ac9957f33ea179a188cc2a081a0.tar.gz px4-nuttx-9e15c4be04516ac9957f33ea179a188cc2a081a0.tar.bz2 px4-nuttx-9e15c4be04516ac9957f33ea179a188cc2a081a0.zip |
Associate address with network driver; implement ioctl calls to set addresses
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@345 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples/uip/main.c')
-rw-r--r-- | nuttx/examples/uip/main.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/nuttx/examples/uip/main.c b/nuttx/examples/uip/main.c index 773d430ea..396200069 100644 --- a/nuttx/examples/uip/main.c +++ b/nuttx/examples/uip/main.c @@ -72,6 +72,7 @@ int user_start(int argc, char *argv[]) { + struct in_addr addr; uip_ipaddr_t ipaddr; #if defined(CONFIG_EXAMPLE_UIP_DHCPC) uint16 mac[6] = {1, 2, 3, 4, 5, 6}; @@ -80,12 +81,13 @@ int user_start(int argc, char *argv[]) void *handle; #endif - uip_ipaddr(ipaddr, 192, 168, 0, 2); - uip_sethostaddr(ipaddr); + addr.s_addr = htonl( 192 << 24 | 168 << 16 | 0 << 8 | 2 ); + uip_sethostaddr("eth0", &addr); + uip_ipaddr(ipaddr, 192, 168, 0, 1); - uip_setdraddr(ipaddr); + uip_setdraddr("eth0", &ipaddr); uip_ipaddr(ipaddr, 255, 255, 255, 0); - uip_setnetmask(ipaddr); + uip_setnetmask("eth0", &ipaddr); #if defined(CONFIG_EXAMPLE_UIP_WEBSERVER) httpd_init(); @@ -99,9 +101,9 @@ int user_start(int argc, char *argv[]) { struct dhcpc_state ds; (void)dhcpc_request(handle, &ds); - uip_sethostaddr(ds.ipaddr); - uip_setnetmask(ds.netmask); - uip_setdraddr(ds.default_router); + uip_sethostaddr("eth0", &ds.ipaddr); + uip_setnetmask("eth0", &ds.netmask); + uip_setdraddr("eth0", &ds.default_router); resolv_conf(ds.dnsaddr); dhcpc_close(handle); } |