More uip_ipaddr_t fixes.
This commit is contained in:
parent
fca710e447
commit
3e92f843ba
|
@ -60,37 +60,36 @@ makebyte(u8_t byte, char *str)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
makeaddr(u16_t *addr, char *str)
|
||||
makeaddr(uip_ipaddr_t *addr, char *str)
|
||||
{
|
||||
str = makebyte(HTONS(addr[0]) >> 8, str);
|
||||
str = makebyte(addr->u8[0], str);
|
||||
*str++ = '.';
|
||||
str = makebyte(HTONS(addr[0]) & 0xff, str);
|
||||
str = makebyte(addr->u8[1], str);
|
||||
*str++ = '.';
|
||||
str = makebyte(HTONS(addr[1]) >> 8, str);
|
||||
str = makebyte(addr->u8[2], str);
|
||||
*str++ = '.';
|
||||
str = makebyte(HTONS(addr[1]) & 0xff, str);
|
||||
str = makebyte(addr->u8[3], str);
|
||||
*str++ = 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
makestrings(void)
|
||||
{
|
||||
u16_t addr[2], *addrptr;
|
||||
uip_ipaddr_t addr, *addrptr;
|
||||
|
||||
uip_gethostaddr((uip_ipaddr_t *)addr);
|
||||
makeaddr(addr, ipaddr);
|
||||
uip_gethostaddr(&addr);
|
||||
makeaddr(&addr, ipaddr);
|
||||
|
||||
uip_getnetmask((uip_ipaddr_t *)addr);
|
||||
makeaddr(addr, netmask);
|
||||
uip_getnetmask(&addr);
|
||||
makeaddr(&addr, netmask);
|
||||
|
||||
uip_getdraddr((uip_ipaddr_t *)addr);
|
||||
makeaddr(addr, gateway);
|
||||
uip_getdraddr(&addr);
|
||||
makeaddr(&addr, gateway);
|
||||
|
||||
addrptr = resolv_getserver();
|
||||
if(addrptr != NULL) {
|
||||
makeaddr(addrptr, dnsserver);
|
||||
}
|
||||
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(dhcp_process, ev, data)
|
||||
|
@ -146,7 +145,7 @@ dhcpc_configured(const struct dhcpc_state *s)
|
|||
uip_sethostaddr(&s->ipaddr);
|
||||
uip_setnetmask(&s->netmask);
|
||||
uip_setdraddr(&s->default_router);
|
||||
resolv_conf((u16_t *)&s->dnsaddr);
|
||||
resolv_conf(&s->dnsaddr);
|
||||
set_statustext("Configured.");
|
||||
process_post(PROCESS_CURRENT(), SHOWCONFIG, NULL);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
*
|
||||
* This file is part of the Contiki desktop environment
|
||||
*
|
||||
* $Id: netconf.c,v 1.4 2006/09/18 22:48:05 oliverschmidt Exp $
|
||||
* $Id: netconf.c,v 1.5 2006/09/18 23:27:42 oliverschmidt Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -83,31 +83,31 @@ makebyte(u8_t byte, char *str)
|
|||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
makeaddr(u16_t *addr, char *str)
|
||||
makeaddr(uip_ipaddr_t *addr, char *str)
|
||||
{
|
||||
str = makebyte(HTONS(addr[0]) >> 8, str);
|
||||
str = makebyte(addr->u8[0], str);
|
||||
*str++ = '.';
|
||||
str = makebyte(HTONS(addr[0]) & 0xff, str);
|
||||
str = makebyte(addr->u8[1], str);
|
||||
*str++ = '.';
|
||||
str = makebyte(HTONS(addr[1]) >> 8, str);
|
||||
str = makebyte(addr->u8[2], str);
|
||||
*str++ = '.';
|
||||
str = makebyte(HTONS(addr[1]) & 0xff, str);
|
||||
str = makebyte(addr->u8[3], str);
|
||||
*str++ = 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
makestrings(void)
|
||||
{
|
||||
u16_t addr[2], *addrptr;
|
||||
uip_ipaddr_t addr, *addrptr;
|
||||
|
||||
uip_gethostaddr((uip_ipaddr_t *)addr);
|
||||
makeaddr(addr, ipaddr);
|
||||
uip_gethostaddr(&addr);
|
||||
makeaddr(&addr, ipaddr);
|
||||
|
||||
uip_getnetmask((uip_ipaddr_t *)addr);
|
||||
makeaddr(addr, netmask);
|
||||
uip_getnetmask(&addr);
|
||||
makeaddr(&addr, netmask);
|
||||
|
||||
uip_getdraddr((uip_ipaddr_t *)addr);
|
||||
makeaddr(addr, gateway);
|
||||
uip_getdraddr(&addr);
|
||||
makeaddr(&addr, gateway);
|
||||
|
||||
addrptr = resolv_getserver();
|
||||
if(addrptr != NULL) {
|
||||
|
@ -127,26 +127,26 @@ nullterminate(char *cptr)
|
|||
static void
|
||||
apply_tcpipconfig(void)
|
||||
{
|
||||
u16_t addr[2];
|
||||
uip_ipaddr_t addr;
|
||||
|
||||
nullterminate(ipaddr);
|
||||
if(uiplib_ipaddrconv(ipaddr, (unsigned char *)addr)) {
|
||||
uip_sethostaddr((uip_ipaddr_t *)addr);
|
||||
if(uiplib_ipaddrconv(ipaddr, (unsigned char *)&addr)) {
|
||||
uip_sethostaddr(&addr);
|
||||
}
|
||||
|
||||
nullterminate(netmask);
|
||||
if(uiplib_ipaddrconv(netmask, (unsigned char *)addr)) {
|
||||
uip_setnetmask((uip_ipaddr_t *)addr);
|
||||
if(uiplib_ipaddrconv(netmask, (unsigned char *)&addr)) {
|
||||
uip_setnetmask(&addr);
|
||||
}
|
||||
|
||||
nullterminate(gateway);
|
||||
if(uiplib_ipaddrconv(gateway, (unsigned char *)addr)) {
|
||||
uip_setdraddr((uip_ipaddr_t *)addr);
|
||||
if(uiplib_ipaddrconv(gateway, (unsigned char *)&addr)) {
|
||||
uip_setdraddr(&addr);
|
||||
}
|
||||
|
||||
nullterminate(dnsserver);
|
||||
if(uiplib_ipaddrconv(dnsserver, (unsigned char *)addr)) {
|
||||
resolv_conf(addr);
|
||||
if(uiplib_ipaddrconv(dnsserver, (unsigned char *)&addr)) {
|
||||
resolv_conf(&addr);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: resolv.c,v 1.3 2006/08/14 23:37:21 oliverschmidt Exp $
|
||||
* $Id: resolv.c,v 1.4 2006/09/18 23:30:40 oliverschmidt Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -453,13 +453,13 @@ resolv_lookup(char *name)
|
|||
* been configured.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
u16_t *
|
||||
uip_ipaddr_t *
|
||||
resolv_getserver(void)
|
||||
{
|
||||
if(resolv_conn == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return resolv_conn->ripaddr.u16;
|
||||
return &resolv_conn->ripaddr;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/**
|
||||
|
@ -470,11 +470,11 @@ resolv_getserver(void)
|
|||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
resolv_conf(u16_t *dnsserver)
|
||||
resolv_conf(const uip_ipaddr_t *dnsserver)
|
||||
{
|
||||
static u16_t server[2];
|
||||
uip_ipaddr_copy(server, dnsserver);
|
||||
process_post(&resolv_process, EVENT_NEW_SERVER, server);
|
||||
static uip_ipaddr_t server;
|
||||
uip_ipaddr_copy(&server, dnsserver);
|
||||
process_post(&resolv_process, EVENT_NEW_SERVER, &server);
|
||||
|
||||
/* if(resolv_conn != NULL) {
|
||||
uip_udp_remove(resolv_conn);
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: resolv.h,v 1.2 2006/08/26 23:58:45 oliverschmidt Exp $
|
||||
* $Id: resolv.h,v 1.3 2006/09/18 23:30:40 oliverschmidt Exp $
|
||||
*
|
||||
*/
|
||||
#ifndef __RESOLV_H__
|
||||
|
@ -51,8 +51,8 @@ CCIF extern process_event_t resolv_event_found;
|
|||
void resolv_found(char *name, u16_t *ipaddr);
|
||||
|
||||
/* Functions. */
|
||||
CCIF void resolv_conf(u16_t *dnsserver);
|
||||
CCIF u16_t *resolv_getserver(void);
|
||||
CCIF void resolv_conf(const uip_ipaddr_t *dnsserver);
|
||||
CCIF uip_ipaddr_t *resolv_getserver(void);
|
||||
void resolv_init(char *arg);
|
||||
CCIF u16_t *resolv_lookup(char *name);
|
||||
CCIF void resolv_query(char *name);
|
||||
|
|
Loading…
Reference in a new issue