A simple but substantial change: uIP used the htons()/HTONS() macro
functions for converting between host and network byte order. These names are the de facto standard names for this functionality because of the original BSD TCP/IP implementation. But they cause problems for uIP/Contiki: some platforms define these names themselves (Mac OS, most notably), causing compilation problems for Contiki on those platforms. This commit changes all htons to uip_htons instead. Same goes for htonl, ntohs, and ntohl. All-caps versions as well.
This commit is contained in:
parent
5a46c629de
commit
5585d72c86
|
@ -149,10 +149,10 @@ PROCESS_THREAD(cmdd_process, ev, data)
|
||||||
|
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
tcp_listen(HTONS(6581));
|
tcp_listen(UIP_HTONS(6581));
|
||||||
memb_init(&conns);
|
memb_init(&conns);
|
||||||
uip_ipaddr(&ipaddr, 255,255,255,255);
|
uip_ipaddr(&ipaddr, 255,255,255,255);
|
||||||
udpconn = udp_new(&ipaddr, HTONS(6712), NULL);
|
udpconn = udp_new(&ipaddr, UIP_HTONS(6712), NULL);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
PROCESS_WAIT_EVENT();
|
PROCESS_WAIT_EVENT();
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: codeprop-tmp.c,v 1.5 2009/02/27 14:28:02 nvt-se Exp $
|
* @(#)$Id: codeprop-tmp.c,v 1.6 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \addtogroup esb
|
/** \addtogroup esb
|
||||||
|
@ -173,9 +173,9 @@ PROCESS_THREAD(codeprop_process, ev, data)
|
||||||
PT_INIT(&s.udpthread_pt);
|
PT_INIT(&s.udpthread_pt);
|
||||||
PT_INIT(&s.recv_udpthread_pt);
|
PT_INIT(&s.recv_udpthread_pt);
|
||||||
|
|
||||||
tcp_listen(HTONS(CODEPROP_DATA_PORT));
|
tcp_listen(UIP_HTONS(CODEPROP_DATA_PORT));
|
||||||
|
|
||||||
udp_conn = udp_broadcast_new(HTONS(CODEPROP_DATA_PORT), NULL);
|
udp_conn = udp_broadcast_new(UIP_HTONS(CODEPROP_DATA_PORT), NULL);
|
||||||
|
|
||||||
s.state = STATE_NONE;
|
s.state = STATE_NONE;
|
||||||
s.received = 0;
|
s.received = 0;
|
||||||
|
@ -203,9 +203,9 @@ send_udpdata(struct codeprop_udphdr *uh)
|
||||||
{
|
{
|
||||||
u16_t len;
|
u16_t len;
|
||||||
|
|
||||||
uh->type = HTONS(TYPE_DATA);
|
uh->type = UIP_HTONS(TYPE_DATA);
|
||||||
uh->addr = htons(s.addr);
|
uh->addr = uip_htons(s.addr);
|
||||||
uh->id = htons(s.id);
|
uh->id = uip_htons(s.id);
|
||||||
|
|
||||||
if(s.len - s.addr > UDPDATASIZE) {
|
if(s.len - s.addr > UDPDATASIZE) {
|
||||||
len = UDPDATASIZE;
|
len = UDPDATASIZE;
|
||||||
|
@ -218,7 +218,7 @@ send_udpdata(struct codeprop_udphdr *uh)
|
||||||
/* eeprom_read(EEPROMFS_ADDR_CODEPROP + s.addr,
|
/* eeprom_read(EEPROMFS_ADDR_CODEPROP + s.addr,
|
||||||
&uh->data[0], len);*/
|
&uh->data[0], len);*/
|
||||||
|
|
||||||
uh->len = htons(s.len);
|
uh->len = uip_htons(s.len);
|
||||||
|
|
||||||
PRINTF(("codeprop: sending packet from address 0x%04x\n", s.addr));
|
PRINTF(("codeprop: sending packet from address 0x%04x\n", s.addr));
|
||||||
uip_udp_send(len + UDPHEADERSIZE);
|
uip_udp_send(len + UDPHEADERSIZE);
|
||||||
|
@ -247,13 +247,13 @@ PT_THREAD(send_udpthread(struct pt *pt))
|
||||||
PT_WAIT_UNTIL(pt, uip_newdata() || etimer_expired(&s.sendtimer));
|
PT_WAIT_UNTIL(pt, uip_newdata() || etimer_expired(&s.sendtimer));
|
||||||
|
|
||||||
if(uip_newdata()) {
|
if(uip_newdata()) {
|
||||||
if(uh->type == HTONS(TYPE_NACK)) {
|
if(uh->type == UIP_HTONS(TYPE_NACK)) {
|
||||||
PRINTF(("send_udpthread: got NACK for address 0x%x (now 0x%x)\n",
|
PRINTF(("send_udpthread: got NACK for address 0x%x (now 0x%x)\n",
|
||||||
htons(uh->addr), s.addr));
|
uip_htons(uh->addr), s.addr));
|
||||||
/* Only accept a NACK if it points to a lower byte. */
|
/* Only accept a NACK if it points to a lower byte. */
|
||||||
if(htons(uh->addr) <= s.addr) {
|
if(uip_htons(uh->addr) <= s.addr) {
|
||||||
/* beep();*/
|
/* beep();*/
|
||||||
s.addr = htons(uh->addr);
|
s.addr = uip_htons(uh->addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PT_YIELD(pt);
|
PT_YIELD(pt);
|
||||||
|
@ -271,8 +271,8 @@ PT_THREAD(send_udpthread(struct pt *pt))
|
||||||
static void
|
static void
|
||||||
send_nack(struct codeprop_udphdr *uh, unsigned short addr)
|
send_nack(struct codeprop_udphdr *uh, unsigned short addr)
|
||||||
{
|
{
|
||||||
uh->type = HTONS(TYPE_NACK);
|
uh->type = UIP_HTONS(TYPE_NACK);
|
||||||
uh->addr = htons(addr);
|
uh->addr = uip_htons(addr);
|
||||||
uip_udp_send(UDPHEADERSIZE);
|
uip_udp_send(UDPHEADERSIZE);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
|
@ -283,7 +283,7 @@ PT_THREAD(recv_udpthread(struct pt *pt))
|
||||||
struct codeprop_udphdr *uh = (struct codeprop_udphdr *)uip_appdata;
|
struct codeprop_udphdr *uh = (struct codeprop_udphdr *)uip_appdata;
|
||||||
|
|
||||||
/* if(uip_newdata()) {
|
/* if(uip_newdata()) {
|
||||||
PRINTF(("recv_udpthread: id %d uh->id %d\n", s.id, htons(uh->id)));
|
PRINTF(("recv_udpthread: id %d uh->id %d\n", s.id, uip_htons(uh->id)));
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
PT_BEGIN(pt);
|
PT_BEGIN(pt);
|
||||||
|
@ -292,29 +292,29 @@ PT_THREAD(recv_udpthread(struct pt *pt))
|
||||||
|
|
||||||
do {
|
do {
|
||||||
PT_WAIT_UNTIL(pt, uip_newdata() &&
|
PT_WAIT_UNTIL(pt, uip_newdata() &&
|
||||||
uh->type == HTONS(TYPE_DATA) &&
|
uh->type == UIP_HTONS(TYPE_DATA) &&
|
||||||
htons(uh->id) > s.id);
|
uip_htons(uh->id) > s.id);
|
||||||
|
|
||||||
if(htons(uh->addr) != 0) {
|
if(uip_htons(uh->addr) != 0) {
|
||||||
s.addr = 0;
|
s.addr = 0;
|
||||||
send_nack(uh, 0);
|
send_nack(uh, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while(htons(uh->addr) != 0);
|
} while(uip_htons(uh->addr) != 0);
|
||||||
|
|
||||||
/* leds_on(LEDS_YELLOW);
|
/* leds_on(LEDS_YELLOW);
|
||||||
beep_down(10000);*/
|
beep_down(10000);*/
|
||||||
|
|
||||||
s.addr = 0;
|
s.addr = 0;
|
||||||
s.id = htons(uh->id);
|
s.id = uip_htons(uh->id);
|
||||||
s.len = htons(uh->len);
|
s.len = uip_htons(uh->len);
|
||||||
|
|
||||||
timer_set(&s.timer, CONNECTION_TIMEOUT);
|
timer_set(&s.timer, CONNECTION_TIMEOUT);
|
||||||
/* process_post(PROCESS_BROADCAST, codeprop_event_quit, (process_data_t)NULL); */
|
/* process_post(PROCESS_BROADCAST, codeprop_event_quit, (process_data_t)NULL); */
|
||||||
|
|
||||||
while(s.addr < s.len) {
|
while(s.addr < s.len) {
|
||||||
|
|
||||||
if(htons(uh->addr) == s.addr) {
|
if(uip_htons(uh->addr) == s.addr) {
|
||||||
/* leds_blink();*/
|
/* leds_blink();*/
|
||||||
len = uip_datalen() - UDPHEADERSIZE;
|
len = uip_datalen() - UDPHEADERSIZE;
|
||||||
if(len > 0) {
|
if(len > 0) {
|
||||||
|
@ -331,8 +331,8 @@ PT_THREAD(recv_udpthread(struct pt *pt))
|
||||||
s.addr += len;
|
s.addr += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(htons(uh->addr) > s.addr) {
|
} else if(uip_htons(uh->addr) > s.addr) {
|
||||||
PRINTF(("sending nack since 0x%x != 0x%x\n", htons(uh->addr), s.addr));
|
PRINTF(("sending nack since 0x%x != 0x%x\n", uip_htons(uh->addr), s.addr));
|
||||||
send_nack(uh, s.addr);
|
send_nack(uh, s.addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,8 +344,8 @@ PT_THREAD(recv_udpthread(struct pt *pt))
|
||||||
timer_set(&s.nacktimer, HIT_NACK_TIMEOUT);
|
timer_set(&s.nacktimer, HIT_NACK_TIMEOUT);
|
||||||
PT_YIELD_UNTIL(pt, timer_expired(&s.nacktimer) ||
|
PT_YIELD_UNTIL(pt, timer_expired(&s.nacktimer) ||
|
||||||
(uip_newdata() &&
|
(uip_newdata() &&
|
||||||
uh->type == HTONS(TYPE_DATA) &&
|
uh->type == UIP_HTONS(TYPE_DATA) &&
|
||||||
htons(uh->id) == s.id));
|
uip_htons(uh->id) == s.id));
|
||||||
if(timer_expired(&s.nacktimer)) {
|
if(timer_expired(&s.nacktimer)) {
|
||||||
send_nack(uh, s.addr);
|
send_nack(uh, s.addr);
|
||||||
}
|
}
|
||||||
|
@ -394,7 +394,7 @@ PT_THREAD(recv_tcpthread(struct pt *pt))
|
||||||
uip_abort();
|
uip_abort();
|
||||||
}
|
}
|
||||||
th = (struct codeprop_tcphdr *)uip_appdata;
|
th = (struct codeprop_tcphdr *)uip_appdata;
|
||||||
s.len = htons(th->len);
|
s.len = uip_htons(th->len);
|
||||||
s.addr = 0;
|
s.addr = 0;
|
||||||
uip_appdata += sizeof(struct codeprop_tcphdr);
|
uip_appdata += sizeof(struct codeprop_tcphdr);
|
||||||
datalen -= sizeof(struct codeprop_tcphdr);
|
datalen -= sizeof(struct codeprop_tcphdr);
|
||||||
|
@ -484,7 +484,7 @@ uipcall(void *state)
|
||||||
recv_udpthread(&s.recv_udpthread_pt);
|
recv_udpthread(&s.recv_udpthread_pt);
|
||||||
send_udpthread(&s.udpthread_pt);
|
send_udpthread(&s.udpthread_pt);
|
||||||
} else {
|
} else {
|
||||||
if(uip_conn->lport == HTONS(CODEPROP_DATA_PORT)) {
|
if(uip_conn->lport == UIP_HTONS(CODEPROP_DATA_PORT)) {
|
||||||
if(uip_connected()) {
|
if(uip_connected()) {
|
||||||
|
|
||||||
if(state == NULL) {
|
if(state == NULL) {
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: codeprop.c,v 1.1 2006/06/18 07:44:36 adamdunkels Exp $
|
* @(#)$Id: codeprop.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \addtogroup esb
|
/** \addtogroup esb
|
||||||
|
@ -170,9 +170,9 @@ PROCESS_THREAD(codeprop_process, ev, data)
|
||||||
PT_INIT(&s.udpthread_pt);
|
PT_INIT(&s.udpthread_pt);
|
||||||
PT_INIT(&s.recv_udpthread_pt);
|
PT_INIT(&s.recv_udpthread_pt);
|
||||||
|
|
||||||
tcp_listen(HTONS(CODEPROP_DATA_PORT));
|
tcp_listen(UIP_HTONS(CODEPROP_DATA_PORT));
|
||||||
|
|
||||||
udp_conn = udp_broadcast_new(HTONS(CODEPROP_DATA_PORT), NULL);
|
udp_conn = udp_broadcast_new(UIP_HTONS(CODEPROP_DATA_PORT), NULL);
|
||||||
|
|
||||||
codeprop_event_quit = process_alloc_event();
|
codeprop_event_quit = process_alloc_event();
|
||||||
|
|
||||||
|
@ -204,9 +204,9 @@ send_udpdata(struct codeprop_udphdr *uh)
|
||||||
{
|
{
|
||||||
u16_t len;
|
u16_t len;
|
||||||
|
|
||||||
uh->type = HTONS(TYPE_DATA);
|
uh->type = UIP_HTONS(TYPE_DATA);
|
||||||
uh->addr = htons(s.addr);
|
uh->addr = uip_htons(s.addr);
|
||||||
uh->id = htons(s.id);
|
uh->id = uip_htons(s.id);
|
||||||
|
|
||||||
if(s.len - s.addr > UDPDATASIZE) {
|
if(s.len - s.addr > UDPDATASIZE) {
|
||||||
len = UDPDATASIZE;
|
len = UDPDATASIZE;
|
||||||
|
@ -217,7 +217,7 @@ send_udpdata(struct codeprop_udphdr *uh)
|
||||||
eeprom_read(EEPROMFS_ADDR_CODEPROP + s.addr,
|
eeprom_read(EEPROMFS_ADDR_CODEPROP + s.addr,
|
||||||
&uh->data[0], len);
|
&uh->data[0], len);
|
||||||
|
|
||||||
uh->len = htons(s.len);
|
uh->len = uip_htons(s.len);
|
||||||
|
|
||||||
PRINTF(("codeprop: sending packet from address 0x%04x\n", s.addr));
|
PRINTF(("codeprop: sending packet from address 0x%04x\n", s.addr));
|
||||||
uip_udp_send(len + UDPHEADERSIZE);
|
uip_udp_send(len + UDPHEADERSIZE);
|
||||||
|
@ -246,12 +246,12 @@ PT_THREAD(send_udpthread(struct pt *pt))
|
||||||
PT_WAIT_UNTIL(pt, uip_newdata() || etimer_expired(&s.sendtimer));
|
PT_WAIT_UNTIL(pt, uip_newdata() || etimer_expired(&s.sendtimer));
|
||||||
|
|
||||||
if(uip_newdata()) {
|
if(uip_newdata()) {
|
||||||
if(uh->type == HTONS(TYPE_NACK)) {
|
if(uh->type == UIP_HTONS(TYPE_NACK)) {
|
||||||
PRINTF(("send_udpthread: got NACK for address 0x%x (now 0x%x)\n",
|
PRINTF(("send_udpthread: got NACK for address 0x%x (now 0x%x)\n",
|
||||||
htons(uh->addr), s.addr));
|
uip_htons(uh->addr), s.addr));
|
||||||
/* Only accept a NACK if it points to a lower byte. */
|
/* Only accept a NACK if it points to a lower byte. */
|
||||||
if(htons(uh->addr) <= s.addr) {
|
if(uip_htons(uh->addr) <= s.addr) {
|
||||||
s.addr = htons(uh->addr);
|
s.addr = uip_htons(uh->addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PT_YIELD(pt);
|
PT_YIELD(pt);
|
||||||
|
@ -269,8 +269,8 @@ PT_THREAD(send_udpthread(struct pt *pt))
|
||||||
static void
|
static void
|
||||||
send_nack(struct codeprop_udphdr *uh, unsigned short addr)
|
send_nack(struct codeprop_udphdr *uh, unsigned short addr)
|
||||||
{
|
{
|
||||||
uh->type = HTONS(TYPE_NACK);
|
uh->type = UIP_HTONS(TYPE_NACK);
|
||||||
uh->addr = htons(addr);
|
uh->addr = uip_htons(addr);
|
||||||
uip_udp_send(UDPHEADERSIZE);
|
uip_udp_send(UDPHEADERSIZE);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
|
@ -281,7 +281,7 @@ PT_THREAD(recv_udpthread(struct pt *pt))
|
||||||
struct codeprop_udphdr *uh = (struct codeprop_udphdr *)uip_appdata;
|
struct codeprop_udphdr *uh = (struct codeprop_udphdr *)uip_appdata;
|
||||||
|
|
||||||
/* if(uip_newdata()) {
|
/* if(uip_newdata()) {
|
||||||
PRINTF(("recv_udpthread: id %d uh->id %d\n", s.id, htons(uh->id)));
|
PRINTF(("recv_udpthread: id %d uh->id %d\n", s.id, uip_htons(uh->id)));
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
PT_BEGIN(pt);
|
PT_BEGIN(pt);
|
||||||
|
@ -290,28 +290,28 @@ PT_THREAD(recv_udpthread(struct pt *pt))
|
||||||
|
|
||||||
do {
|
do {
|
||||||
PT_WAIT_UNTIL(pt, uip_newdata() &&
|
PT_WAIT_UNTIL(pt, uip_newdata() &&
|
||||||
uh->type == HTONS(TYPE_DATA) &&
|
uh->type == UIP_HTONS(TYPE_DATA) &&
|
||||||
htons(uh->id) > s.id);
|
uip_htons(uh->id) > s.id);
|
||||||
|
|
||||||
if(htons(uh->addr) != 0) {
|
if(uip_htons(uh->addr) != 0) {
|
||||||
s.addr = 0;
|
s.addr = 0;
|
||||||
send_nack(uh, 0);
|
send_nack(uh, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while(htons(uh->addr) != 0);
|
} while(uip_htons(uh->addr) != 0);
|
||||||
|
|
||||||
leds_on(LEDS_YELLOW);
|
leds_on(LEDS_YELLOW);
|
||||||
|
|
||||||
s.addr = 0;
|
s.addr = 0;
|
||||||
s.id = htons(uh->id);
|
s.id = uip_htons(uh->id);
|
||||||
s.len = htons(uh->len);
|
s.len = uip_htons(uh->len);
|
||||||
|
|
||||||
timer_set(&s.timer, CONNECTION_TIMEOUT);
|
timer_set(&s.timer, CONNECTION_TIMEOUT);
|
||||||
process_post(PROCESS_BROADCAST, codeprop_event_quit, (process_data_t)NULL);
|
process_post(PROCESS_BROADCAST, codeprop_event_quit, (process_data_t)NULL);
|
||||||
|
|
||||||
while(s.addr < s.len) {
|
while(s.addr < s.len) {
|
||||||
|
|
||||||
if(htons(uh->addr) == s.addr) {
|
if(uip_htons(uh->addr) == s.addr) {
|
||||||
leds_blink();
|
leds_blink();
|
||||||
len = uip_datalen() - UDPHEADERSIZE;
|
len = uip_datalen() - UDPHEADERSIZE;
|
||||||
if(len > 0) {
|
if(len > 0) {
|
||||||
|
@ -324,8 +324,8 @@ PT_THREAD(recv_udpthread(struct pt *pt))
|
||||||
s.addr += len;
|
s.addr += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(htons(uh->addr) > s.addr) {
|
} else if(uip_htons(uh->addr) > s.addr) {
|
||||||
PRINTF(("sending nack since 0x%x != 0x%x\n", htons(uh->addr), s.addr));
|
PRINTF(("sending nack since 0x%x != 0x%x\n", uip_htons(uh->addr), s.addr));
|
||||||
send_nack(uh, s.addr);
|
send_nack(uh, s.addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,8 +337,8 @@ PT_THREAD(recv_udpthread(struct pt *pt))
|
||||||
timer_set(&s.nacktimer, HIT_NACK_TIMEOUT);
|
timer_set(&s.nacktimer, HIT_NACK_TIMEOUT);
|
||||||
PT_YIELD_UNTIL(pt, timer_expired(&s.nacktimer) ||
|
PT_YIELD_UNTIL(pt, timer_expired(&s.nacktimer) ||
|
||||||
(uip_newdata() &&
|
(uip_newdata() &&
|
||||||
uh->type == HTONS(TYPE_DATA) &&
|
uh->type == UIP_HTONS(TYPE_DATA) &&
|
||||||
htons(uh->id) == s.id));
|
uip_htons(uh->id) == s.id));
|
||||||
if(timer_expired(&s.nacktimer)) {
|
if(timer_expired(&s.nacktimer)) {
|
||||||
send_nack(uh, s.addr);
|
send_nack(uh, s.addr);
|
||||||
}
|
}
|
||||||
|
@ -386,7 +386,7 @@ PT_THREAD(recv_tcpthread(struct pt *pt))
|
||||||
uip_abort();
|
uip_abort();
|
||||||
}
|
}
|
||||||
th = (struct codeprop_tcphdr *)uip_appdata;
|
th = (struct codeprop_tcphdr *)uip_appdata;
|
||||||
s.len = htons(th->len);
|
s.len = uip_htons(th->len);
|
||||||
s.addr = 0;
|
s.addr = 0;
|
||||||
uip_appdata += sizeof(struct codeprop_tcphdr);
|
uip_appdata += sizeof(struct codeprop_tcphdr);
|
||||||
datalen = uip_datalen() - sizeof(struct codeprop_tcphdr);
|
datalen = uip_datalen() - sizeof(struct codeprop_tcphdr);
|
||||||
|
@ -451,7 +451,7 @@ uipcall(void *state)
|
||||||
recv_udpthread(&s.recv_udpthread_pt);
|
recv_udpthread(&s.recv_udpthread_pt);
|
||||||
send_udpthread(&s.udpthread_pt);
|
send_udpthread(&s.udpthread_pt);
|
||||||
} else {
|
} else {
|
||||||
if(uip_conn->lport == HTONS(CODEPROP_DATA_PORT)) {
|
if(uip_conn->lport == UIP_HTONS(CODEPROP_DATA_PORT)) {
|
||||||
if(uip_connected()) {
|
if(uip_connected()) {
|
||||||
|
|
||||||
if(state == NULL) {
|
if(state == NULL) {
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: tcp_loader.c,v 1.3 2006/12/20 13:38:34 bg- Exp $
|
* @(#)$Id: tcp_loader.c,v 1.4 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -70,7 +70,7 @@ PT_THREAD(recv_tcpthread(struct pt *pt))
|
||||||
goto thread_done;
|
goto thread_done;
|
||||||
}
|
}
|
||||||
|
|
||||||
s.len = htons(((struct codeprop_tcphdr *)uip_appdata)->len);
|
s.len = uip_htons(((struct codeprop_tcphdr *)uip_appdata)->len);
|
||||||
s.addr = 0;
|
s.addr = 0;
|
||||||
uip_appdata += sizeof(struct codeprop_tcphdr);
|
uip_appdata += sizeof(struct codeprop_tcphdr);
|
||||||
uip_len -= sizeof(struct codeprop_tcphdr);
|
uip_len -= sizeof(struct codeprop_tcphdr);
|
||||||
|
@ -118,11 +118,11 @@ PROCESS_THREAD(tcp_loader_process, ev, data)
|
||||||
{
|
{
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
tcp_listen(HTONS(CODEPROP_DATA_PORT));
|
tcp_listen(UIP_HTONS(CODEPROP_DATA_PORT));
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
PROCESS_YIELD();
|
PROCESS_YIELD();
|
||||||
if(ev == tcpip_event && uip_conn->lport == HTONS(CODEPROP_DATA_PORT)) {
|
if(ev == tcpip_event && uip_conn->lport == UIP_HTONS(CODEPROP_DATA_PORT)) {
|
||||||
if(uip_connected()) { /* Really uip_connecting()!!! */
|
if(uip_connected()) { /* Really uip_connecting()!!! */
|
||||||
if(data == NULL) {
|
if(data == NULL) {
|
||||||
PT_INIT(&s.tcpthread_pt);
|
PT_INIT(&s.tcpthread_pt);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: tcp_loader2.c,v 1.2 2007/01/12 18:16:56 bg- Exp $
|
* @(#)$Id: tcp_loader2.c,v 1.3 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -77,7 +77,7 @@ PT_THREAD(recv_tcpthread(struct pt *pt))
|
||||||
goto thread_done;
|
goto thread_done;
|
||||||
}
|
}
|
||||||
|
|
||||||
s.len = htons(((struct codeprop_tcphdr *)uip_appdata)->len);
|
s.len = uip_htons(((struct codeprop_tcphdr *)uip_appdata)->len);
|
||||||
s.addr = 0;
|
s.addr = 0;
|
||||||
uip_appdata += sizeof(struct codeprop_tcphdr);
|
uip_appdata += sizeof(struct codeprop_tcphdr);
|
||||||
uip_len -= sizeof(struct codeprop_tcphdr);
|
uip_len -= sizeof(struct codeprop_tcphdr);
|
||||||
|
@ -128,11 +128,11 @@ PROCESS_THREAD(tcp_loader_process, ev, data)
|
||||||
{
|
{
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
tcp_listen(HTONS(CODEPROP_DATA_PORT));
|
tcp_listen(UIP_HTONS(CODEPROP_DATA_PORT));
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
PROCESS_YIELD();
|
PROCESS_YIELD();
|
||||||
if(ev == tcpip_event && uip_conn->lport == HTONS(CODEPROP_DATA_PORT)) {
|
if(ev == tcpip_event && uip_conn->lport == UIP_HTONS(CODEPROP_DATA_PORT)) {
|
||||||
if(uip_connected()) { /* Really uip_connecting()!!! */
|
if(uip_connected()) { /* Really uip_connecting()!!! */
|
||||||
if(data == NULL) {
|
if(data == NULL) {
|
||||||
PT_INIT(&s.tcpthread_pt);
|
PT_INIT(&s.tcpthread_pt);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: smtp-socket.c,v 1.4 2010/05/31 15:22:08 nifi Exp $
|
* $Id: smtp-socket.c,v 1.5 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
#include "smtp.h"
|
#include "smtp.h"
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ smtp_send(char *to, char *cc, char *from, char *subject,
|
||||||
{
|
{
|
||||||
struct uip_conn *conn;
|
struct uip_conn *conn;
|
||||||
|
|
||||||
conn = tcp_connect(&smtpserver, HTONS(25), NULL);
|
conn = tcp_connect(&smtpserver, UIP_HTONS(25), NULL);
|
||||||
if(conn == NULL) {
|
if(conn == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: ftp.c,v 1.9 2010/10/16 09:55:06 oliverschmidt Exp $
|
* $Id: ftp.c,v 1.10 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
/* Note to self: It would be nice to have a "View" option in the download dialog. */
|
/* Note to self: It would be nice to have a "View" option in the download dialog. */
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ PROCESS_THREAD(ftp_process, ev, data)
|
||||||
/* Either found a hostname, or not. */
|
/* Either found a hostname, or not. */
|
||||||
if((char *)data != NULL &&
|
if((char *)data != NULL &&
|
||||||
(ipaddrptr = resolv_lookup((char *)data)) != NULL) {
|
(ipaddrptr = resolv_lookup((char *)data)) != NULL) {
|
||||||
connection = ftpc_connect(ipaddrptr, HTONS(21));
|
connection = ftpc_connect(ipaddrptr, UIP_HTONS(21));
|
||||||
show_statustext("Connecting to ", hostname);
|
show_statustext("Connecting to ", hostname);
|
||||||
} else {
|
} else {
|
||||||
show_statustext("Host not found: ", hostname);
|
show_statustext("Host not found: ", hostname);
|
||||||
|
@ -515,15 +515,15 @@ PROCESS_THREAD(ftp_process, ev, data)
|
||||||
show_statustext("Resolving host ", hostname);
|
show_statustext("Resolving host ", hostname);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
connection = ftpc_connect(ipaddrptr, HTONS(21));
|
connection = ftpc_connect(ipaddrptr, UIP_HTONS(21));
|
||||||
show_statustext("Connecting to ", hostname);
|
show_statustext("Connecting to ", hostname);
|
||||||
} else {
|
} else {
|
||||||
connection = ftpc_connect(&ipaddr, HTONS(21));
|
connection = ftpc_connect(&ipaddr, UIP_HTONS(21));
|
||||||
show_statustext("Connecting to ", hostname);
|
show_statustext("Connecting to ", hostname);
|
||||||
}
|
}
|
||||||
#else /* UIP_UDP */
|
#else /* UIP_UDP */
|
||||||
uiplib_ipaddrconv(hostname, &ipaddr);
|
uiplib_ipaddrconv(hostname, &ipaddr);
|
||||||
connection = ftpc_connect(&ipaddr, HTONS(21));
|
connection = ftpc_connect(&ipaddr, UIP_HTONS(21));
|
||||||
show_statustext("Connecting to ", hostname);
|
show_statustext("Connecting to ", hostname);
|
||||||
#endif /* UIP_UDP */
|
#endif /* UIP_UDP */
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: ftpc.c,v 1.4 2010/05/31 15:22:08 nifi Exp $
|
* $Id: ftpc.c,v 1.5 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
#include "ftpc.h"
|
#include "ftpc.h"
|
||||||
|
@ -123,7 +123,7 @@ void
|
||||||
ftpc_init(void)
|
ftpc_init(void)
|
||||||
{
|
{
|
||||||
memb_init(&connections);
|
memb_init(&connections);
|
||||||
/* tcp_listen(HTONS(DATAPORT));*/
|
/* tcp_listen(UIP_HTONS(DATAPORT));*/
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void *
|
void *
|
||||||
|
@ -141,7 +141,7 @@ ftpc_connect(uip_ipaddr_t *ipaddr, u16_t port)
|
||||||
c->codeptr = 0;
|
c->codeptr = 0;
|
||||||
c->dataconn.type = TYPE_DATA;
|
c->dataconn.type = TYPE_DATA;
|
||||||
c->dataconn.port = DATAPORT;
|
c->dataconn.port = DATAPORT;
|
||||||
tcp_listen(HTONS(DATAPORT));
|
tcp_listen(UIP_HTONS(DATAPORT));
|
||||||
|
|
||||||
if(tcp_connect(ipaddr, port, c) == NULL) {
|
if(tcp_connect(ipaddr, port, c) == NULL) {
|
||||||
memb_free(&connections, c);
|
memb_free(&connections, c);
|
||||||
|
@ -190,9 +190,9 @@ handle_input(struct ftp_connection *c)
|
||||||
c->state == STATE_RETR_SENT ||
|
c->state == STATE_RETR_SENT ||
|
||||||
c->state == STATE_CONNECTED)) {
|
c->state == STATE_CONNECTED)) {
|
||||||
if(code == 226 || code == 550) {
|
if(code == 226 || code == 550) {
|
||||||
tcp_unlisten(htons(c->dataconn.port));
|
tcp_unlisten(uip_htons(c->dataconn.port));
|
||||||
++c->dataconn.port;
|
++c->dataconn.port;
|
||||||
tcp_listen(htons(c->dataconn.port));
|
tcp_listen(uip_htons(c->dataconn.port));
|
||||||
c->state = STATE_SEND_PORT;
|
c->state = STATE_SEND_PORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: ircc.c,v 1.4 2008/11/28 00:15:43 adamdunkels Exp $
|
* $Id: ircc.c,v 1.5 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
@ -472,7 +472,7 @@ struct ircc_state *
|
||||||
ircc_connect(struct ircc_state *s, char *servername, uip_ipaddr_t *ipaddr,
|
ircc_connect(struct ircc_state *s, char *servername, uip_ipaddr_t *ipaddr,
|
||||||
char *nick)
|
char *nick)
|
||||||
{
|
{
|
||||||
s->conn = tcp_connect((uip_ipaddr_t *)ipaddr, HTONS(PORT), s);
|
s->conn = tcp_connect((uip_ipaddr_t *)ipaddr, UIP_HTONS(PORT), s);
|
||||||
if(s->conn == NULL) {
|
if(s->conn == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: servreg-hack.c,v 1.2 2010/06/15 19:32:29 adamdunkels Exp $
|
* $Id: servreg-hack.c,v 1.3 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -355,12 +355,12 @@ PROCESS_THREAD(servreg_hack_process, ev, data)
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
/* Create outbound UDP connection. */
|
/* Create outbound UDP connection. */
|
||||||
outconn = udp_broadcast_new(HTONS(UDP_PORT), NULL);
|
outconn = udp_broadcast_new(UIP_HTONS(UDP_PORT), NULL);
|
||||||
udp_bind(outconn, HTONS(UDP_PORT));
|
udp_bind(outconn, UIP_HTONS(UDP_PORT));
|
||||||
|
|
||||||
/* Create inbound UDP connection. */
|
/* Create inbound UDP connection. */
|
||||||
inconn = udp_new(NULL, HTONS(UDP_PORT), NULL);
|
inconn = udp_new(NULL, UIP_HTONS(UDP_PORT), NULL);
|
||||||
udp_bind(inconn, HTONS(UDP_PORT));
|
udp_bind(inconn, UIP_HTONS(UDP_PORT));
|
||||||
|
|
||||||
etimer_set(&periodic, PERIOD_TIME);
|
etimer_set(&periodic, PERIOD_TIME);
|
||||||
etimer_set(&sendtimer, random_rand() % (PERIOD_TIME));
|
etimer_set(&sendtimer, random_rand() % (PERIOD_TIME));
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: shell-netstat.c,v 1.1 2009/05/10 21:02:24 adamdunkels Exp $
|
* $Id: shell-netstat.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -119,12 +119,12 @@ PROCESS_THREAD(shell_netstat_process, ev, data)
|
||||||
conn = &uip_conns[i];
|
conn = &uip_conns[i];
|
||||||
snprintf(buf, BUFLEN,
|
snprintf(buf, BUFLEN,
|
||||||
"%d, %u.%u.%u.%u:%u, %s, %u, %u, %c %c",
|
"%d, %u.%u.%u.%u:%u, %s, %u, %u, %c %c",
|
||||||
htons(conn->lport),
|
uip_htons(conn->lport),
|
||||||
conn->ripaddr.u8[0],
|
conn->ripaddr.u8[0],
|
||||||
conn->ripaddr.u8[1],
|
conn->ripaddr.u8[1],
|
||||||
conn->ripaddr.u8[2],
|
conn->ripaddr.u8[2],
|
||||||
conn->ripaddr.u8[3],
|
conn->ripaddr.u8[3],
|
||||||
htons(conn->rport),
|
uip_htons(conn->rport),
|
||||||
states[conn->tcpstateflags & UIP_TS_MASK],
|
states[conn->tcpstateflags & UIP_TS_MASK],
|
||||||
conn->nrtx,
|
conn->nrtx,
|
||||||
conn->timer,
|
conn->timer,
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: shell-ping.c,v 1.4 2010/05/31 15:22:08 nifi Exp $
|
* $Id: shell-ping.c,v 1.5 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -113,7 +113,7 @@ send_ping(uip_ipaddr_t *dest_addr)
|
||||||
UIP_ICMP_BUF->type = ICMP_ECHO;
|
UIP_ICMP_BUF->type = ICMP_ECHO;
|
||||||
UIP_ICMP_BUF->icode = 0;
|
UIP_ICMP_BUF->icode = 0;
|
||||||
UIP_ICMP_BUF->id = 0xadad;
|
UIP_ICMP_BUF->id = 0xadad;
|
||||||
UIP_ICMP_BUF->seqno = htons(seqno++);
|
UIP_ICMP_BUF->seqno = uip_htons(seqno++);
|
||||||
|
|
||||||
uip_len = UIP_ICMPH_LEN + UIP_IPH_LEN + PING_DATALEN;
|
uip_len = UIP_ICMPH_LEN + UIP_IPH_LEN + PING_DATALEN;
|
||||||
UIP_IP_BUF->len[0] = (u8_t)((uip_len) >> 8);
|
UIP_IP_BUF->len[0] = (u8_t)((uip_len) >> 8);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: shell-udpsend.c,v 1.6 2010/05/31 15:22:08 nifi Exp $
|
* $Id: shell-udpsend.c,v 1.7 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -95,11 +95,11 @@ PROCESS_THREAD(shell_udpsend_process, ev, data)
|
||||||
port = shell_strtolong(next, &nextptr);
|
port = shell_strtolong(next, &nextptr);
|
||||||
|
|
||||||
uiplib_ipaddrconv(server, &serveraddr);
|
uiplib_ipaddrconv(server, &serveraddr);
|
||||||
udpconn = udp_new(&serveraddr, htons(port), NULL);
|
udpconn = udp_new(&serveraddr, uip_htons(port), NULL);
|
||||||
|
|
||||||
if(next != nextptr) {
|
if(next != nextptr) {
|
||||||
local_port = shell_strtolong(nextptr, &nextptr);
|
local_port = shell_strtolong(nextptr, &nextptr);
|
||||||
udp_bind(udpconn, htons(local_port));
|
udp_bind(udpconn, uip_htons(local_port));
|
||||||
}
|
}
|
||||||
running = 1;
|
running = 1;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki desktop environment
|
* This file is part of the Contiki desktop environment
|
||||||
*
|
*
|
||||||
* $Id: simpletelnet.c,v 1.6 2010/05/31 15:22:08 nifi Exp $
|
* $Id: simpletelnet.c,v 1.7 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ connect(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
conn = tcp_connect(addrptr, htons(port), &ts_appstate);
|
conn = tcp_connect(addrptr, uip_htons(port), &ts_appstate);
|
||||||
if(conn == NULL) {
|
if(conn == NULL) {
|
||||||
show("Out of memory error");
|
show("Out of memory error");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: telnet.c,v 1.2 2009/03/05 23:56:56 adamdunkels Exp $
|
* $Id: telnet.c,v 1.3 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ telnet_connect(struct telnet_state *s, uip_ipaddr_t *addr, u16_t port)
|
||||||
{
|
{
|
||||||
struct uip_conn *conn;
|
struct uip_conn *conn;
|
||||||
|
|
||||||
conn = tcp_connect(addr, htons(port), s);
|
conn = tcp_connect(addr, uip_htons(port), s);
|
||||||
if(conn == NULL) {
|
if(conn == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki desktop OS.
|
* This file is part of the Contiki desktop OS.
|
||||||
*
|
*
|
||||||
* $Id: telnetd.c,v 1.13 2008/10/31 18:07:13 adamdunkels Exp $
|
* $Id: telnetd.c,v 1.14 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ PROCESS_THREAD(telnetd_process, ev, data)
|
||||||
{
|
{
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
tcp_listen(HTONS(23));
|
tcp_listen(UIP_HTONS(23));
|
||||||
buf_init(&buf);
|
buf_init(&buf);
|
||||||
|
|
||||||
shell_init();
|
shell_init();
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: twitter.c,v 1.2 2009/05/11 17:31:13 adamdunkels Exp $
|
* $Id: twitter.c,v 1.3 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -233,7 +233,7 @@ PROCESS_THREAD(twitter_process, ev, data)
|
||||||
|
|
||||||
|
|
||||||
/* Open a TCP connection to port 80 on twitter.com */
|
/* Open a TCP connection to port 80 on twitter.com */
|
||||||
conn = tcp_connect(&s->addr, htons(80), s);
|
conn = tcp_connect(&s->addr, uip_htons(80), s);
|
||||||
if(conn == NULL) {
|
if(conn == NULL) {
|
||||||
PRINTF("Could not open TCP connection\n");
|
PRINTF("Could not open TCP connection\n");
|
||||||
/* memb_free(&conns, s);*/
|
/* memb_free(&conns, s);*/
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: vnc-viewer.c,v 1.3 2007/09/01 00:56:03 matsutsuka Exp $
|
* $Id: vnc-viewer.c,v 1.4 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ vnc_viewer_connect(u16_t *server, u8_t display)
|
||||||
vnc_draw_init();
|
vnc_draw_init();
|
||||||
|
|
||||||
memset(vs, 0, sizeof(struct vnc_viewer_state));
|
memset(vs, 0, sizeof(struct vnc_viewer_state));
|
||||||
conn = uip_connect((uip_ipaddr_t *)server, htons(5900 + display));
|
conn = uip_connect((uip_ipaddr_t *)server, uip_htons(5900 + display));
|
||||||
if(conn == NULL) {
|
if(conn == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -127,9 +127,9 @@ senddata(void)
|
||||||
((struct rfb_set_pixel_format *)dataptr)->format.depth = 8;
|
((struct rfb_set_pixel_format *)dataptr)->format.depth = 8;
|
||||||
((struct rfb_set_pixel_format *)dataptr)->format.endian = 1;
|
((struct rfb_set_pixel_format *)dataptr)->format.endian = 1;
|
||||||
((struct rfb_set_pixel_format *)dataptr)->format.truecolor = 1;
|
((struct rfb_set_pixel_format *)dataptr)->format.truecolor = 1;
|
||||||
((struct rfb_set_pixel_format *)dataptr)->format.red_max = htons(7);
|
((struct rfb_set_pixel_format *)dataptr)->format.red_max = uip_htons(7);
|
||||||
((struct rfb_set_pixel_format *)dataptr)->format.green_max = htons(7);
|
((struct rfb_set_pixel_format *)dataptr)->format.green_max = uip_htons(7);
|
||||||
((struct rfb_set_pixel_format *)dataptr)->format.blue_max = htons(3);
|
((struct rfb_set_pixel_format *)dataptr)->format.blue_max = uip_htons(3);
|
||||||
((struct rfb_set_pixel_format *)dataptr)->format.red_shift = 0;
|
((struct rfb_set_pixel_format *)dataptr)->format.red_shift = 0;
|
||||||
((struct rfb_set_pixel_format *)dataptr)->format.green_shift = 3;
|
((struct rfb_set_pixel_format *)dataptr)->format.green_shift = 3;
|
||||||
((struct rfb_set_pixel_format *)dataptr)->format.blue_shift = 6;
|
((struct rfb_set_pixel_format *)dataptr)->format.blue_shift = 6;
|
||||||
|
@ -140,7 +140,7 @@ senddata(void)
|
||||||
case VNC_SEND_ENCODINGS:
|
case VNC_SEND_ENCODINGS:
|
||||||
PRINTF(("Sending ENCODINGS\n"));
|
PRINTF(("Sending ENCODINGS\n"));
|
||||||
((struct rfb_set_encodings *)dataptr)->type = RFB_SET_ENCODINGS;
|
((struct rfb_set_encodings *)dataptr)->type = RFB_SET_ENCODINGS;
|
||||||
((struct rfb_set_encodings *)dataptr)->encodings = htons(1);
|
((struct rfb_set_encodings *)dataptr)->encodings = uip_htons(1);
|
||||||
dataptr += sizeof(struct rfb_set_encodings);
|
dataptr += sizeof(struct rfb_set_encodings);
|
||||||
dataptr[0] = dataptr[1] = dataptr[2] = 0;
|
dataptr[0] = dataptr[1] = dataptr[2] = 0;
|
||||||
dataptr[3] = RFB_ENC_RAW;
|
dataptr[3] = RFB_ENC_RAW;
|
||||||
|
@ -153,19 +153,19 @@ senddata(void)
|
||||||
case VNC_SEND_UPDATERQ:
|
case VNC_SEND_UPDATERQ:
|
||||||
((struct rfb_fb_update_request *)dataptr)->type = RFB_FB_UPDATE_REQ;
|
((struct rfb_fb_update_request *)dataptr)->type = RFB_FB_UPDATE_REQ;
|
||||||
((struct rfb_fb_update_request *)dataptr)->incremental = 0;
|
((struct rfb_fb_update_request *)dataptr)->incremental = 0;
|
||||||
((struct rfb_fb_update_request *)dataptr)->x = htons(vnc_draw_viewport_x());
|
((struct rfb_fb_update_request *)dataptr)->x = uip_htons(vnc_draw_viewport_x());
|
||||||
((struct rfb_fb_update_request *)dataptr)->y = htons(vnc_draw_viewport_y());
|
((struct rfb_fb_update_request *)dataptr)->y = uip_htons(vnc_draw_viewport_y());
|
||||||
((struct rfb_fb_update_request *)dataptr)->w = htons(vnc_draw_viewport_w());
|
((struct rfb_fb_update_request *)dataptr)->w = uip_htons(vnc_draw_viewport_w());
|
||||||
((struct rfb_fb_update_request *)dataptr)->h = htons(vnc_draw_viewport_h());
|
((struct rfb_fb_update_request *)dataptr)->h = uip_htons(vnc_draw_viewport_h());
|
||||||
uip_send(uip_appdata, sizeof(struct rfb_fb_update_request));
|
uip_send(uip_appdata, sizeof(struct rfb_fb_update_request));
|
||||||
break;
|
break;
|
||||||
case VNC_SEND_UPDATERQ_INC:
|
case VNC_SEND_UPDATERQ_INC:
|
||||||
((struct rfb_fb_update_request *)dataptr)->type = RFB_FB_UPDATE_REQ;
|
((struct rfb_fb_update_request *)dataptr)->type = RFB_FB_UPDATE_REQ;
|
||||||
((struct rfb_fb_update_request *)dataptr)->incremental = 1;
|
((struct rfb_fb_update_request *)dataptr)->incremental = 1;
|
||||||
((struct rfb_fb_update_request *)dataptr)->x = htons(vnc_draw_viewport_x());
|
((struct rfb_fb_update_request *)dataptr)->x = uip_htons(vnc_draw_viewport_x());
|
||||||
((struct rfb_fb_update_request *)dataptr)->y = htons(vnc_draw_viewport_y());
|
((struct rfb_fb_update_request *)dataptr)->y = uip_htons(vnc_draw_viewport_y());
|
||||||
((struct rfb_fb_update_request *)dataptr)->w = htons(vnc_draw_viewport_w());
|
((struct rfb_fb_update_request *)dataptr)->w = uip_htons(vnc_draw_viewport_w());
|
||||||
((struct rfb_fb_update_request *)dataptr)->h = htons(vnc_draw_viewport_h());
|
((struct rfb_fb_update_request *)dataptr)->h = uip_htons(vnc_draw_viewport_h());
|
||||||
uip_send(uip_appdata, sizeof(struct rfb_fb_update_request));
|
uip_send(uip_appdata, sizeof(struct rfb_fb_update_request));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -182,9 +182,9 @@ senddata(void)
|
||||||
((struct rfb_pointer_event *)dataptr)->buttonmask =
|
((struct rfb_pointer_event *)dataptr)->buttonmask =
|
||||||
vs->event_queue[vs->eventptr_unacked].ev.ptr.buttonmask;
|
vs->event_queue[vs->eventptr_unacked].ev.ptr.buttonmask;
|
||||||
((struct rfb_pointer_event *)dataptr)->x =
|
((struct rfb_pointer_event *)dataptr)->x =
|
||||||
htons(vs->event_queue[vs->eventptr_unacked].ev.ptr.x);
|
uip_htons(vs->event_queue[vs->eventptr_unacked].ev.ptr.x);
|
||||||
((struct rfb_pointer_event *)dataptr)->y =
|
((struct rfb_pointer_event *)dataptr)->y =
|
||||||
htons(vs->event_queue[vs->eventptr_unacked].ev.ptr.y);
|
uip_htons(vs->event_queue[vs->eventptr_unacked].ev.ptr.y);
|
||||||
/* uip_send(uip_appdata, sizeof(struct rfb_pointer_event));*/
|
/* uip_send(uip_appdata, sizeof(struct rfb_pointer_event));*/
|
||||||
dataptr += sizeof(struct rfb_pointer_event);
|
dataptr += sizeof(struct rfb_pointer_event);
|
||||||
dataleft -= sizeof(struct rfb_pointer_event);
|
dataleft -= sizeof(struct rfb_pointer_event);
|
||||||
|
@ -209,13 +209,13 @@ senddata(void)
|
||||||
((struct rfb_fb_update_request *)dataptr)->type = RFB_FB_UPDATE_REQ;
|
((struct rfb_fb_update_request *)dataptr)->type = RFB_FB_UPDATE_REQ;
|
||||||
((struct rfb_fb_update_request *)dataptr)->incremental = 0;
|
((struct rfb_fb_update_request *)dataptr)->incremental = 0;
|
||||||
((struct rfb_fb_update_request *)dataptr)->x =
|
((struct rfb_fb_update_request *)dataptr)->x =
|
||||||
htons(vs->event_queue[vs->eventptr_unacked].ev.urq.x);
|
uip_htons(vs->event_queue[vs->eventptr_unacked].ev.urq.x);
|
||||||
((struct rfb_fb_update_request *)dataptr)->y =
|
((struct rfb_fb_update_request *)dataptr)->y =
|
||||||
htons(vs->event_queue[vs->eventptr_unacked].ev.urq.y);
|
uip_htons(vs->event_queue[vs->eventptr_unacked].ev.urq.y);
|
||||||
((struct rfb_fb_update_request *)dataptr)->w =
|
((struct rfb_fb_update_request *)dataptr)->w =
|
||||||
htons(vs->event_queue[vs->eventptr_unacked].ev.urq.w);
|
uip_htons(vs->event_queue[vs->eventptr_unacked].ev.urq.w);
|
||||||
((struct rfb_fb_update_request *)dataptr)->h =
|
((struct rfb_fb_update_request *)dataptr)->h =
|
||||||
htons(vs->event_queue[vs->eventptr_unacked].ev.urq.h);
|
uip_htons(vs->event_queue[vs->eventptr_unacked].ev.urq.h);
|
||||||
/* uip_send(uip_appdata, sizeof(struct rfb_fb_update_request)); */
|
/* uip_send(uip_appdata, sizeof(struct rfb_fb_update_request)); */
|
||||||
dataptr += sizeof(struct rfb_fb_update_request);
|
dataptr += sizeof(struct rfb_fb_update_request);
|
||||||
dataleft -= sizeof(struct rfb_fb_update_request);
|
dataleft -= sizeof(struct rfb_fb_update_request);
|
||||||
|
@ -319,12 +319,12 @@ recv_update_rect(CC_REGISTER_ARG struct rfb_fb_update_rect_hdr *rhdr,
|
||||||
rhdr->encoding[2]) == 0) {
|
rhdr->encoding[2]) == 0) {
|
||||||
switch(rhdr->encoding[3]) {
|
switch(rhdr->encoding[3]) {
|
||||||
case RFB_ENC_RAW:
|
case RFB_ENC_RAW:
|
||||||
vs->rectstateleft = (u32_t)htons(rhdr->rect.w) * (u32_t)htons(rhdr->rect.h);
|
vs->rectstateleft = (u32_t)uip_htons(rhdr->rect.w) * (u32_t)uip_htons(rhdr->rect.h);
|
||||||
vs->rectstate = VNC_RECTSTATE_RAW;
|
vs->rectstate = VNC_RECTSTATE_RAW;
|
||||||
vs->rectstatex0 = vs->rectstatex = htons(rhdr->rect.x);
|
vs->rectstatex0 = vs->rectstatex = uip_htons(rhdr->rect.x);
|
||||||
vs->rectstatey0 = vs->rectstatey = htons(rhdr->rect.y);
|
vs->rectstatey0 = vs->rectstatey = uip_htons(rhdr->rect.y);
|
||||||
vs->rectstatew = htons(rhdr->rect.w);
|
vs->rectstatew = uip_htons(rhdr->rect.w);
|
||||||
vs->rectstateh = htons(rhdr->rect.h);
|
vs->rectstateh = uip_htons(rhdr->rect.h);
|
||||||
vs->rectstatex2 = vs->rectstatex0 + vs->rectstatew;
|
vs->rectstatex2 = vs->rectstatex0 + vs->rectstatew;
|
||||||
vs->rectstatey2 = vs->rectstatey0 + vs->rectstateh;
|
vs->rectstatey2 = vs->rectstatey0 + vs->rectstateh;
|
||||||
break;
|
break;
|
||||||
|
@ -333,11 +333,11 @@ recv_update_rect(CC_REGISTER_ARG struct rfb_fb_update_rect_hdr *rhdr,
|
||||||
rrehdr = (struct rfb_rre_hdr *)((u8_t *)rhdr +
|
rrehdr = (struct rfb_rre_hdr *)((u8_t *)rhdr +
|
||||||
sizeof(struct rfb_fb_update_rect_hdr));
|
sizeof(struct rfb_fb_update_rect_hdr));
|
||||||
PRINTF(("Received RRE subrects %d (%d)\n",
|
PRINTF(("Received RRE subrects %d (%d)\n",
|
||||||
(htons(rrehdr->subrects[1]) << 16) +
|
(uip_htons(rrehdr->subrects[1]) << 16) +
|
||||||
htons(rrehdr->subrects[0]),
|
uip_htons(rrehdr->subrects[0]),
|
||||||
rrehdr->bgpixel));
|
rrehdr->bgpixel));
|
||||||
vs->rectstateleft = ((u32_t)(htons(rrehdr->subrects[1]) << 16) +
|
vs->rectstateleft = ((u32_t)(uip_htons(rrehdr->subrects[1]) << 16) +
|
||||||
(u32_t)htons(rrehdr->subrects[0]));
|
(u32_t)uip_htons(rrehdr->subrects[0]));
|
||||||
vs->rectstate = VNC_RECTSTATE_RRE;
|
vs->rectstate = VNC_RECTSTATE_RRE;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -457,13 +457,13 @@ handle_data(CC_REGISTER_ARG u8_t *data, u16_t datalen)
|
||||||
break;
|
break;
|
||||||
case VNC_WAIT_SINIT:
|
case VNC_WAIT_SINIT:
|
||||||
/* PRINTF(("Server init: w %d h %d, bps %d, d %d, name '%s'\n",
|
/* PRINTF(("Server init: w %d h %d, bps %d, d %d, name '%s'\n",
|
||||||
htons(((struct rfb_server_init *)data)->width),
|
uip_htons(((struct rfb_server_init *)data)->width),
|
||||||
htons(((struct rfb_server_init *)data)->height),
|
uip_htons(((struct rfb_server_init *)data)->height),
|
||||||
((struct rfb_server_init *)data)->format.bps,
|
((struct rfb_server_init *)data)->format.bps,
|
||||||
((struct rfb_server_init *)data)->format.depth,
|
((struct rfb_server_init *)data)->format.depth,
|
||||||
((u8_t *)data + sizeof(struct rfb_server_init))));*/
|
((u8_t *)data + sizeof(struct rfb_server_init))));*/
|
||||||
vs->w = htons(((struct rfb_server_init *)data)->width);
|
vs->w = uip_htons(((struct rfb_server_init *)data)->width);
|
||||||
vs->h = htons(((struct rfb_server_init *)data)->height);
|
vs->h = uip_htons(((struct rfb_server_init *)data)->height);
|
||||||
vs->sendmsg = VNC_SEND_PFMT;
|
vs->sendmsg = VNC_SEND_PFMT;
|
||||||
vs->waitmsg = VNC_WAIT_NONE;
|
vs->waitmsg = VNC_WAIT_NONE;
|
||||||
break;
|
break;
|
||||||
|
@ -473,7 +473,7 @@ handle_data(CC_REGISTER_ARG u8_t *data, u16_t datalen)
|
||||||
switch(*data) {
|
switch(*data) {
|
||||||
case RFB_FB_UPDATE:
|
case RFB_FB_UPDATE:
|
||||||
vs->waitmsg = VNC_WAIT_UPDATE_RECT;
|
vs->waitmsg = VNC_WAIT_UPDATE_RECT;
|
||||||
vs->rectsleft = htons(((struct rfb_fb_update *)data)->rects);
|
vs->rectsleft = uip_htons(((struct rfb_fb_update *)data)->rects);
|
||||||
PRINTF(("Handling RFB FB UPDATE for %d rects\n", vs->rectsleft));
|
PRINTF(("Handling RFB FB UPDATE for %d rects\n", vs->rectsleft));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the "contiki" web browser.
|
* This file is part of the "contiki" web browser.
|
||||||
*
|
*
|
||||||
* $Id: webclient.c,v 1.10 2010/06/14 14:08:17 nifi Exp $
|
* $Id: webclient.c,v 1.11 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ webclient_get(const char *host, u16_t port, const char *file)
|
||||||
#endif /* UIP_UDP */
|
#endif /* UIP_UDP */
|
||||||
}
|
}
|
||||||
|
|
||||||
conn = tcp_connect(ipaddr, htons(port), NULL);
|
conn = tcp_connect(ipaddr, uip_htons(port), NULL);
|
||||||
|
|
||||||
if(conn == NULL) {
|
if(conn == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: httpd-cfs.c,v 1.24 2010/09/28 20:40:52 oliverschmidt Exp $
|
* $Id: httpd-cfs.c,v 1.25 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -271,7 +271,7 @@ httpd_appcall(void *state)
|
||||||
void
|
void
|
||||||
httpd_init(void)
|
httpd_init(void)
|
||||||
{
|
{
|
||||||
tcp_listen(HTONS(80));
|
tcp_listen(UIP_HTONS(80));
|
||||||
memb_init(&conns);
|
memb_init(&conns);
|
||||||
#if URLCONV
|
#if URLCONV
|
||||||
urlconv_init();
|
urlconv_init();
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: httpd-cgi.c,v 1.15 2009/08/12 18:23:37 dak664 Exp $
|
* $Id: httpd-cgi.c,v 1.16 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -163,9 +163,9 @@ make_tcp_stats(void *arg)
|
||||||
httpd_sprint_ip6(conn->ripaddr, buf);
|
httpd_sprint_ip6(conn->ripaddr, buf);
|
||||||
return snprintf((char *)uip_appdata, uip_mss(),
|
return snprintf((char *)uip_appdata, uip_mss(),
|
||||||
"<tr align=\"center\"><td>%d</td><td>%s:%u</td><td>%s</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",
|
"<tr align=\"center\"><td>%d</td><td>%s:%u</td><td>%s</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",
|
||||||
htons(conn->lport),
|
uip_htons(conn->lport),
|
||||||
buf,
|
buf,
|
||||||
htons(conn->rport),
|
uip_htons(conn->rport),
|
||||||
states[conn->tcpstateflags & UIP_TS_MASK],
|
states[conn->tcpstateflags & UIP_TS_MASK],
|
||||||
conn->nrtx,
|
conn->nrtx,
|
||||||
conn->timer,
|
conn->timer,
|
||||||
|
@ -174,12 +174,12 @@ make_tcp_stats(void *arg)
|
||||||
#else
|
#else
|
||||||
return snprintf((char *)uip_appdata, uip_mss(),
|
return snprintf((char *)uip_appdata, uip_mss(),
|
||||||
"<tr align=\"center\"><td>%d</td><td>%u.%u.%u.%u:%u</td><td>%s</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",
|
"<tr align=\"center\"><td>%d</td><td>%u.%u.%u.%u:%u</td><td>%s</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",
|
||||||
htons(conn->lport),
|
uip_htons(conn->lport),
|
||||||
conn->ripaddr.u8[0],
|
conn->ripaddr.u8[0],
|
||||||
conn->ripaddr.u8[1],
|
conn->ripaddr.u8[1],
|
||||||
conn->ripaddr.u8[2],
|
conn->ripaddr.u8[2],
|
||||||
conn->ripaddr.u8[3],
|
conn->ripaddr.u8[3],
|
||||||
htons(conn->rport),
|
uip_htons(conn->rport),
|
||||||
states[conn->tcpstateflags & UIP_TS_MASK],
|
states[conn->tcpstateflags & UIP_TS_MASK],
|
||||||
conn->nrtx,
|
conn->nrtx,
|
||||||
conn->timer,
|
conn->timer,
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: httpd.c,v 1.18 2010/04/11 20:54:39 oliverschmidt Exp $
|
* $Id: httpd.c,v 1.19 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -336,7 +336,7 @@ httpd_appcall(void *state)
|
||||||
void
|
void
|
||||||
httpd_init(void)
|
httpd_init(void)
|
||||||
{
|
{
|
||||||
tcp_listen(HTONS(80));
|
tcp_listen(UIP_HTONS(80));
|
||||||
memb_init(&conns);
|
memb_init(&conns);
|
||||||
httpd_cgi_init();
|
httpd_cgi_init();
|
||||||
}
|
}
|
||||||
|
@ -362,7 +362,7 @@ httpd_sprint_ip6(uip_ip6addr_t addr, char * result)
|
||||||
i += zerocnt;
|
i += zerocnt;
|
||||||
numprinted += zerocnt;
|
numprinted += zerocnt;
|
||||||
} else {
|
} else {
|
||||||
result += sprintf(result, "%x", (unsigned int)(ntohs(addr.u16[i])));
|
result += sprintf(result, "%x", (unsigned int)(uip_ntohs(addr.u16[i])));
|
||||||
i++;
|
i++;
|
||||||
numprinted++;
|
numprinted++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: httpd-socket.c,v 1.1 2007/05/26 22:18:48 oliverschmidt Exp $
|
* $Id: httpd-socket.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
@ -187,7 +187,7 @@ httpd_appcall(void *state)
|
||||||
void
|
void
|
||||||
httpd_init(void)
|
httpd_init(void)
|
||||||
{
|
{
|
||||||
tcp_listen(HTONS(80));
|
tcp_listen(UIP_HTONS(80));
|
||||||
memb_init(&conns);
|
memb_init(&conns);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: ctk-termtelnet.c,v 1.1 2007/05/26 21:46:28 oliverschmidt Exp $
|
* @(#)$Id: ctk-termtelnet.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
#include "loader.h"
|
#include "loader.h"
|
||||||
|
@ -648,7 +648,7 @@ LOADER_INIT_FUNC(ctk_termtelnet_init, arg)
|
||||||
EK_EVENTHANDLER(eventhandler, ev, data)
|
EK_EVENTHANDLER(eventhandler, ev, data)
|
||||||
{
|
{
|
||||||
if(ev == EK_EVENT_INIT) {
|
if(ev == EK_EVENT_INIT) {
|
||||||
tcp_listen(HTONS(PORT));
|
tcp_listen(UIP_HTONS(PORT));
|
||||||
} else if(ev == tcpip_event) {
|
} else if(ev == tcpip_event) {
|
||||||
ctk_termtelnet_appcall(data);
|
ctk_termtelnet_appcall(data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the "ctk" console GUI toolkit for cc65
|
* This file is part of the "ctk" console GUI toolkit for cc65
|
||||||
*
|
*
|
||||||
* $Id: ctk-vncserver-service.c,v 1.1 2007/05/23 23:19:13 oliverschmidt Exp $
|
* $Id: ctk-vncserver-service.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1123,7 +1123,7 @@ EK_EVENTHANDLER(eventhandler, ev, data)
|
||||||
switch(ev) {
|
switch(ev) {
|
||||||
case EK_EVENT_INIT:
|
case EK_EVENT_INIT:
|
||||||
case EK_EVENT_REPLACE:
|
case EK_EVENT_REPLACE:
|
||||||
tcp_listen(HTONS(5900));
|
tcp_listen(UIP_HTONS(5900));
|
||||||
|
|
||||||
for(i = 0; i < CTK_VNCSERVER_CONF_NUMCONNS; ++i) {
|
for(i = 0; i < CTK_VNCSERVER_CONF_NUMCONNS; ++i) {
|
||||||
conns[i].state = VNC_DEALLOCATED;
|
conns[i].state = VNC_DEALLOCATED;
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Mycal Modified uIP TCP/IP stack.
|
* This file is part of the Mycal Modified uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: ipcp.c,v 1.1 2007/05/26 07:14:39 oliverschmidt Exp $
|
* $Id: ipcp.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ ipcp_task(u8_t *buffer)
|
||||||
/* Write length */
|
/* Write length */
|
||||||
t = bptr - buffer;
|
t = bptr - buffer;
|
||||||
/* length here - code and ID + */
|
/* length here - code and ID + */
|
||||||
pkt->len = htons(t);
|
pkt->len = uip_htons(t);
|
||||||
|
|
||||||
DEBUG1(("\n**Sending IPCP Request packet\n"));
|
DEBUG1(("\n**Sending IPCP Request packet\n"));
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Mycal Modified uIP TCP/IP stack.
|
* This file is part of the Mycal Modified uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: lcp.c,v 1.1 2007/05/26 07:14:39 oliverschmidt Exp $
|
* $Id: lcp.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ lcp_task(u8_t *buffer)
|
||||||
#endif
|
#endif
|
||||||
/* Write length */
|
/* Write length */
|
||||||
t = bptr - buffer;
|
t = bptr - buffer;
|
||||||
pkt->len = htons(t); /* length here - code and ID + */
|
pkt->len = uip_htons(t); /* length here - code and ID + */
|
||||||
|
|
||||||
DEBUG1((" len %d\n",t));
|
DEBUG1((" len %d\n",t));
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Mycal Modified uIP TCP/IP stack.
|
* This file is part of the Mycal Modified uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: pap.c,v 1.1 2007/05/26 07:14:39 oliverschmidt Exp $
|
* $Id: pap.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ pap_task(u8_t *buffer)
|
||||||
/* Write length */
|
/* Write length */
|
||||||
t = bptr - buffer;
|
t = bptr - buffer;
|
||||||
/* length here - code and ID + */
|
/* length here - code and ID + */
|
||||||
pkt->len = htons(t);
|
pkt->len = uip_htons(t);
|
||||||
|
|
||||||
DEBUG1((" Len %d\n",t));
|
DEBUG1((" Len %d\n",t));
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Mycal Modified uIP TCP/IP stack.
|
* This file is part of the Mycal Modified uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: ppp.c,v 1.1 2007/05/26 07:14:40 oliverschmidt Exp $
|
* $Id: ppp.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -166,8 +166,8 @@ ppp_reject_protocol(u16_t protocol, u8_t *buffer, u16_t count)
|
||||||
pkt = (LCPPKT *)buffer;
|
pkt = (LCPPKT *)buffer;
|
||||||
pkt->code = PROT_REJ; /* Write Conf_rej */
|
pkt->code = PROT_REJ; /* Write Conf_rej */
|
||||||
/*pkt->id = tid++;*/ /* write tid */
|
/*pkt->id = tid++;*/ /* write tid */
|
||||||
pkt->len = htons(count + 6);
|
pkt->len = uip_htons(count + 6);
|
||||||
*((u16_t *)(&pkt->data[0])) = htons(protocol);
|
*((u16_t *)(&pkt->data[0])) = uip_htons(protocol);
|
||||||
|
|
||||||
ahdlc_tx(LCP, buffer, 0, (u16_t)(count + 6), 0);
|
ahdlc_tx(LCP, buffer, 0, (u16_t)(count + 6), 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: rtl8019as-drv.c,v 1.1 2007/05/26 21:29:12 oliverschmidt Exp $
|
* $Id: rtl8019as-drv.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ rtl8019_drv_idle(void)
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
/* A frame was avaliable (and is now read into the uip_buf), so
|
/* A frame was avaliable (and is now read into the uip_buf), so
|
||||||
we process it. */
|
we process it. */
|
||||||
if(BUF->type == htons(UIP_ETHTYPE_IP)) {
|
if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {
|
||||||
/* debug_print16(uip_len);*/
|
/* debug_print16(uip_len);*/
|
||||||
uip_arp_ipin();
|
uip_arp_ipin();
|
||||||
uip_len -= sizeof(struct uip_eth_hdr);
|
uip_len -= sizeof(struct uip_eth_hdr);
|
||||||
|
@ -111,7 +111,7 @@ rtl8019_drv_idle(void)
|
||||||
uip_arp_out();
|
uip_arp_out();
|
||||||
rtl8019as_send();
|
rtl8019as_send();
|
||||||
}
|
}
|
||||||
} else if(BUF->type == htons(UIP_ETHTYPE_ARP)) {
|
} else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) {
|
||||||
uip_arp_arpin();
|
uip_arp_arpin();
|
||||||
/* If the above function invocation resulted in data that
|
/* If the above function invocation resulted in data that
|
||||||
should be sent out on the network, the global variable
|
should be sent out on the network, the global variable
|
||||||
|
|
|
@ -99,7 +99,7 @@ connect(u16_t *host, u16_t port)
|
||||||
PSOCK_INIT(&s.sout, s.inputbuf, sizeof(s.inputbuf));
|
PSOCK_INIT(&s.sout, s.inputbuf, sizeof(s.inputbuf));
|
||||||
PT_INIT(&s.inpt);
|
PT_INIT(&s.inpt);
|
||||||
PT_INIT(&s.outpt);
|
PT_INIT(&s.outpt);
|
||||||
return tcp_connect(host, htons(port), NULL);
|
return tcp_connect(host, uip_htons(port), NULL);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
PROCESS(cgterm_process, "C/G terminal");
|
PROCESS(cgterm_process, "C/G terminal");
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: eth64-drv.c,v 1.1 2007/05/23 23:11:29 oliverschmidt Exp $
|
* $Id: eth64-drv.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -64,11 +64,11 @@ pollhandler(void)
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
/* A frame was avaliable (and is now read into the uip_buf), so
|
/* A frame was avaliable (and is now read into the uip_buf), so
|
||||||
we process it. */
|
we process it. */
|
||||||
if(BUF->type == HTONS(UIP_ETHTYPE_IP)) {
|
if(BUF->type == UIP_HTONS(UIP_ETHTYPE_IP)) {
|
||||||
uip_arp_ipin();
|
uip_arp_ipin();
|
||||||
uip_len -= sizeof(struct uip_eth_hdr);
|
uip_len -= sizeof(struct uip_eth_hdr);
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
} else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) {
|
} else if(BUF->type == UIP_HTONS(UIP_ETHTYPE_ARP)) {
|
||||||
uip_arp_arpin();
|
uip_arp_arpin();
|
||||||
/* If the above function invocation resulted in data that
|
/* If the above function invocation resulted in data that
|
||||||
should be sent out on the network, the global variable
|
should be sent out on the network, the global variable
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: eth64-dump-drv.c,v 1.1 2007/05/23 23:11:29 oliverschmidt Exp $
|
* $Id: eth64-dump-drv.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -86,11 +86,11 @@ pollhandler(void)
|
||||||
|
|
||||||
/* A frame was avaliable (and is now read into the uip_buf), so
|
/* A frame was avaliable (and is now read into the uip_buf), so
|
||||||
we process it. */
|
we process it. */
|
||||||
if(BUF->type == HTONS(UIP_ETHTYPE_IP)) {
|
if(BUF->type == UIP_HTONS(UIP_ETHTYPE_IP)) {
|
||||||
uip_arp_ipin();
|
uip_arp_ipin();
|
||||||
uip_len -= sizeof(struct uip_eth_hdr);
|
uip_len -= sizeof(struct uip_eth_hdr);
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
} else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) {
|
} else if(BUF->type == UIP_HTONS(UIP_ETHTYPE_ARP)) {
|
||||||
uip_arp_arpin();
|
uip_arp_arpin();
|
||||||
/* If the above function invocation resulted in data that
|
/* If the above function invocation resulted in data that
|
||||||
should be sent out on the network, the global variable
|
should be sent out on the network, the global variable
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: rrnet-drv.c,v 1.1 2007/05/23 23:11:30 oliverschmidt Exp $
|
* $Id: rrnet-drv.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -65,11 +65,11 @@ pollhandler(void)
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
/* A frame was avaliable (and is now read into the uip_buf), so
|
/* A frame was avaliable (and is now read into the uip_buf), so
|
||||||
we process it. */
|
we process it. */
|
||||||
if(BUF->type == HTONS(UIP_ETHTYPE_IP)) {
|
if(BUF->type == UIP_HTONS(UIP_ETHTYPE_IP)) {
|
||||||
uip_arp_ipin();
|
uip_arp_ipin();
|
||||||
uip_len -= sizeof(struct uip_eth_hdr);
|
uip_len -= sizeof(struct uip_eth_hdr);
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
} else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) {
|
} else if(BUF->type == UIP_HTONS(UIP_ETHTYPE_ARP)) {
|
||||||
uip_arp_arpin();
|
uip_arp_arpin();
|
||||||
/* If the above function invocation resulted in data that
|
/* If the above function invocation resulted in data that
|
||||||
should be sent out on the network, the global variable
|
should be sent out on the network, the global variable
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: rrnet-dump-drv.c,v 1.1 2007/05/23 23:11:30 oliverschmidt Exp $
|
* $Id: rrnet-dump-drv.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -86,11 +86,11 @@ pollhandler(void)
|
||||||
|
|
||||||
/* A frame was avaliable (and is now read into the uip_buf), so
|
/* A frame was avaliable (and is now read into the uip_buf), so
|
||||||
we process it. */
|
we process it. */
|
||||||
if(BUF->type == HTONS(UIP_ETHTYPE_IP)) {
|
if(BUF->type == UIP_HTONS(UIP_ETHTYPE_IP)) {
|
||||||
uip_arp_ipin();
|
uip_arp_ipin();
|
||||||
uip_len -= sizeof(struct uip_eth_hdr);
|
uip_len -= sizeof(struct uip_eth_hdr);
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
} else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) {
|
} else if(BUF->type == UIP_HTONS(UIP_ETHTYPE_ARP)) {
|
||||||
uip_arp_arpin();
|
uip_arp_arpin();
|
||||||
/* If the above function invocation resulted in data that
|
/* If the above function invocation resulted in data that
|
||||||
should be sent out on the network, the global variable
|
should be sent out on the network, the global variable
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: tfe-drv.c,v 1.1 2007/05/23 23:11:30 oliverschmidt Exp $
|
* $Id: tfe-drv.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -64,11 +64,11 @@ pollhandler(void)
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
/* A frame was avaliable (and is now read into the uip_buf), so
|
/* A frame was avaliable (and is now read into the uip_buf), so
|
||||||
we process it. */
|
we process it. */
|
||||||
if(BUF->type == HTONS(UIP_ETHTYPE_IP)) {
|
if(BUF->type == UIP_HTONS(UIP_ETHTYPE_IP)) {
|
||||||
uip_arp_ipin();
|
uip_arp_ipin();
|
||||||
uip_len -= sizeof(struct uip_eth_hdr);
|
uip_len -= sizeof(struct uip_eth_hdr);
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
} else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) {
|
} else if(BUF->type == UIP_HTONS(UIP_ETHTYPE_ARP)) {
|
||||||
uip_arp_arpin();
|
uip_arp_arpin();
|
||||||
/* If the above function invocation resulted in data that
|
/* If the above function invocation resulted in data that
|
||||||
should be sent out on the network, the global variable
|
should be sent out on the network, the global variable
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: tfe-dump-drv.c,v 1.1 2007/05/23 23:11:30 oliverschmidt Exp $
|
* $Id: tfe-dump-drv.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -122,11 +122,11 @@ EK_POLLHANDLER(pollhandler)
|
||||||
dump_packet();
|
dump_packet();
|
||||||
/* A frame was avaliable (and is now read into the uip_buf), so
|
/* A frame was avaliable (and is now read into the uip_buf), so
|
||||||
we process it. */
|
we process it. */
|
||||||
if(BUF->type == HTONS(UIP_ETHTYPE_IP)) {
|
if(BUF->type == UIP_HTONS(UIP_ETHTYPE_IP)) {
|
||||||
uip_arp_ipin();
|
uip_arp_ipin();
|
||||||
uip_len -= sizeof(struct uip_eth_hdr);
|
uip_len -= sizeof(struct uip_eth_hdr);
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
} else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) {
|
} else if(BUF->type == UIP_HTONS(UIP_ETHTYPE_ARP)) {
|
||||||
uip_arp_arpin();
|
uip_arp_arpin();
|
||||||
/* If the above function invocation resulted in data that
|
/* If the above function invocation resulted in data that
|
||||||
should be sent out on the network, the global variable
|
should be sent out on the network, the global variable
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki desktop environment
|
* This file is part of the Contiki desktop environment
|
||||||
*
|
*
|
||||||
* $Id: contiki-main.c,v 1.1 2008/01/05 21:08:26 oliverschmidt Exp $
|
* $Id: contiki-main.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ main(int argc, char **argv)
|
||||||
#undef LITTLE_ENDIAN
|
#undef LITTLE_ENDIAN
|
||||||
#undef BIG_ENDIAN
|
#undef BIG_ENDIAN
|
||||||
#undef BYTE_ORDER
|
#undef BYTE_ORDER
|
||||||
#undef HTONS
|
#undef UIP_HTONS
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: client.c,v 1.1 2008/05/27 13:16:34 adamdunkels Exp $
|
* @(#)$Id: client.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -86,7 +86,7 @@ struct uip_fw_netif cc2420if =
|
||||||
PROCESS(button_process, "Button process");
|
PROCESS(button_process, "Button process");
|
||||||
|
|
||||||
/* Radio stuff in network byte order. */
|
/* Radio stuff in network byte order. */
|
||||||
static u16_t panId = HTONS(0x2024);
|
static u16_t panId = UIP_HTONS(0x2024);
|
||||||
|
|
||||||
#ifndef RF_CHANNEL
|
#ifndef RF_CHANNEL
|
||||||
#define RF_CHANNEL 15
|
#define RF_CHANNEL 15
|
||||||
|
@ -104,7 +104,7 @@ main(int argc, char **argv)
|
||||||
leds_toggle(LEDS_ALL);
|
leds_toggle(LEDS_ALL);
|
||||||
slip_arch_init(BAUD2UBR(115200)); /* Must come before first printf */
|
slip_arch_init(BAUD2UBR(115200)); /* Must come before first printf */
|
||||||
printf("Starting %s "
|
printf("Starting %s "
|
||||||
"($Id: client.c,v 1.1 2008/05/27 13:16:34 adamdunkels Exp $)\n", __FILE__);
|
"($Id: client.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $)\n", __FILE__);
|
||||||
ds2411_init();
|
ds2411_init();
|
||||||
sensors_light_init();
|
sensors_light_init();
|
||||||
cc2420_init();
|
cc2420_init();
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: dhclient.c,v 1.1 2008/05/27 13:16:34 adamdunkels Exp $
|
* @(#)$Id: dhclient.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -84,7 +84,7 @@ PROCESS(button_process, "Button process");
|
||||||
PROCESS(dhclient_process, "Dhclient process");
|
PROCESS(dhclient_process, "Dhclient process");
|
||||||
|
|
||||||
/* Radio stuff in network byte order. */
|
/* Radio stuff in network byte order. */
|
||||||
static u16_t panId = HTONS(0x2024);
|
static u16_t panId = UIP_HTONS(0x2024);
|
||||||
|
|
||||||
#ifndef RF_CHANNEL
|
#ifndef RF_CHANNEL
|
||||||
#define RF_CHANNEL 15
|
#define RF_CHANNEL 15
|
||||||
|
@ -102,7 +102,7 @@ main(int argc, char **argv)
|
||||||
leds_toggle(LEDS_ALL);
|
leds_toggle(LEDS_ALL);
|
||||||
slip_arch_init(BAUD2UBR(115200)); /* Must come before first printf */
|
slip_arch_init(BAUD2UBR(115200)); /* Must come before first printf */
|
||||||
printf("Starting %s "
|
printf("Starting %s "
|
||||||
"($Id: dhclient.c,v 1.1 2008/05/27 13:16:34 adamdunkels Exp $)\n", __FILE__);
|
"($Id: dhclient.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $)\n", __FILE__);
|
||||||
ds2411_init();
|
ds2411_init();
|
||||||
sensors_light_init();
|
sensors_light_init();
|
||||||
cc2420_init();
|
cc2420_init();
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: gateway.c,v 1.1 2008/05/27 13:16:34 adamdunkels Exp $
|
* @(#)$Id: gateway.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -107,7 +107,7 @@ static struct uip_fw_netif slipif =
|
||||||
{UIP_FW_NETIF(0,0,0,0, 255,255,255,255, slip_send)};
|
{UIP_FW_NETIF(0,0,0,0, 255,255,255,255, slip_send)};
|
||||||
|
|
||||||
/* Radio stuff in network byte order. */
|
/* Radio stuff in network byte order. */
|
||||||
static u16_t panId = HTONS(0x2024);
|
static u16_t panId = UIP_HTONS(0x2024);
|
||||||
|
|
||||||
#ifndef RF_CHANNEL
|
#ifndef RF_CHANNEL
|
||||||
#define RF_CHANNEL 15
|
#define RF_CHANNEL 15
|
||||||
|
@ -125,7 +125,7 @@ main(int argc, char **argv)
|
||||||
leds_toggle(LEDS_ALL);
|
leds_toggle(LEDS_ALL);
|
||||||
slip_arch_init(BAUD2UBR(115200)); /* Must come before first printf */
|
slip_arch_init(BAUD2UBR(115200)); /* Must come before first printf */
|
||||||
printf("Starting %s "
|
printf("Starting %s "
|
||||||
"($Id: gateway.c,v 1.1 2008/05/27 13:16:34 adamdunkels Exp $)\n", __FILE__);
|
"($Id: gateway.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $)\n", __FILE__);
|
||||||
ds2411_init();
|
ds2411_init();
|
||||||
sensors_light_init();
|
sensors_light_init();
|
||||||
cc2420_init();
|
cc2420_init();
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: udprecv.c,v 1.1 2008/05/27 13:16:34 adamdunkels Exp $
|
* @(#)$Id: udprecv.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -51,8 +51,8 @@ PROCESS_THREAD(udprecv_process, ev, data)
|
||||||
{
|
{
|
||||||
uip_ipaddr_t any;
|
uip_ipaddr_t any;
|
||||||
uip_ipaddr(&any, 0,0,0,0);
|
uip_ipaddr(&any, 0,0,0,0);
|
||||||
c = udp_new(&any, HTONS(0), NULL);
|
c = udp_new(&any, UIP_HTONS(0), NULL);
|
||||||
uip_udp_bind(c, HTONS(4321));
|
uip_udp_bind(c, UIP_HTONS(4321));
|
||||||
}
|
}
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: udpsend.c,v 1.1 2008/05/27 13:16:34 adamdunkels Exp $
|
* @(#)$Id: udpsend.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Set the IP destination address to something different from the
|
/* Set the IP destination address to something different from the
|
||||||
|
@ -60,7 +60,7 @@ PROCESS_THREAD(udpsend_process, ev, data)
|
||||||
{
|
{
|
||||||
uip_ipaddr_t addr;
|
uip_ipaddr_t addr;
|
||||||
uip_ipaddr(&addr, 255,255,255,255); /* Change address here! */
|
uip_ipaddr(&addr, 255,255,255,255); /* Change address here! */
|
||||||
c = udp_new(&addr, HTONS(4321), NULL);
|
c = udp_new(&addr, UIP_HTONS(4321), NULL);
|
||||||
c->ttl = 1; /* One hop only. */
|
c->ttl = 1; /* One hop only. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the "ctk" console GUI toolkit for cc65
|
* This file is part of the "ctk" console GUI toolkit for cc65
|
||||||
*
|
*
|
||||||
* $Id: ctk-vncserver.c,v 1.2 2006/08/30 22:24:12 oliverschmidt Exp $
|
* $Id: ctk-vncserver.c,v 1.3 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1082,7 +1082,7 @@ PROCESS_THREAD(ctk_vncserver_process, ev, data)
|
||||||
|
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
tcp_listen(HTONS(5900));
|
tcp_listen(UIP_HTONS(5900));
|
||||||
|
|
||||||
for(i = 0; i < CTK_VNCSERVER_CONF_NUMCONNS; ++i) {
|
for(i = 0; i < CTK_VNCSERVER_CONF_NUMCONNS; ++i) {
|
||||||
conns[i].state = VNC_DEALLOCATED;
|
conns[i].state = VNC_DEALLOCATED;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: vnc-out.c,v 1.2 2007/08/30 14:39:18 matsutsuka Exp $
|
* $Id: vnc-out.c,v 1.3 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -555,14 +555,14 @@ vnc_out_send_blank(CC_REGISTER_ARG struct vnc_server_state *vs)
|
||||||
umsg = (struct rfb_fb_update *)uip_appdata;
|
umsg = (struct rfb_fb_update *)uip_appdata;
|
||||||
|
|
||||||
umsg->type = RFB_FB_UPDATE;
|
umsg->type = RFB_FB_UPDATE;
|
||||||
umsg->rects = HTONS(2);
|
umsg->rects = UIP_HTONS(2);
|
||||||
|
|
||||||
ptr = (u8_t *)umsg + sizeof(struct rfb_fb_update);
|
ptr = (u8_t *)umsg + sizeof(struct rfb_fb_update);
|
||||||
len = sizeof(struct rfb_fb_update);
|
len = sizeof(struct rfb_fb_update);
|
||||||
|
|
||||||
msglen = vnc_server_draw_rect(ptr, 0, 0,
|
msglen = vnc_server_draw_rect(ptr, 0, 0,
|
||||||
HTONS(SCREEN_WIDTH),
|
UIP_HTONS(SCREEN_WIDTH),
|
||||||
HTONS(SCREEN_HEIGHT),
|
UIP_HTONS(SCREEN_HEIGHT),
|
||||||
BORDER_COLOR);
|
BORDER_COLOR);
|
||||||
|
|
||||||
|
|
||||||
|
@ -570,9 +570,9 @@ vnc_out_send_blank(CC_REGISTER_ARG struct vnc_server_state *vs)
|
||||||
len += msglen;
|
len += msglen;
|
||||||
|
|
||||||
msglen = vnc_server_draw_rect(ptr,
|
msglen = vnc_server_draw_rect(ptr,
|
||||||
HTONS(SCREEN_X), HTONS(SCREEN_Y),
|
UIP_HTONS(SCREEN_X), UIP_HTONS(SCREEN_Y),
|
||||||
HTONS(SCREEN_WIDTH - SCREEN_X * 2),
|
UIP_HTONS(SCREEN_WIDTH - SCREEN_X * 2),
|
||||||
HTONS(SCREEN_HEIGHT - SCREEN_Y * 2),
|
UIP_HTONS(SCREEN_HEIGHT - SCREEN_Y * 2),
|
||||||
SCREEN_COLOR);
|
SCREEN_COLOR);
|
||||||
|
|
||||||
uip_send(uip_appdata, len + msglen);
|
uip_send(uip_appdata, len + msglen);
|
||||||
|
@ -690,11 +690,11 @@ vnc_out_send_update(CC_REGISTER_ARG struct vnc_server_state *vs)
|
||||||
y * CTK_VNCFONT_HEIGHT,
|
y * CTK_VNCFONT_HEIGHT,
|
||||||
CTK_VNCFONT_WIDTH * numblanks,
|
CTK_VNCFONT_WIDTH * numblanks,
|
||||||
CTK_VNCFONT_HEIGHT));*/
|
CTK_VNCFONT_HEIGHT));*/
|
||||||
recthdr->rect.x = htons(SCREEN_X + (x - numblanks) *
|
recthdr->rect.x = uip_htons(SCREEN_X + (x - numblanks) *
|
||||||
CTK_VNCFONT_WIDTH);
|
CTK_VNCFONT_WIDTH);
|
||||||
recthdr->rect.y = htons(SCREEN_Y + y * CTK_VNCFONT_HEIGHT);
|
recthdr->rect.y = uip_htons(SCREEN_Y + y * CTK_VNCFONT_HEIGHT);
|
||||||
recthdr->rect.w = htons(CTK_VNCFONT_WIDTH * numblanks);
|
recthdr->rect.w = uip_htons(CTK_VNCFONT_WIDTH * numblanks);
|
||||||
recthdr->rect.h = HTONS(CTK_VNCFONT_HEIGHT);
|
recthdr->rect.h = UIP_HTONS(CTK_VNCFONT_HEIGHT);
|
||||||
recthdr->encoding[0] =
|
recthdr->encoding[0] =
|
||||||
recthdr->encoding[1] =
|
recthdr->encoding[1] =
|
||||||
recthdr->encoding[2] = 0;
|
recthdr->encoding[2] = 0;
|
||||||
|
@ -732,10 +732,10 @@ vnc_out_send_update(CC_REGISTER_ARG struct vnc_server_state *vs)
|
||||||
/* recthdr = (struct rfb_fb_update_rect_hdr *)ptr;*/
|
/* recthdr = (struct rfb_fb_update_rect_hdr *)ptr;*/
|
||||||
recthdr = (struct rfb_fb_update_rect_hdr *)tmpbuf;
|
recthdr = (struct rfb_fb_update_rect_hdr *)tmpbuf;
|
||||||
|
|
||||||
recthdr->rect.x = htons(SCREEN_X + x * CTK_VNCFONT_WIDTH);
|
recthdr->rect.x = uip_htons(SCREEN_X + x * CTK_VNCFONT_WIDTH);
|
||||||
recthdr->rect.y = htons(SCREEN_Y + y * CTK_VNCFONT_HEIGHT);
|
recthdr->rect.y = uip_htons(SCREEN_Y + y * CTK_VNCFONT_HEIGHT);
|
||||||
recthdr->rect.w = HTONS(CTK_VNCFONT_WIDTH);
|
recthdr->rect.w = UIP_HTONS(CTK_VNCFONT_WIDTH);
|
||||||
recthdr->rect.h = HTONS(CTK_VNCFONT_HEIGHT);
|
recthdr->rect.h = UIP_HTONS(CTK_VNCFONT_HEIGHT);
|
||||||
recthdr->encoding[0] =
|
recthdr->encoding[0] =
|
||||||
recthdr->encoding[1] =
|
recthdr->encoding[1] =
|
||||||
recthdr->encoding[2] = 0;
|
recthdr->encoding[2] = 0;
|
||||||
|
@ -756,7 +756,7 @@ vnc_out_send_update(CC_REGISTER_ARG struct vnc_server_state *vs)
|
||||||
|
|
||||||
loopend:
|
loopend:
|
||||||
|
|
||||||
umsg->rects = htons(n);
|
umsg->rects = uip_htons(n);
|
||||||
|
|
||||||
if(y == vs->y + vs->h && x == vs->x + vs->w) {
|
if(y == vs->y + vs->h && x == vs->x + vs->w) {
|
||||||
vs->x2 = vs->y2 = 0;
|
vs->x2 = vs->y2 = 0;
|
||||||
|
@ -841,8 +841,8 @@ vnc_out_pointer_event(struct vnc_server_state *vs)
|
||||||
|
|
||||||
ev = (struct rfb_pointer_event *)uip_appdata;
|
ev = (struct rfb_pointer_event *)uip_appdata;
|
||||||
|
|
||||||
evx = htons(ev->x);
|
evx = uip_htons(ev->x);
|
||||||
evy = htons(ev->y);
|
evy = uip_htons(ev->y);
|
||||||
|
|
||||||
if(evx > SCREEN_X && evx < SCREEN_WIDTH - 2 * SCREEN_X &&
|
if(evx > SCREEN_X && evx < SCREEN_WIDTH - 2 * SCREEN_X &&
|
||||||
evy > SCREEN_Y && evy < SCREEN_HEIGHT - 2 * SCREEN_Y) {
|
evy > SCREEN_Y && evy < SCREEN_HEIGHT - 2 * SCREEN_Y) {
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: vnc-server.c,v 1.2 2007/08/30 14:39:17 matsutsuka Exp $
|
* $Id: vnc-server.c,v 1.3 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -164,16 +164,16 @@ vnc_server_send_data(struct vnc_server_state *vs)
|
||||||
break;
|
break;
|
||||||
case VNC_INIT:
|
case VNC_INIT:
|
||||||
initmsg = (struct rfb_server_init *)uip_appdata;
|
initmsg = (struct rfb_server_init *)uip_appdata;
|
||||||
initmsg->width = htons(vs->width);
|
initmsg->width = uip_htons(vs->width);
|
||||||
initmsg->height = htons(vs->height);
|
initmsg->height = uip_htons(vs->height);
|
||||||
/* BGR233 pixel format. */
|
/* BGR233 pixel format. */
|
||||||
initmsg->format.bps = 8;
|
initmsg->format.bps = 8;
|
||||||
initmsg->format.depth = 8;
|
initmsg->format.depth = 8;
|
||||||
initmsg->format.endian = 1;
|
initmsg->format.endian = 1;
|
||||||
initmsg->format.truecolor = 1;
|
initmsg->format.truecolor = 1;
|
||||||
initmsg->format.red_max = htons(7);
|
initmsg->format.red_max = uip_htons(7);
|
||||||
initmsg->format.green_max = htons(7);
|
initmsg->format.green_max = uip_htons(7);
|
||||||
initmsg->format.blue_max = htons(3);
|
initmsg->format.blue_max = uip_htons(3);
|
||||||
initmsg->format.red_shift = 0;
|
initmsg->format.red_shift = 0;
|
||||||
initmsg->format.green_shift = 3;
|
initmsg->format.green_shift = 3;
|
||||||
initmsg->format.blue_shift = 6;
|
initmsg->format.blue_shift = 6;
|
||||||
|
@ -315,7 +315,7 @@ vnc_read_data(CC_REGISTER_ARG struct vnc_server_state *vs)
|
||||||
case RFB_SET_ENCODINGS:
|
case RFB_SET_ENCODINGS:
|
||||||
PRINTF(("Set encodings\n"));
|
PRINTF(("Set encodings\n"));
|
||||||
vs->readlen = sizeof(struct rfb_set_encoding);
|
vs->readlen = sizeof(struct rfb_set_encoding);
|
||||||
vs->readlen += htons(((struct rfb_set_encoding *)appdata)->encodings) * 4;
|
vs->readlen += uip_htons(((struct rfb_set_encoding *)appdata)->encodings) * 4;
|
||||||
/* Make sure that client supports the encodings we use. */
|
/* Make sure that client supports the encodings we use. */
|
||||||
/* XXX: not implemented yet. */
|
/* XXX: not implemented yet. */
|
||||||
break;
|
break;
|
||||||
|
@ -441,7 +441,7 @@ void
|
||||||
vnc_server_appcall(struct vnc_server_state *vs)
|
vnc_server_appcall(struct vnc_server_state *vs)
|
||||||
{
|
{
|
||||||
|
|
||||||
vs->type = htons(uip_conn->lport) - 5900;
|
vs->type = uip_htons(uip_conn->lport) - 5900;
|
||||||
|
|
||||||
if(uip_connected()) {
|
if(uip_connected()) {
|
||||||
vnc_new(vs);
|
vnc_new(vs);
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: slip.c,v 1.10 2010/03/17 07:10:25 nifi Exp $
|
* @(#)$Id: slip.c,v 1.11 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ PROCESS_THREAD(slip_process, ev, data)
|
||||||
u16_t nid = ip_id++;
|
u16_t nid = ip_id++;
|
||||||
BUF->ipid[0] = nid >> 8;
|
BUF->ipid[0] = nid >> 8;
|
||||||
BUF->ipid[1] = nid;
|
BUF->ipid[1] = nid;
|
||||||
nid = htons(nid);
|
nid = uip_htons(nid);
|
||||||
nid = ~nid; /* negate */
|
nid = ~nid; /* negate */
|
||||||
BUF->ipchksum += nid; /* add */
|
BUF->ipchksum += nid; /* add */
|
||||||
if(BUF->ipchksum < nid) { /* 1-complement overflow? */
|
if(BUF->ipchksum < nid) { /* 1-complement overflow? */
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: dhcpc.c,v 1.8 2007/08/30 14:39:17 matsutsuka Exp $
|
* @(#)$Id: dhcpc.c,v 1.9 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -147,7 +147,7 @@ create_msg(CC_REGISTER_ARG struct dhcp_msg *m)
|
||||||
m->hops = 0;
|
m->hops = 0;
|
||||||
memcpy(m->xid, &xid, sizeof(m->xid));
|
memcpy(m->xid, &xid, sizeof(m->xid));
|
||||||
m->secs = 0;
|
m->secs = 0;
|
||||||
m->flags = HTONS(BOOTP_BROADCAST); /* Broadcast bit. */
|
m->flags = UIP_HTONS(BOOTP_BROADCAST); /* Broadcast bit. */
|
||||||
/* uip_ipaddr_copy(m->ciaddr, uip_hostaddr);*/
|
/* uip_ipaddr_copy(m->ciaddr, uip_hostaddr);*/
|
||||||
memcpy(m->ciaddr, uip_hostaddr.u16, sizeof(m->ciaddr));
|
memcpy(m->ciaddr, uip_hostaddr.u16, sizeof(m->ciaddr));
|
||||||
memset(m->yiaddr, 0, sizeof(m->yiaddr));
|
memset(m->yiaddr, 0, sizeof(m->yiaddr));
|
||||||
|
@ -332,7 +332,7 @@ PT_THREAD(handle_dhcp(process_event_t ev, void *data))
|
||||||
printf("Got default router %d.%d.%d.%d\n",
|
printf("Got default router %d.%d.%d.%d\n",
|
||||||
uip_ipaddr_to_quad(&s.default_router));
|
uip_ipaddr_to_quad(&s.default_router));
|
||||||
printf("Lease expires in %ld seconds\n",
|
printf("Lease expires in %ld seconds\n",
|
||||||
ntohs(s.lease_time[0])*65536ul + ntohs(s.lease_time[1]));
|
uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1]));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dhcpc_configured(&s);
|
dhcpc_configured(&s);
|
||||||
|
@ -341,9 +341,9 @@ PT_THREAD(handle_dhcp(process_event_t ev, void *data))
|
||||||
#define MAX_TICKS32 (~((u32_t)0))
|
#define MAX_TICKS32 (~((u32_t)0))
|
||||||
#define IMIN(a, b) ((a) < (b) ? (a) : (b))
|
#define IMIN(a, b) ((a) < (b) ? (a) : (b))
|
||||||
|
|
||||||
if((ntohs(s.lease_time[0])*65536ul + ntohs(s.lease_time[1]))*CLOCK_SECOND/2
|
if((uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1]))*CLOCK_SECOND/2
|
||||||
<= MAX_TICKS32) {
|
<= MAX_TICKS32) {
|
||||||
s.ticks = (ntohs(s.lease_time[0])*65536ul + ntohs(s.lease_time[1])
|
s.ticks = (uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1])
|
||||||
)*CLOCK_SECOND/2;
|
)*CLOCK_SECOND/2;
|
||||||
} else {
|
} else {
|
||||||
s.ticks = MAX_TICKS32;
|
s.ticks = MAX_TICKS32;
|
||||||
|
@ -357,9 +357,9 @@ PT_THREAD(handle_dhcp(process_event_t ev, void *data))
|
||||||
PT_YIELD_UNTIL(&s.pt, etimer_expired(&s.etimer));
|
PT_YIELD_UNTIL(&s.pt, etimer_expired(&s.etimer));
|
||||||
}
|
}
|
||||||
|
|
||||||
if((ntohs(s.lease_time[0])*65536ul + ntohs(s.lease_time[1]))*CLOCK_SECOND/2
|
if((uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1]))*CLOCK_SECOND/2
|
||||||
<= MAX_TICKS32) {
|
<= MAX_TICKS32) {
|
||||||
s.ticks = (ntohs(s.lease_time[0])*65536ul + ntohs(s.lease_time[1])
|
s.ticks = (uip_ntohs(s.lease_time[0])*65536ul + uip_ntohs(s.lease_time[1])
|
||||||
)*CLOCK_SECOND/2;
|
)*CLOCK_SECOND/2;
|
||||||
} else {
|
} else {
|
||||||
s.ticks = MAX_TICKS32;
|
s.ticks = MAX_TICKS32;
|
||||||
|
@ -405,9 +405,9 @@ dhcpc_init(const void *mac_addr, int mac_len)
|
||||||
|
|
||||||
s.state = STATE_INITIAL;
|
s.state = STATE_INITIAL;
|
||||||
uip_ipaddr(&addr, 255,255,255,255);
|
uip_ipaddr(&addr, 255,255,255,255);
|
||||||
s.conn = udp_new(&addr, HTONS(DHCPC_SERVER_PORT), NULL);
|
s.conn = udp_new(&addr, UIP_HTONS(DHCPC_SERVER_PORT), NULL);
|
||||||
if(s.conn != NULL) {
|
if(s.conn != NULL) {
|
||||||
udp_bind(s.conn, HTONS(DHCPC_CLIENT_PORT));
|
udp_bind(s.conn, UIP_HTONS(DHCPC_CLIENT_PORT));
|
||||||
}
|
}
|
||||||
PT_INIT(&s.pt);
|
PT_INIT(&s.pt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: hc.c,v 1.4 2007/08/30 14:39:17 matsutsuka Exp $
|
* @(#)$Id: hc.c,v 1.5 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,14 +127,14 @@ hc_compress(u8_t *buf, int len)
|
||||||
the same destination
|
the same destination
|
||||||
and source port
|
and source port
|
||||||
number. */
|
number. */
|
||||||
(uhdr->destport & HTONS(0xc000)) == 0) { /* Only packets with the two
|
(uhdr->destport & UIP_HTONS(0xc000)) == 0) { /* Only packets with the two
|
||||||
highest bits in the port
|
highest bits in the port
|
||||||
number equal to zero. */
|
number equal to zero. */
|
||||||
|
|
||||||
hdr->flagsport = htons(
|
hdr->flagsport = uip_htons(
|
||||||
FLAGS_COMPRESSED | /* Compressed header. */
|
FLAGS_COMPRESSED | /* Compressed header. */
|
||||||
FLAGS_BROADCASTDATA | /* Broadcast data. */
|
FLAGS_BROADCASTDATA | /* Broadcast data. */
|
||||||
(htons(uhdr->destport) & 0x3fff));
|
(uip_htons(uhdr->destport) & 0x3fff));
|
||||||
uip_ipaddr_copy(&hdr->srcipaddr, &uhdr->srcipaddr);
|
uip_ipaddr_copy(&hdr->srcipaddr, &uhdr->srcipaddr);
|
||||||
|
|
||||||
/* Move the packet data to the end of the compressed header. */
|
/* Move the packet data to the end of the compressed header. */
|
||||||
|
@ -170,8 +170,8 @@ hc_inflate(u8_t *buf, int len)
|
||||||
hdr = (struct hc_hdr *)buf;
|
hdr = (struct hc_hdr *)buf;
|
||||||
|
|
||||||
/* First, check if the header in buf is compressed or not. */
|
/* First, check if the header in buf is compressed or not. */
|
||||||
if((hdr->flagsport & HTONS(FLAGS_COMPRESSED)) != 0 &&
|
if((hdr->flagsport & UIP_HTONS(FLAGS_COMPRESSED)) != 0 &&
|
||||||
(hdr->flagsport & HTONS(FLAGS_BROADCASTDATA)) != 0) {
|
(hdr->flagsport & UIP_HTONS(FLAGS_BROADCASTDATA)) != 0) {
|
||||||
|
|
||||||
/* Move packet data in memory to make room for the uncompressed header. */
|
/* Move packet data in memory to make room for the uncompressed header. */
|
||||||
memmove(&buf[UIP_IPUDPH_LEN - HC_HLEN],
|
memmove(&buf[UIP_IPUDPH_LEN - HC_HLEN],
|
||||||
|
@ -180,8 +180,8 @@ hc_inflate(u8_t *buf, int len)
|
||||||
hdr = (struct hc_hdr *)&buf[UIP_IPUDPH_LEN - HC_HLEN];
|
hdr = (struct hc_hdr *)&buf[UIP_IPUDPH_LEN - HC_HLEN];
|
||||||
|
|
||||||
uip_ipaddr_copy(&uhdr->srcipaddr, &hdr->srcipaddr);
|
uip_ipaddr_copy(&uhdr->srcipaddr, &hdr->srcipaddr);
|
||||||
uhdr->srcport = hdr->flagsport & HTONS(0x3fff);
|
uhdr->srcport = hdr->flagsport & UIP_HTONS(0x3fff);
|
||||||
uhdr->destport = hdr->flagsport & HTONS(0x3fff);
|
uhdr->destport = hdr->flagsport & UIP_HTONS(0x3fff);
|
||||||
|
|
||||||
uhdr->udplen = len;
|
uhdr->udplen = len;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ c/*
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: rawpacket-udp.c,v 1.3 2007/11/17 18:05:21 adamdunkels Exp $
|
* $Id: rawpacket-udp.c,v 1.4 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,7 +55,7 @@ rawpacket_udp_init(void)
|
||||||
struct rawpacket_conn *
|
struct rawpacket_conn *
|
||||||
rawpacket_setup(int id)
|
rawpacket_setup(int id)
|
||||||
{
|
{
|
||||||
return (struct rawpacket_conn *)udp_broadcast_new(HTONS(PORT + id), NULL);
|
return (struct rawpacket_conn *)udp_broadcast_new(UIP_HTONS(PORT + id), NULL);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: resolv.c,v 1.9 2010/05/31 15:22:08 nifi Exp $
|
* $Id: resolv.c,v 1.10 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -237,9 +237,9 @@ check_entries(void)
|
||||||
}
|
}
|
||||||
hdr = (struct dns_hdr *)uip_appdata;
|
hdr = (struct dns_hdr *)uip_appdata;
|
||||||
memset(hdr, 0, sizeof(struct dns_hdr));
|
memset(hdr, 0, sizeof(struct dns_hdr));
|
||||||
hdr->id = htons(i);
|
hdr->id = uip_htons(i);
|
||||||
hdr->flags1 = DNS_FLAG1_RD;
|
hdr->flags1 = DNS_FLAG1_RD;
|
||||||
hdr->numquestions = HTONS(1);
|
hdr->numquestions = UIP_HTONS(1);
|
||||||
query = (char *)uip_appdata + 12;
|
query = (char *)uip_appdata + 12;
|
||||||
nameptr = namemapptr->name;
|
nameptr = namemapptr->name;
|
||||||
--nameptr;
|
--nameptr;
|
||||||
|
@ -281,19 +281,19 @@ newdata(void)
|
||||||
register struct namemap *namemapptr;
|
register struct namemap *namemapptr;
|
||||||
|
|
||||||
hdr = (struct dns_hdr *)uip_appdata;
|
hdr = (struct dns_hdr *)uip_appdata;
|
||||||
/* printf("ID %d\n", htons(hdr->id));
|
/* printf("ID %d\n", uip_htons(hdr->id));
|
||||||
printf("Query %d\n", hdr->flags1 & DNS_FLAG1_RESPONSE);
|
printf("Query %d\n", hdr->flags1 & DNS_FLAG1_RESPONSE);
|
||||||
printf("Error %d\n", hdr->flags2 & DNS_FLAG2_ERR_MASK);
|
printf("Error %d\n", hdr->flags2 & DNS_FLAG2_ERR_MASK);
|
||||||
printf("Num questions %d, answers %d, authrr %d, extrarr %d\n",
|
printf("Num questions %d, answers %d, authrr %d, extrarr %d\n",
|
||||||
htons(hdr->numquestions),
|
uip_htons(hdr->numquestions),
|
||||||
htons(hdr->numanswers),
|
uip_htons(hdr->numanswers),
|
||||||
htons(hdr->numauthrr),
|
uip_htons(hdr->numauthrr),
|
||||||
htons(hdr->numextrarr));
|
uip_htons(hdr->numextrarr));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* The ID in the DNS header should be our entry into the name
|
/* The ID in the DNS header should be our entry into the name
|
||||||
table. */
|
table. */
|
||||||
i = (u8_t)htons(hdr->id);
|
i = (u8_t)uip_htons(hdr->id);
|
||||||
namemapptr = &names[i];
|
namemapptr = &names[i];
|
||||||
if(i < RESOLV_ENTRIES &&
|
if(i < RESOLV_ENTRIES &&
|
||||||
namemapptr->state == STATE_ASKING) {
|
namemapptr->state == STATE_ASKING) {
|
||||||
|
@ -311,8 +311,8 @@ newdata(void)
|
||||||
|
|
||||||
/* We only care about the question(s) and the answers. The authrr
|
/* We only care about the question(s) and the answers. The authrr
|
||||||
and the extrarr are simply discarded. */
|
and the extrarr are simply discarded. */
|
||||||
nquestions = (u8_t)htons(hdr->numquestions);
|
nquestions = (u8_t)uip_htons(hdr->numquestions);
|
||||||
nanswers = (u8_t)htons(hdr->numanswers);
|
nanswers = (u8_t)uip_htons(hdr->numanswers);
|
||||||
|
|
||||||
/* Skip the name in the question. XXX: This should really be
|
/* Skip the name in the question. XXX: This should really be
|
||||||
checked agains the name in the question, to be sure that they
|
checked agains the name in the question, to be sure that they
|
||||||
|
@ -333,14 +333,14 @@ newdata(void)
|
||||||
|
|
||||||
ans = (struct dns_answer *)nameptr;
|
ans = (struct dns_answer *)nameptr;
|
||||||
/* printf("Answer: type %x, class %x, ttl %x, length %x\n",
|
/* printf("Answer: type %x, class %x, ttl %x, length %x\n",
|
||||||
htons(ans->type), htons(ans->class), (htons(ans->ttl[0])
|
uip_htons(ans->type), uip_htons(ans->class), (uip_htons(ans->ttl[0])
|
||||||
<< 16) | htons(ans->ttl[1]), htons(ans->len));*/
|
<< 16) | uip_htons(ans->ttl[1]), uip_htons(ans->len));*/
|
||||||
|
|
||||||
/* Check for IP address type and Internet class. Others are
|
/* Check for IP address type and Internet class. Others are
|
||||||
discarded. */
|
discarded. */
|
||||||
if(ans->type == HTONS(1) &&
|
if(ans->type == UIP_HTONS(1) &&
|
||||||
ans->class == HTONS(1) &&
|
ans->class == UIP_HTONS(1) &&
|
||||||
ans->len == HTONS(4)) {
|
ans->len == UIP_HTONS(4)) {
|
||||||
/* printf("IP address %d.%d.%d.%d\n",
|
/* printf("IP address %d.%d.%d.%d\n",
|
||||||
ans->ipaddr[0],
|
ans->ipaddr[0],
|
||||||
ans->ipaddr[1],
|
ans->ipaddr[1],
|
||||||
|
@ -355,7 +355,7 @@ newdata(void)
|
||||||
resolv_found(namemapptr->name, &namemapptr->ipaddr);
|
resolv_found(namemapptr->name, &namemapptr->ipaddr);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
nameptr = nameptr + 10 + htons(ans->len);
|
nameptr = nameptr + 10 + uip_htons(ans->len);
|
||||||
}
|
}
|
||||||
--nanswers;
|
--nanswers;
|
||||||
}
|
}
|
||||||
|
@ -391,10 +391,10 @@ PROCESS_THREAD(resolv_process, ev, data)
|
||||||
if(resolv_conn != NULL) {
|
if(resolv_conn != NULL) {
|
||||||
uip_udp_remove(resolv_conn);
|
uip_udp_remove(resolv_conn);
|
||||||
}
|
}
|
||||||
resolv_conn = udp_new((uip_ipaddr_t *)data, HTONS(53), NULL);
|
resolv_conn = udp_new((uip_ipaddr_t *)data, UIP_HTONS(53), NULL);
|
||||||
|
|
||||||
} else if(ev == tcpip_event) {
|
} else if(ev == tcpip_event) {
|
||||||
if(uip_udp_conn->rport == HTONS(53)) {
|
if(uip_udp_conn->rport == UIP_HTONS(53)) {
|
||||||
if(uip_poll()) {
|
if(uip_poll()) {
|
||||||
check_entries();
|
check_entries();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: rime-udp.c,v 1.6 2010/06/14 19:19:17 adamdunkels Exp $
|
* $Id: rime-udp.c,v 1.7 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,18 +77,18 @@ PROCESS_THREAD(rime_udp_process, ev, data)
|
||||||
|
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
broadcast_conn = udp_broadcast_new(HTONS(RIME_UDP_PORT), NULL);
|
broadcast_conn = udp_broadcast_new(UIP_HTONS(RIME_UDP_PORT), NULL);
|
||||||
if(broadcast_conn == NULL) {
|
if(broadcast_conn == NULL) {
|
||||||
PRINTF("rime-udp: Failed to allocate a broadcast connection!\n");
|
PRINTF("rime-udp: Failed to allocate a broadcast connection!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
uip_create_unspecified(&ipaddr);
|
uip_create_unspecified(&ipaddr);
|
||||||
unicast_conn = udp_new(&ipaddr, HTONS(RIME_UDP_PORT), NULL);
|
unicast_conn = udp_new(&ipaddr, UIP_HTONS(RIME_UDP_PORT), NULL);
|
||||||
if(unicast_conn == NULL) {
|
if(unicast_conn == NULL) {
|
||||||
PRINTF("rime-udp: Failed to allocate a unicast connection!\n");
|
PRINTF("rime-udp: Failed to allocate a unicast connection!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
udp_bind(unicast_conn, HTONS(RIME_UDP_PORT));
|
udp_bind(unicast_conn, UIP_HTONS(RIME_UDP_PORT));
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event);
|
PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event);
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: sicslowpan.c,v 1.45 2010/09/23 19:57:50 joxe Exp $
|
* $Id: sicslowpan.c,v 1.46 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* \file
|
* \file
|
||||||
|
@ -621,34 +621,34 @@ compress_hdr_hc06(rimeaddr_t *rime_destaddr)
|
||||||
/* UDP header compression */
|
/* UDP header compression */
|
||||||
if(UIP_IP_BUF->proto == UIP_PROTO_UDP) {
|
if(UIP_IP_BUF->proto == UIP_PROTO_UDP) {
|
||||||
PRINTF("IPHC: Uncompressed UDP ports on send side: %x, %x\n",
|
PRINTF("IPHC: Uncompressed UDP ports on send side: %x, %x\n",
|
||||||
HTONS(UIP_UDP_BUF->srcport), HTONS(UIP_UDP_BUF->destport));
|
UIP_HTONS(UIP_UDP_BUF->srcport), UIP_HTONS(UIP_UDP_BUF->destport));
|
||||||
/* Mask out the last 4 bits can be used as a mask */
|
/* Mask out the last 4 bits can be used as a mask */
|
||||||
if(((HTONS(UIP_UDP_BUF->srcport) & 0xfff0) == SICSLOWPAN_UDP_4_BIT_PORT_MIN) &&
|
if(((UIP_HTONS(UIP_UDP_BUF->srcport) & 0xfff0) == SICSLOWPAN_UDP_4_BIT_PORT_MIN) &&
|
||||||
((HTONS(UIP_UDP_BUF->destport) & 0xfff0) == SICSLOWPAN_UDP_4_BIT_PORT_MIN)) {
|
((UIP_HTONS(UIP_UDP_BUF->destport) & 0xfff0) == SICSLOWPAN_UDP_4_BIT_PORT_MIN)) {
|
||||||
/* we can compress 12 bits of both source and dest */
|
/* we can compress 12 bits of both source and dest */
|
||||||
*hc06_ptr = SICSLOWPAN_NHC_UDP_CS_P_11;
|
*hc06_ptr = SICSLOWPAN_NHC_UDP_CS_P_11;
|
||||||
PRINTF("IPHC: remove 12 b of both source & dest with prefix 0xFOB\n");
|
PRINTF("IPHC: remove 12 b of both source & dest with prefix 0xFOB\n");
|
||||||
*(hc06_ptr + 1) =
|
*(hc06_ptr + 1) =
|
||||||
(u8_t)((HTONS(UIP_UDP_BUF->srcport) -
|
(u8_t)((UIP_HTONS(UIP_UDP_BUF->srcport) -
|
||||||
SICSLOWPAN_UDP_4_BIT_PORT_MIN) << 4) +
|
SICSLOWPAN_UDP_4_BIT_PORT_MIN) << 4) +
|
||||||
(u8_t)((HTONS(UIP_UDP_BUF->destport) -
|
(u8_t)((UIP_HTONS(UIP_UDP_BUF->destport) -
|
||||||
SICSLOWPAN_UDP_4_BIT_PORT_MIN));
|
SICSLOWPAN_UDP_4_BIT_PORT_MIN));
|
||||||
hc06_ptr += 2;
|
hc06_ptr += 2;
|
||||||
} else if((HTONS(UIP_UDP_BUF->destport) & 0xff00) == SICSLOWPAN_UDP_8_BIT_PORT_MIN) {
|
} else if((UIP_HTONS(UIP_UDP_BUF->destport) & 0xff00) == SICSLOWPAN_UDP_8_BIT_PORT_MIN) {
|
||||||
/* we can compress 8 bits of dest, leave source. */
|
/* we can compress 8 bits of dest, leave source. */
|
||||||
*hc06_ptr = SICSLOWPAN_NHC_UDP_CS_P_01;
|
*hc06_ptr = SICSLOWPAN_NHC_UDP_CS_P_01;
|
||||||
PRINTF("IPHC: leave source, remove 8 bits of dest with prefix 0xF0\n");
|
PRINTF("IPHC: leave source, remove 8 bits of dest with prefix 0xF0\n");
|
||||||
memcpy(hc06_ptr + 1, &UIP_UDP_BUF->srcport, 2);
|
memcpy(hc06_ptr + 1, &UIP_UDP_BUF->srcport, 2);
|
||||||
*(hc06_ptr + 3) =
|
*(hc06_ptr + 3) =
|
||||||
(u8_t)((HTONS(UIP_UDP_BUF->destport) -
|
(u8_t)((UIP_HTONS(UIP_UDP_BUF->destport) -
|
||||||
SICSLOWPAN_UDP_8_BIT_PORT_MIN));
|
SICSLOWPAN_UDP_8_BIT_PORT_MIN));
|
||||||
hc06_ptr += 4;
|
hc06_ptr += 4;
|
||||||
} else if((HTONS(UIP_UDP_BUF->srcport) & 0xff00) == SICSLOWPAN_UDP_8_BIT_PORT_MIN) {
|
} else if((UIP_HTONS(UIP_UDP_BUF->srcport) & 0xff00) == SICSLOWPAN_UDP_8_BIT_PORT_MIN) {
|
||||||
/* we can compress 8 bits of src, leave dest. Copy compressed port */
|
/* we can compress 8 bits of src, leave dest. Copy compressed port */
|
||||||
*hc06_ptr = SICSLOWPAN_NHC_UDP_CS_P_10;
|
*hc06_ptr = SICSLOWPAN_NHC_UDP_CS_P_10;
|
||||||
PRINTF("IPHC: remove 8 bits of source with prefix 0xF0, leave dest. hch: %i\n", *hc06_ptr);
|
PRINTF("IPHC: remove 8 bits of source with prefix 0xF0, leave dest. hch: %i\n", *hc06_ptr);
|
||||||
*(hc06_ptr + 1) =
|
*(hc06_ptr + 1) =
|
||||||
(u8_t)((HTONS(UIP_UDP_BUF->srcport) -
|
(u8_t)((UIP_HTONS(UIP_UDP_BUF->srcport) -
|
||||||
SICSLOWPAN_UDP_8_BIT_PORT_MIN));
|
SICSLOWPAN_UDP_8_BIT_PORT_MIN));
|
||||||
memcpy(hc06_ptr + 2, &UIP_UDP_BUF->destport, 2);
|
memcpy(hc06_ptr + 2, &UIP_UDP_BUF->destport, 2);
|
||||||
hc06_ptr += 4;
|
hc06_ptr += 4;
|
||||||
|
@ -858,7 +858,7 @@ uncompress_hdr_hc06(u16_t ip_len) {
|
||||||
memcpy(&SICSLOWPAN_UDP_BUF->srcport, hc06_ptr + 1, 2);
|
memcpy(&SICSLOWPAN_UDP_BUF->srcport, hc06_ptr + 1, 2);
|
||||||
memcpy(&SICSLOWPAN_UDP_BUF->destport, hc06_ptr + 3, 2);
|
memcpy(&SICSLOWPAN_UDP_BUF->destport, hc06_ptr + 3, 2);
|
||||||
PRINTF("IPHC: Uncompressed UDP ports (ptr+5): %x, %x\n",
|
PRINTF("IPHC: Uncompressed UDP ports (ptr+5): %x, %x\n",
|
||||||
HTONS(SICSLOWPAN_UDP_BUF->srcport), HTONS(SICSLOWPAN_UDP_BUF->destport));
|
UIP_HTONS(SICSLOWPAN_UDP_BUF->srcport), UIP_HTONS(SICSLOWPAN_UDP_BUF->destport));
|
||||||
hc06_ptr += 5;
|
hc06_ptr += 5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -866,31 +866,31 @@ uncompress_hdr_hc06(u16_t ip_len) {
|
||||||
/* 1 byte for NHC + source 16bit inline, dest = 0xF0 + 8 bit inline */
|
/* 1 byte for NHC + source 16bit inline, dest = 0xF0 + 8 bit inline */
|
||||||
PRINTF("IPHC: Decompressing destination\n");
|
PRINTF("IPHC: Decompressing destination\n");
|
||||||
memcpy(&SICSLOWPAN_UDP_BUF->srcport, hc06_ptr + 1, 2);
|
memcpy(&SICSLOWPAN_UDP_BUF->srcport, hc06_ptr + 1, 2);
|
||||||
SICSLOWPAN_UDP_BUF->destport = HTONS(SICSLOWPAN_UDP_8_BIT_PORT_MIN + (*(hc06_ptr + 3)));
|
SICSLOWPAN_UDP_BUF->destport = UIP_HTONS(SICSLOWPAN_UDP_8_BIT_PORT_MIN + (*(hc06_ptr + 3)));
|
||||||
PRINTF("IPHC: Uncompressed UDP ports (ptr+4): %x, %x\n",
|
PRINTF("IPHC: Uncompressed UDP ports (ptr+4): %x, %x\n",
|
||||||
HTONS(SICSLOWPAN_UDP_BUF->srcport), HTONS(SICSLOWPAN_UDP_BUF->destport));
|
UIP_HTONS(SICSLOWPAN_UDP_BUF->srcport), UIP_HTONS(SICSLOWPAN_UDP_BUF->destport));
|
||||||
hc06_ptr += 4;
|
hc06_ptr += 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SICSLOWPAN_NHC_UDP_CS_P_10:
|
case SICSLOWPAN_NHC_UDP_CS_P_10:
|
||||||
/* 1 byte for NHC + source = 0xF0 + 8bit inline, dest = 16 bit inline*/
|
/* 1 byte for NHC + source = 0xF0 + 8bit inline, dest = 16 bit inline*/
|
||||||
PRINTF("IPHC: Decompressing source\n");
|
PRINTF("IPHC: Decompressing source\n");
|
||||||
SICSLOWPAN_UDP_BUF->srcport = HTONS(SICSLOWPAN_UDP_8_BIT_PORT_MIN +
|
SICSLOWPAN_UDP_BUF->srcport = UIP_HTONS(SICSLOWPAN_UDP_8_BIT_PORT_MIN +
|
||||||
(*(hc06_ptr + 1)));
|
(*(hc06_ptr + 1)));
|
||||||
memcpy(&SICSLOWPAN_UDP_BUF->destport, hc06_ptr + 2, 2);
|
memcpy(&SICSLOWPAN_UDP_BUF->destport, hc06_ptr + 2, 2);
|
||||||
PRINTF("IPHC: Uncompressed UDP ports (ptr+4): %x, %x\n",
|
PRINTF("IPHC: Uncompressed UDP ports (ptr+4): %x, %x\n",
|
||||||
HTONS(SICSLOWPAN_UDP_BUF->srcport), HTONS(SICSLOWPAN_UDP_BUF->destport));
|
UIP_HTONS(SICSLOWPAN_UDP_BUF->srcport), UIP_HTONS(SICSLOWPAN_UDP_BUF->destport));
|
||||||
hc06_ptr += 4;
|
hc06_ptr += 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SICSLOWPAN_NHC_UDP_CS_P_11:
|
case SICSLOWPAN_NHC_UDP_CS_P_11:
|
||||||
/* 1 byte for NHC, 1 byte for ports */
|
/* 1 byte for NHC, 1 byte for ports */
|
||||||
SICSLOWPAN_UDP_BUF->srcport = HTONS(SICSLOWPAN_UDP_4_BIT_PORT_MIN +
|
SICSLOWPAN_UDP_BUF->srcport = UIP_HTONS(SICSLOWPAN_UDP_4_BIT_PORT_MIN +
|
||||||
(*(hc06_ptr + 1) >> 4));
|
(*(hc06_ptr + 1) >> 4));
|
||||||
SICSLOWPAN_UDP_BUF->destport = HTONS(SICSLOWPAN_UDP_4_BIT_PORT_MIN +
|
SICSLOWPAN_UDP_BUF->destport = UIP_HTONS(SICSLOWPAN_UDP_4_BIT_PORT_MIN +
|
||||||
((*(hc06_ptr + 1)) & 0x0F));
|
((*(hc06_ptr + 1)) & 0x0F));
|
||||||
PRINTF("IPHC: Uncompressed UDP ports (ptr+2): %x, %x\n",
|
PRINTF("IPHC: Uncompressed UDP ports (ptr+2): %x, %x\n",
|
||||||
HTONS(SICSLOWPAN_UDP_BUF->srcport), HTONS(SICSLOWPAN_UDP_BUF->destport));
|
UIP_HTONS(SICSLOWPAN_UDP_BUF->srcport), UIP_HTONS(SICSLOWPAN_UDP_BUF->destport));
|
||||||
hc06_ptr += 2;
|
hc06_ptr += 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1052,10 +1052,10 @@ compress_hdr_hc1(rimeaddr_t *rime_destaddr)
|
||||||
* SICSLOWPAN_UDP_PORT_MIN and SICSLOWPAN_UDP_PORT_MIN + 15
|
* SICSLOWPAN_UDP_PORT_MIN and SICSLOWPAN_UDP_PORT_MIN + 15
|
||||||
*/
|
*/
|
||||||
PRINTF("local/remote port %u/%u\n",UIP_UDP_BUF->srcport,UIP_UDP_BUF->destport);
|
PRINTF("local/remote port %u/%u\n",UIP_UDP_BUF->srcport,UIP_UDP_BUF->destport);
|
||||||
if(HTONS(UIP_UDP_BUF->srcport) >= SICSLOWPAN_UDP_PORT_MIN &&
|
if(UIP_HTONS(UIP_UDP_BUF->srcport) >= SICSLOWPAN_UDP_PORT_MIN &&
|
||||||
HTONS(UIP_UDP_BUF->srcport) < SICSLOWPAN_UDP_PORT_MAX &&
|
UIP_HTONS(UIP_UDP_BUF->srcport) < SICSLOWPAN_UDP_PORT_MAX &&
|
||||||
HTONS(UIP_UDP_BUF->destport) >= SICSLOWPAN_UDP_PORT_MIN &&
|
UIP_HTONS(UIP_UDP_BUF->destport) >= SICSLOWPAN_UDP_PORT_MIN &&
|
||||||
HTONS(UIP_UDP_BUF->destport) < SICSLOWPAN_UDP_PORT_MAX) {
|
UIP_HTONS(UIP_UDP_BUF->destport) < SICSLOWPAN_UDP_PORT_MAX) {
|
||||||
/* HC1 encoding */
|
/* HC1 encoding */
|
||||||
RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_HC1_ENCODING] = 0xFB;
|
RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_HC1_ENCODING] = 0xFB;
|
||||||
|
|
||||||
|
@ -1064,9 +1064,9 @@ compress_hdr_hc1(rimeaddr_t *rime_destaddr)
|
||||||
RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_TTL] = UIP_IP_BUF->ttl;
|
RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_TTL] = UIP_IP_BUF->ttl;
|
||||||
|
|
||||||
RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_PORTS] =
|
RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_PORTS] =
|
||||||
(u8_t)((HTONS(UIP_UDP_BUF->srcport) -
|
(u8_t)((UIP_HTONS(UIP_UDP_BUF->srcport) -
|
||||||
SICSLOWPAN_UDP_PORT_MIN) << 4) +
|
SICSLOWPAN_UDP_PORT_MIN) << 4) +
|
||||||
(u8_t)((HTONS(UIP_UDP_BUF->destport) - SICSLOWPAN_UDP_PORT_MIN));
|
(u8_t)((UIP_HTONS(UIP_UDP_BUF->destport) - SICSLOWPAN_UDP_PORT_MIN));
|
||||||
memcpy(&RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_CHKSUM], &UIP_UDP_BUF->udpchksum, 2);
|
memcpy(&RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_CHKSUM], &UIP_UDP_BUF->udpchksum, 2);
|
||||||
rime_hdr_len += SICSLOWPAN_HC1_HC_UDP_HDR_LEN;
|
rime_hdr_len += SICSLOWPAN_HC1_HC_UDP_HDR_LEN;
|
||||||
uncomp_hdr_len += UIP_UDPH_LEN;
|
uncomp_hdr_len += UIP_UDPH_LEN;
|
||||||
|
@ -1144,10 +1144,10 @@ uncompress_hdr_hc1(u16_t ip_len) {
|
||||||
SICSLOWPAN_IP_BUF->ttl = RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_TTL];
|
SICSLOWPAN_IP_BUF->ttl = RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_TTL];
|
||||||
/* UDP ports, len, checksum */
|
/* UDP ports, len, checksum */
|
||||||
SICSLOWPAN_UDP_BUF->srcport =
|
SICSLOWPAN_UDP_BUF->srcport =
|
||||||
HTONS(SICSLOWPAN_UDP_PORT_MIN +
|
UIP_HTONS(SICSLOWPAN_UDP_PORT_MIN +
|
||||||
(RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_PORTS] >> 4));
|
(RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_PORTS] >> 4));
|
||||||
SICSLOWPAN_UDP_BUF->destport =
|
SICSLOWPAN_UDP_BUF->destport =
|
||||||
HTONS(SICSLOWPAN_UDP_PORT_MIN +
|
UIP_HTONS(SICSLOWPAN_UDP_PORT_MIN +
|
||||||
(RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_PORTS] & 0x0F));
|
(RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_PORTS] & 0x0F));
|
||||||
memcpy(&SICSLOWPAN_UDP_BUF->udpchksum, &RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_CHKSUM], 2);
|
memcpy(&SICSLOWPAN_UDP_BUF->udpchksum, &RIME_HC1_HC_UDP_PTR[RIME_HC1_HC_UDP_CHKSUM], 2);
|
||||||
uncomp_hdr_len += UIP_UDPH_LEN;
|
uncomp_hdr_len += UIP_UDPH_LEN;
|
||||||
|
@ -1333,10 +1333,10 @@ output(uip_lladdr_t *localdest)
|
||||||
* Note that the length is in units of 8 bytes
|
* Note that the length is in units of 8 bytes
|
||||||
*/
|
*/
|
||||||
/* RIME_FRAG_BUF->dispatch_size = */
|
/* RIME_FRAG_BUF->dispatch_size = */
|
||||||
/* htons((SICSLOWPAN_DISPATCH_FRAG1 << 8) | uip_len); */
|
/* uip_htons((SICSLOWPAN_DISPATCH_FRAG1 << 8) | uip_len); */
|
||||||
SET16(RIME_FRAG_PTR, RIME_FRAG_DISPATCH_SIZE,
|
SET16(RIME_FRAG_PTR, RIME_FRAG_DISPATCH_SIZE,
|
||||||
((SICSLOWPAN_DISPATCH_FRAG1 << 8) | uip_len));
|
((SICSLOWPAN_DISPATCH_FRAG1 << 8) | uip_len));
|
||||||
/* RIME_FRAG_BUF->tag = htons(my_tag); */
|
/* RIME_FRAG_BUF->tag = uip_htons(my_tag); */
|
||||||
SET16(RIME_FRAG_PTR, RIME_FRAG_TAG, my_tag);
|
SET16(RIME_FRAG_PTR, RIME_FRAG_TAG, my_tag);
|
||||||
|
|
||||||
/* Copy payload and send */
|
/* Copy payload and send */
|
||||||
|
@ -1366,7 +1366,7 @@ output(uip_lladdr_t *localdest)
|
||||||
*/
|
*/
|
||||||
rime_hdr_len = SICSLOWPAN_FRAGN_HDR_LEN;
|
rime_hdr_len = SICSLOWPAN_FRAGN_HDR_LEN;
|
||||||
/* RIME_FRAG_BUF->dispatch_size = */
|
/* RIME_FRAG_BUF->dispatch_size = */
|
||||||
/* htons((SICSLOWPAN_DISPATCH_FRAGN << 8) | uip_len); */
|
/* uip_htons((SICSLOWPAN_DISPATCH_FRAGN << 8) | uip_len); */
|
||||||
SET16(RIME_FRAG_PTR, RIME_FRAG_DISPATCH_SIZE,
|
SET16(RIME_FRAG_PTR, RIME_FRAG_DISPATCH_SIZE,
|
||||||
((SICSLOWPAN_DISPATCH_FRAGN << 8) | uip_len));
|
((SICSLOWPAN_DISPATCH_FRAGN << 8) | uip_len));
|
||||||
rime_payload_len = (MAC_MAX_PAYLOAD - rime_hdr_len) & 0xf8;
|
rime_payload_len = (MAC_MAX_PAYLOAD - rime_hdr_len) & 0xf8;
|
||||||
|
@ -1462,9 +1462,9 @@ input(void)
|
||||||
case SICSLOWPAN_DISPATCH_FRAG1:
|
case SICSLOWPAN_DISPATCH_FRAG1:
|
||||||
PRINTFI("sicslowpan input: FRAG1 ");
|
PRINTFI("sicslowpan input: FRAG1 ");
|
||||||
frag_offset = 0;
|
frag_offset = 0;
|
||||||
/* frag_size = (ntohs(RIME_FRAG_BUF->dispatch_size) & 0x07ff); */
|
/* frag_size = (uip_ntohs(RIME_FRAG_BUF->dispatch_size) & 0x07ff); */
|
||||||
frag_size = GET16(RIME_FRAG_PTR, RIME_FRAG_DISPATCH_SIZE) & 0x07ff;
|
frag_size = GET16(RIME_FRAG_PTR, RIME_FRAG_DISPATCH_SIZE) & 0x07ff;
|
||||||
/* frag_tag = ntohs(RIME_FRAG_BUF->tag); */
|
/* frag_tag = uip_ntohs(RIME_FRAG_BUF->tag); */
|
||||||
frag_tag = GET16(RIME_FRAG_PTR, RIME_FRAG_TAG);
|
frag_tag = GET16(RIME_FRAG_PTR, RIME_FRAG_TAG);
|
||||||
PRINTFI("size %d, tag %d, offset %d)\n",
|
PRINTFI("size %d, tag %d, offset %d)\n",
|
||||||
frag_size, frag_tag, frag_offset);
|
frag_size, frag_tag, frag_offset);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: tcpdump.c,v 1.2 2006/10/09 11:53:56 adamdunkels Exp $
|
* @(#)$Id: tcpdump.c,v 1.3 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki-net.h"
|
#include "contiki-net.h"
|
||||||
|
@ -238,13 +238,13 @@ tcpdump_format(u8_t *packet, u16_t packetlen,
|
||||||
}
|
}
|
||||||
} else if(IPBUF->proto == UIP_PROTO_UDP) {
|
} else if(IPBUF->proto == UIP_PROTO_UDP) {
|
||||||
return s(" UDP",
|
return s(" UDP",
|
||||||
n(htons(UDPBUF->destport), d(
|
n(uip_htons(UDPBUF->destport), d(
|
||||||
n(IPBUF->destipaddr[3], d(
|
n(IPBUF->destipaddr[3], d(
|
||||||
n(IPBUF->destipaddr[2], d(
|
n(IPBUF->destipaddr[2], d(
|
||||||
n(IPBUF->destipaddr[1], d(
|
n(IPBUF->destipaddr[1], d(
|
||||||
n(IPBUF->destipaddr[0],
|
n(IPBUF->destipaddr[0],
|
||||||
s(" ",
|
s(" ",
|
||||||
n(htons(UDPBUF->srcport), d(
|
n(uip_htons(UDPBUF->srcport), d(
|
||||||
n(IPBUF->srcipaddr[3], d(
|
n(IPBUF->srcipaddr[3], d(
|
||||||
n(IPBUF->srcipaddr[2], d(
|
n(IPBUF->srcipaddr[2], d(
|
||||||
n(IPBUF->srcipaddr[1], d(
|
n(IPBUF->srcipaddr[1], d(
|
||||||
|
@ -253,21 +253,21 @@ tcpdump_format(u8_t *packet, u16_t packetlen,
|
||||||
/* return sprintf(buf, "%d.%d.%d.%d.%d %d.%d.%d.%d.%d UDP",
|
/* return sprintf(buf, "%d.%d.%d.%d.%d %d.%d.%d.%d.%d UDP",
|
||||||
IPBUF->srcipaddr[0], IPBUF->srcipaddr[1],
|
IPBUF->srcipaddr[0], IPBUF->srcipaddr[1],
|
||||||
IPBUF->srcipaddr[2], IPBUF->srcipaddr[3],
|
IPBUF->srcipaddr[2], IPBUF->srcipaddr[3],
|
||||||
htons(UDPBUF->srcport),
|
uip_htons(UDPBUF->srcport),
|
||||||
IPBUF->destipaddr[0], IPBUF->destipaddr[1],
|
IPBUF->destipaddr[0], IPBUF->destipaddr[1],
|
||||||
IPBUF->destipaddr[2], IPBUF->destipaddr[3],
|
IPBUF->destipaddr[2], IPBUF->destipaddr[3],
|
||||||
htons(UDPBUF->destport));*/
|
uip_htons(UDPBUF->destport));*/
|
||||||
} else if(IPBUF->proto == UIP_PROTO_TCP) {
|
} else if(IPBUF->proto == UIP_PROTO_TCP) {
|
||||||
tcpflags(TCPBUF->flags, flags);
|
tcpflags(TCPBUF->flags, flags);
|
||||||
return s(flags,
|
return s(flags,
|
||||||
s(" ",
|
s(" ",
|
||||||
n(htons(TCPBUF->destport), d(
|
n(uip_htons(TCPBUF->destport), d(
|
||||||
n(IPBUF->destipaddr[3], d(
|
n(IPBUF->destipaddr[3], d(
|
||||||
n(IPBUF->destipaddr[2], d(
|
n(IPBUF->destipaddr[2], d(
|
||||||
n(IPBUF->destipaddr[1], d(
|
n(IPBUF->destipaddr[1], d(
|
||||||
n(IPBUF->destipaddr[0],
|
n(IPBUF->destipaddr[0],
|
||||||
s(" ",
|
s(" ",
|
||||||
n(htons(TCPBUF->srcport), d(
|
n(uip_htons(TCPBUF->srcport), d(
|
||||||
n(IPBUF->srcipaddr[3], d(
|
n(IPBUF->srcipaddr[3], d(
|
||||||
n(IPBUF->srcipaddr[2], d(
|
n(IPBUF->srcipaddr[2], d(
|
||||||
n(IPBUF->srcipaddr[1], d(
|
n(IPBUF->srcipaddr[1], d(
|
||||||
|
@ -276,10 +276,10 @@ tcpdump_format(u8_t *packet, u16_t packetlen,
|
||||||
/* return sprintf(buf, "%d.%d.%d.%d.%d %d.%d.%d.%d.%d %s",
|
/* return sprintf(buf, "%d.%d.%d.%d.%d %d.%d.%d.%d.%d %s",
|
||||||
IPBUF->srcipaddr[0], IPBUF->srcipaddr[1],
|
IPBUF->srcipaddr[0], IPBUF->srcipaddr[1],
|
||||||
IPBUF->srcipaddr[2], IPBUF->srcipaddr[3],
|
IPBUF->srcipaddr[2], IPBUF->srcipaddr[3],
|
||||||
htons(TCPBUF->srcport),
|
uip_htons(TCPBUF->srcport),
|
||||||
IPBUF->destipaddr[0], IPBUF->destipaddr[1],
|
IPBUF->destipaddr[0], IPBUF->destipaddr[1],
|
||||||
IPBUF->destipaddr[2], IPBUF->destipaddr[3],
|
IPBUF->destipaddr[2], IPBUF->destipaddr[3],
|
||||||
htons(TCPBUF->destport),
|
uip_htons(TCPBUF->destport),
|
||||||
flags); */
|
flags); */
|
||||||
} else {
|
} else {
|
||||||
strcpy(buf, "Unrecognized protocol");
|
strcpy(buf, "Unrecognized protocol");
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: tcpip.h,v 1.16 2010/02/05 12:43:37 nifi Exp $
|
* $Id: tcpip.h,v 1.17 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef __TCPIP_H__
|
#ifndef __TCPIP_H__
|
||||||
#define __TCPIP_H__
|
#define __TCPIP_H__
|
||||||
|
@ -120,7 +120,7 @@ CCIF void tcp_attach(struct uip_conn *conn,
|
||||||
* with the new connection request.
|
* with the new connection request.
|
||||||
*
|
*
|
||||||
* \note Port numbers must always be given in network byte order. The
|
* \note Port numbers must always be given in network byte order. The
|
||||||
* functions HTONS() and htons() can be used to convert port numbers
|
* functions UIP_HTONS() and uip_htons() can be used to convert port numbers
|
||||||
* from host byte order to network byte order.
|
* from host byte order to network byte order.
|
||||||
*
|
*
|
||||||
* \param port The port number in network byte order.
|
* \param port The port number in network byte order.
|
||||||
|
@ -134,7 +134,7 @@ CCIF void tcp_listen(u16_t port);
|
||||||
* This function closes a listening TCP port.
|
* This function closes a listening TCP port.
|
||||||
*
|
*
|
||||||
* \note Port numbers must always be given in network byte order. The
|
* \note Port numbers must always be given in network byte order. The
|
||||||
* functions HTONS() and htons() can be used to convert port numbers
|
* functions UIP_HTONS() and uip_htons() can be used to convert port numbers
|
||||||
* from host byte order to network byte order.
|
* from host byte order to network byte order.
|
||||||
*
|
*
|
||||||
* \param port The port number in network byte order.
|
* \param port The port number in network byte order.
|
||||||
|
@ -151,7 +151,7 @@ CCIF void tcp_unlisten(u16_t port);
|
||||||
* together with uIP events to the process.
|
* together with uIP events to the process.
|
||||||
*
|
*
|
||||||
* \note The port number must be provided in network byte order so a
|
* \note The port number must be provided in network byte order so a
|
||||||
* conversion with HTONS() usually is necessary.
|
* conversion with UIP_HTONS() usually is necessary.
|
||||||
*
|
*
|
||||||
* \note This function will only create the connection. The connection
|
* \note This function will only create the connection. The connection
|
||||||
* is not opened directly. uIP will try to open the connection the
|
* is not opened directly. uIP will try to open the connection the
|
||||||
|
@ -215,7 +215,7 @@ void udp_attach(struct uip_udp_conn *conn,
|
||||||
* remote endpoint.
|
* remote endpoint.
|
||||||
*
|
*
|
||||||
* \note The port number must be provided in network byte order so a
|
* \note The port number must be provided in network byte order so a
|
||||||
* conversion with HTONS() usually is necessary.
|
* conversion with UIP_HTONS() usually is necessary.
|
||||||
*
|
*
|
||||||
* \sa udp_bind()
|
* \sa udp_bind()
|
||||||
*
|
*
|
||||||
|
@ -253,7 +253,7 @@ struct uip_udp_conn *udp_broadcast_new(u16_t port, void *appstate);
|
||||||
* connection to a specified local port, this function should be used.
|
* connection to a specified local port, this function should be used.
|
||||||
*
|
*
|
||||||
* \note The port number must be provided in network byte order so a
|
* \note The port number must be provided in network byte order so a
|
||||||
* conversion with HTONS() usually is necessary.
|
* conversion with UIP_HTONS() usually is necessary.
|
||||||
*
|
*
|
||||||
* \param conn A pointer to the UDP connection that is to be bound.
|
* \param conn A pointer to the UDP connection that is to be bound.
|
||||||
* \param port The port number in network byte order to which to bind
|
* \param port The port number in network byte order to which to bind
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: uaodv-rt.c,v 1.7 2007/05/13 15:14:48 bg- Exp $
|
* $Id: uaodv-rt.c,v 1.8 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,7 +81,7 @@ uaodv_rt_add(uip_ipaddr_t *dest, uip_ipaddr_t *nexthop,
|
||||||
uip_ipaddr_copy(&e->dest, dest);
|
uip_ipaddr_copy(&e->dest, dest);
|
||||||
uip_ipaddr_copy(&e->nexthop, nexthop);
|
uip_ipaddr_copy(&e->nexthop, nexthop);
|
||||||
e->hop_count = hop_count;
|
e->hop_count = hop_count;
|
||||||
e->hseqno = ntohl(*seqno);
|
e->hseqno = uip_ntohl(*seqno);
|
||||||
e->is_bad = 0;
|
e->is_bad = 0;
|
||||||
|
|
||||||
/* New entry goes first. */
|
/* New entry goes first. */
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: uaodv.c,v 1.37 2010/01/20 09:58:16 fros4943 Exp $
|
* $Id: uaodv.c,v 1.38 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,7 +70,7 @@ last_known_seqno(uip_ipaddr_t *host)
|
||||||
struct uaodv_rt_entry *route = uaodv_rt_lookup_any(host);
|
struct uaodv_rt_entry *route = uaodv_rt_lookup_any(host);
|
||||||
|
|
||||||
if(route != NULL)
|
if(route != NULL)
|
||||||
return htonl(route->hseqno);
|
return uip_htonl(route->hseqno);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -193,11 +193,11 @@ send_rreq(uip_ipaddr_t *addr)
|
||||||
rm->flags = 0;
|
rm->flags = 0;
|
||||||
rm->reserved = 0;
|
rm->reserved = 0;
|
||||||
rm->hop_count = 0;
|
rm->hop_count = 0;
|
||||||
rm->rreq_id = htonl(rreq_id++);
|
rm->rreq_id = uip_htonl(rreq_id++);
|
||||||
uip_ipaddr_copy(&rm->dest_addr, addr);
|
uip_ipaddr_copy(&rm->dest_addr, addr);
|
||||||
uip_gethostaddr(&rm->orig_addr);
|
uip_gethostaddr(&rm->orig_addr);
|
||||||
my_hseqno++; /* Always */
|
my_hseqno++; /* Always */
|
||||||
rm->orig_seqno = htonl(my_hseqno);
|
rm->orig_seqno = uip_htonl(my_hseqno);
|
||||||
bcastconn->ttl = MY_NET_DIAMETER;
|
bcastconn->ttl = MY_NET_DIAMETER;
|
||||||
len = sizeof(struct uaodv_msg_rreq);
|
len = sizeof(struct uaodv_msg_rreq);
|
||||||
len += add_rreq_extensions(rm + 1);
|
len += add_rreq_extensions(rm + 1);
|
||||||
|
@ -220,7 +220,7 @@ send_rrep(uip_ipaddr_t *dest, uip_ipaddr_t *nexthop, uip_ipaddr_t *orig,
|
||||||
uip_ipaddr_copy(&rm->orig_addr, orig);
|
uip_ipaddr_copy(&rm->orig_addr, orig);
|
||||||
rm->dest_seqno = *seqno;
|
rm->dest_seqno = *seqno;
|
||||||
uip_ipaddr_copy(&rm->dest_addr, dest);
|
uip_ipaddr_copy(&rm->dest_addr, dest);
|
||||||
rm->lifetime = HTONL(MY_ROUTE_TIMEOUT);
|
rm->lifetime = UIP_HTONL(MY_ROUTE_TIMEOUT);
|
||||||
sendto(nexthop, rm, sizeof(struct uaodv_msg_rrep));
|
sendto(nexthop, rm, sizeof(struct uaodv_msg_rrep));
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -256,9 +256,9 @@ handle_incoming_rreq(void)
|
||||||
uip_ipaddr_to_quad(&BUF->srcipaddr),
|
uip_ipaddr_to_quad(&BUF->srcipaddr),
|
||||||
uip_ipaddr_to_quad(&BUF->destipaddr),
|
uip_ipaddr_to_quad(&BUF->destipaddr),
|
||||||
BUF->ttl,
|
BUF->ttl,
|
||||||
uip_ipaddr_to_quad(&rm->orig_addr), ntohl(rm->orig_seqno),
|
uip_ipaddr_to_quad(&rm->orig_addr), uip_ntohl(rm->orig_seqno),
|
||||||
rm->hop_count,
|
rm->hop_count,
|
||||||
uip_ipaddr_to_quad(&rm->dest_addr), ntohl(rm->dest_seqno));
|
uip_ipaddr_to_quad(&rm->dest_addr), uip_ntohl(rm->dest_seqno));
|
||||||
|
|
||||||
if(uip_ipaddr_cmp(&rm->orig_addr, &uip_hostaddr)) {
|
if(uip_ipaddr_cmp(&rm->orig_addr, &uip_hostaddr)) {
|
||||||
return; /* RREQ looped back! */
|
return; /* RREQ looped back! */
|
||||||
|
@ -308,8 +308,8 @@ handle_incoming_rreq(void)
|
||||||
/* New reverse route? */
|
/* New reverse route? */
|
||||||
rt = uaodv_rt_lookup(&rm->orig_addr);
|
rt = uaodv_rt_lookup(&rm->orig_addr);
|
||||||
if(rt == NULL
|
if(rt == NULL
|
||||||
|| (SCMP32(ntohl(rm->orig_seqno), rt->hseqno) > 0) /* New route. */
|
|| (SCMP32(uip_ntohl(rm->orig_seqno), rt->hseqno) > 0) /* New route. */
|
||||||
|| (SCMP32(ntohl(rm->orig_seqno), rt->hseqno) == 0
|
|| (SCMP32(uip_ntohl(rm->orig_seqno), rt->hseqno) == 0
|
||||||
&& rm->hop_count < rt->hop_count)) { /* Better route. */
|
&& rm->hop_count < rt->hop_count)) { /* Better route. */
|
||||||
print_debug("Inserting1\n");
|
print_debug("Inserting1\n");
|
||||||
rt = uaodv_rt_add(&rm->orig_addr, uip_udp_sender(),
|
rt = uaodv_rt_add(&rm->orig_addr, uip_udp_sender(),
|
||||||
|
@ -324,7 +324,7 @@ handle_incoming_rreq(void)
|
||||||
fw = uaodv_rt_lookup(&rm->dest_addr);
|
fw = uaodv_rt_lookup(&rm->dest_addr);
|
||||||
if(!(rm->flags & UAODV_RREQ_UNKSEQNO)
|
if(!(rm->flags & UAODV_RREQ_UNKSEQNO)
|
||||||
&& fw != NULL
|
&& fw != NULL
|
||||||
&& SCMP32(fw->hseqno, ntohl(rm->dest_seqno)) <= 0) {
|
&& SCMP32(fw->hseqno, uip_ntohl(rm->dest_seqno)) <= 0) {
|
||||||
fw = NULL;
|
fw = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,7 @@ handle_incoming_rreq(void)
|
||||||
print_debug("RREQ for known route\n");
|
print_debug("RREQ for known route\n");
|
||||||
uip_ipaddr_copy(&dest_addr, &rm->dest_addr);
|
uip_ipaddr_copy(&dest_addr, &rm->dest_addr);
|
||||||
uip_ipaddr_copy(&orig_addr, &rm->orig_addr);
|
uip_ipaddr_copy(&orig_addr, &rm->orig_addr);
|
||||||
net_seqno = htonl(fw->hseqno);
|
net_seqno = uip_htonl(fw->hseqno);
|
||||||
send_rrep(&dest_addr, &rt->nexthop, &orig_addr, &net_seqno,
|
send_rrep(&dest_addr, &rt->nexthop, &orig_addr, &net_seqno,
|
||||||
fw->hop_count + 1);
|
fw->hop_count + 1);
|
||||||
} else if(uip_ipaddr_cmp(&rm->dest_addr, &uip_hostaddr)) {
|
} else if(uip_ipaddr_cmp(&rm->dest_addr, &uip_hostaddr)) {
|
||||||
|
@ -347,11 +347,11 @@ handle_incoming_rreq(void)
|
||||||
|
|
||||||
my_hseqno++;
|
my_hseqno++;
|
||||||
if(!(rm->flags & UAODV_RREQ_UNKSEQNO)
|
if(!(rm->flags & UAODV_RREQ_UNKSEQNO)
|
||||||
&& SCMP32(my_hseqno, ntohl(rm->dest_seqno)) < 0) {
|
&& SCMP32(my_hseqno, uip_ntohl(rm->dest_seqno)) < 0) {
|
||||||
print_debug("New my_hseqno %lu\n", my_hseqno); /* We have rebooted. */
|
print_debug("New my_hseqno %lu\n", my_hseqno); /* We have rebooted. */
|
||||||
my_hseqno = ntohl(rm->dest_seqno) + 1;
|
my_hseqno = uip_ntohl(rm->dest_seqno) + 1;
|
||||||
}
|
}
|
||||||
net_seqno = htonl(my_hseqno);
|
net_seqno = uip_htonl(my_hseqno);
|
||||||
send_rrep(&dest_addr, &rt->nexthop, &orig_addr, &net_seqno, 0);
|
send_rrep(&dest_addr, &rt->nexthop, &orig_addr, &net_seqno, 0);
|
||||||
} else if(BUF->ttl > 1) {
|
} else if(BUF->ttl > 1) {
|
||||||
int len;
|
int len;
|
||||||
|
@ -396,7 +396,7 @@ handle_incoming_rrep(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Sometimes it helps to send a non-requested RREP in response! */
|
/* Sometimes it helps to send a non-requested RREP in response! */
|
||||||
net_seqno = htonl(my_hseqno);
|
net_seqno = uip_htonl(my_hseqno);
|
||||||
send_rrep(&uip_hostaddr, &BUF->srcipaddr, &BUF->srcipaddr, &net_seqno, 0);
|
send_rrep(&uip_hostaddr, &BUF->srcipaddr, &BUF->srcipaddr, &net_seqno, 0);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
|
@ -406,14 +406,14 @@ handle_incoming_rrep(void)
|
||||||
" dest=%d.%d.%d.%d seq=%lu hops=%u orig=%d.%d.%d.%d\n",
|
" dest=%d.%d.%d.%d seq=%lu hops=%u orig=%d.%d.%d.%d\n",
|
||||||
uip_ipaddr_to_quad(&BUF->srcipaddr),
|
uip_ipaddr_to_quad(&BUF->srcipaddr),
|
||||||
uip_ipaddr_to_quad(&BUF->destipaddr),
|
uip_ipaddr_to_quad(&BUF->destipaddr),
|
||||||
uip_ipaddr_to_quad(&rm->dest_addr), ntohl(rm->dest_seqno),
|
uip_ipaddr_to_quad(&rm->dest_addr), uip_ntohl(rm->dest_seqno),
|
||||||
rm->hop_count,
|
rm->hop_count,
|
||||||
uip_ipaddr_to_quad(&rm->orig_addr));
|
uip_ipaddr_to_quad(&rm->orig_addr));
|
||||||
|
|
||||||
rt = uaodv_rt_lookup(&rm->dest_addr);
|
rt = uaodv_rt_lookup(&rm->dest_addr);
|
||||||
|
|
||||||
/* New forward route? */
|
/* New forward route? */
|
||||||
if(rt == NULL || (SCMP32(ntohl(rm->dest_seqno), rt->hseqno) > 0)) {
|
if(rt == NULL || (SCMP32(uip_ntohl(rm->dest_seqno), rt->hseqno) > 0)) {
|
||||||
print_debug("Inserting3\n");
|
print_debug("Inserting3\n");
|
||||||
rt = uaodv_rt_add(&rm->dest_addr, uip_udp_sender(),
|
rt = uaodv_rt_add(&rm->dest_addr, uip_udp_sender(),
|
||||||
rm->hop_count, &rm->dest_seqno);
|
rm->hop_count, &rm->dest_seqno);
|
||||||
|
@ -469,7 +469,7 @@ handle_incoming_rerr(void)
|
||||||
uip_ipaddr_to_quad(&BUF->srcipaddr),
|
uip_ipaddr_to_quad(&BUF->srcipaddr),
|
||||||
uip_ipaddr_to_quad(&BUF->destipaddr),
|
uip_ipaddr_to_quad(&BUF->destipaddr),
|
||||||
uip_ipaddr_to_quad((uip_ipaddr_t *)&rm->unreach[0]),
|
uip_ipaddr_to_quad((uip_ipaddr_t *)&rm->unreach[0]),
|
||||||
ntohl(rm->unreach[0].seqno));
|
uip_ntohl(rm->unreach[0].seqno));
|
||||||
|
|
||||||
if(uip_ipaddr_cmp(&rm->unreach[0].addr, &uip_hostaddr))
|
if(uip_ipaddr_cmp(&rm->unreach[0].addr, &uip_hostaddr))
|
||||||
return;
|
return;
|
||||||
|
@ -477,11 +477,11 @@ handle_incoming_rerr(void)
|
||||||
rt = uaodv_rt_lookup_any(&rm->unreach[0].addr);
|
rt = uaodv_rt_lookup_any(&rm->unreach[0].addr);
|
||||||
if(rt != NULL && uip_ipaddr_cmp(&rt->nexthop, uip_udp_sender())) {
|
if(rt != NULL && uip_ipaddr_cmp(&rt->nexthop, uip_udp_sender())) {
|
||||||
if((rm->flags & UAODV_RERR_UNKNOWN) || rm->unreach[0].seqno == 0
|
if((rm->flags & UAODV_RERR_UNKNOWN) || rm->unreach[0].seqno == 0
|
||||||
|| SCMP32(rt->hseqno, ntohl(rm->unreach[0].seqno)) <= 0) {
|
|| SCMP32(rt->hseqno, uip_ntohl(rm->unreach[0].seqno)) <= 0) {
|
||||||
rt->is_bad = 1;
|
rt->is_bad = 1;
|
||||||
if(rm->flags & UAODV_RERR_UNKNOWN) {
|
if(rm->flags & UAODV_RERR_UNKNOWN) {
|
||||||
rm->flags &= ~UAODV_RERR_UNKNOWN;
|
rm->flags &= ~UAODV_RERR_UNKNOWN;
|
||||||
rm->unreach[0].seqno = htonl(rt->hseqno);
|
rm->unreach[0].seqno = uip_htonl(rt->hseqno);
|
||||||
}
|
}
|
||||||
print_debug("RERR rebroadcast\n");
|
print_debug("RERR rebroadcast\n");
|
||||||
uip_udp_packet_send(bcastconn, rm, sizeof(struct uaodv_msg_rerr));
|
uip_udp_packet_send(bcastconn, rm, sizeof(struct uaodv_msg_rerr));
|
||||||
|
@ -529,7 +529,7 @@ uaodv_bad_dest(uip_ipaddr_t *dest)
|
||||||
bad_seqno = 0; /* Or flag this in RERR? */
|
bad_seqno = 0; /* Or flag this in RERR? */
|
||||||
else {
|
else {
|
||||||
rt->is_bad = 1;
|
rt->is_bad = 1;
|
||||||
bad_seqno = htonl(rt->hseqno);
|
bad_seqno = uip_htonl(rt->hseqno);
|
||||||
}
|
}
|
||||||
|
|
||||||
uip_ipaddr_copy(&bad_dest, dest);
|
uip_ipaddr_copy(&bad_dest, dest);
|
||||||
|
@ -576,8 +576,8 @@ PROCESS_THREAD(uaodv_process, ev, data)
|
||||||
|
|
||||||
printf("uaodv_process starting %lu\n", (unsigned long) my_hseqno);
|
printf("uaodv_process starting %lu\n", (unsigned long) my_hseqno);
|
||||||
|
|
||||||
bcastconn = udp_broadcast_new(HTONS(UAODV_UDPPORT), NULL);
|
bcastconn = udp_broadcast_new(UIP_HTONS(UAODV_UDPPORT), NULL);
|
||||||
unicastconn = udp_broadcast_new(HTONS(UAODV_UDPPORT), NULL);
|
unicastconn = udp_broadcast_new(UIP_HTONS(UAODV_UDPPORT), NULL);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
PROCESS_WAIT_EVENT();
|
PROCESS_WAIT_EVENT();
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: uip-fw.c,v 1.11 2008/02/08 09:12:57 nifi Exp $
|
* $Id: uip-fw.c,v 1.12 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* \addtogroup uip
|
* \addtogroup uip
|
||||||
|
@ -413,7 +413,7 @@ uip_fw_forward(void)
|
||||||
|
|
||||||
#ifdef AODV_COMPLIANCE
|
#ifdef AODV_COMPLIANCE
|
||||||
#define udp ((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])
|
#define udp ((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||||
if(udp->proto == UIP_PROTO_UDP && udp->destport == HTONS(UAODV_UDPPORT)) {
|
if(udp->proto == UIP_PROTO_UDP && udp->destport == UIP_HTONS(UAODV_UDPPORT)) {
|
||||||
return UIP_FW_LOCAL;
|
return UIP_FW_LOCAL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -466,10 +466,10 @@ uip_fw_forward(void)
|
||||||
BUF->ttl = BUF->ttl - 1;
|
BUF->ttl = BUF->ttl - 1;
|
||||||
|
|
||||||
/* Update the IP checksum. */
|
/* Update the IP checksum. */
|
||||||
if(BUF->ipchksum >= HTONS(0xffff - 0x0100)) {
|
if(BUF->ipchksum >= UIP_HTONS(0xffff - 0x0100)) {
|
||||||
BUF->ipchksum = BUF->ipchksum + HTONS(0x0100) + 1;
|
BUF->ipchksum = BUF->ipchksum + UIP_HTONS(0x0100) + 1;
|
||||||
} else {
|
} else {
|
||||||
BUF->ipchksum = BUF->ipchksum + HTONS(0x0100);
|
BUF->ipchksum = BUF->ipchksum + UIP_HTONS(0x0100);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
|
|
|
@ -179,7 +179,7 @@ uip_icmp6_error_output(u8_t type, u8_t code, u32_t param) {
|
||||||
|
|
||||||
UIP_ICMP_BUF->type = type;
|
UIP_ICMP_BUF->type = type;
|
||||||
UIP_ICMP_BUF->icode = code;
|
UIP_ICMP_BUF->icode = code;
|
||||||
UIP_ICMP6_ERROR_BUF->param = htonl(param);
|
UIP_ICMP6_ERROR_BUF->param = uip_htonl(param);
|
||||||
UIP_IP_BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
|
UIP_IP_BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
|
||||||
UIP_IP_BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
|
UIP_IP_BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
|
||||||
UIP_ICMP_BUF->icmpchksum = 0;
|
UIP_ICMP_BUF->icmpchksum = 0;
|
||||||
|
|
|
@ -632,9 +632,9 @@ uip_nd6_ra_output(uip_ipaddr_t * dest)
|
||||||
UIP_ND6_RA_BUF->flags_reserved =
|
UIP_ND6_RA_BUF->flags_reserved =
|
||||||
(UIP_ND6_M_FLAG << 7) | (UIP_ND6_O_FLAG << 6);
|
(UIP_ND6_M_FLAG << 7) | (UIP_ND6_O_FLAG << 6);
|
||||||
|
|
||||||
UIP_ND6_RA_BUF->router_lifetime = htons(UIP_ND6_ROUTER_LIFETIME);
|
UIP_ND6_RA_BUF->router_lifetime = uip_htons(UIP_ND6_ROUTER_LIFETIME);
|
||||||
//UIP_ND6_RA_BUF->reachable_time = htonl(uip_ds6_if.reachable_time);
|
//UIP_ND6_RA_BUF->reachable_time = uip_htonl(uip_ds6_if.reachable_time);
|
||||||
//UIP_ND6_RA_BUF->retrans_timer = htonl(uip_ds6_if.retrans_timer);
|
//UIP_ND6_RA_BUF->retrans_timer = uip_htonl(uip_ds6_if.retrans_timer);
|
||||||
UIP_ND6_RA_BUF->reachable_time = 0;
|
UIP_ND6_RA_BUF->reachable_time = 0;
|
||||||
UIP_ND6_RA_BUF->retrans_timer = 0;
|
UIP_ND6_RA_BUF->retrans_timer = 0;
|
||||||
|
|
||||||
|
@ -650,8 +650,8 @@ uip_nd6_ra_output(uip_ipaddr_t * dest)
|
||||||
UIP_ND6_OPT_PREFIX_BUF->len = UIP_ND6_OPT_PREFIX_INFO_LEN / 8;
|
UIP_ND6_OPT_PREFIX_BUF->len = UIP_ND6_OPT_PREFIX_INFO_LEN / 8;
|
||||||
UIP_ND6_OPT_PREFIX_BUF->preflen = prefix->length;
|
UIP_ND6_OPT_PREFIX_BUF->preflen = prefix->length;
|
||||||
UIP_ND6_OPT_PREFIX_BUF->flagsreserved1 = prefix->l_a_reserved;
|
UIP_ND6_OPT_PREFIX_BUF->flagsreserved1 = prefix->l_a_reserved;
|
||||||
UIP_ND6_OPT_PREFIX_BUF->validlt = htonl(prefix->vlifetime);
|
UIP_ND6_OPT_PREFIX_BUF->validlt = uip_htonl(prefix->vlifetime);
|
||||||
UIP_ND6_OPT_PREFIX_BUF->preferredlt = htonl(prefix->plifetime);
|
UIP_ND6_OPT_PREFIX_BUF->preferredlt = uip_htonl(prefix->plifetime);
|
||||||
UIP_ND6_OPT_PREFIX_BUF->reserved2 = 0;
|
UIP_ND6_OPT_PREFIX_BUF->reserved2 = 0;
|
||||||
uip_ipaddr_copy(&(UIP_ND6_OPT_PREFIX_BUF->prefix), &(prefix->ipaddr));
|
uip_ipaddr_copy(&(UIP_ND6_OPT_PREFIX_BUF->prefix), &(prefix->ipaddr));
|
||||||
nd6_opt_offset += UIP_ND6_OPT_PREFIX_INFO_LEN;
|
nd6_opt_offset += UIP_ND6_OPT_PREFIX_INFO_LEN;
|
||||||
|
@ -669,8 +669,8 @@ uip_nd6_ra_output(uip_ipaddr_t * dest)
|
||||||
UIP_ND6_OPT_MTU_BUF->type = UIP_ND6_OPT_MTU;
|
UIP_ND6_OPT_MTU_BUF->type = UIP_ND6_OPT_MTU;
|
||||||
UIP_ND6_OPT_MTU_BUF->len = UIP_ND6_OPT_MTU_LEN >> 3;
|
UIP_ND6_OPT_MTU_BUF->len = UIP_ND6_OPT_MTU_LEN >> 3;
|
||||||
UIP_ND6_OPT_MTU_BUF->reserved = 0;
|
UIP_ND6_OPT_MTU_BUF->reserved = 0;
|
||||||
//UIP_ND6_OPT_MTU_BUF->mtu = htonl(uip_ds6_if.link_mtu);
|
//UIP_ND6_OPT_MTU_BUF->mtu = uip_htonl(uip_ds6_if.link_mtu);
|
||||||
UIP_ND6_OPT_MTU_BUF->mtu = htonl(1500);
|
UIP_ND6_OPT_MTU_BUF->mtu = uip_htonl(1500);
|
||||||
|
|
||||||
uip_len += UIP_ND6_OPT_MTU_LEN;
|
uip_len += UIP_ND6_OPT_MTU_LEN;
|
||||||
nd6_opt_offset += UIP_ND6_OPT_MTU_LEN;
|
nd6_opt_offset += UIP_ND6_OPT_MTU_LEN;
|
||||||
|
@ -760,13 +760,13 @@ uip_nd6_ra_input(void)
|
||||||
|
|
||||||
if(UIP_ND6_RA_BUF->reachable_time != 0) {
|
if(UIP_ND6_RA_BUF->reachable_time != 0) {
|
||||||
if(uip_ds6_if.base_reachable_time !=
|
if(uip_ds6_if.base_reachable_time !=
|
||||||
ntohl(UIP_ND6_RA_BUF->reachable_time)) {
|
uip_ntohl(UIP_ND6_RA_BUF->reachable_time)) {
|
||||||
uip_ds6_if.base_reachable_time = ntohl(UIP_ND6_RA_BUF->reachable_time);
|
uip_ds6_if.base_reachable_time = uip_ntohl(UIP_ND6_RA_BUF->reachable_time);
|
||||||
uip_ds6_if.reachable_time = uip_ds6_compute_reachable_time();
|
uip_ds6_if.reachable_time = uip_ds6_compute_reachable_time();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(UIP_ND6_RA_BUF->retrans_timer != 0) {
|
if(UIP_ND6_RA_BUF->retrans_timer != 0) {
|
||||||
uip_ds6_if.retrans_timer = ntohl(UIP_ND6_RA_BUF->retrans_timer);
|
uip_ds6_if.retrans_timer = uip_ntohl(UIP_ND6_RA_BUF->retrans_timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Options processing */
|
/* Options processing */
|
||||||
|
@ -801,13 +801,13 @@ uip_nd6_ra_input(void)
|
||||||
case UIP_ND6_OPT_MTU:
|
case UIP_ND6_OPT_MTU:
|
||||||
PRINTF("Processing MTU option in RA\n");
|
PRINTF("Processing MTU option in RA\n");
|
||||||
uip_ds6_if.link_mtu =
|
uip_ds6_if.link_mtu =
|
||||||
ntohl(((uip_nd6_opt_mtu *) UIP_ND6_OPT_HDR_BUF)->mtu);
|
uip_ntohl(((uip_nd6_opt_mtu *) UIP_ND6_OPT_HDR_BUF)->mtu);
|
||||||
break;
|
break;
|
||||||
case UIP_ND6_OPT_PREFIX_INFO:
|
case UIP_ND6_OPT_PREFIX_INFO:
|
||||||
PRINTF("Processing PREFIX option in RA\n");
|
PRINTF("Processing PREFIX option in RA\n");
|
||||||
nd6_opt_prefix_info = (uip_nd6_opt_prefix_info *) UIP_ND6_OPT_HDR_BUF;
|
nd6_opt_prefix_info = (uip_nd6_opt_prefix_info *) UIP_ND6_OPT_HDR_BUF;
|
||||||
if((ntohl(nd6_opt_prefix_info->validlt) >=
|
if((uip_ntohl(nd6_opt_prefix_info->validlt) >=
|
||||||
ntohl(nd6_opt_prefix_info->preferredlt))
|
uip_ntohl(nd6_opt_prefix_info->preferredlt))
|
||||||
&& (!uip_is_addr_link_local(&nd6_opt_prefix_info->prefix))) {
|
&& (!uip_is_addr_link_local(&nd6_opt_prefix_info->prefix))) {
|
||||||
/* on-link flag related processing */
|
/* on-link flag related processing */
|
||||||
if(nd6_opt_prefix_info->flagsreserved1 & UIP_ND6_RA_FLAG_ONLINK) {
|
if(nd6_opt_prefix_info->flagsreserved1 & UIP_ND6_RA_FLAG_ONLINK) {
|
||||||
|
@ -819,7 +819,7 @@ uip_nd6_ra_input(void)
|
||||||
if(nd6_opt_prefix_info->validlt != UIP_ND6_INFINITE_LIFETIME) {
|
if(nd6_opt_prefix_info->validlt != UIP_ND6_INFINITE_LIFETIME) {
|
||||||
prefix = uip_ds6_prefix_add(&nd6_opt_prefix_info->prefix,
|
prefix = uip_ds6_prefix_add(&nd6_opt_prefix_info->prefix,
|
||||||
nd6_opt_prefix_info->preflen,
|
nd6_opt_prefix_info->preflen,
|
||||||
ntohl(nd6_opt_prefix_info->
|
uip_ntohl(nd6_opt_prefix_info->
|
||||||
validlt));
|
validlt));
|
||||||
} else {
|
} else {
|
||||||
prefix = uip_ds6_prefix_add(&nd6_opt_prefix_info->prefix,
|
prefix = uip_ds6_prefix_add(&nd6_opt_prefix_info->prefix,
|
||||||
|
@ -837,9 +837,9 @@ uip_nd6_ra_input(void)
|
||||||
default:
|
default:
|
||||||
PRINTF("Updating timer of prefix");
|
PRINTF("Updating timer of prefix");
|
||||||
PRINT6ADDR(&prefix->ipaddr);
|
PRINT6ADDR(&prefix->ipaddr);
|
||||||
PRINTF("new value %lu\n", ntohl(nd6_opt_prefix_info->validlt));
|
PRINTF("new value %lu\n", uip_ntohl(nd6_opt_prefix_info->validlt));
|
||||||
stimer_set(&prefix->vlifetime,
|
stimer_set(&prefix->vlifetime,
|
||||||
ntohl(nd6_opt_prefix_info->validlt));
|
uip_ntohl(nd6_opt_prefix_info->validlt));
|
||||||
prefix->isinfinite = 0;
|
prefix->isinfinite = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -857,15 +857,15 @@ uip_nd6_ra_input(void)
|
||||||
if((addr != NULL) && (addr->type == ADDR_AUTOCONF)) {
|
if((addr != NULL) && (addr->type == ADDR_AUTOCONF)) {
|
||||||
if(nd6_opt_prefix_info->validlt != UIP_ND6_INFINITE_LIFETIME) {
|
if(nd6_opt_prefix_info->validlt != UIP_ND6_INFINITE_LIFETIME) {
|
||||||
/* The processing below is defined in RFC4862 section 5.5.3 e */
|
/* The processing below is defined in RFC4862 section 5.5.3 e */
|
||||||
if((ntohl(nd6_opt_prefix_info->validlt) > 2 * 60 * 60) ||
|
if((uip_ntohl(nd6_opt_prefix_info->validlt) > 2 * 60 * 60) ||
|
||||||
(ntohl(nd6_opt_prefix_info->validlt) >
|
(uip_ntohl(nd6_opt_prefix_info->validlt) >
|
||||||
stimer_remaining(&addr->vlifetime))) {
|
stimer_remaining(&addr->vlifetime))) {
|
||||||
PRINTF("Updating timer of address");
|
PRINTF("Updating timer of address");
|
||||||
PRINT6ADDR(&addr->ipaddr);
|
PRINT6ADDR(&addr->ipaddr);
|
||||||
PRINTF("new value %lu\n",
|
PRINTF("new value %lu\n",
|
||||||
ntohl(nd6_opt_prefix_info->validlt));
|
uip_ntohl(nd6_opt_prefix_info->validlt));
|
||||||
stimer_set(&addr->vlifetime,
|
stimer_set(&addr->vlifetime,
|
||||||
ntohl(nd6_opt_prefix_info->validlt));
|
uip_ntohl(nd6_opt_prefix_info->validlt));
|
||||||
} else {
|
} else {
|
||||||
stimer_set(&addr->vlifetime, 2 * 60 * 60);
|
stimer_set(&addr->vlifetime, 2 * 60 * 60);
|
||||||
PRINTF("Updating timer of address ");
|
PRINTF("Updating timer of address ");
|
||||||
|
@ -877,11 +877,11 @@ uip_nd6_ra_input(void)
|
||||||
addr->isinfinite = 1;
|
addr->isinfinite = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(ntohl(nd6_opt_prefix_info->validlt) ==
|
if(uip_ntohl(nd6_opt_prefix_info->validlt) ==
|
||||||
UIP_ND6_INFINITE_LIFETIME) {
|
UIP_ND6_INFINITE_LIFETIME) {
|
||||||
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
|
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
|
||||||
} else {
|
} else {
|
||||||
uip_ds6_addr_add(&ipaddr, ntohl(nd6_opt_prefix_info->validlt),
|
uip_ds6_addr_add(&ipaddr, uip_ntohl(nd6_opt_prefix_info->validlt),
|
||||||
ADDR_AUTOCONF);
|
ADDR_AUTOCONF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -904,10 +904,10 @@ uip_nd6_ra_input(void)
|
||||||
if(defrt == NULL) {
|
if(defrt == NULL) {
|
||||||
uip_ds6_defrt_add(&UIP_IP_BUF->srcipaddr,
|
uip_ds6_defrt_add(&UIP_IP_BUF->srcipaddr,
|
||||||
(unsigned
|
(unsigned
|
||||||
long)(ntohs(UIP_ND6_RA_BUF->router_lifetime)));
|
long)(uip_ntohs(UIP_ND6_RA_BUF->router_lifetime)));
|
||||||
} else {
|
} else {
|
||||||
stimer_set(&(defrt->lifetime),
|
stimer_set(&(defrt->lifetime),
|
||||||
(unsigned long)(ntohs(UIP_ND6_RA_BUF->router_lifetime)));
|
(unsigned long)(uip_ntohs(UIP_ND6_RA_BUF->router_lifetime)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(defrt != NULL) {
|
if(defrt != NULL) {
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: uip.c,v 1.29 2010/05/30 09:46:12 oliverschmidt Exp $
|
* $Id: uip.c,v 1.30 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ chksum(u16_t sum, const u8_t *data, u16_t len)
|
||||||
u16_t
|
u16_t
|
||||||
uip_chksum(u16_t *data, u16_t len)
|
uip_chksum(u16_t *data, u16_t len)
|
||||||
{
|
{
|
||||||
return htons(chksum(0, (u8_t *)data, len));
|
return uip_htons(chksum(0, (u8_t *)data, len));
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#ifndef UIP_ARCH_IPCHKSUM
|
#ifndef UIP_ARCH_IPCHKSUM
|
||||||
|
@ -313,7 +313,7 @@ uip_ipchksum(void)
|
||||||
|
|
||||||
sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN);
|
sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN);
|
||||||
DEBUG_PRINTF("uip_ipchksum: sum 0x%04x\n", sum);
|
DEBUG_PRINTF("uip_ipchksum: sum 0x%04x\n", sum);
|
||||||
return (sum == 0) ? 0xffff : htons(sum);
|
return (sum == 0) ? 0xffff : uip_htons(sum);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -340,7 +340,7 @@ upper_layer_chksum(u8_t proto)
|
||||||
sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN],
|
sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN],
|
||||||
upper_layer_len);
|
upper_layer_len);
|
||||||
|
|
||||||
return (sum == 0) ? 0xffff : htons(sum);
|
return (sum == 0) ? 0xffff : uip_htons(sum);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if UIP_CONF_IPV6
|
#if UIP_CONF_IPV6
|
||||||
|
@ -413,7 +413,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
|
||||||
for(c = 0; c < UIP_CONNS; ++c) {
|
for(c = 0; c < UIP_CONNS; ++c) {
|
||||||
conn = &uip_conns[c];
|
conn = &uip_conns[c];
|
||||||
if(conn->tcpstateflags != UIP_CLOSED &&
|
if(conn->tcpstateflags != UIP_CLOSED &&
|
||||||
conn->lport == htons(lastport)) {
|
conn->lport == uip_htons(lastport)) {
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -452,7 +452,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
|
||||||
conn->rto = UIP_RTO;
|
conn->rto = UIP_RTO;
|
||||||
conn->sa = 0;
|
conn->sa = 0;
|
||||||
conn->sv = 16; /* Initial value of the RTT variance. */
|
conn->sv = 16; /* Initial value of the RTT variance. */
|
||||||
conn->lport = htons(lastport);
|
conn->lport = uip_htons(lastport);
|
||||||
conn->rport = rport;
|
conn->rport = rport;
|
||||||
uip_ipaddr_copy(&conn->ripaddr, ripaddr);
|
uip_ipaddr_copy(&conn->ripaddr, ripaddr);
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
|
||||||
}
|
}
|
||||||
|
|
||||||
for(c = 0; c < UIP_UDP_CONNS; ++c) {
|
for(c = 0; c < UIP_UDP_CONNS; ++c) {
|
||||||
if(uip_udp_conns[c].lport == htons(lastport)) {
|
if(uip_udp_conns[c].lport == uip_htons(lastport)) {
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -493,7 +493,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
conn->lport = HTONS(lastport);
|
conn->lport = UIP_HTONS(lastport);
|
||||||
conn->rport = rport;
|
conn->rport = rport;
|
||||||
if(ripaddr == NULL) {
|
if(ripaddr == NULL) {
|
||||||
memset(&conn->ripaddr, 0, sizeof(uip_ipaddr_t));
|
memset(&conn->ripaddr, 0, sizeof(uip_ipaddr_t));
|
||||||
|
@ -935,7 +935,7 @@ uip_process(u8_t flag)
|
||||||
address) as well. However, we will cheat here and accept all
|
address) as well. However, we will cheat here and accept all
|
||||||
multicast packets that are sent to the ff02::/16 addresses. */
|
multicast packets that are sent to the ff02::/16 addresses. */
|
||||||
if(!uip_ipaddr_cmp(&BUF->destipaddr, &uip_hostaddr) &&
|
if(!uip_ipaddr_cmp(&BUF->destipaddr, &uip_hostaddr) &&
|
||||||
BUF->destipaddr.u16[0] != HTONS(0xff02)) {
|
BUF->destipaddr.u16[0] != UIP_HTONS(0xff02)) {
|
||||||
UIP_STAT(++uip_stat.ip.drop);
|
UIP_STAT(++uip_stat.ip.drop);
|
||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
|
@ -1000,10 +1000,10 @@ uip_process(u8_t flag)
|
||||||
|
|
||||||
ICMPBUF->type = ICMP_ECHO_REPLY;
|
ICMPBUF->type = ICMP_ECHO_REPLY;
|
||||||
|
|
||||||
if(ICMPBUF->icmpchksum >= HTONS(0xffff - (ICMP_ECHO << 8))) {
|
if(ICMPBUF->icmpchksum >= UIP_HTONS(0xffff - (ICMP_ECHO << 8))) {
|
||||||
ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8) + 1;
|
ICMPBUF->icmpchksum += UIP_HTONS(ICMP_ECHO << 8) + 1;
|
||||||
} else {
|
} else {
|
||||||
ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8);
|
ICMPBUF->icmpchksum += UIP_HTONS(ICMP_ECHO << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Swap IP addresses. */
|
/* Swap IP addresses. */
|
||||||
|
@ -1191,7 +1191,7 @@ uip_process(u8_t flag)
|
||||||
BUF->ttl = uip_udp_conn->ttl;
|
BUF->ttl = uip_udp_conn->ttl;
|
||||||
BUF->proto = UIP_PROTO_UDP;
|
BUF->proto = UIP_PROTO_UDP;
|
||||||
|
|
||||||
UDPBUF->udplen = HTONS(uip_slen + UIP_UDPH_LEN);
|
UDPBUF->udplen = UIP_HTONS(uip_slen + UIP_UDPH_LEN);
|
||||||
UDPBUF->udpchksum = 0;
|
UDPBUF->udpchksum = 0;
|
||||||
|
|
||||||
BUF->srcport = uip_udp_conn->lport;
|
BUF->srcport = uip_udp_conn->lport;
|
||||||
|
@ -1939,15 +1939,15 @@ uip_process(u8_t flag)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
u16_t
|
u16_t
|
||||||
htons(u16_t val)
|
uip_htons(u16_t val)
|
||||||
{
|
{
|
||||||
return HTONS(val);
|
return UIP_HTONS(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32_t
|
u32_t
|
||||||
htonl(u32_t val)
|
uip_htonl(u32_t val)
|
||||||
{
|
{
|
||||||
return HTONL(val);
|
return UIP_HTONL(val);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: uip.h,v 1.34 2010/05/30 09:46:12 oliverschmidt Exp $
|
* $Id: uip.h,v 1.35 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -290,14 +290,14 @@ void uip_setipid(u16_t id);
|
||||||
#define BUF ((struct uip_eth_hdr *)&uip_buf[0])
|
#define BUF ((struct uip_eth_hdr *)&uip_buf[0])
|
||||||
uip_len = ethernet_devicedrver_poll();
|
uip_len = ethernet_devicedrver_poll();
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
if(BUF->type == HTONS(UIP_ETHTYPE_IP)) {
|
if(BUF->type == UIP_HTONS(UIP_ETHTYPE_IP)) {
|
||||||
uip_arp_ipin();
|
uip_arp_ipin();
|
||||||
uip_input();
|
uip_input();
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
uip_arp_out();
|
uip_arp_out();
|
||||||
ethernet_devicedriver_send();
|
ethernet_devicedriver_send();
|
||||||
}
|
}
|
||||||
} else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) {
|
} else if(BUF->type == UIP_HTONS(UIP_ETHTYPE_ARP)) {
|
||||||
uip_arp_arpin();
|
uip_arp_arpin();
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
ethernet_devicedriver_send();
|
ethernet_devicedriver_send();
|
||||||
|
@ -504,10 +504,10 @@ CCIF extern uip_buf_t uip_aligned_buf;
|
||||||
* Start listening to the specified port.
|
* Start listening to the specified port.
|
||||||
*
|
*
|
||||||
* \note Since this function expects the port number in network byte
|
* \note Since this function expects the port number in network byte
|
||||||
* order, a conversion using HTONS() or htons() is necessary.
|
* order, a conversion using UIP_HTONS() or uip_htons() is necessary.
|
||||||
*
|
*
|
||||||
\code
|
\code
|
||||||
uip_listen(HTONS(80));
|
uip_listen(UIP_HTONS(80));
|
||||||
\endcode
|
\endcode
|
||||||
*
|
*
|
||||||
* \param port A 16-bit port number in network byte order.
|
* \param port A 16-bit port number in network byte order.
|
||||||
|
@ -518,10 +518,10 @@ void uip_listen(u16_t port);
|
||||||
* Stop listening to the specified port.
|
* Stop listening to the specified port.
|
||||||
*
|
*
|
||||||
* \note Since this function expects the port number in network byte
|
* \note Since this function expects the port number in network byte
|
||||||
* order, a conversion using HTONS() or htons() is necessary.
|
* order, a conversion using UIP_HTONS() or uip_htons() is necessary.
|
||||||
*
|
*
|
||||||
\code
|
\code
|
||||||
uip_unlisten(HTONS(80));
|
uip_unlisten(UIP_HTONS(80));
|
||||||
\endcode
|
\endcode
|
||||||
*
|
*
|
||||||
* \param port A 16-bit port number in network byte order.
|
* \param port A 16-bit port number in network byte order.
|
||||||
|
@ -543,13 +543,13 @@ void uip_unlisten(u16_t port);
|
||||||
* has been configured by defining UIP_ACTIVE_OPEN to 1 in uipopt.h.
|
* has been configured by defining UIP_ACTIVE_OPEN to 1 in uipopt.h.
|
||||||
*
|
*
|
||||||
* \note Since this function requires the port number to be in network
|
* \note Since this function requires the port number to be in network
|
||||||
* byte order, a conversion using HTONS() or htons() is necessary.
|
* byte order, a conversion using UIP_HTONS() or uip_htons() is necessary.
|
||||||
*
|
*
|
||||||
\code
|
\code
|
||||||
uip_ipaddr_t ipaddr;
|
uip_ipaddr_t ipaddr;
|
||||||
|
|
||||||
uip_ipaddr(&ipaddr, 192,168,1,2);
|
uip_ipaddr(&ipaddr, 192,168,1,2);
|
||||||
uip_connect(&ipaddr, HTONS(80));
|
uip_connect(&ipaddr, UIP_HTONS(80));
|
||||||
\endcode
|
\endcode
|
||||||
*
|
*
|
||||||
* \param ripaddr The IP address of the remote host.
|
* \param ripaddr The IP address of the remote host.
|
||||||
|
@ -816,9 +816,9 @@ CCIF void uip_send(const void *data, int len);
|
||||||
struct uip_udp_conn *c;
|
struct uip_udp_conn *c;
|
||||||
|
|
||||||
uip_ipaddr(&addr, 192,168,2,1);
|
uip_ipaddr(&addr, 192,168,2,1);
|
||||||
c = uip_udp_new(&addr, HTONS(12345));
|
c = uip_udp_new(&addr, UIP_HTONS(12345));
|
||||||
if(c != NULL) {
|
if(c != NULL) {
|
||||||
uip_udp_bind(c, HTONS(12344));
|
uip_udp_bind(c, UIP_HTONS(12344));
|
||||||
}
|
}
|
||||||
\endcode
|
\endcode
|
||||||
* \param ripaddr The IP address of the remote host.
|
* \param ripaddr The IP address of the remote host.
|
||||||
|
@ -903,7 +903,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
|
||||||
struct uip_conn *c;
|
struct uip_conn *c;
|
||||||
|
|
||||||
uip_ipaddr(&ipaddr, 192,168,1,2);
|
uip_ipaddr(&ipaddr, 192,168,1,2);
|
||||||
c = uip_connect(&ipaddr, HTONS(80));
|
c = uip_connect(&ipaddr, UIP_HTONS(80));
|
||||||
\endcode
|
\endcode
|
||||||
*
|
*
|
||||||
* \param addr A pointer to a uip_ipaddr_t variable that will be
|
* \param addr A pointer to a uip_ipaddr_t variable that will be
|
||||||
|
@ -931,14 +931,14 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
|
||||||
* \hideinitializer
|
* \hideinitializer
|
||||||
*/
|
*/
|
||||||
#define uip_ip6addr(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7) do { \
|
#define uip_ip6addr(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7) do { \
|
||||||
(addr)->u16[0] = HTONS(addr0); \
|
(addr)->u16[0] = UIP_HTONS(addr0); \
|
||||||
(addr)->u16[1] = HTONS(addr1); \
|
(addr)->u16[1] = UIP_HTONS(addr1); \
|
||||||
(addr)->u16[2] = HTONS(addr2); \
|
(addr)->u16[2] = UIP_HTONS(addr2); \
|
||||||
(addr)->u16[3] = HTONS(addr3); \
|
(addr)->u16[3] = UIP_HTONS(addr3); \
|
||||||
(addr)->u16[4] = HTONS(addr4); \
|
(addr)->u16[4] = UIP_HTONS(addr4); \
|
||||||
(addr)->u16[5] = HTONS(addr5); \
|
(addr)->u16[5] = UIP_HTONS(addr5); \
|
||||||
(addr)->u16[6] = HTONS(addr6); \
|
(addr)->u16[6] = UIP_HTONS(addr6); \
|
||||||
(addr)->u16[7] = HTONS(addr7); \
|
(addr)->u16[7] = UIP_HTONS(addr7); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1184,41 +1184,41 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
|
||||||
*
|
*
|
||||||
* This macro is primarily used for converting constants from host
|
* This macro is primarily used for converting constants from host
|
||||||
* byte order to network byte order. For converting variables to
|
* byte order to network byte order. For converting variables to
|
||||||
* network byte order, use the htons() function instead.
|
* network byte order, use the uip_htons() function instead.
|
||||||
*
|
*
|
||||||
* \hideinitializer
|
* \hideinitializer
|
||||||
*/
|
*/
|
||||||
#ifndef HTONS
|
#ifndef UIP_HTONS
|
||||||
# if UIP_BYTE_ORDER == UIP_BIG_ENDIAN
|
# if UIP_BYTE_ORDER == UIP_BIG_ENDIAN
|
||||||
# define HTONS(n) (n)
|
# define UIP_HTONS(n) (n)
|
||||||
# define HTONL(n) (n)
|
# define UIP_HTONL(n) (n)
|
||||||
# else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
|
# else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
|
||||||
# define HTONS(n) (u16_t)((((u16_t) (n)) << 8) | (((u16_t) (n)) >> 8))
|
# define UIP_HTONS(n) (u16_t)((((u16_t) (n)) << 8) | (((u16_t) (n)) >> 8))
|
||||||
# define HTONL(n) (((u32_t)HTONS(n) << 16) | HTONS((u32_t)(n) >> 16))
|
# define UIP_HTONL(n) (((u32_t)UIP_HTONS(n) << 16) | UIP_HTONS((u32_t)(n) >> 16))
|
||||||
# endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
|
# endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
|
||||||
#else
|
#else
|
||||||
#error "HTONS already defined!"
|
#error "UIP_HTONS already defined!"
|
||||||
#endif /* HTONS */
|
#endif /* UIP_HTONS */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert 16-bit quantity from host byte order to network byte order.
|
* Convert 16-bit quantity from host byte order to network byte order.
|
||||||
*
|
*
|
||||||
* This function is primarily used for converting variables from host
|
* This function is primarily used for converting variables from host
|
||||||
* byte order to network byte order. For converting constants to
|
* byte order to network byte order. For converting constants to
|
||||||
* network byte order, use the HTONS() macro instead.
|
* network byte order, use the UIP_HTONS() macro instead.
|
||||||
*/
|
*/
|
||||||
#ifndef htons
|
#ifndef uip_htons
|
||||||
CCIF u16_t htons(u16_t val);
|
CCIF u16_t uip_htons(u16_t val);
|
||||||
#endif /* htons */
|
#endif /* uip_htons */
|
||||||
#ifndef ntohs
|
#ifndef uip_ntohs
|
||||||
#define ntohs htons
|
#define uip_ntohs uip_htons
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef htonl
|
#ifndef uip_htonl
|
||||||
CCIF u32_t htonl(u32_t val);
|
CCIF u32_t uip_htonl(u32_t val);
|
||||||
#endif /* htonl */
|
#endif /* uip_htonl */
|
||||||
#ifndef ntohl
|
#ifndef uip_ntohl
|
||||||
#define ntohl htonl
|
#define uip_ntohl uip_htonl
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
@ -1993,7 +1993,7 @@ CCIF extern uip_lladdr_t uip_lladdr;
|
||||||
/** \brief set IP address a to the link local all-routers multicast address */
|
/** \brief set IP address a to the link local all-routers multicast address */
|
||||||
#define uip_create_linklocal_allrouters_mcast(a) uip_ip6addr(a, 0xff02, 0, 0, 0, 0, 0, 0, 0x0002)
|
#define uip_create_linklocal_allrouters_mcast(a) uip_ip6addr(a, 0xff02, 0, 0, 0, 0, 0, 0, 0x0002)
|
||||||
#define uip_create_linklocal_prefix(addr) do { \
|
#define uip_create_linklocal_prefix(addr) do { \
|
||||||
(addr)->u16[0] = HTONS(0xfe80); \
|
(addr)->u16[0] = UIP_HTONS(0xfe80); \
|
||||||
(addr)->u16[1] = 0; \
|
(addr)->u16[1] = 0; \
|
||||||
(addr)->u16[2] = 0; \
|
(addr)->u16[2] = 0; \
|
||||||
(addr)->u16[3] = 0; \
|
(addr)->u16[3] = 0; \
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: uip6.c,v 1.23 2010/05/24 10:07:34 joxe Exp $
|
* $Id: uip6.c,v 1.24 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ chksum(u16_t sum, const u8_t *data, u16_t len)
|
||||||
u16_t
|
u16_t
|
||||||
uip_chksum(u16_t *data, u16_t len)
|
uip_chksum(u16_t *data, u16_t len)
|
||||||
{
|
{
|
||||||
return htons(chksum(0, (u8_t *)data, len));
|
return uip_htons(chksum(0, (u8_t *)data, len));
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#ifndef UIP_ARCH_IPCHKSUM
|
#ifndef UIP_ARCH_IPCHKSUM
|
||||||
|
@ -348,7 +348,7 @@ uip_ipchksum(void)
|
||||||
|
|
||||||
sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN);
|
sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN);
|
||||||
PRINTF("uip_ipchksum: sum 0x%04x\n", sum);
|
PRINTF("uip_ipchksum: sum 0x%04x\n", sum);
|
||||||
return (sum == 0) ? 0xffff : htons(sum);
|
return (sum == 0) ? 0xffff : uip_htons(sum);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -370,7 +370,7 @@ upper_layer_chksum(u8_t proto)
|
||||||
sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN + uip_ext_len],
|
sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN + uip_ext_len],
|
||||||
upper_layer_len);
|
upper_layer_len);
|
||||||
|
|
||||||
return (sum == 0) ? 0xffff : htons(sum);
|
return (sum == 0) ? 0xffff : uip_htons(sum);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
u16_t
|
u16_t
|
||||||
|
@ -443,7 +443,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
|
||||||
for(c = 0; c < UIP_CONNS; ++c) {
|
for(c = 0; c < UIP_CONNS; ++c) {
|
||||||
conn = &uip_conns[c];
|
conn = &uip_conns[c];
|
||||||
if(conn->tcpstateflags != UIP_CLOSED &&
|
if(conn->tcpstateflags != UIP_CLOSED &&
|
||||||
conn->lport == htons(lastport)) {
|
conn->lport == uip_htons(lastport)) {
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -482,7 +482,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
|
||||||
conn->rto = UIP_RTO;
|
conn->rto = UIP_RTO;
|
||||||
conn->sa = 0;
|
conn->sa = 0;
|
||||||
conn->sv = 16; /* Initial value of the RTT variance. */
|
conn->sv = 16; /* Initial value of the RTT variance. */
|
||||||
conn->lport = htons(lastport);
|
conn->lport = uip_htons(lastport);
|
||||||
conn->rport = rport;
|
conn->rport = rport;
|
||||||
uip_ipaddr_copy(&conn->ripaddr, ripaddr);
|
uip_ipaddr_copy(&conn->ripaddr, ripaddr);
|
||||||
|
|
||||||
|
@ -507,7 +507,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
|
||||||
}
|
}
|
||||||
|
|
||||||
for(c = 0; c < UIP_UDP_CONNS; ++c) {
|
for(c = 0; c < UIP_UDP_CONNS; ++c) {
|
||||||
if(uip_udp_conns[c].lport == htons(lastport)) {
|
if(uip_udp_conns[c].lport == uip_htons(lastport)) {
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -525,7 +525,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
conn->lport = HTONS(lastport);
|
conn->lport = UIP_HTONS(lastport);
|
||||||
conn->rport = rport;
|
conn->rport = rport;
|
||||||
if(ripaddr == NULL) {
|
if(ripaddr == NULL) {
|
||||||
memset(&conn->ripaddr, 0, sizeof(uip_ipaddr_t));
|
memset(&conn->ripaddr, 0, sizeof(uip_ipaddr_t));
|
||||||
|
@ -634,7 +634,7 @@ uip_reass(void)
|
||||||
uip_ipaddr_cmp(&FBUF->destipaddr, &UIP_IP_BUF->destipaddr) &&
|
uip_ipaddr_cmp(&FBUF->destipaddr, &UIP_IP_BUF->destipaddr) &&
|
||||||
UIP_FRAG_BUF->id == uip_id) {
|
UIP_FRAG_BUF->id == uip_id) {
|
||||||
len = uip_len - uip_ext_len - UIP_IPH_LEN - UIP_FRAGH_LEN;
|
len = uip_len - uip_ext_len - UIP_IPH_LEN - UIP_FRAGH_LEN;
|
||||||
offset = (ntohs(UIP_FRAG_BUF->offsetresmore) & 0xfff8);
|
offset = (uip_ntohs(UIP_FRAG_BUF->offsetresmore) & 0xfff8);
|
||||||
/* in byte, originaly in multiple of 8 bytes*/
|
/* in byte, originaly in multiple of 8 bytes*/
|
||||||
PRINTF("len %d\n", len);
|
PRINTF("len %d\n", len);
|
||||||
PRINTF("offset %d\n", offset);
|
PRINTF("offset %d\n", offset);
|
||||||
|
@ -666,7 +666,7 @@ uip_reass(void)
|
||||||
|
|
||||||
/* If this fragment has the More Fragments flag set to zero, it is the
|
/* If this fragment has the More Fragments flag set to zero, it is the
|
||||||
last fragment*/
|
last fragment*/
|
||||||
if((ntohs(UIP_FRAG_BUF->offsetresmore) & IP_MF) == 0) {
|
if((uip_ntohs(UIP_FRAG_BUF->offsetresmore) & IP_MF) == 0) {
|
||||||
uip_reassflags |= UIP_REASS_FLAG_LASTFRAG;
|
uip_reassflags |= UIP_REASS_FLAG_LASTFRAG;
|
||||||
/*calculate the size of the entire packet*/
|
/*calculate the size of the entire packet*/
|
||||||
uip_reasslen = offset + len;
|
uip_reasslen = offset + len;
|
||||||
|
@ -1442,7 +1442,7 @@ uip_process(u8_t flag)
|
||||||
UIP_IP_BUF->ttl = uip_udp_conn->ttl;
|
UIP_IP_BUF->ttl = uip_udp_conn->ttl;
|
||||||
UIP_IP_BUF->proto = UIP_PROTO_UDP;
|
UIP_IP_BUF->proto = UIP_PROTO_UDP;
|
||||||
|
|
||||||
UIP_UDP_BUF->udplen = HTONS(uip_slen + UIP_UDPH_LEN);
|
UIP_UDP_BUF->udplen = UIP_HTONS(uip_slen + UIP_UDPH_LEN);
|
||||||
UIP_UDP_BUF->udpchksum = 0;
|
UIP_UDP_BUF->udpchksum = 0;
|
||||||
|
|
||||||
UIP_UDP_BUF->srcport = uip_udp_conn->lport;
|
UIP_UDP_BUF->srcport = uip_udp_conn->lport;
|
||||||
|
@ -2189,15 +2189,15 @@ uip_process(u8_t flag)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
u16_t
|
u16_t
|
||||||
htons(u16_t val)
|
uip_htons(u16_t val)
|
||||||
{
|
{
|
||||||
return HTONS(val);
|
return UIP_HTONS(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32_t
|
u32_t
|
||||||
htonl(u32_t val)
|
uip_htonl(u32_t val)
|
||||||
{
|
{
|
||||||
return HTONL(val);
|
return UIP_HTONL(val);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: uip_arp.c,v 1.5 2008/02/07 01:35:00 adamdunkels Exp $
|
* $Id: uip_arp.c,v 1.6 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ uip_arp_arpin(void)
|
||||||
uip_len = 0;
|
uip_len = 0;
|
||||||
|
|
||||||
switch(BUF->opcode) {
|
switch(BUF->opcode) {
|
||||||
case HTONS(ARP_REQUEST):
|
case UIP_HTONS(ARP_REQUEST):
|
||||||
/* ARP request. If it asked for our address, we send out a
|
/* ARP request. If it asked for our address, we send out a
|
||||||
reply. */
|
reply. */
|
||||||
/* if(BUF->dipaddr[0] == uip_hostaddr[0] &&
|
/* if(BUF->dipaddr[0] == uip_hostaddr[0] &&
|
||||||
|
@ -306,7 +306,7 @@ uip_arp_arpin(void)
|
||||||
with this host in the future. */
|
with this host in the future. */
|
||||||
uip_arp_update(&BUF->sipaddr, &BUF->shwaddr);
|
uip_arp_update(&BUF->sipaddr, &BUF->shwaddr);
|
||||||
|
|
||||||
BUF->opcode = HTONS(ARP_REPLY);
|
BUF->opcode = UIP_HTONS(ARP_REPLY);
|
||||||
|
|
||||||
memcpy(BUF->dhwaddr.addr, BUF->shwaddr.addr, 6);
|
memcpy(BUF->dhwaddr.addr, BUF->shwaddr.addr, 6);
|
||||||
memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);
|
memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);
|
||||||
|
@ -316,11 +316,11 @@ uip_arp_arpin(void)
|
||||||
uip_ipaddr_copy(&BUF->dipaddr, &BUF->sipaddr);
|
uip_ipaddr_copy(&BUF->dipaddr, &BUF->sipaddr);
|
||||||
uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr);
|
uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr);
|
||||||
|
|
||||||
BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);
|
BUF->ethhdr.type = UIP_HTONS(UIP_ETHTYPE_ARP);
|
||||||
uip_len = sizeof(struct arp_hdr);
|
uip_len = sizeof(struct arp_hdr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HTONS(ARP_REPLY):
|
case UIP_HTONS(ARP_REPLY):
|
||||||
/* ARP reply. We insert or update the ARP table if it was meant
|
/* ARP reply. We insert or update the ARP table if it was meant
|
||||||
for us. */
|
for us. */
|
||||||
if(uip_ipaddr_cmp(&BUF->dipaddr, &uip_hostaddr)) {
|
if(uip_ipaddr_cmp(&BUF->dipaddr, &uip_hostaddr)) {
|
||||||
|
@ -404,12 +404,12 @@ uip_arp_out(void)
|
||||||
|
|
||||||
uip_ipaddr_copy(&BUF->dipaddr, &ipaddr);
|
uip_ipaddr_copy(&BUF->dipaddr, &ipaddr);
|
||||||
uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr);
|
uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr);
|
||||||
BUF->opcode = HTONS(ARP_REQUEST); /* ARP request. */
|
BUF->opcode = UIP_HTONS(ARP_REQUEST); /* ARP request. */
|
||||||
BUF->hwtype = HTONS(ARP_HWTYPE_ETH);
|
BUF->hwtype = UIP_HTONS(ARP_HWTYPE_ETH);
|
||||||
BUF->protocol = HTONS(UIP_ETHTYPE_IP);
|
BUF->protocol = UIP_HTONS(UIP_ETHTYPE_IP);
|
||||||
BUF->hwlen = 6;
|
BUF->hwlen = 6;
|
||||||
BUF->protolen = 4;
|
BUF->protolen = 4;
|
||||||
BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);
|
BUF->ethhdr.type = UIP_HTONS(UIP_ETHTYPE_ARP);
|
||||||
|
|
||||||
uip_appdata = &uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN];
|
uip_appdata = &uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN];
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ uip_arp_out(void)
|
||||||
}
|
}
|
||||||
memcpy(IPBUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
|
memcpy(IPBUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
|
||||||
|
|
||||||
IPBUF->ethhdr.type = HTONS(UIP_ETHTYPE_IP);
|
IPBUF->ethhdr.type = UIP_HTONS(UIP_ETHTYPE_IP);
|
||||||
|
|
||||||
uip_len += sizeof(struct uip_eth_hdr);
|
uip_len += sizeof(struct uip_eth_hdr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: ethernet-drv.c,v 1.2 2007/11/27 20:54:10 oliverschmidt Exp $
|
* @(#)$Id: ethernet-drv.c,v 1.3 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -61,15 +61,15 @@ pollhandler(void)
|
||||||
|
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
#if UIP_CONF_IPV6
|
#if UIP_CONF_IPV6
|
||||||
if(BUF->type == htons(UIP_ETHTYPE_IPV6)) {
|
if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {
|
||||||
uip_neighbor_add(&IPBUF->srcipaddr, &BUF->src);
|
uip_neighbor_add(&IPBUF->srcipaddr, &BUF->src);
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
} else
|
} else
|
||||||
#endif /* UIP_CONF_IPV6 */
|
#endif /* UIP_CONF_IPV6 */
|
||||||
if(BUF->type == htons(UIP_ETHTYPE_IP)) {
|
if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {
|
||||||
uip_len -= sizeof(struct uip_eth_hdr);
|
uip_len -= sizeof(struct uip_eth_hdr);
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
} else if(BUF->type == htons(UIP_ETHTYPE_ARP)) {
|
} else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) {
|
||||||
uip_arp_arpin();
|
uip_arp_arpin();
|
||||||
/* If the above function invocation resulted in data that
|
/* If the above function invocation resulted in data that
|
||||||
should be sent out on the network, the global variable
|
should be sent out on the network, the global variable
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: codeprop-otf.c,v 1.1 2009/07/11 14:18:50 ksb Exp $
|
* @(#)$Id: codeprop-otf.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \addtogroup esb
|
/** \addtogroup esb
|
||||||
|
@ -175,9 +175,9 @@ PROCESS_THREAD(codeprop_process, ev, data)
|
||||||
PT_INIT(&s.udpthread_pt);
|
PT_INIT(&s.udpthread_pt);
|
||||||
PT_INIT(&s.recv_udpthread_pt);
|
PT_INIT(&s.recv_udpthread_pt);
|
||||||
|
|
||||||
tcp_listen(HTONS(CODEPROP_DATA_PORT));
|
tcp_listen(UIP_HTONS(CODEPROP_DATA_PORT));
|
||||||
|
|
||||||
udp_conn = udp_broadcast_new(HTONS(CODEPROP_DATA_PORT), NULL);
|
udp_conn = udp_broadcast_new(UIP_HTONS(CODEPROP_DATA_PORT), NULL);
|
||||||
|
|
||||||
s.state = STATE_NONE;
|
s.state = STATE_NONE;
|
||||||
s.received = 0;
|
s.received = 0;
|
||||||
|
@ -205,9 +205,9 @@ send_udpdata(struct codeprop_udphdr *uh)
|
||||||
{
|
{
|
||||||
u16_t len;
|
u16_t len;
|
||||||
|
|
||||||
uh->type = HTONS(TYPE_DATA);
|
uh->type = UIP_HTONS(TYPE_DATA);
|
||||||
uh->addr = htons(s.addr);
|
uh->addr = uip_htons(s.addr);
|
||||||
uh->id = htons(s.id);
|
uh->id = uip_htons(s.id);
|
||||||
|
|
||||||
if(s.len - s.addr > UDPDATASIZE) {
|
if(s.len - s.addr > UDPDATASIZE) {
|
||||||
len = UDPDATASIZE;
|
len = UDPDATASIZE;
|
||||||
|
@ -220,7 +220,7 @@ send_udpdata(struct codeprop_udphdr *uh)
|
||||||
/* eeprom_read(EEPROMFS_ADDR_CODEPROP + s.addr,
|
/* eeprom_read(EEPROMFS_ADDR_CODEPROP + s.addr,
|
||||||
&uh->data[0], len);*/
|
&uh->data[0], len);*/
|
||||||
|
|
||||||
uh->len = htons(s.len);
|
uh->len = uip_htons(s.len);
|
||||||
|
|
||||||
PRINTF(("codeprop: sending packet from address 0x%04x\n", s.addr));
|
PRINTF(("codeprop: sending packet from address 0x%04x\n", s.addr));
|
||||||
uip_udp_send(len + UDPHEADERSIZE);
|
uip_udp_send(len + UDPHEADERSIZE);
|
||||||
|
@ -249,13 +249,13 @@ PT_THREAD(send_udpthread(struct pt *pt))
|
||||||
PT_WAIT_UNTIL(pt, uip_newdata() || etimer_expired(&s.sendtimer));
|
PT_WAIT_UNTIL(pt, uip_newdata() || etimer_expired(&s.sendtimer));
|
||||||
|
|
||||||
if(uip_newdata()) {
|
if(uip_newdata()) {
|
||||||
if(uh->type == HTONS(TYPE_NACK)) {
|
if(uh->type == UIP_HTONS(TYPE_NACK)) {
|
||||||
PRINTF(("send_udpthread: got NACK for address 0x%x (now 0x%x)\n",
|
PRINTF(("send_udpthread: got NACK for address 0x%x (now 0x%x)\n",
|
||||||
htons(uh->addr), s.addr));
|
uip_htons(uh->addr), s.addr));
|
||||||
/* Only accept a NACK if it points to a lower byte. */
|
/* Only accept a NACK if it points to a lower byte. */
|
||||||
if(htons(uh->addr) <= s.addr) {
|
if(uip_htons(uh->addr) <= s.addr) {
|
||||||
/* beep();*/
|
/* beep();*/
|
||||||
s.addr = htons(uh->addr);
|
s.addr = uip_htons(uh->addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PT_YIELD(pt);
|
PT_YIELD(pt);
|
||||||
|
@ -273,8 +273,8 @@ PT_THREAD(send_udpthread(struct pt *pt))
|
||||||
static void
|
static void
|
||||||
send_nack(struct codeprop_udphdr *uh, unsigned short addr)
|
send_nack(struct codeprop_udphdr *uh, unsigned short addr)
|
||||||
{
|
{
|
||||||
uh->type = HTONS(TYPE_NACK);
|
uh->type = UIP_HTONS(TYPE_NACK);
|
||||||
uh->addr = htons(addr);
|
uh->addr = uip_htons(addr);
|
||||||
uip_udp_send(UDPHEADERSIZE);
|
uip_udp_send(UDPHEADERSIZE);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
|
@ -285,7 +285,7 @@ PT_THREAD(recv_udpthread(struct pt *pt))
|
||||||
struct codeprop_udphdr *uh = (struct codeprop_udphdr *)uip_appdata;
|
struct codeprop_udphdr *uh = (struct codeprop_udphdr *)uip_appdata;
|
||||||
|
|
||||||
/* if(uip_newdata()) {
|
/* if(uip_newdata()) {
|
||||||
PRINTF(("recv_udpthread: id %d uh->id %d\n", s.id, htons(uh->id)));
|
PRINTF(("recv_udpthread: id %d uh->id %d\n", s.id, uip_htons(uh->id)));
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
PT_BEGIN(pt);
|
PT_BEGIN(pt);
|
||||||
|
@ -294,29 +294,29 @@ PT_THREAD(recv_udpthread(struct pt *pt))
|
||||||
|
|
||||||
do {
|
do {
|
||||||
PT_WAIT_UNTIL(pt, uip_newdata() &&
|
PT_WAIT_UNTIL(pt, uip_newdata() &&
|
||||||
uh->type == HTONS(TYPE_DATA) &&
|
uh->type == UIP_HTONS(TYPE_DATA) &&
|
||||||
htons(uh->id) > s.id);
|
uip_htons(uh->id) > s.id);
|
||||||
|
|
||||||
if(htons(uh->addr) != 0) {
|
if(uip_htons(uh->addr) != 0) {
|
||||||
s.addr = 0;
|
s.addr = 0;
|
||||||
send_nack(uh, 0);
|
send_nack(uh, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while(htons(uh->addr) != 0);
|
} while(uip_htons(uh->addr) != 0);
|
||||||
|
|
||||||
/* leds_on(LEDS_YELLOW);
|
/* leds_on(LEDS_YELLOW);
|
||||||
beep_down(10000);*/
|
beep_down(10000);*/
|
||||||
|
|
||||||
s.addr = 0;
|
s.addr = 0;
|
||||||
s.id = htons(uh->id);
|
s.id = uip_htons(uh->id);
|
||||||
s.len = htons(uh->len);
|
s.len = uip_htons(uh->len);
|
||||||
|
|
||||||
timer_set(&s.timer, CONNECTION_TIMEOUT);
|
timer_set(&s.timer, CONNECTION_TIMEOUT);
|
||||||
/* process_post(PROCESS_BROADCAST, codeprop_event_quit, (process_data_t)NULL); */
|
/* process_post(PROCESS_BROADCAST, codeprop_event_quit, (process_data_t)NULL); */
|
||||||
|
|
||||||
while(s.addr < s.len) {
|
while(s.addr < s.len) {
|
||||||
|
|
||||||
if(htons(uh->addr) == s.addr) {
|
if(uip_htons(uh->addr) == s.addr) {
|
||||||
/* leds_blink();*/
|
/* leds_blink();*/
|
||||||
len = uip_datalen() - UDPHEADERSIZE;
|
len = uip_datalen() - UDPHEADERSIZE;
|
||||||
if(len > 0) {
|
if(len > 0) {
|
||||||
|
@ -333,8 +333,8 @@ PT_THREAD(recv_udpthread(struct pt *pt))
|
||||||
s.addr += len;
|
s.addr += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(htons(uh->addr) > s.addr) {
|
} else if(uip_htons(uh->addr) > s.addr) {
|
||||||
PRINTF(("sending nack since 0x%x != 0x%x\n", htons(uh->addr), s.addr));
|
PRINTF(("sending nack since 0x%x != 0x%x\n", uip_htons(uh->addr), s.addr));
|
||||||
send_nack(uh, s.addr);
|
send_nack(uh, s.addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,8 +346,8 @@ PT_THREAD(recv_udpthread(struct pt *pt))
|
||||||
timer_set(&s.nacktimer, HIT_NACK_TIMEOUT);
|
timer_set(&s.nacktimer, HIT_NACK_TIMEOUT);
|
||||||
PT_YIELD_UNTIL(pt, timer_expired(&s.nacktimer) ||
|
PT_YIELD_UNTIL(pt, timer_expired(&s.nacktimer) ||
|
||||||
(uip_newdata() &&
|
(uip_newdata() &&
|
||||||
uh->type == HTONS(TYPE_DATA) &&
|
uh->type == UIP_HTONS(TYPE_DATA) &&
|
||||||
htons(uh->id) == s.id));
|
uip_htons(uh->id) == s.id));
|
||||||
if(timer_expired(&s.nacktimer)) {
|
if(timer_expired(&s.nacktimer)) {
|
||||||
send_nack(uh, s.addr);
|
send_nack(uh, s.addr);
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ PT_THREAD(recv_tcpthread(struct pt *pt))
|
||||||
uip_abort();
|
uip_abort();
|
||||||
}
|
}
|
||||||
th = (struct codeprop_tcphdr *)uip_appdata;
|
th = (struct codeprop_tcphdr *)uip_appdata;
|
||||||
s.len = htons(th->len);
|
s.len = uip_htons(th->len);
|
||||||
s.addr = 0;
|
s.addr = 0;
|
||||||
uip_appdata += CODEPROP_TCPHDR_SIZE;
|
uip_appdata += CODEPROP_TCPHDR_SIZE;
|
||||||
datalen -= CODEPROP_TCPHDR_SIZE;
|
datalen -= CODEPROP_TCPHDR_SIZE;
|
||||||
|
@ -493,7 +493,7 @@ uipcall(void *state)
|
||||||
recv_udpthread(&s.recv_udpthread_pt);
|
recv_udpthread(&s.recv_udpthread_pt);
|
||||||
send_udpthread(&s.udpthread_pt);
|
send_udpthread(&s.udpthread_pt);
|
||||||
} else {
|
} else {
|
||||||
if(uip_conn->lport == HTONS(CODEPROP_DATA_PORT)) {
|
if(uip_conn->lport == UIP_HTONS(CODEPROP_DATA_PORT)) {
|
||||||
if(uip_connected()) {
|
if(uip_connected()) {
|
||||||
|
|
||||||
if(state == NULL) {
|
if(state == NULL) {
|
||||||
|
|
|
@ -118,15 +118,15 @@ PROCESS_THREAD(usb_eth_process, ev , data)
|
||||||
/* printf("Received: %d bytes\n", uip_len); */
|
/* printf("Received: %d bytes\n", uip_len); */
|
||||||
memcpy(uip_buf, recv_data, uip_len);
|
memcpy(uip_buf, recv_data, uip_len);
|
||||||
#if UIP_CONF_IPV6
|
#if UIP_CONF_IPV6
|
||||||
if(BUF->type == htons(UIP_ETHTYPE_IPV6)) {
|
if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {
|
||||||
uip_neighbor_add(&IPBUF->srcipaddr, &BUF->src);
|
uip_neighbor_add(&IPBUF->srcipaddr, &BUF->src);
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
} else
|
} else
|
||||||
#endif /* UIP_CONF_IPV6 */
|
#endif /* UIP_CONF_IPV6 */
|
||||||
if(BUF->type == htons(UIP_ETHTYPE_IP)) {
|
if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {
|
||||||
uip_len -= sizeof(struct uip_eth_hdr);
|
uip_len -= sizeof(struct uip_eth_hdr);
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
} else if(BUF->type == htons(UIP_ETHTYPE_ARP)) {
|
} else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) {
|
||||||
uip_arp_arpin();
|
uip_arp_arpin();
|
||||||
/* If the above function invocation resulted in data that
|
/* If the above function invocation resulted in data that
|
||||||
should be sent out on the network, the global variable
|
should be sent out on the network, the global variable
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: dhcps.c,v 1.1 2009/07/11 14:37:11 ksb Exp $
|
* @(#)$Id: dhcps.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -256,7 +256,7 @@ add_lease_time(uint8_t *optptr)
|
||||||
uint32_t lt;
|
uint32_t lt;
|
||||||
*optptr++ = DHCP_OPTION_LEASE_TIME;
|
*optptr++ = DHCP_OPTION_LEASE_TIME;
|
||||||
*optptr++ = 4;
|
*optptr++ = 4;
|
||||||
lt = HTONL(config->default_lease_time);
|
lt = UIP_HTONL(config->default_lease_time);
|
||||||
memcpy(optptr, <, 4);
|
memcpy(optptr, <, 4);
|
||||||
return optptr + 4;
|
return optptr + 4;
|
||||||
}
|
}
|
||||||
|
@ -381,13 +381,13 @@ PROCESS_THREAD(dhcp_server_process, ev , data)
|
||||||
printf("DHCP server starting\n");
|
printf("DHCP server starting\n");
|
||||||
uip_ipaddr(&any_addr, 0,0,0,0);
|
uip_ipaddr(&any_addr, 0,0,0,0);
|
||||||
uip_ipaddr(&bcast_addr, 255,255,255,255);
|
uip_ipaddr(&bcast_addr, 255,255,255,255);
|
||||||
conn = udp_new(&any_addr, HTONS(DHCPS_CLIENT_PORT), NULL);
|
conn = udp_new(&any_addr, UIP_HTONS(DHCPS_CLIENT_PORT), NULL);
|
||||||
if (!conn) goto exit;
|
if (!conn) goto exit;
|
||||||
send_conn = udp_new(&bcast_addr, HTONS(DHCPS_CLIENT_PORT), NULL);
|
send_conn = udp_new(&bcast_addr, UIP_HTONS(DHCPS_CLIENT_PORT), NULL);
|
||||||
if (!send_conn) goto exit;
|
if (!send_conn) goto exit;
|
||||||
|
|
||||||
uip_udp_bind(conn, HTONS(DHCPS_SERVER_PORT));
|
uip_udp_bind(conn, UIP_HTONS(DHCPS_SERVER_PORT));
|
||||||
uip_udp_bind(send_conn, HTONS(DHCPS_SERVER_PORT));
|
uip_udp_bind(send_conn, UIP_HTONS(DHCPS_SERVER_PORT));
|
||||||
while(1) {
|
while(1) {
|
||||||
PROCESS_WAIT_EVENT();
|
PROCESS_WAIT_EVENT();
|
||||||
if(ev == tcpip_event) {
|
if(ev == tcpip_event) {
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: rtl8019-drv.c,v 1.2 2007/05/26 23:05:36 oliverschmidt Exp $
|
* $Id: rtl8019-drv.c,v 1.3 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -59,15 +59,15 @@ pollhandler(void)
|
||||||
|
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
#if UIP_CONF_IPV6
|
#if UIP_CONF_IPV6
|
||||||
if(BUF->type == htons(UIP_ETHTYPE_IPV6)) {
|
if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {
|
||||||
uip_neighbor_add(&IPBUF->srcipaddr, &BUF->src);
|
uip_neighbor_add(&IPBUF->srcipaddr, &BUF->src);
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
} else
|
} else
|
||||||
#endif /* UIP_CONF_IPV6 */
|
#endif /* UIP_CONF_IPV6 */
|
||||||
if(BUF->type == htons(UIP_ETHTYPE_IP)) {
|
if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {
|
||||||
uip_len -= sizeof(struct uip_eth_hdr);
|
uip_len -= sizeof(struct uip_eth_hdr);
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
} else if(BUF->type == htons(UIP_ETHTYPE_ARP)) {
|
} else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) {
|
||||||
uip_arp_arpin();
|
uip_arp_arpin();
|
||||||
/* If the above function invocation resulted in data that
|
/* If the above function invocation resulted in data that
|
||||||
should be sent out on the network, the global variable
|
should be sent out on the network, the global variable
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: uip_arch.c,v 1.1 2009/09/08 20:07:35 zdshelby Exp $
|
* $Id: uip_arch.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
@ -130,10 +130,10 @@ _upper_layer_chksum_call:
|
||||||
|
|
||||||
ld a, h
|
ld a, h
|
||||||
or a, l
|
or a, l
|
||||||
jr nz, _upper_layer_htons
|
jr nz, _upper_layer_uip_htons
|
||||||
ld hl, #0xffff
|
ld hl, #0xffff
|
||||||
jr _upper_layer_ret
|
jr _upper_layer_ret
|
||||||
_upper_layer_htons:
|
_upper_layer_uip_htons:
|
||||||
ld a, l
|
ld a, l
|
||||||
ld l, h
|
ld l, h
|
||||||
ld h, a
|
ld h, a
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: loader-arch.c,v 1.1 2006/06/17 22:41:21 adamdunkels Exp $
|
* @(#)$Id: loader-arch.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
@ -68,13 +68,13 @@ loader_arch_load(unsigned short startaddr)
|
||||||
/* Read the magic word and version number from the first four bytes
|
/* Read the magic word and version number from the first four bytes
|
||||||
in EEPROM. */
|
in EEPROM. */
|
||||||
eeprom_read(startaddr, (char *)&tmp, 2);
|
eeprom_read(startaddr, (char *)&tmp, 2);
|
||||||
if(tmp != HTONS(LOADER_ARCH_MAGIC)) {
|
if(tmp != UIP_HTONS(LOADER_ARCH_MAGIC)) {
|
||||||
beep_beep(60000);
|
beep_beep(60000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
eeprom_read(startaddr + 2, (char *)&tmp, 2);
|
eeprom_read(startaddr + 2, (char *)&tmp, 2);
|
||||||
if(tmp != HTONS(LOADER_ARCH_VERSION)) {
|
if(tmp != UIP_HTONS(LOADER_ARCH_VERSION)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ loader_arch_load(unsigned short startaddr)
|
||||||
/* Read the total lenghth that the checksum covers. */
|
/* Read the total lenghth that the checksum covers. */
|
||||||
eeprom_read(startaddr, (char *)&sumlen, 2);
|
eeprom_read(startaddr, (char *)&sumlen, 2);
|
||||||
|
|
||||||
sumlen = htons(sumlen);
|
sumlen = uip_htons(sumlen);
|
||||||
|
|
||||||
sum = 0;
|
sum = 0;
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ loader_arch_load(unsigned short startaddr)
|
||||||
/* Read the size of the code segment from the next two bytes in EEPROM. */
|
/* Read the size of the code segment from the next two bytes in EEPROM. */
|
||||||
eeprom_read(startaddr, (char *)&codelen, 2);
|
eeprom_read(startaddr, (char *)&codelen, 2);
|
||||||
/* Convert from network byte order to host byte order. */
|
/* Convert from network byte order to host byte order. */
|
||||||
codelen = htons(codelen);
|
codelen = uip_htons(codelen);
|
||||||
|
|
||||||
|
|
||||||
/* Flash program code into ROM. We use the available space in the
|
/* Flash program code into ROM. We use the available space in the
|
||||||
|
@ -193,7 +193,7 @@ loader_arch_load(unsigned short startaddr)
|
||||||
eeprom_read(startaddr + 2 + codelen, (char *)&datalen, 2);
|
eeprom_read(startaddr + 2 + codelen, (char *)&datalen, 2);
|
||||||
|
|
||||||
/* Convert from network byte order to host byte order. */
|
/* Convert from network byte order to host byte order. */
|
||||||
datalen = htons(datalen);
|
datalen = uip_htons(datalen);
|
||||||
|
|
||||||
if(datalen > 0) {
|
if(datalen > 0) {
|
||||||
/* Read the contents of the data memory into RAM. */
|
/* Read the contents of the data memory into RAM. */
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: tapdev-drv.c,v 1.5 2008/10/14 14:38:10 julienabeille Exp $
|
* @(#)$Id: tapdev-drv.c,v 1.6 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki-net.h"
|
#include "contiki-net.h"
|
||||||
|
@ -65,14 +65,14 @@ pollhandler(void)
|
||||||
|
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
#if UIP_CONF_IPV6
|
#if UIP_CONF_IPV6
|
||||||
if(BUF->type == htons(UIP_ETHTYPE_IPV6)) {
|
if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
} else
|
} else
|
||||||
#endif /* UIP_CONF_IPV6 */
|
#endif /* UIP_CONF_IPV6 */
|
||||||
if(BUF->type == htons(UIP_ETHTYPE_IP)) {
|
if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {
|
||||||
uip_len -= sizeof(struct uip_eth_hdr);
|
uip_len -= sizeof(struct uip_eth_hdr);
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
} else if(BUF->type == htons(UIP_ETHTYPE_ARP)) {
|
} else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) {
|
||||||
#if !UIP_CONF_IPV6 //math
|
#if !UIP_CONF_IPV6 //math
|
||||||
uip_arp_arpin();
|
uip_arp_arpin();
|
||||||
/* If the above function invocation resulted in data that
|
/* If the above function invocation resulted in data that
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: tapdev6.c,v 1.3 2008/10/14 16:50:11 julienabeille Exp $
|
* $Id: tapdev6.c,v 1.4 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ u8_t tapdev_send(uip_lladdr_t *lladdr)
|
||||||
memcpy(&BUF->dest, lladdr, UIP_LLADDR_LEN);
|
memcpy(&BUF->dest, lladdr, UIP_LLADDR_LEN);
|
||||||
}
|
}
|
||||||
memcpy(&BUF->src, &uip_lladdr, UIP_LLADDR_LEN);
|
memcpy(&BUF->src, &uip_lladdr, UIP_LLADDR_LEN);
|
||||||
BUF->type = HTONS(UIP_ETHTYPE_IPV6); //math tmp
|
BUF->type = UIP_HTONS(UIP_ETHTYPE_IPV6); //math tmp
|
||||||
|
|
||||||
uip_len += sizeof(struct uip_eth_hdr);
|
uip_len += sizeof(struct uip_eth_hdr);
|
||||||
do_send();
|
do_send();
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: wpcap-drv.c,v 1.6 2009/08/11 16:06:17 dak664 Exp $
|
* @(#)$Id: wpcap-drv.c,v 1.7 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki-net.h"
|
#include "contiki-net.h"
|
||||||
|
@ -62,15 +62,15 @@ pollhandler(void)
|
||||||
|
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
#if UIP_CONF_IPV6
|
#if UIP_CONF_IPV6
|
||||||
if(BUF->type == htons(UIP_ETHTYPE_IPV6)) {
|
if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
} else
|
} else
|
||||||
#endif /* UIP_CONF_IPV6 */
|
#endif /* UIP_CONF_IPV6 */
|
||||||
if(BUF->type == htons(UIP_ETHTYPE_IP)) {
|
if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {
|
||||||
uip_len -= sizeof(struct uip_eth_hdr);
|
uip_len -= sizeof(struct uip_eth_hdr);
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
#if !UIP_CONF_IPV6
|
#if !UIP_CONF_IPV6
|
||||||
} else if(BUF->type == htons(UIP_ETHTYPE_ARP)) {
|
} else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) {
|
||||||
uip_arp_arpin(); //math
|
uip_arp_arpin(); //math
|
||||||
/* If the above function invocation resulted in data that
|
/* If the above function invocation resulted in data that
|
||||||
should be sent out on the network, the global variable
|
should be sent out on the network, the global variable
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Oliver Schmidt <ol.sc@web.de>
|
* Author: Oliver Schmidt <ol.sc@web.de>
|
||||||
*
|
*
|
||||||
* $Id: wpcap.c,v 1.18 2009/08/13 18:41:00 dak664 Exp $
|
* $Id: wpcap.c,v 1.19 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
@ -55,8 +55,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Avoid 'conflicting types' errors. */
|
/* Avoid 'conflicting types' errors. */
|
||||||
#define htonl
|
#define uip_htonl
|
||||||
#define htons
|
#define uip_htons
|
||||||
|
|
||||||
#include "contiki-net.h"
|
#include "contiki-net.h"
|
||||||
#include "sys/log.h"
|
#include "sys/log.h"
|
||||||
|
@ -317,7 +317,7 @@ wpcap_send(uip_lladdr_t *lladdr)
|
||||||
PRINTF("Src= %02x %02x %02x %02x %02x %02x",(&BUF->src)->addr[0],(&BUF->src)->addr[1],(&BUF->src)->addr[2],(&BUF->src)->addr[3],(&BUF->src)->addr[4],(&BUF->src)->addr[5]);
|
PRINTF("Src= %02x %02x %02x %02x %02x %02x",(&BUF->src)->addr[0],(&BUF->src)->addr[1],(&BUF->src)->addr[2],(&BUF->src)->addr[3],(&BUF->src)->addr[4],(&BUF->src)->addr[5]);
|
||||||
PRINTF(" Dst= %02x %02x %02x %02x %02x %02x",(&BUF->dest)->addr[0],(&BUF->dest)->addr[1],(&BUF->dest)->addr[2],(&BUF->dest)->addr[3],(&BUF->dest)->addr[4],(&BUF->dest)->addr[5]);
|
PRINTF(" Dst= %02x %02x %02x %02x %02x %02x",(&BUF->dest)->addr[0],(&BUF->dest)->addr[1],(&BUF->dest)->addr[2],(&BUF->dest)->addr[3],(&BUF->dest)->addr[4],(&BUF->dest)->addr[5]);
|
||||||
PRINTF(" Type=%04x\n",BUF->type);
|
PRINTF(" Type=%04x\n",BUF->type);
|
||||||
BUF->type = HTONS(UIP_ETHTYPE_IPV6);
|
BUF->type = UIP_HTONS(UIP_ETHTYPE_IPV6);
|
||||||
uip_len += sizeof(struct uip_eth_hdr);
|
uip_len += sizeof(struct uip_eth_hdr);
|
||||||
if(pcap_sendpacket(pcap, uip_buf, uip_len) == -1) {
|
if(pcap_sendpacket(pcap, uip_buf, uip_len) == -1) {
|
||||||
error_exit("error on send\n");
|
error_exit("error on send\n");
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: uip_arch.c,v 1.2 2007/09/29 03:57:39 matsutsuka Exp $
|
* $Id: uip_arch.c,v 1.3 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
@ -130,10 +130,10 @@ _upper_layer_chksum_call:
|
||||||
|
|
||||||
ld a, h
|
ld a, h
|
||||||
or a, l
|
or a, l
|
||||||
jr nz, _upper_layer_htons
|
jr nz, _upper_layer_uip_htons
|
||||||
ld hl, #0xffff
|
ld hl, #0xffff
|
||||||
jr _upper_layer_ret
|
jr _upper_layer_ret
|
||||||
_upper_layer_htons:
|
_upper_layer_uip_htons:
|
||||||
ld a, l
|
ld a, l
|
||||||
ld l, h
|
ld l, h
|
||||||
ld h, a
|
ld h, a
|
||||||
|
|
|
@ -46,7 +46,7 @@ PROCESS_THREAD(example_program_process, ev, data)
|
||||||
* attach any special data to the connection, so we pass it a NULL
|
* attach any special data to the connection, so we pass it a NULL
|
||||||
* parameter.
|
* parameter.
|
||||||
*/
|
*/
|
||||||
c = udp_broadcast_new(HTONS(4321), NULL);
|
c = udp_broadcast_new(UIP_HTONS(4321), NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loop for ever.
|
* Loop for ever.
|
||||||
|
|
|
@ -33,7 +33,7 @@ PROCESS_THREAD(example_psock_client_process, ev, data)
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
uip_ipaddr(addr, 192,168,2,1);
|
uip_ipaddr(addr, 192,168,2,1);
|
||||||
tcp_connect(addr, HTONS(80), NULL);
|
tcp_connect(addr, UIP_HTONS(80), NULL);
|
||||||
|
|
||||||
printf("Connecting...\n");
|
printf("Connecting...\n");
|
||||||
PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event);
|
PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event);
|
||||||
|
|
|
@ -106,10 +106,10 @@ PROCESS_THREAD(example_psock_server_process, ev, data)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We start with setting up a listening TCP port. Note how we're
|
* We start with setting up a listening TCP port. Note how we're
|
||||||
* using the HTONS() macro to convert the port number (1010) to
|
* using the UIP_HTONS() macro to convert the port number (1010) to
|
||||||
* network byte order as required by the tcp_listen() function.
|
* network byte order as required by the tcp_listen() function.
|
||||||
*/
|
*/
|
||||||
tcp_listen(HTONS(1010));
|
tcp_listen(UIP_HTONS(1010));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We loop for ever, accepting new connections.
|
* We loop for ever, accepting new connections.
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: httpd-simple.c,v 1.4 2010/08/31 20:05:44 joxe Exp $
|
* $Id: httpd-simple.c,v 1.5 2010/10/19 18:29:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -249,7 +249,7 @@ httpd_appcall(void *state)
|
||||||
void
|
void
|
||||||
httpd_init(void)
|
httpd_init(void)
|
||||||
{
|
{
|
||||||
tcp_listen(HTONS(80));
|
tcp_listen(UIP_HTONS(80));
|
||||||
memb_init(&conns);
|
memb_init(&conns);
|
||||||
#if URLCONV
|
#if URLCONV
|
||||||
urlconv_init();
|
urlconv_init();
|
||||||
|
|
|
@ -81,7 +81,7 @@ send_packet(void *ptr)
|
||||||
client_conn->ripaddr.u8[15], seq_id);
|
client_conn->ripaddr.u8[15], seq_id);
|
||||||
sprintf(buf, "Hello %d from the client", seq_id);
|
sprintf(buf, "Hello %d from the client", seq_id);
|
||||||
uip_udp_packet_sendto(client_conn, buf, strlen(buf),
|
uip_udp_packet_sendto(client_conn, buf, strlen(buf),
|
||||||
&server_ipaddr, HTONS(UDP_SERVER_PORT));
|
&server_ipaddr, UIP_HTONS(UDP_SERVER_PORT));
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
|
@ -135,13 +135,13 @@ PROCESS_THREAD(udp_client_process, ev, data)
|
||||||
print_local_addresses();
|
print_local_addresses();
|
||||||
|
|
||||||
/* new connection with remote host */
|
/* new connection with remote host */
|
||||||
client_conn = udp_new(NULL, HTONS(UDP_SERVER_PORT), NULL);
|
client_conn = udp_new(NULL, UIP_HTONS(UDP_SERVER_PORT), NULL);
|
||||||
udp_bind(client_conn, HTONS(UDP_CLIENT_PORT));
|
udp_bind(client_conn, UIP_HTONS(UDP_CLIENT_PORT));
|
||||||
|
|
||||||
PRINTF("Created a connection with the server ");
|
PRINTF("Created a connection with the server ");
|
||||||
PRINT6ADDR(&client_conn->ripaddr);
|
PRINT6ADDR(&client_conn->ripaddr);
|
||||||
PRINTF(" local/remote port %u/%u\n",
|
PRINTF(" local/remote port %u/%u\n",
|
||||||
HTONS(client_conn->lport), HTONS(client_conn->rport));
|
UIP_HTONS(client_conn->lport), UIP_HTONS(client_conn->rport));
|
||||||
|
|
||||||
etimer_set(&periodic, SEND_INTERVAL);
|
etimer_set(&periodic, SEND_INTERVAL);
|
||||||
while(1) {
|
while(1) {
|
||||||
|
|
|
@ -130,13 +130,13 @@ PROCESS_THREAD(udp_server_process, ev, data)
|
||||||
packet reception rates. */
|
packet reception rates. */
|
||||||
NETSTACK_MAC.off(1);
|
NETSTACK_MAC.off(1);
|
||||||
|
|
||||||
server_conn = udp_new(NULL, HTONS(UDP_CLIENT_PORT), NULL);
|
server_conn = udp_new(NULL, UIP_HTONS(UDP_CLIENT_PORT), NULL);
|
||||||
udp_bind(server_conn, HTONS(UDP_SERVER_PORT));
|
udp_bind(server_conn, UIP_HTONS(UDP_SERVER_PORT));
|
||||||
|
|
||||||
PRINTF("Created a server connection with remote address ");
|
PRINTF("Created a server connection with remote address ");
|
||||||
PRINT6ADDR(&server_conn->ripaddr);
|
PRINT6ADDR(&server_conn->ripaddr);
|
||||||
PRINTF(" local/remote port %u/%u\n", HTONS(server_conn->lport),
|
PRINTF(" local/remote port %u/%u\n", UIP_HTONS(server_conn->lport),
|
||||||
HTONS(server_conn->rport));
|
UIP_HTONS(server_conn->rport));
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
PROCESS_YIELD();
|
PROCESS_YIELD();
|
||||||
|
|
|
@ -37,7 +37,7 @@ void tcpip_set_outputfunc(u8_t (* f)(uip_lladdr_t *)) {
|
||||||
output = f;
|
output = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16_t htons(u16_t val) { return HTONS(val);}
|
u16_t uip_htons(u16_t val) { return UIP_HTONS(val);}
|
||||||
|
|
||||||
|
|
||||||
#if THEOLDWAY
|
#if THEOLDWAY
|
||||||
|
@ -123,7 +123,7 @@ upper_layer_chksum(u8_t proto)
|
||||||
sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN],
|
sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN],
|
||||||
upper_layer_len);
|
upper_layer_len);
|
||||||
|
|
||||||
return (sum == 0) ? 0xffff : htons(sum);
|
return (sum == 0) ? 0xffff : uip_htons(sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: tcprudolph0.c,v 1.12 2009/02/27 14:28:02 nvt-se Exp $
|
* @(#)$Id: tcprudolph0.c,v 1.13 2010/10/19 18:29:05 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -118,7 +118,7 @@ PT_THREAD(recv_tcpthread(struct pt *pt))
|
||||||
rudolph0_stop(&rudolph0);
|
rudolph0_stop(&rudolph0);
|
||||||
/* elfloader_unload();*/
|
/* elfloader_unload();*/
|
||||||
|
|
||||||
s.len = htons(((struct codeprop_tcphdr *)uip_appdata)->len);
|
s.len = uip_htons(((struct codeprop_tcphdr *)uip_appdata)->len);
|
||||||
s.addr = 0;
|
s.addr = 0;
|
||||||
uip_appdata += sizeof(struct codeprop_tcphdr);
|
uip_appdata += sizeof(struct codeprop_tcphdr);
|
||||||
uip_len -= sizeof(struct codeprop_tcphdr);
|
uip_len -= sizeof(struct codeprop_tcphdr);
|
||||||
|
@ -261,11 +261,11 @@ PROCESS_THREAD(tcp_loader_process, ev, data)
|
||||||
|
|
||||||
rudolph0_open(&rudolph0, 20, &rudolph0_call);
|
rudolph0_open(&rudolph0, 20, &rudolph0_call);
|
||||||
|
|
||||||
tcp_listen(HTONS(CODEPROP_DATA_PORT));
|
tcp_listen(UIP_HTONS(CODEPROP_DATA_PORT));
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
PROCESS_YIELD();
|
PROCESS_YIELD();
|
||||||
if(ev == tcpip_event && uip_conn->lport == HTONS(CODEPROP_DATA_PORT)) {
|
if(ev == tcpip_event && uip_conn->lport == UIP_HTONS(CODEPROP_DATA_PORT)) {
|
||||||
if(uip_connected()) { /* Really uip_connecting()!!! */
|
if(uip_connected()) { /* Really uip_connecting()!!! */
|
||||||
if(data == NULL) {
|
if(data == NULL) {
|
||||||
PT_INIT(&s.tcpthread_pt);
|
PT_INIT(&s.tcpthread_pt);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: testv6.c,v 1.3 2010/02/05 19:13:06 oliverschmidt Exp $
|
* $Id: testv6.c,v 1.4 2010/10/19 18:29:05 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki-net.h"
|
#include "contiki-net.h"
|
||||||
|
@ -54,7 +54,7 @@ PROCESS_THREAD(test_process, ev, data)
|
||||||
|
|
||||||
uip_ip6addr(&ip6addr, 0xfc00,0,0,0,0,0,0,0x231);
|
uip_ip6addr(&ip6addr, 0xfc00,0,0,0,0,0,0,0x231);
|
||||||
|
|
||||||
tcp_connect(&ip6addr, HTONS(7), NULL);
|
tcp_connect(&ip6addr, UIP_HTONS(7), NULL);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
PROCESS_WAIT_EVENT();
|
PROCESS_WAIT_EVENT();
|
||||||
|
@ -67,7 +67,7 @@ PROCESS_THREAD(test_tcpip_process, ev, data)
|
||||||
{
|
{
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
tcp_listen(HTONS(800));
|
tcp_listen(UIP_HTONS(800));
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event);
|
PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event);
|
||||||
|
|
|
@ -135,13 +135,13 @@ PROCESS_THREAD(udp_client_process, ev, data)
|
||||||
set_connection_address(&ipaddr);
|
set_connection_address(&ipaddr);
|
||||||
|
|
||||||
/* new connection with remote host */
|
/* new connection with remote host */
|
||||||
client_conn = udp_new(&ipaddr, HTONS(3000), NULL);
|
client_conn = udp_new(&ipaddr, UIP_HTONS(3000), NULL);
|
||||||
udp_bind(client_conn, HTONS(3001));
|
udp_bind(client_conn, UIP_HTONS(3001));
|
||||||
|
|
||||||
PRINTF("Created a connection with the server ");
|
PRINTF("Created a connection with the server ");
|
||||||
PRINT6ADDR(&client_conn->ripaddr);
|
PRINT6ADDR(&client_conn->ripaddr);
|
||||||
PRINTF(" local/remote port %u/%u\n",
|
PRINTF(" local/remote port %u/%u\n",
|
||||||
HTONS(client_conn->lport), HTONS(client_conn->rport));
|
UIP_HTONS(client_conn->lport), UIP_HTONS(client_conn->rport));
|
||||||
|
|
||||||
etimer_set(&et, SEND_INTERVAL);
|
etimer_set(&et, SEND_INTERVAL);
|
||||||
while(1) {
|
while(1) {
|
||||||
|
|
|
@ -102,8 +102,8 @@ PROCESS_THREAD(udp_server_process, ev, data)
|
||||||
|
|
||||||
print_local_addresses();
|
print_local_addresses();
|
||||||
|
|
||||||
server_conn = udp_new(NULL, HTONS(3001), NULL);
|
server_conn = udp_new(NULL, UIP_HTONS(3001), NULL);
|
||||||
udp_bind(server_conn, HTONS(3000));
|
udp_bind(server_conn, UIP_HTONS(3000));
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
PROCESS_YIELD();
|
PROCESS_YIELD();
|
||||||
|
|
|
@ -254,9 +254,9 @@ PROCESS_THREAD(raven_lcd_process, ev, data)
|
||||||
uip_ip6addr(&udp_addr,0x2001,0x420,0x5FFF,0x7D,0x2D0,0xB7FF,0xFE23,0xE6DB);
|
uip_ip6addr(&udp_addr,0x2001,0x420,0x5FFF,0x7D,0x2D0,0xB7FF,0xFE23,0xE6DB);
|
||||||
|
|
||||||
/* set destination parameters*/
|
/* set destination parameters*/
|
||||||
udp_conn = udp_new(&udp_addr, HTONS(0xF0B0), NULL);
|
udp_conn = udp_new(&udp_addr, UIP_HTONS(0xF0B0), NULL);
|
||||||
/*set local port */
|
/*set local port */
|
||||||
udp_bind(udp_conn, HTONS(0xF0B0+1));
|
udp_bind(udp_conn, UIP_HTONS(0xF0B0+1));
|
||||||
|
|
||||||
if((error = icmp6_new(NULL)) == 0) {
|
if((error = icmp6_new(NULL)) == 0) {
|
||||||
while(1) {
|
while(1) {
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: httpd-cfs.c,v 1.1 2009/03/12 19:15:25 adamdunkels Exp $
|
* $Id: httpd-cfs.c,v 1.2 2010/10/19 18:29:05 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -238,7 +238,7 @@ httpd_appcall(void *state)
|
||||||
void
|
void
|
||||||
httpd_init(void)
|
httpd_init(void)
|
||||||
{
|
{
|
||||||
tcp_listen(HTONS(80));
|
tcp_listen(UIP_HTONS(80));
|
||||||
memb_init(&conns);
|
memb_init(&conns);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the uIP TCP/IP stack.
|
* This file is part of the uIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* $Id: httpd-cgi.c,v 1.7 2010/02/26 21:38:58 dak664 Exp $
|
* $Id: httpd-cgi.c,v 1.8 2010/10/19 18:29:05 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -227,12 +227,12 @@ make_tcp_stats(void *arg)
|
||||||
|
|
||||||
conn = &uip_conns[s->u.count];
|
conn = &uip_conns[s->u.count];
|
||||||
|
|
||||||
numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(), httpd_cgi_tcpstat1, htons(conn->lport));
|
numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(), httpd_cgi_tcpstat1, uip_htons(conn->lport));
|
||||||
numprinted += httpd_cgi_sprint_ip6(conn->ripaddr, uip_appdata + numprinted);
|
numprinted += httpd_cgi_sprint_ip6(conn->ripaddr, uip_appdata + numprinted);
|
||||||
httpd_strcpy(tstate,states[conn->tcpstateflags & UIP_TS_MASK]);
|
httpd_strcpy(tstate,states[conn->tcpstateflags & UIP_TS_MASK]);
|
||||||
numprinted += httpd_snprintf((char *)uip_appdata + numprinted, uip_mss() - numprinted,
|
numprinted += httpd_snprintf((char *)uip_appdata + numprinted, uip_mss() - numprinted,
|
||||||
httpd_cgi_tcpstat2,
|
httpd_cgi_tcpstat2,
|
||||||
htons(conn->rport),
|
uip_htons(conn->rport),
|
||||||
tstate,
|
tstate,
|
||||||
conn->nrtx,
|
conn->nrtx,
|
||||||
conn->timer,
|
conn->timer,
|
||||||
|
@ -431,7 +431,7 @@ uint8_t httpd_cgi_sprint_ip6(uip_ip6addr_t addr, char * result)
|
||||||
//Normal address, just print it
|
//Normal address, just print it
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result += sprintf(result, "%x", (unsigned int)(ntohs(addr.u16[i])));
|
result += sprintf(result, "%x", (unsigned int)(uip_ntohs(addr.u16[i])));
|
||||||
i++;
|
i++;
|
||||||
numprinted++;
|
numprinted++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: httpd.c,v 1.4 2009/07/24 15:41:52 dak664 Exp $
|
* $Id: httpd.c,v 1.5 2010/10/19 18:29:05 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -484,7 +484,7 @@ httpd_appcall(void *state)
|
||||||
void
|
void
|
||||||
httpd_init(void)
|
httpd_init(void)
|
||||||
{
|
{
|
||||||
tcp_listen(HTONS(80));
|
tcp_listen(UIP_HTONS(80));
|
||||||
memb_init(&conns);
|
memb_init(&conns);
|
||||||
httpd_cgi_init();
|
httpd_cgi_init();
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ uart_circ_buf_has_char(tcirc_buf *cbuf)
|
||||||
* \return val Converted hex value
|
* \return val Converted hex value
|
||||||
*/
|
*/
|
||||||
uint8_t
|
uint8_t
|
||||||
ntohex(uint8_t val)
|
uip_ntohex(uint8_t val)
|
||||||
{
|
{
|
||||||
/* Convert nibble to hex */
|
/* Convert nibble to hex */
|
||||||
if (val > 9){
|
if (val > 9){
|
||||||
|
@ -178,8 +178,8 @@ ntohex(uint8_t val)
|
||||||
void
|
void
|
||||||
itohex(uint8_t val,char *str)
|
itohex(uint8_t val,char *str)
|
||||||
{
|
{
|
||||||
*str++ = ntohex(val >> 8);
|
*str++ = uip_ntohex(val >> 8);
|
||||||
*str = ntohex(val & 0x0f);
|
*str = uip_ntohex(val & 0x0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: httpd-simple-avr.c,v 1.1 2010/08/26 18:55:43 dak664 Exp $
|
* $Id: httpd-simple-avr.c,v 1.2 2010/10/19 18:29:05 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -202,7 +202,7 @@ bomb
|
||||||
void
|
void
|
||||||
httpd_init(void)
|
httpd_init(void)
|
||||||
{
|
{
|
||||||
tcp_listen(HTONS(80));
|
tcp_listen(UIP_HTONS(80));
|
||||||
memb_init(&conns);
|
memb_init(&conns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -327,7 +327,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
|
||||||
uip_lladdr_t destAddr;
|
uip_lladdr_t destAddr;
|
||||||
uip_lladdr_t *destAddrPtr = NULL;
|
uip_lladdr_t *destAddrPtr = NULL;
|
||||||
|
|
||||||
PRINTF("Packet type: 0x%04x\n\r", ntohs(((struct uip_eth_hdr *) ethHeader)->type));
|
PRINTF("Packet type: 0x%04x\n\r", uip_ntohs(((struct uip_eth_hdr *) ethHeader)->type));
|
||||||
|
|
||||||
//RUM doesn't support sending data
|
//RUM doesn't support sending data
|
||||||
#if UIP_CONF_USE_RUM
|
#if UIP_CONF_USE_RUM
|
||||||
|
@ -342,8 +342,8 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
|
||||||
|
|
||||||
|
|
||||||
//If not IPv6 we don't do anything
|
//If not IPv6 we don't do anything
|
||||||
if (((struct uip_eth_hdr *) ethHeader)->type != HTONS(UIP_ETHTYPE_IPV6)) {
|
if (((struct uip_eth_hdr *) ethHeader)->type != UIP_HTONS(UIP_ETHTYPE_IPV6)) {
|
||||||
PRINTF("eth2low: Dropping packet w/type=0x%04x\n",ntohs(((struct uip_eth_hdr *) ethHeader)->type));
|
PRINTF("eth2low: Dropping packet w/type=0x%04x\n",uip_ntohs(((struct uip_eth_hdr *) ethHeader)->type));
|
||||||
// printf("!ipv6");
|
// printf("!ipv6");
|
||||||
#if !RF230BB
|
#if !RF230BB
|
||||||
usb_eth_stat.txbad++;
|
usb_eth_stat.txbad++;
|
||||||
|
@ -448,7 +448,7 @@ void mac_LowpanToEthernet(void)
|
||||||
|
|
||||||
//printf("in lowpantoethernet\n\r");
|
//printf("in lowpantoethernet\n\r");
|
||||||
//Setup generic ethernet stuff
|
//Setup generic ethernet stuff
|
||||||
ETHBUF(uip_buf)->type = htons(UIP_ETHTYPE_IPV6);
|
ETHBUF(uip_buf)->type = uip_htons(UIP_ETHTYPE_IPV6);
|
||||||
|
|
||||||
//Check for broadcast message
|
//Check for broadcast message
|
||||||
|
|
||||||
|
@ -924,7 +924,7 @@ mac_log_802_15_4_tx(const uint8_t* buffer, size_t total_len) {
|
||||||
sendlen = total_len;
|
sendlen = total_len;
|
||||||
|
|
||||||
/* Setup generic ethernet stuff */
|
/* Setup generic ethernet stuff */
|
||||||
ETHBUF(raw_buf)->type = htons(0x809A); //UIP_ETHTYPE_802154 0x809A
|
ETHBUF(raw_buf)->type = uip_htons(0x809A); //UIP_ETHTYPE_802154 0x809A
|
||||||
|
|
||||||
/* Check for broadcast message */
|
/* Check for broadcast message */
|
||||||
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_null)) {
|
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_null)) {
|
||||||
|
@ -965,7 +965,7 @@ mac_log_802_15_4_rx(const uint8_t* buf, size_t len) {
|
||||||
sendlen = len;
|
sendlen = len;
|
||||||
|
|
||||||
/* Setup generic ethernet stuff */
|
/* Setup generic ethernet stuff */
|
||||||
ETHBUF(raw_buf)->type = htons(0x809A); //UIP_ETHTYPE_802154 0x809A
|
ETHBUF(raw_buf)->type = uip_htons(0x809A); //UIP_ETHTYPE_802154 0x809A
|
||||||
|
|
||||||
/* Check for broadcast message */
|
/* Check for broadcast message */
|
||||||
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_null)) {
|
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_null)) {
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: gateway.c,v 1.3 2007/05/21 14:14:16 bg- Exp $
|
* @(#)$Id: gateway.c,v 1.4 2010/10/19 18:29:05 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -78,7 +78,7 @@ static struct uip_fw_netif slipif =
|
||||||
{UIP_FW_NETIF(0,0,0,0, 255,255,255,255, slip_send)};
|
{UIP_FW_NETIF(0,0,0,0, 255,255,255,255, slip_send)};
|
||||||
|
|
||||||
/* Radio stuff in network byte order. */
|
/* Radio stuff in network byte order. */
|
||||||
static u16_t panId = HTONS(0x2024);
|
static u16_t panId = UIP_HTONS(0x2024);
|
||||||
|
|
||||||
#ifndef RF_CHANNEL
|
#ifndef RF_CHANNEL
|
||||||
#define RF_CHANNEL 15
|
#define RF_CHANNEL 15
|
||||||
|
@ -110,7 +110,7 @@ main(int argc, char **argv)
|
||||||
leds_toggle(LEDS_ALL);
|
leds_toggle(LEDS_ALL);
|
||||||
slip_arch_init(BAUD2UBR(38400)); /* Must come before first printf */
|
slip_arch_init(BAUD2UBR(38400)); /* Must come before first printf */
|
||||||
printf("Starting %s "
|
printf("Starting %s "
|
||||||
"($Id: gateway.c,v 1.3 2007/05/21 14:14:16 bg- Exp $)\n", __FILE__);
|
"($Id: gateway.c,v 1.4 2010/10/19 18:29:05 adamdunkels Exp $)\n", __FILE__);
|
||||||
ds2411_init();
|
ds2411_init();
|
||||||
cc2420_init();
|
cc2420_init();
|
||||||
xmem_init();
|
xmem_init();
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: radio-uip-uaodv.c,v 1.9 2007/12/13 16:57:31 fros4943 Exp $
|
* @(#)$Id: radio-uip-uaodv.c,v 1.10 2010/10/19 18:29:05 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "radio-uip-uaodv.h"
|
#include "radio-uip-uaodv.h"
|
||||||
|
@ -209,7 +209,7 @@ radio_uip_uaodv_send(void)
|
||||||
|
|
||||||
/* Transmit uAODV packets with headers but without using route table */
|
/* Transmit uAODV packets with headers but without using route table */
|
||||||
if (((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])->proto == UIP_PROTO_UDP
|
if (((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])->proto == UIP_PROTO_UDP
|
||||||
&& radio_uip_uaodv_dest_port(&uip_buf[UIP_LLH_LEN], uip_len) == HTONS(UAODV_UDPPORT)) {
|
&& radio_uip_uaodv_dest_port(&uip_buf[UIP_LLH_LEN], uip_len) == UIP_HTONS(UAODV_UDPPORT)) {
|
||||||
uip_ipaddr_t nexthop;
|
uip_ipaddr_t nexthop;
|
||||||
memcpy(&nexthop, &((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])->destipaddr, 4);
|
memcpy(&nexthop, &((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])->destipaddr, 4);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: testuaodv.c,v 1.3 2010/01/14 19:19:50 nifi Exp $
|
* $Id: testuaodv.c,v 1.4 2010/10/19 18:29:05 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -56,11 +56,11 @@ PROCESS_THREAD(test_uaodv_process, ev, data)
|
||||||
printf("uIP uAODV test process started\n");
|
printf("uIP uAODV test process started\n");
|
||||||
|
|
||||||
uip_ipaddr(&addr, 0,0,0,0);
|
uip_ipaddr(&addr, 0,0,0,0);
|
||||||
in_conn = udp_new(&addr, HTONS(0), NULL);
|
in_conn = udp_new(&addr, UIP_HTONS(0), NULL);
|
||||||
uip_udp_bind(in_conn, HTONS(COOJA_PORT));
|
uip_udp_bind(in_conn, UIP_HTONS(COOJA_PORT));
|
||||||
|
|
||||||
uip_ipaddr(&addr, 10,10,10,4);
|
uip_ipaddr(&addr, 10,10,10,4);
|
||||||
out_conn = udp_new(&addr, HTONS(COOJA_PORT), NULL);
|
out_conn = udp_new(&addr, UIP_HTONS(COOJA_PORT), NULL);
|
||||||
|
|
||||||
button_sensor.configure(SENSORS_ACTIVE, 1);
|
button_sensor.configure(SENSORS_ACTIVE, 1);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: pinger.c,v 1.2 2010/01/15 10:37:04 nifi Exp $
|
* @(#)$Id: pinger.c,v 1.3 2010/10/19 18:29:05 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki-esb.h"
|
#include "contiki-esb.h"
|
||||||
|
@ -77,11 +77,11 @@ udp_appcall(void *arg)
|
||||||
leds_toggle(LEDS_YELLOW);
|
leds_toggle(LEDS_YELLOW);
|
||||||
/* beep();*/
|
/* beep();*/
|
||||||
|
|
||||||
/* if(htons(d->seqno) != last_seqno + 1) {
|
/* if(uip_htons(d->seqno) != last_seqno + 1) {
|
||||||
leds_toggle(LEDS_RED);
|
leds_toggle(LEDS_RED);
|
||||||
beep_quick(2);
|
beep_quick(2);
|
||||||
}*/
|
}*/
|
||||||
/* last_seqno = htons(d->seqno);*/
|
/* last_seqno = uip_htons(d->seqno);*/
|
||||||
/* uip_udp_send(sizeof(struct data));*/
|
/* uip_udp_send(sizeof(struct data));*/
|
||||||
/* snprintf(buf, sizeof(buf), "Packet received id %d signal %u\n",
|
/* snprintf(buf, sizeof(buf), "Packet received id %d signal %u\n",
|
||||||
d->id, tr1001_sstrength());
|
d->id, tr1001_sstrength());
|
||||||
|
@ -91,7 +91,7 @@ udp_appcall(void *arg)
|
||||||
d->pingpong = PONG;
|
d->pingpong = PONG;
|
||||||
} else {
|
} else {
|
||||||
d->pingpong = PING;
|
d->pingpong = PING;
|
||||||
d->seqno = htons(htons(d->seqno) + 1);
|
d->seqno = uip_htons(uip_htons(d->seqno) + 1);
|
||||||
}*/
|
}*/
|
||||||
/* uip_udp_send(sizeof(struct data));
|
/* uip_udp_send(sizeof(struct data));
|
||||||
timer_restart(&timer);*/
|
timer_restart(&timer);*/
|
||||||
|
@ -100,7 +100,7 @@ udp_appcall(void *arg)
|
||||||
--packet_count;
|
--packet_count;
|
||||||
d->id = place_id;
|
d->id = place_id;
|
||||||
d->pingpong = PING;
|
d->pingpong = PING;
|
||||||
d->seqno = htons(sent_seqno);
|
d->seqno = uip_htons(sent_seqno);
|
||||||
++sent_seqno;
|
++sent_seqno;
|
||||||
uip_udp_send(sizeof(struct data));
|
uip_udp_send(sizeof(struct data));
|
||||||
etimer_reset(&etimer);
|
etimer_reset(&etimer);
|
||||||
|
@ -167,7 +167,7 @@ PROCESS_THREAD(pinger, ev, data)
|
||||||
|
|
||||||
pingeron = 0;
|
pingeron = 0;
|
||||||
|
|
||||||
conn = udp_broadcast_new(HTONS(PORT), NULL);
|
conn = udp_broadcast_new(UIP_HTONS(PORT), NULL);
|
||||||
|
|
||||||
PT_INIT(&config_pt);
|
PT_INIT(&config_pt);
|
||||||
|
|
||||||
|
|
|
@ -26,14 +26,14 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: radio-test.c,v 1.2 2006/10/09 11:55:30 adamdunkels Exp $
|
* $Id: radio-test.c,v 1.3 2010/10/19 18:29:05 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
* -----------------------------------------------------------------
|
* -----------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
|
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
|
||||||
* Created : 2006-03-07
|
* Created : 2006-03-07
|
||||||
* Updated : $Date: 2006/10/09 11:55:30 $
|
* Updated : $Date: 2010/10/19 18:29:05 $
|
||||||
* $Revision: 1.2 $
|
* $Revision: 1.3 $
|
||||||
*
|
*
|
||||||
* Simple application to indicate connectivity between two nodes:
|
* Simple application to indicate connectivity between two nodes:
|
||||||
*
|
*
|
||||||
|
@ -96,7 +96,7 @@ PROCESS_THREAD(radio_test_process, ev, data)
|
||||||
other.led = LEDS_GREEN;
|
other.led = LEDS_GREEN;
|
||||||
flash.led = LEDS_RED;
|
flash.led = LEDS_RED;
|
||||||
|
|
||||||
conn = udp_broadcast_new(HTONS(PORT), NULL);
|
conn = udp_broadcast_new(UIP_HTONS(PORT), NULL);
|
||||||
etimer_set(&send_timer, CLOCK_SECOND);
|
etimer_set(&send_timer, CLOCK_SECOND);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
|
|
|
@ -26,14 +26,14 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: test-receiver.c,v 1.1 2006/06/18 07:48:48 adamdunkels Exp $
|
* $Id: test-receiver.c,v 1.2 2010/10/19 18:29:05 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
* -----------------------------------------------------------------
|
* -----------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
|
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
|
||||||
* Created : 2006-03-07
|
* Created : 2006-03-07
|
||||||
* Updated : $Date: 2006/06/18 07:48:48 $
|
* Updated : $Date: 2010/10/19 18:29:05 $
|
||||||
* $Revision: 1.1 $
|
* $Revision: 1.2 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki-esb.h"
|
#include "contiki-esb.h"
|
||||||
|
@ -50,7 +50,7 @@ PROCESS_THREAD(test_receiver_process, ev, data)
|
||||||
|
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
conn = udp_broadcast_new(HTONS(PORT), NULL);
|
conn = udp_broadcast_new(UIP_HTONS(PORT), NULL);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event && uip_newdata());
|
PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event && uip_newdata());
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue