Changed packet drivers from services to plain processes.

Now tcpip_output() is a function pointer that is supposed to be set via the macro tcpip_set_outputfunc(). Packet drivers do so on process startup.

Thus if there are several packet drivers in a Contiki system the one started last is the one actually used. This behaviour is especially useful for the 'IP forwarding' "meta" packet driver.
This commit is contained in:
oliverschmidt 2007-05-20 21:29:39 +00:00
parent 42a952981b
commit 5f3296e943
21 changed files with 93 additions and 311 deletions

View file

@ -30,13 +30,11 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: tcpip.c,v 1.7 2007/05/20 00:04:18 oliverschmidt Exp $
* $Id: tcpip.c,v 1.8 2007/05/20 21:29:39 oliverschmidt Exp $
*/
#include "contiki-conf.h"
#include "contiki-net.h"
#include "net/packet-service.h"
#include "net/uip-split.h"
#include <string.h>
@ -66,6 +64,8 @@ enum {
PACKET_INPUT
};
u8_t (* tcpip_output)(void); /* Called on IP packet output. */
unsigned char tcpip_do_forwarding; /* Forwarding enabled. */
unsigned char tcpip_is_forwarding; /* Forwarding right now? */
@ -103,12 +103,6 @@ packet_input(void)
}
}
/*---------------------------------------------------------------------------*/
void
tcpip_output(void)
{
SERVICE_CALL(packet_service, output());
}
/*---------------------------------------------------------------------------*/
struct uip_conn *
tcp_connect(uip_ipaddr_t *ripaddr, u16_t port, void *appstate)
{