mirror of
https://github.com/ep00ch/lwip-contrib-mac.git
synced 2024-07-04 15:29:30 +00:00
Hope it's compiling cleanly again, after all these recent changes...
Note that you also have to set the PCAP_DIR environment variable to point to the WinPcap Developer's Packs (containing 'include' and 'lib'), as well as the PLATFORMSDK_DIR environment variable to point to Microsoft's Platform SDK (or any other place containing 'include/windows.h').
This commit is contained in:
parent
24c826defe
commit
4b634d5d37
1
ports/msvc6/include/arch/bpstruct.h
Normal file
1
ports/msvc6/include/arch/bpstruct.h
Normal file
@ -0,0 +1 @@
|
||||
#pragma pack(push,1)
|
76
ports/msvc6/include/arch/cc.h
Normal file
76
ports/msvc6/include/arch/cc.h
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2003 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. 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 lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __ARCH_CC_H__
|
||||
#define __ARCH_CC_H__
|
||||
|
||||
/* Include some files for defining library routines */
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define LWIP_PROVIDE_ERRNO
|
||||
|
||||
/* Define platform endianness */
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
|
||||
/* Define generic types used in lwIP */
|
||||
typedef unsigned char u8_t;
|
||||
typedef signed char s8_t;
|
||||
typedef unsigned short u16_t;
|
||||
typedef signed short s16_t;
|
||||
typedef unsigned long u32_t;
|
||||
typedef signed long s32_t;
|
||||
|
||||
typedef u32_t mem_ptr_t;
|
||||
|
||||
/* Define (sn)printf formatters for these lwIP types */
|
||||
#define U16_F "hu"
|
||||
#define S16_F "hd"
|
||||
#define X16_F "hx"
|
||||
#define U32_F "lu"
|
||||
#define S32_F "ld"
|
||||
#define X32_F "lx"
|
||||
|
||||
/* Compiler hints for byte order */
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
|
||||
/* Compiler hints for packing structures */
|
||||
#define PACK_STRUCT_STRUCT
|
||||
|
||||
/* Plaform specific diagnostic output */
|
||||
#define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0)
|
||||
|
||||
#define LWIP_PLATFORM_ASSERT(x) do {printf("Assertion \"%s\" failed at line %d in %s\n", \
|
||||
x, __LINE__, __FILE__); fflush(NULL); abort();} while(0)
|
||||
|
||||
#endif /* __ARCH_CC_H__ */
|
1
ports/msvc6/include/arch/epstruct.h
Normal file
1
ports/msvc6/include/arch/epstruct.h
Normal file
@ -0,0 +1 @@
|
||||
#pragma pack(pop)
|
40
ports/msvc6/include/arch/perf.h
Normal file
40
ports/msvc6/include/arch/perf.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __PERF_H__
|
||||
#define __PERF_H__
|
||||
|
||||
#define PERF_START /* null definition */
|
||||
#define PERF_STOP(x) /* null definition */
|
||||
|
||||
#endif /* __PERF_H__ */
|
49
ports/msvc6/include/arch/sys_arch.h
Normal file
49
ports/msvc6/include/arch/sys_arch.h
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2003 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. 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 lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __ARCH_SYS_ARCH_H__
|
||||
#define __ARCH_SYS_ARCH_H__
|
||||
|
||||
typedef u32_t sys_prot_t;
|
||||
|
||||
/* HANDLE is used for sys_sem_t but we won't include windows.h */
|
||||
typedef void* sys_sem_t;
|
||||
#define SYS_SEM_NULL NULL
|
||||
|
||||
struct lwip_mbox;
|
||||
typedef struct lwip_mbox* sys_mbox_t;
|
||||
#define SYS_MBOX_NULL NULL
|
||||
|
||||
/* DWORD (thread id) is used for sys_thread_t but we won't include windows.h */
|
||||
typedef u32_t sys_thread_t;
|
||||
|
||||
#endif /* __ARCH_SYS_ARCH_H__ */
|
||||
|
@ -41,7 +41,7 @@ RSC=rc.exe
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "$(LWIP_SRC)\include" /I "$(LWIP_SRC)\include\ipv4" /I ".\include" /I ".\\" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "$(LWIP_SRC)\include" /I "$(LWIP_SRC)\include\ipv4" /I ".\include" /I ".\\" /I "$(PLATFORMSDK_DIR)\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x407 /d "NDEBUG"
|
||||
# ADD RSC /l 0x407 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
@ -64,7 +64,7 @@ LIB32=link.exe -lib
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "$(LWIP_SRC)\include" /I "$(LWIP_SRC)\include\ipv4" /I ".\include" /I ".\\" /D "_LIB" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "LWIP_DEBUG" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "$(LWIP_SRC)\include" /I "$(LWIP_SRC)\include\ipv4" /I ".\include" /I ".\\" /I "$(PLATFORMSDK_DIR)\include" /D "_LIB" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "LWIP_DEBUG" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x407 /d "_DEBUG"
|
||||
# ADD RSC /l 0x407 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
@ -80,9 +80,16 @@ LIB32=link.exe -lib
|
||||
|
||||
# Name "lwip4 - Win32 Release"
|
||||
# Name "lwip4 - Win32 Debug"
|
||||
# Begin Group "Quellcodedateien"
|
||||
# Begin Group "source"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Group "arch"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\sys_arch.c"
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "api"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\api\api_lib.c"
|
||||
@ -97,6 +104,10 @@ SOURCE="$(LWIP_SRC)\api\err.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\api\netbuf.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\api\netifapi.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -107,6 +118,13 @@ SOURCE="$(LWIP_SRC)\api\sockets.c"
|
||||
|
||||
SOURCE="$(LWIP_SRC)\api\tcpip.c"
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "core"
|
||||
# Begin Group "ipv4"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\core\ipv4\autoip.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\core\ipv4\icmp.c"
|
||||
@ -117,10 +135,6 @@ SOURCE="$(LWIP_SRC)\core\ipv4\igmp.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\core\inet.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\core\ipv4\ip.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -131,6 +145,8 @@ SOURCE="$(LWIP_SRC)\core\ipv4\ip_addr.c"
|
||||
|
||||
SOURCE="$(LWIP_SRC)\core\ipv4\ip_frag.c"
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "snmp"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\core\snmp\asn1_dec.c"
|
||||
@ -155,12 +171,21 @@ SOURCE="$(LWIP_SRC)\core\snmp\msg_in.c"
|
||||
|
||||
SOURCE="$(LWIP_SRC)\core\snmp\msg_out.c"
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\core\dhcp.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\core\inet.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\core\init.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\core\mem.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -204,9 +229,15 @@ SOURCE="$(LWIP_SRC)\core\tcp_out.c"
|
||||
SOURCE="$(LWIP_SRC)\core\udp.c"
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header-Dateien"
|
||||
# End Group
|
||||
# Begin Group "header"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Group "ipv4"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\include\ipv4\lwip\autoip.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\include\ipv4\lwip\icmp.h"
|
||||
@ -231,6 +262,7 @@ SOURCE="$(LWIP_SRC)\include\ipv4\lwip\ip_addr.h"
|
||||
|
||||
SOURCE="$(LWIP_SRC)\include\ipv4\lwip\ip_frag.h"
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\include\lwip\api.h"
|
||||
@ -261,6 +293,10 @@ SOURCE="$(LWIP_SRC)\include\lwip\err.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\include\lwip\init.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\include\lwip\mem.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -269,6 +305,14 @@ SOURCE="$(LWIP_SRC)\include\lwip\memp.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\include\lwip\memp_std.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\include\lwip\netbuf.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\include\lwip\netif.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -289,6 +333,10 @@ SOURCE="$(LWIP_SRC)\include\lwip\raw.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\include\lwip\sio.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\include\lwip\snmp.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -309,6 +357,10 @@ SOURCE="$(LWIP_SRC)\include\lwip\sockets.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\include\lwip\stats.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="$(LWIP_SRC)\include\lwip\sys.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -32,48 +32,55 @@
|
||||
#ifndef __LWIPOPTS_H__
|
||||
#define __LWIPOPTS_H__
|
||||
|
||||
#define LWIP_HAVE_LOOPIF 1
|
||||
#include "arch/cc.h"
|
||||
|
||||
#define LWIP_DBG_MIN_LEVEL 0
|
||||
#define LWIP_COMPAT_SOCKETS 1
|
||||
#define TAPIF_DEBUG LWIP_DBG_ON
|
||||
#define TUNIF_DEBUG LWIP_DBG_OFF
|
||||
#define UNIXIF_DEBUG LWIP_DBG_OFF
|
||||
#define DELIF_DEBUG LWIP_DBG_OFF
|
||||
#define SIO_FIFO_DEBUG LWIP_DBG_OFF
|
||||
#define TCPDUMP_DEBUG LWIP_DBG_ON
|
||||
#define NO_SYS 0
|
||||
#define LWIP_SOCKET 1
|
||||
|
||||
#define PPP_DEBUG LWIP_DBG_ON
|
||||
#define LWIP_HAVE_LOOPIF 1
|
||||
|
||||
#define LWIP_COMPAT_SOCKETS 1
|
||||
|
||||
#define LWIP_TCPIP_CORE_LOCKING 0
|
||||
|
||||
#define LWIP_NETIF_LINK_CALLBACK 1
|
||||
#define LWIP_NETIF_STATUS_CALLBACK 1
|
||||
|
||||
#ifdef LWIP_DEBUG
|
||||
/*#define MEM_DEBUG LWIP_DBG_ON
|
||||
#define MEMP_DEBUG LWIP_DBG_ON
|
||||
#define PBUF_DEBUG LWIP_DBG_ON
|
||||
#define API_LIB_DEBUG LWIP_DBG_ON
|
||||
#define API_MSG_DEBUG LWIP_DBG_ON */
|
||||
#define TCPIP_DEBUG LWIP_DBG_ON
|
||||
#define NETIF_DEBUG LWIP_DBG_ON
|
||||
#define SOCKETS_DEBUG LWIP_DBG_ON
|
||||
#define DEMO_DEBUG LWIP_DBG_ON
|
||||
#define IP_DEBUG LWIP_DBG_ON
|
||||
#define IP_REASS_DEBUG LWIP_DBG_ON
|
||||
#define ICMP_DEBUG LWIP_DBG_ON
|
||||
#define UDP_DEBUG LWIP_DBG_ON
|
||||
//#define TCP_DEBUG LWIP_DBG_ON
|
||||
#define TCP_INPUT_DEBUG LWIP_DBG_ON
|
||||
#define TCP_OUTPUT_DEBUG LWIP_DBG_ON
|
||||
/*#define TCP_RTO_DEBUG LWIP_DBG_ON
|
||||
#define TCP_CWND_DEBUG LWIP_DBG_ON
|
||||
#define TCP_WND_DEBUG LWIP_DBG_ON
|
||||
#define TCP_FR_DEBUG LWIP_DBG_ON
|
||||
#define TCP_QLEN_DEBUG LWIP_DBG_ON
|
||||
#define TCP_RST_DEBUG LWIP_DBG_ON*/
|
||||
|
||||
#define LWIP_DBG_MIN_LEVEL 0
|
||||
#define TAPIF_DEBUG LWIP_DBG_OFF
|
||||
#define TUNIF_DEBUG LWIP_DBG_OFF
|
||||
#define UNIXIF_DEBUG LWIP_DBG_OFF
|
||||
#define DELIF_DEBUG LWIP_DBG_OFF
|
||||
#define SIO_FIFO_DEBUG LWIP_DBG_OFF
|
||||
#define TCPDUMP_DEBUG LWIP_DBG_OFF
|
||||
#define PPP_DEBUG LWIP_DBG_OFF
|
||||
#define MEM_DEBUG LWIP_DBG_OFF
|
||||
#define MEMP_DEBUG LWIP_DBG_OFF
|
||||
#define PBUF_DEBUG LWIP_DBG_OFF
|
||||
#define API_LIB_DEBUG LWIP_DBG_OFF
|
||||
#define API_MSG_DEBUG LWIP_DBG_OFF
|
||||
#define TCPIP_DEBUG LWIP_DBG_OFF
|
||||
#define NETIF_DEBUG LWIP_DBG_OFF
|
||||
#define SOCKETS_DEBUG LWIP_DBG_OFF
|
||||
#define DEMO_DEBUG LWIP_DBG_OFF
|
||||
#define IP_DEBUG LWIP_DBG_OFF
|
||||
#define IP_REASS_DEBUG LWIP_DBG_OFF
|
||||
#define ICMP_DEBUG LWIP_DBG_OFF
|
||||
#define UDP_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_INPUT_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_RTO_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_CWND_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_WND_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_FR_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_QLEN_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_RST_DEBUG LWIP_DBG_OFF
|
||||
#endif
|
||||
|
||||
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
|
||||
|
||||
#define NO_SYS 0
|
||||
#define LWIP_PROVIDE_ERRNO
|
||||
#define LWIP_DBG_TYPES_ON (LWIP_DBG_OFF|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
|
||||
|
||||
/* ---------- Memory options ---------- */
|
||||
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
|
||||
@ -134,7 +141,7 @@ a lot of data that needs to be copied, this should be set high. */
|
||||
* for certain critical regions during buffer allocation, deallocation and memory
|
||||
* allocation and deallocation.
|
||||
*/
|
||||
#define SYS_LIGHTWEIGHT_PROT 1
|
||||
#define SYS_LIGHTWEIGHT_PROT 1
|
||||
|
||||
/* ---------- TCP options ---------- */
|
||||
#define LWIP_TCP 1
|
||||
@ -152,12 +159,12 @@ a lot of data that needs to be copied, this should be set high. */
|
||||
|
||||
/* TCP sender buffer space (pbufs). This must be at least = 2 *
|
||||
TCP_SND_BUF/TCP_MSS for things to work. */
|
||||
#define TCP_SND_QUEUELEN 4 * TCP_SND_BUF/TCP_MSS
|
||||
#define TCP_SND_QUEUELEN (4 * TCP_SND_BUF/TCP_MSS)
|
||||
|
||||
/* TCP writable space (bytes). This must be less than or equal
|
||||
to TCP_SND_BUF. It is the amount of space which must be
|
||||
available in the tcp snd_buf for select to return writable */
|
||||
#define TCP_SNDLOWAT (TCP_SND_BUF/2)
|
||||
#define TCP_SNDLOWAT (TCP_SND_BUF/2)
|
||||
|
||||
/* TCP receive window. */
|
||||
#define TCP_WND 8096
|
||||
@ -169,8 +176,8 @@ a lot of data that needs to be copied, this should be set high. */
|
||||
#define TCP_SYNMAXRTX 4
|
||||
|
||||
/* ---------- ARP options ---------- */
|
||||
#define ARP_TABLE_SIZE 10
|
||||
#define ARP_QUEUEING 1
|
||||
#define ARP_TABLE_SIZE 10
|
||||
#define ARP_QUEUEING 1
|
||||
|
||||
/* ---------- IP options ---------- */
|
||||
/* Define IP_FORWARD to 1 if you wish to have the ability to forward
|
||||
@ -181,8 +188,8 @@ a lot of data that needs to be copied, this should be set high. */
|
||||
|
||||
/* IP reassembly and segmentation.These are orthogonal even
|
||||
* if they both deal with IP fragments */
|
||||
#define IP_REASSEMBLY 1
|
||||
#define IP_FRAG 1
|
||||
#define IP_REASSEMBLY 1
|
||||
#define IP_FRAG 1
|
||||
|
||||
/* ---------- ICMP options ---------- */
|
||||
#define ICMP_TTL 255
|
||||
@ -195,10 +202,13 @@ a lot of data that needs to be copied, this should be set high. */
|
||||
|
||||
/* 1 if you want to do an ARP check on the offered address
|
||||
(recommended). */
|
||||
#if LWIP_DHCP
|
||||
#define DHCP_DOES_ARP_CHECK 1
|
||||
#endif
|
||||
|
||||
/* ---------- UDP options ---------- */
|
||||
#define LWIP_UDP 1
|
||||
#define LWIP_UDPLITE 1
|
||||
#define UDP_TTL 255
|
||||
|
||||
|
||||
|
@ -84,25 +84,25 @@ int init_adapter(int adapter_num, char* mac_addr)
|
||||
|
||||
void *AdapterList[Max_Num_Adapter];
|
||||
|
||||
int i;
|
||||
DWORD dwVersion;
|
||||
DWORD dwWindowsMajorVersion;
|
||||
int i;
|
||||
DWORD dwVersion;
|
||||
DWORD dwWindowsMajorVersion;
|
||||
|
||||
//unicode strings (winnt)
|
||||
char AdapterName[8192]; // string that contains a list of the network adapters
|
||||
char *temp,*temp1;
|
||||
//unicode strings (winnt)
|
||||
char AdapterName[8192]; // string that contains a list of the network adapters
|
||||
char *temp,*temp1;
|
||||
|
||||
//ascii strings (win95)
|
||||
char AdapterNamea[8192]; // string that contains a list of the network adapters
|
||||
char *tempa,*temp1a;
|
||||
//ascii strings (win95)
|
||||
char AdapterNamea[8192]; // string that contains a list of the network adapters
|
||||
char *tempa,*temp1a;
|
||||
|
||||
int AdapterNum=0;
|
||||
ULONG AdapterLength;
|
||||
int AdapterNum=0;
|
||||
ULONG AdapterLength;
|
||||
|
||||
PPACKET_OID_DATA ppacket_oid_data;
|
||||
|
||||
// obtain the name of the adapters installed on this machine
|
||||
AdapterLength=4096;
|
||||
// obtain the name of the adapters installed on this machine
|
||||
AdapterLength=4096;
|
||||
|
||||
memset(AdapterList,0,sizeof(AdapterList));
|
||||
memset(AdapterName,0,sizeof(AdapterName));
|
||||
@ -110,151 +110,156 @@ int init_adapter(int adapter_num, char* mac_addr)
|
||||
|
||||
i=0;
|
||||
|
||||
// the data returned by PacketGetAdapterNames is different in Win95 and in WinNT.
|
||||
// We have to check the os on which we are running
|
||||
dwVersion=GetVersion();
|
||||
dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
|
||||
if (!(dwVersion >= 0x80000000 && dwWindowsMajorVersion >= 4))
|
||||
{ // Windows NT
|
||||
if (PacketGetAdapterNames((char *)AdapterName,&AdapterLength)==FALSE){
|
||||
printf("Unable to retrieve the list of the adapters!\n");
|
||||
return -1;
|
||||
}
|
||||
temp=AdapterName;
|
||||
temp1=AdapterName;
|
||||
while ((*temp!='\0')||(*(temp-1)!='\0'))
|
||||
{
|
||||
if (*temp=='\0')
|
||||
{
|
||||
AdapterList[i] = temp1;
|
||||
temp1=temp+1;
|
||||
i++;
|
||||
}
|
||||
// the data returned by PacketGetAdapterNames is different in Win95 and in WinNT.
|
||||
// We have to check the os on which we are running
|
||||
dwVersion=GetVersion();
|
||||
dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
|
||||
if (!(dwVersion >= 0x80000000 && dwWindowsMajorVersion >= 4)) {
|
||||
// Windows NT
|
||||
if (PacketGetAdapterNames((char *)AdapterName,&AdapterLength)==FALSE){
|
||||
printf("Unable to retrieve the list of the adapters!\n");
|
||||
return -1;
|
||||
}
|
||||
temp=AdapterName;
|
||||
temp1=AdapterName;
|
||||
while ((*temp!='\0')||(*(temp-1)!='\0')) {
|
||||
if (*temp=='\0') {
|
||||
AdapterList[i] = temp1;
|
||||
temp1=temp+1;
|
||||
i++;
|
||||
}
|
||||
|
||||
temp++;
|
||||
}
|
||||
temp++;
|
||||
}
|
||||
|
||||
AdapterNum=i;
|
||||
for (i=0; i<AdapterNum; i++)
|
||||
printf("%2i: %s\n", i, AdapterList[i]);
|
||||
}
|
||||
AdapterNum=i;
|
||||
for (i=0; i<AdapterNum; i++) {
|
||||
printf("%2i: %s\n", i, AdapterList[i]);
|
||||
}
|
||||
} else {
|
||||
//windows 95
|
||||
if (PacketGetAdapterNames(AdapterNamea,&AdapterLength)==FALSE) {
|
||||
printf("Unable to retrieve the list of the adapters!\n");
|
||||
return -1;
|
||||
}
|
||||
tempa = AdapterNamea;
|
||||
temp1a = AdapterNamea;
|
||||
|
||||
else //windows 95
|
||||
{
|
||||
if (PacketGetAdapterNames(AdapterNamea,&AdapterLength)==FALSE){
|
||||
printf("Unable to retrieve the list of the adapters!\n");
|
||||
return -1;
|
||||
}
|
||||
tempa=AdapterNamea;
|
||||
temp1a=AdapterNamea;
|
||||
while ((*tempa!='\0')||(*(tempa-1)!='\0')) {
|
||||
if (*tempa=='\0') {
|
||||
AdapterList[i] = temp1a;
|
||||
temp1a=tempa+1;
|
||||
i++;
|
||||
}
|
||||
tempa++;
|
||||
}
|
||||
|
||||
while ((*tempa!='\0')||(*(tempa-1)!='\0'))
|
||||
{
|
||||
if (*tempa=='\0')
|
||||
{
|
||||
AdapterList[i] = temp1a;
|
||||
temp1a=tempa+1;
|
||||
i++;
|
||||
}
|
||||
tempa++;
|
||||
}
|
||||
AdapterNum=i;
|
||||
AdapterNum=i;
|
||||
for (i=0; i<AdapterNum; i++) {
|
||||
printf("%2i: %s", i, AdapterList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
AdapterNum=i;
|
||||
AdapterNum=i;
|
||||
for (i=0; i<AdapterNum; i++)
|
||||
printf("%2i: %s", i, AdapterList[i]);
|
||||
}
|
||||
|
||||
if (AdapterNum<=0)
|
||||
if (AdapterNum<=0) {
|
||||
return -1;
|
||||
if (adapter_num < 0)
|
||||
return -1;
|
||||
if (adapter_num >= AdapterNum)
|
||||
return -1;
|
||||
}
|
||||
if (adapter_num < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (adapter_num >= AdapterNum) {
|
||||
return -1;
|
||||
}
|
||||
ppacket_oid_data=malloc(sizeof(PACKET_OID_DATA)+6);
|
||||
lpAdapter=PacketOpenAdapter(AdapterList[adapter_num]);
|
||||
if (!lpAdapter || (lpAdapter->hFile == INVALID_HANDLE_VALUE))
|
||||
return -1;
|
||||
if (!lpAdapter || (lpAdapter->hFile == INVALID_HANDLE_VALUE)) {
|
||||
return -1;
|
||||
}
|
||||
ppacket_oid_data->Oid=OID_802_3_PERMANENT_ADDRESS;
|
||||
ppacket_oid_data->Length=6;
|
||||
if (!PacketRequest(lpAdapter,FALSE,ppacket_oid_data))
|
||||
return -1;
|
||||
if (!PacketRequest(lpAdapter,FALSE,ppacket_oid_data)) {
|
||||
return -1;
|
||||
}
|
||||
memcpy(ðaddr,ppacket_oid_data->Data,6);
|
||||
free(ppacket_oid_data);
|
||||
memcpy(mac_addr, ethaddr, 6);
|
||||
printf("MAC: %02X:%02X:%02X:%02X:%02X:%02X\n", ethaddr[0], ethaddr[1], ethaddr[2], ethaddr[3], ethaddr[4], ethaddr[5]);
|
||||
PacketSetBuff(lpAdapter,512000);
|
||||
PacketSetReadTimeout(lpAdapter,1);
|
||||
PacketSetHwFilter(lpAdapter,NDIS_PACKET_TYPE_ALL_LOCAL);
|
||||
if ((lpPacket = PacketAllocatePacket())==NULL){
|
||||
return (-1);
|
||||
}
|
||||
PacketInitPacket(lpPacket,(char*)buffer,256000);
|
||||
PacketSetBuff(lpAdapter,512000);
|
||||
PacketSetReadTimeout(lpAdapter,1);
|
||||
PacketSetHwFilter(lpAdapter,NDIS_PACKET_TYPE_ALL_LOCAL);
|
||||
if ((lpPacket = PacketAllocatePacket())==NULL) {
|
||||
return (-1);
|
||||
}
|
||||
PacketInitPacket(lpPacket,(char*)buffer,256000);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void shutdown_adapter(void)
|
||||
{
|
||||
PacketFreePacket(lpPacket);
|
||||
PacketCloseAdapter(lpAdapter);
|
||||
PacketFreePacket(lpPacket);
|
||||
PacketCloseAdapter(lpAdapter);
|
||||
}
|
||||
|
||||
int packet_send(void *buffer, int len)
|
||||
{
|
||||
LPPACKET lpPacket;
|
||||
LPPACKET lpPacket;
|
||||
|
||||
if ((lpPacket = PacketAllocatePacket())==NULL)
|
||||
return -1;
|
||||
PacketInitPacket(lpPacket,buffer,len);
|
||||
if (!PacketSendPacket(lpAdapter,lpPacket,TRUE))
|
||||
return -1;
|
||||
PacketFreePacket(lpPacket);
|
||||
if ((lpPacket = PacketAllocatePacket())==NULL) {
|
||||
return -1;
|
||||
}
|
||||
PacketInitPacket(lpPacket,buffer,len);
|
||||
if (!PacketSendPacket(lpAdapter,lpPacket,TRUE)) {
|
||||
return -1;
|
||||
}
|
||||
PacketFreePacket(lpPacket);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern void process_input(void);
|
||||
|
||||
static void ProcessPackets(LPPACKET lpPacket)
|
||||
{
|
||||
ULONG ulLines, ulBytesReceived;
|
||||
char *base;
|
||||
char *buf;
|
||||
u_int off=0;
|
||||
u_int tlen,tlen1;
|
||||
struct bpf_hdr *hdr;
|
||||
ULONG ulLines, ulBytesReceived;
|
||||
char *base;
|
||||
char *buf;
|
||||
u_int off=0;
|
||||
u_int tlen,tlen1;
|
||||
struct bpf_hdr *hdr;
|
||||
|
||||
ulBytesReceived = lpPacket->ulBytesReceived;
|
||||
ulBytesReceived = lpPacket->ulBytesReceived;
|
||||
|
||||
buf = lpPacket->Buffer;
|
||||
buf = lpPacket->Buffer;
|
||||
|
||||
off=0;
|
||||
off=0;
|
||||
|
||||
while (off<ulBytesReceived)
|
||||
{
|
||||
//if (kbhit())return;
|
||||
hdr=(struct bpf_hdr *)(buf+off);
|
||||
tlen1=hdr->bh_datalen;
|
||||
cur_length=tlen1;
|
||||
tlen=hdr->bh_caplen;
|
||||
off+=hdr->bh_hdrlen;
|
||||
while (off<ulBytesReceived) {
|
||||
//if (kbhit())return;
|
||||
hdr=(struct bpf_hdr *)(buf+off);
|
||||
tlen1=hdr->bh_datalen;
|
||||
cur_length=tlen1;
|
||||
tlen=hdr->bh_caplen;
|
||||
off+=hdr->bh_hdrlen;
|
||||
|
||||
ulLines = (tlen + 15) / 16;
|
||||
if (ulLines > 5) ulLines=5;
|
||||
ulLines = (tlen + 15) / 16;
|
||||
if (ulLines > 5) {
|
||||
ulLines=5;
|
||||
}
|
||||
|
||||
base =(char*)(buf+off);
|
||||
cur_packet=base;
|
||||
off=Packet_WORDALIGN(off+tlen);
|
||||
base =(char*)(buf + off);
|
||||
cur_packet = base;
|
||||
off = Packet_WORDALIGN(off + tlen);
|
||||
|
||||
process_input();
|
||||
}
|
||||
process_input();
|
||||
}
|
||||
}
|
||||
|
||||
void update_adapter(void)
|
||||
{
|
||||
if (PacketReceivePacket(lpAdapter,lpPacket,TRUE)==TRUE)
|
||||
if (PacketReceivePacket(lpAdapter,lpPacket,TRUE)==TRUE) {
|
||||
ProcessPackets(lpPacket);
|
||||
}
|
||||
cur_length=0;
|
||||
cur_packet=NULL;
|
||||
}
|
||||
|
@ -78,12 +78,16 @@
|
||||
|
||||
#include "netif/etharp.h"
|
||||
|
||||
#undef NETIF_DEBUG
|
||||
#undef NETIF_DEBUG
|
||||
#define NETIF_DEBUG 0
|
||||
|
||||
/* Define those to better describe your network interface. */
|
||||
#define IFNAME0 'p'
|
||||
#define IFNAME1 'k'
|
||||
|
||||
/* index of the network adapter to use for lwIP */
|
||||
#define PACKET_LIB_ADAPTER_NR 1
|
||||
|
||||
static struct eth_addr broadcastaddr = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
|
||||
/* Forward declarations. */
|
||||
@ -94,18 +98,28 @@ static struct netif *pktif_netif;
|
||||
extern unsigned char ethaddr[6];
|
||||
extern unsigned char *cur_packet;
|
||||
extern int cur_length;
|
||||
extern int init_adapter(int adapter_num, char* mac_addr);
|
||||
extern int packet_send(void *buffer, int len);
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
low_level_init(struct netif *netif)
|
||||
{
|
||||
#ifdef NETIF_DEBUG
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("pktif: eth_addr %02X%02X%02X%02X%02X%02X\n",netif->hwaddr[0],netif->hwaddr[1],netif->hwaddr[2],netif->hwaddr[3],netif->hwaddr[4],netif->hwaddr[5]));
|
||||
#endif /* NETIF_DEBUG */
|
||||
/* Do whatever else is needed to initialize interface. */
|
||||
char mac_addr[6];
|
||||
|
||||
pktif_netif=netif;
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("pktif: eth_addr %02X%02X%02X%02X%02X%02X\n",netif->hwaddr[0],netif->hwaddr[1],netif->hwaddr[2],netif->hwaddr[3],netif->hwaddr[4],netif->hwaddr[5]));
|
||||
|
||||
/* Do whatever else is needed to initialize interface. */
|
||||
if (init_adapter(PACKET_LIB_ADAPTER_NR, mac_addr) != 0) {
|
||||
printf("ERROR initializing network adapter %d!\n", PACKET_LIB_ADAPTER_NR);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Prepare MAC addr: increase the last octet so that lwIP netif has a similar but different MAC addr */
|
||||
memcpy(&netif->hwaddr, mac_addr, 6);
|
||||
netif->hwaddr[5]++;
|
||||
|
||||
pktif_netif=netif;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
@ -123,28 +137,27 @@ low_level_output(struct netif *ethernetif, struct pbuf *p)
|
||||
{
|
||||
struct pbuf *q;
|
||||
unsigned char buffer[1600];
|
||||
unsigned char *ptr;
|
||||
unsigned char *ptr;
|
||||
|
||||
/* initiate transfer(); */
|
||||
if (p->tot_len>=1600)
|
||||
return ERR_BUF;
|
||||
ptr=buffer;
|
||||
if (p->tot_len >= sizeof(buffer)) {
|
||||
return ERR_BUF;
|
||||
}
|
||||
ptr = buffer;
|
||||
for(q = p; q != NULL; q = q->next) {
|
||||
/* Send the data from the pbuf to the interface, one pbuf at a
|
||||
time. The size of the data in each pbuf is kept in the ->len
|
||||
variable. */
|
||||
/* send data from(q->payload, q->len); */
|
||||
#ifdef NETIF_DEBUG
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("netif: send ptr %p q->payload %p q->len %i q->next %p\n", ptr, q->payload, (int)q->len, q->next));
|
||||
#endif
|
||||
memcpy(ptr,q->payload,q->len);
|
||||
ptr+=q->len;
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("netif: send ptr %p q->payload %p q->len %i q->next %p\n", ptr, q->payload, (int)q->len, q->next));
|
||||
memcpy(ptr, q->payload, q->len);
|
||||
ptr += q->len;
|
||||
}
|
||||
|
||||
/* signal that packet should be sent(); */
|
||||
|
||||
if (packet_send(buffer, p->tot_len) < 0)
|
||||
return ERR_BUF;
|
||||
if (packet_send(buffer, p->tot_len) < 0) {
|
||||
return ERR_BUF;
|
||||
}
|
||||
|
||||
#ifdef LINK_STATS
|
||||
lwip_stats.link.xmit++;
|
||||
@ -167,15 +180,15 @@ low_level_input(struct netif *netif)
|
||||
int start, length;
|
||||
struct eth_hdr *ethhdr;
|
||||
|
||||
/* Obtain the size of the packet and put it into the "len"
|
||||
variable. */
|
||||
/* Obtain the size of the packet and put it into the "len" variable. */
|
||||
length = cur_length;
|
||||
if (length<=0)
|
||||
return NULL;
|
||||
if (length<=0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ethhdr = (struct eth_hdr*)cur_packet;
|
||||
/* MAC filter: only let my MAC or broadcast through */
|
||||
if((memcmp(ðhdr->dest, &netif->hwaddr, 6)) && (memcmp(ðhdr->dest, &broadcastaddr, 6))) {
|
||||
if ((memcmp(ðhdr->dest, &netif->hwaddr, 6)) && (memcmp(ðhdr->dest, &broadcastaddr, 6))) {
|
||||
/* acknowledge that packet has been read(); */
|
||||
cur_length=0;
|
||||
return NULL;
|
||||
@ -183,36 +196,33 @@ low_level_input(struct netif *netif)
|
||||
|
||||
/* We allocate a pbuf chain of pbufs from the pool. */
|
||||
p = pbuf_alloc(PBUF_LINK, (u16_t)length, PBUF_POOL);
|
||||
#ifdef NETIF_DEBUG
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("netif: recv length %i p->tot_len %i\n", length, (int)p->tot_len));
|
||||
#endif
|
||||
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("netif: recv length %i p->tot_len %i\n", length, (int)p->tot_len));
|
||||
|
||||
if (p != NULL) {
|
||||
/* We iterate over the pbuf chain until we have read the entire
|
||||
packet into the pbuf. */
|
||||
start=0;
|
||||
for(q = p; q != NULL; q = q->next) {
|
||||
start=0;
|
||||
for (q = p; q != NULL; q = q->next) {
|
||||
/* Read enough bytes to fill this pbuf in the chain. The
|
||||
available data in the pbuf is given by the q->len
|
||||
variable. */
|
||||
/* read data into(q->payload, q->len); */
|
||||
#ifdef NETIF_DEBUG
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("netif: recv start %i length %i q->payload %p q->len %i q->next %p\n", start, length, q->payload, (int)q->len, q->next));
|
||||
#endif
|
||||
memcpy(q->payload,&cur_packet[start],q->len);
|
||||
start+=q->len;
|
||||
length-=q->len;
|
||||
if (length<=0)
|
||||
break;
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("netif: recv start %i length %i q->payload %p q->len %i q->next %p\n", start, length, q->payload, (int)q->len, q->next));
|
||||
memcpy(q->payload, &cur_packet[start], q->len);
|
||||
start += q->len;
|
||||
length -= q->len;
|
||||
if (length<=0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* acknowledge that packet has been read(); */
|
||||
cur_length=0;
|
||||
cur_length = 0;
|
||||
#ifdef LINK_STATS
|
||||
lwip_stats.link.recv++;
|
||||
#endif /* LINK_STATS */
|
||||
} else {
|
||||
/* drop packet(); */
|
||||
cur_length=0;
|
||||
cur_length = 0;
|
||||
#ifdef LINK_STATS
|
||||
lwip_stats.link.memerr++;
|
||||
lwip_stats.link.drop++;
|
||||
@ -240,40 +250,38 @@ ethernetif_input(struct netif *netif)
|
||||
struct eth_hdr *ethhdr;
|
||||
struct pbuf *p;
|
||||
|
||||
|
||||
ethernetif = netif->state;
|
||||
|
||||
/* move received packet into a new pbuf */
|
||||
p = low_level_input(netif);
|
||||
/* no packet could be read, silently ignore this */
|
||||
if (p == NULL) {
|
||||
return;
|
||||
}
|
||||
/* points to packet payload, which starts with an Ethernet header */
|
||||
ethhdr = p->payload;
|
||||
|
||||
if (p != NULL) {
|
||||
|
||||
#if LINK_STATS
|
||||
lwip_stats.link.recv++;
|
||||
#endif /* LINK_STATS */
|
||||
|
||||
ethhdr = p->payload;
|
||||
|
||||
switch (htons(ethhdr->type)) {
|
||||
#if ETHARP_TCPIP_INPUT
|
||||
/* IP or ARP packet? */
|
||||
case ETHTYPE_IP:
|
||||
case ETHTYPE_ARP:
|
||||
netif->input(p, netif);
|
||||
break;
|
||||
#else
|
||||
case ETHTYPE_IP:
|
||||
etharp_ip_input(netif, p);
|
||||
pbuf_header(p, -14);
|
||||
netif->input(p, netif);
|
||||
break;
|
||||
case ETHTYPE_ARP:
|
||||
etharp_arp_input(netif, ethernetif->ethaddr, p);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
switch (htons(ethhdr->type)) {
|
||||
/* IP or ARP packet? */
|
||||
case ETHTYPE_IP:
|
||||
case ETHTYPE_ARP:
|
||||
#if PPPOE_SUPPORT
|
||||
/* PPPoE packet? */
|
||||
case ETHTYPE_PPPOEDISC:
|
||||
case ETHTYPE_PPPOE:
|
||||
#endif /* PPPOE_SUPPORT */
|
||||
/* full packet send to tcpip_thread to process */
|
||||
if (netif->input(p, netif)!=ERR_OK) {
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: IP input error\n"));
|
||||
pbuf_free(p);
|
||||
break;
|
||||
p = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
pbuf_free(p);
|
||||
p = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
@ -295,7 +303,7 @@ ethernetif_init(struct netif *netif)
|
||||
netif->output = etharp_output;
|
||||
|
||||
netif->mtu = 1500;
|
||||
netif->flags = NETIF_FLAG_BROADCAST;
|
||||
netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP;;
|
||||
netif->hwaddr_len = 6;
|
||||
|
||||
NETIF_INIT_SNMP(netif, 6, 100000000);
|
||||
@ -316,5 +324,3 @@ void process_input(void)
|
||||
{
|
||||
ethernetif_input(pktif_netif);
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ RSC=rc.exe
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "$(LWIP_SRC)\include" /I "$(LWIP_SRC)\include\ipv4" /I ".\include" /I ".\\" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "$(LWIP_SRC)\include" /I "$(LWIP_SRC)\include\ipv4" /I ".\include" /I ".\\" /I "$(PLATFORMSDK_DIR)\include" /I "$(PCAP_DIR)\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x407 /d "NDEBUG"
|
||||
# ADD RSC /l 0x407 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
@ -64,7 +64,7 @@ LIB32=link.exe -lib
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "$(LWIP_SRC)\include" /I "$(LWIP_SRC)\include\ipv4" /I ".\include" /I ".\\" /D "_LIB" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "LWIP_DEBUG" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "$(LWIP_SRC)\include" /I "$(LWIP_SRC)\include\ipv4" /I ".\include" /I ".\\" /I "$(PLATFORMSDK_DIR)\include" /I "$(PCAP_DIR)\include" /D "_LIB" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "LWIP_DEBUG" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x407 /d "_DEBUG"
|
||||
# ADD RSC /l 0x407 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
@ -10,6 +10,15 @@ Win32/MSVC.
|
||||
To get this compiling, you have to set the LWIP_SRC environment variable to
|
||||
point to the src subdirectory in the main lwip tree.
|
||||
|
||||
>>>NEW>>>
|
||||
|
||||
Note that you also have to set the PCAP_DIR environment variable to point
|
||||
to the WinPcap Developer's Packs (containing 'include' and 'lib'), as well
|
||||
as the PLATFORMSDK_DIR environment variable to point to Microsoft's Platform
|
||||
SDK (or any other place containing 'include/windows.h').
|
||||
|
||||
<<<NEW<<<
|
||||
|
||||
Due to the nature of the lwip library you have to copy this whole project
|
||||
into a new subdir in proj and modify lwipopts.h to your needs. If you move
|
||||
it to another directory besides proj, you have to update the include paths
|
||||
|
@ -149,7 +149,7 @@ void main_loop()
|
||||
#if NO_SYS
|
||||
netif_set_default(netif_add(&netif, &ipaddr, &netmask, &gw, NULL, ethernetif_init, ip_input));
|
||||
#else /* NO_SYS */
|
||||
netif_set_default(netif_add(&netif, &ipaddr, &netmask, &gw, NULL, ethernetif_init, tcpip_ethinput));
|
||||
netif_set_default(netif_add(&netif, &ipaddr, &netmask, &gw, NULL, ethernetif_init, tcpip_input));
|
||||
#endif /* NO_SYS */
|
||||
netif_set_up(&netif);
|
||||
|
||||
@ -160,7 +160,7 @@ void main_loop()
|
||||
#if NO_SYS
|
||||
netif_add(&loop_netif, &loop_ipaddr, &loop_netmask, &loop_gw, NULL, loopif_init, ip_input);
|
||||
#else /* NO_SYS */
|
||||
netif_add(&loop_netif, &loop_ipaddr, &loop_netmask, &loop_gw, NULL, loopif_init, tcpip_ethinput);
|
||||
netif_add(&loop_netif, &loop_ipaddr, &loop_netmask, &loop_gw, NULL, loopif_init, tcpip_input);
|
||||
#endif /* NO_SYS */
|
||||
netif_set_up(&loop_netif);
|
||||
#endif
|
||||
|
@ -49,8 +49,8 @@ BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib Packet.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib $(PCAP_DIR)\lib\Packet.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "test - Win32 Debug"
|
||||
|
||||
@ -73,8 +73,8 @@ BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib Packet.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib $(PCAP_DIR)\lib\Packet.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user