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

@ -60,7 +60,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: tcpip.h,v 1.9 2007/05/20 00:04:18 oliverschmidt Exp $
* $Id: tcpip.h,v 1.10 2007/05/20 21:29:40 oliverschmidt Exp $
*/
#ifndef __TCPIP_H__
#define __TCPIP_H__
@ -296,7 +296,10 @@ CCIF extern process_event_t tcpip_event;
*/
CCIF void tcpip_input(void);
void tcpip_output(void);
/*
* This function is called on IP packet output.
*/
extern u8_t (* tcpip_output)(void);
/*
* Is forwarding generally enabled?
@ -308,6 +311,7 @@ extern unsigned char tcpip_do_forwarding;
*/
extern unsigned char tcpip_is_forwarding;
#define tcpip_set_outputfunc(outputfunc) tcpip_output = (outputfunc)
#define tcpip_set_forwarding(forwarding) tcpip_do_forwarding = (forwarding)
/** @} */