added curly brackets to ensure ANSI C compliance when UIP_TCP is defined; some automatic whitespace removal
This commit is contained in:
parent
647443cb9d
commit
91910f82dd
1 changed files with 43 additions and 41 deletions
|
@ -29,12 +29,12 @@
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* $Id: tcpip.c,v 1.13 2008/10/14 09:40:56 julienabeille Exp $
|
* $Id: tcpip.c,v 1.14 2008/10/15 07:59:34 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* \file
|
* \file
|
||||||
* Code for tunnelling uIP packets over the Rime mesh routing module
|
* Code for tunnelling uIP packets over the Rime mesh routing module
|
||||||
*
|
*
|
||||||
* \author Adam Dunkels <adam@sics.se>\author
|
* \author Adam Dunkels <adam@sics.se>\author
|
||||||
* \author Mathilde Durvy <mdurvy@cisco.com> (IPv6 related code)
|
* \author Mathilde Durvy <mdurvy@cisco.com> (IPv6 related code)
|
||||||
* \author Julien Abeille <jabeille@cisco.com> (IPv6 related code)
|
* \author Julien Abeille <jabeille@cisco.com> (IPv6 related code)
|
||||||
|
@ -109,7 +109,7 @@ enum {
|
||||||
#if UIP_CONF_IPV6
|
#if UIP_CONF_IPV6
|
||||||
u8_t (* tcpip_output)(uip_lladdr_t *);
|
u8_t (* tcpip_output)(uip_lladdr_t *);
|
||||||
#else
|
#else
|
||||||
u8_t (* tcpip_output)(void);
|
u8_t (* tcpip_output)(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if UIP_CONF_IP_FORWARD
|
#if UIP_CONF_IP_FORWARD
|
||||||
|
@ -285,7 +285,7 @@ udp_broadcast_new(u16_t port, void *appstate)
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if UIP_CONF_ICMP6
|
#if UIP_CONF_ICMP6
|
||||||
u8_t
|
u8_t
|
||||||
icmp6_new(void *appstate) {
|
icmp6_new(void *appstate) {
|
||||||
if(uip_icmp6_conns.appstate.p == PROCESS_NONE) {
|
if(uip_icmp6_conns.appstate.p == PROCESS_NONE) {
|
||||||
uip_icmp6_conns.appstate.p = PROCESS_CURRENT();
|
uip_icmp6_conns.appstate.p = PROCESS_CURRENT();
|
||||||
|
@ -306,10 +306,10 @@ void tcpip_icmp6_call(u8_t type) {
|
||||||
static void
|
static void
|
||||||
eventhandler(process_event_t ev, process_data_t data)
|
eventhandler(process_event_t ev, process_data_t data)
|
||||||
{
|
{
|
||||||
#if UIP_TCP
|
#if UIP_TCP
|
||||||
static unsigned char i;
|
static unsigned char i;
|
||||||
register struct listenport *l;
|
register struct listenport *l;
|
||||||
#endif /*UIP_TCP*/
|
#endif /*UIP_TCP*/
|
||||||
struct process *p;
|
struct process *p;
|
||||||
|
|
||||||
switch(ev) {
|
switch(ev) {
|
||||||
|
@ -320,7 +320,7 @@ eventhandler(process_event_t ev, process_data_t data)
|
||||||
connections. */
|
connections. */
|
||||||
|
|
||||||
p = (struct process *)data;
|
p = (struct process *)data;
|
||||||
#if UIP_TCP
|
#if UIP_TCP
|
||||||
l = s.listenports;
|
l = s.listenports;
|
||||||
for(i = 0; i < UIP_LISTENPORTS; ++i) {
|
for(i = 0; i < UIP_LISTENPORTS; ++i) {
|
||||||
if(l->p == p) {
|
if(l->p == p) {
|
||||||
|
@ -343,7 +343,7 @@ eventhandler(process_event_t ev, process_data_t data)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif /* UIP_TCP */
|
#endif /* UIP_TCP */
|
||||||
#if UIP_UDP
|
#if UIP_UDP
|
||||||
{
|
{
|
||||||
register struct uip_udp_conn *cptr;
|
register struct uip_udp_conn *cptr;
|
||||||
|
@ -362,7 +362,7 @@ eventhandler(process_event_t ev, process_data_t data)
|
||||||
/* We get this event if one of our timers have expired. */
|
/* We get this event if one of our timers have expired. */
|
||||||
{
|
{
|
||||||
/* Check the clock so see if we should call the periodic uIP
|
/* Check the clock so see if we should call the periodic uIP
|
||||||
processing. */
|
processing. */
|
||||||
if(data == &periodic &&
|
if(data == &periodic &&
|
||||||
etimer_expired(&periodic)) {
|
etimer_expired(&periodic)) {
|
||||||
#if UIP_TCP
|
#if UIP_TCP
|
||||||
|
@ -378,10 +378,10 @@ eventhandler(process_event_t ev, process_data_t data)
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
tcpip_output();
|
tcpip_output();
|
||||||
}
|
}
|
||||||
#endif /* UIP_CONF_IPV6 */
|
#endif /* UIP_CONF_IPV6 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* UIP_TCP */
|
#endif /* UIP_TCP */
|
||||||
#if UIP_CONF_IP_FORWARD
|
#if UIP_CONF_IP_FORWARD
|
||||||
uip_fw_periodic();
|
uip_fw_periodic();
|
||||||
#endif /* UIP_CONF_IP_FORWARD */
|
#endif /* UIP_CONF_IP_FORWARD */
|
||||||
|
@ -457,7 +457,7 @@ eventhandler(process_event_t ev, process_data_t data)
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
tcpip_output();
|
tcpip_output();
|
||||||
}
|
}
|
||||||
#endif /* UIP_UDP */
|
#endif /* UIP_UDP */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* UIP_UDP */
|
#endif /* UIP_UDP */
|
||||||
|
@ -496,7 +496,7 @@ tcpip_ipv6_output(void)
|
||||||
if(uip_is_addr_unspecified(&UIP_IP_BUF->destipaddr)){
|
if(uip_is_addr_unspecified(&UIP_IP_BUF->destipaddr)){
|
||||||
UIP_LOG("tcpip_ipv6_output: Destination address unspecified");
|
UIP_LOG("tcpip_ipv6_output: Destination address unspecified");
|
||||||
uip_len = 0;
|
uip_len = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) {
|
if(!uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) {
|
||||||
/*If destination is on link */
|
/*If destination is on link */
|
||||||
|
@ -512,7 +512,7 @@ tcpip_ipv6_output(void)
|
||||||
UIP_LOG("tcpip_ipv6_output: Destination off-link but no router");
|
UIP_LOG("tcpip_ipv6_output: Destination off-link but no router");
|
||||||
uip_len = 0;
|
uip_len = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* there are two cases where the entry logically does not exist:
|
/* there are two cases where the entry logically does not exist:
|
||||||
* 1 it really does not exist. 2 it is in the NO_STATE state */
|
* 1 it really does not exist. 2 it is in the NO_STATE state */
|
||||||
|
@ -523,7 +523,7 @@ tcpip_ipv6_output(void)
|
||||||
} else {
|
} else {
|
||||||
nbc->state = INCOMPLETE;
|
nbc->state = INCOMPLETE;
|
||||||
}
|
}
|
||||||
#if UIP_CONF_IPV6_QUEUE_PKT
|
#if UIP_CONF_IPV6_QUEUE_PKT
|
||||||
/* copy outgoing pkt in the queuing buffer for later transmmit */
|
/* copy outgoing pkt in the queuing buffer for later transmmit */
|
||||||
memcpy(nbc->queue_buf, UIP_IP_BUF, uip_len);
|
memcpy(nbc->queue_buf, UIP_IP_BUF, uip_len);
|
||||||
nbc->queue_buf_len = uip_len;
|
nbc->queue_buf_len = uip_len;
|
||||||
|
@ -546,7 +546,7 @@ tcpip_ipv6_output(void)
|
||||||
} else {
|
} else {
|
||||||
if (nbc->state == INCOMPLETE){
|
if (nbc->state == INCOMPLETE){
|
||||||
PRINTF("tcpip_ipv6_output: neighbor cache entry incomplete\n");
|
PRINTF("tcpip_ipv6_output: neighbor cache entry incomplete\n");
|
||||||
#if UIP_CONF_IPV6_QUEUE_PKT
|
#if UIP_CONF_IPV6_QUEUE_PKT
|
||||||
/* copy outgoing pkt in the queuing buffer for later transmmit and set
|
/* copy outgoing pkt in the queuing buffer for later transmmit and set
|
||||||
the destination neighbor to nbc */
|
the destination neighbor to nbc */
|
||||||
memcpy(nbc->queue_buf, UIP_IP_BUF, uip_len);
|
memcpy(nbc->queue_buf, UIP_IP_BUF, uip_len);
|
||||||
|
@ -578,9 +578,9 @@ tcpip_ipv6_output(void)
|
||||||
*to STALE, and you must both send a NA and the queued packet
|
*to STALE, and you must both send a NA and the queued packet
|
||||||
*/
|
*/
|
||||||
if(nbc->queue_buf_len != 0) {
|
if(nbc->queue_buf_len != 0) {
|
||||||
uip_len = nbc->queue_buf_len;
|
uip_len = nbc->queue_buf_len;
|
||||||
memcpy(UIP_IP_BUF, nbc->queue_buf, uip_len);
|
memcpy(UIP_IP_BUF, nbc->queue_buf, uip_len);
|
||||||
nbc->queue_buf_len = 0;
|
nbc->queue_buf_len = 0;
|
||||||
tcpip_output(&(nbc->lladdr));
|
tcpip_output(&(nbc->lladdr));
|
||||||
}
|
}
|
||||||
#endif /*UIP_CONF_IPV6_QUEUE_PKT*/
|
#endif /*UIP_CONF_IPV6_QUEUE_PKT*/
|
||||||
|
@ -629,29 +629,31 @@ tcpip_uipcall(void)
|
||||||
ts = &uip_conn->appstate;
|
ts = &uip_conn->appstate;
|
||||||
#endif /* UIP_UDP */
|
#endif /* UIP_UDP */
|
||||||
|
|
||||||
#if UIP_TCP
|
#if UIP_TCP
|
||||||
static unsigned char i;
|
{
|
||||||
register struct listenport *l;
|
static unsigned char i;
|
||||||
|
register struct listenport *l;
|
||||||
/* If this is a connection request for a listening port, we must
|
|
||||||
mark the connection with the right process ID. */
|
/* If this is a connection request for a listening port, we must
|
||||||
if(uip_connected()) {
|
mark the connection with the right process ID. */
|
||||||
l = &s.listenports[0];
|
if(uip_connected()) {
|
||||||
for(i = 0; i < UIP_LISTENPORTS; ++i) {
|
l = &s.listenports[0];
|
||||||
if(l->port == uip_conn->lport &&
|
for(i = 0; i < UIP_LISTENPORTS; ++i) {
|
||||||
l->p != PROCESS_NONE) {
|
if(l->port == uip_conn->lport &&
|
||||||
ts->p = l->p;
|
l->p != PROCESS_NONE) {
|
||||||
ts->state = NULL;
|
ts->p = l->p;
|
||||||
break;
|
ts->state = NULL;
|
||||||
}
|
break;
|
||||||
++l;
|
}
|
||||||
}
|
++l;
|
||||||
|
}
|
||||||
/* Start the periodic polling, if it isn't already active. */
|
|
||||||
if(etimer_expired(&periodic)) {
|
/* Start the periodic polling, if it isn't already active. */
|
||||||
etimer_restart(&periodic);
|
if(etimer_expired(&periodic)) {
|
||||||
}
|
etimer_restart(&periodic);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ts->p != NULL) {
|
if(ts->p != NULL) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue