Updated API for uiplib and resolv to use uip_ipaddr_t instead of uint16_t for compability with IPv6

This commit is contained in:
nifi 2010-05-31 15:22:08 +00:00
parent c13bb8666b
commit b54c6e673b
22 changed files with 194 additions and 106 deletions

View file

@ -29,7 +29,7 @@
*
* This file is part of the "contiki" web browser.
*
* $Id: webclient.c,v 1.8 2010/02/01 19:44:30 oliverschmidt Exp $
* $Id: webclient.c,v 1.9 2010/05/31 15:22:08 nifi Exp $
*
*/
@ -133,25 +133,25 @@ webclient_close(void)
unsigned char
webclient_get(char *host, u16_t port, char *file)
{
uip_ipaddr_t addr;
struct uip_conn *conn;
u16_t *ipaddr;
static u16_t addr[2];
uip_ipaddr_t *ipaddr;
/* First check if the host is an IP address. */
ipaddr = &addr[0];
ipaddr = &addr;
if(uiplib_ipaddrconv(host, &addr) == 0) {
#if UIP_UDP
if(uiplib_ipaddrconv(host, (unsigned char *)addr) == 0) {
ipaddr = resolv_lookup(host);
if(ipaddr == NULL) {
return 0;
}
}
#else /* UIP_UDP */
uiplib_ipaddrconv(host, (unsigned char *)addr);
return 0;
#endif /* UIP_UDP */
}
conn = tcp_connect((uip_ipaddr_t *)ipaddr, htons(port), NULL);
conn = tcp_connect(ipaddr, htons(port), NULL);
if(conn == NULL) {
return 0;