* More uip_ipaddr_t fixes.

This commit is contained in:
bg- 2006-08-14 14:01:02 +00:00
parent eb7fcb54b4
commit a99f0ca352
3 changed files with 16 additions and 15 deletions

View File

@ -30,7 +30,7 @@
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
* $Id: contiki-main.c,v 1.1 2006/06/17 22:41:35 adamdunkels Exp $ * $Id: contiki-main.c,v 1.2 2006/08/14 14:01:02 bg- Exp $
*/ */
#include "contiki.h" #include "contiki.h"
@ -158,7 +158,7 @@ contiki_main(int flag)
process_start(&tapdev_drv_process, NULL); process_start(&tapdev_drv_process, NULL);
uip_fw_register(&ethernodeif); uip_fw_register(&ethernodeif);
uip_fw_default(&tapif); uip_fw_default(&tapif);
printf("uip_hostaddr %02x%02x\n", uip_hostaddr[0], uip_hostaddr[1]); printf("uip_hostaddr %02x%02x\n", uip_hostaddr.u16[0], uip_hostaddr.u16[1]);
} else { } else {
uip_fw_default(&ethernodeif); uip_fw_default(&ethernodeif);
} }

View File

@ -30,7 +30,7 @@
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
* $Id: main.c,v 1.1 2006/06/17 22:41:35 adamdunkels Exp $ * $Id: main.c,v 1.2 2006/08/14 14:01:02 bg- Exp $
*/ */
/** /**
@ -233,19 +233,20 @@ clock_seconds(void)
void void
uip_log(char *m) uip_log(char *m)
{ {
u16_t addr[2]; uip_ipaddr_t addr;
uip_gethostaddr(addr);
uip_gethostaddr(&addr);
printf("uIP log at %d.%d.%d.%d: %s\n", printf("uIP log at %d.%d.%d.%d: %s\n",
uip_ipaddr1(addr), uip_ipaddr1(&addr),
uip_ipaddr2(addr), uip_ipaddr2(&addr),
uip_ipaddr3(addr), uip_ipaddr3(&addr),
uip_ipaddr4(addr), uip_ipaddr4(&addr),
m); m);
fflush(NULL); fflush(NULL);
} }
void void
configurator_send_config(u16_t *addr, unsigned long seconds) configurator_send_config(uip_ipaddr_t *addr, unsigned long seconds)
{ {
printf("Configurator: address %d.%d.%d.%d, seconds %lu\n", printf("Configurator: address %d.%d.%d.%d, seconds %lu\n",
uip_ipaddr1(addr), uip_ipaddr1(addr),

View File

@ -30,7 +30,7 @@
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
* $Id: node.c,v 1.1 2006/06/17 22:41:35 adamdunkels Exp $ * $Id: node.c,v 1.2 2006/08/14 14:01:02 bg- Exp $
*/ */
#include "node.h" #include "node.h"
#include "contiki.h" #include "contiki.h"
@ -50,7 +50,7 @@ static void init_node_log(void);
void void
node_init(int id, int posx, int posy, int b) node_init(int id, int posx, int posy, int b)
{ {
u16_t addr[2]; uip_ipaddr_t addr;
node.id = id; node.id = id;
node.x = posx; node.x = posx;
@ -58,11 +58,11 @@ node_init(int id, int posx, int posy, int b)
node.type = NODE_TYPE_NORMAL; node.type = NODE_TYPE_NORMAL;
if(b) { if(b) {
uip_ipaddr(addr, 192,168,250,2); uip_ipaddr(&addr, 192,168,250,2);
} else { } else {
uip_ipaddr(addr, 10,10,posx,posy); uip_ipaddr(&addr, 10,10,posx,posy);
} }
uip_sethostaddr(addr); uip_sethostaddr(&addr);
drift = random() % 9572627217; drift = random() % 9572627217;