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:41:31 +00:00
parent 5f3296e943
commit a22d2ecfef
5 changed files with 19 additions and 18 deletions

View file

@ -30,7 +30,7 @@
#
# Author: Oliver Schmidt <ol.sc@web.de>
#
# $Id: Makefile.win32,v 1.9 2007/05/19 21:23:06 oliverschmidt Exp $
# $Id: Makefile.win32,v 1.10 2007/05/20 21:43:21 oliverschmidt Exp $
#
ifndef CONTIKI
@ -45,7 +45,7 @@ CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o}
CONTIKI_TARGET_SOURCEFILES = contiki-main.c clock.c cfs-win32.c \
ctk-console.c dll-loader.c
CONTIKI_SOURCEFILES += $(CTK) ctk-conio.c wpcap.c wpcap-service.c \
CONTIKI_SOURCEFILES += $(CTK) ctk-conio.c wpcap.c wpcap-drv.c \
$(CONTIKI_TARGET_SOURCEFILES)
.SUFFIXES:

View file

@ -30,7 +30,7 @@
*
* Author: Oliver Schmidt <ol.sc@web.de>
*
* $Id: contiki-main.c,v 1.10 2007/05/19 21:23:06 oliverschmidt Exp $
* $Id: contiki-main.c,v 1.11 2007/05/20 21:43:21 oliverschmidt Exp $
*/
#define WIN32_LEAN_AND_MEAN
@ -38,7 +38,6 @@
#include <stdio.h>
#include <stdlib.h>
#include "contiki.h"
#include "contiki-net.h"
#include "sys/clock.h"
@ -49,7 +48,7 @@
#include "../../apps/webbrowser/www-dsc.h"
#include "sys/etimer.h"
#include "net/wpcap-service.h"
#include "net/wpcap-drv.h"
#include "program-handler.h"
PROCINIT(&etimer_process,
@ -85,6 +84,12 @@ log_message(const char *part1, const char *part2)
debug_printf("%s%s\n", part1, part2);
}
/*-----------------------------------------------------------------------------------*/
void
exit_handler(void)
{
process_post_synch(&wpcap_process, PROCESS_EVENT_EXIT, NULL);
}
/*-----------------------------------------------------------------------------------*/
int
main(void)
{
@ -95,6 +100,8 @@ main(void)
program_handler_add(&directory_dsc, "Directory", 1);
program_handler_add(&www_dsc, "Web browser", 1);
atexit(exit_handler);
#if 1
{
uip_ipaddr_t addr;

View file

@ -296,10 +296,6 @@
<Filter
Name="net"
>
<File
RelativePath="..\..\..\core\net\packet-service.h"
>
</File>
<File
RelativePath="..\..\..\core\net\psock.h"
>
@ -457,11 +453,11 @@
Name="net"
>
<File
RelativePath="..\..\..\cpu\native\net\wpcap-service.c"
RelativePath="..\..\..\cpu\native\net\wpcap-drv.c"
>
</File>
<File
RelativePath="..\..\..\cpu\native\net\wpcap-service.h"
RelativePath="..\..\..\cpu\native\net\wpcap-drv.h"
>
</File>
<File