From 5f3296e9436c778284341121f6ed2774aa387feb Mon Sep 17 00:00:00 2001 From: oliverschmidt Date: Sun, 20 May 2007 21:29:39 +0000 Subject: [PATCH] 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. --- Makefile.include | 2 +- core/net/packet-service.h | 46 -------- core/net/tcpip.c | 12 +- core/net/tcpip.h | 8 +- core/net/{uip-fw-service.c => uip-fw-drv.c} | 17 +-- core/net/{uip-fw-service.h => uip-fw-drv.h} | 8 +- .../native/net/tapdev-drv.c | 31 +++--- .../native/net/tapdev-drv.h | 10 +- cpu/native/net/tapdev-service.c | 103 ------------------ cpu/native/net/tapdev-service.h | 41 ------- cpu/native/net/tapdev.c | 7 +- cpu/native/net/tapdev.h | 3 +- .../net/{wpcap-service.c => wpcap-drv.c} | 33 +++--- .../net/{wpcap-service.h => wpcap-drv.h} | 10 +- cpu/native/net/wpcap.c | 7 +- cpu/native/net/wpcap.h | 3 +- platform/gtk/Makefile.gtk | 2 +- platform/gtk/net/tapdev.c | 7 +- platform/gtk/net/tapdev.h | 44 -------- platform/minimal-net/Makefile.minimal-net | 4 +- platform/minimal-net/contiki-main.c | 6 +- 21 files changed, 93 insertions(+), 311 deletions(-) delete mode 100644 core/net/packet-service.h rename core/net/{uip-fw-service.c => uip-fw-drv.c} (83%) rename core/net/{uip-fw-service.h => uip-fw-drv.h} (91%) rename platform/gtk/net/tapdev-service.c => cpu/native/net/tapdev-drv.c (87%) rename platform/gtk/net/tapdev-service.h => cpu/native/net/tapdev-drv.h (90%) delete mode 100644 cpu/native/net/tapdev-service.c delete mode 100644 cpu/native/net/tapdev-service.h rename cpu/native/net/{wpcap-service.c => wpcap-drv.c} (87%) rename cpu/native/net/{wpcap-service.h => wpcap-drv.h} (91%) delete mode 100644 platform/gtk/net/tapdev.h diff --git a/Makefile.include b/Makefile.include index 01378f115..dacd31c27 100644 --- a/Makefile.include +++ b/Makefile.include @@ -39,7 +39,7 @@ THREADS = mt.c LIBS = memb.c timer.c list.c etimer.c energest.c rtimer.c CTK = ctk.c UIP = uip.c uiplib.c resolv.c tcpip.c psock.c hc.c uip-split.c \ - uip-fw.c uip-fw-service.c uipbuf.c uip_arp.c uiplib.c tcpdump.c \ + uip-fw.c uip-fw-drv.c uipbuf.c uip_arp.c uiplib.c tcpdump.c \ uip-neighbor.c uip-udp-packet.c rawpacket-udp.c uip-over-mesh.c NET = $(UIP) uaodv.c uaodv-rt.c diff --git a/core/net/packet-service.h b/core/net/packet-service.h deleted file mode 100644 index 64ef57c88..000000000 --- a/core/net/packet-service.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: packet-service.h,v 1.1 2006/06/17 22:41:18 adamdunkels Exp $ - */ -#ifndef __PACKET_SERVICE_H__ -#define __PACKET_SERVICE_H__ - -#include "contiki.h" - -#define packet_service_name "Packet driver" - -SERVICE_INTERFACE(packet_service, { - u8_t (* output)(void); -}); - -#endif /* __PACKET_SERVICE_H__ */ diff --git a/core/net/tcpip.c b/core/net/tcpip.c index fc9b98071..898b65693 100644 --- a/core/net/tcpip.c +++ b/core/net/tcpip.c @@ -30,13 +30,11 @@ * * Author: Adam Dunkels * - * $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 @@ -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) { diff --git a/core/net/tcpip.h b/core/net/tcpip.h index 63a918ad1..07a44df08 100644 --- a/core/net/tcpip.h +++ b/core/net/tcpip.h @@ -60,7 +60,7 @@ * * Author: Adam Dunkels * - * $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) /** @} */ diff --git a/core/net/uip-fw-service.c b/core/net/uip-fw-drv.c similarity index 83% rename from core/net/uip-fw-service.c rename to core/net/uip-fw-drv.c index 3062fa8d9..9bd0fa175 100644 --- a/core/net/uip-fw-service.c +++ b/core/net/uip-fw-drv.c @@ -30,17 +30,11 @@ * * Author: Adam Dunkels * - * $Id: uip-fw-service.c,v 1.1 2006/06/17 22:41:19 adamdunkels Exp $ + * $Id: uip-fw-drv.c,v 1.1 2007/05/20 21:29:40 oliverschmidt Exp $ */ -#include "net/packet-service.h" - #include "net/uip-fw.h" -SERVICE(uip_fw_service, packet_service, { uip_fw_output }); - -/*---------------------------------------------------------------------------*/ - PROCESS(uip_fw_process, "IP forwarding"); /*---------------------------------------------------------------------------*/ @@ -50,13 +44,12 @@ PROCESS_THREAD(uip_fw_process, ev, data) PROCESS_SET_FLAGS(PROCESS_NO_BROADCAST); - SERVICE_REGISTER(uip_fw_service); + uip_fw_init(); - PROCESS_WAIT_UNTIL(ev == PROCESS_EVENT_EXIT || - ev == PROCESS_EVENT_SERVICE_REMOVED); + tcpip_set_outputfunc(uip_fw_output); + + PROCESS_WAIT_UNTIL(ev == PROCESS_EVENT_EXIT); - SERVICE_REMOVE(uip_fw_service); - PROCESS_END(); } /*---------------------------------------------------------------------------*/ diff --git a/core/net/uip-fw-service.h b/core/net/uip-fw-drv.h similarity index 91% rename from core/net/uip-fw-service.h rename to core/net/uip-fw-drv.h index f4b87f13e..300d62130 100644 --- a/core/net/uip-fw-service.h +++ b/core/net/uip-fw-drv.h @@ -30,14 +30,14 @@ * * Author: Adam Dunkels * - * $Id: uip-fw-service.h,v 1.1 2006/06/17 22:41:19 adamdunkels Exp $ + * $Id: uip-fw-drv.h,v 1.1 2007/05/20 21:29:40 oliverschmidt Exp $ */ -#ifndef __UIP_FW_SERVICE_H__ -#define __UIP_FW_SERVICE_H__ +#ifndef __UIP_FW_DRV_H__ +#define __UIP_FW_DRV_H__ #include "contiki.h" #include "net/uip-fw.h" PROCESS_NAME(uip_fw_process); -#endif /* __UIP_FW_SERVICE_H__ */ +#endif /* __UIP_FW_DRV_H__ */ diff --git a/platform/gtk/net/tapdev-service.c b/cpu/native/net/tapdev-drv.c similarity index 87% rename from platform/gtk/net/tapdev-service.c rename to cpu/native/net/tapdev-drv.c index d3768ecdf..130634538 100644 --- a/platform/gtk/net/tapdev-service.c +++ b/cpu/native/net/tapdev-drv.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: tapdev-service.c,v 1.4 2007/03/27 21:26:25 oliverschmidt Exp $ + * @(#)$Id: tapdev-drv.c,v 1.1 2007/05/20 21:32:24 oliverschmidt Exp $ */ #include "contiki-net.h" @@ -37,10 +37,6 @@ #define BUF ((struct uip_eth_hdr *)&uip_buf[0]) -u8_t tapdev_output(void); - -SERVICE(tapdev_service, packet_service, { tapdev_output }); - PROCESS(tapdev_process, "TAP driver"); /*---------------------------------------------------------------------------*/ @@ -67,6 +63,7 @@ pollhandler(void) } else #endif /* UIP_CONF_IPV6 */ if(BUF->type == htons(UIP_ETHTYPE_IP)) { + uip_len -= sizeof(struct uip_eth_hdr); tcpip_input(); } else if(BUF->type == htons(UIP_ETHTYPE_ARP)) { uip_arp_arpin(); @@ -80,23 +77,27 @@ pollhandler(void) } } /*---------------------------------------------------------------------------*/ +static void +exithandler(void) +{ + tapdev_exit(); +} +/*---------------------------------------------------------------------------*/ PROCESS_THREAD(tapdev_process, ev, data) { + PROCESS_POLLHANDLER(pollhandler()); + PROCESS_EXITHANDLER(exithandler()); + PROCESS_BEGIN(); tapdev_init(); - - SERVICE_REGISTER(tapdev_service); + + tcpip_set_outputfunc(tapdev_output); process_poll(&tapdev_process); - - while(1) { - PROCESS_YIELD(); - if(ev == PROCESS_EVENT_POLL) { - pollhandler(); - } - } - + + PROCESS_WAIT_UNTIL(ev == PROCESS_EVENT_EXIT); + PROCESS_END(); } /*---------------------------------------------------------------------------*/ diff --git a/platform/gtk/net/tapdev-service.h b/cpu/native/net/tapdev-drv.h similarity index 90% rename from platform/gtk/net/tapdev-service.h rename to cpu/native/net/tapdev-drv.h index 82ecb9d1d..f5b3b3720 100644 --- a/platform/gtk/net/tapdev-service.h +++ b/cpu/native/net/tapdev-drv.h @@ -28,14 +28,16 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: tapdev-service.h,v 1.2 2007/03/27 20:49:09 oliverschmidt Exp $ + * @(#)$Id: tapdev-drv.h,v 1.1 2007/05/20 21:32:24 oliverschmidt Exp $ */ -#ifndef __TAPDEV_SERVICE_H__ -#define __TAPDEV_SERVICE_H__ +#ifndef __TAPDEV_DRV_H__ +#define __TAPDEV_DRV_H__ #include "contiki.h" PROCESS_NAME(tapdev_process); -#endif /* __TAPDEV_SERVICE_H__ */ +u8_t tapdev_output(void); + +#endif /* __TAPDEV_DRV_H__ */ diff --git a/cpu/native/net/tapdev-service.c b/cpu/native/net/tapdev-service.c deleted file mode 100644 index c67c36c0f..000000000 --- a/cpu/native/net/tapdev-service.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: tapdev-service.c,v 1.1 2007/03/31 18:49:40 adamdunkels Exp $ - */ - -#include "contiki-net.h" -#include "tapdev.h" -#include "net/uip-neighbor.h" - -#define BUF ((struct uip_eth_hdr *)&uip_buf[0]) - -u8_t tapdev_output(void); - -SERVICE(tapdev_service, packet_service, { tapdev_output }); - -PROCESS(tapdev_process, "TAP driver"); - -/*---------------------------------------------------------------------------*/ -u8_t -tapdev_output(void) -{ - uip_arp_out(); - tapdev_send(); - - uip_len -= UIP_LLH_LEN; - return UIP_FW_OK; -} -/*---------------------------------------------------------------------------*/ -static void -pollhandler(void) -{ - process_poll(&tapdev_process); - uip_len = tapdev_poll(); - - if(uip_len > 0) { -#if UIP_CONF_IPV6 - if(BUF->type == htons(UIP_ETHTYPE_IPV6)) { - uip_neighbor_add(&IPBUF->srcipaddr, &BUF->src); - tcpip_input(); - } else -#endif /* UIP_CONF_IPV6 */ - if(BUF->type == htons(UIP_ETHTYPE_IP)) { - tcpip_input(); - } else if(BUF->type == htons(UIP_ETHTYPE_ARP)) { - uip_arp_arpin(); - /* If the above function invocation resulted in data that - should be sent out on the network, the global variable - uip_len is set to a value > 0. */ - if(uip_len > 0) { - tapdev_send(); - } - } - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(tapdev_process, ev, data) -{ - PROCESS_BEGIN(); - - tapdev_init(); - - SERVICE_REGISTER(tapdev_service); - - process_poll(&tapdev_process); - - while(1) { - PROCESS_YIELD(); - if(ev == PROCESS_EVENT_POLL) { - pollhandler(); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/cpu/native/net/tapdev-service.h b/cpu/native/net/tapdev-service.h deleted file mode 100644 index 62755192d..000000000 --- a/cpu/native/net/tapdev-service.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: tapdev-service.h,v 1.1 2007/03/31 18:49:40 adamdunkels Exp $ - */ - -#ifndef __TAPDEV_SERVICE_H__ -#define __TAPDEV_SERVICE_H__ - -#include "contiki.h" - -PROCESS_NAME(tapdev_process); - -#endif /* __TAPDEV_SERVICE_H__ */ diff --git a/cpu/native/net/tapdev.c b/cpu/native/net/tapdev.c index a058009a8..1996e17a3 100644 --- a/cpu/native/net/tapdev.c +++ b/cpu/native/net/tapdev.c @@ -31,7 +31,7 @@ * * Author: Adam Dunkels * - * $Id: tapdev.c,v 1.1 2007/03/31 18:49:40 adamdunkels Exp $ + * $Id: tapdev.c,v 1.2 2007/05/20 21:32:24 oliverschmidt Exp $ */ #include @@ -178,3 +178,8 @@ tapdev_send(void) } } /*---------------------------------------------------------------------------*/ +void +tapdev_exit(void) +{ +} +/*---------------------------------------------------------------------------*/ diff --git a/cpu/native/net/tapdev.h b/cpu/native/net/tapdev.h index 73a6b853e..d3c1d53c8 100644 --- a/cpu/native/net/tapdev.h +++ b/cpu/native/net/tapdev.h @@ -31,7 +31,7 @@ * * This file is part of the uIP TCP/IP stack. * - * $Id: tapdev.h,v 1.1 2007/03/31 18:49:40 adamdunkels Exp $ + * $Id: tapdev.h,v 1.2 2007/05/20 21:32:24 oliverschmidt Exp $ */ #ifndef __TAPDEV_H__ @@ -40,5 +40,6 @@ void tapdev_init(void); u16_t tapdev_poll(void); void tapdev_send(void); +void tapdev_exit(void); #endif /* __TAPDEV_H__ */ diff --git a/cpu/native/net/wpcap-service.c b/cpu/native/net/wpcap-drv.c similarity index 87% rename from cpu/native/net/wpcap-service.c rename to cpu/native/net/wpcap-drv.c index 60afb62da..9f37c8001 100644 --- a/cpu/native/net/wpcap-service.c +++ b/cpu/native/net/wpcap-drv.c @@ -28,19 +28,17 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: wpcap-service.c,v 1.2 2007/04/01 21:06:30 oliverschmidt Exp $ + * @(#)$Id: wpcap-drv.c,v 1.1 2007/05/20 21:32:24 oliverschmidt Exp $ */ #include "contiki-net.h" #include "wpcap.h" #include "net/uip-neighbor.h" +#include "wpcap-drv.h" + #define BUF ((struct uip_eth_hdr *)&uip_buf[0]) -u8_t wpcap_output(void); - -SERVICE(wpcap_service, packet_service, { wpcap_output }); - PROCESS(wpcap_process, "WinPcap driver"); /*---------------------------------------------------------------------------*/ @@ -67,6 +65,7 @@ pollhandler(void) } else #endif /* UIP_CONF_IPV6 */ if(BUF->type == htons(UIP_ETHTYPE_IP)) { + uip_len -= sizeof(struct uip_eth_hdr); tcpip_input(); } else if(BUF->type == htons(UIP_ETHTYPE_ARP)) { uip_arp_arpin(); @@ -80,23 +79,27 @@ pollhandler(void) } } /*---------------------------------------------------------------------------*/ +static void +exithandler(void) +{ + wpcap_exit(); +} +/*---------------------------------------------------------------------------*/ PROCESS_THREAD(wpcap_process, ev, data) { + PROCESS_POLLHANDLER(pollhandler()); + PROCESS_EXITHANDLER(exithandler()); + PROCESS_BEGIN(); wpcap_init(); - - SERVICE_REGISTER(wpcap_service); + + tcpip_set_outputfunc(wpcap_output); process_poll(&wpcap_process); - - while(1) { - PROCESS_YIELD(); - if(ev == PROCESS_EVENT_POLL) { - pollhandler(); - } - } - + + PROCESS_WAIT_UNTIL(ev == PROCESS_EVENT_EXIT); + PROCESS_END(); } /*---------------------------------------------------------------------------*/ diff --git a/cpu/native/net/wpcap-service.h b/cpu/native/net/wpcap-drv.h similarity index 91% rename from cpu/native/net/wpcap-service.h rename to cpu/native/net/wpcap-drv.h index 44aefffb9..5d0465369 100644 --- a/cpu/native/net/wpcap-service.h +++ b/cpu/native/net/wpcap-drv.h @@ -28,14 +28,16 @@ * * This file is part of the Contiki operating system. * - * $Id: wpcap-service.h,v 1.1 2007/04/01 20:39:38 oliverschmidt Exp $ + * $Id: wpcap-drv.h,v 1.1 2007/05/20 21:32:25 oliverschmidt Exp $ */ -#ifndef __WPCAP_SERVICE_H__ -#define __WPCAP_SERVICE_H__ +#ifndef __WPCAP_DRV_H__ +#define __WPCAP_DRV_H__ #include "contiki.h" PROCESS_NAME(wpcap_process); -#endif /* __WPCAP_SERVICE_H__ */ +u8_t wpcap_output(void); + +#endif /* __WPCAP_DRV_H__ */ diff --git a/cpu/native/net/wpcap.c b/cpu/native/net/wpcap.c index 23e325080..ec6a61b77 100644 --- a/cpu/native/net/wpcap.c +++ b/cpu/native/net/wpcap.c @@ -30,7 +30,7 @@ * * Author: Oliver Schmidt * - * $Id: wpcap.c,v 1.6 2007/04/11 00:21:28 oliverschmidt Exp $ + * $Id: wpcap.c,v 1.7 2007/05/20 21:32:24 oliverschmidt Exp $ */ #define WIN32_LEAN_AND_MEAN @@ -249,3 +249,8 @@ wpcap_send(void) } } /*---------------------------------------------------------------------------*/ +void +wpcap_exit(void) +{ +} +/*---------------------------------------------------------------------------*/ diff --git a/cpu/native/net/wpcap.h b/cpu/native/net/wpcap.h index 83abea48e..67099bd7d 100644 --- a/cpu/native/net/wpcap.h +++ b/cpu/native/net/wpcap.h @@ -30,7 +30,7 @@ * * Author: Oliver Schmidt * - * $Id: wpcap.h,v 1.1 2007/04/01 20:39:38 oliverschmidt Exp $ + * $Id: wpcap.h,v 1.2 2007/05/20 21:32:24 oliverschmidt Exp $ */ #ifndef __WPCAP_H__ @@ -39,5 +39,6 @@ void wpcap_init(void); u16_t wpcap_poll(void); void wpcap_send(void); +void wpcap_exit(void); #endif /* __WPCAP_H__ */ diff --git a/platform/gtk/Makefile.gtk b/platform/gtk/Makefile.gtk index bfeb389ad..ffe6b0788 100644 --- a/platform/gtk/Makefile.gtk +++ b/platform/gtk/Makefile.gtk @@ -11,7 +11,7 @@ CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o} CTKGTK = $(CTK) ctk-gtksim.c ctk-draw.c ctk-gtksim-service.c libconio.c \ ctk-gtksim-draw.c -CONTIKI_TARGET_SOURCEFILES = tapdev-service.c tapdev.c contiki-main.c \ +CONTIKI_TARGET_SOURCEFILES = tapdev-drv.c tapdev.c contiki-main.c \ dlloader.c clock.c $(CTK) $(CTKGTK) cfs-posix.c CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) diff --git a/platform/gtk/net/tapdev.c b/platform/gtk/net/tapdev.c index 5f9c20f08..5425e7490 100644 --- a/platform/gtk/net/tapdev.c +++ b/platform/gtk/net/tapdev.c @@ -31,7 +31,7 @@ * * Author: Adam Dunkels * - * $Id: tapdev.c,v 1.2 2007/03/27 20:49:09 oliverschmidt Exp $ + * $Id: tapdev.c,v 1.3 2007/05/20 21:34:28 oliverschmidt Exp $ */ #include @@ -157,3 +157,8 @@ tapdev_send(void) } } /*---------------------------------------------------------------------------*/ +void +tapdev_exit(void) +{ +} +/*---------------------------------------------------------------------------*/ diff --git a/platform/gtk/net/tapdev.h b/platform/gtk/net/tapdev.h deleted file mode 100644 index 6c08872ab..000000000 --- a/platform/gtk/net/tapdev.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Adam Dunkels. - * 4. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * $Id: tapdev.h,v 1.2 2007/03/27 20:49:09 oliverschmidt Exp $ - */ - -#ifndef __TAPDEV_H__ -#define __TAPDEV_H__ - -void tapdev_init(void); -u16_t tapdev_poll(void); -void tapdev_send(void); - -#endif /* __TAPDEV_H__ */ diff --git a/platform/minimal-net/Makefile.minimal-net b/platform/minimal-net/Makefile.minimal-net index c8c32f1eb..945cf5ef0 100644 --- a/platform/minimal-net/Makefile.minimal-net +++ b/platform/minimal-net/Makefile.minimal-net @@ -9,9 +9,9 @@ CONTIKI_TARGET_SOURCEFILES = contiki-main.c dlloader.c clock.c \ leds.c leds-arch.c cfs-posix.c ifeq ($(OS),Windows_NT) -CONTIKI_TARGET_SOURCEFILES += wpcap-service.c wpcap.c +CONTIKI_TARGET_SOURCEFILES += wpcap-drv.c wpcap.c else -CONTIKI_TARGET_SOURCEFILES += tapdev-service.c tapdev.c +CONTIKI_TARGET_SOURCEFILES += tapdev-drv.c tapdev.c endif CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) diff --git a/platform/minimal-net/contiki-main.c b/platform/minimal-net/contiki-main.c index 5a12ea3c3..301abde66 100644 --- a/platform/minimal-net/contiki-main.c +++ b/platform/minimal-net/contiki-main.c @@ -29,7 +29,7 @@ * * This file is part of the Contiki OS * - * $Id: contiki-main.c,v 1.5 2007/05/19 21:18:10 oliverschmidt Exp $ + * $Id: contiki-main.c,v 1.6 2007/05/20 21:36:31 oliverschmidt Exp $ * */ @@ -37,9 +37,9 @@ #include "net/uip.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 #ifdef __CYGWIN__