added fallback interface and removed uip_router

This commit is contained in:
joxe 2010-03-16 15:35:03 +00:00
parent 2b44f809fb
commit b4adc6bcb5
2 changed files with 16 additions and 16 deletions

View file

@ -29,7 +29,7 @@
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* *
* $Id: tcpip.c,v 1.25 2010/03/15 16:41:24 joxe Exp $ * $Id: tcpip.c,v 1.26 2010/03/16 15:35:03 joxe Exp $
*/ */
/** /**
* \file * \file
@ -73,6 +73,10 @@ void uip_log(char *msg);
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN]) #define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
#define UIP_TCP_BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN]) #define UIP_TCP_BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
#ifdef UIP_FALLBACK_INTERFACE
external struct uip_fallback_interface UIP_FALLBACK_INTERFACE;
#endif
process_event_t tcpip_event; process_event_t tcpip_event;
#if UIP_CONF_ICMP6 #if UIP_CONF_ICMP6
process_event_t tcpip_icmp6_event; process_event_t tcpip_icmp6_event;
@ -568,7 +572,11 @@ tcpip_ipv6_output(void)
locrt = uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr); locrt = uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr);
if(locrt == NULL) { if(locrt == NULL) {
if((nexthop = uip_ds6_defrt_choose()) == NULL) { if((nexthop = uip_ds6_defrt_choose()) == NULL) {
#ifdef UIP_FALLBACK_INTERFACE
UIP_FALLBACK_INTERFACE.output();
#else
PRINTF("tcpip_ipv6_output: Destination off-link but no route\n"); PRINTF("tcpip_ipv6_output: Destination off-link but no route\n");
#endif
uip_len = 0; uip_len = 0;
return; return;
} }
@ -741,7 +749,9 @@ PROCESS_THREAD(tcpip_process, ev, data)
etimer_set(&periodic, CLOCK_SECOND / 2); etimer_set(&periodic, CLOCK_SECOND / 2);
uip_init(); uip_init();
#ifdef UIP_FALLBACK_INTERFACE
UIP_FALLBACK_INTERFACE.init();
#endif
while(1) { while(1) {
PROCESS_YIELD(); PROCESS_YIELD();
eventhandler(ev, data); eventhandler(ev, data);

View file

@ -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.27 2010/03/15 16:41:24 joxe Exp $ * $Id: uip.h,v 1.28 2010/03/16 15:35:03 joxe Exp $
* *
*/ */
@ -1356,21 +1356,11 @@ struct uip_udp_conn {
extern struct uip_udp_conn *uip_udp_conn; extern struct uip_udp_conn *uip_udp_conn;
extern struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS]; extern struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS];
struct uip_router { struct uip_fallback_interface {
int (*activate)(void); void (*init)(void);
int (*deactivate)(void); void (*output)(void);
uip_ipaddr_t *(*lookup)(uip_ipaddr_t *destipaddr, uip_ipaddr_t *nexthop);
}; };
#if UIP_CONF_ROUTER
extern const struct uip_router *uip_router;
/**
* uIP routing driver registration function.
*/
void uip_router_register(const struct uip_router *router);
#endif /*UIP_CONF_ROUTER*/
#if UIP_CONF_ICMP6 #if UIP_CONF_ICMP6
struct uip_icmp6_conn { struct uip_icmp6_conn {
uip_icmp6_appstate_t appstate; uip_icmp6_appstate_t appstate;