Made use of uip_ipaddr_to_quad().

This commit is contained in:
oliverschmidt 2008-01-04 23:28:33 +00:00
parent 74fc3b4576
commit 00d75c8d16
6 changed files with 19 additions and 42 deletions

View file

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: ftpc.c,v 1.2 2006/08/21 21:37:37 oliverschmidt Exp $
* $Id: ftpc.c,v 1.3 2008/01/04 23:30:57 oliverschmidt Exp $
*/
#include "contiki.h"
#include "ftpc.h"
@ -286,10 +286,7 @@ senddata(struct ftp_connection *c)
break;
case STATE_SEND_PORT:
len = sprintf(uip_appdata, "PORT %d,%d,%d,%d,%d,%d\n",
uip_ipaddr1(&uip_hostaddr),
uip_ipaddr2(&uip_hostaddr),
uip_ipaddr3(&uip_hostaddr),
uip_ipaddr4(&uip_hostaddr),
uip_ipaddr_to_quad(&uip_hostaddr),
(c->dataconn.port) >> 8,
(c->dataconn.port) & 0xff);
uip_send(uip_appdata, len);

View file

@ -33,7 +33,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: route.c,v 1.9 2007/12/17 09:20:16 adamdunkels Exp $
* $Id: route.c,v 1.10 2008/01/04 23:33:09 oliverschmidt Exp $
*/
/**
@ -132,14 +132,7 @@ route_lookup(rimeaddr_t *dest)
for(e = list_head(route_table); e != NULL; e = e->next) {
/* printf("route_lookup: comparing %d.%d.%d.%d with %d.%d.%d.%d\n",
uip_ipaddr1(dest),
uip_ipaddr2(dest),
uip_ipaddr3(dest),
uip_ipaddr4(dest),
uip_ipaddr1(&e->dest),
uip_ipaddr2(&e->dest),
uip_ipaddr3(&e->dest),
uip_ipaddr4(&e->dest));*/
uip_ipaddr_to_quad(dest), uip_ipaddr_to_quad(&e->dest));*/
if(rimeaddr_cmp(dest, &e->dest)) {
/* Refresh age of route so that used routes do not get thrown

View file

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: main.c,v 1.9 2008/01/04 23:23:29 oliverschmidt Exp $
* $Id: main.c,v 1.10 2008/01/04 23:28:33 oliverschmidt Exp $
*/
/**
@ -260,23 +260,14 @@ uip_log(char *m)
uip_gethostaddr(&addr);
printf("uIP log at %d.%d.%d.%d: %s\n",
uip_ipaddr1(&addr),
uip_ipaddr2(&addr),
uip_ipaddr3(&addr),
uip_ipaddr4(&addr),
m);
printf("uIP log at %d.%d.%d.%d: %s\n", uip_ipaddr_to_quad(&addr), m);
fflush(NULL);
}
void
configurator_send_config(uip_ipaddr_t *addr, unsigned long seconds)
{
printf("Configurator: address %d.%d.%d.%d, seconds %lu\n",
uip_ipaddr1(addr),
uip_ipaddr2(addr),
uip_ipaddr3(addr),
uip_ipaddr4(addr),
seconds);
uip_ipaddr_to_quad(addr), seconds);
}

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)$Id: client.c,v 1.7 2007/05/21 14:21:35 bg- Exp $
* @(#)$Id: client.c,v 1.8 2008/01/04 23:36:56 oliverschmidt Exp $
*/
/*
@ -75,8 +75,6 @@
#include "codeprop/codeprop.h"
#define ip2quad(p) uip_ipaddr1(p),uip_ipaddr2(p),uip_ipaddr3(p),uip_ipaddr4(p)
/* This is how we force inclusion of the psock library. */
#include "net/psock.h"
void *force_psock_inclusion = &psock_init;
@ -106,7 +104,7 @@ main(int argc, char **argv)
leds_toggle(LEDS_ALL);
slip_arch_init(BAUD2UBR(115200)); /* Must come before first printf */
printf("Starting %s "
"($Id: client.c,v 1.7 2007/05/21 14:21:35 bg- Exp $)\n", __FILE__);
"($Id: client.c,v 1.8 2008/01/04 23:36:56 oliverschmidt Exp $)\n", __FILE__);
ds2411_init();
sensors_light_init();
cc2420_init();
@ -126,7 +124,9 @@ main(int argc, char **argv)
uip_ipaddr_copy(&uip_netmask, &cc2420if.netmask);
uip_ipaddr(&uip_draddr, 172,16,0,1);
printf("IP %d.%d.%d.%d netmask %d.%d.%d.%d default router %d.%d.%d.%d\n",
ip2quad(&uip_hostaddr), ip2quad(&uip_netmask), ip2quad(&uip_draddr));
uip_ipaddr_to_quad(&uip_hostaddr),
uip_ipaddr_to_quad(&uip_netmask),
uip_ipaddr_to_quad(&uip_draddr));
cc2420_set_chan_pan_addr(RF_CHANNEL, panId, uip_hostaddr.u16[1], ds2411_id);
/*

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)$Id: dhclient.c,v 1.10 2007/05/21 14:21:53 bg- Exp $
* @(#)$Id: dhclient.c,v 1.11 2008/01/04 23:36:56 oliverschmidt Exp $
*/
/*
@ -102,7 +102,7 @@ main(int argc, char **argv)
leds_toggle(LEDS_ALL);
slip_arch_init(BAUD2UBR(115200)); /* Must come before first printf */
printf("Starting %s "
"($Id: dhclient.c,v 1.10 2007/05/21 14:21:53 bg- Exp $)\n", __FILE__);
"($Id: dhclient.c,v 1.11 2008/01/04 23:36:56 oliverschmidt Exp $)\n", __FILE__);
ds2411_init();
sensors_light_init();
cc2420_init();
@ -228,15 +228,13 @@ PROCESS_THREAD(dhclient_process, ev, data)
static char is_configured;
#define ip2quad(p) uip_ipaddr1(p),uip_ipaddr2(p),uip_ipaddr3(p),uip_ipaddr4(p)
void
dhcpc_configured(const struct dhcpc_state *s)
{
if(is_configured)
printf("dhcp reconfigure %d.%d.%d.%d\n", ip2quad(&s->ipaddr));
printf("dhcp reconfigure %d.%d.%d.%d\n", uip_ipaddr_to_quad(&s->ipaddr));
else {
printf("dhcpc_configured %d.%d.%d.%d\n", ip2quad(&s->ipaddr));
printf("dhcpc_configured %d.%d.%d.%d\n", uip_ipaddr_to_quad(&s->ipaddr));
leds_toggle(LEDS_GREEN);
is_configured = 1;
process_start(&uaodv_process, NULL);

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)$Id: gateway.c,v 1.10 2007/06/04 18:09:14 bg- Exp $
* @(#)$Id: gateway.c,v 1.11 2008/01/04 23:36:56 oliverschmidt Exp $
*/
/*
@ -76,8 +76,6 @@
#include "codeprop/codeprop.h"
#define ip2quad(p) uip_ipaddr1(p),uip_ipaddr2(p),uip_ipaddr3(p),uip_ipaddr4(p)
/*
* This is how we force inclusion of the psock library and the button
* device driver.
@ -127,7 +125,7 @@ main(int argc, char **argv)
leds_toggle(LEDS_ALL);
slip_arch_init(BAUD2UBR(115200)); /* Must come before first printf */
printf("Starting %s "
"($Id: gateway.c,v 1.10 2007/06/04 18:09:14 bg- Exp $)\n", __FILE__);
"($Id: gateway.c,v 1.11 2008/01/04 23:36:56 oliverschmidt Exp $)\n", __FILE__);
ds2411_init();
sensors_light_init();
cc2420_init();
@ -145,7 +143,7 @@ main(int argc, char **argv)
uip_ipaddr_copy(&uip_hostaddr, &cc2420if.ipaddr);
uip_ipaddr_copy(&uip_netmask, &cc2420if.netmask);
printf("IP %d.%d.%d.%d netmask %d.%d.%d.%d\n",
ip2quad(&uip_hostaddr), ip2quad(&uip_netmask));
uip_ipaddr_to_quad(&uip_hostaddr), uip_ipaddr_to_quad(&uip_netmask));
cc2420_set_chan_pan_addr(RF_CHANNEL, panId, uip_hostaddr.u16[1], ds2411_id);
srand(rand() +