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:
parent
5f3296e943
commit
a22d2ecfef
|
@ -13,9 +13,9 @@ NETSIM = cfs-ram.c ether.c ethernode.c ethernode-uip.c lpm.c rs232.c flash.c \
|
|||
ethernode-rime.c
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
CONTIKI_TARGET_SOURCEFILES = $(NETSIM) $(SENSORS) wpcap-service.c wpcap.c
|
||||
CONTIKI_TARGET_SOURCEFILES = $(NETSIM) $(SENSORS) wpcap-drv.c wpcap.c
|
||||
else
|
||||
CONTIKI_TARGET_SOURCEFILES = $(NETSIM) $(SENSORS) tapdev-service.c tapdev.c
|
||||
CONTIKI_TARGET_SOURCEFILES = $(NETSIM) $(SENSORS) tapdev-drv.c tapdev.c
|
||||
endif
|
||||
|
||||
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: contiki-main.c,v 1.14 2007/05/19 21:20:03 oliverschmidt Exp $
|
||||
* $Id: contiki-main.c,v 1.15 2007/05/20 21:41:31 oliverschmidt Exp $
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
|
@ -40,9 +40,9 @@
|
|||
#include "net/rime.h"
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#include "net/wpcap-service.h"
|
||||
#include "net/wpcap-drv.h"
|
||||
#else
|
||||
#include "net/tapdev-service.h"
|
||||
#include "net/tapdev-drv.h"
|
||||
#endif
|
||||
#include "net/ethernode-uip.h"
|
||||
#include "net/ethernode-rime.h"
|
||||
|
@ -62,11 +62,9 @@
|
|||
#include "dev/leds.h"
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
u8_t wpcap_output(void);
|
||||
static struct uip_fw_netif extif =
|
||||
{UIP_FW_NETIF(0,0,0,0, 0,0,0,0, wpcap_output)};
|
||||
#else
|
||||
u8_t tapdev_output(void);
|
||||
static struct uip_fw_netif extif =
|
||||
{UIP_FW_NETIF(0,0,0,0, 0,0,0,0, tapdev_output)};
|
||||
#endif
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue