Removed lwIP source from project. Replaced with submodule and patch
This commit is contained in:
@@ -1 +0,0 @@
|
||||
The ext/ folder contains third party code, drivers, installation support files, etc.
|
||||
25
ext/lwip-contrib/.gitignore
vendored
25
ext/lwip-contrib/.gitignore
vendored
@@ -1,25 +0,0 @@
|
||||
*.o
|
||||
*.so
|
||||
*.a
|
||||
.depend
|
||||
/ports/unix/unixsim/simhost
|
||||
/ports/unix/unixsim/simrouter
|
||||
/ports/unix/unixsim/simnode
|
||||
/ports/unix/unixsim/makefsdata
|
||||
/ports/unix/minimal/echop
|
||||
/ports/win32/msvc/Debug
|
||||
/ports/win32/lwipcfg_msvc.h
|
||||
/ports/win32/msvc/Debug unittests
|
||||
/ports/win32/msvc/Release
|
||||
/ports/win32/msvc/Release unittests
|
||||
/ports/win32/msvc/*.user
|
||||
/ports/win32/msvc/*.ncb
|
||||
/ports/win32/msvc/*.cache
|
||||
/ports/win32/msvc/*.suo
|
||||
/ports/win32/msvc/ipch
|
||||
/ports/win32/msvc/*.opensdf
|
||||
/ports/win32/msvc/*.sdf
|
||||
/ports/unix/check/lwip_unittests
|
||||
/ports/win32/mingw/*.exe
|
||||
/ports/win32/mingw/*.map
|
||||
/ports/win32/mingw/cov-int
|
||||
@@ -1,47 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2001, 2002 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>
|
||||
#
|
||||
|
||||
# CONTRIBAPPFILES: Contrib Applications.
|
||||
CONTRIBAPPFILES=$(CONTRIBDIR)/apps/httpserver/httpserver-netconn.c \
|
||||
$(CONTRIBDIR)/apps/chargen/chargen.c \
|
||||
$(CONTRIBDIR)/apps/udpecho/udpecho.c \
|
||||
$(CONTRIBDIR)/apps/tcpecho/tcpecho.c \
|
||||
$(CONTRIBDIR)/apps/shell/shell.c \
|
||||
$(CONTRIBDIR)/apps/udpecho_raw/udpecho_raw.c \
|
||||
$(CONTRIBDIR)/apps/tcpecho_raw/tcpecho_raw.c \
|
||||
$(CONTRIBDIR)/apps/netio/netio.c \
|
||||
$(CONTRIBDIR)/apps/ping/ping.c \
|
||||
$(CONTRIBDIR)/apps/snmp_private_mib/lwip_prvmib.c \
|
||||
$(CONTRIBDIR)/apps/snmp_v3/snmpv3_dummy.c \
|
||||
$(CONTRIBDIR)/apps/socket_examples/socket_examples.c \
|
||||
$(CONTRIBDIR)/apps/rtp/rtp.c \
|
||||
$(CONTRIBDIR)/addons/tcp_isn/tcp_isn.c \
|
||||
$(CONTRIBDIR)/addons/ipv6_static_routing/ip6_route_table.c
|
||||
@@ -1,94 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2001, 2002 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>
|
||||
#
|
||||
|
||||
#CC=gcc
|
||||
#CC=clang
|
||||
CCDEP?=$(CC)
|
||||
|
||||
CFLAGS+=-g -Wall -DLWIP_DEBUG -pedantic -Werror \
|
||||
-Wparentheses -Wsequence-point -Wswitch-default \
|
||||
-Wextra -Wundef -Wshadow -Wpointer-arith -Wcast-qual \
|
||||
-Wc++-compat -Wwrite-strings -Wold-style-definition -Wcast-align \
|
||||
-Wmissing-prototypes -Wredundant-decls -Wnested-externs \
|
||||
-Wunreachable-code -Wuninitialized
|
||||
|
||||
ifeq (,$(findstring clang,$(CC)))
|
||||
CFLAGS+= -Wlogical-op
|
||||
# if GCC is newer than 4.8/4.9 you may use:
|
||||
#CFLAGS:=$(CFLAGS) -fsanitize=address -fstack-protector -fstack-check -fsanitize=undefined -fno-sanitize=alignment
|
||||
else
|
||||
# we cannot sanitize alignment on x86-64 targets because clang wants 64 bit alignment
|
||||
CFLAGS+= -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -Wdocumentation -Wno-documentation-deprecated-sync
|
||||
endif
|
||||
|
||||
# not used for now but interesting:
|
||||
# -Wpacked
|
||||
# -ansi
|
||||
# -std=c89
|
||||
|
||||
CONTRIBDIR?=../../..
|
||||
ARFLAGS?=rs
|
||||
|
||||
#Set this to where you have the lwip core module checked out from git
|
||||
#default assumes it's a dir named lwip at the same level as the contrib module
|
||||
LWIPDIR?=$(CONTRIBDIR)/../lwip/src
|
||||
|
||||
CFLAGS+=-I. \
|
||||
-I$(CONTRIBDIR) \
|
||||
-I$(LWIPDIR)/include \
|
||||
-I$(LWIPARCH)/include
|
||||
|
||||
# Add include path and link to mbedTLS lib if available
|
||||
MBEDTLSDIR?=$(CONTRIBDIR)/../mbedtls
|
||||
ifneq (,$(wildcard $(MBEDTLSDIR)/include/mbedtls/*.h))
|
||||
LDFLAGS+=-L$(MBEDTLSDIR)/library -lmbedtls -lmbedcrypto -lmbedx509
|
||||
CFLAGS+=-I$(MBEDTLSDIR)/include -Wno-redundant-decls -DLWIP_HAVE_MBEDTLS=1
|
||||
endif
|
||||
|
||||
include $(CONTRIBDIR)/Filelists.mk
|
||||
include $(LWIPDIR)/Filelists.mk
|
||||
|
||||
# LWIPFILES: All the above.
|
||||
LWIPFILES=$(LWIPNOAPPSFILES) $(ARCHFILES)
|
||||
LWIPOBJS=$(notdir $(LWIPFILES:.c=.o))
|
||||
|
||||
LWIPLIBCOMMON=liblwipcommon.a
|
||||
$(LWIPLIBCOMMON): $(LWIPOBJS)
|
||||
$(AR) $(ARFLAGS) $(LWIPLIBCOMMON) $?
|
||||
|
||||
APPFILES=$(CONTRIBAPPFILES) $(LWIPAPPFILES)
|
||||
APPLIB=liblwipapps.a
|
||||
APPOBJS=$(notdir $(APPFILES:.c=.o))
|
||||
$(APPLIB): $(APPOBJS)
|
||||
$(AR) $(ARFLAGS) $(APPLIB) $?
|
||||
|
||||
%.o:
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
@@ -1,8 +0,0 @@
|
||||
unix/ - Architectural files for testing on unix-like systems
|
||||
(assuming gcc and pthreads).
|
||||
- Maintained by Kieran Mansley <kieran@recoil.org>
|
||||
|
||||
msvc6/ - Architectural files for Microsoft Visual C++ 6.0.
|
||||
- Maintained by Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com>
|
||||
|
||||
old/ - Ports that are no longer actively maintained
|
||||
@@ -1,42 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2001, 2002 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>
|
||||
#
|
||||
|
||||
# Architecture specific files.
|
||||
LWIPARCH?=$(CONTRIBDIR)/ports/unix/port
|
||||
SYSARCH?=$(LWIPARCH)/sys_arch.c
|
||||
ARCHFILES=$(LWIPARCH)/perf.c $(SYSARCH) $(LWIPARCH)/netif/tapif.c $(LWIPARCH)/netif/tunif.c \
|
||||
$(LWIPARCH)/netif/unixif.c $(LWIPARCH)/netif/list.c $(LWIPARCH)/netif/tcpdump.c \
|
||||
$(LWIPARCH)/netif/delif.c $(LWIPARCH)/netif/sio.c $(LWIPARCH)/netif/fifo.c
|
||||
|
||||
UNIX_COMMON_MK_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||
include $(UNIX_COMMON_MK_DIR)../Common.allports.mk
|
||||
|
||||
LDFLAGS+=-pthread -lutil -lrt
|
||||
@@ -1,52 +0,0 @@
|
||||
This port contains infrastructure and examples for running lwIP on Unix-like
|
||||
operating systems (Linux, OpenBSD, cygwin). Much of this is targetted towards
|
||||
testing lwIP applications.
|
||||
|
||||
* port/sys_arch.c, port/perf.c, port/include/arch/: Generic platform porting,
|
||||
for both states of NO_SYS. (Mapping debugging to printf, providing
|
||||
sys_now & co from the system time etc.)
|
||||
|
||||
* check: Runs the unit tests shipped with main lwIP on the Unix port.
|
||||
|
||||
* fuzz: Helper application for fuzzing the lwIP stack
|
||||
|
||||
* port/netif, port/include/netif: Various network interface implementations and
|
||||
their helpers, some explicitly for Unix infrastructure, some generic (but most
|
||||
useful on an easy to debug system):
|
||||
|
||||
* delif: Network interface that inserts delay before receiving or sending
|
||||
packages
|
||||
|
||||
* fifo: Helper for sio
|
||||
|
||||
* list: Helper for unixif
|
||||
|
||||
* pcapif: Network interface that replays packages from a PCAP dump file, and
|
||||
discards packages sent out from it
|
||||
|
||||
* sio: Mapping Unix character devices to lwIP's sio mechanisms
|
||||
|
||||
* tapif: Network interface that is mapped to a tap interface (Unix user
|
||||
space layer 2 network device). Uses lwIP threads.
|
||||
|
||||
* tcpdump: Utility functions to dump pbufs into a tcpdump formatted log
|
||||
file
|
||||
|
||||
* tunif: Network interface that is mapped to a tun interface (Unix user
|
||||
space layer 3 network device). Uses lwIP threads.
|
||||
|
||||
* unixif: Network interface that allows lwIP Unix programs to "meet" at Unix
|
||||
socket address and exchange traffic over it.
|
||||
|
||||
* lib: Compiling lwIP as a shared library
|
||||
|
||||
* minimal: Standalone example program that runs in NO_SYS=1 mode.
|
||||
Contains the mintapif network interface implementation, which is similar to
|
||||
netif/tapif, but runs without threads.
|
||||
|
||||
Runs an echo server and SNMP.
|
||||
|
||||
* unixsim: Standalone example program that runs in NO_SYS=0 mode. Uses
|
||||
the tapif network interface.
|
||||
|
||||
Runs an HTTP server.
|
||||
@@ -1,62 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2001, 2002 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>
|
||||
#
|
||||
|
||||
all compile: lwip_unittests
|
||||
.PHONY: all clean check
|
||||
|
||||
# The include path to sys_arch.h and lwipopts.h must be first, so this must be before Common.mk
|
||||
CFLAGS=-DLWIP_NOASSERT_ON_ERROR -I/usr/include/check -I$(LWIPDIR)/../test/unit
|
||||
|
||||
# Prevent compiling sys_arch.c of unix port because unit test provide their own port
|
||||
SYSARCH?=
|
||||
include ../Common.mk
|
||||
|
||||
LDFLAGS:=-lcheck -lm -lsubunit $(LDFLAGS)
|
||||
|
||||
TESTDIR=$(LWIPDIR)/../test/unit
|
||||
include $(TESTDIR)/Filelists.mk
|
||||
TESTOBJS=$(notdir $(TESTFILES:.c=.o))
|
||||
|
||||
clean:
|
||||
@rm -f *.o $(LWIPLIBCOMMON) $(APPLIB) lwip_unittests *.s .depend* *.core core
|
||||
|
||||
depend dep: .depend
|
||||
|
||||
include .depend
|
||||
|
||||
.depend: $(LWIPFILES) $(APPFILES) $(TESTFILES)
|
||||
$(CCDEP) $(CFLAGS) -MM $^ > .depend || rm -f .depend
|
||||
|
||||
lwip_unittests: .depend $(TESTOBJS) $(LWIPLIBCOMMON) $(APPLIB)
|
||||
$(CC) $(CFLAGS) -o lwip_unittests $(TESTOBJS) -Wl,--start-group $(LWIPLIBCOMMON) $(APPLIB) $(LDFLAGS) -Wl,--end-group
|
||||
|
||||
check: lwip_unittests
|
||||
@./lwip_unittests
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
Helper files to run lwIP unit tests on unix-like systems.
|
||||
|
||||
1. Install the check library, through a package manager or from http://check.sourceforge.net/
|
||||
2. Put the lwip code in a directory called 'lwip' in the same directory as lwip-contrib is
|
||||
3. Run `make check`
|
||||
4. Make sure all tests pass
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
/* Enable this to simplify debugging */
|
||||
/* #define LWIP_UNITTESTS_NOFORK */
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_ARCH_CC_H
|
||||
#define LWIP_ARCH_CC_H
|
||||
|
||||
/* see https://sourceforge.net/p/predef/wiki/OperatingSystems/ */
|
||||
#if defined __ANDROID__
|
||||
#define LWIP_UNIX_ANDROID
|
||||
#elif defined __linux__
|
||||
#define LWIP_UNIX_LINUX
|
||||
#elif defined __APPLE__
|
||||
#define LWIP_UNIX_MACH
|
||||
#elif defined __OpenBSD__
|
||||
#define LWIP_UNIX_OPENBSD
|
||||
#elif defined __CYGWIN__
|
||||
#define LWIP_UNIX_CYGWIN
|
||||
#endif
|
||||
|
||||
#define LWIP_TIMEVAL_PRIVATE 0
|
||||
#include <sys/time.h>
|
||||
|
||||
#define LWIP_ERRNO_INCLUDE <errno.h>
|
||||
|
||||
#define LWIP_RAND() ((u32_t)rand())
|
||||
|
||||
#define LWIP_NOASSERT 1
|
||||
|
||||
/* different handling for unit test, normally not needed */
|
||||
#ifdef LWIP_NOASSERT_ON_ERROR
|
||||
#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
|
||||
handler;}} while(0)
|
||||
#endif
|
||||
|
||||
#if defined(LWIP_UNIX_ANDROID) && defined(FD_SET)
|
||||
typedef __kernel_fd_set fd_set;
|
||||
#endif
|
||||
|
||||
struct sio_status_s;
|
||||
typedef struct sio_status_s sio_status_t;
|
||||
#define sio_fd_t sio_status_t*
|
||||
#define __sio_fd_t_defined
|
||||
|
||||
#endif /* LWIP_ARCH_CC_H */
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_ARCH_PERF_H
|
||||
#define LWIP_ARCH_PERF_H
|
||||
|
||||
#include <sys/times.h>
|
||||
|
||||
#ifdef PERF
|
||||
#define PERF_START { \
|
||||
unsigned long __c1l, __c1h, __c2l, __c2h; \
|
||||
__asm__(".byte 0x0f, 0x31" : "=a" (__c1l), "=d" (__c1h))
|
||||
#define PERF_STOP(x) __asm__(".byte 0x0f, 0x31" : "=a" (__c2l), "=d" (__c2h)); \
|
||||
perf_print(__c1l, __c1h, __c2l, __c2h, x);}
|
||||
|
||||
/*#define PERF_START do { \
|
||||
struct tms __perf_start, __perf_end; \
|
||||
times(&__perf_start)
|
||||
#define PERF_STOP(x) times(&__perf_end); \
|
||||
perf_print_times(&__perf_start, &__perf_end, x);\
|
||||
} while(0)*/
|
||||
#else /* PERF */
|
||||
#define PERF_START /* null definition */
|
||||
#define PERF_STOP(x) /* null definition */
|
||||
#endif /* PERF */
|
||||
|
||||
void perf_print(unsigned long c1l, unsigned long c1h,
|
||||
unsigned long c2l, unsigned long c2h,
|
||||
char *key);
|
||||
|
||||
void perf_print_times(struct tms *start, struct tms *end, char *key);
|
||||
|
||||
void perf_init(char *fname);
|
||||
|
||||
#endif /* LWIP_ARCH_PERF_H */
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_ARCH_SYS_ARCH_H
|
||||
#define LWIP_ARCH_SYS_ARCH_H
|
||||
|
||||
#define SYS_MBOX_NULL NULL
|
||||
#define SYS_SEM_NULL NULL
|
||||
|
||||
typedef u32_t sys_prot_t;
|
||||
|
||||
struct sys_sem;
|
||||
typedef struct sys_sem * sys_sem_t;
|
||||
#define sys_sem_valid(sem) (((sem) != NULL) && (*(sem) != NULL))
|
||||
#define sys_sem_valid_val(sem) ((sem) != NULL)
|
||||
#define sys_sem_set_invalid(sem) do { if((sem) != NULL) { *(sem) = NULL; }}while(0)
|
||||
#define sys_sem_set_invalid_val(sem) do { (sem) = NULL; }while(0)
|
||||
|
||||
struct sys_mutex;
|
||||
typedef struct sys_mutex * sys_mutex_t;
|
||||
#define sys_mutex_valid(mutex) sys_sem_valid(mutex)
|
||||
#define sys_mutex_set_invalid(mutex) sys_sem_set_invalid(mutex)
|
||||
|
||||
struct sys_mbox;
|
||||
typedef struct sys_mbox * sys_mbox_t;
|
||||
#define sys_mbox_valid(mbox) sys_sem_valid(mbox)
|
||||
#define sys_mbox_valid_val(mbox) sys_sem_valid_val(mbox)
|
||||
#define sys_mbox_set_invalid(mbox) sys_sem_set_invalid(mbox)
|
||||
#define sys_mbox_set_invalid_val(mbox) sys_sem_set_invalid_val(mbox)
|
||||
|
||||
struct sys_thread;
|
||||
typedef struct sys_thread * sys_thread_t;
|
||||
|
||||
#endif /* LWIP_ARCH_SYS_ARCH_H */
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2001, 2002 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>
|
||||
#
|
||||
|
||||
UNIXLIB=liblwip.a
|
||||
|
||||
all: $(UNIXLIB)
|
||||
.PHONY: all
|
||||
|
||||
include ../Common.mk
|
||||
|
||||
CFLAGS+=-fPIC
|
||||
|
||||
clean:
|
||||
rm -f *.o $(LWIPLIBCOMMON) *.s .depend* *.core core
|
||||
|
||||
depend dep: .depend
|
||||
|
||||
include .depend
|
||||
|
||||
$(UNIXLIB): $(LWIPLIBCOMMON) unixlib.o
|
||||
$(CC) -g -nostartfiles -shared -o $@ $^
|
||||
|
||||
.depend: unixlib.c $(LWIPFILES)
|
||||
$(CCDEP) $(CFLAGS) -MM $^ > .depend || rm -f .depend
|
||||
@@ -1,31 +0,0 @@
|
||||
This directory contains an example of how to compile lwIP as a self
|
||||
initialising shared library on Linux.
|
||||
|
||||
Some brief instructions:
|
||||
|
||||
* Compile the code:
|
||||
|
||||
> make clean all
|
||||
|
||||
This should produce liblwip4unixlib.so. This is the shared library.
|
||||
|
||||
* Link an application against the shared library
|
||||
|
||||
If you're using gcc you can do this by including -llwip4unixlib in
|
||||
your link command.
|
||||
|
||||
* Run your application
|
||||
|
||||
Ensure that LD_LIBRARY_PATH includes the directory that contains
|
||||
liblwip4unixlib.so (ie. this directory)
|
||||
|
||||
|
||||
|
||||
If you are unsure about shared libraries and libraries on linux in
|
||||
general, you might find this HOWTO useful:
|
||||
|
||||
<http://www.tldp.org/HOWTO/Program-Library-HOWTO/>
|
||||
|
||||
|
||||
|
||||
Kieran Mansley, October 2002.
|
||||
@@ -1,419 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* lwIP Options Configuration
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-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. 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 LWIP_LWIPOPTS_H
|
||||
#define LWIP_LWIPOPTS_H
|
||||
|
||||
/*
|
||||
* Include user defined options first. Anything not defined in these files
|
||||
* will be set to standard values. Override anything you dont like!
|
||||
*/
|
||||
#include "lwipopts.h"
|
||||
#include "lwip/debug.h"
|
||||
|
||||
/*
|
||||
-----------------------------------------------
|
||||
---------- Platform specific locking ----------
|
||||
-----------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
|
||||
* critical regions during buffer allocation, deallocation and memory
|
||||
* allocation and deallocation.
|
||||
*/
|
||||
#define SYS_LIGHTWEIGHT_PROT 0
|
||||
|
||||
/**
|
||||
* NO_SYS==1: Provides VERY minimal functionality. Otherwise,
|
||||
* use lwIP facilities.
|
||||
*/
|
||||
#define NO_SYS 0
|
||||
|
||||
/*
|
||||
------------------------------------
|
||||
---------- Memory options ----------
|
||||
------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* MEM_ALIGNMENT: should be set to the alignment of the CPU
|
||||
* 4 byte alignment -> #define MEM_ALIGNMENT 4
|
||||
* 2 byte alignment -> #define MEM_ALIGNMENT 2
|
||||
*/
|
||||
#define MEM_ALIGNMENT 1U
|
||||
|
||||
/**
|
||||
* MEM_SIZE: the size of the heap memory. If the application will send
|
||||
* a lot of data that needs to be copied, this should be set high.
|
||||
*/
|
||||
#define MEM_SIZE 1600
|
||||
|
||||
/*
|
||||
------------------------------------------------
|
||||
---------- Internal Memory Pool Sizes ----------
|
||||
------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF).
|
||||
* If the application sends a lot of data out of ROM (or other static memory),
|
||||
* this should be set high.
|
||||
*/
|
||||
#define MEMP_NUM_PBUF 16
|
||||
|
||||
/**
|
||||
* MEMP_NUM_RAW_PCB: Number of raw connection PCBs
|
||||
* (requires the LWIP_RAW option)
|
||||
*/
|
||||
#define MEMP_NUM_RAW_PCB 4
|
||||
|
||||
/**
|
||||
* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
|
||||
* per active UDP "connection".
|
||||
* (requires the LWIP_UDP option)
|
||||
*/
|
||||
#define MEMP_NUM_UDP_PCB 4
|
||||
|
||||
/**
|
||||
* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections.
|
||||
* (requires the LWIP_TCP option)
|
||||
*/
|
||||
#define MEMP_NUM_TCP_PCB 4
|
||||
|
||||
/**
|
||||
* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
|
||||
* (requires the LWIP_TCP option)
|
||||
*/
|
||||
#define MEMP_NUM_TCP_PCB_LISTEN 4
|
||||
|
||||
/**
|
||||
* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
|
||||
* (requires the LWIP_TCP option)
|
||||
*/
|
||||
#define MEMP_NUM_TCP_SEG 16
|
||||
|
||||
/**
|
||||
* MEMP_NUM_REASSDATA: the number of simultaneously IP packets queued for
|
||||
* reassembly (whole packets, not fragments!)
|
||||
*/
|
||||
#define MEMP_NUM_REASSDATA 1
|
||||
|
||||
/**
|
||||
* MEMP_NUM_ARP_QUEUE: the number of simulateously queued outgoing
|
||||
* packets (pbufs) that are waiting for an ARP request (to resolve
|
||||
* their destination address) to finish.
|
||||
* (requires the ARP_QUEUEING option)
|
||||
*/
|
||||
#define MEMP_NUM_ARP_QUEUE 2
|
||||
|
||||
/**
|
||||
* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts.
|
||||
* (requires NO_SYS==0)
|
||||
*/
|
||||
#define MEMP_NUM_SYS_TIMEOUT 3
|
||||
|
||||
/**
|
||||
* MEMP_NUM_NETBUF: the number of struct netbufs.
|
||||
* (only needed if you use the sequential API, like api_lib.c)
|
||||
*/
|
||||
#define MEMP_NUM_NETBUF 2
|
||||
|
||||
/**
|
||||
* MEMP_NUM_NETCONN: the number of struct netconns.
|
||||
* (only needed if you use the sequential API, like api_lib.c)
|
||||
*/
|
||||
#define MEMP_NUM_NETCONN 4
|
||||
|
||||
/**
|
||||
* MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used
|
||||
* for callback/timeout API communication.
|
||||
* (only needed if you use tcpip.c)
|
||||
*/
|
||||
#define MEMP_NUM_TCPIP_MSG_API 8
|
||||
|
||||
/**
|
||||
* MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used
|
||||
* for incoming packets.
|
||||
* (only needed if you use tcpip.c)
|
||||
*/
|
||||
#define MEMP_NUM_TCPIP_MSG_INPKT 8
|
||||
|
||||
/**
|
||||
* PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
|
||||
*/
|
||||
#define PBUF_POOL_SIZE 8
|
||||
|
||||
/*
|
||||
---------------------------------
|
||||
---------- ARP options ----------
|
||||
---------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_ARP==1: Enable ARP functionality.
|
||||
*/
|
||||
#define LWIP_ARP 1
|
||||
|
||||
/*
|
||||
--------------------------------
|
||||
---------- IP options ----------
|
||||
--------------------------------
|
||||
*/
|
||||
/**
|
||||
* IP_FORWARD==1: Enables the ability to forward IP packets across network
|
||||
* interfaces. If you are going to run lwIP on a device with only one network
|
||||
* interface, define this to 0.
|
||||
*/
|
||||
#define IP_FORWARD 0
|
||||
|
||||
/**
|
||||
* IP_OPTIONS: Defines the behavior for IP options.
|
||||
* IP_OPTIONS_ALLOWED==0: All packets with IP options are dropped.
|
||||
* IP_OPTIONS_ALLOWED==1: IP options are allowed (but not parsed).
|
||||
*/
|
||||
#define IP_OPTIONS_ALLOWED 1
|
||||
|
||||
/**
|
||||
* IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that
|
||||
* this option does not affect outgoing packet sizes, which can be controlled
|
||||
* via IP_FRAG.
|
||||
*/
|
||||
#define IP_REASSEMBLY 1
|
||||
|
||||
/**
|
||||
* IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note
|
||||
* that this option does not affect incoming packet sizes, which can be
|
||||
* controlled via IP_REASSEMBLY.
|
||||
*/
|
||||
#define IP_FRAG 1
|
||||
|
||||
/**
|
||||
* IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally)
|
||||
* a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived
|
||||
* in this time, the whole packet is discarded.
|
||||
*/
|
||||
#define IP_REASS_MAXAGE 3
|
||||
|
||||
/**
|
||||
* IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.
|
||||
* Since the received pbufs are enqueued, be sure to configure
|
||||
* PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive
|
||||
* packets even if the maximum amount of fragments is enqueued for reassembly!
|
||||
*/
|
||||
#define IP_REASS_MAX_PBUFS 4
|
||||
|
||||
/**
|
||||
* IP_FRAG_USES_STATIC_BUF==1: Use a static MTU-sized buffer for IP
|
||||
* fragmentation. Otherwise pbufs are allocated and reference the original
|
||||
* packet data to be fragmented.
|
||||
*/
|
||||
#define IP_FRAG_USES_STATIC_BUF 0
|
||||
|
||||
/**
|
||||
* IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers.
|
||||
*/
|
||||
#define IP_DEFAULT_TTL 255
|
||||
|
||||
/*
|
||||
----------------------------------
|
||||
---------- ICMP options ----------
|
||||
----------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_ICMP==1: Enable ICMP module inside the IP stack.
|
||||
* Be careful, disable that make your product non-compliant to RFC1122
|
||||
*/
|
||||
#define LWIP_ICMP 1
|
||||
|
||||
/*
|
||||
---------------------------------
|
||||
---------- RAW options ----------
|
||||
---------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
|
||||
*/
|
||||
#define LWIP_RAW 1
|
||||
|
||||
/*
|
||||
----------------------------------
|
||||
---------- DHCP options ----------
|
||||
----------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_DHCP==1: Enable DHCP module.
|
||||
*/
|
||||
#define LWIP_DHCP 0
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------
|
||||
---------- AUTOIP options ----------
|
||||
------------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_AUTOIP==1: Enable AUTOIP module.
|
||||
*/
|
||||
#define LWIP_AUTOIP 0
|
||||
|
||||
/*
|
||||
----------------------------------
|
||||
---------- SNMP options ----------
|
||||
----------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_SNMP==1: Turn on SNMP module. UDP must be available for SNMP
|
||||
* transport.
|
||||
*/
|
||||
#define LWIP_SNMP 0
|
||||
|
||||
/*
|
||||
----------------------------------
|
||||
---------- IGMP options ----------
|
||||
----------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_IGMP==1: Turn on IGMP module.
|
||||
*/
|
||||
#define LWIP_IGMP 0
|
||||
|
||||
/*
|
||||
----------------------------------
|
||||
---------- DNS options -----------
|
||||
----------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS
|
||||
* transport.
|
||||
*/
|
||||
#define LWIP_DNS 0
|
||||
|
||||
/*
|
||||
---------------------------------
|
||||
---------- UDP options ----------
|
||||
---------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_UDP==1: Turn on UDP.
|
||||
*/
|
||||
#define LWIP_UDP 1
|
||||
|
||||
/*
|
||||
---------------------------------
|
||||
---------- TCP options ----------
|
||||
---------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_TCP==1: Turn on TCP.
|
||||
*/
|
||||
#define LWIP_TCP 1
|
||||
|
||||
#define LWIP_LISTEN_BACKLOG 0
|
||||
|
||||
/*
|
||||
----------------------------------
|
||||
---------- Pbuf options ----------
|
||||
----------------------------------
|
||||
*/
|
||||
/**
|
||||
* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
|
||||
* link level header. The default is 14, the standard value for
|
||||
* Ethernet.
|
||||
*/
|
||||
#define PBUF_LINK_HLEN 16
|
||||
|
||||
/**
|
||||
* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. The default is
|
||||
* designed to accomodate single full size TCP frame in one pbuf, including
|
||||
* TCP_MSS, IP header, and link header.
|
||||
*
|
||||
*/
|
||||
#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN)
|
||||
|
||||
/*
|
||||
------------------------------------
|
||||
---------- LOOPIF options ----------
|
||||
------------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1) and loopif.c
|
||||
*/
|
||||
#define LWIP_HAVE_LOOPIF 0
|
||||
|
||||
/*
|
||||
----------------------------------------------
|
||||
---------- Sequential layer options ----------
|
||||
----------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
|
||||
*/
|
||||
#define LWIP_NETCONN 1
|
||||
|
||||
/*
|
||||
------------------------------------
|
||||
---------- Socket options ----------
|
||||
------------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
|
||||
*/
|
||||
#define LWIP_SOCKET 1
|
||||
|
||||
/*
|
||||
----------------------------------------
|
||||
---------- Statistics options ----------
|
||||
----------------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_STATS==1: Enable statistics collection in lwip_stats.
|
||||
*/
|
||||
#define LWIP_STATS 0
|
||||
/*
|
||||
---------------------------------
|
||||
---------- PPP options ----------
|
||||
---------------------------------
|
||||
*/
|
||||
/**
|
||||
* PPP_SUPPORT==1: Enable PPP.
|
||||
*/
|
||||
#define PPP_SUPPORT 0
|
||||
|
||||
|
||||
/* Misc */
|
||||
|
||||
#endif /* LWIP_LWIPOPTS_H */
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Author: Kieran Mansley <kjm25@cam.ac.uk>
|
||||
*
|
||||
* $Id: unixlib.c,v 1.10 2010/02/17 16:52:30 goldsimon Exp $
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* unixlib.c
|
||||
*
|
||||
* The initialisation functions for a shared library
|
||||
*
|
||||
* You may need to configure this file to your own needs - it is only an example
|
||||
* of how lwIP can be used as a self initialising shared library.
|
||||
*
|
||||
* In particular, you should change the gateway, ipaddr, and netmask to be the values
|
||||
* you would like the stack to use.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
#include "lwip/init.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/memp.h"
|
||||
#include "lwip/pbuf.h"
|
||||
#include "lwip/tcp.h"
|
||||
#include "lwip/tcpip.h"
|
||||
#include "lwip/netif.h"
|
||||
#include "lwip/stats.h"
|
||||
#include "lwip/sockets.h"
|
||||
|
||||
#include "netif/tapif.h"
|
||||
|
||||
struct netif netif;
|
||||
|
||||
void _init(void);
|
||||
void _fini(void);
|
||||
|
||||
static void
|
||||
tcpip_init_done(void *arg)
|
||||
{
|
||||
ip_addr_t ipaddr, netmask, gateway;
|
||||
sys_sem_t *sem;
|
||||
sem = (sys_sem_t *)arg;
|
||||
|
||||
/*
|
||||
CHANGE THESE to suit your own network configuration:
|
||||
*/
|
||||
IP4_ADDR(&gateway, 192,168,1,1);
|
||||
IP4_ADDR(&ipaddr, 192,168,1,2);
|
||||
IP4_ADDR(&netmask, 255,255,255,0);
|
||||
|
||||
netif_set_default(netif_add(&netif, &ipaddr, &netmask, &gateway, NULL, tapif_init,
|
||||
tcpip_input));
|
||||
netif_set_up(&netif);
|
||||
#if LWIP_IPV6
|
||||
netif_create_ip6_linklocal_address(&netif, 1);
|
||||
#endif
|
||||
sys_sem_signal(sem);
|
||||
}
|
||||
|
||||
void _init(void){
|
||||
sys_sem_t sem;
|
||||
|
||||
if(sys_sem_new(&sem, 0) != ERR_OK) {
|
||||
LWIP_ASSERT("failed to create semaphore", 0);
|
||||
}
|
||||
tcpip_init(tcpip_init_done, &sem);
|
||||
sys_sem_wait(&sem);
|
||||
sys_sem_free(&sem);
|
||||
}
|
||||
|
||||
void _fini(void){
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2001, 2002 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>
|
||||
#
|
||||
|
||||
all ipv4 compile: echop
|
||||
.PHONY: all
|
||||
|
||||
include ../Common.mk
|
||||
|
||||
clean:
|
||||
rm -f *.o $(LWIPLIBCOMMON) $(APPLIB) echop .depend* *.core core
|
||||
|
||||
depend dep: .depend
|
||||
|
||||
include .depend
|
||||
|
||||
.depend: main.c $(LWIPFILES) $(APPFILES)
|
||||
$(CCDEP) $(CFLAGS) -MM $^ > .depend || rm -f .depend
|
||||
|
||||
echop: .depend $(LWIPLIBCOMMON) $(APPLIB) main.o $(APPFILES)
|
||||
$(CC) $(CFLAGS) -o echop main.o -Wl,--start-group $(APPLIB) $(LWIPLIBCOMMON) -Wl,--end-group $(LDFLAGS)
|
||||
@@ -1,12 +0,0 @@
|
||||
This is an example of a very minimal lwIP project. It runs in a single
|
||||
thread and runs a single example application - an echo server. The
|
||||
echo application is implemented using the raw API. Additionally this
|
||||
raw API example hosts the SNMPv1 agent for development purposes.
|
||||
|
||||
In order to run the demo without root priviledges, you can create a
|
||||
preconfigured tap device in advance and then run the application with the
|
||||
interface passed in via an environment variable:
|
||||
|
||||
$ sudo ip tuntap add dev tap0 mode tap user YOUR-USER-NAME
|
||||
$ sudo ip a a dev tap0 192.168.0.1/24
|
||||
$ PRECONFIGURED_TAPIF=tap0 ./echop
|
||||
@@ -1,440 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* lwIP Options Configuration
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-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. 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 LWIP_LWIPOPTS_H
|
||||
#define LWIP_LWIPOPTS_H
|
||||
|
||||
/*
|
||||
-----------------------------------------------
|
||||
---------- Platform specific locking ----------
|
||||
-----------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* NO_SYS==1: Provides VERY minimal functionality. Otherwise,
|
||||
* use lwIP facilities.
|
||||
*/
|
||||
#define NO_SYS 1
|
||||
|
||||
/**
|
||||
* SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
|
||||
* critical regions during buffer allocation, deallocation and memory
|
||||
* allocation and deallocation.
|
||||
*/
|
||||
#define SYS_LIGHTWEIGHT_PROT 0
|
||||
|
||||
/*
|
||||
------------------------------------
|
||||
---------- Memory options ----------
|
||||
------------------------------------
|
||||
*/
|
||||
/**
|
||||
* MEM_ALIGNMENT: should be set to the alignment of the CPU
|
||||
* 4 byte alignment -> #define MEM_ALIGNMENT 4
|
||||
* 2 byte alignment -> #define MEM_ALIGNMENT 2
|
||||
*/
|
||||
#define MEM_ALIGNMENT 1U
|
||||
|
||||
/**
|
||||
* MEM_SIZE: the size of the heap memory. If the application will send
|
||||
* a lot of data that needs to be copied, this should be set high.
|
||||
*/
|
||||
#define MEM_SIZE 16000
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------
|
||||
---------- Internal Memory Pool Sizes ----------
|
||||
------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF).
|
||||
* If the application sends a lot of data out of ROM (or other static memory),
|
||||
* this should be set high.
|
||||
*/
|
||||
#define MEMP_NUM_PBUF 30
|
||||
|
||||
/**
|
||||
* MEMP_NUM_RAW_PCB: Number of raw connection PCBs
|
||||
* (requires the LWIP_RAW option)
|
||||
*/
|
||||
#define MEMP_NUM_RAW_PCB 4
|
||||
|
||||
/**
|
||||
* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
|
||||
* per active UDP "connection".
|
||||
* (requires the LWIP_UDP option)
|
||||
*/
|
||||
#define MEMP_NUM_UDP_PCB 4
|
||||
|
||||
/**
|
||||
* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections.
|
||||
* (requires the LWIP_TCP option)
|
||||
*/
|
||||
#define MEMP_NUM_TCP_PCB 2
|
||||
|
||||
/**
|
||||
* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
|
||||
* (requires the LWIP_TCP option)
|
||||
*/
|
||||
#define MEMP_NUM_TCP_PCB_LISTEN 8
|
||||
|
||||
/**
|
||||
* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
|
||||
* (requires the LWIP_TCP option)
|
||||
*/
|
||||
#define MEMP_NUM_TCP_SEG 16
|
||||
|
||||
/**
|
||||
* MEMP_NUM_ARP_QUEUE: the number of simulateously queued outgoing
|
||||
* packets (pbufs) that are waiting for an ARP request (to resolve
|
||||
* their destination address) to finish.
|
||||
* (requires the ARP_QUEUEING option)
|
||||
*/
|
||||
#define MEMP_NUM_ARP_QUEUE 2
|
||||
|
||||
/**
|
||||
* MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active timeouts.
|
||||
* The default number of timeouts is calculated here for all enabled modules.
|
||||
* The formula expects settings to be either '0' or '1'.
|
||||
*
|
||||
* To this default value, 1 was added for the snmp_increment timer.
|
||||
*/
|
||||
#define MEMP_NUM_SYS_TIMEOUT (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT + (LWIP_IPV6 ? (1 + LWIP_IPV6_REASS + LWIP_IPV6_MLD) : 0)) + 1
|
||||
|
||||
/**
|
||||
* MEMP_NUM_NETBUF: the number of struct netbufs.
|
||||
* (only needed if you use the sequential API, like api_lib.c)
|
||||
*/
|
||||
#define MEMP_NUM_NETBUF 0
|
||||
|
||||
/**
|
||||
* MEMP_NUM_NETCONN: the number of struct netconns.
|
||||
* (only needed if you use the sequential API, like api_lib.c)
|
||||
*/
|
||||
#define MEMP_NUM_NETCONN 0
|
||||
|
||||
/**
|
||||
* MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used
|
||||
* for callback/timeout API communication.
|
||||
* (only needed if you use tcpip.c)
|
||||
*/
|
||||
#define MEMP_NUM_TCPIP_MSG_API 0
|
||||
|
||||
/**
|
||||
* MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used
|
||||
* for incoming packets.
|
||||
* (only needed if you use tcpip.c)
|
||||
*/
|
||||
#define MEMP_NUM_TCPIP_MSG_INPKT 0
|
||||
|
||||
/**
|
||||
* PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
|
||||
*/
|
||||
#define PBUF_POOL_SIZE 32
|
||||
|
||||
/*
|
||||
---------------------------------
|
||||
---------- ARP options ----------
|
||||
---------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_ARP==1: Enable ARP functionality.
|
||||
*/
|
||||
#define LWIP_ARP 1
|
||||
|
||||
/*
|
||||
--------------------------------
|
||||
---------- IP options ----------
|
||||
--------------------------------
|
||||
*/
|
||||
/**
|
||||
* IP_FORWARD==1: Enables the ability to forward IP packets across network
|
||||
* interfaces. If you are going to run lwIP on a device with only one network
|
||||
* interface, define this to 0.
|
||||
*/
|
||||
#define IP_FORWARD 0
|
||||
|
||||
/**
|
||||
* IP_OPTIONS: Defines the behavior for IP options.
|
||||
* IP_OPTIONS==0_ALLOWED: All packets with IP options are dropped.
|
||||
* IP_OPTIONS==1_ALLOWED: IP options are allowed (but not parsed).
|
||||
*/
|
||||
#define IP_OPTIONS_ALLOWED 1
|
||||
|
||||
/**
|
||||
* IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that
|
||||
* this option does not affect outgoing packet sizes, which can be controlled
|
||||
* via IP_FRAG.
|
||||
*/
|
||||
#define IP_REASSEMBLY 1
|
||||
|
||||
/**
|
||||
* IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note
|
||||
* that this option does not affect incoming packet sizes, which can be
|
||||
* controlled via IP_REASSEMBLY.
|
||||
*/
|
||||
#define IP_FRAG 1
|
||||
|
||||
/**
|
||||
* IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally)
|
||||
* a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived
|
||||
* in this time, the whole packet is discarded.
|
||||
*/
|
||||
#define IP_REASS_MAXAGE 3
|
||||
|
||||
/**
|
||||
* IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.
|
||||
* Since the received pbufs are enqueued, be sure to configure
|
||||
* PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive
|
||||
* packets even if the maximum amount of fragments is enqueued for reassembly!
|
||||
*/
|
||||
#define IP_REASS_MAX_PBUFS 10
|
||||
|
||||
/**
|
||||
* IP_FRAG_USES_STATIC_BUF==1: Use a static MTU-sized buffer for IP
|
||||
* fragmentation. Otherwise pbufs are allocated and reference the original
|
||||
* packet data to be fragmented.
|
||||
*/
|
||||
#define IP_FRAG_USES_STATIC_BUF 0
|
||||
|
||||
/**
|
||||
* IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers.
|
||||
*/
|
||||
#define IP_DEFAULT_TTL 255
|
||||
|
||||
/*
|
||||
----------------------------------
|
||||
---------- ICMP options ----------
|
||||
----------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_ICMP==1: Enable ICMP module inside the IP stack.
|
||||
* Be careful, disable that make your product non-compliant to RFC1122
|
||||
*/
|
||||
#define LWIP_ICMP 1
|
||||
|
||||
/**
|
||||
* ICMP_TTL: Default value for Time-To-Live used by ICMP packets.
|
||||
*/
|
||||
#define ICMP_TTL (IP_DEFAULT_TTL)
|
||||
|
||||
/*
|
||||
---------------------------------
|
||||
---------- RAW options ----------
|
||||
---------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
|
||||
*/
|
||||
#define LWIP_RAW 0
|
||||
|
||||
/*
|
||||
----------------------------------
|
||||
---------- DHCP options ----------
|
||||
----------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_DHCP==1: Enable DHCP module.
|
||||
*/
|
||||
#define LWIP_DHCP 0
|
||||
|
||||
/*
|
||||
------------------------------------
|
||||
---------- AUTOIP options ----------
|
||||
------------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_AUTOIP==1: Enable AUTOIP module.
|
||||
*/
|
||||
#define LWIP_AUTOIP 0
|
||||
|
||||
/*
|
||||
----------------------------------
|
||||
---------- SNMP options ----------
|
||||
----------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_SNMP==1: Turn on SNMP module. UDP must be available for SNMP
|
||||
* transport.
|
||||
*/
|
||||
#define LWIP_SNMP 1
|
||||
#define LWIP_MIB2_CALLBACKS 0
|
||||
#define MIB2_STATS 1
|
||||
|
||||
/*
|
||||
----------------------------------
|
||||
---------- IGMP options ----------
|
||||
----------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_IGMP==1: Turn on IGMP module.
|
||||
*/
|
||||
#define LWIP_IGMP 0
|
||||
|
||||
/*
|
||||
----------------------------------
|
||||
---------- DNS options -----------
|
||||
----------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS
|
||||
* transport.
|
||||
*/
|
||||
#define LWIP_DNS 0
|
||||
|
||||
/*
|
||||
---------------------------------
|
||||
---------- UDP options ----------
|
||||
---------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_UDP==1: Turn on UDP.
|
||||
*/
|
||||
#define LWIP_UDP 1
|
||||
|
||||
/**
|
||||
* LWIP_UDPLITE==1: Turn on UDP-Lite. (Requires LWIP_UDP)
|
||||
*/
|
||||
#define LWIP_UDPLITE 0
|
||||
|
||||
/**
|
||||
* UDP_TTL: Default Time-To-Live value.
|
||||
*/
|
||||
#define UDP_TTL (IP_DEFAULT_TTL)
|
||||
|
||||
/*
|
||||
---------------------------------
|
||||
---------- TCP options ----------
|
||||
---------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_TCP==1: Turn on TCP.
|
||||
*/
|
||||
#define LWIP_TCP 1
|
||||
|
||||
/*
|
||||
----------------------------------
|
||||
---------- Pbuf options ----------
|
||||
----------------------------------
|
||||
*/
|
||||
/**
|
||||
* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
|
||||
* link level header. The default is 14, the standard value for
|
||||
* Ethernet.
|
||||
*/
|
||||
#define PBUF_LINK_HLEN 16
|
||||
|
||||
/*
|
||||
------------------------------------
|
||||
---------- LOOPIF options ----------
|
||||
------------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1) and loopif.c
|
||||
*/
|
||||
#define LWIP_HAVE_LOOPIF 0
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------
|
||||
---------- Sequential layer options ----------
|
||||
----------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
|
||||
*/
|
||||
#define LWIP_NETCONN 0
|
||||
|
||||
/*
|
||||
------------------------------------
|
||||
---------- Socket options ----------
|
||||
------------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
|
||||
*/
|
||||
#define LWIP_SOCKET 0
|
||||
|
||||
/*
|
||||
----------------------------------------
|
||||
---------- Statistics options ----------
|
||||
----------------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_STATS==1: Enable statistics collection in lwip_stats.
|
||||
*/
|
||||
#define LWIP_STATS 1
|
||||
|
||||
/*
|
||||
---------------------------------------
|
||||
---------- Debugging options ----------
|
||||
---------------------------------------
|
||||
*/
|
||||
|
||||
#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 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 RAW_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
|
||||
|
||||
extern unsigned char debug_flags;
|
||||
#define LWIP_DBG_TYPES_ON debug_flags
|
||||
|
||||
#endif /* LWIP_LWIPOPTS_H */
|
||||
@@ -1,224 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
* RT timer modifications by Christiaan Simons
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lwip/init.h"
|
||||
|
||||
#include "lwip/debug.h"
|
||||
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/memp.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/timeouts.h"
|
||||
|
||||
#include "lwip/stats.h"
|
||||
|
||||
#include "lwip/ip.h"
|
||||
#include "lwip/ip4_frag.h"
|
||||
#include "lwip/udp.h"
|
||||
#include "lwip/tcp.h"
|
||||
#include "netif/tapif.h"
|
||||
#include "netif/etharp.h"
|
||||
|
||||
#include "lwip/apps/snmp.h"
|
||||
#include "lwip/apps/snmp_mib2.h"
|
||||
|
||||
#include "apps/snmp_private_mib/private_mib.h"
|
||||
#include "apps/udpecho_raw/udpecho_raw.h"
|
||||
#include "apps/tcpecho_raw/tcpecho_raw.h"
|
||||
|
||||
/* (manual) host IP configuration */
|
||||
static ip4_addr_t ipaddr, netmask, gw;
|
||||
|
||||
#if LWIP_SNMP
|
||||
/* SNMP trap destination cmd option */
|
||||
static unsigned char trap_flag;
|
||||
static ip_addr_t trap_addr;
|
||||
|
||||
static const struct snmp_mib *mibs[] = {
|
||||
&mib2,
|
||||
&mib_private
|
||||
};
|
||||
#endif
|
||||
|
||||
/* nonstatic debug cmd option, exported in lwipopts.h */
|
||||
unsigned char debug_flags;
|
||||
|
||||
#if LWIP_SNMP
|
||||
/* enable == 1, disable == 2 */
|
||||
u8_t snmpauthentraps_set = 2;
|
||||
#endif
|
||||
|
||||
static struct option longopts[] = {
|
||||
/* turn on debugging output (if build with LWIP_DEBUG) */
|
||||
{"debug", no_argument, NULL, 'd'},
|
||||
/* help */
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
/* gateway address */
|
||||
{"gateway", required_argument, NULL, 'g'},
|
||||
/* ip address */
|
||||
{"ipaddr", required_argument, NULL, 'i'},
|
||||
/* netmask */
|
||||
{"netmask", required_argument, NULL, 'm'},
|
||||
/* ping destination */
|
||||
{"trap_destination", required_argument, NULL, 't'},
|
||||
/* new command line options go here! */
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
#define NUM_OPTS ((sizeof(longopts) / sizeof(struct option)) - 1)
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
unsigned char i;
|
||||
|
||||
printf("options:\n");
|
||||
for (i = 0; i < NUM_OPTS; i++) {
|
||||
printf("-%c --%s\n",longopts[i].val, longopts[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
struct netif netif;
|
||||
int ch;
|
||||
char ip_str[16] = {0}, nm_str[16] = {0}, gw_str[16] = {0};
|
||||
|
||||
/* startup defaults (may be overridden by one or more opts) */
|
||||
IP4_ADDR(&gw, 192,168,0,1);
|
||||
IP4_ADDR(&ipaddr, 192,168,0,2);
|
||||
IP4_ADDR(&netmask, 255,255,255,0);
|
||||
|
||||
#if LWIP_SNMP
|
||||
trap_flag = 0;
|
||||
#endif
|
||||
/* use debug flags defined by debug.h */
|
||||
debug_flags = LWIP_DBG_OFF;
|
||||
|
||||
while ((ch = getopt_long(argc, argv, "dhg:i:m:t:", longopts, NULL)) != -1) {
|
||||
switch (ch) {
|
||||
case 'd':
|
||||
debug_flags |= (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT);
|
||||
break;
|
||||
case 'h':
|
||||
usage();
|
||||
exit(0);
|
||||
break;
|
||||
case 'g':
|
||||
ip4addr_aton(optarg, &gw);
|
||||
break;
|
||||
case 'i':
|
||||
ip4addr_aton(optarg, &ipaddr);
|
||||
break;
|
||||
case 'm':
|
||||
ip4addr_aton(optarg, &netmask);
|
||||
break;
|
||||
case 't':
|
||||
#if LWIP_SNMP
|
||||
trap_flag = !0;
|
||||
/* @todo: remove this authentraps tweak
|
||||
when we have proper SET & non-volatile mem */
|
||||
snmpauthentraps_set = 1;
|
||||
ipaddr_aton(optarg, &trap_addr);
|
||||
strncpy(ip_str, ipaddr_ntoa(&trap_addr),sizeof(ip_str));
|
||||
printf("SNMP trap destination %s\n", ip_str);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
strncpy(ip_str, ip4addr_ntoa(&ipaddr), sizeof(ip_str));
|
||||
strncpy(nm_str, ip4addr_ntoa(&netmask), sizeof(nm_str));
|
||||
strncpy(gw_str, ip4addr_ntoa(&gw), sizeof(gw_str));
|
||||
printf("Host at %s mask %s gateway %s\n", ip_str, nm_str, gw_str);
|
||||
|
||||
|
||||
#ifdef PERF
|
||||
perf_init("/tmp/minimal.perf");
|
||||
#endif /* PERF */
|
||||
|
||||
lwip_init();
|
||||
|
||||
printf("TCP/IP initialized.\n");
|
||||
|
||||
netif_add(&netif, &ipaddr, &netmask, &gw, NULL, tapif_init, ethernet_input);
|
||||
netif_set_default(&netif);
|
||||
netif_set_up(&netif);
|
||||
#if LWIP_IPV6
|
||||
netif_create_ip6_linklocal_address(&netif, 1);
|
||||
#endif
|
||||
|
||||
#if LWIP_SNMP
|
||||
/* initialize our private example MIB */
|
||||
lwip_privmib_init();
|
||||
|
||||
/* snmp_trap_dst_ip_set(0,&trap_addr); */
|
||||
/* snmp_trap_dst_enable(0,trap_flag); */
|
||||
|
||||
#if SNMP_LWIP_MIB2
|
||||
#if SNMP_USE_NETCONN
|
||||
snmp_threadsync_init(&snmp_mib2_lwip_locks, snmp_mib2_lwip_synchronizer);
|
||||
#endif
|
||||
snmp_mib2_set_syscontact_readonly((const u8_t*)"root", NULL);
|
||||
snmp_mib2_set_syslocation_readonly((const u8_t*)"lwIP development PC", NULL);
|
||||
snmp_mib2_set_sysdescr((const u8_t*)"minimal example", NULL);
|
||||
#endif /* SNMP_LWIP_MIB2 */
|
||||
|
||||
/* snmp_set_snmpenableauthentraps(&snmpauthentraps_set); */
|
||||
snmp_set_mibs(mibs, LWIP_ARRAYSIZE(mibs));
|
||||
snmp_init();
|
||||
#endif /* LWIP_SNMP */
|
||||
|
||||
udpecho_raw_init();
|
||||
tcpecho_raw_init();
|
||||
|
||||
printf("Applications started.\n");
|
||||
|
||||
|
||||
while (1) {
|
||||
/* poll netif, pass packet to lwIP */
|
||||
tapif_select(&netif);
|
||||
|
||||
sys_check_timeouts();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_ARCH_CC_H
|
||||
#define LWIP_ARCH_CC_H
|
||||
|
||||
/* see https://sourceforge.net/p/predef/wiki/OperatingSystems/ */
|
||||
#if defined __ANDROID__
|
||||
#define LWIP_UNIX_ANDROID
|
||||
#elif defined __linux__
|
||||
#define LWIP_UNIX_LINUX
|
||||
#elif defined __APPLE__
|
||||
#define LWIP_UNIX_MACH
|
||||
#elif defined __OpenBSD__
|
||||
#define LWIP_UNIX_OPENBSD
|
||||
#elif defined __CYGWIN__
|
||||
#define LWIP_UNIX_CYGWIN
|
||||
#endif
|
||||
|
||||
#define LWIP_TIMEVAL_PRIVATE 0
|
||||
#include <sys/time.h>
|
||||
|
||||
#define LWIP_ERRNO_INCLUDE <errno.h>
|
||||
|
||||
#define LWIP_RAND() ((u32_t)rand())
|
||||
|
||||
/* different handling for unit test, normally not needed */
|
||||
#ifdef LWIP_NOASSERT_ON_ERROR
|
||||
#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
|
||||
handler;}} while(0)
|
||||
#endif
|
||||
|
||||
#if defined(LWIP_UNIX_ANDROID) && defined(FD_SET)
|
||||
typedef __kernel_fd_set fd_set;
|
||||
#endif
|
||||
|
||||
struct sio_status_s;
|
||||
typedef struct sio_status_s sio_status_t;
|
||||
#define sio_fd_t sio_status_t*
|
||||
#define __sio_fd_t_defined
|
||||
|
||||
#endif /* LWIP_ARCH_CC_H */
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_ARCH_PERF_H
|
||||
#define LWIP_ARCH_PERF_H
|
||||
|
||||
#include <sys/times.h>
|
||||
|
||||
#ifdef PERF
|
||||
#define PERF_START { \
|
||||
unsigned long __c1l, __c1h, __c2l, __c2h; \
|
||||
__asm__(".byte 0x0f, 0x31" : "=a" (__c1l), "=d" (__c1h))
|
||||
#define PERF_STOP(x) __asm__(".byte 0x0f, 0x31" : "=a" (__c2l), "=d" (__c2h)); \
|
||||
perf_print(__c1l, __c1h, __c2l, __c2h, x);}
|
||||
|
||||
/*#define PERF_START do { \
|
||||
struct tms __perf_start, __perf_end; \
|
||||
times(&__perf_start)
|
||||
#define PERF_STOP(x) times(&__perf_end); \
|
||||
perf_print_times(&__perf_start, &__perf_end, x);\
|
||||
} while(0)*/
|
||||
#else /* PERF */
|
||||
#define PERF_START /* null definition */
|
||||
#define PERF_STOP(x) /* null definition */
|
||||
#endif /* PERF */
|
||||
|
||||
void perf_print(unsigned long c1l, unsigned long c1h,
|
||||
unsigned long c2l, unsigned long c2h,
|
||||
char *key);
|
||||
|
||||
void perf_print_times(struct tms *start, struct tms *end, char *key);
|
||||
|
||||
void perf_init(char *fname);
|
||||
|
||||
#endif /* LWIP_ARCH_PERF_H */
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_ARCH_SYS_ARCH_H
|
||||
#define LWIP_ARCH_SYS_ARCH_H
|
||||
|
||||
#define SYS_MBOX_NULL NULL
|
||||
#define SYS_SEM_NULL NULL
|
||||
|
||||
typedef u32_t sys_prot_t;
|
||||
|
||||
struct sys_sem;
|
||||
typedef struct sys_sem * sys_sem_t;
|
||||
#define sys_sem_valid(sem) (((sem) != NULL) && (*(sem) != NULL))
|
||||
#define sys_sem_valid_val(sem) ((sem) != NULL)
|
||||
#define sys_sem_set_invalid(sem) do { if((sem) != NULL) { *(sem) = NULL; }}while(0)
|
||||
#define sys_sem_set_invalid_val(sem) do { (sem) = NULL; }while(0)
|
||||
|
||||
struct sys_mutex;
|
||||
typedef struct sys_mutex * sys_mutex_t;
|
||||
#define sys_mutex_valid(mutex) sys_sem_valid(mutex)
|
||||
#define sys_mutex_set_invalid(mutex) sys_sem_set_invalid(mutex)
|
||||
|
||||
struct sys_mbox;
|
||||
typedef struct sys_mbox * sys_mbox_t;
|
||||
#define sys_mbox_valid(mbox) sys_sem_valid(mbox)
|
||||
#define sys_mbox_valid_val(mbox) sys_sem_valid_val(mbox)
|
||||
#define sys_mbox_set_invalid(mbox) sys_sem_set_invalid(mbox)
|
||||
#define sys_mbox_set_invalid_val(mbox) sys_sem_set_invalid_val(mbox)
|
||||
|
||||
struct sys_thread;
|
||||
typedef struct sys_thread * sys_thread_t;
|
||||
|
||||
#endif /* LWIP_ARCH_SYS_ARCH_H */
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_DELIF_H
|
||||
#define LWIP_DELIF_H
|
||||
|
||||
#include "lwip/netif.h"
|
||||
|
||||
#include "lwip/pbuf.h"
|
||||
|
||||
err_t delif_init(struct netif *netif);
|
||||
err_t delif_init_thread(struct netif *netif);
|
||||
|
||||
#endif /* LWIP_DELIF_H */
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_DROPIF_H
|
||||
#define LWIP_DROPIF_H
|
||||
|
||||
#include "lwip/netif.h"
|
||||
|
||||
#include "lwip/pbuf.h"
|
||||
|
||||
err_t dropif_init(struct netif *netif);
|
||||
|
||||
#endif /* LWIP_DROPIF_H */
|
||||
@@ -1,54 +0,0 @@
|
||||
#ifndef FIFO_H
|
||||
#define FIFO_H
|
||||
|
||||
#include "lwip/sys.h"
|
||||
|
||||
/** How many bytes in fifo */
|
||||
#define FIFOSIZE 2048
|
||||
|
||||
/** fifo data structure, this one is passed to all fifo functions */
|
||||
typedef struct fifo_t {
|
||||
u8_t data[FIFOSIZE+10]; /* data segment, +10 is a hack probably not needed.. FIXME! */
|
||||
int dataslot; /* index to next char to be read */
|
||||
int emptyslot; /* index to next empty slot */
|
||||
int len; /* len probably not needed, may be calculated from dataslot and emptyslot in conjunction with FIFOSIZE */
|
||||
|
||||
sys_sem_t sem; /* semaphore protecting simultaneous data manipulation */
|
||||
sys_sem_t getSem; /* sepaphore used to signal new data if getWaiting is set */
|
||||
u8_t getWaiting; /* flag used to indicate that fifoget is waiting for data. fifoput is suposed to clear */
|
||||
/* this flag prior to signaling the getSem semaphore */
|
||||
} fifo_t;
|
||||
|
||||
|
||||
/**
|
||||
* Get a character from fifo
|
||||
* Blocking call.
|
||||
* @param fifo pointer to fifo data structure
|
||||
* @return character read from fifo
|
||||
*/
|
||||
u8_t fifoGet(fifo_t * fifo);
|
||||
|
||||
/**
|
||||
* Get a character from fifo
|
||||
* Non blocking call.
|
||||
* @param fifo pointer to fifo data structure
|
||||
* @return character read from fifo, or < zero if non was available
|
||||
*/
|
||||
s16_t fifoGetNonBlock(fifo_t * fifo);
|
||||
|
||||
/**
|
||||
* fifoput is called by the signalhandler when new data has arrived (or some other event is indicated)
|
||||
* fifoput reads directly from the serialport and is thus highly dependent on unix arch at this moment
|
||||
* @param fifo pointer to fifo data structure
|
||||
* @param fd unix file descriptor
|
||||
*/
|
||||
void fifoPut(fifo_t * fifo, int fd);
|
||||
|
||||
/**
|
||||
* fifoinit initiate fifo
|
||||
* @param fifo pointer to fifo data structure, allocated by the user
|
||||
*/
|
||||
void fifoInit(fifo_t * fifo);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
|
||||
#ifndef LWIP_LIST_H
|
||||
#define LWIP_LIST_H
|
||||
|
||||
struct elem;
|
||||
|
||||
struct list {
|
||||
struct elem *first, *last;
|
||||
int size, elems;
|
||||
};
|
||||
|
||||
struct elem {
|
||||
struct elem *next;
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct list *list_new(int size);
|
||||
int list_push(struct list *list, void *data);
|
||||
void *list_pop(struct list *list);
|
||||
void *list_first(struct list *list);
|
||||
int list_elems(struct list *list);
|
||||
void list_delete(struct list *list);
|
||||
int list_remove(struct list *list, void *elem);
|
||||
void list_map(struct list *list, void (* func)(void *arg));
|
||||
|
||||
#endif
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_PCAPIF_H
|
||||
#define LWIP_PCAPIF_H
|
||||
|
||||
#include "lwip/netif.h"
|
||||
|
||||
err_t pcapif_init(struct netif *netif);
|
||||
|
||||
#endif /* LWIP_PCAPIF_H */
|
||||
@@ -1,60 +0,0 @@
|
||||
#ifndef SIO_UNIX_H
|
||||
#define SIO_UNIX_H
|
||||
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/netif.h"
|
||||
#include "netif/fifo.h"
|
||||
/*#include "netif/pppif.h"*/
|
||||
|
||||
struct sio_status_s {
|
||||
int fd;
|
||||
fifo_t myfifo;
|
||||
};
|
||||
|
||||
/* BAUDRATE is defined in sio.c as it is implementation specific */
|
||||
/** Baudrates */
|
||||
typedef enum sioBaudrates {
|
||||
SIO_BAUD_9600,
|
||||
SIO_BAUD_19200,
|
||||
SIO_BAUD_38400,
|
||||
SIO_BAUD_57600,
|
||||
SIO_BAUD_115200
|
||||
} sioBaudrates;
|
||||
|
||||
/**
|
||||
* Poll for a new character from incoming data stream
|
||||
* @param siostat siostatus struct, contains sio instance data, given by sio_open
|
||||
* @return char read from input stream, or < 0 if no char was available
|
||||
*/
|
||||
s16_t sio_poll(sio_status_t * siostat);
|
||||
|
||||
/**
|
||||
* Parse incoming characters until a string str is recieved, blocking call
|
||||
* @param str zero terminated string to expect
|
||||
* @param siostat siostatus struct, contains sio instance data, given by sio_open
|
||||
*/
|
||||
void sio_expect_string(u8_t *str, sio_status_t * siostat);
|
||||
|
||||
/**
|
||||
* Write a char to output data stream
|
||||
* @param str pointer to a zero terminated string
|
||||
* @param siostat siostatus struct, contains sio instance data, given by sio_open
|
||||
*/
|
||||
void sio_send_string(u8_t *str, sio_status_t * siostat);
|
||||
|
||||
/**
|
||||
* Flush outbuffer (send everything in buffer now), useful if some layer below is
|
||||
* holding on to data, waitng to fill a buffer
|
||||
* @param siostat siostatus struct, contains sio instance data, given by sio_open
|
||||
*/
|
||||
void sio_flush( sio_status_t * siostat );
|
||||
|
||||
/**
|
||||
* Change baudrate of port, may close and reopen port
|
||||
* @param baud new baudrate
|
||||
* @param siostat siostatus struct, contains sio instance data, given by sio_open
|
||||
*/
|
||||
void sio_change_baud( sioBaudrates baud, sio_status_t * siostat );
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_TAPIF_H
|
||||
#define LWIP_TAPIF_H
|
||||
|
||||
#include "lwip/netif.h"
|
||||
|
||||
err_t tapif_init(struct netif *netif);
|
||||
#if NO_SYS
|
||||
int tapif_select(struct netif *netif);
|
||||
#endif /* NO_SYS */
|
||||
|
||||
#endif /* LWIP_TAPIF_H */
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_NETIF_TCPDUMP_H
|
||||
#define LWIP_NETIF_TCPDUMP_H
|
||||
|
||||
struct pbuf;
|
||||
struct netif;
|
||||
|
||||
void tcpdump_init(void);
|
||||
void tcpdump(struct pbuf *p, struct netif *netif);
|
||||
|
||||
#endif /* LWIP_NETIF_TCPDUMP_H */
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_TUNIF_H
|
||||
#define LWIP_TUNIF_H
|
||||
|
||||
#include "lwip/netif.h"
|
||||
|
||||
#include "lwip/pbuf.h"
|
||||
|
||||
err_t tunif_init(struct netif *netif);
|
||||
|
||||
#endif /* LWIP_TUNIF_H */
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_UNIXIF_H
|
||||
#define LWIP_UNIXIF_H
|
||||
|
||||
#include "lwip/netif.h"
|
||||
|
||||
err_t unixif_init_server(struct netif *netif);
|
||||
err_t unixif_init_client(struct netif *netif);
|
||||
|
||||
#endif /* LWIP_UNIXIF_H */
|
||||
@@ -1,384 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/pbuf.h"
|
||||
|
||||
#if !NO_SYS
|
||||
|
||||
#include "lwip/debug.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lwip/def.h"
|
||||
#include "netif/delif.h"
|
||||
|
||||
#ifdef LWIP_UNIX_LINUX
|
||||
#include "netif/tapif.h"
|
||||
#else /* LWIP_UNIX_LINUX */
|
||||
#include "netif/tunif.h"
|
||||
#endif /* LWIP_UNIX_LINUX */
|
||||
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/timeouts.h"
|
||||
|
||||
#ifndef DELIF_DEBUG
|
||||
#define DELIF_DEBUG LWIP_DBG_OFF
|
||||
#endif
|
||||
|
||||
#define DELIF_INPUT_DROPRATE 0.1
|
||||
#define DELIF_OUTPUT_DROPRATE 0.1
|
||||
|
||||
#define DELIF_INPUT_DELAY 500 /* Miliseconds. */
|
||||
#define DELIF_OUTPUT_DELAY 500 /* Miliseconds. */
|
||||
|
||||
#define DELIF_TIMEOUT 10
|
||||
|
||||
struct delif {
|
||||
err_t (* input)(struct pbuf *p, struct netif *inp);
|
||||
struct netif *netif;
|
||||
};
|
||||
|
||||
struct delif_pbuf {
|
||||
struct delif_pbuf *next;
|
||||
struct pbuf *p;
|
||||
ip_addr_t ipaddr;
|
||||
unsigned int time;
|
||||
};
|
||||
|
||||
static struct delif_pbuf *input_list = NULL;
|
||||
static struct delif_pbuf *output_list = NULL;
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
delif_input_timeout(void *arg)
|
||||
{
|
||||
struct netif *netif;
|
||||
struct delif *delif;
|
||||
struct delif_pbuf *dp;
|
||||
unsigned int timeout, now;
|
||||
|
||||
timeout = DELIF_TIMEOUT;
|
||||
|
||||
netif = (struct netif*)arg;
|
||||
delif = (struct delif*)netif->state;
|
||||
|
||||
/* Check if there is anything on the input list. */
|
||||
dp = input_list;
|
||||
while (dp != NULL) {
|
||||
now = sys_now();
|
||||
|
||||
if (dp->time <= now) {
|
||||
delif->input(dp->p, netif);
|
||||
if (dp->next != NULL) {
|
||||
if (dp->next->time > now) {
|
||||
timeout = dp->next->time - now;
|
||||
} else {
|
||||
timeout = 0;
|
||||
}
|
||||
LWIP_DEBUGF(DELIF_DEBUG, ("delif_output_timeout: timeout %u.\n", timeout));
|
||||
|
||||
}
|
||||
input_list = dp->next;
|
||||
free(dp);
|
||||
dp = input_list;
|
||||
} else {
|
||||
dp = dp->next;
|
||||
}
|
||||
}
|
||||
|
||||
sys_timeout(timeout, delif_input_timeout, arg);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
delif_output_timeout(void *arg)
|
||||
{
|
||||
struct netif *netif;
|
||||
struct delif *delif;
|
||||
struct delif_pbuf *dp;
|
||||
unsigned int timeout, now;
|
||||
|
||||
timeout = DELIF_TIMEOUT;
|
||||
|
||||
netif = (struct netif*)arg;
|
||||
delif = (struct delif*)netif->state;
|
||||
|
||||
/* Check if there is anything on the output list. */
|
||||
dp = output_list;
|
||||
while (dp != NULL) {
|
||||
now = sys_now();
|
||||
if (dp->time <= now) {
|
||||
LWIP_DEBUGF(DELIF_DEBUG, ("delif_output_timeout: now %u dp->time %u\n",
|
||||
now, dp->time));
|
||||
|
||||
#if LWIP_IPV4
|
||||
if(!IP_IS_V6_VAL(dp->ipaddr)) {
|
||||
delif->netif->output(delif->netif, dp->p, ip_2_ip4(&dp->ipaddr));
|
||||
}
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
#if LWIP_IPV6
|
||||
if(IP_IS_V6_VAL(dp->ipaddr)) {
|
||||
delif->netif->output_ip6(delif->netif, dp->p, ip_2_ip6(&dp->ipaddr));
|
||||
}
|
||||
#endif /* LWIP_IPV6 */
|
||||
|
||||
if (dp->next != NULL) {
|
||||
if (dp->next->time > now) {
|
||||
timeout = dp->next->time - now;
|
||||
} else {
|
||||
timeout = 0;
|
||||
}
|
||||
LWIP_DEBUGF(DELIF_DEBUG, ("delif_output_timeout: timeout %u.\n", timeout));
|
||||
|
||||
}
|
||||
pbuf_free(dp->p);
|
||||
|
||||
output_list = dp->next;
|
||||
free(dp);
|
||||
dp = output_list;
|
||||
} else {
|
||||
dp = dp->next;
|
||||
}
|
||||
}
|
||||
|
||||
sys_timeout(timeout, delif_output_timeout, arg);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static err_t
|
||||
delif_output(struct netif *netif, struct pbuf *p, const ip_addr_t *ipaddr)
|
||||
{
|
||||
struct delif_pbuf *dp, *np;
|
||||
char *data;
|
||||
|
||||
LWIP_UNUSED_ARG(netif);
|
||||
|
||||
LWIP_DEBUGF(DELIF_DEBUG, ("delif_output\n"));
|
||||
|
||||
#ifdef DELIF_OUTPUT_DROPRATE
|
||||
if (((double)rand()/(double)RAND_MAX) < DELIF_OUTPUT_DROPRATE) {
|
||||
LWIP_DEBUGF(DELIF_DEBUG, ("delif_output: Packet dropped\n"));
|
||||
return ERR_BUF;
|
||||
}
|
||||
#endif /* DELIF_OUTPUT_DROPRATE */
|
||||
|
||||
LWIP_DEBUGF(DELIF_DEBUG, ("delif_output\n"));
|
||||
|
||||
dp = (struct delif_pbuf*)malloc(sizeof(struct delif_pbuf));
|
||||
data = (char*)malloc(p->tot_len);
|
||||
|
||||
pbuf_copy_partial(p, data, p->tot_len, 0);
|
||||
|
||||
dp->p = pbuf_alloc(PBUF_LINK, 0, PBUF_ROM);
|
||||
dp->p->payload = data;
|
||||
dp->p->len = p->tot_len;
|
||||
dp->p->tot_len = p->tot_len;
|
||||
dp->ipaddr = *ipaddr;
|
||||
dp->time = sys_now() + DELIF_OUTPUT_DELAY;
|
||||
dp->next = NULL;
|
||||
if (output_list == NULL) {
|
||||
output_list = dp;
|
||||
} else {
|
||||
for(np = output_list; np->next != NULL; np = np->next);
|
||||
np->next = dp;
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
#if LWIP_IPV4
|
||||
static err_t
|
||||
delif_output4(struct netif *netif, struct pbuf *p, const ip4_addr_t *ipaddr)
|
||||
{
|
||||
ip_addr_t ip;
|
||||
if (ipaddr != NULL) {
|
||||
ip_addr_copy_from_ip4(ip, *ipaddr);
|
||||
} else {
|
||||
ip = *IP_ADDR_ANY;
|
||||
}
|
||||
return delif_output(netif, p, &ip);
|
||||
}
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
#if LWIP_IPV6
|
||||
static err_t
|
||||
delif_output6(struct netif *netif, struct pbuf *p, const ip6_addr_t *ipaddr)
|
||||
{
|
||||
ip_addr_t ip;
|
||||
if (ipaddr != NULL) {
|
||||
ip_addr_copy_from_ip6(ip, *ipaddr);
|
||||
} else {
|
||||
ip = *IP6_ADDR_ANY;
|
||||
}
|
||||
return delif_output(netif, p, &ip);
|
||||
}
|
||||
#endif /* LWIP_IPV6 */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static err_t
|
||||
delif_input(struct pbuf *p, struct netif *inp)
|
||||
{
|
||||
struct delif_pbuf *dp, *np;
|
||||
|
||||
LWIP_UNUSED_ARG(inp);
|
||||
|
||||
LWIP_DEBUGF(DELIF_DEBUG, ("delif_input\n"));
|
||||
#ifdef DELIF_INPUT_DROPRATE
|
||||
if (((double)rand()/(double)RAND_MAX) < DELIF_INPUT_DROPRATE) {
|
||||
LWIP_DEBUGF(DELIF_DEBUG, ("delif_input: Packet dropped\n"));
|
||||
pbuf_free(p);
|
||||
return ERR_OK;
|
||||
}
|
||||
#endif /* DELIF_INPUT_DROPRATE */
|
||||
|
||||
dp = (struct delif_pbuf*)malloc(sizeof(struct delif_pbuf));
|
||||
dp->p = p;
|
||||
dp->time = sys_now() + DELIF_INPUT_DELAY;
|
||||
dp->next = NULL;
|
||||
|
||||
if (input_list == NULL) {
|
||||
input_list = dp;
|
||||
} else {
|
||||
for(np = input_list; np->next != NULL; np = np->next);
|
||||
np->next = dp;
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
err_t
|
||||
delif_init(struct netif *netif)
|
||||
{
|
||||
struct delif *del;
|
||||
|
||||
del = (struct delif*)malloc(sizeof(struct delif));
|
||||
if (!del) {
|
||||
return ERR_MEM;
|
||||
}
|
||||
netif->state = del;
|
||||
netif->name[0] = 'd';
|
||||
netif->name[1] = 'e';
|
||||
|
||||
#if LWIP_IPV4
|
||||
netif->output = delif_output4;
|
||||
#endif /* LWIP_IPV4 */
|
||||
#if LWIP_IPV6
|
||||
netif->output_ip6 = delif_output6;
|
||||
#endif /* LWIP_IPV6 */
|
||||
|
||||
del->netif = (struct netif*)malloc(sizeof(struct netif));
|
||||
if (!del->netif) {
|
||||
free(del);
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
#ifdef LWIP_UNIX_LINUX
|
||||
tapif_init(del->netif);
|
||||
#else /* LWIP_UNIX_LINUX */
|
||||
tunif_init(del->netif);
|
||||
#endif /* LWIP_UNIX_LINUX */
|
||||
|
||||
del->input = netif->input;
|
||||
del->netif->input = delif_input;
|
||||
|
||||
sys_timeout(DELIF_TIMEOUT, delif_input_timeout, netif);
|
||||
sys_timeout(DELIF_TIMEOUT, delif_output_timeout, netif);
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
delif_thread(void *arg)
|
||||
{
|
||||
struct netif *netif = (struct netif*)arg;
|
||||
struct delif *del;
|
||||
sys_sem_t sem;
|
||||
|
||||
del = (struct delif*)netif->state;
|
||||
#ifdef LWIP_UNIX_LINUX
|
||||
tapif_init(del->netif);
|
||||
#else /* LWIP_UNIX_LINUX */
|
||||
tunif_init(del->netif);
|
||||
#endif /* LWIP_UNIX_LINUX */
|
||||
|
||||
sys_timeout(DELIF_TIMEOUT, delif_input_timeout, netif);
|
||||
sys_timeout(DELIF_TIMEOUT, delif_output_timeout, netif);
|
||||
|
||||
if(sys_sem_new(&sem, 0) != ERR_OK) {
|
||||
LWIP_ASSERT("Failed to create semaphore", 0);
|
||||
}
|
||||
sys_sem_wait(&sem);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
err_t
|
||||
delif_init_thread(struct netif *netif)
|
||||
{
|
||||
struct delif *del;
|
||||
|
||||
LWIP_DEBUGF(DELIF_DEBUG, ("delif_init_thread\n"));
|
||||
|
||||
del = (struct delif*)malloc(sizeof(struct delif));
|
||||
if (!del) {
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
netif->state = del;
|
||||
netif->name[0] = 'd';
|
||||
netif->name[1] = 'e';
|
||||
|
||||
del->netif = (struct netif*)malloc(sizeof(struct netif));
|
||||
if (!del->netif) {
|
||||
free(del);
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
#if LWIP_IPV4
|
||||
netif->output = delif_output4;
|
||||
netif_set_addr(del->netif, netif_ip4_addr(netif), netif_ip4_netmask(netif), netif_ip4_gw(netif));
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
#if LWIP_IPV6
|
||||
{
|
||||
s8_t i;
|
||||
netif->output_ip6 = delif_output6;
|
||||
for(i=0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
|
||||
netif_ip6_addr_set(del->netif, i, netif_ip6_addr(netif, i));
|
||||
}
|
||||
}
|
||||
#endif /* LWIP_IPV6 */
|
||||
|
||||
del->input = netif->input;
|
||||
del->netif->input = delif_input;
|
||||
|
||||
sys_thread_new("delif_thread", delif_thread, netif, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO);
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#endif /* !NO_SYS */
|
||||
@@ -1,139 +0,0 @@
|
||||
/* Author: Magnus Ivarsson <magnus.ivarsson@volvo.com> */
|
||||
|
||||
/* ---------------------------------------------- */
|
||||
/* --- fifo 4 unix ------------------------------ */
|
||||
/* ---------------------------------------------- */
|
||||
#include "lwip/err.h"
|
||||
#include "netif/fifo.h"
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/arch.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef SIO_FIFO_DEBUG
|
||||
#define SIO_FIFO_DEBUG LWIP_DBG_OFF
|
||||
#endif
|
||||
|
||||
u8_t fifoGet(fifo_t * fifo)
|
||||
{
|
||||
u8_t c;
|
||||
|
||||
sys_sem_wait(&fifo->sem); /* enter critical section */
|
||||
|
||||
if (fifo->dataslot == fifo->emptyslot)
|
||||
{
|
||||
fifo->getWaiting = TRUE; /* tell putFifo to signal us when data is available */
|
||||
sys_sem_signal(&fifo->sem); /* leave critical section (allow input from serial port..) */
|
||||
sys_sem_wait(&fifo->getSem); /* wait 4 data */
|
||||
sys_sem_wait(&fifo->sem); /* reenter critical section */
|
||||
}
|
||||
|
||||
c = fifo->data[fifo->dataslot++];
|
||||
fifo->len--;
|
||||
|
||||
if (fifo->dataslot == FIFOSIZE)
|
||||
{
|
||||
fifo->dataslot = 0;
|
||||
}
|
||||
sys_sem_signal(&fifo->sem); /* leave critical section */
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
s16_t fifoGetNonBlock(fifo_t * fifo)
|
||||
{
|
||||
u16_t c;
|
||||
|
||||
sys_sem_wait(&fifo->sem); /* enter critical section */
|
||||
|
||||
if (fifo->dataslot == fifo->emptyslot)
|
||||
{
|
||||
/* empty fifo */
|
||||
c = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
c = fifo->data[fifo->dataslot++];
|
||||
fifo->len--;
|
||||
|
||||
if (fifo->dataslot == FIFOSIZE)
|
||||
{
|
||||
fifo->dataslot = 0;
|
||||
}
|
||||
}
|
||||
sys_sem_signal(&fifo->sem); /* leave critical section */
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
void fifoPut(fifo_t * fifo, int fd)
|
||||
{
|
||||
/* FIXME: mutex around struct data.. */
|
||||
int cnt=0;
|
||||
|
||||
sys_sem_wait(&fifo->sem ); /* enter critical */
|
||||
|
||||
LWIP_DEBUGF( SIO_FIFO_DEBUG,("fifoput: len%d dat%d empt%d --> ", fifo->len, fifo->dataslot, fifo->emptyslot ) );
|
||||
|
||||
if ( fifo->emptyslot < fifo->dataslot )
|
||||
{
|
||||
cnt = read( fd, &fifo->data[fifo->emptyslot], fifo->dataslot - fifo->emptyslot );
|
||||
}
|
||||
else
|
||||
{
|
||||
cnt = read( fd, &fifo->data[fifo->emptyslot], FIFOSIZE-fifo->emptyslot );
|
||||
}
|
||||
fifo->emptyslot += cnt;
|
||||
fifo->len += cnt;
|
||||
|
||||
LWIP_DEBUGF( SIO_FIFO_DEBUG,("len%d dat%d empt%d\n", fifo->len, fifo->dataslot, fifo->emptyslot ) );
|
||||
|
||||
if ( fifo->len > FIFOSIZE )
|
||||
{
|
||||
printf( "ERROR: fifo overrun detected len=%d, flushing\n", fifo->len );
|
||||
fifo->dataslot = 0;
|
||||
fifo->emptyslot = 0;
|
||||
fifo->len = 0;
|
||||
}
|
||||
|
||||
if ( fifo->emptyslot == FIFOSIZE )
|
||||
{
|
||||
fifo->emptyslot = 0;
|
||||
LWIP_DEBUGF( SIO_FIFO_DEBUG, ("(WRAP) ") );
|
||||
|
||||
sys_sem_signal(&fifo->sem ); /* leave critical */
|
||||
fifoPut( fifo, fd );
|
||||
return;
|
||||
}
|
||||
if ( fifo->getWaiting )
|
||||
{
|
||||
fifo->getWaiting = FALSE;
|
||||
sys_sem_signal(&fifo->getSem );
|
||||
}
|
||||
|
||||
sys_sem_signal(&fifo->sem ); /* leave critical */
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void fifoInit(fifo_t * fifo)
|
||||
{
|
||||
fifo->dataslot = 0;
|
||||
fifo->emptyslot = 0;
|
||||
fifo->len = 0;
|
||||
if(sys_sem_new(&fifo->sem, 1) != ERR_OK) { /* critical section 1=free to enter */
|
||||
LWIP_ASSERT("Failed to create semaphore", 0);
|
||||
}
|
||||
if(sys_sem_new(&fifo->getSem, 0) != ERR_OK) { /* 0 = no one waiting */
|
||||
LWIP_ASSERT("Failed to create semaphore", 0);
|
||||
}
|
||||
fifo->getWaiting = FALSE;
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <netif/list.h>
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
struct list *
|
||||
list_new(int size)
|
||||
{
|
||||
struct list *list;
|
||||
list = (struct list *)malloc(sizeof(struct list));
|
||||
list->first = list->last = NULL;
|
||||
list->size = size;
|
||||
list->elems = 0;
|
||||
return list;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
int
|
||||
list_push(struct list *list, void *data)
|
||||
{
|
||||
struct elem *elem;
|
||||
|
||||
if (list->elems < list->size) {
|
||||
elem = (struct elem *)malloc(sizeof(struct elem));
|
||||
elem->data = data;
|
||||
elem->next = NULL;
|
||||
if (list->last != NULL) {
|
||||
list->last->next = elem;
|
||||
}
|
||||
list->last = elem;
|
||||
if (list->first == NULL) {
|
||||
list->first = elem;
|
||||
}
|
||||
list->elems++;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void *
|
||||
list_pop(struct list *list)
|
||||
{
|
||||
struct elem *elem;
|
||||
void *data;
|
||||
|
||||
if (list->elems > 0) {
|
||||
elem = list->first;
|
||||
if (elem == list->last) {
|
||||
list->last = elem->next;
|
||||
}
|
||||
list->first = elem->next;
|
||||
|
||||
list->elems--;
|
||||
|
||||
data = elem->data;
|
||||
free(elem);
|
||||
|
||||
return data;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void *
|
||||
list_first(struct list *list)
|
||||
{
|
||||
return list->first;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
int
|
||||
list_elems(struct list *list)
|
||||
{
|
||||
return list->elems;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
list_delete(struct list *list)
|
||||
{
|
||||
while (list_pop(list) != NULL);
|
||||
free(list);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
int
|
||||
list_remove(struct list *list, void *elem)
|
||||
{
|
||||
struct elem *e, *p;
|
||||
|
||||
p = NULL;
|
||||
for(e = list->first; e != NULL; e = e->next) {
|
||||
if (e->data == elem) {
|
||||
if (p != NULL) {
|
||||
p->next = e->next;
|
||||
} else {
|
||||
list->first = e->next;
|
||||
}
|
||||
if (list->last == e) {
|
||||
list->last = p;
|
||||
if (p != NULL) {
|
||||
p->next = NULL;
|
||||
}
|
||||
}
|
||||
free(e);
|
||||
list->elems--;
|
||||
return 1;
|
||||
}
|
||||
p = e;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
list_map(struct list *list, void (* func)(void *arg))
|
||||
{
|
||||
struct elem *e;
|
||||
|
||||
for(e = list->first; e != NULL; e = e->next) {
|
||||
func(e->data);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
@@ -1,216 +0,0 @@
|
||||
/*
|
||||
* 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 linux /* Apparently, this doesn't work under Linux. */
|
||||
|
||||
#include "lwip/debug.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/stat.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <pcap.h>
|
||||
|
||||
#include "netif/etharp.h"
|
||||
|
||||
#include "lwip/stats.h"
|
||||
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/pbuf.h"
|
||||
#include "netif/unixif.h"
|
||||
#include "lwip/sys.h"
|
||||
|
||||
#include "lwip/ip.h"
|
||||
|
||||
|
||||
#if defined(LWIP_DEBUG) && defined(LWIP_TCPDUMP)
|
||||
#include "netif/tcpdump.h"
|
||||
#endif /* LWIP_DEBUG && LWIP_TCPDUMP */
|
||||
|
||||
struct pcapif {
|
||||
pcap_t *pd;
|
||||
sys_sem_t sem;
|
||||
u8_t pkt[2048];
|
||||
u32_t len;
|
||||
u32_t lasttime;
|
||||
struct pbuf *p;
|
||||
struct eth_addr *ethaddr;
|
||||
};
|
||||
|
||||
static char errbuf[PCAP_ERRBUF_SIZE];
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static err_t
|
||||
pcapif_output(struct netif *netif, struct pbuf *p,
|
||||
ip_addr_t *ipaddr)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
timeout(void *arg)
|
||||
{
|
||||
struct netif *netif;
|
||||
struct pcapif *pcapif;
|
||||
struct pbuf *p;
|
||||
struct eth_hdr *ethhdr;
|
||||
|
||||
netif = (struct netif *)arg;
|
||||
pcapif = netif->state;
|
||||
ethhdr = (struct eth_hdr *)pcapif->pkt;
|
||||
|
||||
|
||||
if (lwip_htons(ethhdr->type) != ETHTYPE_IP ||
|
||||
ip_lookup(pcapif->pkt + 14, netif)) {
|
||||
|
||||
/* We allocate a pbuf chain of pbufs from the pool. */
|
||||
p = pbuf_alloc(PBUF_LINK, pcapif->len, PBUF_POOL);
|
||||
|
||||
if (p != NULL) {
|
||||
pbuf_take(p, pcapif->pkt, pcapif->len);
|
||||
|
||||
#if defined(LWIP_DEBUG) && defined(LWIP_TCPDUMP)
|
||||
tcpdump(p, netif);
|
||||
#endif /* LWIP_DEBUG && LWIP_TCPDUMP */
|
||||
|
||||
ethhdr = p->payload;
|
||||
switch (lwip_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);
|
||||
p = NULL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
pbuf_free(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printf("ip_lookup dropped\n");
|
||||
}
|
||||
|
||||
sys_sem_signal(&pcapif->sem);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
callback(u_char *arg, const struct pcap_pkthdr *hdr, const u_char *pkt)
|
||||
{
|
||||
struct netif *netif;
|
||||
struct pcapif *pcapif;
|
||||
u32_t time, lasttime;
|
||||
|
||||
netif = (struct netif *)arg;
|
||||
pcapif = netif->state;
|
||||
|
||||
pcapif->len = hdr->len;
|
||||
|
||||
bcopy(pkt, pcapif->pkt, hdr->len);
|
||||
|
||||
time = hdr->ts.tv_sec * 1000 + hdr->ts.tv_usec / 1000;
|
||||
|
||||
lasttime = pcapif->lasttime;
|
||||
pcapif->lasttime = time;
|
||||
|
||||
|
||||
if (lasttime == 0) {
|
||||
sys_timeout(1000, timeout, netif);
|
||||
} else {
|
||||
sys_timeout(time - lasttime, timeout, netif);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
pcapif_thread(void *arg)
|
||||
{
|
||||
struct netif *netif;
|
||||
struct pcapif *pcapif;
|
||||
netif = arg;
|
||||
pcapif = netif->state;
|
||||
|
||||
while (1) {
|
||||
pcap_loop(pcapif->pd, 1, callback, (u_char *)netif);
|
||||
sys_sem_wait(&pcapif->sem);
|
||||
if (pcapif->p != NULL) {
|
||||
netif->input(pcapif->p, netif);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
err_t
|
||||
pcapif_init(struct netif *netif)
|
||||
{
|
||||
struct pcapif *p;
|
||||
|
||||
p = malloc(sizeof(struct pcapif));
|
||||
if (p == NULL)
|
||||
return ERR_MEM;
|
||||
netif->state = p;
|
||||
netif->name[0] = 'p';
|
||||
netif->name[1] = 'c';
|
||||
netif->output = pcapif_output;
|
||||
|
||||
p->pd = pcap_open_offline("pcapdump", errbuf);
|
||||
if (p->pd == NULL) {
|
||||
printf("pcapif_init: failed %s\n", errbuf);
|
||||
return ERR_IF;
|
||||
}
|
||||
|
||||
if(sys_sem_new(&p->sem, 0) != ERR_OK) {
|
||||
LWIP_ASSERT("Failed to create semaphore", 0);
|
||||
}
|
||||
p->p = NULL;
|
||||
p->lasttime = 0;
|
||||
|
||||
sys_thread_new("pcapif_thread", pcapif_thread, netif, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO);
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
#endif /* linux */
|
||||
@@ -1,481 +0,0 @@
|
||||
/* Author: Magnus Ivarsson <magnus.ivarsson@volvo.com> */
|
||||
|
||||
/* to get rid of implicit function declarations */
|
||||
#define _XOPEN_SOURCE 600
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "netif/sio.h"
|
||||
#include "netif/fifo.h"
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/arch.h"
|
||||
#include "lwip/sio.h"
|
||||
#include "netif/ppp/ppp_opts.h"
|
||||
|
||||
/* Following #undefs are here to keep compiler from issuing warnings
|
||||
about them being double defined. (They are defined in lwip/inet.h
|
||||
as well as the Unix #includes below.) */
|
||||
#undef htonl
|
||||
#undef ntohl
|
||||
#undef htons
|
||||
#undef ntohs
|
||||
#undef HTONL
|
||||
#undef NTOHL
|
||||
#undef HTONS
|
||||
#undef NTOHS
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#if defined(LWIP_UNIX_OPENBSD)
|
||||
#include <util.h>
|
||||
#endif
|
||||
#include <termios.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef LWIP_HAVE_SLIPIF
|
||||
#define LWIP_HAVE_SLIPIF 0
|
||||
#endif
|
||||
|
||||
#if (PPP_SUPPORT || LWIP_HAVE_SLIPIF) && defined(LWIP_UNIX_LINUX)
|
||||
#include <pty.h>
|
||||
#endif
|
||||
|
||||
/*#define BAUDRATE B19200 */
|
||||
/*#define BAUDRATE B57600 */
|
||||
#define BAUDRATE B115200
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
/* for all of you who dont define SIO_DEBUG in debug.h */
|
||||
#ifndef SIO_DEBUG
|
||||
#define SIO_DEBUG 0
|
||||
#endif
|
||||
|
||||
|
||||
/* typedef struct siostruct_t */
|
||||
/* { */
|
||||
/* sio_status_t *sio; */
|
||||
/* } siostruct_t; */
|
||||
|
||||
/** array of ((siostruct*)netif->state)->sio structs */
|
||||
static sio_status_t statusar[4];
|
||||
|
||||
#if ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF)
|
||||
/* --private-functions----------------------------------------------------------------- */
|
||||
/**
|
||||
* Signal handler for ttyXX0 to indicate bytes received
|
||||
* one per interface is needed since we cannot send a instance number / pointer as callback argument (?)
|
||||
*/
|
||||
static void signal_handler_IO_0( int status )
|
||||
{
|
||||
LWIP_UNUSED_ARG(status);
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("SigHand: rxSignal channel 0\n"));
|
||||
fifoPut( &statusar[0].myfifo, statusar[0].fd );
|
||||
}
|
||||
|
||||
/**
|
||||
* Signal handler for ttyXX1 to indicate bytes received
|
||||
* one per interface is needed since we cannot send a instance number / pointer as callback argument (?)
|
||||
*/
|
||||
static void signal_handler_IO_1( int status )
|
||||
{
|
||||
LWIP_UNUSED_ARG(status);
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("SigHand: rxSignal channel 1\n"));
|
||||
fifoPut( &statusar[1].myfifo, statusar[1].fd );
|
||||
}
|
||||
#endif /* ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF) */
|
||||
|
||||
/**
|
||||
* Initiation of serial device
|
||||
* @param device string with the device name and path, eg. "/dev/ttyS0"
|
||||
* @param devnum device number
|
||||
* @param siostat status
|
||||
* @return file handle to serial dev.
|
||||
*/
|
||||
static int sio_init( char * device, int devnum, sio_status_t * siostat )
|
||||
{
|
||||
struct termios oldtio,newtio;
|
||||
#if ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF)
|
||||
struct sigaction saio; /* definition of signal action */
|
||||
#endif
|
||||
int fd;
|
||||
LWIP_UNUSED_ARG(siostat);
|
||||
LWIP_UNUSED_ARG(devnum);
|
||||
|
||||
/* open the device to be non-blocking (read will return immediately) */
|
||||
fd = open( device, O_RDWR | O_NOCTTY | O_NONBLOCK );
|
||||
if ( fd < 0 )
|
||||
{
|
||||
perror( device );
|
||||
exit( -1 );
|
||||
}
|
||||
|
||||
#if ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF)
|
||||
/* install the signal handler before making the device asynchronous */
|
||||
switch ( devnum )
|
||||
{
|
||||
case 0:
|
||||
LWIP_DEBUGF( SIO_DEBUG, ("sioinit, signal_handler_IO_0\n") );
|
||||
saio.sa_handler = signal_handler_IO_0;
|
||||
break;
|
||||
case 1:
|
||||
LWIP_DEBUGF( SIO_DEBUG, ("sioinit, signal_handler_IO_1\n") );
|
||||
saio.sa_handler = signal_handler_IO_1;
|
||||
break;
|
||||
default:
|
||||
LWIP_DEBUGF( SIO_DEBUG,("sioinit, devnum not allowed\n") );
|
||||
break;
|
||||
}
|
||||
|
||||
saio.sa_flags = 0;
|
||||
#if defined(LWIP_UNIX_LINUX)
|
||||
saio.sa_restorer = NULL;
|
||||
#endif /* LWIP_UNIX_LINUX */
|
||||
sigaction( SIGIO,&saio,NULL );
|
||||
|
||||
/* allow the process to receive SIGIO */
|
||||
if ( fcntl( fd, F_SETOWN, getpid( ) ) != 0)
|
||||
{
|
||||
perror( device );
|
||||
exit( -1 );
|
||||
}
|
||||
/* Make the file descriptor asynchronous (the manual page says only
|
||||
O_APPEND and O_NONBLOCK, will work with F_SETFL...) */
|
||||
if ( fcntl( fd, F_SETFL, FASYNC ) != 0)
|
||||
{
|
||||
perror( device );
|
||||
exit( -1 );
|
||||
}
|
||||
#else
|
||||
if ( fcntl( fd, F_SETFL, 0 ) != 0)
|
||||
{
|
||||
perror( device );
|
||||
exit( -1 );
|
||||
}
|
||||
|
||||
#endif /* ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF) */
|
||||
|
||||
tcgetattr( fd,&oldtio ); /* save current port settings */
|
||||
/* set new port settings */
|
||||
/* see 'man termios' for further settings */
|
||||
memset(&newtio, 0, sizeof(newtio));
|
||||
newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD | CRTSCTS;
|
||||
newtio.c_iflag = 0;
|
||||
newtio.c_oflag = 0;
|
||||
newtio.c_lflag = 0; /*ECHO; */
|
||||
newtio.c_cc[VMIN] = 1; /* Read 1 byte at a time, no timer */
|
||||
newtio.c_cc[VTIME] = 0;
|
||||
|
||||
tcsetattr( fd,TCSANOW,&newtio );
|
||||
tcflush( fd, TCIOFLUSH );
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void sio_speed( int fd, int speed )
|
||||
{
|
||||
struct termios oldtio,newtio;
|
||||
/* int fd; */
|
||||
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_speed[%d]: baudcode:%d enter\n", fd, speed));
|
||||
|
||||
if ( fd < 0 )
|
||||
{
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_speed[%d]: fd ERROR\n", fd));
|
||||
exit( -1 );
|
||||
}
|
||||
|
||||
tcgetattr( fd,&oldtio ); /* get current port settings */
|
||||
|
||||
/* set new port settings
|
||||
* see 'man termios' for further settings */
|
||||
memset(&newtio, 0, sizeof(newtio));
|
||||
newtio.c_cflag = speed | CS8 | CLOCAL | CREAD; /* | CRTSCTS; */
|
||||
newtio.c_iflag = 0;
|
||||
newtio.c_oflag = 0;
|
||||
newtio.c_lflag = 0; /*ECHO; */
|
||||
newtio.c_cc[VMIN] = 1; /* Read 1 byte at a time, no timer */
|
||||
newtio.c_cc[VTIME] = 0;
|
||||
|
||||
tcsetattr( fd,TCSANOW,&newtio );
|
||||
tcflush( fd, TCIOFLUSH );
|
||||
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_speed[%d]: leave\n", fd));
|
||||
}
|
||||
|
||||
/* --public-functions----------------------------------------------------------------------------- */
|
||||
void sio_send( u8_t c, sio_status_t * siostat )
|
||||
{
|
||||
/* sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; */
|
||||
|
||||
if ( write( siostat->fd, &c, 1 ) <= 0 )
|
||||
{
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_send[%d]: write refused\n", siostat->fd));
|
||||
}
|
||||
}
|
||||
|
||||
void sio_send_string( u8_t *str, sio_status_t * siostat )
|
||||
{
|
||||
/* sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; */
|
||||
int len = strlen( (const char *)str );
|
||||
|
||||
if ( write( siostat->fd, str, len ) <= 0 )
|
||||
{
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_send_string[%d]: write refused\n", siostat->fd));
|
||||
}
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_send_string[%d]: sent: %s\n", siostat->fd, str));
|
||||
}
|
||||
|
||||
|
||||
void sio_flush( sio_status_t * siostat )
|
||||
{
|
||||
LWIP_UNUSED_ARG(siostat);
|
||||
/* not implemented in unix as it is not needed */
|
||||
/*sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; */
|
||||
}
|
||||
|
||||
|
||||
#if ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF)
|
||||
/*u8_t sio_recv( struct netif * netif )*/
|
||||
u8_t sio_recv( sio_status_t * siostat )
|
||||
{
|
||||
/* sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; */
|
||||
return fifoGet( &(siostat->myfifo) );
|
||||
}
|
||||
|
||||
s16_t sio_poll(sio_status_t * siostat)
|
||||
{
|
||||
/* sio_status_t * siostat = ((siostruct_t*)netif->state)->sio;*/
|
||||
return fifoGetNonBlock( &(siostat->myfifo) );
|
||||
}
|
||||
|
||||
|
||||
void sio_expect_string( u8_t *str, sio_status_t * siostat )
|
||||
{
|
||||
/* sio_status_t * siostat = ((siostruct_t*)netif->state)->sio;*/
|
||||
u8_t c;
|
||||
int finger=0;
|
||||
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_expect_string[%d]: %s\n", siostat->fd, str));
|
||||
while ( 1 )
|
||||
{
|
||||
c=fifoGet( &(siostat->myfifo) );
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("_%c", c));
|
||||
if ( c==str[finger] )
|
||||
{
|
||||
finger++;
|
||||
} else if ( finger > 0 )
|
||||
{
|
||||
/*it might fit in the beginning? */
|
||||
if ( str[0] == c )
|
||||
{
|
||||
finger = 1;
|
||||
}
|
||||
}
|
||||
if ( 0 == str[finger] )
|
||||
break; /* done, we have a match */
|
||||
}
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_expect_string[%d]: [match]\n", siostat->fd));
|
||||
}
|
||||
#endif /* ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF) */
|
||||
|
||||
#if (PPP_SUPPORT || LWIP_HAVE_SLIPIF)
|
||||
u32_t sio_write(sio_status_t * siostat, u8_t *buf, u32_t size)
|
||||
{
|
||||
ssize_t wsz = write( siostat->fd, buf, size );
|
||||
return wsz < 0 ? 0 : wsz;
|
||||
}
|
||||
|
||||
u32_t sio_read(sio_status_t * siostat, u8_t *buf, u32_t size)
|
||||
{
|
||||
ssize_t rsz = read( siostat->fd, buf, size );
|
||||
return rsz < 0 ? 0 : rsz;
|
||||
}
|
||||
|
||||
void sio_read_abort(sio_status_t * siostat)
|
||||
{
|
||||
LWIP_UNUSED_ARG(siostat);
|
||||
printf("sio_read_abort[%d]: not yet implemented for unix\n", siostat->fd);
|
||||
}
|
||||
#endif /* (PPP_SUPPORT || LWIP_HAVE_SLIPIF) */
|
||||
|
||||
sio_fd_t sio_open(u8_t devnum)
|
||||
{
|
||||
char dev[20];
|
||||
|
||||
/* would be nice with dynamic memory alloc */
|
||||
sio_status_t * siostate = &statusar[ devnum ];
|
||||
/* siostruct_t * tmp; */
|
||||
|
||||
|
||||
/* tmp = (siostruct_t*)(netif->state); */
|
||||
/* tmp->sio = siostate; */
|
||||
|
||||
/* tmp = (siostruct_t*)(netif->state); */
|
||||
|
||||
/* ((sio_status_t*)(tmp->sio))->fd = 0; */
|
||||
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_open: for devnum %d\n", devnum));
|
||||
|
||||
#if ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF)
|
||||
fifoInit( &siostate->myfifo );
|
||||
#endif /* ! PPP_SUPPORT */
|
||||
|
||||
snprintf( dev, sizeof(dev), "/dev/ttyS%d", devnum );
|
||||
|
||||
if ( (devnum == 1) || (devnum == 0) )
|
||||
{
|
||||
if ( ( siostate->fd = sio_init( dev, devnum, siostate ) ) == 0 )
|
||||
{
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_open: ERROR opening serial device dev=%s\n", dev));
|
||||
abort( );
|
||||
return NULL;
|
||||
}
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: dev=%s open.\n", siostate->fd, dev));
|
||||
}
|
||||
#if PPP_SUPPORT
|
||||
else if (devnum == 2) {
|
||||
pid_t childpid;
|
||||
char name[256];
|
||||
childpid = forkpty(&siostate->fd, name, NULL, NULL);
|
||||
if(childpid < 0) {
|
||||
perror("forkpty");
|
||||
exit (1);
|
||||
}
|
||||
if(childpid == 0) {
|
||||
execl("/usr/sbin/pppd", "pppd",
|
||||
"ms-dns", "198.168.100.7",
|
||||
"local", "crtscts",
|
||||
"debug",
|
||||
#ifdef LWIP_PPP_CHAP_TEST
|
||||
"auth",
|
||||
"require-chap",
|
||||
"remotename", "lwip",
|
||||
#else
|
||||
"noauth",
|
||||
#endif
|
||||
#if LWIP_IPV6
|
||||
"+ipv6",
|
||||
#endif
|
||||
"192.168.1.1:192.168.1.2",
|
||||
NULL);
|
||||
perror("execl pppd");
|
||||
exit (1);
|
||||
} else {
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: spawned pppd pid %d on %s\n",
|
||||
siostate->fd, childpid, name));
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
#if LWIP_HAVE_SLIPIF
|
||||
else if (devnum == 3) {
|
||||
pid_t childpid;
|
||||
/* create PTY pair */
|
||||
siostate->fd = posix_openpt(O_RDWR | O_NOCTTY);
|
||||
if (siostate->fd < 0) {
|
||||
perror("open pty master");
|
||||
exit (1);
|
||||
}
|
||||
if (grantpt(siostate->fd) != 0) {
|
||||
perror("grant pty master");
|
||||
exit (1);
|
||||
}
|
||||
if (unlockpt(siostate->fd) != 0) {
|
||||
perror("unlock pty master");
|
||||
exit (1);
|
||||
}
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: for %s\n",
|
||||
siostate->fd, ptsname(siostate->fd)));
|
||||
/* fork for slattach */
|
||||
childpid = fork();
|
||||
if(childpid < 0) {
|
||||
perror("fork");
|
||||
exit (1);
|
||||
}
|
||||
if(childpid == 0) {
|
||||
/* esteblish SLIP interface on host side connected to PTY slave */
|
||||
execl("/sbin/slattach", "slattach",
|
||||
"-d", "-v", "-L", "-p", "slip",
|
||||
ptsname(siostate->fd),
|
||||
NULL);
|
||||
perror("execl slattach");
|
||||
exit (1);
|
||||
} else {
|
||||
int ret;
|
||||
char buf[1024];
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: spawned slattach pid %d on %s\n",
|
||||
siostate->fd, childpid, ptsname(siostate->fd)));
|
||||
/* wait a moment for slattach startup */
|
||||
sleep(1);
|
||||
/* configure SLIP interface on host side as P2P interface */
|
||||
snprintf(buf, sizeof(buf),
|
||||
"/sbin/ifconfig sl0 mtu %d %s pointopoint %s up",
|
||||
SLIP_MAX_SIZE, "192.168.2.1", "192.168.2.2");
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: system(\"%s\");\n", siostate->fd, buf));
|
||||
ret = system(buf);
|
||||
if (ret < 0) {
|
||||
perror("ifconfig failed");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* LWIP_HAVE_SLIPIF */
|
||||
else
|
||||
{
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_open: device %s (%d) is not supported\n", dev, devnum));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return siostate;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void sio_change_baud( sioBaudrates baud, sio_status_t * siostat )
|
||||
{
|
||||
/* sio_status_t * siostat = ((siostruct_t*)netif->state)->sio;*/
|
||||
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_change_baud[%d]\n", siostat->fd));
|
||||
|
||||
switch ( baud )
|
||||
{
|
||||
case SIO_BAUD_9600:
|
||||
sio_speed( siostat->fd, B9600 );
|
||||
break;
|
||||
case SIO_BAUD_19200:
|
||||
sio_speed( siostat->fd, B19200 );
|
||||
break;
|
||||
case SIO_BAUD_38400:
|
||||
sio_speed( siostat->fd, B38400 );
|
||||
break;
|
||||
case SIO_BAUD_57600:
|
||||
sio_speed( siostat->fd, B57600 );
|
||||
break;
|
||||
case SIO_BAUD_115200:
|
||||
sio_speed( siostat->fd, B115200 );
|
||||
break;
|
||||
|
||||
default:
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_change_baud[%d]: Unknown baudrate, code:%d\n",
|
||||
siostat->fd, baud));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,424 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/ip.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/stats.h"
|
||||
#include "lwip/snmp.h"
|
||||
#include "lwip/pbuf.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/timeouts.h"
|
||||
#include "netif/etharp.h"
|
||||
#include "lwip/ethip6.h"
|
||||
|
||||
#if defined(LWIP_DEBUG) && defined(LWIP_TCPDUMP)
|
||||
#include "netif/tcpdump.h"
|
||||
#endif /* LWIP_DEBUG && LWIP_TCPDUMP */
|
||||
|
||||
#include "netif/tapif.h"
|
||||
|
||||
#define IFCONFIG_BIN "/sbin/ifconfig "
|
||||
|
||||
#if defined(LWIP_UNIX_LINUX)
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_tun.h>
|
||||
/*
|
||||
* Creating a tap interface requires special privileges. If the interfaces
|
||||
* is created in advance with `tunctl -u <user>` it can be opened as a regular
|
||||
* user. The network must already be configured. If DEVTAP_IF is defined it
|
||||
* will be opened instead of creating a new tap device.
|
||||
*
|
||||
* You can also use PRECONFIGURED_TAPIF environment variable to do so.
|
||||
*/
|
||||
#ifndef DEVTAP_DEFAULT_IF
|
||||
#define DEVTAP_DEFAULT_IF "tap0"
|
||||
#endif
|
||||
#ifndef DEVTAP
|
||||
#define DEVTAP "/dev/net/tun"
|
||||
#endif
|
||||
#define NETMASK_ARGS "netmask %d.%d.%d.%d"
|
||||
#define IFCONFIG_ARGS "tap0 inet %d.%d.%d.%d " NETMASK_ARGS
|
||||
#elif defined(LWIP_UNIX_OPENBSD)
|
||||
#define DEVTAP "/dev/tun0"
|
||||
#define NETMASK_ARGS "netmask %d.%d.%d.%d"
|
||||
#define IFCONFIG_ARGS "tun0 inet %d.%d.%d.%d " NETMASK_ARGS " link0"
|
||||
#else /* others */
|
||||
#define DEVTAP "/dev/tap0"
|
||||
#define NETMASK_ARGS "netmask %d.%d.%d.%d"
|
||||
#define IFCONFIG_ARGS "tap0 inet %d.%d.%d.%d " NETMASK_ARGS
|
||||
#endif
|
||||
|
||||
/* Define those to better describe your network interface. */
|
||||
#define IFNAME0 't'
|
||||
#define IFNAME1 'p'
|
||||
|
||||
#ifndef TAPIF_DEBUG
|
||||
#define TAPIF_DEBUG LWIP_DBG_OFF
|
||||
#endif
|
||||
|
||||
struct tapif {
|
||||
/* Add whatever per-interface state that is needed here. */
|
||||
int fd;
|
||||
};
|
||||
|
||||
/* Forward declarations. */
|
||||
static void tapif_input(struct netif *netif);
|
||||
#if !NO_SYS
|
||||
static void tapif_thread(void *arg);
|
||||
#endif /* !NO_SYS */
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
low_level_init(struct netif *netif)
|
||||
{
|
||||
struct tapif *tapif;
|
||||
#if LWIP_IPV4
|
||||
int ret;
|
||||
char buf[1024];
|
||||
#endif /* LWIP_IPV4 */
|
||||
char *preconfigured_tapif = getenv("PRECONFIGURED_TAPIF");
|
||||
|
||||
tapif = (struct tapif *)netif->state;
|
||||
|
||||
/* Obtain MAC address from network interface. */
|
||||
|
||||
/* (We just fake an address...) */
|
||||
netif->hwaddr[0] = 0x02;
|
||||
netif->hwaddr[1] = 0x12;
|
||||
netif->hwaddr[2] = 0x34;
|
||||
netif->hwaddr[3] = 0x56;
|
||||
netif->hwaddr[4] = 0x78;
|
||||
netif->hwaddr[5] = 0xab;
|
||||
netif->hwaddr_len = 6;
|
||||
|
||||
/* device capabilities */
|
||||
netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_IGMP;
|
||||
|
||||
tapif->fd = open(DEVTAP, O_RDWR);
|
||||
LWIP_DEBUGF(TAPIF_DEBUG, ("tapif_init: fd %d\n", tapif->fd));
|
||||
if (tapif->fd == -1) {
|
||||
#ifdef LWIP_UNIX_LINUX
|
||||
perror("tapif_init: try running \"modprobe tun\" or rebuilding your kernel with CONFIG_TUN; cannot open "DEVTAP);
|
||||
#else /* LWIP_UNIX_LINUX */
|
||||
perror("tapif_init: cannot open "DEVTAP);
|
||||
#endif /* LWIP_UNIX_LINUX */
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef LWIP_UNIX_LINUX
|
||||
{
|
||||
struct ifreq ifr;
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
|
||||
if (preconfigured_tapif) {
|
||||
strncpy(ifr.ifr_name, preconfigured_tapif, sizeof(ifr.ifr_name));
|
||||
} else {
|
||||
strncpy(ifr.ifr_name, DEVTAP_DEFAULT_IF, sizeof(ifr.ifr_name));
|
||||
}
|
||||
ifr.ifr_name[sizeof(ifr.ifr_name)-1] = 0; /* ensure \0 termination */
|
||||
|
||||
ifr.ifr_flags = IFF_TAP|IFF_NO_PI;
|
||||
if (ioctl(tapif->fd, TUNSETIFF, (void *) &ifr) < 0) {
|
||||
perror("tapif_init: "DEVTAP" ioctl TUNSETIFF");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
#endif /* LWIP_UNIX_LINUX */
|
||||
|
||||
netif_set_link_up(netif);
|
||||
|
||||
if (preconfigured_tapif == NULL) {
|
||||
#if LWIP_IPV4
|
||||
snprintf(buf, 1024, IFCONFIG_BIN IFCONFIG_ARGS,
|
||||
ip4_addr1(netif_ip4_gw(netif)),
|
||||
ip4_addr2(netif_ip4_gw(netif)),
|
||||
ip4_addr3(netif_ip4_gw(netif)),
|
||||
ip4_addr4(netif_ip4_gw(netif))
|
||||
#ifdef NETMASK_ARGS
|
||||
,
|
||||
ip4_addr1(netif_ip4_netmask(netif)),
|
||||
ip4_addr2(netif_ip4_netmask(netif)),
|
||||
ip4_addr3(netif_ip4_netmask(netif)),
|
||||
ip4_addr4(netif_ip4_netmask(netif))
|
||||
#endif /* NETMASK_ARGS */
|
||||
);
|
||||
|
||||
LWIP_DEBUGF(TAPIF_DEBUG, ("tapif_init: system(\"%s\");\n", buf));
|
||||
ret = system(buf);
|
||||
if (ret < 0) {
|
||||
perror("ifconfig failed");
|
||||
exit(1);
|
||||
}
|
||||
if (ret != 0) {
|
||||
printf("ifconfig returned %d\n", ret);
|
||||
}
|
||||
#else /* LWIP_IPV4 */
|
||||
perror("todo: support IPv6 support for non-preconfigured tapif");
|
||||
exit(1);
|
||||
#endif /* LWIP_IPV4 */
|
||||
}
|
||||
|
||||
#if !NO_SYS
|
||||
sys_thread_new("tapif_thread", tapif_thread, netif, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO);
|
||||
#endif /* !NO_SYS */
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* low_level_output():
|
||||
*
|
||||
* Should do the actual transmission of the packet. The packet is
|
||||
* contained in the pbuf that is passed to the function. This pbuf
|
||||
* might be chained.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static err_t
|
||||
low_level_output(struct netif *netif, struct pbuf *p)
|
||||
{
|
||||
struct tapif *tapif = (struct tapif *)netif->state;
|
||||
char buf[1514];
|
||||
ssize_t written;
|
||||
|
||||
#if 0
|
||||
if (((double)rand()/(double)RAND_MAX) < 0.2) {
|
||||
printf("drop output\n");
|
||||
return ERR_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* initiate transfer(); */
|
||||
pbuf_copy_partial(p, buf, p->tot_len, 0);
|
||||
|
||||
/* signal that packet should be sent(); */
|
||||
written = write(tapif->fd, buf, p->tot_len);
|
||||
if (written < 0) {
|
||||
MIB2_STATS_NETIF_INC(netif, ifoutdiscards);
|
||||
perror("tapif: write");
|
||||
}
|
||||
else {
|
||||
MIB2_STATS_NETIF_ADD(netif, ifoutoctets, (u32_t)written);
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* low_level_input():
|
||||
*
|
||||
* Should allocate a pbuf and transfer the bytes of the incoming
|
||||
* packet from the interface into the pbuf.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static struct pbuf *
|
||||
low_level_input(struct netif *netif)
|
||||
{
|
||||
struct pbuf *p;
|
||||
u16_t len;
|
||||
ssize_t readlen;
|
||||
char buf[1514];
|
||||
struct tapif *tapif = (struct tapif *)netif->state;
|
||||
|
||||
/* Obtain the size of the packet and put it into the "len"
|
||||
variable. */
|
||||
readlen = read(tapif->fd, buf, sizeof(buf));
|
||||
if (readlen < 0) {
|
||||
perror("read returned -1");
|
||||
exit(1);
|
||||
}
|
||||
len = (u16_t)readlen;
|
||||
|
||||
MIB2_STATS_NETIF_ADD(netif, ifinoctets, len);
|
||||
|
||||
#if 0
|
||||
if (((double)rand()/(double)RAND_MAX) < 0.2) {
|
||||
printf("drop\n");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We allocate a pbuf chain of pbufs from the pool. */
|
||||
p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
|
||||
if (p != NULL) {
|
||||
pbuf_take(p, buf, len);
|
||||
/* acknowledge that packet has been read(); */
|
||||
} else {
|
||||
/* drop packet(); */
|
||||
MIB2_STATS_NETIF_INC(netif, ifindiscards);
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("tapif_input: could not allocate pbuf\n"));
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* tapif_input():
|
||||
*
|
||||
* This function should be called when a packet is ready to be read
|
||||
* from the interface. It uses the function low_level_input() that
|
||||
* should handle the actual reception of bytes from the network
|
||||
* interface.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
tapif_input(struct netif *netif)
|
||||
{
|
||||
struct pbuf *p = low_level_input(netif);
|
||||
|
||||
if (p == NULL) {
|
||||
#if LINK_STATS
|
||||
LINK_STATS_INC(link.recv);
|
||||
#endif /* LINK_STATS */
|
||||
LWIP_DEBUGF(TAPIF_DEBUG, ("tapif_input: low_level_input returned NULL\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (netif->input(p, netif) != ERR_OK) {
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("tapif_input: netif input error\n"));
|
||||
pbuf_free(p);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* tapif_init():
|
||||
*
|
||||
* Should be called at the beginning of the program to set up the
|
||||
* network interface. It calls the function low_level_init() to do the
|
||||
* actual setup of the hardware.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
err_t
|
||||
tapif_init(struct netif *netif)
|
||||
{
|
||||
struct tapif *tapif = (struct tapif *)mem_malloc(sizeof(struct tapif));
|
||||
|
||||
if (tapif == NULL) {
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("tapif_init: out of memory for tapif\n"));
|
||||
return ERR_MEM;
|
||||
}
|
||||
netif->state = tapif;
|
||||
MIB2_INIT_NETIF(netif, snmp_ifType_other, 100000000);
|
||||
|
||||
netif->name[0] = IFNAME0;
|
||||
netif->name[1] = IFNAME1;
|
||||
#if LWIP_IPV4
|
||||
netif->output = etharp_output;
|
||||
#endif /* LWIP_IPV4 */
|
||||
#if LWIP_IPV6
|
||||
netif->output_ip6 = ethip6_output;
|
||||
#endif /* LWIP_IPV6 */
|
||||
netif->linkoutput = low_level_output;
|
||||
netif->mtu = 1500;
|
||||
|
||||
low_level_init(netif);
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
#if NO_SYS
|
||||
|
||||
int
|
||||
tapif_select(struct netif *netif)
|
||||
{
|
||||
fd_set fdset;
|
||||
int ret;
|
||||
struct timeval tv;
|
||||
struct tapif *tapif;
|
||||
u32_t msecs = sys_timeouts_sleeptime();
|
||||
|
||||
tapif = (struct tapif *)netif->state;
|
||||
|
||||
tv.tv_sec = msecs / 1000;
|
||||
tv.tv_usec = (msecs % 1000) * 1000;
|
||||
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(tapif->fd, &fdset);
|
||||
|
||||
ret = select(tapif->fd + 1, &fdset, NULL, NULL, &tv);
|
||||
if (ret > 0) {
|
||||
tapif_input(netif);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#else /* NO_SYS */
|
||||
|
||||
static void
|
||||
tapif_thread(void *arg)
|
||||
{
|
||||
struct netif *netif;
|
||||
struct tapif *tapif;
|
||||
fd_set fdset;
|
||||
int ret;
|
||||
|
||||
netif = (struct netif *)arg;
|
||||
tapif = (struct tapif *)netif->state;
|
||||
|
||||
while(1) {
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(tapif->fd, &fdset);
|
||||
|
||||
/* Wait for a packet to arrive. */
|
||||
ret = select(tapif->fd + 1, &fdset, NULL, NULL, NULL);
|
||||
|
||||
if(ret == 1) {
|
||||
/* Handle incoming packet. */
|
||||
tapif_input(netif);
|
||||
} else if(ret == -1) {
|
||||
perror("tapif_thread: select");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* NO_SYS */
|
||||
@@ -1,216 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#if (LWIP_IPV4 || LWIP_IPV6) && LWIP_TCP /* @todo: fix IPv6 */
|
||||
|
||||
#include <string.h> /* memcpy */
|
||||
#include "netif/tcpdump.h"
|
||||
#include "lwip/pbuf.h"
|
||||
#include "lwip/netif.h"
|
||||
#include "lwip/ip.h"
|
||||
#include "lwip/ip4.h"
|
||||
#include "lwip/ip6.h"
|
||||
#include "lwip/ip_addr.h"
|
||||
#include "lwip/priv/tcp_priv.h"
|
||||
#include "lwip/udp.h"
|
||||
#include "lwip/inet.h"
|
||||
#include "lwip/inet_chksum.h"
|
||||
|
||||
#ifndef TCPDUMP_DEBUG
|
||||
#define TCPDUMP_DEBUG LWIP_DBG_OFF
|
||||
#endif
|
||||
|
||||
static FILE *file = NULL;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
tcpdump_init(void)
|
||||
{
|
||||
#define TCPDUMP_FNAME "/tmp/tcpdump"
|
||||
file = fopen(TCPDUMP_FNAME, "w");
|
||||
if (file == NULL) {
|
||||
perror("tcpdump_init: cannot open \""TCPDUMP_FNAME"\" for writing");
|
||||
}
|
||||
LWIP_DEBUGF(TCPDUMP_DEBUG, ("tcpdump: file %s\n", TCPDUMP_FNAME));
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
tcpdump(struct pbuf *p, struct netif* netif)
|
||||
{
|
||||
#if LWIP_IPV4
|
||||
ip_addr_t src, dst;
|
||||
struct ip_hdr *iphdr;
|
||||
#if LWIP_UDP
|
||||
struct udp_hdr *udphdr;
|
||||
#endif
|
||||
#if LWIP_TCP
|
||||
struct tcp_hdr *tcphdr;
|
||||
char flags[5];
|
||||
int i;
|
||||
int len;
|
||||
int offset;
|
||||
#endif
|
||||
|
||||
LWIP_UNUSED_ARG(netif); /* in case IPv6 is disabled */
|
||||
|
||||
if (file == NULL) {
|
||||
return;
|
||||
}
|
||||
iphdr = (struct ip_hdr *)p->payload;
|
||||
|
||||
#if LWIP_IPV6
|
||||
if(IPH_V(iphdr) == 6) {
|
||||
struct ip6_hdr *ip6hdr = (struct ip6_hdr*)iphdr;
|
||||
|
||||
/* create aligned copies if IPv6 src/dest addr */
|
||||
ip6_addr_copy_from_packed(*ip_2_ip6(&src), ip6hdr->src);
|
||||
ip6_addr_assign_zone(ip_2_ip6(&src), IP6_UNKNOWN, netif);
|
||||
IP_SET_TYPE_VAL(src, IPADDR_TYPE_V6);
|
||||
|
||||
ip6_addr_copy_from_packed(*ip_2_ip6(&dst), ip6hdr->dest);
|
||||
ip6_addr_assign_zone(ip_2_ip6(&dst), IP6_UNKNOWN, netif);
|
||||
IP_SET_TYPE_VAL(dst, IPADDR_TYPE_V6);
|
||||
|
||||
fprintf(file, "%s > %s: (IPv6, unsupported) ",
|
||||
ip_ntoa(&src),
|
||||
ip_ntoa(&dst));
|
||||
return; /* not supported */
|
||||
}
|
||||
#endif
|
||||
|
||||
if(IPH_V(iphdr) == 4) {
|
||||
ip_addr_copy_from_ip4(src, iphdr->src);
|
||||
ip_addr_copy_from_ip4(dst, iphdr->dest);
|
||||
}
|
||||
|
||||
switch (IPH_PROTO(iphdr)) {
|
||||
#if LWIP_TCP
|
||||
case IP_PROTO_TCP:
|
||||
tcphdr = (struct tcp_hdr *)((char *)iphdr + IPH_HL(iphdr));
|
||||
|
||||
pbuf_header(p, -IP_HLEN);
|
||||
if (ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len, &src, &dst) != 0) {
|
||||
LWIP_DEBUGF(TCPDUMP_DEBUG, ("tcpdump: IP checksum failed!\n"));
|
||||
/*
|
||||
fprintf(file, "chksum 0x%lx ", tcphdr->chksum);
|
||||
tcphdr->chksum = 0;
|
||||
fprintf(file, "should be 0x%lx ", inet_chksum_pseudo(p, (ip_addr_t *)&(iphdr->src),
|
||||
(ip_addr_t *)&(iphdr->dest), IP_PROTO_TCP, p->tot_len));*/
|
||||
fprintf(file, "!chksum ");
|
||||
}
|
||||
|
||||
i = 0;
|
||||
if (TCPH_FLAGS(tcphdr) & TCP_SYN) {
|
||||
flags[i++] = 'S';
|
||||
}
|
||||
if (TCPH_FLAGS(tcphdr) & TCP_PSH) {
|
||||
flags[i++] = 'P';
|
||||
}
|
||||
if (TCPH_FLAGS(tcphdr) & TCP_FIN) {
|
||||
flags[i++] = 'F';
|
||||
}
|
||||
if (TCPH_FLAGS(tcphdr) & TCP_RST) {
|
||||
flags[i++] = 'R';
|
||||
}
|
||||
if (i == 0) {
|
||||
flags[i++] = '.';
|
||||
}
|
||||
flags[i++] = 0;
|
||||
|
||||
fprintf(file, "%s.%u > %s.%u: ",
|
||||
ip_ntoa(&src),
|
||||
lwip_ntohs(tcphdr->src),
|
||||
ip_ntoa(&dst),
|
||||
lwip_ntohs(tcphdr->dest));
|
||||
offset = TCPH_HDRLEN(tcphdr);
|
||||
|
||||
len = lwip_ntohs(IPH_LEN(iphdr)) - offset * 4 - IP_HLEN;
|
||||
if (len != 0 || flags[0] != '.') {
|
||||
fprintf(file, "%s %u:%u(%u) ", flags, lwip_ntohl(tcphdr->seqno),
|
||||
lwip_ntohl(tcphdr->seqno) + (u32_t)len, len);
|
||||
}
|
||||
if (TCPH_FLAGS(tcphdr) & TCP_ACK) {
|
||||
fprintf(file, "ack %u ", lwip_ntohl(tcphdr->ackno));
|
||||
}
|
||||
fprintf(file, "wnd %u\n", lwip_ntohs(tcphdr->wnd));
|
||||
|
||||
fflush(file);
|
||||
|
||||
pbuf_header(p, IP_HLEN);
|
||||
break;
|
||||
#endif /* LWIP_TCP */
|
||||
|
||||
#if LWIP_UDP
|
||||
case IP_PROTO_UDP:
|
||||
udphdr = (struct udp_hdr *)((char *)iphdr + IPH_HL(iphdr));
|
||||
|
||||
pbuf_header(p, -IP_HLEN);
|
||||
if (ip_chksum_pseudo(p, IP_PROTO_UDP, p->tot_len, &src, &dst) != 0) {
|
||||
LWIP_DEBUGF(TCPDUMP_DEBUG, ("tcpdump: IP checksum failed!\n"));
|
||||
/*
|
||||
fprintf(file, "chksum 0x%lx ", tcphdr->chksum);
|
||||
tcphdr->chksum = 0;
|
||||
fprintf(file, "should be 0x%lx ", ip_chksum_pseudo(p, &src, &dst, IP_PROTO_TCP, p->tot_len));*/
|
||||
fprintf(file, "!chksum ");
|
||||
}
|
||||
|
||||
fprintf(file, "%s.%u > %s.%u: ",
|
||||
ip_ntoa(&src),
|
||||
lwip_ntohs(udphdr->src),
|
||||
ip_ntoa(&dst),
|
||||
lwip_ntohs(udphdr->dest));
|
||||
fprintf(file, "U ");
|
||||
len = (int)(lwip_ntohs(IPH_LEN(iphdr)) - sizeof(struct udp_hdr) - IP_HLEN);
|
||||
fprintf(file, " %d\n", len);
|
||||
|
||||
fflush(file);
|
||||
|
||||
pbuf_header(p, IP_HLEN);
|
||||
break;
|
||||
#endif /* LWIP_UDP */
|
||||
default:
|
||||
LWIP_DEBUGF(TCPDUMP_DEBUG, ("unhandled IP protocol: %d\n", (int)IPH_PROTO(iphdr)));
|
||||
break;
|
||||
}
|
||||
#else
|
||||
LWIP_UNUSED_ARG(p);
|
||||
LWIP_UNUSED_ARG(netif);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* LWIP_IPV4 && LWIP_TCP */
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
@@ -1,302 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "netif/tunif.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
|
||||
#include "lwip/debug.h"
|
||||
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/ip.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/netif.h"
|
||||
#include "lwip/pbuf.h"
|
||||
#include "lwip/sys.h"
|
||||
|
||||
#if LWIP_IPV4 /* @todo: IPv6 */
|
||||
#if !NO_SYS
|
||||
|
||||
#define IFNAME0 't'
|
||||
#define IFNAME1 'n'
|
||||
|
||||
#ifndef TUNIF_DEBUG
|
||||
#define TUNIF_DEBUG LWIP_DBG_OFF
|
||||
#endif
|
||||
|
||||
#define IFCONFIG_CALL "/sbin/ifconfig tun0 inet %d.%d.%d.%d %d.%d.%d.%d"
|
||||
|
||||
struct tunif {
|
||||
/* Add whatever per-interface state that is needed here. */
|
||||
int fd;
|
||||
};
|
||||
|
||||
/* Forward declarations. */
|
||||
static void tunif_input(struct netif *netif);
|
||||
static err_t tunif_output(struct netif *netif, struct pbuf *p,
|
||||
const ip4_addr_t *ipaddr);
|
||||
|
||||
static void tunif_thread(void *data);
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
low_level_init(struct netif *netif)
|
||||
{
|
||||
struct tunif *tunif;
|
||||
char buf[sizeof(IFCONFIG_CALL) + 50];
|
||||
|
||||
tunif = (struct tunif *)netif->state;
|
||||
|
||||
/* Obtain MAC address from network interface. */
|
||||
|
||||
/* Do whatever else is needed to initialize interface. */
|
||||
|
||||
tunif->fd = open("/dev/tun0", O_RDWR);
|
||||
LWIP_DEBUGF(TUNIF_DEBUG, ("tunif_init: fd %d\n", tunif->fd));
|
||||
if (tunif->fd == -1) {
|
||||
perror("tunif_init");
|
||||
exit(1);
|
||||
}
|
||||
sprintf(buf, IFCONFIG_CALL,
|
||||
ip4_addr1(netif_ip4_gw(netif)),
|
||||
ip4_addr2(netif_ip4_gw(netif)),
|
||||
ip4_addr3(netif_ip4_gw(netif)),
|
||||
ip4_addr4(netif_ip4_gw(netif)),
|
||||
ip4_addr1(netif_ip4_addr(netif)),
|
||||
ip4_addr2(netif_ip4_addr(netif)),
|
||||
ip4_addr3(netif_ip4_addr(netif)),
|
||||
ip4_addr4(netif_ip4_addr(netif)));
|
||||
|
||||
LWIP_DEBUGF(TUNIF_DEBUG, ("tunif_init: system(\"%s\");\n", buf));
|
||||
if (system(buf) == 0) {
|
||||
sys_thread_new("tunif_thread", tunif_thread, netif, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* low_level_output():
|
||||
*
|
||||
* Should do the actual transmission of the packet. The packet is
|
||||
* contained in the pbuf that is passed to the function. This pbuf
|
||||
* might be chained.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static err_t
|
||||
low_level_output(struct tunif *tunif, struct pbuf *p)
|
||||
{
|
||||
char buf[1500];
|
||||
int rnd_val;
|
||||
|
||||
/* initiate transfer(); */
|
||||
|
||||
rnd_val = rand();
|
||||
if (((double)rnd_val/(double)RAND_MAX) < 0.4) {
|
||||
printf("drop\n");
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
pbuf_copy_partial(p, buf, p->tot_len, 0);
|
||||
|
||||
/* signal that packet should be sent(); */
|
||||
if (write(tunif->fd, buf, p->tot_len) == -1) {
|
||||
perror("tunif: write");
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* low_level_input():
|
||||
*
|
||||
* Should allocate a pbuf and transfer the bytes of the incoming
|
||||
* packet from the interface into the pbuf.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static struct pbuf *
|
||||
low_level_input(struct tunif *tunif)
|
||||
{
|
||||
struct pbuf *p;
|
||||
ssize_t len;
|
||||
char buf[1500];
|
||||
|
||||
/* Obtain the size of the packet and put it into the "len"
|
||||
variable. */
|
||||
len = read(tunif->fd, buf, sizeof(buf));
|
||||
if((len <= 0) || (len > 0xffff)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* if (((double)rand()/(double)RAND_MAX) < 0.1) {
|
||||
printf("drop\n");
|
||||
return NULL;
|
||||
}*/
|
||||
|
||||
/* We allocate a pbuf chain of pbufs from the pool. */
|
||||
p = pbuf_alloc(PBUF_LINK, (u16_t)len, PBUF_POOL);
|
||||
|
||||
if (p != NULL) {
|
||||
pbuf_take(p, buf, (u16_t)len);
|
||||
/* acknowledge that packet has been read(); */
|
||||
} else {
|
||||
/* drop packet(); */
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
tunif_thread(void *arg)
|
||||
{
|
||||
struct netif *netif;
|
||||
struct tunif *tunif;
|
||||
fd_set fdset;
|
||||
int ret;
|
||||
|
||||
netif = (struct netif *)arg;
|
||||
tunif = (struct tunif *)netif->state;
|
||||
|
||||
while (1) {
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(tunif->fd, &fdset);
|
||||
|
||||
/* Wait for a packet to arrive. */
|
||||
ret = select(tunif->fd + 1, &fdset, NULL, NULL, NULL);
|
||||
|
||||
if (ret == 1) {
|
||||
/* Handle incoming packet. */
|
||||
tunif_input(netif);
|
||||
} else if (ret == -1) {
|
||||
perror("tunif_thread: select");
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* tunif_output():
|
||||
*
|
||||
* This function is called by the TCP/IP stack when an IP packet
|
||||
* should be sent. It calls the function called low_level_output() to
|
||||
* do the actuall transmission of the packet.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static err_t
|
||||
tunif_output(struct netif *netif, struct pbuf *p,
|
||||
const ip4_addr_t *ipaddr)
|
||||
{
|
||||
struct tunif *tunif;
|
||||
LWIP_UNUSED_ARG(ipaddr);
|
||||
|
||||
tunif = (struct tunif *)netif->state;
|
||||
|
||||
return low_level_output(tunif, p);
|
||||
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* tunif_input():
|
||||
*
|
||||
* This function should be called when a packet is ready to be read
|
||||
* from the interface. It uses the function low_level_input() that
|
||||
* should handle the actual reception of bytes from the network
|
||||
* interface.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
tunif_input(struct netif *netif)
|
||||
{
|
||||
struct tunif *tunif;
|
||||
struct pbuf *p;
|
||||
|
||||
|
||||
tunif = (struct tunif *)netif->state;
|
||||
|
||||
p = low_level_input(tunif);
|
||||
|
||||
if (p == NULL) {
|
||||
LWIP_DEBUGF(TUNIF_DEBUG, ("tunif_input: low_level_input returned NULL\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* CS: ip_lookup() was removed */
|
||||
if (ip_lookup(p->payload, netif)) {
|
||||
#endif
|
||||
netif->input(p, netif);
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* tunif_init():
|
||||
*
|
||||
* Should be called at the beginning of the program to set up the
|
||||
* network interface. It calls the function low_level_init() to do the
|
||||
* actual setup of the hardware.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
err_t
|
||||
tunif_init(struct netif *netif)
|
||||
{
|
||||
struct tunif *tunif;
|
||||
|
||||
tunif = (struct tunif *)mem_malloc(sizeof(struct tunif));
|
||||
if (!tunif) {
|
||||
return ERR_MEM;
|
||||
}
|
||||
netif->state = tunif;
|
||||
netif->name[0] = IFNAME0;
|
||||
netif->name[1] = IFNAME1;
|
||||
netif->output = tunif_output;
|
||||
|
||||
|
||||
low_level_init(netif);
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#endif /* !NO_SYS */
|
||||
#endif /* LWIP_IPV4 */
|
||||
@@ -1,500 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/debug.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/stat.h>
|
||||
/*#include <netinet/in.h> */
|
||||
/*#include <arpa/inet.h> */
|
||||
|
||||
|
||||
#include "lwip/stats.h"
|
||||
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/pbuf.h"
|
||||
#include "netif/list.h"
|
||||
#include "netif/unixif.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/timeouts.h"
|
||||
|
||||
#if LWIP_IPV4 /* @todo: IPv6 */
|
||||
#if !NO_SYS
|
||||
|
||||
#include "netif/tcpdump.h"
|
||||
|
||||
#define UNIXIF_BPS 512000
|
||||
#define UNIXIF_QUEUELEN 6
|
||||
/*#define UNIXIF_DROP_FIRST */
|
||||
|
||||
#ifndef UNIXIF_DEBUG
|
||||
#define UNIXIF_DEBUG LWIP_DBG_OFF
|
||||
#endif
|
||||
|
||||
struct unixif_buf {
|
||||
struct pbuf *p;
|
||||
unsigned short len, tot_len;
|
||||
void *payload;
|
||||
};
|
||||
|
||||
struct unixif {
|
||||
int fd;
|
||||
sys_sem_t sem;
|
||||
struct list *q;
|
||||
};
|
||||
|
||||
static void unixif_thread(void *arg);
|
||||
static void unixif_thread2(void *arg);
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static int
|
||||
unix_socket_client(const char *name)
|
||||
{
|
||||
int fd;
|
||||
#if !defined(LWIP_UNIX_LINUX) && !defined(LWIP_UNIX_CYGWIN) && !defined(__CYGWIN__)
|
||||
int len;
|
||||
#endif
|
||||
struct sockaddr_un unix_addr;
|
||||
|
||||
/* create a Unix domain stream socket */
|
||||
if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
|
||||
perror("unixif: unix_socket_client: socket");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* fill socket address structure w/our address */
|
||||
memset(&unix_addr, 0, sizeof(unix_addr));
|
||||
unix_addr.sun_family = AF_UNIX;
|
||||
snprintf(unix_addr.sun_path, sizeof(unix_addr.sun_path), "%s%05d", "/var/tmp/", getpid());
|
||||
#if !defined(LWIP_UNIX_LINUX) && !defined(LWIP_UNIX_CYGWIN) && !defined(__CYGWIN__)
|
||||
len = sizeof(unix_addr.sun_len) + sizeof(unix_addr.sun_family) +
|
||||
strlen(unix_addr.sun_path) + 1;
|
||||
unix_addr.sun_len = len;
|
||||
#endif /* LWIP_UNIX_LINUX */
|
||||
|
||||
unlink(unix_addr.sun_path); /* in case it already exists */
|
||||
if (bind(fd, (struct sockaddr *) &unix_addr,
|
||||
sizeof(struct sockaddr_un)) < 0) {
|
||||
perror("unixif: unix_socket_client: socket");
|
||||
return(-1);
|
||||
}
|
||||
if (chmod(unix_addr.sun_path, S_IRWXU | S_IRWXO) < 0) {
|
||||
perror("unixif: unix_socket_client: socket");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* fill socket address structure w/server's addr */
|
||||
memset(&unix_addr, 0, sizeof(unix_addr));
|
||||
unix_addr.sun_family = AF_UNIX;
|
||||
strncpy(unix_addr.sun_path, name, sizeof(unix_addr.sun_path));
|
||||
unix_addr.sun_path[sizeof(unix_addr.sun_path)-1] = 0; /* ensure \0 termination */
|
||||
#if !defined(LWIP_UNIX_LINUX) && !defined(LWIP_UNIX_CYGWIN) && !defined(__CYGWIN__)
|
||||
len = sizeof(unix_addr.sun_len) + sizeof(unix_addr.sun_family) +
|
||||
strlen(unix_addr.sun_path) + 1;
|
||||
unix_addr.sun_len = len;
|
||||
#endif /* LWIP_UNIX_LINUX */
|
||||
if (connect(fd, (struct sockaddr *) &unix_addr,
|
||||
sizeof(struct sockaddr_un)) < 0) {
|
||||
perror("unixif: unix_socket_client: socket");
|
||||
return(-1);
|
||||
}
|
||||
return(fd);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static int
|
||||
unix_socket_server(const char *name)
|
||||
{
|
||||
int fd;
|
||||
#if !defined(LWIP_UNIX_LINUX) && !defined(LWIP_UNIX_CYGWIN) && !defined(__CYGWIN__)
|
||||
int len;
|
||||
#endif
|
||||
struct sockaddr_un unix_addr;
|
||||
|
||||
/* create a Unix domain stream socket */
|
||||
if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
|
||||
perror("unixif: unix_socket_server: socket");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
unlink(name); /* in case it already exists */
|
||||
|
||||
/* fill in socket address structure */
|
||||
memset(&unix_addr, 0, sizeof(unix_addr));
|
||||
unix_addr.sun_family = AF_UNIX;
|
||||
strncpy(unix_addr.sun_path, name, sizeof(unix_addr.sun_path));
|
||||
unix_addr.sun_path[sizeof(unix_addr.sun_path)-1] = 0; /* ensure \0 termination */
|
||||
#if !defined(LWIP_UNIX_LINUX) && !defined(LWIP_UNIX_CYGWIN) && !defined(__CYGWIN__)
|
||||
len = sizeof(unix_addr.sun_len) + sizeof(unix_addr.sun_family) +
|
||||
strlen(unix_addr.sun_path) + 1;
|
||||
unix_addr.sun_len = len;
|
||||
#endif /* LWIP_UNIX_LINUX */
|
||||
|
||||
/* bind the name to the descriptor */
|
||||
if (bind(fd, (struct sockaddr *) &unix_addr,
|
||||
sizeof(struct sockaddr_un)) < 0) {
|
||||
perror("unixif: unix_socket_server: bind");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (chmod(unix_addr.sun_path, S_IRWXU | S_IRWXO) < 0) {
|
||||
perror("unixif: unix_socket_server: chmod");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
if (listen(fd, 5) < 0) { /* tell kernel we're a server */
|
||||
perror("unixif: unix_socket_server: listen");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(fd);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
unixif_input_handler(void *data)
|
||||
{
|
||||
struct netif *netif;
|
||||
struct unixif *unixif;
|
||||
char buf[1532];
|
||||
int plen;
|
||||
ssize_t len;
|
||||
u16_t len16;
|
||||
struct pbuf *p;
|
||||
|
||||
netif = (struct netif *)data;
|
||||
unixif = (struct unixif *)netif->state;
|
||||
|
||||
len = read(unixif->fd, &plen, sizeof(int));
|
||||
if (len < 0) {
|
||||
perror("unixif_irq_handler: read");
|
||||
abort();
|
||||
}
|
||||
|
||||
LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_irq_handler: len == %d plen == %d bytes\n", (int)len, plen));
|
||||
if (len == sizeof(int)) {
|
||||
|
||||
if (plen < 20 || plen > 1500) {
|
||||
LWIP_DEBUGF(UNIXIF_DEBUG, ("plen %d!\n", plen));
|
||||
return;
|
||||
}
|
||||
|
||||
len = read(unixif->fd, buf, (size_t)plen);
|
||||
if (len < 0) {
|
||||
perror("unixif_irq_handler: read");
|
||||
abort();
|
||||
}
|
||||
if (len != plen) {
|
||||
perror("unixif_irq_handler: read len != plen");
|
||||
abort();
|
||||
}
|
||||
LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_irq_handler: read %d bytes\n", (int)len));
|
||||
len16 = (u16_t)len;
|
||||
p = pbuf_alloc(PBUF_LINK, len16, PBUF_POOL);
|
||||
|
||||
if (p != NULL) {
|
||||
pbuf_take(p, buf, len16);
|
||||
LINK_STATS_INC(link.recv);
|
||||
#if LWIP_IPV4 && LWIP_TCP
|
||||
tcpdump(p, netif);
|
||||
#endif
|
||||
netif->input(p, netif);
|
||||
} else {
|
||||
LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_irq_handler: could not allocate pbuf\n"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
unixif_thread(void *arg)
|
||||
{
|
||||
struct netif *netif;
|
||||
struct unixif *unixif;
|
||||
|
||||
LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_thread: started.\n"));
|
||||
|
||||
netif = (struct netif *)arg;
|
||||
unixif = (struct unixif *)netif->state;
|
||||
|
||||
|
||||
while (1) {
|
||||
sys_sem_wait(&unixif->sem);
|
||||
unixif_input_handler(netif);
|
||||
}
|
||||
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
unixif_thread2(void *arg)
|
||||
{
|
||||
struct netif *netif;
|
||||
struct unixif *unixif;
|
||||
fd_set fdset;
|
||||
|
||||
LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_thread2: started.\n"));
|
||||
|
||||
netif = (struct netif *)arg;
|
||||
unixif = (struct unixif *)netif->state;
|
||||
|
||||
while (1) {
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(unixif->fd, &fdset);
|
||||
|
||||
if (select(unixif->fd + 1, &fdset, NULL, NULL, NULL) > 0) {
|
||||
sys_sem_signal(&unixif->sem);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void unixif_output_timeout(void *arg);
|
||||
|
||||
static err_t
|
||||
unixif_output(struct netif *netif, struct pbuf *p, const ip4_addr_t *ipaddr)
|
||||
{
|
||||
struct unixif *unixif;
|
||||
struct unixif_buf *buf;
|
||||
LWIP_UNUSED_ARG(ipaddr);
|
||||
|
||||
unixif = (struct unixif *)netif->state;
|
||||
|
||||
buf = (struct unixif_buf *)malloc(sizeof(struct unixif_buf));
|
||||
buf->p = p;
|
||||
buf->len = p->len;
|
||||
buf->tot_len = p->tot_len;
|
||||
buf->payload = p->payload;
|
||||
|
||||
if (list_elems(unixif->q) == 0) {
|
||||
pbuf_ref(p);
|
||||
list_push(unixif->q, buf);
|
||||
sys_timeout((u32_t)p->tot_len * 8000 / UNIXIF_BPS, unixif_output_timeout,
|
||||
netif);
|
||||
|
||||
LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_output: first on list\n"));
|
||||
|
||||
} else {
|
||||
pbuf_ref(p);
|
||||
if (list_push(unixif->q, buf) == 0) {
|
||||
#ifdef UNIXIF_DROP_FIRST
|
||||
struct unixif_buf *buf2;
|
||||
|
||||
buf2 = list_pop(unixif->q);
|
||||
pbuf_free(buf2->p);
|
||||
free(buf2);
|
||||
list_push(unixif->q, buf);
|
||||
#else
|
||||
free(buf);
|
||||
pbuf_free(p);
|
||||
|
||||
LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_output: drop\n"));
|
||||
|
||||
#endif /* UNIXIF_DROP_FIRST */
|
||||
LINK_STATS_INC(link.drop);
|
||||
|
||||
} else {
|
||||
LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_output: on list\n"));
|
||||
}
|
||||
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
unixif_output_timeout(void *arg)
|
||||
{
|
||||
struct pbuf *p, *q;
|
||||
int i, j, len;
|
||||
unsigned short plen, ptot_len;
|
||||
struct unixif_buf *buf;
|
||||
void *payload;
|
||||
struct netif *netif;
|
||||
struct unixif *unixif;
|
||||
char *data;
|
||||
|
||||
netif = (struct netif *)arg;
|
||||
unixif = (struct unixif *)netif->state;
|
||||
|
||||
LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_output_timeout\n"));
|
||||
|
||||
/* buf = unixif->q[0];
|
||||
unixif->q[0] = unixif->q[1];
|
||||
unixif->q[1] = NULL;*/
|
||||
buf = (struct unixif_buf *)list_pop(unixif->q);
|
||||
|
||||
p = buf->p;
|
||||
|
||||
plen = p->len;
|
||||
ptot_len = p->tot_len;
|
||||
payload = p->payload;
|
||||
|
||||
p->len = buf->len;
|
||||
p->tot_len = buf->tot_len;
|
||||
p->payload = buf->payload;
|
||||
|
||||
|
||||
if (p->tot_len == 0) {
|
||||
|
||||
LWIP_DEBUGF(UNIXIF_DEBUG, ("p->len!\n"));
|
||||
abort();
|
||||
}
|
||||
data = (char *)malloc(p->tot_len);
|
||||
|
||||
i = 0;
|
||||
for(q = p; q != NULL; q = q->next) {
|
||||
for(j = 0; j < q->len; j++) {
|
||||
data[i] = ((char *)q->payload)[j];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_output: sending %d (%d) bytes\n",
|
||||
p->len, p->tot_len));
|
||||
|
||||
len = p->tot_len;
|
||||
if (write(unixif->fd, &len, sizeof(int)) == -1) {
|
||||
perror("unixif_output: write");
|
||||
abort();
|
||||
}
|
||||
|
||||
if (write(unixif->fd, data, p->tot_len) == -1) {
|
||||
perror("unixif_output: write");
|
||||
abort();
|
||||
}
|
||||
#if LWIP_IPV4 && LWIP_TCP
|
||||
tcpdump(p, netif);
|
||||
#endif
|
||||
LINK_STATS_INC(link.xmit);
|
||||
|
||||
free(data);
|
||||
free(buf);
|
||||
p->len = plen;
|
||||
p->tot_len = ptot_len;
|
||||
p->payload = payload;
|
||||
|
||||
pbuf_free(p);
|
||||
|
||||
/* if (unixif->q[0] != NULL) {
|
||||
sys_timeout(unixif->q[0]->tot_len * 8000 / UNIXIF_BPS,
|
||||
unixif_output_timeout, netif);
|
||||
}*/
|
||||
if (list_elems(unixif->q) > 0) {
|
||||
sys_timeout(((struct unixif_buf *)list_first(unixif->q))->tot_len *
|
||||
8000U / UNIXIF_BPS,
|
||||
unixif_output_timeout, netif);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
err_t
|
||||
unixif_init_server(struct netif *netif)
|
||||
{
|
||||
int fd, fd2;
|
||||
struct sockaddr_un addr;
|
||||
socklen_t len;
|
||||
struct unixif *unixif;
|
||||
|
||||
fd = unix_socket_server("/tmp/unixif");
|
||||
|
||||
if (fd == -1) {
|
||||
perror("unixif_server");
|
||||
abort();
|
||||
}
|
||||
LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_server: fd %d\n", fd));
|
||||
|
||||
unixif = (struct unixif *)malloc(sizeof(struct unixif));
|
||||
if (!unixif) {
|
||||
return ERR_MEM;
|
||||
}
|
||||
netif->state = unixif;
|
||||
netif->name[0] = 'u';
|
||||
netif->name[1] = 'n';
|
||||
netif->output = unixif_output;
|
||||
unixif->q = list_new(UNIXIF_QUEUELEN);
|
||||
|
||||
printf("Now run ./simnode.\n");
|
||||
len = sizeof(addr);
|
||||
fd2 = accept(fd, (struct sockaddr *)&addr, &len);
|
||||
|
||||
if (fd2 == -1) {
|
||||
perror("unixif_accept");
|
||||
abort();
|
||||
}
|
||||
|
||||
LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_accept: %d\n", fd2));
|
||||
|
||||
unixif->fd = fd2;
|
||||
if(sys_sem_new(&unixif->sem, 0) != ERR_OK) {
|
||||
LWIP_ASSERT("Failed to create semaphore", 0);
|
||||
}
|
||||
sys_thread_new("unixif_thread", unixif_thread, netif, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO);
|
||||
sys_thread_new("unixif_thread2", unixif_thread2, netif, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO);
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
err_t
|
||||
unixif_init_client(struct netif *netif)
|
||||
{
|
||||
struct unixif *unixif;
|
||||
unixif = (struct unixif *)malloc(sizeof(struct unixif));
|
||||
if (!unixif) {
|
||||
return ERR_MEM;
|
||||
}
|
||||
netif->state = unixif;
|
||||
netif->name[0] = 'u';
|
||||
netif->name[1] = 'n';
|
||||
netif->output = unixif_output;
|
||||
|
||||
unixif->fd = unix_socket_client("/tmp/unixif");
|
||||
if (unixif->fd == -1) {
|
||||
perror("unixif_init");
|
||||
abort();
|
||||
}
|
||||
unixif->q = list_new(UNIXIF_QUEUELEN);
|
||||
if(sys_sem_new(&unixif->sem, 0) != ERR_OK) {
|
||||
LWIP_ASSERT("Failed to create semaphore", 0);
|
||||
}
|
||||
sys_thread_new("unixif_thread", unixif_thread, netif, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO);
|
||||
sys_thread_new("unixif_thread2", unixif_thread2, netif, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO);
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#endif /* !NO_SYS */
|
||||
#endif /* LWIP_IPV4 */
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "arch/perf.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static FILE *f;
|
||||
|
||||
void
|
||||
perf_print(unsigned long c1l, unsigned long c1h,
|
||||
unsigned long c2l, unsigned long c2h,
|
||||
char *key)
|
||||
{
|
||||
unsigned long sub_ms, sub_ls;
|
||||
|
||||
sub_ms = c2h - c1h;
|
||||
sub_ls = c2l - c1l;
|
||||
if (c2l < c1l) sub_ms--;
|
||||
fprintf(f, "%s: %.8lu%.8lu\n", key, sub_ms, sub_ls);
|
||||
fflush(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
perf_print_times(struct tms *start, struct tms *end, char *key)
|
||||
{
|
||||
fprintf(f, "%s: %lu\n", key, end->tms_stime - start->tms_stime);
|
||||
fflush(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
perf_init(char *fname)
|
||||
{
|
||||
f = fopen(fname, "w");
|
||||
}
|
||||
|
||||
@@ -1,649 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Wed Apr 17 16:05:29 EDT 2002 (James Roth)
|
||||
*
|
||||
* - Fixed an unlikely sys_thread_new() race condition.
|
||||
*
|
||||
* - Made current_thread() work with threads which where
|
||||
* not created with sys_thread_new(). This includes
|
||||
* the main thread and threads made with pthread_create().
|
||||
*
|
||||
* - Catch overflows where more than SYS_MBOX_SIZE messages
|
||||
* are waiting to be read. The sys_mbox_post() routine
|
||||
* will block until there is more room instead of just
|
||||
* leaking messages.
|
||||
*/
|
||||
#include "lwip/debug.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "lwip/def.h"
|
||||
|
||||
#ifdef LWIP_UNIX_MACH
|
||||
#include <mach/mach.h>
|
||||
#include <mach/mach_time.h>
|
||||
#endif
|
||||
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/stats.h"
|
||||
|
||||
static void
|
||||
get_monotonic_time(struct timespec *ts)
|
||||
{
|
||||
#ifdef LWIP_UNIX_MACH
|
||||
/* darwin impl (no CLOCK_MONOTONIC) */
|
||||
uint64_t t = mach_absolute_time();
|
||||
mach_timebase_info_data_t timebase_info = {0, 0};
|
||||
mach_timebase_info(&timebase_info);
|
||||
uint64_t nano = (t * timebase_info.numer) / (timebase_info.denom);
|
||||
uint64_t sec = nano/1000000000L;
|
||||
nano -= sec * 1000000000L;
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nano;
|
||||
#else
|
||||
clock_gettime(CLOCK_MONOTONIC, ts);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !NO_SYS
|
||||
|
||||
static struct sys_thread *threads = NULL;
|
||||
static pthread_mutex_t threads_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
struct sys_mbox_msg {
|
||||
struct sys_mbox_msg *next;
|
||||
void *msg;
|
||||
};
|
||||
|
||||
#define SYS_MBOX_SIZE 128
|
||||
|
||||
struct sys_mbox {
|
||||
int first, last;
|
||||
void *msgs[SYS_MBOX_SIZE];
|
||||
struct sys_sem *not_empty;
|
||||
struct sys_sem *not_full;
|
||||
struct sys_sem *mutex;
|
||||
int wait_send;
|
||||
};
|
||||
|
||||
struct sys_sem {
|
||||
unsigned int c;
|
||||
pthread_condattr_t condattr;
|
||||
pthread_cond_t cond;
|
||||
pthread_mutex_t mutex;
|
||||
};
|
||||
|
||||
struct sys_mutex {
|
||||
pthread_mutex_t mutex;
|
||||
};
|
||||
|
||||
struct sys_thread {
|
||||
struct sys_thread *next;
|
||||
pthread_t pthread;
|
||||
};
|
||||
|
||||
#if SYS_LIGHTWEIGHT_PROT
|
||||
static pthread_mutex_t lwprot_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static pthread_t lwprot_thread = (pthread_t)0xDEAD;
|
||||
static int lwprot_count = 0;
|
||||
#endif /* SYS_LIGHTWEIGHT_PROT */
|
||||
|
||||
static struct sys_sem *sys_sem_new_internal(u8_t count);
|
||||
static void sys_sem_free_internal(struct sys_sem *sem);
|
||||
|
||||
static u32_t cond_wait(pthread_cond_t * cond, pthread_mutex_t * mutex,
|
||||
u32_t timeout);
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Threads */
|
||||
static struct sys_thread *
|
||||
introduce_thread(pthread_t id)
|
||||
{
|
||||
struct sys_thread *thread;
|
||||
|
||||
thread = (struct sys_thread *)malloc(sizeof(struct sys_thread));
|
||||
|
||||
if (thread != NULL) {
|
||||
pthread_mutex_lock(&threads_mutex);
|
||||
thread->next = threads;
|
||||
thread->pthread = id;
|
||||
threads = thread;
|
||||
pthread_mutex_unlock(&threads_mutex);
|
||||
}
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
sys_thread_t
|
||||
sys_thread_new(const char *name, lwip_thread_fn function, void *arg, int stacksize, int prio)
|
||||
{
|
||||
int code;
|
||||
pthread_t tmp;
|
||||
struct sys_thread *st = NULL;
|
||||
LWIP_UNUSED_ARG(name);
|
||||
LWIP_UNUSED_ARG(stacksize);
|
||||
LWIP_UNUSED_ARG(prio);
|
||||
|
||||
code = pthread_create(&tmp,
|
||||
NULL,
|
||||
(void *(*)(void *))
|
||||
function,
|
||||
arg);
|
||||
|
||||
if (0 == code) {
|
||||
st = introduce_thread(tmp);
|
||||
}
|
||||
|
||||
if (NULL == st) {
|
||||
LWIP_DEBUGF(SYS_DEBUG, ("sys_thread_new: pthread_create %d, st = 0x%lx",
|
||||
code, (unsigned long)st));
|
||||
abort();
|
||||
}
|
||||
return st;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Mailbox */
|
||||
err_t
|
||||
sys_mbox_new(struct sys_mbox **mb, int size)
|
||||
{
|
||||
struct sys_mbox *mbox;
|
||||
LWIP_UNUSED_ARG(size);
|
||||
|
||||
mbox = (struct sys_mbox *)malloc(sizeof(struct sys_mbox));
|
||||
if (mbox == NULL) {
|
||||
return ERR_MEM;
|
||||
}
|
||||
mbox->first = mbox->last = 0;
|
||||
mbox->not_empty = sys_sem_new_internal(0);
|
||||
mbox->not_full = sys_sem_new_internal(0);
|
||||
mbox->mutex = sys_sem_new_internal(1);
|
||||
mbox->wait_send = 0;
|
||||
|
||||
SYS_STATS_INC_USED(mbox);
|
||||
*mb = mbox;
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void
|
||||
sys_mbox_free(struct sys_mbox **mb)
|
||||
{
|
||||
if ((mb != NULL) && (*mb != SYS_MBOX_NULL)) {
|
||||
struct sys_mbox *mbox = *mb;
|
||||
SYS_STATS_DEC(mbox.used);
|
||||
sys_arch_sem_wait(&mbox->mutex, 0);
|
||||
|
||||
sys_sem_free_internal(mbox->not_empty);
|
||||
sys_sem_free_internal(mbox->not_full);
|
||||
sys_sem_free_internal(mbox->mutex);
|
||||
mbox->not_empty = mbox->not_full = mbox->mutex = NULL;
|
||||
/* LWIP_DEBUGF("sys_mbox_free: mbox 0x%lx\n", mbox); */
|
||||
free(mbox);
|
||||
}
|
||||
}
|
||||
|
||||
err_t
|
||||
sys_mbox_trypost(struct sys_mbox **mb, void *msg)
|
||||
{
|
||||
u8_t first;
|
||||
struct sys_mbox *mbox;
|
||||
LWIP_ASSERT("invalid mbox", (mb != NULL) && (*mb != NULL));
|
||||
mbox = *mb;
|
||||
|
||||
sys_arch_sem_wait(&mbox->mutex, 0);
|
||||
|
||||
LWIP_DEBUGF(SYS_DEBUG, ("sys_mbox_trypost: mbox %p msg %p\n",
|
||||
(void *)mbox, (void *)msg));
|
||||
|
||||
if ((mbox->last + 1) >= (mbox->first + SYS_MBOX_SIZE)) {
|
||||
sys_sem_signal(&mbox->mutex);
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
mbox->msgs[mbox->last % SYS_MBOX_SIZE] = msg;
|
||||
|
||||
if (mbox->last == mbox->first) {
|
||||
first = 1;
|
||||
} else {
|
||||
first = 0;
|
||||
}
|
||||
|
||||
mbox->last++;
|
||||
|
||||
if (first) {
|
||||
sys_sem_signal(&mbox->not_empty);
|
||||
}
|
||||
|
||||
sys_sem_signal(&mbox->mutex);
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void
|
||||
sys_mbox_post(struct sys_mbox **mb, void *msg)
|
||||
{
|
||||
u8_t first;
|
||||
struct sys_mbox *mbox;
|
||||
LWIP_ASSERT("invalid mbox", (mb != NULL) && (*mb != NULL));
|
||||
mbox = *mb;
|
||||
|
||||
sys_arch_sem_wait(&mbox->mutex, 0);
|
||||
|
||||
LWIP_DEBUGF(SYS_DEBUG, ("sys_mbox_post: mbox %p msg %p\n", (void *)mbox, (void *)msg));
|
||||
|
||||
while ((mbox->last + 1) >= (mbox->first + SYS_MBOX_SIZE)) {
|
||||
mbox->wait_send++;
|
||||
sys_sem_signal(&mbox->mutex);
|
||||
sys_arch_sem_wait(&mbox->not_full, 0);
|
||||
sys_arch_sem_wait(&mbox->mutex, 0);
|
||||
mbox->wait_send--;
|
||||
}
|
||||
|
||||
mbox->msgs[mbox->last % SYS_MBOX_SIZE] = msg;
|
||||
|
||||
if (mbox->last == mbox->first) {
|
||||
first = 1;
|
||||
} else {
|
||||
first = 0;
|
||||
}
|
||||
|
||||
mbox->last++;
|
||||
|
||||
if (first) {
|
||||
sys_sem_signal(&mbox->not_empty);
|
||||
}
|
||||
|
||||
sys_sem_signal(&mbox->mutex);
|
||||
}
|
||||
|
||||
u32_t
|
||||
sys_arch_mbox_tryfetch(struct sys_mbox **mb, void **msg)
|
||||
{
|
||||
struct sys_mbox *mbox;
|
||||
LWIP_ASSERT("invalid mbox", (mb != NULL) && (*mb != NULL));
|
||||
mbox = *mb;
|
||||
|
||||
sys_arch_sem_wait(&mbox->mutex, 0);
|
||||
|
||||
if (mbox->first == mbox->last) {
|
||||
sys_sem_signal(&mbox->mutex);
|
||||
return SYS_MBOX_EMPTY;
|
||||
}
|
||||
|
||||
if (msg != NULL) {
|
||||
LWIP_DEBUGF(SYS_DEBUG, ("sys_mbox_tryfetch: mbox %p msg %p\n", (void *)mbox, *msg));
|
||||
*msg = mbox->msgs[mbox->first % SYS_MBOX_SIZE];
|
||||
}
|
||||
else{
|
||||
LWIP_DEBUGF(SYS_DEBUG, ("sys_mbox_tryfetch: mbox %p, null msg\n", (void *)mbox));
|
||||
}
|
||||
|
||||
mbox->first++;
|
||||
|
||||
if (mbox->wait_send) {
|
||||
sys_sem_signal(&mbox->not_full);
|
||||
}
|
||||
|
||||
sys_sem_signal(&mbox->mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32_t
|
||||
sys_arch_mbox_fetch(struct sys_mbox **mb, void **msg, u32_t timeout)
|
||||
{
|
||||
u32_t time_needed = 0;
|
||||
struct sys_mbox *mbox;
|
||||
LWIP_ASSERT("invalid mbox", (mb != NULL) && (*mb != NULL));
|
||||
mbox = *mb;
|
||||
|
||||
/* The mutex lock is quick so we don't bother with the timeout
|
||||
stuff here. */
|
||||
sys_arch_sem_wait(&mbox->mutex, 0);
|
||||
|
||||
while (mbox->first == mbox->last) {
|
||||
sys_sem_signal(&mbox->mutex);
|
||||
|
||||
/* We block while waiting for a mail to arrive in the mailbox. We
|
||||
must be prepared to timeout. */
|
||||
if (timeout != 0) {
|
||||
time_needed = sys_arch_sem_wait(&mbox->not_empty, timeout);
|
||||
|
||||
if (time_needed == SYS_ARCH_TIMEOUT) {
|
||||
return SYS_ARCH_TIMEOUT;
|
||||
}
|
||||
} else {
|
||||
sys_arch_sem_wait(&mbox->not_empty, 0);
|
||||
}
|
||||
|
||||
sys_arch_sem_wait(&mbox->mutex, 0);
|
||||
}
|
||||
|
||||
if (msg != NULL) {
|
||||
LWIP_DEBUGF(SYS_DEBUG, ("sys_mbox_fetch: mbox %p msg %p\n", (void *)mbox, *msg));
|
||||
*msg = mbox->msgs[mbox->first % SYS_MBOX_SIZE];
|
||||
}
|
||||
else{
|
||||
LWIP_DEBUGF(SYS_DEBUG, ("sys_mbox_fetch: mbox %p, null msg\n", (void *)mbox));
|
||||
}
|
||||
|
||||
mbox->first++;
|
||||
|
||||
if (mbox->wait_send) {
|
||||
sys_sem_signal(&mbox->not_full);
|
||||
}
|
||||
|
||||
sys_sem_signal(&mbox->mutex);
|
||||
|
||||
return time_needed;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Semaphore */
|
||||
static struct sys_sem *
|
||||
sys_sem_new_internal(u8_t count)
|
||||
{
|
||||
struct sys_sem *sem;
|
||||
|
||||
sem = (struct sys_sem *)malloc(sizeof(struct sys_sem));
|
||||
if (sem != NULL) {
|
||||
sem->c = count;
|
||||
pthread_condattr_init(&(sem->condattr));
|
||||
#if !(defined(LWIP_UNIX_MACH) || (defined(LWIP_UNIX_ANDROID) && __ANDROID_API__ < 21))
|
||||
pthread_condattr_setclock(&(sem->condattr), CLOCK_MONOTONIC);
|
||||
#endif
|
||||
pthread_cond_init(&(sem->cond), &(sem->condattr));
|
||||
pthread_mutex_init(&(sem->mutex), NULL);
|
||||
}
|
||||
return sem;
|
||||
}
|
||||
|
||||
err_t
|
||||
sys_sem_new(struct sys_sem **sem, u8_t count)
|
||||
{
|
||||
SYS_STATS_INC_USED(sem);
|
||||
*sem = sys_sem_new_internal(count);
|
||||
if (*sem == NULL) {
|
||||
return ERR_MEM;
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
static u32_t
|
||||
cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex, u32_t timeout)
|
||||
{
|
||||
struct timespec rtime1, rtime2, ts;
|
||||
int ret;
|
||||
|
||||
if (timeout == 0) {
|
||||
pthread_cond_wait(cond, mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get a timestamp and add the timeout value. */
|
||||
get_monotonic_time(&rtime1);
|
||||
#if defined(LWIP_UNIX_MACH) || (defined(LWIP_UNIX_ANDROID) && __ANDROID_API__ < 21)
|
||||
ts.tv_sec = timeout / 1000L;
|
||||
ts.tv_nsec = (timeout % 1000L) * 1000000L;
|
||||
ret = pthread_cond_timedwait_relative_np(cond, mutex, &ts);
|
||||
#else
|
||||
ts.tv_sec = rtime1.tv_sec + timeout / 1000L;
|
||||
ts.tv_nsec = rtime1.tv_nsec + (timeout % 1000L) * 1000000L;
|
||||
if (ts.tv_nsec >= 1000000000L) {
|
||||
ts.tv_sec++;
|
||||
ts.tv_nsec -= 1000000000L;
|
||||
}
|
||||
|
||||
ret = pthread_cond_timedwait(cond, mutex, &ts);
|
||||
#endif
|
||||
if (ret == ETIMEDOUT) {
|
||||
return SYS_ARCH_TIMEOUT;
|
||||
}
|
||||
|
||||
/* Calculate for how long we waited for the cond. */
|
||||
get_monotonic_time(&rtime2);
|
||||
ts.tv_sec = rtime2.tv_sec - rtime1.tv_sec;
|
||||
ts.tv_nsec = rtime2.tv_nsec - rtime1.tv_nsec;
|
||||
if (ts.tv_nsec < 0) {
|
||||
ts.tv_sec--;
|
||||
ts.tv_nsec += 1000000000L;
|
||||
}
|
||||
return (u32_t)(ts.tv_sec * 1000L + ts.tv_nsec / 1000000L);
|
||||
}
|
||||
|
||||
u32_t
|
||||
sys_arch_sem_wait(struct sys_sem **s, u32_t timeout)
|
||||
{
|
||||
u32_t time_needed = 0;
|
||||
struct sys_sem *sem;
|
||||
LWIP_ASSERT("invalid sem", (s != NULL) && (*s != NULL));
|
||||
sem = *s;
|
||||
|
||||
pthread_mutex_lock(&(sem->mutex));
|
||||
while (sem->c <= 0) {
|
||||
if (timeout > 0) {
|
||||
time_needed = cond_wait(&(sem->cond), &(sem->mutex), timeout);
|
||||
|
||||
if (time_needed == SYS_ARCH_TIMEOUT) {
|
||||
pthread_mutex_unlock(&(sem->mutex));
|
||||
return SYS_ARCH_TIMEOUT;
|
||||
}
|
||||
/* pthread_mutex_unlock(&(sem->mutex));
|
||||
return time_needed; */
|
||||
} else {
|
||||
cond_wait(&(sem->cond), &(sem->mutex), 0);
|
||||
}
|
||||
}
|
||||
sem->c--;
|
||||
pthread_mutex_unlock(&(sem->mutex));
|
||||
return (u32_t)time_needed;
|
||||
}
|
||||
|
||||
void
|
||||
sys_sem_signal(struct sys_sem **s)
|
||||
{
|
||||
struct sys_sem *sem;
|
||||
LWIP_ASSERT("invalid sem", (s != NULL) && (*s != NULL));
|
||||
sem = *s;
|
||||
|
||||
pthread_mutex_lock(&(sem->mutex));
|
||||
sem->c++;
|
||||
|
||||
if (sem->c > 1) {
|
||||
sem->c = 1;
|
||||
}
|
||||
|
||||
pthread_cond_broadcast(&(sem->cond));
|
||||
pthread_mutex_unlock(&(sem->mutex));
|
||||
}
|
||||
|
||||
static void
|
||||
sys_sem_free_internal(struct sys_sem *sem)
|
||||
{
|
||||
pthread_cond_destroy(&(sem->cond));
|
||||
pthread_condattr_destroy(&(sem->condattr));
|
||||
pthread_mutex_destroy(&(sem->mutex));
|
||||
free(sem);
|
||||
}
|
||||
|
||||
void
|
||||
sys_sem_free(struct sys_sem **sem)
|
||||
{
|
||||
if ((sem != NULL) && (*sem != SYS_SEM_NULL)) {
|
||||
SYS_STATS_DEC(sem.used);
|
||||
sys_sem_free_internal(*sem);
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Mutex */
|
||||
/** Create a new mutex
|
||||
* @param mutex pointer to the mutex to create
|
||||
* @return a new mutex */
|
||||
err_t
|
||||
sys_mutex_new(struct sys_mutex **mutex)
|
||||
{
|
||||
struct sys_mutex *mtx;
|
||||
|
||||
mtx = (struct sys_mutex *)malloc(sizeof(struct sys_mutex));
|
||||
if (mtx != NULL) {
|
||||
pthread_mutex_init(&(mtx->mutex), NULL);
|
||||
*mutex = mtx;
|
||||
return ERR_OK;
|
||||
}
|
||||
else {
|
||||
return ERR_MEM;
|
||||
}
|
||||
}
|
||||
|
||||
/** Lock a mutex
|
||||
* @param mutex the mutex to lock */
|
||||
void
|
||||
sys_mutex_lock(struct sys_mutex **mutex)
|
||||
{
|
||||
pthread_mutex_lock(&((*mutex)->mutex));
|
||||
}
|
||||
|
||||
/** Unlock a mutex
|
||||
* @param mutex the mutex to unlock */
|
||||
void
|
||||
sys_mutex_unlock(struct sys_mutex **mutex)
|
||||
{
|
||||
pthread_mutex_unlock(&((*mutex)->mutex));
|
||||
}
|
||||
|
||||
/** Delete a mutex
|
||||
* @param mutex the mutex to delete */
|
||||
void
|
||||
sys_mutex_free(struct sys_mutex **mutex)
|
||||
{
|
||||
pthread_mutex_destroy(&((*mutex)->mutex));
|
||||
free(*mutex);
|
||||
}
|
||||
|
||||
#endif /* !NO_SYS */
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Time */
|
||||
u32_t
|
||||
sys_now(void)
|
||||
{
|
||||
struct timespec ts;
|
||||
|
||||
get_monotonic_time(&ts);
|
||||
return (u32_t)(ts.tv_sec * 1000L + ts.tv_nsec / 1000000L);
|
||||
}
|
||||
|
||||
u32_t
|
||||
sys_jiffies(void)
|
||||
{
|
||||
struct timespec ts;
|
||||
|
||||
get_monotonic_time(&ts);
|
||||
return (u32_t)(ts.tv_sec * 1000000000L + ts.tv_nsec);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Init */
|
||||
|
||||
void
|
||||
sys_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Critical section */
|
||||
#if SYS_LIGHTWEIGHT_PROT
|
||||
/** sys_prot_t sys_arch_protect(void)
|
||||
|
||||
This optional function does a "fast" critical region protection and returns
|
||||
the previous protection level. This function is only called during very short
|
||||
critical regions. An embedded system which supports ISR-based drivers might
|
||||
want to implement this function by disabling interrupts. Task-based systems
|
||||
might want to implement this by using a mutex or disabling tasking. This
|
||||
function should support recursive calls from the same task or interrupt. In
|
||||
other words, sys_arch_protect() could be called while already protected. In
|
||||
that case the return value indicates that it is already protected.
|
||||
|
||||
sys_arch_protect() is only required if your port is supporting an operating
|
||||
system.
|
||||
*/
|
||||
sys_prot_t
|
||||
sys_arch_protect(void)
|
||||
{
|
||||
/* Note that for the UNIX port, we are using a lightweight mutex, and our
|
||||
* own counter (which is locked by the mutex). The return code is not actually
|
||||
* used. */
|
||||
if (lwprot_thread != pthread_self())
|
||||
{
|
||||
/* We are locking the mutex where it has not been locked before *
|
||||
* or is being locked by another thread */
|
||||
pthread_mutex_lock(&lwprot_mutex);
|
||||
lwprot_thread = pthread_self();
|
||||
lwprot_count = 1;
|
||||
}
|
||||
else
|
||||
/* It is already locked by THIS thread */
|
||||
lwprot_count++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** void sys_arch_unprotect(sys_prot_t pval)
|
||||
|
||||
This optional function does a "fast" set of critical region protection to the
|
||||
value specified by pval. See the documentation for sys_arch_protect() for
|
||||
more information. This function is only required if your port is supporting
|
||||
an operating system.
|
||||
*/
|
||||
void
|
||||
sys_arch_unprotect(sys_prot_t pval)
|
||||
{
|
||||
LWIP_UNUSED_ARG(pval);
|
||||
if (lwprot_thread == pthread_self())
|
||||
{
|
||||
if (--lwprot_count == 0)
|
||||
{
|
||||
lwprot_thread = (pthread_t) 0xDEAD;
|
||||
pthread_mutex_unlock(&lwprot_mutex);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* SYS_LIGHTWEIGHT_PROT */
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Run me using "source setup-tapif" to get exported PRECONFIGURED_TAPIF variable
|
||||
# Alternatively, add "export PRECONFIGURED_TAPIF=tap0" to ~/.bashrc
|
||||
|
||||
# http://backreference.org/2010/03/26/tuntap-interface-tutorial/
|
||||
|
||||
# After executing this script, start unixsim/simhost.
|
||||
# Enter 192.168.0.2 or "http://simhost.local/" (Zeroconf)
|
||||
# in your webbrowser to see simhost webpage.
|
||||
|
||||
sudo ip tuntap add dev tap0 mode tap user `whoami`
|
||||
sudo ip link set tap0 up
|
||||
sudo ip addr add 192.168.0.1/24 dev tap0
|
||||
export PRECONFIGURED_TAPIF=tap0
|
||||
@@ -1,59 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2001, 2002 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>
|
||||
#
|
||||
|
||||
all compile: simhost simrouter simnode makefsdata
|
||||
.PHONY: all
|
||||
|
||||
include ../Common.mk
|
||||
|
||||
MAKEFSDATAOBJS=$(notdir $(MAKEFSDATAFILES:.c=.o))
|
||||
|
||||
clean:
|
||||
rm -f *.o $(LWIPLIBCOMMON) $(APPLIB) simhost simnode simrouter *.s .depend* *.core core
|
||||
|
||||
depend dep: .depend
|
||||
|
||||
include .depend
|
||||
|
||||
.depend: simhost.c simnode.c simrouter.c $(LWIPFILES) $(APPFILES) $(MAKEFSDATAFILES)
|
||||
$(CCDEP) $(CFLAGS) -MM $^ > .depend || rm -f .depend
|
||||
|
||||
simhost: .depend $(LWIPLIBCOMMON) $(APPLIB) simhost.o
|
||||
$(CC) $(CFLAGS) -o simhost simhost.o -Wl,--start-group $(APPLIB) $(LWIPLIBCOMMON) -Wl,--end-group $(LDFLAGS)
|
||||
|
||||
simrouter: .depend $(LWIPLIBCOMMON) $(APPLIB) simrouter.o
|
||||
$(CC) $(CFLAGS) -o simrouter simrouter.o -Wl,--start-group $(APPLIB) $(LWIPLIBCOMMON) -Wl,--end-group $(LDFLAGS)
|
||||
|
||||
simnode: .depend $(LWIPLIBCOMMON) $(APPLIB) simnode.o
|
||||
$(CC) $(CFLAGS) -o simnode simnode.o -Wl,--start-group $(APPLIB) $(LWIPLIBCOMMON) -Wl,--end-group $(LDFLAGS)
|
||||
|
||||
makefsdata: .depend $(MAKEFSDATAOBJS)
|
||||
$(CC) $(CFLAGS) -o makefsdata $(MAKEFSDATAOBJS)
|
||||
@@ -1,61 +0,0 @@
|
||||
This directory contains an example of how a project using lwIP might
|
||||
look. It is also the development platform of lwIP, since it can be run
|
||||
as a user process under FreeBSD or Linux. There are also a number of
|
||||
example applications (including a simple web server) in the apps/
|
||||
directory.
|
||||
|
||||
Some short instructions on how to build and run lwIP on a FreeBSD or
|
||||
Linux host. For FreeBSD, the tap interface must be enabled in the
|
||||
kernel configuration and the kernel must be recompiled. The tap
|
||||
interface is enabled by adding the line "pseudo-device tap" in the
|
||||
kernel configuration. See Chapter 9 in the FreeBSD handbook for
|
||||
instructions on how to build a custom FreeBSD kernel.
|
||||
|
||||
For Linux you might need to create a device node with
|
||||
|
||||
> mknod /dev/net/tun c 10 200
|
||||
|
||||
* Compile the code. This must be done by using GNU Make. Under
|
||||
FreeBSD, GNU Make can be found in the ports collection under
|
||||
/usr/ports/devel/gmake (type "make install distclean" to
|
||||
install). Under Linux, GNU Make is the default "make".
|
||||
|
||||
> gmake (FreeBSD)
|
||||
|
||||
> make (Linux)
|
||||
|
||||
* The compilation process produces the executable file "simhost". To
|
||||
run this, you have to be root.
|
||||
|
||||
> su (Type password for the root account)
|
||||
# ./simhost
|
||||
|
||||
* The lwIP TCP/IP stack is now running with IP address
|
||||
192.168.0.2. Some things that you can try:
|
||||
|
||||
To see the packets that are going to and from the lwIP stack, run
|
||||
tcpdump:
|
||||
|
||||
# tcpdump -l -n -i tap0
|
||||
|
||||
You can ping lwIP:
|
||||
|
||||
> ping 192.168.0.2
|
||||
|
||||
For a telnet shell, run:
|
||||
|
||||
> telnet 192.168.0.2
|
||||
|
||||
Finally, "simhost" also includes a simple web server; the URL is
|
||||
of course http://192.168.0.2/.
|
||||
|
||||
* Simhost has some extra features that can be
|
||||
selected with command line options.
|
||||
|
||||
To enable runtime debug output (project must be build with -DLWIP_DEBUG):
|
||||
|
||||
# ./simhost -d
|
||||
|
||||
To ping any host, e.g. the gateway:
|
||||
|
||||
# ./simhost -p 192.168.0.1
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_HOOKS_H
|
||||
#define LWIP_HOOKS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "addons/tcp_isn/tcp_isn.h"
|
||||
|
||||
#define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_HOOKS_H */
|
||||
|
||||
@@ -1,374 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_LWIPOPTS_H
|
||||
#define LWIP_LWIPOPTS_H
|
||||
|
||||
#include "lwip/arch.h"
|
||||
|
||||
#define LWIP_HOOK_FILENAME "lwip_hooks.h"
|
||||
|
||||
#define LWIP_IPV4 1
|
||||
#define LWIP_IPV6 1
|
||||
|
||||
#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 SLIP_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_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 RAW_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
|
||||
|
||||
extern unsigned char debug_flags;
|
||||
#define LWIP_DBG_TYPES_ON debug_flags
|
||||
|
||||
#define NO_SYS 0
|
||||
#define LWIP_SOCKET (NO_SYS==0)
|
||||
#define LWIP_NETCONN (NO_SYS==0)
|
||||
#define SO_REUSE 1
|
||||
#define IP_SOF_BROADCAST_RECV 1
|
||||
#define IP_SOF_BROADCAST 1
|
||||
#define SO_REUSE_RXTOALL 1
|
||||
#define LWIP_SO_RCVTIMEO (LWIP_SOCKET)
|
||||
|
||||
/* ---------- Memory options ---------- */
|
||||
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
|
||||
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
|
||||
byte alignment -> define MEM_ALIGNMENT to 2. */
|
||||
/* MSVC port: intel processors don't need 4-byte alignment,
|
||||
but are faster that way! */
|
||||
#define MEM_ALIGNMENT 4U
|
||||
|
||||
/* MEM_SIZE: the size of the heap memory. If the application will send
|
||||
a lot of data that needs to be copied, this should be set high. */
|
||||
#define MEM_SIZE 10240
|
||||
|
||||
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
|
||||
sends a lot of data out of ROM (or other static memory), this
|
||||
should be set high. */
|
||||
#define MEMP_NUM_PBUF 16
|
||||
/* MEMP_NUM_RAW_PCB: the number of UDP protocol control blocks. One
|
||||
per active RAW "connection". */
|
||||
#define MEMP_NUM_RAW_PCB 3
|
||||
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
|
||||
per active UDP "connection". */
|
||||
#define MEMP_NUM_UDP_PCB 6
|
||||
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
|
||||
connections. */
|
||||
#define MEMP_NUM_TCP_PCB 5
|
||||
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
|
||||
connections. */
|
||||
#define MEMP_NUM_TCP_PCB_LISTEN 8
|
||||
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
|
||||
segments. */
|
||||
#define MEMP_NUM_TCP_SEG 16
|
||||
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
|
||||
timeouts. */
|
||||
#define MEMP_NUM_SYS_TIMEOUT 17
|
||||
|
||||
/* The following four are used only with the sequential API and can be
|
||||
set to 0 if the application only will use the raw API. */
|
||||
/* MEMP_NUM_NETBUF: the number of struct netbufs. */
|
||||
#define MEMP_NUM_NETBUF 2
|
||||
/* MEMP_NUM_NETCONN: the number of struct netconns. */
|
||||
#define MEMP_NUM_NETCONN 10
|
||||
/* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
|
||||
for sequential API communication and incoming packets. Used in
|
||||
src/api/tcpip.c. */
|
||||
#define MEMP_NUM_TCPIP_MSG_API 16
|
||||
#define MEMP_NUM_TCPIP_MSG_INPKT 16
|
||||
|
||||
#define MEMP_OVERFLOW_CHECK 1
|
||||
|
||||
/* ---------- Pbuf options ---------- */
|
||||
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
|
||||
#define PBUF_POOL_SIZE 200
|
||||
|
||||
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
|
||||
#define PBUF_POOL_BUFSIZE 128
|
||||
|
||||
/* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
|
||||
link level header. */
|
||||
#define PBUF_LINK_HLEN 16u
|
||||
|
||||
/** SYS_LIGHTWEIGHT_PROT
|
||||
* define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
|
||||
* for certain critical regions during buffer allocation, deallocation and memory
|
||||
* allocation and deallocation.
|
||||
*/
|
||||
#define SYS_LIGHTWEIGHT_PROT 1
|
||||
|
||||
#define LWIP_TCPIP_TIMEOUT 1
|
||||
|
||||
/* ---------- TCP options ---------- */
|
||||
#define LWIP_TCP 1
|
||||
#define LWIP_ALTCP (LWIP_TCP)
|
||||
#define TCP_TTL 255
|
||||
|
||||
#ifdef LWIP_HAVE_MBEDTLS
|
||||
#define LWIP_ALTCP_TLS (LWIP_TCP)
|
||||
#define LWIP_ALTCP_TLS_MBEDTLS (LWIP_TCP)
|
||||
#endif
|
||||
|
||||
#define TCP_LISTEN_BACKLOG 1
|
||||
|
||||
/* Controls if TCP should queue segments that arrive out of
|
||||
order. Define to 0 if your device is low on memory. */
|
||||
#define TCP_QUEUE_OOSEQ 1
|
||||
|
||||
/* TCP Maximum segment size. */
|
||||
#define TCP_MSS 1024
|
||||
|
||||
/* TCP sender buffer space (bytes). */
|
||||
#define TCP_SND_BUF 2048
|
||||
|
||||
/* 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)
|
||||
|
||||
/* 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)
|
||||
|
||||
/* TCP receive window. */
|
||||
#define TCP_WND 8096
|
||||
|
||||
/* Maximum number of retransmissions of data segments. */
|
||||
#define TCP_MAXRTX 12
|
||||
|
||||
/* Maximum number of retransmissions of SYN segments. */
|
||||
#define TCP_SYNMAXRTX 4
|
||||
|
||||
/* ---------- ARP options ---------- */
|
||||
#define LWIP_ARP 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
|
||||
IP packets across network interfaces. If you are going to run lwIP
|
||||
on a device with only one network interface, define this to 0. */
|
||||
#define IP_FORWARD 1
|
||||
|
||||
|
||||
/* IP reassembly and segmentation.These are orthogonal even
|
||||
* if they both deal with IP fragments */
|
||||
#define IP_REASSEMBLY 1
|
||||
#define IP_REASS_MAX_PBUFS 10
|
||||
#define MEMP_NUM_REASSDATA 10
|
||||
#define IP_FRAG 1
|
||||
#define IPV6_FRAG_COPYHEADER 1
|
||||
#define LWIP_IPV6_FRAG 1
|
||||
|
||||
#define LWIP_IGMP (LWIP_IPV4)
|
||||
|
||||
/* ---------- ICMP options ---------- */
|
||||
#define ICMP_TTL 255
|
||||
|
||||
/* ---------- DHCP options ---------- */
|
||||
/* Define LWIP_DHCP to 1 if you want DHCP configuration of
|
||||
interfaces. */
|
||||
#define LWIP_DHCP 0
|
||||
|
||||
#define LWIP_DHCP_GET_NTP_SRV (LWIP_DHCP)
|
||||
|
||||
/* 1 if you want to do an ARP check on the offered address
|
||||
(recommended if using DHCP). */
|
||||
#define DHCP_DOES_ARP_CHECK (LWIP_DHCP)
|
||||
|
||||
/* ---------- AUTOIP options ------- */
|
||||
#define LWIP_AUTOIP (LWIP_DHCP)
|
||||
#define LWIP_DHCP_AUTOIP_COOP (LWIP_DHCP)
|
||||
#define LWIP_DHCP_AUTOIP_COOP_TRIES 3
|
||||
|
||||
/* ---------- SNTP options --------- */
|
||||
extern void sntp_set_system_time(u32_t sec);
|
||||
#define SNTP_SET_SYSTEM_TIME(s) sntp_set_system_time(s)
|
||||
|
||||
/* ---------- SNMP options ---------- */
|
||||
#define LWIP_SNMP (LWIP_UDP)
|
||||
#ifdef LWIP_HAVE_MBEDTLS
|
||||
#define LWIP_SNMP_V3 (LWIP_SNMP)
|
||||
#endif
|
||||
#define MIB2_STATS (LWIP_SNMP)
|
||||
#define SNMP_USE_NETCONN (LWIP_NETCONN)
|
||||
#define SNMP_USE_RAW (!LWIP_NETCONN)
|
||||
|
||||
/* ---------- DNS options ---------- */
|
||||
#define LWIP_DNS 1
|
||||
|
||||
/* ---------- MDNS options ---------- */
|
||||
#define LWIP_MDNS_RESPONDER 1
|
||||
#define LWIP_NUM_NETIF_CLIENT_DATA (LWIP_MDNS_RESPONDER)
|
||||
|
||||
/* ---------- UDP options ---------- */
|
||||
#define LWIP_UDP 1
|
||||
#define UDP_TTL 255
|
||||
|
||||
/* ---------- RAW options ---------- */
|
||||
#define LWIP_RAW 1
|
||||
#define RAW_TTL 255
|
||||
|
||||
/* ---------- Statistics options ---------- */
|
||||
/* individual STATS options can be turned off by defining them to 0
|
||||
* (e.g #define TCP_STATS 0). All of them are turned off if LWIP_STATS
|
||||
* is 0
|
||||
* */
|
||||
|
||||
#define LWIP_STATS 1
|
||||
|
||||
#define LWIP_NETIF_API 1
|
||||
#define LWIP_NETIF_STATUS_CALLBACK 1
|
||||
#define LWIP_NETIF_EXT_STATUS_CALLBACK 1
|
||||
#define LWIP_NETIF_HOSTNAME 0
|
||||
|
||||
/* ---------- SLIP options ---------- */
|
||||
|
||||
#define LWIP_HAVE_SLIPIF 1 /* Set > 0 for SLIP */
|
||||
|
||||
/* Maximum packet size that is received by this netif */
|
||||
#define SLIP_MAX_SIZE 1500
|
||||
#define sio_tryread sio_read
|
||||
|
||||
/* ---------- 6LoWPAN options ---------- */
|
||||
#define LWIP_6LOWPAN 1
|
||||
|
||||
/* ---------- PPP options ---------- */
|
||||
|
||||
#define PPP_SUPPORT 1 /* Set > 0 for PPP */
|
||||
#define MPPE_SUPPORT PPP_SUPPORT
|
||||
#define PPPOE_SUPPORT PPP_SUPPORT
|
||||
#define PPPOL2TP_SUPPORT PPP_SUPPORT
|
||||
#define PPPOS_SUPPORT PPP_SUPPORT
|
||||
|
||||
#if PPP_SUPPORT > 0
|
||||
|
||||
#define NUM_PPP 1 /* Max PPP sessions. */
|
||||
|
||||
|
||||
/* Select modules to enable. Ideally these would be set in the makefile but
|
||||
* we're limited by the command line length so you need to modify the settings
|
||||
* in this file.
|
||||
*/
|
||||
#define PAP_SUPPORT 1 /* Set > 0 for PAP. */
|
||||
#define CHAP_SUPPORT 1 /* Set > 0 for CHAP. */
|
||||
#define MSCHAP_SUPPORT 0 /* Set > 0 for MSCHAP (NOT FUNCTIONAL!) */
|
||||
#define CBCP_SUPPORT 0 /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
|
||||
#define CCP_SUPPORT 0 /* Set > 0 for CCP (NOT FUNCTIONAL!) */
|
||||
#define VJ_SUPPORT 1 /* Set > 0 for VJ header compression. */
|
||||
#define MD5_SUPPORT 1 /* Set > 0 for MD5 (see also CHAP) */
|
||||
|
||||
|
||||
/*
|
||||
* Timeouts.
|
||||
*/
|
||||
#define FSM_DEFTIMEOUT 6 /* Timeout time in seconds */
|
||||
#define FSM_DEFMAXTERMREQS 2 /* Maximum Terminate-Request transmissions */
|
||||
#define FSM_DEFMAXCONFREQS 10 /* Maximum Configure-Request transmissions */
|
||||
#define FSM_DEFMAXNAKLOOPS 5 /* Maximum number of nak loops */
|
||||
|
||||
#define UPAP_DEFTIMEOUT 6 /* Timeout (seconds) for retransmitting req */
|
||||
#define UPAP_DEFREQTIME 30 /* Time to wait for auth-req from peer */
|
||||
|
||||
#define CHAP_DEFTIMEOUT 6 /* Timeout time in seconds */
|
||||
#define CHAP_DEFTRANSMITS 10 /* max # times to send challenge */
|
||||
|
||||
|
||||
/* Interval in seconds between keepalive echo requests, 0 to disable. */
|
||||
#if 1
|
||||
#define LCP_ECHOINTERVAL 0
|
||||
#else
|
||||
#define LCP_ECHOINTERVAL 10
|
||||
#endif
|
||||
|
||||
/* Number of unanswered echo requests before failure. */
|
||||
#define LCP_MAXECHOFAILS 3
|
||||
|
||||
/* Max Xmit idle time (in jiffies) before resend flag char. */
|
||||
#define PPP_MAXIDLEFLAG 100
|
||||
|
||||
/*
|
||||
* Packet sizes
|
||||
*
|
||||
* Note - lcp shouldn't be allowed to negotiate stuff outside these
|
||||
* limits. See lcp.h in the pppd directory.
|
||||
* (XXX - these constants should simply be shared by lcp.c instead
|
||||
* of living in lcp.h)
|
||||
*/
|
||||
#define PPP_MTU 1500 /* Default MTU (size of Info field) */
|
||||
#if 0
|
||||
#define PPP_MAXMTU 65535 - (PPP_HDRLEN + PPP_FCSLEN)
|
||||
#else
|
||||
#define PPP_MAXMTU 1500 /* Largest MTU we allow */
|
||||
#endif
|
||||
#define PPP_MINMTU 64
|
||||
#define PPP_MRU 1500 /* default MRU = max length of info field */
|
||||
#define PPP_MAXMRU 1500 /* Largest MRU we allow */
|
||||
#define PPP_DEFMRU 296 /* Try for this */
|
||||
#define PPP_MINMRU 128 /* No MRUs below this */
|
||||
|
||||
|
||||
#define MAXNAMELEN 256 /* max length of hostname or name for auth */
|
||||
#define MAXSECRETLEN 256 /* max length of password or secret */
|
||||
|
||||
#endif /* PPP_SUPPORT > 0 */
|
||||
|
||||
#define LWIP_HTTPD_SSI 1
|
||||
|
||||
#endif /* LWIP_LWIPOPTS_H */
|
||||
@@ -1,670 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <getopt.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#include "lwip/init.h"
|
||||
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/memp.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/timeouts.h"
|
||||
|
||||
#include "lwip/ip_addr.h"
|
||||
|
||||
#include "lwip/dns.h"
|
||||
#include "lwip/dhcp.h"
|
||||
|
||||
#include "lwip/stats.h"
|
||||
|
||||
#include "lwip/tcp.h"
|
||||
#include "lwip/inet_chksum.h"
|
||||
|
||||
#include "lwip/tcpip.h"
|
||||
#include "lwip/sockets.h"
|
||||
|
||||
#include "netif/tapif.h"
|
||||
#include "netif/tunif.h"
|
||||
|
||||
#include "netif/unixif.h"
|
||||
#include "netif/dropif.h"
|
||||
#include "netif/pcapif.h"
|
||||
|
||||
#include "netif/tcpdump.h"
|
||||
|
||||
#ifndef LWIP_HAVE_SLIPIF
|
||||
#define LWIP_HAVE_SLIPIF 0
|
||||
#endif
|
||||
#if LWIP_HAVE_SLIPIF
|
||||
#include "netif/slipif.h"
|
||||
#define SLIP_PTY_TEST 1
|
||||
#endif
|
||||
|
||||
#if PPP_SUPPORT
|
||||
#include "netif/ppp/pppos.h"
|
||||
#include "lwip/sio.h"
|
||||
#define PPP_PTY_TEST 1
|
||||
#include <termios.h>
|
||||
#endif
|
||||
|
||||
#include "lwip/ip_addr.h"
|
||||
#include "arch/perf.h"
|
||||
|
||||
#include "lwip/apps/httpd.h"
|
||||
#include "apps/udpecho/udpecho.h"
|
||||
#include "apps/tcpecho/tcpecho.h"
|
||||
#include "apps/shell/shell.h"
|
||||
#include "apps/chargen/chargen.h"
|
||||
#include "apps/netio/netio.h"
|
||||
#include "apps/ping/ping.h"
|
||||
#include "lwip/apps/netbiosns.h"
|
||||
#include "lwip/apps/mdns.h"
|
||||
#include "lwip/apps/sntp.h"
|
||||
#include "lwip/apps/snmp.h"
|
||||
#include "lwip/apps/snmp_mib2.h"
|
||||
#include "apps/snmp_private_mib/private_mib.h"
|
||||
#include "lwip/apps/snmpv3.h"
|
||||
#include "apps/snmp_v3/snmpv3_dummy.h"
|
||||
#include "lwip/apps/snmp_snmpv2_framework.h"
|
||||
#include "lwip/apps/snmp_snmpv2_usm.h"
|
||||
#include "lwip/apps/tftp_server.h"
|
||||
#include "addons/tcp_isn/tcp_isn.h"
|
||||
|
||||
#if LWIP_RAW
|
||||
#include "lwip/icmp.h"
|
||||
#include "lwip/raw.h"
|
||||
#endif
|
||||
|
||||
#if LWIP_SNMP
|
||||
static const struct snmp_mib *mibs[] = {
|
||||
&mib2,
|
||||
&mib_private
|
||||
#if LWIP_SNMP_V3
|
||||
, &snmpframeworkmib
|
||||
, &snmpusmmib
|
||||
#endif
|
||||
};
|
||||
#endif /* LWIP_SNMP */
|
||||
|
||||
#if LWIP_IPV4
|
||||
/* (manual) host IP configuration */
|
||||
static ip_addr_t ipaddr, netmask, gw;
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
struct netif netif;
|
||||
|
||||
/* ping out destination cmd option */
|
||||
static unsigned char ping_flag;
|
||||
static ip_addr_t ping_addr;
|
||||
|
||||
/* nonstatic debug cmd option, exported in lwipopts.h */
|
||||
unsigned char debug_flags;
|
||||
|
||||
/** @todo add options for selecting netif, starting DHCP client etc */
|
||||
static struct option longopts[] = {
|
||||
/* turn on debugging output (if build with LWIP_DEBUG) */
|
||||
{"debug", no_argument, NULL, 'd'},
|
||||
/* help */
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
#if LWIP_IPV4
|
||||
/* gateway address */
|
||||
{"gateway", required_argument, NULL, 'g'},
|
||||
/* ip address */
|
||||
{"ipaddr", required_argument, NULL, 'i'},
|
||||
/* netmask */
|
||||
{"netmask", required_argument, NULL, 'm'},
|
||||
/* ping destination */
|
||||
{"ping", required_argument, NULL, 'p'},
|
||||
#endif /* LWIP_IPV4 */
|
||||
/* new command line options go here! */
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
#define NUM_OPTS ((sizeof(longopts) / sizeof(struct option)) - 1)
|
||||
|
||||
static void init_netifs(void);
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
unsigned char i;
|
||||
|
||||
printf("options:\n");
|
||||
for (i = 0; i < NUM_OPTS; i++) {
|
||||
printf("-%c --%s\n",longopts[i].val, longopts[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
tcp_debug_timeout(void *data)
|
||||
{
|
||||
LWIP_UNUSED_ARG(data);
|
||||
#if TCP_DEBUG
|
||||
tcp_debug_print_pcbs();
|
||||
#endif /* TCP_DEBUG */
|
||||
sys_timeout(5000, tcp_debug_timeout, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
sntp_set_system_time(u32_t sec)
|
||||
{
|
||||
char buf[32];
|
||||
struct tm current_time_val;
|
||||
time_t current_time = (time_t)sec;
|
||||
|
||||
localtime_r(¤t_time, ¤t_time_val);
|
||||
|
||||
strftime(buf, sizeof(buf), "%d.%m.%Y %H:%M:%S", ¤t_time_val);
|
||||
printf("SNTP time: %s\n", buf);
|
||||
}
|
||||
|
||||
#if LWIP_MDNS_RESPONDER
|
||||
static void
|
||||
srv_txt(struct mdns_service *service, void *txt_userdata)
|
||||
{
|
||||
err_t res;
|
||||
LWIP_UNUSED_ARG(txt_userdata);
|
||||
|
||||
res = mdns_resp_add_service_txtitem(service, "path=/", 6);
|
||||
LWIP_ERROR("mdns add service txt failed\n", (res == ERR_OK), return);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LWIP_UDP
|
||||
|
||||
static void*
|
||||
tftp_open(const char* fname, const char* mode, u8_t is_write)
|
||||
{
|
||||
LWIP_UNUSED_ARG(mode);
|
||||
|
||||
if (is_write) {
|
||||
return (void*)fopen(fname, "wb");
|
||||
} else {
|
||||
return (void*)fopen(fname, "rb");
|
||||
}
|
||||
}
|
||||
static void
|
||||
tftp_close(void* handle)
|
||||
{
|
||||
fclose((FILE*)handle);
|
||||
}
|
||||
static int
|
||||
tftp_read(void* handle, void* buf, int bytes)
|
||||
{
|
||||
int ret = fread(buf, 1, bytes, (FILE*)handle);
|
||||
if (ret <= 0) {
|
||||
return -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
static int
|
||||
tftp_write(void* handle, struct pbuf* p)
|
||||
{
|
||||
while (p != NULL) {
|
||||
if (fwrite(p->payload, 1, p->len, (FILE*)handle) != (size_t)p->len) {
|
||||
return -1;
|
||||
}
|
||||
p = p->next;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct tftp_context tftp = {
|
||||
tftp_open,
|
||||
tftp_close,
|
||||
tftp_read,
|
||||
tftp_write
|
||||
};
|
||||
|
||||
#endif /* LWIP_UDP */
|
||||
|
||||
static void
|
||||
tcpip_init_done(void *arg)
|
||||
{
|
||||
sys_sem_t *sem;
|
||||
sem = (sys_sem_t *)arg;
|
||||
|
||||
init_netifs();
|
||||
|
||||
#if LWIP_IPV4
|
||||
netbiosns_set_name("simhost");
|
||||
netbiosns_init();
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
sntp_setoperatingmode(SNTP_OPMODE_POLL);
|
||||
#if LWIP_DHCP
|
||||
sntp_servermode_dhcp(1); /* get SNTP server via DHCP */
|
||||
#else /* LWIP_DHCP */
|
||||
#if LWIP_IPV4
|
||||
sntp_setserver(0, netif_ip_gw4(&netif));
|
||||
#endif /* LWIP_IPV4 */
|
||||
#endif /* LWIP_DHCP */
|
||||
sntp_init();
|
||||
|
||||
#if LWIP_SNMP
|
||||
lwip_privmib_init();
|
||||
#if SNMP_LWIP_MIB2
|
||||
#if SNMP_USE_NETCONN
|
||||
snmp_threadsync_init(&snmp_mib2_lwip_locks, snmp_mib2_lwip_synchronizer);
|
||||
#endif /* SNMP_USE_NETCONN */
|
||||
snmp_mib2_set_syscontact_readonly((const u8_t*)"root", NULL);
|
||||
snmp_mib2_set_syslocation_readonly((const u8_t*)"lwIP development PC", NULL);
|
||||
snmp_mib2_set_sysdescr((const u8_t*)"simhost", NULL);
|
||||
#endif /* SNMP_LWIP_MIB2 */
|
||||
|
||||
#if LWIP_SNMP_V3
|
||||
snmpv3_dummy_init();
|
||||
#endif
|
||||
|
||||
snmp_set_mibs(mibs, LWIP_ARRAYSIZE(mibs));
|
||||
snmp_init();
|
||||
#endif /* LWIP_SNMP */
|
||||
|
||||
#if LWIP_MDNS_RESPONDER
|
||||
mdns_resp_init();
|
||||
mdns_resp_add_netif(&netif, "simhost", 3600);
|
||||
mdns_resp_add_service(&netif, "myweb", "_http", DNSSD_PROTO_TCP, 80, 3600, srv_txt, NULL);
|
||||
#endif
|
||||
|
||||
#if LWIP_UDP
|
||||
tftp_init(&tftp);
|
||||
#endif /* LWIP_UDP */
|
||||
|
||||
sys_sem_signal(sem);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#if LWIP_HAVE_SLIPIF
|
||||
/* (manual) host IP configuration */
|
||||
#if LWIP_IPV4
|
||||
static ip_addr_t ipaddr_slip, netmask_slip, gw_slip;
|
||||
#endif /* LWIP_IPV4 */
|
||||
struct netif slipif;
|
||||
#endif /* LWIP_HAVE_SLIPIF */
|
||||
|
||||
#if PPP_SUPPORT
|
||||
sio_fd_t ppp_sio;
|
||||
ppp_pcb *ppp;
|
||||
struct netif pppos_netif;
|
||||
|
||||
static void
|
||||
pppos_rx_thread(void *arg)
|
||||
{
|
||||
u32_t len;
|
||||
u8_t buffer[128];
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
|
||||
/* Please read the "PPPoS input path" chapter in the PPP documentation. */
|
||||
while (1) {
|
||||
len = sio_read(ppp_sio, buffer, sizeof(buffer));
|
||||
if (len > 0) {
|
||||
/* Pass received raw characters from PPPoS to be decoded through lwIP
|
||||
* TCPIP thread using the TCPIP API. This is thread safe in all cases
|
||||
* but you should avoid passing data byte after byte. */
|
||||
pppos_input_tcpip(ppp, buffer, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ppp_link_status_cb(ppp_pcb *pcb, int err_code, void *ctx)
|
||||
{
|
||||
struct netif *pppif = ppp_netif(pcb);
|
||||
LWIP_UNUSED_ARG(ctx);
|
||||
|
||||
switch(err_code) {
|
||||
case PPPERR_NONE: /* No error. */
|
||||
{
|
||||
#if LWIP_DNS
|
||||
const ip_addr_t *ns;
|
||||
#endif /* LWIP_DNS */
|
||||
fprintf(stderr, "ppp_link_status_cb: PPPERR_NONE\n\r");
|
||||
#if LWIP_IPV4
|
||||
fprintf(stderr, " our_ip4addr = %s\n\r", ip4addr_ntoa(netif_ip4_addr(pppif)));
|
||||
fprintf(stderr, " his_ipaddr = %s\n\r", ip4addr_ntoa(netif_ip4_gw(pppif)));
|
||||
fprintf(stderr, " netmask = %s\n\r", ip4addr_ntoa(netif_ip4_netmask(pppif)));
|
||||
#endif /* LWIP_IPV4 */
|
||||
#if LWIP_IPV6
|
||||
fprintf(stderr, " our_ip6addr = %s\n\r", ip6addr_ntoa(netif_ip6_addr(pppif, 0)));
|
||||
#endif /* LWIP_IPV6 */
|
||||
|
||||
#if LWIP_DNS
|
||||
ns = dns_getserver(0);
|
||||
fprintf(stderr, " dns1 = %s\n\r", ipaddr_ntoa(ns));
|
||||
ns = dns_getserver(1);
|
||||
fprintf(stderr, " dns2 = %s\n\r", ipaddr_ntoa(ns));
|
||||
#endif /* LWIP_DNS */
|
||||
#if PPP_IPV6_SUPPORT
|
||||
fprintf(stderr, " our6_ipaddr = %s\n\r", ip6addr_ntoa(netif_ip6_addr(pppif, 0)));
|
||||
#endif /* PPP_IPV6_SUPPORT */
|
||||
}
|
||||
break;
|
||||
|
||||
case PPPERR_PARAM: /* Invalid parameter. */
|
||||
printf("ppp_link_status_cb: PPPERR_PARAM\n");
|
||||
break;
|
||||
|
||||
case PPPERR_OPEN: /* Unable to open PPP session. */
|
||||
printf("ppp_link_status_cb: PPPERR_OPEN\n");
|
||||
break;
|
||||
|
||||
case PPPERR_DEVICE: /* Invalid I/O device for PPP. */
|
||||
printf("ppp_link_status_cb: PPPERR_DEVICE\n");
|
||||
break;
|
||||
|
||||
case PPPERR_ALLOC: /* Unable to allocate resources. */
|
||||
printf("ppp_link_status_cb: PPPERR_ALLOC\n");
|
||||
break;
|
||||
|
||||
case PPPERR_USER: /* User interrupt. */
|
||||
printf("ppp_link_status_cb: PPPERR_USER\n");
|
||||
break;
|
||||
|
||||
case PPPERR_CONNECT: /* Connection lost. */
|
||||
printf("ppp_link_status_cb: PPPERR_CONNECT\n");
|
||||
break;
|
||||
|
||||
case PPPERR_AUTHFAIL: /* Failed authentication challenge. */
|
||||
printf("ppp_link_status_cb: PPPERR_AUTHFAIL\n");
|
||||
break;
|
||||
|
||||
case PPPERR_PROTOCOL: /* Failed to meet protocol. */
|
||||
printf("ppp_link_status_cb: PPPERR_PROTOCOL\n");
|
||||
break;
|
||||
|
||||
case PPPERR_PEERDEAD: /* Connection timeout. */
|
||||
printf("ppp_link_status_cb: PPPERR_PEERDEAD\n");
|
||||
break;
|
||||
|
||||
case PPPERR_IDLETIMEOUT: /* Idle Timeout. */
|
||||
printf("ppp_link_status_cb: PPPERR_IDLETIMEOUT\n");
|
||||
break;
|
||||
|
||||
case PPPERR_CONNECTTIME: /* PPPERR_CONNECTTIME. */
|
||||
printf("ppp_link_status_cb: PPPERR_CONNECTTIME\n");
|
||||
break;
|
||||
|
||||
case PPPERR_LOOPBACK: /* Connection timeout. */
|
||||
printf("ppp_link_status_cb: PPPERR_LOOPBACK\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("ppp_link_status_cb: unknown errCode %d\n", err_code);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static u32_t
|
||||
ppp_output_cb(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx)
|
||||
{
|
||||
LWIP_UNUSED_ARG(pcb);
|
||||
LWIP_UNUSED_ARG(ctx);
|
||||
return sio_write(ppp_sio, data, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LWIP_NETIF_STATUS_CALLBACK
|
||||
static void
|
||||
netif_status_callback(struct netif *nif)
|
||||
{
|
||||
printf("NETIF: %c%c%d is %s\n", nif->name[0], nif->name[1], nif->num,
|
||||
netif_is_up(nif) ? "UP" : "DOWN");
|
||||
#if LWIP_IPV4
|
||||
printf("IPV4: Host at %s ", ip4addr_ntoa(netif_ip4_addr(nif)));
|
||||
printf("mask %s ", ip4addr_ntoa(netif_ip4_netmask(nif)));
|
||||
printf("gateway %s\n", ip4addr_ntoa(netif_ip4_gw(nif)));
|
||||
#endif /* LWIP_IPV4 */
|
||||
#if LWIP_IPV6
|
||||
printf("IPV6: Host at %s\n", ip6addr_ntoa(netif_ip6_addr(nif, 0)));
|
||||
#endif /* LWIP_IPV6 */
|
||||
#if LWIP_NETIF_HOSTNAME
|
||||
printf("FQDN: %s\n", netif_get_hostname(nif));
|
||||
#endif /* LWIP_NETIF_HOSTNAME */
|
||||
}
|
||||
#endif /* LWIP_NETIF_STATUS_CALLBACK */
|
||||
|
||||
static void
|
||||
init_netifs(void)
|
||||
{
|
||||
#if LWIP_HAVE_SLIPIF
|
||||
#if SLIP_PTY_TEST
|
||||
u8_t siodev_slip = 3;
|
||||
#else
|
||||
u8_t siodev_slip = 0;
|
||||
#endif
|
||||
|
||||
#if LWIP_IPV4
|
||||
netif_add(&slipif, ip_2_ip4(&ipaddr_slip), ip_2_ip4(&netmask_slip), ip_2_ip4(&gw_slip),
|
||||
(void*)&siodev_slip, slipif_init, tcpip_input);
|
||||
#else /* LWIP_IPV4 */
|
||||
netif_add(&slipif, (void*)&siodev_slip, slipif_init, tcpip_input);
|
||||
#endif /* LWIP_IPV4 */
|
||||
#if LWIP_IPV6
|
||||
netif_create_ip6_linklocal_address(&slipif, 1);
|
||||
#endif
|
||||
#if LWIP_NETIF_STATUS_CALLBACK
|
||||
netif_set_status_callback(&slipif, netif_status_callback);
|
||||
#endif /* LWIP_NETIF_STATUS_CALLBACK */
|
||||
netif_set_link_up(&slipif);
|
||||
netif_set_up(&slipif);
|
||||
#endif /* LWIP_HAVE_SLIPIF */
|
||||
|
||||
#if PPP_SUPPORT
|
||||
#if PPP_PTY_TEST
|
||||
ppp_sio = sio_open(2);
|
||||
#else
|
||||
ppp_sio = sio_open(0);
|
||||
#endif
|
||||
if(!ppp_sio)
|
||||
{
|
||||
perror("Error opening device: ");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ppp = pppos_create(&pppos_netif, ppp_output_cb, ppp_link_status_cb, NULL);
|
||||
if (!ppp)
|
||||
{
|
||||
printf("Could not create PPP control interface");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef LWIP_PPP_CHAP_TEST
|
||||
ppp_set_auth(ppp, PPPAUTHTYPE_CHAP, "lwip", "mysecret");
|
||||
#endif
|
||||
|
||||
ppp_connect(ppp, 0);
|
||||
|
||||
#if LWIP_NETIF_STATUS_CALLBACK
|
||||
netif_set_status_callback(&pppos_netif, netif_status_callback);
|
||||
#endif /* LWIP_NETIF_STATUS_CALLBACK */
|
||||
#endif /* PPP_SUPPORT */
|
||||
|
||||
#if LWIP_IPV4
|
||||
#if LWIP_DHCP
|
||||
IP_ADDR4(&gw, 0,0,0,0);
|
||||
IP_ADDR4(&ipaddr, 0,0,0,0);
|
||||
IP_ADDR4(&netmask, 0,0,0,0);
|
||||
#endif /* LWIP_DHCP */
|
||||
netif_add(&netif, ip_2_ip4(&ipaddr), ip_2_ip4(&netmask), ip_2_ip4(&gw), NULL, tapif_init, tcpip_input);
|
||||
#else /* LWIP_IPV4 */
|
||||
netif_add(&netif, NULL, tapif_init, tcpip_input);
|
||||
#endif /* LWIP_IPV4 */
|
||||
#if LWIP_IPV6
|
||||
netif_create_ip6_linklocal_address(&netif, 1);
|
||||
netif.ip6_autoconfig_enabled = 1;
|
||||
#endif
|
||||
#if LWIP_NETIF_STATUS_CALLBACK
|
||||
netif_set_status_callback(&netif, netif_status_callback);
|
||||
#endif /* LWIP_NETIF_STATUS_CALLBACK */
|
||||
netif_set_default(&netif);
|
||||
netif_set_up(&netif);
|
||||
|
||||
#if LWIP_DHCP
|
||||
dhcp_start(&netif);
|
||||
#endif /* LWIP_DHCP */
|
||||
|
||||
#if 0
|
||||
/* Only used for testing purposes: */
|
||||
netif_add(&ipaddr, &netmask, &gw, NULL, pcapif_init, tcpip_input);
|
||||
#endif
|
||||
|
||||
#if LWIP_TCP
|
||||
netio_init();
|
||||
#endif
|
||||
#if LWIP_TCP && LWIP_NETCONN
|
||||
tcpecho_init();
|
||||
shell_init();
|
||||
httpd_init();
|
||||
#endif
|
||||
#if LWIP_UDP && LWIP_NETCONN
|
||||
udpecho_init();
|
||||
#endif
|
||||
#if LWIP_SOCKET
|
||||
chargen_init();
|
||||
#endif
|
||||
/* sys_timeout(5000, tcp_debug_timeout, NULL);*/
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
main_thread(void *arg)
|
||||
{
|
||||
sys_sem_t sem;
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
|
||||
lwip_init_tcp_isn(sys_now(), (u8_t*)&netif);
|
||||
|
||||
if(sys_sem_new(&sem, 0) != ERR_OK) {
|
||||
LWIP_ASSERT("Failed to create semaphore", 0);
|
||||
}
|
||||
tcpip_init(tcpip_init_done, &sem);
|
||||
sys_sem_wait(&sem);
|
||||
printf("TCP/IP initialized.\n");
|
||||
|
||||
#if LWIP_SOCKET
|
||||
if (ping_flag) {
|
||||
ping_init(&ping_addr);
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("Applications started.\n");
|
||||
|
||||
#ifdef MEM_PERF
|
||||
mem_perf_init("/tmp/memstats.client");
|
||||
#endif /* MEM_PERF */
|
||||
#if 0
|
||||
stats_display();
|
||||
#endif
|
||||
#if PPP_SUPPORT
|
||||
/* Block forever. */
|
||||
sys_thread_new("pppos_rx_thread", pppos_rx_thread, NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO);
|
||||
sys_sem_wait(&sem);
|
||||
#endif
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int ch;
|
||||
char ip_str[IPADDR_STRLEN_MAX] = {0};
|
||||
|
||||
/* startup defaults (may be overridden by one or more opts) */
|
||||
#if LWIP_IPV4
|
||||
IP_ADDR4(&gw, 192,168, 0,1);
|
||||
IP_ADDR4(&netmask, 255,255,255,0);
|
||||
IP_ADDR4(&ipaddr, 192,168, 0,2);
|
||||
#if LWIP_HAVE_SLIPIF
|
||||
IP_ADDR4(&gw_slip, 192,168, 2, 1);
|
||||
IP_ADDR4(&netmask_slip, 255,255,255,255);
|
||||
IP_ADDR4(&ipaddr_slip, 192,168, 2, 2);
|
||||
#endif
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
ping_flag = 0;
|
||||
/* use debug flags defined by debug.h */
|
||||
debug_flags = LWIP_DBG_OFF;
|
||||
|
||||
while ((ch = getopt_long(argc, argv, "dhg:i:m:p:", longopts, NULL)) != -1) {
|
||||
switch (ch) {
|
||||
case 'd':
|
||||
debug_flags |= (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT);
|
||||
break;
|
||||
case 'h':
|
||||
usage();
|
||||
exit(0);
|
||||
break;
|
||||
#if LWIP_IPV4
|
||||
case 'g':
|
||||
ipaddr_aton(optarg, &gw);
|
||||
break;
|
||||
case 'i':
|
||||
ipaddr_aton(optarg, &ipaddr);
|
||||
break;
|
||||
case 'm':
|
||||
ipaddr_aton(optarg, &netmask);
|
||||
break;
|
||||
#endif /* LWIP_IPV4 */
|
||||
case 'p':
|
||||
ping_flag = !0;
|
||||
ipaddr_aton(optarg, &ping_addr);
|
||||
strncpy(ip_str,ipaddr_ntoa(&ping_addr),sizeof(ip_str));
|
||||
ip_str[sizeof(ip_str)-1] = 0; /* ensure \0 termination */
|
||||
printf("Using %s to ping\n", ip_str);
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
#ifdef PERF
|
||||
perf_init("/tmp/simhost.perf");
|
||||
#endif /* PERF */
|
||||
|
||||
printf("System initialized.\n");
|
||||
|
||||
sys_thread_new("main_thread", main_thread, NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO);
|
||||
pause();
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
@@ -1,181 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/debug.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/memp.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/tcp.h"
|
||||
#include "lwip/priv/tcp_priv.h" /* for tcp_debug_print_pcbs() */
|
||||
#include "lwip/timeouts.h"
|
||||
|
||||
#include "lwip/stats.h"
|
||||
|
||||
|
||||
#include "lwip/tcpip.h"
|
||||
|
||||
|
||||
#include "netif/unixif.h"
|
||||
#include "netif/dropif.h"
|
||||
|
||||
#include "netif/tcpdump.h"
|
||||
|
||||
#include "lwip/ip_addr.h"
|
||||
|
||||
#include "arch/perf.h"
|
||||
|
||||
#include "lwip/apps/httpd.h"
|
||||
#include "apps/udpecho/udpecho.h"
|
||||
#include "apps/tcpecho/tcpecho.h"
|
||||
#include "apps/shell/shell.h"
|
||||
|
||||
#if LWIP_IPV4 /* @todo: IPv6 */
|
||||
|
||||
/* nonstatic debug cmd option, exported in lwipopts.h */
|
||||
unsigned char debug_flags;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
tcp_timeout(void *data)
|
||||
{
|
||||
LWIP_UNUSED_ARG(data);
|
||||
#if TCP_DEBUG && LWIP_TCP
|
||||
tcp_debug_print_pcbs();
|
||||
#endif /* TCP_DEBUG */
|
||||
sys_timeout(5000, tcp_timeout, NULL);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
struct netif netif_unix;
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
tcpip_init_done(void *arg)
|
||||
{
|
||||
ip4_addr_t ipaddr, netmask, gw;
|
||||
sys_sem_t *sem;
|
||||
sem = (sys_sem_t *)arg;
|
||||
|
||||
IP4_ADDR(&gw, 192,168,1,1);
|
||||
IP4_ADDR(&ipaddr, 192,168,1,2);
|
||||
IP4_ADDR(&netmask, 255,255,255,0);
|
||||
|
||||
netif_set_default(netif_add(&netif_unix, &ipaddr, &netmask, &gw, NULL, unixif_init_client,
|
||||
tcpip_input));
|
||||
netif_set_up(&netif_unix);
|
||||
#if LWIP_IPV6
|
||||
netif_create_ip6_linklocal_address(&netif_unix, 1);
|
||||
#endif
|
||||
/* netif_set_default(netif_add(&ipaddr, &netmask, &gw, NULL, sioslipif_init1,
|
||||
tcpip_input)); */
|
||||
|
||||
#if LWIP_NETCONN
|
||||
tcpecho_init();
|
||||
shell_init();
|
||||
#if LWIP_IPV4 && LWIP_TCP
|
||||
httpd_init();
|
||||
#endif
|
||||
udpecho_init();
|
||||
#endif
|
||||
|
||||
printf("Applications started.\n");
|
||||
|
||||
sys_timeout(5000, tcp_timeout, NULL);
|
||||
|
||||
sys_sem_signal(sem);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
main_thread(void *arg)
|
||||
{
|
||||
sys_sem_t sem;
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
|
||||
if(sys_sem_new(&sem, 0) != ERR_OK) {
|
||||
LWIP_ASSERT("Failed to create semaphore", 0);
|
||||
}
|
||||
tcpip_init(tcpip_init_done, &sem);
|
||||
sys_sem_wait(&sem);
|
||||
printf("TCP/IP initialized.\n");
|
||||
|
||||
#ifdef MEM_PERF
|
||||
mem_perf_init("/tmp/memstats.client");
|
||||
#endif /* MEM_PERF */
|
||||
|
||||
/* Block forever. */
|
||||
sys_sem_wait(&sem);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
#ifdef PERF
|
||||
perf_init("/tmp/client.perf");
|
||||
#endif /* PERF */
|
||||
|
||||
#if LWIP_IPV4 && LWIP_TCP
|
||||
tcpdump_init();
|
||||
#endif
|
||||
|
||||
printf("System initialized.\n");
|
||||
|
||||
sys_thread_new("main_thread", main_thread, NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO);
|
||||
pause();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* LWIP_IPV4 */
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
LWIP_UNUSED_ARG(argc);
|
||||
LWIP_UNUSED_ARG(argv);
|
||||
|
||||
printf("simnode only works with IPv4\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
/* dummy, because SNTP is pulled in via LWIP_DHCP_GET_NTP_SRV */
|
||||
void
|
||||
sntp_set_system_time(u32_t sec)
|
||||
{
|
||||
LWIP_UNUSED_ARG(sec);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
@@ -1,203 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/debug.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/memp.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/tcp.h"
|
||||
#include "lwip/priv/tcp_priv.h" /* for tcp_debug_print_pcbs() */
|
||||
#include "lwip/timeouts.h"
|
||||
|
||||
#include "lwip/stats.h"
|
||||
|
||||
|
||||
#include "lwip/tcpip.h"
|
||||
|
||||
#include "netif/tapif.h"
|
||||
|
||||
#include "netif/unixif.h"
|
||||
#include "netif/dropif.h"
|
||||
|
||||
#include "netif/tcpdump.h"
|
||||
|
||||
|
||||
#include "lwip/ip_addr.h"
|
||||
|
||||
#include "arch/perf.h"
|
||||
|
||||
#include "lwip/apps/httpd.h"
|
||||
#include "apps/udpecho/udpecho.h"
|
||||
#include "apps/tcpecho/tcpecho.h"
|
||||
#include "apps/shell/shell.h"
|
||||
|
||||
#if LWIP_IPV4 /* @todo: IPv6 */
|
||||
|
||||
/* nonstatic debug cmd option, exported in lwipopts.h */
|
||||
unsigned char debug_flags;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
tcp_timeout(void *data)
|
||||
{
|
||||
LWIP_UNUSED_ARG(data);
|
||||
#if TCP_DEBUG && LWIP_TCP
|
||||
tcp_debug_print_pcbs();
|
||||
#endif /* TCP_DEBUG */
|
||||
sys_timeout(5000, tcp_timeout, NULL);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
struct netif netif_tap, netif_unix;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
tcpip_init_done(void *arg)
|
||||
{
|
||||
ip4_addr_t ipaddr, netmask, gw;
|
||||
sys_sem_t *sem;
|
||||
sem = (sys_sem_t *)arg;
|
||||
|
||||
IP4_ADDR(&gw, 192,168,0,1);
|
||||
IP4_ADDR(&ipaddr, 192,168,0,2);
|
||||
IP4_ADDR(&netmask, 255,255,255,0);
|
||||
|
||||
netif_set_default(netif_add(&netif_tap, &ipaddr, &netmask, &gw, NULL, tapif_init,
|
||||
tcpip_input));
|
||||
netif_set_up(&netif_tap);
|
||||
#if LWIP_IPV6
|
||||
netif_create_ip6_linklocal_address(&netif_tap, 1);
|
||||
#endif
|
||||
|
||||
IP4_ADDR(&gw, 192,168,1,1);
|
||||
IP4_ADDR(&ipaddr, 192,168,1,1);
|
||||
IP4_ADDR(&netmask, 255,255,255,0);
|
||||
netif_set_default(netif_add(&netif_unix, &ipaddr, &netmask, &gw, NULL, unixif_init_server,
|
||||
tcpip_input));
|
||||
netif_set_up(&netif_unix);
|
||||
#if LWIP_IPV6
|
||||
netif_create_ip6_linklocal_address(&netif_unix, 1);
|
||||
#endif
|
||||
|
||||
if(system("route add 192.168.1.1 192.168.0.2") != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(system("route add 192.168.1.2 192.168.0.2") != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*netif_set_default(netif_add(&ipaddr, &netmask, &gw, NULL, sioslipif_init1,
|
||||
tcpip_input)); */
|
||||
|
||||
#if LWIP_NETCONN
|
||||
tcpecho_init();
|
||||
shell_init();
|
||||
#if LWIP_IPV4 && LWIP_TCP
|
||||
httpd_init();
|
||||
#endif
|
||||
udpecho_init();
|
||||
#endif
|
||||
|
||||
printf("Applications started.\n");
|
||||
|
||||
sys_timeout(5000, tcp_timeout, NULL);
|
||||
|
||||
sys_sem_signal(sem);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
main_thread(void *arg)
|
||||
{
|
||||
sys_sem_t sem;
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
|
||||
if(sys_sem_new(&sem, 0) != ERR_OK) {
|
||||
LWIP_ASSERT("Failed to create semaphore", 0);
|
||||
}
|
||||
tcpip_init(tcpip_init_done, &sem);
|
||||
sys_sem_wait(&sem);
|
||||
printf("TCP/IP initialized.\n");
|
||||
|
||||
#ifdef MEM_PERF
|
||||
mem_perf_init("/tmp/memstats.client");
|
||||
#endif /* MEM_PERF */
|
||||
/* Block forever. */
|
||||
sys_sem_wait(&sem);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
#ifdef PERF
|
||||
perf_init("/tmp/client.perf");
|
||||
#endif /* PERF */
|
||||
|
||||
#if LWIP_IPV4 && LWIP_TCP
|
||||
tcpdump_init();
|
||||
#endif
|
||||
|
||||
printf("System initialized.\n");
|
||||
sys_thread_new("main_thread", main_thread, NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO);
|
||||
pause();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* LWIP_IPV4 */
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
LWIP_UNUSED_ARG(argc);
|
||||
LWIP_UNUSED_ARG(argv);
|
||||
|
||||
printf("simrouter only works with IPv4\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
/* dummy, because SNTP is pulled in via LWIP_DHCP_GET_NTP_SRV */
|
||||
void
|
||||
sntp_set_system_time(u32_t sec)
|
||||
{
|
||||
LWIP_UNUSED_ARG(sec);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
@@ -1 +0,0 @@
|
||||
/* deliberateliy empty */
|
||||
@@ -1,30 +0,0 @@
|
||||
/* config.h for check-0.11.0 on win32 under MSVC/MinGW */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
typedef unsigned int pid_t;
|
||||
typedef unsigned int uint32_t;
|
||||
|
||||
typedef int ssize_t;
|
||||
#define snprintf _snprintf
|
||||
|
||||
#define HAVE_DECL_STRDUP 1
|
||||
#define HAVE_DECL_FILENO 1
|
||||
#define HAVE_DECL_PUTENV 1
|
||||
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
/* disable some warnings */
|
||||
#pragma warning (disable: 4090) /* const assigned to non-const */
|
||||
#pragma warning (disable: 4996) /* fileno is deprecated */
|
||||
|
||||
#endif /* _ MSC_VER */
|
||||
|
||||
|
||||
#define LWIP_UNITTESTS_NOFORK
|
||||
|
||||
#include <io.h>
|
||||
|
||||
typedef unsigned int clockid_t;
|
||||
typedef unsigned int timer_t;
|
||||
#define STRUCT_TIMESPEC_DEFINITION_MISSING
|
||||
@@ -1,9 +0,0 @@
|
||||
#ifndef MY_STDBOOL_H
|
||||
#define MY_STDBOOL_H
|
||||
|
||||
typedef int bool;
|
||||
#define true 1
|
||||
#define false 0
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#endif
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef LWIP_SYS__TIME_H
|
||||
#define LWIP_SYS__TIME_H
|
||||
|
||||
#include <stdlib.h> /* time_t */
|
||||
|
||||
struct timeval {
|
||||
time_t tv_sec; /* seconds */
|
||||
long tv_usec; /* and microseconds */
|
||||
};
|
||||
int gettimeofday(struct timeval* tp, void* tzp);
|
||||
|
||||
#endif
|
||||
@@ -1,64 +0,0 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <windows.h>
|
||||
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
|
||||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
|
||||
#else
|
||||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
|
||||
struct timezone
|
||||
{
|
||||
int tz_minuteswest; /* minutes W of Greenwich */
|
||||
int tz_dsttime; /* type of dst correction */
|
||||
};
|
||||
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
{
|
||||
FILETIME ft;
|
||||
unsigned __int64 tmpres = 0;
|
||||
static int tzflag;
|
||||
|
||||
if (NULL != tv)
|
||||
{
|
||||
GetSystemTimeAsFileTime(&ft);
|
||||
|
||||
tmpres |= ft.dwHighDateTime;
|
||||
tmpres <<= 32;
|
||||
tmpres |= ft.dwLowDateTime;
|
||||
|
||||
/*converting file time to unix epoch*/
|
||||
tmpres -= DELTA_EPOCH_IN_MICROSECS;
|
||||
tmpres /= 10; /*convert into microseconds*/
|
||||
tv->tv_sec = (long)(tmpres / 1000000UL);
|
||||
tv->tv_usec = (long)(tmpres % 1000000UL);
|
||||
}
|
||||
|
||||
if (NULL != tz)
|
||||
{
|
||||
if (!tzflag)
|
||||
{
|
||||
_tzset();
|
||||
tzflag++;
|
||||
}
|
||||
tz->tz_minuteswest = _timezone / 60;
|
||||
tz->tz_dsttime = _daylight;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct tm *
|
||||
localtime_r(const time_t *timer, struct tm *result)
|
||||
{
|
||||
struct tm *local_result;
|
||||
local_result = localtime (timer);
|
||||
|
||||
if (local_result == NULL || result == NULL)
|
||||
return NULL;
|
||||
|
||||
memcpy(result, local_result, sizeof (result));
|
||||
return result;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
#ifndef LWIP_UNISTD_H
|
||||
#define LWIP_UNISTD_H
|
||||
|
||||
/* include io.h for read() and write() */
|
||||
#include <io.h>
|
||||
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
#pragma pack(push,1)
|
||||
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_ARCH_CC_H
|
||||
#define LWIP_ARCH_CC_H
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (disable: 4127) /* conditional expression is constant */
|
||||
#pragma warning (disable: 4996) /* 'strncpy' was declared deprecated */
|
||||
#pragma warning (disable: 4103) /* structure packing changed by including file */
|
||||
#pragma warning (disable: 4820) /* 'x' bytes padding added after data member 'y' */
|
||||
#endif
|
||||
|
||||
#define LWIP_PROVIDE_ERRNO 0
|
||||
|
||||
/* Define platform endianness (might already be defined) */
|
||||
#ifndef BYTE_ORDER
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif /* BYTE_ORDER */
|
||||
|
||||
typedef int sys_prot_t;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* define _INTPTR for Win32 MSVC stdint.h */
|
||||
#define _INTPTR 2
|
||||
|
||||
/* Do not use lwIP default definitions for format strings
|
||||
* because these do not work with MSVC 2010 compiler (no inttypes.h)
|
||||
*/
|
||||
#define LWIP_NO_INTTYPES_H 1
|
||||
|
||||
/* Define (sn)printf formatters for these lwIP types */
|
||||
#define X8_F "02x"
|
||||
#define U16_F "hu"
|
||||
#define U32_F "lu"
|
||||
#define S32_F "ld"
|
||||
#define X32_F "lx"
|
||||
|
||||
#define S16_F "hd"
|
||||
#define X16_F "hx"
|
||||
#define SZT_F "lu"
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* Compiler hints for packing structures */
|
||||
#define PACK_STRUCT_USE_INCLUDES
|
||||
|
||||
#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
|
||||
printf("Assertion \"%s\" failed at line %d in %s\n", message, __LINE__, __FILE__); \
|
||||
fflush(NULL);handler;} } while(0)
|
||||
|
||||
#if _MSC_VER < 1900
|
||||
/* C runtime functions redefined */
|
||||
#define snprintf _snprintf
|
||||
#define strdup _strdup
|
||||
#endif
|
||||
|
||||
#ifndef LWIP_NORAND
|
||||
extern unsigned int sys_win_rand(void);
|
||||
#define LWIP_RAND() (sys_win_rand())
|
||||
#endif
|
||||
|
||||
#define PPP_INCLUDE_SETTINGS_HEADER
|
||||
|
||||
#endif /* LWIP_ARCH_CC_H */
|
||||
@@ -1 +0,0 @@
|
||||
#pragma pack(pop)
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_PERF_H
|
||||
#define LWIP_PERF_H
|
||||
|
||||
#define PERF_START /* null definition */
|
||||
#define PERF_STOP(x) /* null definition */
|
||||
|
||||
#endif /* LWIP_PERF_H */
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_ARCH_SYS_ARCH_H
|
||||
#define LWIP_ARCH_SYS_ARCH_H
|
||||
|
||||
/* HANDLE is used for sys_sem_t but we won't include windows.h */
|
||||
struct _sys_sem {
|
||||
void *sem;
|
||||
};
|
||||
typedef struct _sys_sem sys_sem_t;
|
||||
#define sys_sem_valid_val(sema) (((sema).sem != NULL) && ((sema).sem != (void*)-1))
|
||||
#define sys_sem_valid(sema) (((sema) != NULL) && sys_sem_valid_val(*(sema)))
|
||||
#define sys_sem_set_invalid(sema) ((sema)->sem = NULL)
|
||||
|
||||
/* HANDLE is used for sys_mutex_t but we won't include windows.h */
|
||||
struct _sys_mut {
|
||||
void *mut;
|
||||
};
|
||||
typedef struct _sys_mut sys_mutex_t;
|
||||
#define sys_mutex_valid_val(mutex) (((mutex).mut != NULL) && ((mutex).mut != (void*)-1))
|
||||
#define sys_mutex_valid(mutex) (((mutex) != NULL) && sys_mutex_valid_val(*(mutex)))
|
||||
#define sys_mutex_set_invalid(mutex) ((mutex)->mut = NULL)
|
||||
|
||||
#ifndef MAX_QUEUE_ENTRIES
|
||||
#define MAX_QUEUE_ENTRIES 100
|
||||
#endif
|
||||
struct lwip_mbox {
|
||||
void* sem;
|
||||
void* q_mem[MAX_QUEUE_ENTRIES];
|
||||
u32_t head, tail;
|
||||
};
|
||||
typedef struct lwip_mbox sys_mbox_t;
|
||||
#define SYS_MBOX_NULL NULL
|
||||
#define sys_mbox_valid_val(mbox) (((mbox).sem != NULL) && ((mbox).sem != (void*)-1))
|
||||
#define sys_mbox_valid(mbox) ((mbox != NULL) && sys_mbox_valid_val(*(mbox)))
|
||||
#define sys_mbox_set_invalid(mbox) ((mbox)->sem = NULL)
|
||||
|
||||
/* DWORD (thread id) is used for sys_thread_t but we won't include windows.h */
|
||||
typedef u32_t sys_thread_t;
|
||||
|
||||
sys_sem_t* sys_arch_netconn_sem_get(void);
|
||||
void sys_arch_netconn_sem_alloc(void);
|
||||
void sys_arch_netconn_sem_free(void);
|
||||
#define LWIP_NETCONN_THREAD_SEM_GET() sys_arch_netconn_sem_get()
|
||||
#define LWIP_NETCONN_THREAD_SEM_ALLOC() sys_arch_netconn_sem_alloc()
|
||||
#define LWIP_NETCONN_THREAD_SEM_FREE() sys_arch_netconn_sem_free()
|
||||
|
||||
int lwip_win32_keypressed(void);
|
||||
|
||||
#endif /* LWIP_ARCH_SYS_ARCH_H */
|
||||
|
||||
@@ -1,308 +0,0 @@
|
||||
/*
|
||||
* 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 LWIP_LWIPOPTS_H
|
||||
#define LWIP_LWIPOPTS_H
|
||||
|
||||
#define LWIP_IPV4 1
|
||||
#define LWIP_IPV6 1
|
||||
|
||||
#define NO_SYS 0
|
||||
#define LWIP_SOCKET (NO_SYS==0)
|
||||
#define LWIP_NETCONN (NO_SYS==0)
|
||||
#define LWIP_NETIF_API (NO_SYS==0)
|
||||
|
||||
#define LWIP_IGMP LWIP_IPV4
|
||||
#define LWIP_ICMP LWIP_IPV4
|
||||
|
||||
#define LWIP_SNMP LWIP_UDP
|
||||
#define MIB2_STATS LWIP_SNMP
|
||||
#ifdef LWIP_HAVE_MBEDTLS
|
||||
#define LWIP_SNMP_V3 (LWIP_SNMP)
|
||||
#endif
|
||||
|
||||
#define LWIP_DNS LWIP_UDP
|
||||
#define LWIP_MDNS_RESPONDER LWIP_UDP
|
||||
|
||||
#define LWIP_NUM_NETIF_CLIENT_DATA (LWIP_MDNS_RESPONDER)
|
||||
|
||||
#define LWIP_HAVE_LOOPIF 1
|
||||
#define LWIP_NETIF_LOOPBACK 1
|
||||
#define LWIP_LOOPBACK_MAX_PBUFS 10
|
||||
|
||||
#define TCP_LISTEN_BACKLOG 1
|
||||
|
||||
#define LWIP_COMPAT_SOCKETS 1
|
||||
#define LWIP_SO_RCVTIMEO 1
|
||||
#define LWIP_SO_RCVBUF 1
|
||||
|
||||
#define LWIP_TCPIP_CORE_LOCKING 1
|
||||
|
||||
#define LWIP_NETIF_LINK_CALLBACK 1
|
||||
#define LWIP_NETIF_STATUS_CALLBACK 1
|
||||
|
||||
#ifdef LWIP_DEBUG
|
||||
|
||||
#define LWIP_DBG_MIN_LEVEL 0
|
||||
#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 DNS_DEBUG LWIP_DBG_OFF
|
||||
#define AUTOIP_DEBUG LWIP_DBG_OFF
|
||||
#define DHCP_DEBUG LWIP_DBG_OFF
|
||||
#define IP_DEBUG LWIP_DBG_OFF
|
||||
#define IP_REASS_DEBUG LWIP_DBG_OFF
|
||||
#define ICMP_DEBUG LWIP_DBG_OFF
|
||||
#define IGMP_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)
|
||||
|
||||
|
||||
/* ---------- Memory options ---------- */
|
||||
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
|
||||
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
|
||||
byte alignment -> define MEM_ALIGNMENT to 2. */
|
||||
/* MSVC port: intel processors don't need 4-byte alignment,
|
||||
but are faster that way! */
|
||||
#define MEM_ALIGNMENT 4U
|
||||
|
||||
/* MEM_SIZE: the size of the heap memory. If the application will send
|
||||
a lot of data that needs to be copied, this should be set high. */
|
||||
#define MEM_SIZE 10240
|
||||
|
||||
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
|
||||
sends a lot of data out of ROM (or other static memory), this
|
||||
should be set high. */
|
||||
#define MEMP_NUM_PBUF 16
|
||||
/* MEMP_NUM_RAW_PCB: the number of UDP protocol control blocks. One
|
||||
per active RAW "connection". */
|
||||
#define MEMP_NUM_RAW_PCB 3
|
||||
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
|
||||
per active UDP "connection". */
|
||||
#define MEMP_NUM_UDP_PCB 4
|
||||
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
|
||||
connections. */
|
||||
#define MEMP_NUM_TCP_PCB 5
|
||||
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
|
||||
connections. */
|
||||
#define MEMP_NUM_TCP_PCB_LISTEN 8
|
||||
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
|
||||
segments. */
|
||||
#define MEMP_NUM_TCP_SEG 16
|
||||
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
|
||||
timeouts. */
|
||||
#define MEMP_NUM_SYS_TIMEOUT 17
|
||||
|
||||
/* The following four are used only with the sequential API and can be
|
||||
set to 0 if the application only will use the raw API. */
|
||||
/* MEMP_NUM_NETBUF: the number of struct netbufs. */
|
||||
#define MEMP_NUM_NETBUF 2
|
||||
/* MEMP_NUM_NETCONN: the number of struct netconns. */
|
||||
#define MEMP_NUM_NETCONN 10
|
||||
/* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
|
||||
for sequential API communication and incoming packets. Used in
|
||||
src/api/tcpip.c. */
|
||||
#define MEMP_NUM_TCPIP_MSG_API 16
|
||||
#define MEMP_NUM_TCPIP_MSG_INPKT 16
|
||||
|
||||
|
||||
/* ---------- Pbuf options ---------- */
|
||||
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
|
||||
#define PBUF_POOL_SIZE 160
|
||||
|
||||
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
|
||||
#define PBUF_POOL_BUFSIZE 128
|
||||
|
||||
/* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
|
||||
link level header. */
|
||||
#define PBUF_LINK_HLEN 16
|
||||
|
||||
/** SYS_LIGHTWEIGHT_PROT
|
||||
* define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
|
||||
* for certain critical regions during buffer allocation, deallocation and memory
|
||||
* allocation and deallocation.
|
||||
*/
|
||||
#define SYS_LIGHTWEIGHT_PROT (NO_SYS==0)
|
||||
|
||||
|
||||
/* ---------- TCP options ---------- */
|
||||
#define LWIP_TCP 1
|
||||
#define TCP_TTL 255
|
||||
|
||||
#define LWIP_ALTCP (LWIP_TCP)
|
||||
#ifdef LWIP_HAVE_MBEDTLS
|
||||
#define LWIP_ALTCP_TLS (LWIP_TCP)
|
||||
#define LWIP_ALTCP_TLS_MBEDTLS (LWIP_TCP)
|
||||
#endif
|
||||
|
||||
|
||||
/* Controls if TCP should queue segments that arrive out of
|
||||
order. Define to 0 if your device is low on memory. */
|
||||
#define TCP_QUEUE_OOSEQ 1
|
||||
|
||||
/* TCP Maximum segment size. */
|
||||
#define TCP_MSS 1024
|
||||
|
||||
/* TCP sender buffer space (bytes). */
|
||||
#define TCP_SND_BUF 2048
|
||||
|
||||
/* 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)
|
||||
|
||||
/* 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)
|
||||
|
||||
/* TCP receive window. */
|
||||
#define TCP_WND 8096
|
||||
|
||||
/* Maximum number of retransmissions of data segments. */
|
||||
#define TCP_MAXRTX 12
|
||||
|
||||
/* Maximum number of retransmissions of SYN segments. */
|
||||
#define TCP_SYNMAXRTX 4
|
||||
|
||||
|
||||
/* ---------- ARP options ---------- */
|
||||
#define LWIP_ARP 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
|
||||
IP packets across network interfaces. If you are going to run lwIP
|
||||
on a device with only one network interface, define this to 0. */
|
||||
#define IP_FORWARD 1
|
||||
|
||||
/* IP reassembly and segmentation.These are orthogonal even
|
||||
* if they both deal with IP fragments */
|
||||
#define IP_REASSEMBLY 1
|
||||
#define IP_REASS_MAX_PBUFS 10
|
||||
#define MEMP_NUM_REASSDATA 10
|
||||
#define IP_FRAG 1
|
||||
|
||||
|
||||
/* ---------- ICMP options ---------- */
|
||||
#define ICMP_TTL 255
|
||||
|
||||
|
||||
/* ---------- DHCP options ---------- */
|
||||
/* Define LWIP_DHCP to 1 if you want DHCP configuration of
|
||||
interfaces. */
|
||||
#define LWIP_DHCP LWIP_UDP
|
||||
|
||||
/* 1 if you want to do an ARP check on the offered address
|
||||
(recommended). */
|
||||
#define DHCP_DOES_ARP_CHECK (LWIP_DHCP)
|
||||
|
||||
|
||||
/* ---------- AUTOIP options ------- */
|
||||
#define LWIP_AUTOIP (LWIP_DHCP)
|
||||
#define LWIP_DHCP_AUTOIP_COOP (LWIP_DHCP && LWIP_AUTOIP)
|
||||
|
||||
|
||||
/* ---------- UDP options ---------- */
|
||||
#define LWIP_UDP 1
|
||||
#define LWIP_UDPLITE LWIP_UDP
|
||||
#define UDP_TTL 255
|
||||
|
||||
|
||||
/* ---------- RAW options ---------- */
|
||||
#define LWIP_RAW 1
|
||||
|
||||
|
||||
/* ---------- Statistics options ---------- */
|
||||
|
||||
#define LWIP_STATS 1
|
||||
#define LWIP_STATS_DISPLAY 1
|
||||
|
||||
#if LWIP_STATS
|
||||
#define LINK_STATS 1
|
||||
#define IP_STATS 1
|
||||
#define ICMP_STATS 1
|
||||
#define IGMP_STATS 1
|
||||
#define IPFRAG_STATS 1
|
||||
#define UDP_STATS 1
|
||||
#define TCP_STATS 1
|
||||
#define MEM_STATS 1
|
||||
#define MEMP_STATS 1
|
||||
#define PBUF_STATS 1
|
||||
#define SYS_STATS 1
|
||||
#endif /* LWIP_STATS */
|
||||
|
||||
|
||||
/* ---------- PPP options ---------- */
|
||||
|
||||
#define PPP_SUPPORT 1 /* Set > 0 for PPP */
|
||||
|
||||
#if PPP_SUPPORT
|
||||
|
||||
#define NUM_PPP 1 /* Max PPP sessions. */
|
||||
|
||||
|
||||
/* Select modules to enable. Ideally these would be set in the makefile but
|
||||
* we're limited by the command line length so you need to modify the settings
|
||||
* in this file.
|
||||
*/
|
||||
#define PPPOE_SUPPORT 1
|
||||
#define PPPOS_SUPPORT 1
|
||||
|
||||
#define PAP_SUPPORT 1 /* Set > 0 for PAP. */
|
||||
#define CHAP_SUPPORT 1 /* Set > 0 for CHAP. */
|
||||
#define MSCHAP_SUPPORT 0 /* Set > 0 for MSCHAP */
|
||||
#define CBCP_SUPPORT 0 /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
|
||||
#define CCP_SUPPORT 0 /* Set > 0 for CCP */
|
||||
#define VJ_SUPPORT 1 /* Set > 0 for VJ header compression. */
|
||||
#define MD5_SUPPORT 1 /* Set > 0 for MD5 (see also CHAP) */
|
||||
|
||||
#endif /* PPP_SUPPORT */
|
||||
|
||||
#endif /* LWIP_LWIPOPTS_H */
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (disable: 4242) /* PPP only: conversion from 'x' to 'y', possible loss of data */
|
||||
#pragma warning (disable: 4244) /* PPP only: conversion from 'x' to 'y', possible loss of data (again?) */
|
||||
#pragma warning (disable: 4310) /* PPP only: cast truncates constant value */
|
||||
#pragma warning (disable: 4706) /* PPP only: assignment within conditional expression */
|
||||
#endif /* MSC_VER */
|
||||
@@ -1,72 +0,0 @@
|
||||
/**
|
||||
* Additional settings for the win32 port.
|
||||
* Copy this to lwipcfg_msvc.h and make the config changes you need.
|
||||
*/
|
||||
|
||||
/* configuration for this port */
|
||||
#define PPP_USERNAME "Admin"
|
||||
#define PPP_PASSWORD "pass"
|
||||
|
||||
/** Define this to the index of the windows network adapter to use */
|
||||
#define PACKET_LIB_ADAPTER_NR 1
|
||||
/** Define this to the GUID of the windows network adapter to use
|
||||
* or NOT define this if you want PACKET_LIB_ADAPTER_NR to be used */
|
||||
/*#define PACKET_LIB_ADAPTER_GUID "00000000-0000-0000-0000-000000000000"*/
|
||||
/*#define PACKET_LIB_GET_ADAPTER_NETADDRESS(addr) IP4_ADDR((addr), 192,168,1,0)*/
|
||||
/*#define PACKET_LIB_QUIET*/
|
||||
|
||||
/* If these 2 are not defined, the corresponding config setting is used */
|
||||
/* #define USE_DHCP 0 */
|
||||
/* #define USE_AUTOIP 0 */
|
||||
|
||||
/* #define USE_PCAPIF 1 */
|
||||
#define LWIP_PORT_INIT_IPADDR(addr) IP4_ADDR((addr), 192,168,1,200)
|
||||
#define LWIP_PORT_INIT_GW(addr) IP4_ADDR((addr), 192,168,1,1)
|
||||
#define LWIP_PORT_INIT_NETMASK(addr) IP4_ADDR((addr), 255,255,255,0)
|
||||
|
||||
/* remember to change this MAC address to suit your needs!
|
||||
the last octet will be increased by netif->num for each netif */
|
||||
#define LWIP_MAC_ADDR_BASE {0x00,0x01,0x02,0x03,0x04,0x05}
|
||||
|
||||
/* #define USE_SLIPIF 0 */
|
||||
/* #define SIO_USE_COMPORT 0 */
|
||||
#ifdef USE_SLIPIF
|
||||
#if USE_SLIPIF
|
||||
#define LWIP_PORT_INIT_SLIP1_IPADDR(addr) IP4_ADDR((addr), 192, 168, 2, 2)
|
||||
#define LWIP_PORT_INIT_SLIP1_GW(addr) IP4_ADDR((addr), 192, 168, 2, 1)
|
||||
#define LWIP_PORT_INIT_SLIP1_NETMASK(addr) IP4_ADDR((addr), 255, 255, 255, 0)
|
||||
#if USE_SLIPIF > 1
|
||||
#define LWIP_PORT_INIT_SLIP2_IPADDR(addr) IP4_ADDR((addr), 192, 168, 2, 1)
|
||||
#define LWIP_PORT_INIT_SLIP2_GW(addr) IP4_ADDR((addr), 0, 0, 0, 0)
|
||||
#define LWIP_PORT_INIT_SLIP2_NETMASK(addr) IP4_ADDR((addr), 255, 255, 255, 0)*/
|
||||
#endif /* USE_SLIPIF > 1 */
|
||||
#endif /* USE_SLIPIF */
|
||||
#endif /* USE_SLIPIF */
|
||||
|
||||
/* configuration for applications */
|
||||
|
||||
#define LWIP_CHARGEN_APP 0
|
||||
#define LWIP_DNS_APP 0
|
||||
#define LWIP_HTTPD_APP 0
|
||||
/* Set this to 1 to use the netconn http server,
|
||||
* otherwise the raw api server will be used. */
|
||||
/*#define LWIP_HTTPD_APP_NETCONN */
|
||||
#define LWIP_NETBIOS_APP 0
|
||||
#define LWIP_NETIO_APP 0
|
||||
#define LWIP_PING_APP 0
|
||||
#define LWIP_RTP_APP 0
|
||||
#define LWIP_SHELL_APP 0
|
||||
#define LWIP_SNTP_APP 0
|
||||
#define LWIP_SOCKET_EXAMPLES_APP 0
|
||||
#define LWIP_TCPECHO_APP 0
|
||||
/* Set this to 1 to use the netconn tcpecho server,
|
||||
* otherwise the raw api server will be used. */
|
||||
/*#define LWIP_TCPECHO_APP_NETCONN */
|
||||
#define LWIP_UDPECHO_APP 0
|
||||
#define LWIP_LWIPERF_APP 0
|
||||
|
||||
/*#define USE_DHCP 1*/
|
||||
/*#define USE_AUTOIP 1*/
|
||||
|
||||
/* define this to your custom application-init function */
|
||||
/* #define LWIP_APP_INIT my_app_init() */
|
||||
@@ -1,20 +0,0 @@
|
||||
/* OPTIONAL: Pools to replace heap allocation
|
||||
* Optional: Pools can be used instead of the heap for mem_malloc. If
|
||||
* so, these should be defined here, in increasing order according to
|
||||
* the pool element size.
|
||||
*
|
||||
* LWIP_MALLOC_MEMPOOL(number_elements, element_size)
|
||||
*/
|
||||
#if MEM_USE_POOLS
|
||||
LWIP_MALLOC_MEMPOOL_START
|
||||
LWIP_MALLOC_MEMPOOL(100, 256)
|
||||
LWIP_MALLOC_MEMPOOL(50, 512)
|
||||
LWIP_MALLOC_MEMPOOL(20, 1024)
|
||||
LWIP_MALLOC_MEMPOOL(20, 1536)
|
||||
LWIP_MALLOC_MEMPOOL_END
|
||||
#endif /* MEM_USE_POOLS */
|
||||
|
||||
/* Optional: Your custom pools can go here if you would like to use
|
||||
* lwIP's memory pools for anything else.
|
||||
*/
|
||||
LWIP_MEMPOOL(SYS_MBOX, 22, 100, "SYS_MBOX")
|
||||
@@ -1,50 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2001, 2002 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>
|
||||
#
|
||||
|
||||
CC=gcc
|
||||
|
||||
# Architecture specific files.
|
||||
LWIPARCH?=$(CONTRIBDIR)/ports/win32
|
||||
ARCHFILES=$(LWIPARCH)/sys_arch.c $(LWIPARCH)/test.c $(LWIPARCH)/pcapif.c \
|
||||
$(LWIPARCH)/pcapif_helper.c $(LWIPARCH)/sio.c
|
||||
|
||||
WIN32_COMMON_MK_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||
include $(WIN32_COMMON_MK_DIR)/../../Common.allports.mk
|
||||
|
||||
PCAPDIR=$(PCAP_DIR)/Include
|
||||
LDFLAGS+=-L$(PCAP_DIR)/lib -lwpcap -lpacket
|
||||
# -Wno-format: GCC complains about non-standard 64 bit modifier needed for MSVC runtime
|
||||
CFLAGS+=-I$(PCAPDIR) -Wno-format
|
||||
|
||||
pcapif.o:
|
||||
$(CC) $(CFLAGS) -Wno-error -Wno-redundant-decls -c $(<:.o=.c)
|
||||
pcapif_helper.o:
|
||||
$(CC) $(CFLAGS) -std=c99 -Wno-redundant-decls -c $(<:.o=.c)
|
||||
@@ -1,48 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2001, 2002 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>
|
||||
#
|
||||
|
||||
all ipv4 compile: test
|
||||
.PHONY: all
|
||||
|
||||
include Common.mk
|
||||
|
||||
clean:
|
||||
cmd /c del /q *.o $(LWIPLIBCOMMON) $(APPLIB) test.exe *.s .depend* *.map
|
||||
|
||||
depend dep: .depend
|
||||
|
||||
include .depend
|
||||
|
||||
.depend: $(LWIPFILES) $(APPFILES)
|
||||
$(CCDEP) $(CFLAGS) -MM $^ > .depend || cmd /c del .depend
|
||||
|
||||
test: .depend $(LWIPLIBCOMMON) $(APPLIB) test.o
|
||||
$(CC) $(CFLAGS) -o test test.o -Wl,--start-group $(APPLIB) $(LWIPLIBCOMMON) -Wl,--end-group $(LDFLAGS) -Xlinker -Map=test.map
|
||||
@@ -1,100 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{EBB156DC-01BF-47B2-B69C-1A750B6B5F09}</ProjectGuid>
|
||||
<RootNamespace>libcheck</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\check;..\..\..\..\check\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;WIN32;_DEBUG;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\check;..\..\..\..\check\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\check\lib\libcompat.h" />
|
||||
<ClInclude Include="..\check\config.h" />
|
||||
<ClInclude Include="..\check\unistd.h" />
|
||||
<ClInclude Include="..\check\sys\time.h" />
|
||||
<ClInclude Include="..\..\..\..\check\src\check.h" />
|
||||
<ClInclude Include="..\..\..\..\check\src\check_error.h" />
|
||||
<ClInclude Include="..\..\..\..\check\src\check_impl.h" />
|
||||
<ClInclude Include="..\..\..\..\check\src\check_list.h" />
|
||||
<ClInclude Include="..\..\..\..\check\src\check_log.h" />
|
||||
<ClInclude Include="..\..\..\..\check\src\check_msg.h" />
|
||||
<ClInclude Include="..\..\..\..\check\src\check_pack.h" />
|
||||
<ClInclude Include="..\..\..\..\check\src\check_print.h" />
|
||||
<ClInclude Include="..\..\..\..\check\src\check_str.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\check\lib\clock_gettime.c" />
|
||||
<ClCompile Include="..\..\..\..\check\lib\libcompat.c" />
|
||||
<ClCompile Include="..\check\time.c" />
|
||||
<ClCompile Include="..\..\..\..\check\src\check.c" />
|
||||
<ClCompile Include="..\..\..\..\check\src\check_error.c" />
|
||||
<ClCompile Include="..\..\..\..\check\src\check_list.c" />
|
||||
<ClCompile Include="..\..\..\..\check\src\check_log.c" />
|
||||
<ClCompile Include="..\..\..\..\check\src\check_msg.c" />
|
||||
<ClCompile Include="..\..\..\..\check\src\check_pack.c" />
|
||||
<ClCompile Include="..\..\..\..\check\src\check_print.c" />
|
||||
<ClCompile Include="..\..\..\..\check\src\check_run.c" />
|
||||
<ClCompile Include="..\..\..\..\check\src\check_str.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,96 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Win32">
|
||||
<UniqueIdentifier>{05d172f9-8ca6-4d9c-96e4-2b0480a8222f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Win32\sys">
|
||||
<UniqueIdentifier>{eb9ccf88-7e08-4202-bb4f-5a51443fa480}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="src">
|
||||
<UniqueIdentifier>{3f044d95-ab52-45ce-b4ae-27797eb221b2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="libcompat">
|
||||
<UniqueIdentifier>{abb21abe-51c2-45df-bdc9-8e00ce7fe404}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\check\config.h">
|
||||
<Filter>Win32</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\check\unistd.h">
|
||||
<Filter>Win32</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\check\sys\time.h">
|
||||
<Filter>Win32\sys</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\check\src\check.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\check\src\check_error.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\check\src\check_impl.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\check\src\check_list.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\check\src\check_log.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\check\src\check_msg.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\check\src\check_pack.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\check\src\check_print.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\check\src\check_str.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\check\lib\libcompat.h">
|
||||
<Filter>libcompat</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\check\time.c">
|
||||
<Filter>Win32</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\check\src\check.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\check\src\check_error.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\check\src\check_list.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\check\src\check_log.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\check\src\check_msg.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\check\src\check_pack.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\check\src\check_print.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\check\src\check_run.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\check\src\check_str.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\check\lib\libcompat.c">
|
||||
<Filter>libcompat</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\check\lib\clock_gettime.c">
|
||||
<Filter>libcompat</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,552 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug unittests|Win32">
|
||||
<Configuration>Debug unittests</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release unittests|Win32">
|
||||
<Configuration>Release unittests</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{2CC276FA-B226-49C9-8F82-7FCD5A228E28}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'">.\$(Configuration)\unittests\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'">.\$(Configuration)\$(ProjectName)\unittests\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'">.\$(Configuration)\unittests\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'">.\$(Configuration)\$(ProjectName)\unittests\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;..\..\..\apps\snmp_private_mib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0407</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;..\..\..\apps\snmp_private_mib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;WIN32;_DEBUG;LWIP_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0407</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\lwip\test\unit;..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>LWIP_NORAND;_LIB;WIN32;_DEBUG;LWIP_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0407</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\lwip\test\unit;..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>LWIP_NORAND;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0407</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuildStep Include="..\..\..\..\lwip\doc\contrib.txt">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\..\..\lwip\doc\FILES">
|
||||
<FileType>Document</FileType>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\..\..\lwip\doc\rawapi.txt">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\..\..\lwip\doc\savannah.txt">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\..\..\lwip\doc\snmp_agent.txt">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\..\..\lwip\doc\sys_arch.txt">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\..\..\lwip\src\core\ipv6\README">
|
||||
<FileType>Document</FileType>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\..\..\lwip\src\netif\FILES">
|
||||
<FileType>Document</FileType>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\lwipcfg_msvc.h.example">
|
||||
<FileType>Document</FileType>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<None Include="..\..\..\..\lwip\CHANGELOG" />
|
||||
<None Include="..\..\..\..\lwip\COPYING" />
|
||||
<None Include="..\..\..\..\lwip\doc\contrib.txt" />
|
||||
<None Include="..\..\..\..\lwip\doc\doxygen\generate.bat" />
|
||||
<None Include="..\..\..\..\lwip\doc\doxygen\generate.sh" />
|
||||
<None Include="..\..\..\..\lwip\doc\doxygen\lwip.Doxyfile" />
|
||||
<None Include="..\..\..\..\lwip\doc\FILES" />
|
||||
<None Include="..\..\..\..\lwip\doc\mdns.txt" />
|
||||
<None Include="..\..\..\..\lwip\doc\ppp.txt" />
|
||||
<None Include="..\..\..\..\lwip\doc\rawapi.txt" />
|
||||
<None Include="..\..\..\..\lwip\doc\savannah.txt" />
|
||||
<None Include="..\..\..\..\lwip\doc\sys_arch.txt" />
|
||||
<None Include="..\..\..\..\lwip\FILES" />
|
||||
<None Include="..\..\..\..\lwip\README" />
|
||||
<None Include="..\..\..\..\lwip\UPGRADING" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\lwip\doc\NO_SYS_SampleCode.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\lwip\src\api\api_lib.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\api\api_msg.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\api\err.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\api\if_api.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\api\netbuf.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\api\netdb.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\api\netifapi.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\api\sockets.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\api\tcpip.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\altcp_tls\altcp_tls_mbedtls.c">
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\mbedtls\include;..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;..\..\..\apps\snmp_private_mib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\mbedtls\include;..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;..\..\..\apps\snmp_private_mib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'">..\..\..\..\mbedtls\include;..\..\..\..\lwip\test\unit;..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'">..\..\..\..\mbedtls\include;..\..\..\..\lwip\test\unit;..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\altcp_tls\altcp_tls_mbedtls_mem.c">
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\mbedtls\include;..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;..\..\..\apps\snmp_private_mib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\mbedtls\include;..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;..\..\..\apps\snmp_private_mib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'">..\..\..\..\mbedtls\include;..\..\..\..\lwip\test\unit;..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'">..\..\..\..\mbedtls\include;..\..\..\..\lwip\test\unit;..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\lwiperf\lwiperf.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\mqtt\mqtt.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\netbiosns\netbiosns.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\smtp\smtp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_snmpv2_framework.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_snmpv2_usm.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\sntp\sntp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\tftp\tftp_server.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\altcp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\altcp_tcp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\def.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\dns.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\inet_chksum.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\init.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\mem.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\memp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\netif.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\pbuf.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\raw.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\stats.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\sys.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\tcp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\tcp_in.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\tcp_out.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\udp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ipv4\autoip.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ipv4\dhcp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ipv4\etharp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ipv4\icmp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ipv4\igmp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ipv4\ip4.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ipv4\ip4_addr.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ipv6\dhcp6.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ipv6\ethip6.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ipv6\icmp6.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ipv6\inet6.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ipv6\ip6.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ipv6\ip6_addr.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ipv6\ip6_frag.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ipv6\mld6.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ipv6\nd6.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\bridgeif.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ethernet.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ethernetif.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\lowpan6.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\slipif.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\auth.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\ccp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\chap-md5.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\chap-new.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\chap_ms.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\demand.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\eap.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\ecp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\eui64.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\fsm.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\ipcp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\ipv6cp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\lcp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\magic.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\mppe.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\multilink.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\ppp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\pppcrypt.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\pppoe.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\pppol2tp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\pppos.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\upap.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\utils.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\vj.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\polarssl\arc4.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\polarssl\des.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\polarssl\md4.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\polarssl\md5.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\polarssl\sha1.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\httpd\fs.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\httpd\fsdata.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\httpd\httpd.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_asn1.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_core.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_mib2.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_msg.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_netconn.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_pbuf_stream.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_raw.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_scalar.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_table.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_threadsync.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_traps.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ip.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmpv3.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_mib2_icmp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_mib2_interfaces.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_mib2_ip.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_mib2_snmp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_mib2_system.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_mib2_tcp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmp_mib2_udp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\netif\ppp\pppapi.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\ipv4\ip4_frag.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\core\timeouts.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\mdns\mdns.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\snmp\snmpv3_mbedtls.c" />
|
||||
<ClCompile Include="..\sio.c" />
|
||||
<ClCompile Include="..\sys_arch.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug unittests|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release unittests|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\lwip\doc\doxygen\main_page.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\apps\altcp_tls\altcp_tls_mbedtls_mem.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\apps\altcp_tls\altcp_tls_mbedtls_structs.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\apps\snmp\snmp_msg.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\compat\stdc\errno.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\compat\posix\arpa\inet.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\compat\posix\netdb.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\compat\posix\net\if.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\compat\posix\sys\socket.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\altcp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\altcp_tcp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\altcp_tls.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\altcp_tls_mbedtls_opts.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\lwiperf.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\mdns_priv.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\mqtt.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\mqtt_opts.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\mqtt_priv.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\netbiosns.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\netbiosns_opts.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\smtp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\smtp_opts.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\snmp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\snmp_opts.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\snmp_snmpv2_framework.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\snmp_snmpv2_usm.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\sntp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\sntp_opts.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\tftp_opts.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\tftp_server.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\errno.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\if_api.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\ip6_zone.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\priv\altcp_priv.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\priv\api_msg.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\priv\memp_priv.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\priv\memp_std.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\priv\nd6_priv.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\priv\sockets_priv.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\priv\tcpip_priv.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\priv\tcp_priv.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\api.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\arch.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\autoip.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\debug.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\def.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\dhcp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\dhcp6.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\dns.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\err.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\ethip6.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\icmp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\icmp6.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\igmp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\inet.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\inet_chksum.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\init.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\ip.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\ip4.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\ip4_addr.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\ip6.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\ip6_addr.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\ip6_frag.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\ip_addr.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\mem.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\memp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\mld6.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\nd6.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\netbuf.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\netdb.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\netif.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\netifapi.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\opt.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\pbuf.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\prot\etharp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\prot\iana.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\prot\ieee.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\prot\igmp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\raw.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\sio.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\snmp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\sockets.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\stats.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\sys.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\tcp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\tcpip.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\udp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\bridgeif.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\bridgeif_opts.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\etharp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ethernet.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\lowpan6.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\lowpan6_opts.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\slipif.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\ccp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\chap-md5.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\chap-new.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\chap_ms.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\eap.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\ecp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\eui64.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\fsm.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\ipcp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\ipv6cp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\lcp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\magic.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\mppe.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\ppp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\ppp_impl.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\ppp_opts.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\pppcrypt.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\pppdebug.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\pppoe.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\pppol2tp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\pppos.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\upap.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\vj.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\polarssl\arc4.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\polarssl\des.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\polarssl\md4.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\polarssl\md5.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\polarssl\sha1.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\apps\httpd\fsdata.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\apps\httpd\httpd_structs.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\apps\snmp\snmp_asn1.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\apps\snmp\snmp_core_priv.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\apps\snmp\snmp_pbuf_stream.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\snmp_core.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\snmp_mib2.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\snmp_scalar.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\snmp_table.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\snmp_threadsync.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\netif\ppp\pppapi.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\fs.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\httpd.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\httpd_opts.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\snmpv3.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\etharp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\ip4_frag.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\timeouts.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\mdns.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\apps\mdns_opts.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\prot\autoip.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\prot\dhcp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\prot\dns.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\prot\ip.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\prot\ip4.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\apps\snmp\snmpv3_priv.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\prot\ethernet.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\prot\icmp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\prot\icmp6.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\prot\ip6.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\prot\mld6.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\prot\nd6.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\prot\tcp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\src\include\lwip\prot\udp.h" />
|
||||
<ClInclude Include="..\include\arch\bpstruct.h" />
|
||||
<ClInclude Include="..\include\arch\cc.h" />
|
||||
<ClInclude Include="..\include\arch\epstruct.h" />
|
||||
<ClInclude Include="..\lwipcfg_msvc.h" />
|
||||
<ClInclude Include="..\include\lwipopts.h" />
|
||||
<ClInclude Include="..\lwippools.h" />
|
||||
<ClInclude Include="..\include\arch\perf.h" />
|
||||
<ClInclude Include="..\include\arch\sys_arch.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,37 +0,0 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C++ Express 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lwIP_Test", "lwIP_Test.vcxproj", "{8CC0CE51-32CF-4585-BFAF-A9343BC5A96D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lwIP pcapif", "lwIP_pcapif.vcxproj", "{6F44E49E-9F21-4144-91EC-53B92AEF62CE}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lwIP", "lwIP.vcxproj", "{2CC276FA-B226-49C9-8F82-7FCD5A228E28}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "makefsdata", "makefsdata.vcxproj", "{0BFC0F21-8E84-4E68-A9E1-CE2A09B72F6D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8CC0CE51-32CF-4585-BFAF-A9343BC5A96D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{8CC0CE51-32CF-4585-BFAF-A9343BC5A96D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{8CC0CE51-32CF-4585-BFAF-A9343BC5A96D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{8CC0CE51-32CF-4585-BFAF-A9343BC5A96D}.Release|Win32.Build.0 = Release|Win32
|
||||
{6F44E49E-9F21-4144-91EC-53B92AEF62CE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6F44E49E-9F21-4144-91EC-53B92AEF62CE}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6F44E49E-9F21-4144-91EC-53B92AEF62CE}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6F44E49E-9F21-4144-91EC-53B92AEF62CE}.Release|Win32.Build.0 = Release|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|Win32.Build.0 = Release|Win32
|
||||
{0BFC0F21-8E84-4E68-A9E1-CE2A09B72F6D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{0BFC0F21-8E84-4E68-A9E1-CE2A09B72F6D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{0BFC0F21-8E84-4E68-A9E1-CE2A09B72F6D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{0BFC0F21-8E84-4E68-A9E1-CE2A09B72F6D}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,183 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{8CC0CE51-32CF-4585-BFAF-A9343BC5A96D}</ProjectGuid>
|
||||
<RootNamespace>lwIP_test</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<TypeLibraryName>.\Release/test.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0407</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>Packet.lib;wpcap.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>$(PCAP_DIR)\Lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ProgramDatabaseFile>.\Release/test.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<TypeLibraryName>.\Debug/test.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_CONSOLE;WIN32;_DEBUG;LWIP_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0407</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>Packet.lib;wpcap.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>$(PCAP_DIR)\Lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\addons\ipv6_static_routing\ip6_route_table.c" />
|
||||
<ClCompile Include="..\..\..\addons\tcp_isn\tcp_isn.c" />
|
||||
<ClCompile Include="..\..\..\apps\snmp_v3\snmpv3_dummy.c" />
|
||||
<ClCompile Include="..\..\..\apps\tcpecho_raw\tcpecho_raw.c" />
|
||||
<ClCompile Include="..\..\..\apps\udpecho_raw\udpecho_raw.c" />
|
||||
<ClCompile Include="..\test.c">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\apps\chargen\chargen.c" />
|
||||
<ClCompile Include="..\..\..\apps\httpserver\httpserver-netconn.c" />
|
||||
<ClCompile Include="..\..\..\apps\netio\netio.c" />
|
||||
<ClCompile Include="..\..\..\apps\ping\ping.c" />
|
||||
<ClCompile Include="..\..\..\apps\rtp\rtp.c" />
|
||||
<ClCompile Include="..\..\..\apps\shell\shell.c" />
|
||||
<ClCompile Include="..\..\..\apps\socket_examples\socket_examples.c" />
|
||||
<ClCompile Include="..\..\..\apps\tcpecho\tcpecho.c" />
|
||||
<ClCompile Include="..\..\..\apps\udpecho\udpecho.c" />
|
||||
<ClCompile Include="..\..\..\apps\snmp_private_mib\lwip_prvmib.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\addons\ipv6_static_routing\ip6_route_table.h" />
|
||||
<ClInclude Include="..\..\..\addons\tcp_isn\tcp_isn.h" />
|
||||
<ClInclude Include="..\..\..\apps\chargen\chargen.h" />
|
||||
<ClInclude Include="..\..\..\apps\httpserver\httpserver-netconn.h" />
|
||||
<ClInclude Include="..\..\..\apps\netio\netio.h" />
|
||||
<ClInclude Include="..\..\..\apps\ping\ping.h" />
|
||||
<ClInclude Include="..\..\..\apps\rtp\rtp.h" />
|
||||
<ClInclude Include="..\..\..\apps\shell\shell.h" />
|
||||
<ClInclude Include="..\..\..\apps\snmp_v3\snmpv3_dummy.h" />
|
||||
<ClInclude Include="..\..\..\apps\socket_examples\socket_examples.h" />
|
||||
<ClInclude Include="..\..\..\apps\tcpecho\tcpecho.h" />
|
||||
<ClInclude Include="..\..\..\apps\tcpecho_raw\tcpecho_raw.h" />
|
||||
<ClInclude Include="..\..\..\apps\udpecho\udpecho.h" />
|
||||
<ClInclude Include="..\..\..\apps\snmp_private_mib\private_mib.h" />
|
||||
<ClInclude Include="..\..\..\apps\udpecho_raw\udpecho_raw.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\addons\ipv6_static_routing\README" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="lwIP.vcxproj">
|
||||
<Project>{2cc276fa-b226-49c9-8f82-7fcd5a228e28}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="lwIP_pcapif.vcxproj">
|
||||
<Project>{6f44e49e-9f21-4144-91ec-53b92aef62ce}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,123 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{e858c3d0-1558-4d47-bc6a-9d4a55ce3d3a}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\apps">
|
||||
<UniqueIdentifier>{0582eefd-a68e-45f8-b93c-f828c4794f30}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\addons">
|
||||
<UniqueIdentifier>{ed0627c2-099a-4da8-af0c-142003828f9f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\addons\tcp_isn">
|
||||
<UniqueIdentifier>{4ffb2268-6fc6-44d7-8e3b-2a3f68b8d5a3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\addons\ipv6_static_routing">
|
||||
<UniqueIdentifier>{93b36161-88b2-448c-9c45-ac6f27b98290}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\test.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\apps\chargen\chargen.c">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\apps\httpserver\httpserver-netconn.c">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\apps\netio\netio.c">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\apps\ping\ping.c">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\apps\rtp\rtp.c">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\apps\shell\shell.c">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\apps\socket_examples\socket_examples.c">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\apps\tcpecho\tcpecho.c">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\apps\udpecho\udpecho.c">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\apps\tcpecho_raw\tcpecho_raw.c">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\apps\udpecho_raw\udpecho_raw.c">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\apps\snmp_private_mib\lwip_prvmib.c">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\addons\tcp_isn\tcp_isn.c">
|
||||
<Filter>Source Files\addons\tcp_isn</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\addons\ipv6_static_routing\ip6_route_table.c">
|
||||
<Filter>Source Files\addons\ipv6_static_routing</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\apps\snmp_v3\snmpv3_dummy.c">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\apps\chargen\chargen.h">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\apps\httpserver\httpserver-netconn.h">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\apps\netio\netio.h">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\apps\ping\ping.h">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\apps\rtp\rtp.h">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\apps\shell\shell.h">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\apps\socket_examples\socket_examples.h">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\apps\tcpecho\tcpecho.h">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\apps\udpecho\udpecho.h">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\apps\tcpecho_raw\tcpecho_raw.h">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\apps\udpecho_raw\udpecho_raw.h">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\apps\snmp_private_mib\private_mib.h">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\addons\tcp_isn\tcp_isn.h">
|
||||
<Filter>Source Files\addons\tcp_isn</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\addons\ipv6_static_routing\ip6_route_table.h">
|
||||
<Filter>Source Files\addons\ipv6_static_routing</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\apps\snmp_v3\snmpv3_dummy.h">
|
||||
<Filter>Source Files\apps</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\addons\ipv6_static_routing\README">
|
||||
<Filter>Source Files\addons\ipv6_static_routing</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,111 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>lwIP pcapif</ProjectName>
|
||||
<ProjectGuid>{6F44E49E-9F21-4144-91EC-53B92AEF62CE}</ProjectGuid>
|
||||
<RootNamespace>lwIP pcapif</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;.\;$(PCAP_DIR)\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;WIN32;_DEBUG;LWIP_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0407</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;.\;$(PCAP_DIR)\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0407</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\pcapif.c" />
|
||||
<ClCompile Include="..\pcapif_helper.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\pcapif.h" />
|
||||
<ClInclude Include="..\pcapif_helper.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="lwIP.vcxproj">
|
||||
<Project>{2cc276fa-b226-49c9-8f82-7fcd5a228e28}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{0d38b8c3-e694-4572-89b8-fc6e825a092d}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{e5ce29d5-319e-4e99-978b-b88e8d6167e4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\pcapif.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\pcapif_helper.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\pcapif.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\pcapif_helper.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,31 +0,0 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C++ Express 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lwip_unittests", "lwip_unittests.vcxproj", "{6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lwIP", "lwIP.vcxproj", "{2CC276FA-B226-49C9-8F82-7FCD5A228E28}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcheck", "libcheck.vcxproj", "{EBB156DC-01BF-47B2-B69C-1A750B6B5F09}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}.Release|Win32.Build.0 = Release|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug|Win32.ActiveCfg = Debug unittests|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug|Win32.Build.0 = Debug unittests|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|Win32.ActiveCfg = Release unittests|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|Win32.Build.0 = Release unittests|Win32
|
||||
{EBB156DC-01BF-47B2-B69C-1A750B6B5F09}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{EBB156DC-01BF-47B2-B69C-1A750B6B5F09}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{EBB156DC-01BF-47B2-B69C-1A750B6B5F09}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{EBB156DC-01BF-47B2-B69C-1A750B6B5F09}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,131 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}</ProjectGuid>
|
||||
<RootNamespace>lwip_unittests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\check;..\..\..\..\check\src;..\..\..\..\lwip\test\unit;..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;WIN32;_DEBUG;LWIP_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4820</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\check;..\..\..\..\check\src;..\..\..\..\lwip\test\unit;..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\api\test_sockets.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\arch\sys_arch.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\core\test_mem.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\core\test_pbuf.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\ip4\test_ip4.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\mdns\test_mdns.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\mqtt\test_mqtt.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\tcp\tcp_helper.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\tcp\test_tcp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\tcp\test_tcp_oos.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\udp\test_udp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\etharp\test_etharp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\dhcp\test_dhcp.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\lwip_unittests.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\api\test_sockets.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\arch\sys_arch.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\core\test_mem.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\core\test_pbuf.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\ip4\test_ip4.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\mdns\test_mdns.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\mqtt\test_mqtt.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\tcp\tcp_helper.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\tcp\test_tcp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\tcp\test_tcp_oos.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\udp\test_udp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\etharp\test_etharp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\dhcp\test_dhcp.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\lwip_check.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\lwipopts.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="libcheck.vcxproj">
|
||||
<Project>{ebb156dc-01bf-47b2-b69c-1a750b6b5f09}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="lwIP.vcxproj">
|
||||
<Project>{2cc276fa-b226-49c9-8f82-7fcd5a228e28}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="core">
|
||||
<UniqueIdentifier>{e351c538-9f2b-4a01-bf46-3ee8873cbc0f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="tcp">
|
||||
<UniqueIdentifier>{5805c4bc-32c1-49cf-a35e-af58757e2d7a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="udp">
|
||||
<UniqueIdentifier>{173ba4ab-b194-4933-8e02-319044c2a8fa}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="etharp">
|
||||
<UniqueIdentifier>{70c655a7-f40f-4728-b586-33fd9598b355}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="dhcp">
|
||||
<UniqueIdentifier>{a6b60d4e-4b81-44f2-9408-2e45cc769391}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="mdns">
|
||||
<UniqueIdentifier>{d454902e-ce5b-48ae-a690-e6490bdbbf17}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="api">
|
||||
<UniqueIdentifier>{d9501476-6102-4f14-90bd-35322fbd2fb2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="arch">
|
||||
<UniqueIdentifier>{b04f182c-1910-456d-9388-397dfe82dbc9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="mqtt">
|
||||
<UniqueIdentifier>{fd48ae04-ec85-478f-a97c-a7c8384a2d94}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="ip4">
|
||||
<UniqueIdentifier>{fe93fc95-f1af-4a1f-a086-c1771dbf4d79}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\core\test_mem.c">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\core\test_pbuf.c">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\tcp\tcp_helper.c">
|
||||
<Filter>tcp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\tcp\test_tcp.c">
|
||||
<Filter>tcp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\tcp\test_tcp_oos.c">
|
||||
<Filter>tcp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\udp\test_udp.c">
|
||||
<Filter>udp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\etharp\test_etharp.c">
|
||||
<Filter>etharp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\dhcp\test_dhcp.c">
|
||||
<Filter>dhcp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\lwip_unittests.c" />
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\mdns\test_mdns.c">
|
||||
<Filter>mdns</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\api\test_sockets.c">
|
||||
<Filter>api</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\arch\sys_arch.c">
|
||||
<Filter>arch</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\mqtt\test_mqtt.c">
|
||||
<Filter>mqtt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\lwip\test\unit\ip4\test_ip4.c">
|
||||
<Filter>ip4</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\core\test_mem.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\core\test_pbuf.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\tcp\tcp_helper.h">
|
||||
<Filter>tcp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\tcp\test_tcp.h">
|
||||
<Filter>tcp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\tcp\test_tcp_oos.h">
|
||||
<Filter>tcp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\udp\test_udp.h">
|
||||
<Filter>udp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\etharp\test_etharp.h">
|
||||
<Filter>etharp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\dhcp\test_dhcp.h">
|
||||
<Filter>dhcp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\lwip_check.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\lwipopts.h" />
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\mdns\test_mdns.h">
|
||||
<Filter>mdns</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\api\test_sockets.h">
|
||||
<Filter>api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\arch\sys_arch.h">
|
||||
<Filter>arch</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\mqtt\test_mqtt.h">
|
||||
<Filter>mqtt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\lwip\test\unit\ip4\test_ip4.h">
|
||||
<Filter>ip4</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,99 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\httpd\makefsdata\makefsdata.c" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{0BFC0F21-8E84-4E68-A9E1-CE2A09B72F6D}</ProjectGuid>
|
||||
<RootNamespace>makefsdata</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\lwip\src\include;..\..\..\..\lwip\src\include\ipv4;..\..\..\..\lwip\src\include\ipv6;..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Quelldateien">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\lwip\src\apps\httpd\makefsdata\makefsdata.c">
|
||||
<Filter>Quelldateien</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,32 +0,0 @@
|
||||
#ifndef LWIP_PCAPIF_H
|
||||
#define LWIP_PCAPIF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "lwip/err.h"
|
||||
|
||||
/** Set to 1 to let rx use an own thread (only for NO_SYS==0).
|
||||
* If set to 0, ethernetif_poll is used to poll for packets.
|
||||
*/
|
||||
#ifndef PCAPIF_RX_USE_THREAD
|
||||
#define PCAPIF_RX_USE_THREAD !NO_SYS
|
||||
#endif
|
||||
#if PCAPIF_RX_USE_THREAD && NO_SYS
|
||||
#error "Can't create a dedicated RX thread with NO_SYS==1"
|
||||
#endif
|
||||
|
||||
struct netif;
|
||||
|
||||
err_t pcapif_init (struct netif *netif);
|
||||
void pcapif_shutdown(struct netif *netif);
|
||||
#if !PCAPIF_RX_USE_THREAD
|
||||
void pcapif_poll (struct netif *netif);
|
||||
#endif /* !PCAPIF_RX_USE_THREAD */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_PCAPIF_H */
|
||||
@@ -1,105 +0,0 @@
|
||||
/**
|
||||
* pcapif_helper.c - This file is part of lwIP pcapif and provides helper functions
|
||||
* for managing the link state.
|
||||
*/
|
||||
|
||||
#include "pcapif_helper.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lwip/arch.h"
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( push, 3 )
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <packet32.h>
|
||||
#include <ntddndis.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning ( pop )
|
||||
#endif
|
||||
|
||||
struct pcapifh_linkstate {
|
||||
LPADAPTER lpAdapter;
|
||||
PPACKET_OID_DATA ppacket_oid_data;
|
||||
};
|
||||
|
||||
struct pcapifh_linkstate* pcapifh_linkstate_init(char *adapter_name)
|
||||
{
|
||||
struct pcapifh_linkstate* state = (struct pcapifh_linkstate*)malloc(sizeof(struct pcapifh_linkstate));
|
||||
if (state != NULL) {
|
||||
memset(state, 0, sizeof(struct pcapifh_linkstate));
|
||||
state->ppacket_oid_data = (PPACKET_OID_DATA)malloc(sizeof(PACKET_OID_DATA) + sizeof(NDIS_MEDIA_STATE));
|
||||
if (state->ppacket_oid_data == NULL) {
|
||||
free(state);
|
||||
state = NULL;
|
||||
} else {
|
||||
state->lpAdapter = PacketOpenAdapter((char*)adapter_name);
|
||||
if ((state->lpAdapter == NULL) || (state->lpAdapter->hFile == INVALID_HANDLE_VALUE)) {
|
||||
/* failed to open adapter */
|
||||
free(state);
|
||||
state = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
enum pcapifh_link_event pcapifh_linkstate_get(struct pcapifh_linkstate* state)
|
||||
{
|
||||
enum pcapifh_link_event ret = PCAPIF_LINKEVENT_UNKNOWN;
|
||||
if (state != NULL) {
|
||||
state->ppacket_oid_data->Oid = OID_GEN_MEDIA_CONNECT_STATUS;
|
||||
state->ppacket_oid_data->Length = sizeof(NDIS_MEDIA_STATE);
|
||||
if (PacketRequest(state->lpAdapter, FALSE, state->ppacket_oid_data)) {
|
||||
NDIS_MEDIA_STATE fNdisMediaState;
|
||||
fNdisMediaState = (*((PNDIS_MEDIA_STATE)(state->ppacket_oid_data->Data)));
|
||||
ret = ((fNdisMediaState == NdisMediaStateConnected) ? PCAPIF_LINKEVENT_UP : PCAPIF_LINKEVENT_DOWN);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void pcapifh_linkstate_close(struct pcapifh_linkstate* state)
|
||||
{
|
||||
if (state != NULL) {
|
||||
if (state->lpAdapter != NULL) {
|
||||
PacketCloseAdapter(state->lpAdapter);
|
||||
}
|
||||
if (state->ppacket_oid_data != NULL) {
|
||||
free(state->ppacket_oid_data);
|
||||
}
|
||||
free(state);
|
||||
}
|
||||
}
|
||||
|
||||
#else /* WIN32 */
|
||||
|
||||
/* @todo: add linux/unix implementation? */
|
||||
|
||||
struct pcapifh_linkstate {
|
||||
u8_t empty;
|
||||
};
|
||||
|
||||
struct pcapifh_linkstate* pcapifh_linkstate_init(char *adapter_name)
|
||||
{
|
||||
LWIP_UNUSED_ARG(adapter_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
enum pcapifh_link_event pcapifh_linkstate_get(struct pcapifh_linkstate* state)
|
||||
{
|
||||
LWIP_UNUSED_ARG(state);
|
||||
return PCAPIF_LINKEVENT_UP;
|
||||
}
|
||||
void pcapifh_linkstate_close(struct pcapifh_linkstate* state)
|
||||
{
|
||||
LWIP_UNUSED_ARG(state);
|
||||
}
|
||||
|
||||
#endif /* WIN32 */
|
||||
@@ -1,25 +0,0 @@
|
||||
#ifndef LWIP_PCAPIF_HELPER_H
|
||||
#define LWIP_PCAPIF_HELPER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct pcapifh_linkstate;
|
||||
|
||||
enum pcapifh_link_event {
|
||||
PCAPIF_LINKEVENT_UNKNOWN,
|
||||
PCAPIF_LINKEVENT_UP,
|
||||
PCAPIF_LINKEVENT_DOWN
|
||||
};
|
||||
|
||||
struct pcapifh_linkstate* pcapifh_linkstate_init(char *adapter_name);
|
||||
enum pcapifh_link_event pcapifh_linkstate_get(struct pcapifh_linkstate* state);
|
||||
void pcapifh_linkstate_close(struct pcapifh_linkstate* state);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_PCAPIF_HELPER_H */
|
||||
@@ -1,24 +0,0 @@
|
||||
lwIP for Win32
|
||||
|
||||
This is an example port of lwIP for Win32. It uses WinPCAP to send & receive packets.
|
||||
To compile it, use the MSVC projects in the 'msvc' subdir or the Makefile in the 'mingw' subdir.
|
||||
|
||||
For both compilers:
|
||||
- the lwIP core repository must be in a folder "lwip" next to the "contrib" folder
|
||||
- you have to set an environment variable PCAP_DIR pointing to the WinPcap Developer's
|
||||
Pack (containing 'include' and 'lib')
|
||||
|
||||
You also will have to copy the file 'lwipcfg_msvc.h.example' to
|
||||
'lwipcfg_msvc.h' and modify to suit your needs (WinPcap adapter number,
|
||||
IP configuration, applications...).
|
||||
|
||||
Included in the contrib\ports\win32 directory is the network interface driver
|
||||
using the winpcap library.
|
||||
|
||||
lwIP: http://savannah.nongnu.org/projects/lwip/
|
||||
WinPCap: https://www.winpcap.org/devel.htm
|
||||
Visual C++: http://www.microsoft.com/express/download/
|
||||
|
||||
To compile the unittests (msvc\lwIP_unittests.sln), download check (tested with v0.11.0) from
|
||||
https://github.com/libcheck/check/releases/
|
||||
and place it in a folder "check" next to the "contrib" folder.
|
||||
@@ -1,304 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <lwip/opt.h>
|
||||
#include <lwip/sys.h>
|
||||
#include <lwip/sio.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (push, 3)
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
#include "lwipcfg_msvc.h"
|
||||
|
||||
/** When 1, use COM ports, when 0, use named pipes (for simulation). */
|
||||
#ifndef SIO_USE_COMPORT
|
||||
#define SIO_USE_COMPORT 1
|
||||
#endif
|
||||
|
||||
/** If SIO_USE_COMPORT==1, use COMx, if 0, use a pipe (default) */
|
||||
#if SIO_USE_COMPORT
|
||||
#define SIO_DEVICENAME "\\\\.\\COM"
|
||||
#else
|
||||
#define SIO_DEVICENAME "\\\\.\\pipe\\lwip"
|
||||
#endif
|
||||
|
||||
#if SIO_USE_COMPORT
|
||||
#ifndef SIO_COMPORT_SPEED
|
||||
#define SIO_COMPORT_SPEED 115200
|
||||
#endif
|
||||
#ifndef SIO_COMPORT_BYTESIZE
|
||||
#define SIO_COMPORT_BYTESIZE 8
|
||||
#endif
|
||||
#ifndef SIO_COMPORT_STOPBITS
|
||||
#define SIO_COMPORT_STOPBITS 0 /* ONESTOPBIT */
|
||||
#endif
|
||||
#ifndef SIO_COMPORT_PARITY
|
||||
#define SIO_COMPORT_PARITY 0 /* NOPARITY */
|
||||
#endif
|
||||
#endif /* SIO_USE_COMPORT */
|
||||
|
||||
static int sio_abort = 0;
|
||||
|
||||
/* \\.\pipe\lwip0 */
|
||||
/* pppd /dev/ttyS0 logfile mylog debug nocrtscts local noauth noccp ms-dns 212.27.54.252 192.168.0.4:192.168.0.5
|
||||
*/
|
||||
|
||||
/**
|
||||
* SIO_DEBUG: Enable debugging for SIO.
|
||||
*/
|
||||
#ifndef SIO_DEBUG
|
||||
#define SIO_DEBUG LWIP_DBG_OFF
|
||||
#endif
|
||||
|
||||
#if SIO_USE_COMPORT
|
||||
/** When using a real COM port, set up the
|
||||
* serial line settings (baudrate etc.)
|
||||
*/
|
||||
static BOOL
|
||||
sio_setup(HANDLE fd)
|
||||
{
|
||||
COMMTIMEOUTS cto;
|
||||
DCB dcb;
|
||||
|
||||
/* set up baudrate and other communication settings */
|
||||
memset(&dcb, 0, sizeof(dcb));
|
||||
/* Obtain the DCB structure for the device */
|
||||
if (!GetCommState(fd, &dcb)) {
|
||||
return FALSE;
|
||||
}
|
||||
/* Set the new data */
|
||||
dcb.BaudRate = SIO_COMPORT_SPEED;
|
||||
dcb.ByteSize = SIO_COMPORT_BYTESIZE;
|
||||
dcb.StopBits = 0; /* ONESTOPBIT */
|
||||
dcb.Parity = 0; /* NOPARITY */
|
||||
dcb.fParity = 0; /* parity is not used */
|
||||
/* do not use flow control */
|
||||
/*dcb.fOutxDsrFlow = dcb.fDtrControl = 0;
|
||||
dcb.fOutxCtsFlow = dcb.fRtsControl = 0;
|
||||
dcb.fErrorChar = dcb.fNull = 0;
|
||||
dcb.fInX = dcb.fOutX = 0;
|
||||
dcb.XonChar = dcb.XoffChar = 0;
|
||||
dcb.XonLim = dcb.XoffLim = 100;*/
|
||||
|
||||
/* Set the new DCB structure */
|
||||
if (!SetCommState(fd, &dcb)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
memset(&cto, 0, sizeof(cto));
|
||||
if(!GetCommTimeouts(fd, &cto))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
/* change read timeout, leave write timeout as it is */
|
||||
cto.ReadIntervalTimeout = 1;
|
||||
cto.ReadTotalTimeoutMultiplier = 0;
|
||||
cto.ReadTotalTimeoutConstant = 1; /* 1 ms */
|
||||
if(!SetCommTimeouts(fd, &cto)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* SIO_USE_COMPORT */
|
||||
|
||||
/**
|
||||
* Opens a serial device for communication.
|
||||
*
|
||||
* @param devnum device number
|
||||
* @return handle to serial device if successful, NULL otherwise
|
||||
*/
|
||||
sio_fd_t sio_open(u8_t devnum)
|
||||
{
|
||||
HANDLE fileHandle = INVALID_HANDLE_VALUE;
|
||||
CHAR fileName[256];
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_open(%lu)\n", (DWORD)devnum));
|
||||
#if SIO_USE_COMPORT
|
||||
_snprintf(fileName, 255, SIO_DEVICENAME"%lu", (DWORD)(devnum));
|
||||
#else /* SIO_USE_COMPORT */
|
||||
_snprintf(fileName, 255, SIO_DEVICENAME"%lu", (DWORD)(devnum & ~1));
|
||||
if ((devnum & 1) == 0) {
|
||||
fileHandle = CreateNamedPipeA(fileName, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_NOWAIT,
|
||||
PIPE_UNLIMITED_INSTANCES, 102400, 102400, 100, NULL);
|
||||
} else
|
||||
#endif /* SIO_USE_COMPORT */
|
||||
{
|
||||
fileHandle = CreateFileA(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
}
|
||||
if (fileHandle != INVALID_HANDLE_VALUE) {
|
||||
sio_abort = 0;
|
||||
#if !SIO_USE_COMPORT
|
||||
if (devnum & 1) {
|
||||
DWORD mode = PIPE_NOWAIT;
|
||||
if (!SetNamedPipeHandleState(fileHandle, &mode, NULL, NULL)) {
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_open(%lu): SetNamedPipeHandleState failed. GetLastError() returns %d\n",
|
||||
(DWORD)devnum, GetLastError()));
|
||||
}
|
||||
} else
|
||||
#endif /* !SIO_USE_COMPORT */
|
||||
{
|
||||
FlushFileBuffers(fileHandle);
|
||||
}
|
||||
#if SIO_USE_COMPORT
|
||||
if(!sio_setup(fileHandle)) {
|
||||
CloseHandle(fileHandle);
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_open(%lu): sio_setup failed. GetLastError() returns %lu\n",
|
||||
(DWORD)devnum, GetLastError()));
|
||||
return NULL;
|
||||
}
|
||||
#endif /* SIO_USE_COMPORT */
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_open: file \"%s\" successfully opened.\n", fileName));
|
||||
printf("sio_open: file \"%s\" (%d) successfully opened: 0x%08x\n", fileName, devnum, LWIP_PTR_NUMERIC_CAST(unsigned int, fileHandle));
|
||||
return (sio_fd_t)(fileHandle);
|
||||
}
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_open(%lu) failed. GetLastError() returns %lu\n",
|
||||
(DWORD)devnum, GetLastError()));
|
||||
printf("sio_open(%lu) failed. GetLastError() returns %lu\n",
|
||||
(DWORD)devnum, GetLastError());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a single character to the serial device.
|
||||
*
|
||||
* @param c character to send
|
||||
* @param fd serial device handle
|
||||
*
|
||||
* @note This function will block until the character can be sent.
|
||||
*/
|
||||
void sio_send(u8_t c, sio_fd_t fd)
|
||||
{
|
||||
DWORD dwNbBytesWritten = 0;
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_send(%lu)\n", (DWORD)c));
|
||||
while ((!WriteFile((HANDLE)(fd), &c, 1, &dwNbBytesWritten, NULL)) || (dwNbBytesWritten < 1)) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Receives a single character from the serial device.
|
||||
*
|
||||
* @param fd serial device handle
|
||||
*
|
||||
* @note This function will block until a character is received.
|
||||
*/
|
||||
u8_t sio_recv(sio_fd_t fd)
|
||||
{
|
||||
DWORD dwNbBytesReadden = 0;
|
||||
u8_t byte = 0;
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_recv()\n"));
|
||||
while ((sio_abort == 0) && ((!ReadFile((HANDLE)(fd), &byte, 1, &dwNbBytesReadden, NULL)) || (dwNbBytesReadden < 1)));
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_recv()=%lu\n", (DWORD)byte));
|
||||
return byte;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads from the serial device.
|
||||
*
|
||||
* @param fd serial device handle
|
||||
* @param data pointer to data buffer for receiving
|
||||
* @param len maximum length (in bytes) of data to receive
|
||||
* @return number of bytes actually received - may be 0 if aborted by sio_read_abort
|
||||
*
|
||||
* @note This function will block until data can be received. The blocking
|
||||
* can be cancelled by calling sio_read_abort().
|
||||
*/
|
||||
u32_t sio_read(sio_fd_t fd, u8_t* data, u32_t len)
|
||||
{
|
||||
BOOL ret;
|
||||
DWORD dwNbBytesReadden = 0;
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_read()...\n"));
|
||||
ret = ReadFile((HANDLE)(fd), data, len, &dwNbBytesReadden, NULL);
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_read()=%lu bytes -> %d\n", dwNbBytesReadden, ret));
|
||||
LWIP_UNUSED_ARG(ret);
|
||||
return dwNbBytesReadden;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to read from the serial device. Same as sio_read but returns
|
||||
* immediately if no data is available and never blocks.
|
||||
*
|
||||
* @param fd serial device handle
|
||||
* @param data pointer to data buffer for receiving
|
||||
* @param len maximum length (in bytes) of data to receive
|
||||
* @return number of bytes actually received
|
||||
*/
|
||||
u32_t sio_tryread(sio_fd_t fd, u8_t* data, u32_t len)
|
||||
{
|
||||
/* @todo: implement non-blocking read */
|
||||
BOOL ret;
|
||||
DWORD dwNbBytesReadden = 0;
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_read()...\n"));
|
||||
ret = ReadFile((HANDLE)(fd), data, len, &dwNbBytesReadden, NULL);
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_read()=%lu bytes -> %d\n", dwNbBytesReadden, ret));
|
||||
LWIP_UNUSED_ARG(ret);
|
||||
return dwNbBytesReadden;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes to the serial device.
|
||||
*
|
||||
* @param fd serial device handle
|
||||
* @param data pointer to data to send
|
||||
* @param len length (in bytes) of data to send
|
||||
* @return number of bytes actually sent
|
||||
*
|
||||
* @note This function will block until all data can be sent.
|
||||
*/
|
||||
u32_t sio_write(sio_fd_t fd, u8_t* data, u32_t len)
|
||||
{
|
||||
BOOL ret;
|
||||
DWORD dwNbBytesWritten = 0;
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_write()...\n"));
|
||||
ret = WriteFile((HANDLE)(fd), data, len, &dwNbBytesWritten, NULL);
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_write()=%lu bytes -> %d\n", dwNbBytesWritten, ret));
|
||||
LWIP_UNUSED_ARG(ret);
|
||||
return dwNbBytesWritten;
|
||||
}
|
||||
|
||||
/**
|
||||
* Aborts a blocking sio_read() call.
|
||||
* @todo: This currently ignores fd and aborts all reads
|
||||
*
|
||||
* @param fd serial device handle
|
||||
*/
|
||||
void sio_read_abort(sio_fd_t fd)
|
||||
{
|
||||
LWIP_UNUSED_ARG(fd);
|
||||
LWIP_DEBUGF(SIO_DEBUG, ("sio_read_abort() !!!!!...\n"));
|
||||
sio_abort = 1;
|
||||
return;
|
||||
}
|
||||
@@ -1,612 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
* Simon Goldschmidt
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h> /* sprintf() for task names */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (push, 3)
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
#include <time.h>
|
||||
|
||||
#include <lwip/opt.h>
|
||||
#include <lwip/arch.h>
|
||||
#include <lwip/stats.h>
|
||||
#include <lwip/debug.h>
|
||||
#include <lwip/sys.h>
|
||||
|
||||
/* These functions are used from NO_SYS also, for precise timer triggering */
|
||||
LARGE_INTEGER freq, sys_start_time;
|
||||
#define SYS_INITIALIZED() (freq.QuadPart != 0)
|
||||
|
||||
DWORD netconn_sem_tls_index;
|
||||
|
||||
HCRYPTPROV hcrypt;
|
||||
u32_t sys_win_rand(void)
|
||||
{
|
||||
u32_t ret;
|
||||
if (CryptGenRandom(hcrypt, sizeof(ret), (BYTE*)&ret)) {
|
||||
return ret;
|
||||
}
|
||||
LWIP_ASSERT("CryptGenRandom failed", 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sys_win_rand_init(void)
|
||||
{
|
||||
if(!CryptAcquireContext(&hcrypt, NULL, NULL, PROV_RSA_FULL, 0)) {
|
||||
DWORD err = GetLastError();
|
||||
LWIP_PLATFORM_DIAG(("CryptAcquireContext failed with error %d, trying to create NEWKEYSET", (int)err));
|
||||
if(!CryptAcquireContext(&hcrypt, NULL, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET)) {
|
||||
err = GetLastError();
|
||||
char errbuf[128];
|
||||
snprintf(errbuf, sizeof(errbuf), "CryptAcquireContext failed with error %d", (int)err);
|
||||
LWIP_UNUSED_ARG(err);
|
||||
LWIP_ASSERT(errbuf, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sys_init_timing(void)
|
||||
{
|
||||
QueryPerformanceFrequency(&freq);
|
||||
QueryPerformanceCounter(&sys_start_time);
|
||||
}
|
||||
|
||||
static LONGLONG sys_get_ms_longlong(void)
|
||||
{
|
||||
LONGLONG ret;
|
||||
LARGE_INTEGER now;
|
||||
#if NO_SYS
|
||||
if (!SYS_INITIALIZED()) {
|
||||
sys_init();
|
||||
LWIP_ASSERT("initialization failed", SYS_INITIALIZED());
|
||||
}
|
||||
#endif /* NO_SYS */
|
||||
QueryPerformanceCounter(&now);
|
||||
ret = now.QuadPart-sys_start_time.QuadPart;
|
||||
return (u32_t)(((ret)*1000)/freq.QuadPart);
|
||||
}
|
||||
|
||||
u32_t sys_jiffies(void)
|
||||
{
|
||||
return (u32_t)sys_get_ms_longlong();
|
||||
}
|
||||
|
||||
u32_t sys_now(void)
|
||||
{
|
||||
return (u32_t)sys_get_ms_longlong();
|
||||
}
|
||||
|
||||
CRITICAL_SECTION critSec;
|
||||
|
||||
static void InitSysArchProtect(void)
|
||||
{
|
||||
InitializeCriticalSection(&critSec);
|
||||
}
|
||||
|
||||
sys_prot_t sys_arch_protect(void)
|
||||
{
|
||||
#if NO_SYS
|
||||
if (!SYS_INITIALIZED()) {
|
||||
sys_init();
|
||||
LWIP_ASSERT("initialization failed", SYS_INITIALIZED());
|
||||
}
|
||||
#endif
|
||||
EnterCriticalSection(&critSec);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sys_arch_unprotect(sys_prot_t pval)
|
||||
{
|
||||
LWIP_UNUSED_ARG(pval);
|
||||
LeaveCriticalSection(&critSec);
|
||||
}
|
||||
|
||||
static void msvc_sys_init(void)
|
||||
{
|
||||
sys_win_rand_init();
|
||||
sys_init_timing();
|
||||
InitSysArchProtect();
|
||||
netconn_sem_tls_index = TlsAlloc();
|
||||
LWIP_ASSERT("TlsAlloc failed", netconn_sem_tls_index != TLS_OUT_OF_INDEXES);
|
||||
}
|
||||
|
||||
void sys_init(void)
|
||||
{
|
||||
msvc_sys_init();
|
||||
}
|
||||
|
||||
#if !NO_SYS
|
||||
|
||||
struct threadlist {
|
||||
lwip_thread_fn function;
|
||||
void *arg;
|
||||
DWORD id;
|
||||
struct threadlist *next;
|
||||
};
|
||||
|
||||
struct threadlist *lwip_win32_threads = NULL;
|
||||
|
||||
err_t sys_sem_new(sys_sem_t *sem, u8_t count)
|
||||
{
|
||||
HANDLE new_sem = NULL;
|
||||
|
||||
LWIP_ASSERT("sem != NULL", sem != NULL);
|
||||
|
||||
new_sem = CreateSemaphore(0, count, 100000, 0);
|
||||
LWIP_ASSERT("Error creating semaphore", new_sem != NULL);
|
||||
if(new_sem != NULL) {
|
||||
SYS_STATS_INC_USED(sem);
|
||||
#if LWIP_STATS && SYS_STATS
|
||||
LWIP_ASSERT("sys_sem_new() counter overflow", lwip_stats.sys.sem.used != 0 );
|
||||
#endif /* LWIP_STATS && SYS_STATS*/
|
||||
sem->sem = new_sem;
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/* failed to allocate memory... */
|
||||
SYS_STATS_INC(sem.err);
|
||||
sem->sem = NULL;
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
void sys_sem_free(sys_sem_t *sem)
|
||||
{
|
||||
/* parameter check */
|
||||
LWIP_ASSERT("sem != NULL", sem != NULL);
|
||||
LWIP_ASSERT("sem->sem != NULL", sem->sem != NULL);
|
||||
LWIP_ASSERT("sem->sem != INVALID_HANDLE_VALUE", sem->sem != INVALID_HANDLE_VALUE);
|
||||
CloseHandle(sem->sem);
|
||||
|
||||
SYS_STATS_DEC(sem.used);
|
||||
#if LWIP_STATS && SYS_STATS
|
||||
LWIP_ASSERT("sys_sem_free() closed more than created", lwip_stats.sys.sem.used != (u16_t)-1);
|
||||
#endif /* LWIP_STATS && SYS_STATS */
|
||||
sem->sem = NULL;
|
||||
}
|
||||
|
||||
u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
|
||||
{
|
||||
DWORD ret;
|
||||
LONGLONG starttime, endtime;
|
||||
LWIP_ASSERT("sem != NULL", sem != NULL);
|
||||
LWIP_ASSERT("sem->sem != NULL", sem->sem != NULL);
|
||||
LWIP_ASSERT("sem->sem != INVALID_HANDLE_VALUE", sem->sem != INVALID_HANDLE_VALUE);
|
||||
if(!timeout)
|
||||
{
|
||||
/* wait infinite */
|
||||
starttime = sys_get_ms_longlong();
|
||||
ret = WaitForSingleObject(sem->sem, INFINITE);
|
||||
LWIP_ASSERT("Error waiting for semaphore", ret == WAIT_OBJECT_0);
|
||||
endtime = sys_get_ms_longlong();
|
||||
/* return the time we waited for the sem */
|
||||
return (u32_t)(endtime - starttime);
|
||||
}
|
||||
else
|
||||
{
|
||||
starttime = sys_get_ms_longlong();
|
||||
ret = WaitForSingleObject(sem->sem, timeout);
|
||||
LWIP_ASSERT("Error waiting for semaphore", (ret == WAIT_OBJECT_0) || (ret == WAIT_TIMEOUT));
|
||||
if(ret == WAIT_OBJECT_0)
|
||||
{
|
||||
endtime = sys_get_ms_longlong();
|
||||
/* return the time we waited for the sem */
|
||||
return (u32_t)(endtime - starttime);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* timeout */
|
||||
return SYS_ARCH_TIMEOUT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sys_sem_signal(sys_sem_t *sem)
|
||||
{
|
||||
BOOL ret;
|
||||
LWIP_ASSERT("sem != NULL", sem != NULL);
|
||||
LWIP_ASSERT("sem->sem != NULL", sem->sem != NULL);
|
||||
LWIP_ASSERT("sem->sem != INVALID_HANDLE_VALUE", sem->sem != INVALID_HANDLE_VALUE);
|
||||
ret = ReleaseSemaphore(sem->sem, 1, NULL);
|
||||
LWIP_ASSERT("Error releasing semaphore", ret != 0);
|
||||
LWIP_UNUSED_ARG(ret);
|
||||
}
|
||||
|
||||
err_t sys_mutex_new(sys_mutex_t *mutex)
|
||||
{
|
||||
HANDLE new_mut = NULL;
|
||||
|
||||
LWIP_ASSERT("mutex != NULL", mutex != NULL);
|
||||
|
||||
new_mut = CreateMutex(NULL, FALSE, NULL);
|
||||
LWIP_ASSERT("Error creating mutex", new_mut != NULL);
|
||||
if(new_mut != NULL) {
|
||||
SYS_STATS_INC_USED(mutex);
|
||||
#if LWIP_STATS && SYS_STATS
|
||||
LWIP_ASSERT("sys_mutex_new() counter overflow", lwip_stats.sys.mutex.used != 0 );
|
||||
#endif /* LWIP_STATS && SYS_STATS*/
|
||||
mutex->mut = new_mut;
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/* failed to allocate memory... */
|
||||
SYS_STATS_INC(mutex.err);
|
||||
mutex->mut = NULL;
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
void sys_mutex_free(sys_mutex_t *mutex)
|
||||
{
|
||||
/* parameter check */
|
||||
LWIP_ASSERT("mutex != NULL", mutex != NULL);
|
||||
LWIP_ASSERT("mutex->mut != NULL", mutex->mut != NULL);
|
||||
LWIP_ASSERT("mutex->mut != INVALID_HANDLE_VALUE", mutex->mut != INVALID_HANDLE_VALUE);
|
||||
CloseHandle(mutex->mut);
|
||||
|
||||
SYS_STATS_DEC(mutex.used);
|
||||
#if LWIP_STATS && SYS_STATS
|
||||
LWIP_ASSERT("sys_mutex_free() closed more than created", lwip_stats.sys.mutex.used != (u16_t)-1);
|
||||
#endif /* LWIP_STATS && SYS_STATS */
|
||||
mutex->mut = NULL;
|
||||
}
|
||||
|
||||
void sys_mutex_lock(sys_mutex_t *mutex)
|
||||
{
|
||||
DWORD ret;
|
||||
LWIP_ASSERT("mutex != NULL", mutex != NULL);
|
||||
LWIP_ASSERT("mutex->mut != NULL", mutex->mut != NULL);
|
||||
LWIP_ASSERT("mutex->mut != INVALID_HANDLE_VALUE", mutex->mut != INVALID_HANDLE_VALUE);
|
||||
/* wait infinite */
|
||||
ret = WaitForSingleObject(mutex->mut, INFINITE);
|
||||
LWIP_ASSERT("Error waiting for mutex", ret == WAIT_OBJECT_0);
|
||||
LWIP_UNUSED_ARG(ret);
|
||||
}
|
||||
|
||||
void sys_mutex_unlock(sys_mutex_t *mutex)
|
||||
{
|
||||
LWIP_ASSERT("mutex != NULL", mutex != NULL);
|
||||
LWIP_ASSERT("mutex->mut != NULL", mutex->mut != NULL);
|
||||
LWIP_ASSERT("mutex->mut != INVALID_HANDLE_VALUE", mutex->mut != INVALID_HANDLE_VALUE);
|
||||
/* wait infinite */
|
||||
if(!ReleaseMutex(mutex->mut))
|
||||
{
|
||||
LWIP_ASSERT("Error releasing mutex", 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
const DWORD MS_VC_EXCEPTION=0x406D1388;
|
||||
#pragma pack(push,8)
|
||||
typedef struct tagTHREADNAME_INFO
|
||||
{
|
||||
DWORD dwType; /* Must be 0x1000. */
|
||||
LPCSTR szName; /* Pointer to name (in user addr space). */
|
||||
DWORD dwThreadID; /* Thread ID (-1=caller thread). */
|
||||
DWORD dwFlags; /* Reserved for future use, must be zero. */
|
||||
} THREADNAME_INFO;
|
||||
#pragma pack(pop)
|
||||
static void SetThreadName(DWORD dwThreadID, const char* threadName)
|
||||
{
|
||||
THREADNAME_INFO info;
|
||||
info.dwType = 0x1000;
|
||||
info.szName = threadName;
|
||||
info.dwThreadID = dwThreadID;
|
||||
info.dwFlags = 0;
|
||||
|
||||
__try
|
||||
{
|
||||
RaiseException(MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(ULONG_PTR), (ULONG_PTR*)&info);
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
}
|
||||
}
|
||||
#else /* _MSC_VER */
|
||||
static void SetThreadName(DWORD dwThreadID, const char* threadName)
|
||||
{
|
||||
LWIP_UNUSED_ARG(dwThreadID);
|
||||
LWIP_UNUSED_ARG(threadName);
|
||||
}
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
static void sys_thread_function(void* arg)
|
||||
{
|
||||
struct threadlist* t = (struct threadlist*)arg;
|
||||
#if LWIP_NETCONN_SEM_PER_THREAD
|
||||
sys_arch_netconn_sem_alloc();
|
||||
#endif
|
||||
t->function(t->arg);
|
||||
#if LWIP_NETCONN_SEM_PER_THREAD
|
||||
sys_arch_netconn_sem_free();
|
||||
#endif
|
||||
}
|
||||
|
||||
sys_thread_t sys_thread_new(const char *name, lwip_thread_fn function, void *arg, int stacksize, int prio)
|
||||
{
|
||||
struct threadlist *new_thread;
|
||||
HANDLE h;
|
||||
SYS_ARCH_DECL_PROTECT(lev);
|
||||
|
||||
LWIP_UNUSED_ARG(name);
|
||||
LWIP_UNUSED_ARG(stacksize);
|
||||
LWIP_UNUSED_ARG(prio);
|
||||
|
||||
new_thread = (struct threadlist*)malloc(sizeof(struct threadlist));
|
||||
LWIP_ASSERT("new_thread != NULL", new_thread != NULL);
|
||||
if(new_thread != NULL) {
|
||||
new_thread->function = function;
|
||||
new_thread->arg = arg;
|
||||
SYS_ARCH_PROTECT(lev);
|
||||
new_thread->next = lwip_win32_threads;
|
||||
lwip_win32_threads = new_thread;
|
||||
|
||||
h = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)sys_thread_function, new_thread, 0, &(new_thread->id));
|
||||
LWIP_ASSERT("h != 0", h != 0);
|
||||
LWIP_ASSERT("h != -1", h != INVALID_HANDLE_VALUE);
|
||||
LWIP_UNUSED_ARG(h);
|
||||
SetThreadName(new_thread->id, name);
|
||||
|
||||
SYS_ARCH_UNPROTECT(lev);
|
||||
return new_thread->id;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
err_t sys_mbox_new(sys_mbox_t *mbox, int size)
|
||||
{
|
||||
LWIP_ASSERT("mbox != NULL", mbox != NULL);
|
||||
LWIP_UNUSED_ARG(size);
|
||||
|
||||
mbox->sem = CreateSemaphore(0, 0, MAX_QUEUE_ENTRIES, 0);
|
||||
LWIP_ASSERT("Error creating semaphore", mbox->sem != NULL);
|
||||
if(mbox->sem == NULL) {
|
||||
SYS_STATS_INC(mbox.err);
|
||||
return ERR_MEM;
|
||||
}
|
||||
memset(&mbox->q_mem, 0, sizeof(u32_t)*MAX_QUEUE_ENTRIES);
|
||||
mbox->head = 0;
|
||||
mbox->tail = 0;
|
||||
SYS_STATS_INC_USED(mbox);
|
||||
#if LWIP_STATS && SYS_STATS
|
||||
LWIP_ASSERT("sys_mbox_new() counter overflow", lwip_stats.sys.mbox.used != 0 );
|
||||
#endif /* LWIP_STATS && SYS_STATS */
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void sys_mbox_free(sys_mbox_t *mbox)
|
||||
{
|
||||
/* parameter check */
|
||||
LWIP_ASSERT("mbox != NULL", mbox != NULL);
|
||||
LWIP_ASSERT("mbox->sem != NULL", mbox->sem != NULL);
|
||||
LWIP_ASSERT("mbox->sem != INVALID_HANDLE_VALUE", mbox->sem != INVALID_HANDLE_VALUE);
|
||||
|
||||
CloseHandle(mbox->sem);
|
||||
|
||||
SYS_STATS_DEC(mbox.used);
|
||||
#if LWIP_STATS && SYS_STATS
|
||||
LWIP_ASSERT( "sys_mbox_free() ", lwip_stats.sys.mbox.used!= (u16_t)-1 );
|
||||
#endif /* LWIP_STATS && SYS_STATS */
|
||||
mbox->sem = NULL;
|
||||
}
|
||||
|
||||
void sys_mbox_post(sys_mbox_t *q, void *msg)
|
||||
{
|
||||
BOOL ret;
|
||||
SYS_ARCH_DECL_PROTECT(lev);
|
||||
|
||||
/* parameter check */
|
||||
LWIP_ASSERT("q != SYS_MBOX_NULL", q != SYS_MBOX_NULL);
|
||||
LWIP_ASSERT("q->sem != NULL", q->sem != NULL);
|
||||
LWIP_ASSERT("q->sem != INVALID_HANDLE_VALUE", q->sem != INVALID_HANDLE_VALUE);
|
||||
|
||||
SYS_ARCH_PROTECT(lev);
|
||||
q->q_mem[q->head] = msg;
|
||||
(q->head)++;
|
||||
if (q->head >= MAX_QUEUE_ENTRIES) {
|
||||
q->head = 0;
|
||||
}
|
||||
LWIP_ASSERT("mbox is full!", q->head != q->tail);
|
||||
ret = ReleaseSemaphore(q->sem, 1, 0);
|
||||
LWIP_ASSERT("Error releasing sem", ret != 0);
|
||||
LWIP_UNUSED_ARG(ret);
|
||||
|
||||
SYS_ARCH_UNPROTECT(lev);
|
||||
}
|
||||
|
||||
err_t sys_mbox_trypost(sys_mbox_t *q, void *msg)
|
||||
{
|
||||
u32_t new_head;
|
||||
BOOL ret;
|
||||
SYS_ARCH_DECL_PROTECT(lev);
|
||||
|
||||
/* parameter check */
|
||||
LWIP_ASSERT("q != SYS_MBOX_NULL", q != SYS_MBOX_NULL);
|
||||
LWIP_ASSERT("q->sem != NULL", q->sem != NULL);
|
||||
LWIP_ASSERT("q->sem != INVALID_HANDLE_VALUE", q->sem != INVALID_HANDLE_VALUE);
|
||||
|
||||
SYS_ARCH_PROTECT(lev);
|
||||
|
||||
new_head = q->head + 1;
|
||||
if (new_head >= MAX_QUEUE_ENTRIES) {
|
||||
new_head = 0;
|
||||
}
|
||||
if (new_head == q->tail) {
|
||||
SYS_ARCH_UNPROTECT(lev);
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
q->q_mem[q->head] = msg;
|
||||
q->head = new_head;
|
||||
LWIP_ASSERT("mbox is full!", q->head != q->tail);
|
||||
ret = ReleaseSemaphore(q->sem, 1, 0);
|
||||
LWIP_ASSERT("Error releasing sem", ret != 0);
|
||||
LWIP_UNUSED_ARG(ret);
|
||||
|
||||
SYS_ARCH_UNPROTECT(lev);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
u32_t sys_arch_mbox_fetch(sys_mbox_t *q, void **msg, u32_t timeout)
|
||||
{
|
||||
DWORD ret;
|
||||
LONGLONG starttime, endtime;
|
||||
SYS_ARCH_DECL_PROTECT(lev);
|
||||
|
||||
/* parameter check */
|
||||
LWIP_ASSERT("q != SYS_MBOX_NULL", q != SYS_MBOX_NULL);
|
||||
LWIP_ASSERT("q->sem != NULL", q->sem != NULL);
|
||||
LWIP_ASSERT("q->sem != INVALID_HANDLE_VALUE", q->sem != INVALID_HANDLE_VALUE);
|
||||
|
||||
if (timeout == 0) {
|
||||
timeout = INFINITE;
|
||||
}
|
||||
starttime = sys_get_ms_longlong();
|
||||
if ((ret = WaitForSingleObject(q->sem, timeout)) == WAIT_OBJECT_0) {
|
||||
SYS_ARCH_PROTECT(lev);
|
||||
if(msg != NULL) {
|
||||
*msg = q->q_mem[q->tail];
|
||||
}
|
||||
|
||||
(q->tail)++;
|
||||
if (q->tail >= MAX_QUEUE_ENTRIES) {
|
||||
q->tail = 0;
|
||||
}
|
||||
SYS_ARCH_UNPROTECT(lev);
|
||||
endtime = sys_get_ms_longlong();
|
||||
return (u32_t)(endtime - starttime);
|
||||
}
|
||||
else
|
||||
{
|
||||
LWIP_ASSERT("Error waiting for sem", ret == WAIT_TIMEOUT);
|
||||
if(msg != NULL) {
|
||||
*msg = NULL;
|
||||
}
|
||||
|
||||
return SYS_ARCH_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
u32_t sys_arch_mbox_tryfetch(sys_mbox_t *q, void **msg)
|
||||
{
|
||||
DWORD ret;
|
||||
SYS_ARCH_DECL_PROTECT(lev);
|
||||
|
||||
/* parameter check */
|
||||
LWIP_ASSERT("q != SYS_MBOX_NULL", q != SYS_MBOX_NULL);
|
||||
LWIP_ASSERT("q->sem != NULL", q->sem != NULL);
|
||||
LWIP_ASSERT("q->sem != INVALID_HANDLE_VALUE", q->sem != INVALID_HANDLE_VALUE);
|
||||
|
||||
if ((ret = WaitForSingleObject(q->sem, 0)) == WAIT_OBJECT_0) {
|
||||
SYS_ARCH_PROTECT(lev);
|
||||
if(msg != NULL) {
|
||||
*msg = q->q_mem[q->tail];
|
||||
}
|
||||
|
||||
(q->tail)++;
|
||||
if (q->tail >= MAX_QUEUE_ENTRIES) {
|
||||
q->tail = 0;
|
||||
}
|
||||
SYS_ARCH_UNPROTECT(lev);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
LWIP_ASSERT("Error waiting for sem", ret == WAIT_TIMEOUT);
|
||||
if(msg != NULL) {
|
||||
*msg = NULL;
|
||||
}
|
||||
|
||||
return SYS_ARCH_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
#if LWIP_NETCONN_SEM_PER_THREAD
|
||||
sys_sem_t* sys_arch_netconn_sem_get(void)
|
||||
{
|
||||
LPVOID tls_data = TlsGetValue(netconn_sem_tls_index);
|
||||
return (sys_sem_t*)tls_data;
|
||||
}
|
||||
|
||||
void sys_arch_netconn_sem_alloc(void)
|
||||
{
|
||||
sys_sem_t *sem;
|
||||
err_t err;
|
||||
BOOL done;
|
||||
|
||||
sem = (sys_sem_t*)malloc(sizeof(sys_sem_t));
|
||||
LWIP_ASSERT("failed to allocate memory for TLS semaphore", sem != NULL);
|
||||
err = sys_sem_new(sem, 0);
|
||||
LWIP_ASSERT("failed to initialise TLS semaphore", err == ERR_OK);
|
||||
done = TlsSetValue(netconn_sem_tls_index, sem);
|
||||
LWIP_UNUSED_ARG(done);
|
||||
LWIP_ASSERT("failed to initialise TLS semaphore storage", done == TRUE);
|
||||
}
|
||||
|
||||
void sys_arch_netconn_sem_free(void)
|
||||
{
|
||||
LPVOID tls_data = TlsGetValue(netconn_sem_tls_index);
|
||||
if (tls_data != NULL) {
|
||||
BOOL done;
|
||||
free(tls_data);
|
||||
done = TlsSetValue(netconn_sem_tls_index, NULL);
|
||||
LWIP_UNUSED_ARG(done);
|
||||
LWIP_ASSERT("failed to de-init TLS semaphore storage", done == TRUE);
|
||||
}
|
||||
}
|
||||
#endif /* LWIP_NETCONN_SEM_PER_THREAD */
|
||||
|
||||
#endif /* !NO_SYS */
|
||||
|
||||
/* get keyboard state to terminate the debug app on any kbhit event using win32 API */
|
||||
int lwip_win32_keypressed(void)
|
||||
{
|
||||
INPUT_RECORD rec;
|
||||
DWORD num = 0;
|
||||
HANDLE h = GetStdHandle(STD_INPUT_HANDLE);
|
||||
BOOL ret = PeekConsoleInput(h, &rec, 1, &num);
|
||||
if (ret) {
|
||||
if(rec.EventType == KEY_EVENT) {
|
||||
if(rec.Event.KeyEvent.bKeyDown) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
ReadConsoleInput(h, &rec, 1, &num);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,788 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001,2002 Florian Schulze.
|
||||
* 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 authors nor the names of the contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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.
|
||||
*
|
||||
* test.c - This file is part of lwIP test
|
||||
*
|
||||
*/
|
||||
|
||||
/* C runtime includes */
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
/* lwIP core includes */
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/timeouts.h"
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/stats.h"
|
||||
#include "lwip/init.h"
|
||||
#include "lwip/tcpip.h"
|
||||
#include "lwip/netif.h"
|
||||
#include "lwip/api.h"
|
||||
|
||||
#include "lwip/tcp.h"
|
||||
#include "lwip/udp.h"
|
||||
#include "lwip/dns.h"
|
||||
#include "lwip/dhcp.h"
|
||||
#include "lwip/autoip.h"
|
||||
|
||||
/* lwIP netif includes */
|
||||
#include "lwip/etharp.h"
|
||||
#include "netif/ethernet.h"
|
||||
|
||||
/* applications includes */
|
||||
#include "lwip/apps/lwiperf.h"
|
||||
#include "lwip/apps/netbiosns.h"
|
||||
#include "lwip/apps/sntp.h"
|
||||
#include "lwip/apps/httpd.h"
|
||||
#include "lwip/apps/mdns.h"
|
||||
#include "lwip/apps/snmp.h"
|
||||
#include "apps/httpserver/httpserver-netconn.h"
|
||||
#include "apps/netio/netio.h"
|
||||
#include "apps/ping/ping.h"
|
||||
#include "apps/rtp/rtp.h"
|
||||
#include "apps/chargen/chargen.h"
|
||||
#include "apps/shell/shell.h"
|
||||
#include "apps/tcpecho/tcpecho.h"
|
||||
#include "apps/udpecho/udpecho.h"
|
||||
#include "apps/tcpecho_raw/tcpecho_raw.h"
|
||||
#include "apps/socket_examples/socket_examples.h"
|
||||
#include "apps/snmp_v3/snmpv3_dummy.h"
|
||||
|
||||
#if NO_SYS
|
||||
/* ... then we need information about the timer intervals: */
|
||||
#include "lwip/ip4_frag.h"
|
||||
#include "lwip/igmp.h"
|
||||
#endif /* NO_SYS */
|
||||
|
||||
#include "netif/ppp/ppp_opts.h"
|
||||
#if PPP_SUPPORT
|
||||
/* PPP includes */
|
||||
#include "lwip/sio.h"
|
||||
#include "netif/ppp/pppapi.h"
|
||||
#include "netif/ppp/pppos.h"
|
||||
#include "netif/ppp/pppoe.h"
|
||||
#if !NO_SYS && !LWIP_PPP_API
|
||||
#error With NO_SYS==0, LWIP_PPP_API==1 is required.
|
||||
#endif
|
||||
#endif /* PPP_SUPPORT */
|
||||
|
||||
/* include the port-dependent configuration */
|
||||
#include "lwipcfg_msvc.h"
|
||||
|
||||
/** Define this to 1 to enable a PCAP interface as default interface. */
|
||||
#ifndef USE_PCAPIF
|
||||
#define USE_PCAPIF 1
|
||||
#endif
|
||||
|
||||
/** Define this to 1 to enable a PPP interface. */
|
||||
#ifndef USE_PPP
|
||||
#define USE_PPP 0
|
||||
#endif
|
||||
|
||||
/** Define this to 1 or 2 to support 1 or 2 SLIP interfaces. */
|
||||
#ifndef USE_SLIPIF
|
||||
#define USE_SLIPIF 0
|
||||
#endif
|
||||
|
||||
/** Use an ethernet adapter? Default to enabled if PCAPIF or PPPoE are used. */
|
||||
#ifndef USE_ETHERNET
|
||||
#define USE_ETHERNET (USE_PCAPIF || PPPOE_SUPPORT)
|
||||
#endif
|
||||
|
||||
/** Use an ethernet adapter for TCP/IP? By default only if PCAPIF is used. */
|
||||
#ifndef USE_ETHERNET_TCPIP
|
||||
#define USE_ETHERNET_TCPIP (USE_PCAPIF)
|
||||
#endif
|
||||
|
||||
#if USE_ETHERNET
|
||||
#include "pcapif.h"
|
||||
#endif /* USE_ETHERNET */
|
||||
#if USE_SLIPIF
|
||||
#include <netif/slipif.h>
|
||||
#endif /* USE_SLIPIF */
|
||||
|
||||
#ifndef USE_DHCP
|
||||
#define USE_DHCP LWIP_DHCP
|
||||
#endif
|
||||
#ifndef USE_AUTOIP
|
||||
#define USE_AUTOIP LWIP_AUTOIP
|
||||
#endif
|
||||
|
||||
/* globales variables for netifs */
|
||||
#if USE_ETHERNET
|
||||
/* THE ethernet interface */
|
||||
struct netif netif;
|
||||
#if LWIP_DHCP
|
||||
/* dhcp struct for the ethernet netif */
|
||||
struct dhcp netif_dhcp;
|
||||
#endif /* LWIP_DHCP */
|
||||
#if LWIP_AUTOIP
|
||||
/* autoip struct for the ethernet netif */
|
||||
struct autoip netif_autoip;
|
||||
#endif /* LWIP_AUTOIP */
|
||||
#endif /* USE_ETHERNET */
|
||||
#if USE_PPP
|
||||
/* THE PPP PCB */
|
||||
ppp_pcb *ppp;
|
||||
/* THE PPP interface */
|
||||
struct netif ppp_netif;
|
||||
/* THE PPP descriptor */
|
||||
u8_t sio_idx = 0;
|
||||
sio_fd_t ppp_sio;
|
||||
#endif /* USE_PPP */
|
||||
#if USE_SLIPIF
|
||||
struct netif slipif1;
|
||||
#if USE_SLIPIF > 1
|
||||
struct netif slipif2;
|
||||
#endif /* USE_SLIPIF > 1 */
|
||||
#endif /* USE_SLIPIF */
|
||||
|
||||
|
||||
#if USE_PPP
|
||||
static void
|
||||
pppLinkStatusCallback(ppp_pcb *pcb, int errCode, void *ctx)
|
||||
{
|
||||
struct netif *pppif = ppp_netif(pcb);
|
||||
LWIP_UNUSED_ARG(ctx);
|
||||
|
||||
switch(errCode) {
|
||||
case PPPERR_NONE: { /* No error. */
|
||||
printf("pppLinkStatusCallback: PPPERR_NONE\n");
|
||||
#if LWIP_IPV4
|
||||
printf(" our_ipaddr = %s\n", ip4addr_ntoa(netif_ip4_addr(pppif)));
|
||||
printf(" his_ipaddr = %s\n", ip4addr_ntoa(netif_ip4_gw(pppif)));
|
||||
printf(" netmask = %s\n", ip4addr_ntoa(netif_ip4_netmask(pppif)));
|
||||
#endif /* LWIP_IPV4 */
|
||||
#if LWIP_DNS
|
||||
printf(" dns1 = %s\n", ipaddr_ntoa(dns_getserver(0)));
|
||||
printf(" dns2 = %s\n", ipaddr_ntoa(dns_getserver(1)));
|
||||
#endif /* LWIP_DNS */
|
||||
#if PPP_IPV6_SUPPORT
|
||||
printf(" our6_ipaddr = %s\n", ip6addr_ntoa(netif_ip6_addr(pppif, 0)));
|
||||
#endif /* PPP_IPV6_SUPPORT */
|
||||
break;
|
||||
}
|
||||
case PPPERR_PARAM: { /* Invalid parameter. */
|
||||
printf("pppLinkStatusCallback: PPPERR_PARAM\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_OPEN: { /* Unable to open PPP session. */
|
||||
printf("pppLinkStatusCallback: PPPERR_OPEN\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_DEVICE: { /* Invalid I/O device for PPP. */
|
||||
printf("pppLinkStatusCallback: PPPERR_DEVICE\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_ALLOC: { /* Unable to allocate resources. */
|
||||
printf("pppLinkStatusCallback: PPPERR_ALLOC\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_USER: { /* User interrupt. */
|
||||
printf("pppLinkStatusCallback: PPPERR_USER\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_CONNECT: { /* Connection lost. */
|
||||
printf("pppLinkStatusCallback: PPPERR_CONNECT\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_AUTHFAIL: { /* Failed authentication challenge. */
|
||||
printf("pppLinkStatusCallback: PPPERR_AUTHFAIL\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_PROTOCOL: { /* Failed to meet protocol. */
|
||||
printf("pppLinkStatusCallback: PPPERR_PROTOCOL\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_PEERDEAD: { /* Connection timeout */
|
||||
printf("pppLinkStatusCallback: PPPERR_PEERDEAD\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_IDLETIMEOUT: { /* Idle Timeout */
|
||||
printf("pppLinkStatusCallback: PPPERR_IDLETIMEOUT\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_CONNECTTIME: { /* Max connect time reached */
|
||||
printf("pppLinkStatusCallback: PPPERR_CONNECTTIME\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_LOOPBACK: { /* Loopback detected */
|
||||
printf("pppLinkStatusCallback: PPPERR_LOOPBACK\n");
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
printf("pppLinkStatusCallback: unknown errCode %d\n", errCode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if PPPOS_SUPPORT
|
||||
static u32_t
|
||||
ppp_output_cb(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx)
|
||||
{
|
||||
LWIP_UNUSED_ARG(pcb);
|
||||
LWIP_UNUSED_ARG(ctx);
|
||||
return sio_write(ppp_sio, data, len);
|
||||
}
|
||||
#endif /* PPPOS_SUPPORT */
|
||||
#endif /* USE_PPP */
|
||||
|
||||
#if LWIP_NETIF_STATUS_CALLBACK
|
||||
static void
|
||||
status_callback(struct netif *state_netif)
|
||||
{
|
||||
if (netif_is_up(state_netif)) {
|
||||
#if LWIP_IPV4
|
||||
printf("status_callback==UP, local interface IP is %s\n", ip4addr_ntoa(netif_ip4_addr(state_netif)));
|
||||
#else
|
||||
printf("status_callback==UP\n");
|
||||
#endif
|
||||
#if LWIP_MDNS_RESPONDER
|
||||
mdns_resp_netif_settings_changed(state_netif);
|
||||
#endif
|
||||
} else {
|
||||
printf("status_callback==DOWN\n");
|
||||
}
|
||||
}
|
||||
#endif /* LWIP_NETIF_STATUS_CALLBACK */
|
||||
|
||||
#if LWIP_NETIF_LINK_CALLBACK
|
||||
static void
|
||||
link_callback(struct netif *state_netif)
|
||||
{
|
||||
if (netif_is_link_up(state_netif)) {
|
||||
printf("link_callback==UP\n");
|
||||
} else {
|
||||
printf("link_callback==DOWN\n");
|
||||
}
|
||||
}
|
||||
#endif /* LWIP_NETIF_LINK_CALLBACK */
|
||||
|
||||
/* This function initializes all network interfaces */
|
||||
static void
|
||||
msvc_netif_init(void)
|
||||
{
|
||||
#if LWIP_IPV4 && USE_ETHERNET
|
||||
ip4_addr_t ipaddr, netmask, gw;
|
||||
#endif /* LWIP_IPV4 && USE_ETHERNET */
|
||||
#if USE_SLIPIF
|
||||
u8_t num_slip1 = 0;
|
||||
#if LWIP_IPV4
|
||||
ip4_addr_t ipaddr_slip1, netmask_slip1, gw_slip1;
|
||||
#endif
|
||||
#if USE_SLIPIF > 1
|
||||
u8_t num_slip2 = 1;
|
||||
#if LWIP_IPV4
|
||||
ip4_addr_t ipaddr_slip2, netmask_slip2, gw_slip2;
|
||||
#endif
|
||||
#endif /* USE_SLIPIF > 1 */
|
||||
#endif /* USE_SLIPIF */
|
||||
#if USE_DHCP || USE_AUTOIP
|
||||
err_t err;
|
||||
#endif
|
||||
|
||||
#if USE_PPP
|
||||
const char *username = NULL, *password = NULL;
|
||||
#ifdef PPP_USERNAME
|
||||
username = PPP_USERNAME;
|
||||
#endif
|
||||
#ifdef PPP_PASSWORD
|
||||
password = PPP_PASSWORD;
|
||||
#endif
|
||||
printf("ppp_connect: COM%d\n", (int)sio_idx);
|
||||
#if PPPOS_SUPPORT
|
||||
ppp_sio = sio_open(sio_idx);
|
||||
if (ppp_sio == NULL) {
|
||||
printf("sio_open error\n");
|
||||
} else {
|
||||
ppp = pppos_create(&ppp_netif, ppp_output_cb, pppLinkStatusCallback, NULL);
|
||||
if (ppp == NULL) {
|
||||
printf("pppos_create error\n");
|
||||
} else {
|
||||
ppp_set_auth(ppp, PPPAUTHTYPE_ANY, username, password);
|
||||
ppp_connect(ppp, 0);
|
||||
}
|
||||
}
|
||||
#endif /* PPPOS_SUPPORT */
|
||||
#endif /* USE_PPP */
|
||||
|
||||
#if USE_ETHERNET
|
||||
#if LWIP_IPV4
|
||||
#define NETIF_ADDRS &ipaddr, &netmask, &gw,
|
||||
ip4_addr_set_zero(&gw);
|
||||
ip4_addr_set_zero(&ipaddr);
|
||||
ip4_addr_set_zero(&netmask);
|
||||
#if USE_ETHERNET_TCPIP
|
||||
#if USE_DHCP
|
||||
printf("Starting lwIP, local interface IP is dhcp-enabled\n");
|
||||
#elif USE_AUTOIP
|
||||
printf("Starting lwIP, local interface IP is autoip-enabled\n");
|
||||
#else /* USE_DHCP */
|
||||
LWIP_PORT_INIT_GW(&gw);
|
||||
LWIP_PORT_INIT_IPADDR(&ipaddr);
|
||||
LWIP_PORT_INIT_NETMASK(&netmask);
|
||||
printf("Starting lwIP, local interface IP is %s\n", ip4addr_ntoa(&ipaddr));
|
||||
#endif /* USE_DHCP */
|
||||
#endif /* USE_ETHERNET_TCPIP */
|
||||
#else /* LWIP_IPV4 */
|
||||
#define NETIF_ADDRS
|
||||
printf("Starting lwIP, IPv4 disable\n");
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
#if NO_SYS
|
||||
netif_set_default(netif_add(&netif, NETIF_ADDRS NULL, pcapif_init, netif_input));
|
||||
#else /* NO_SYS */
|
||||
netif_set_default(netif_add(&netif, NETIF_ADDRS NULL, pcapif_init, tcpip_input));
|
||||
#endif /* NO_SYS */
|
||||
#if LWIP_IPV6
|
||||
netif_create_ip6_linklocal_address(&netif, 1);
|
||||
printf("ip6 linklocal address: ");
|
||||
ip6_addr_debug_print(0xFFFFFFFF & ~LWIP_DBG_HALT, netif_ip6_addr(&netif, 0));
|
||||
printf("\n");
|
||||
#endif /* LWIP_IPV6 */
|
||||
#if LWIP_NETIF_STATUS_CALLBACK
|
||||
netif_set_status_callback(&netif, status_callback);
|
||||
#endif /* LWIP_NETIF_STATUS_CALLBACK */
|
||||
#if LWIP_NETIF_LINK_CALLBACK
|
||||
netif_set_link_callback(&netif, link_callback);
|
||||
#endif /* LWIP_NETIF_LINK_CALLBACK */
|
||||
|
||||
#if USE_ETHERNET_TCPIP
|
||||
#if LWIP_AUTOIP
|
||||
autoip_set_struct(&netif, &netif_autoip);
|
||||
#endif /* LWIP_AUTOIP */
|
||||
#if LWIP_DHCP
|
||||
dhcp_set_struct(&netif, &netif_dhcp);
|
||||
#endif /* LWIP_DHCP */
|
||||
netif_set_up(&netif);
|
||||
#if USE_DHCP
|
||||
err = dhcp_start(&netif);
|
||||
LWIP_ASSERT("dhcp_start failed", err == ERR_OK);
|
||||
#elif USE_AUTOIP
|
||||
err = autoip_start(&netif);
|
||||
LWIP_ASSERT("autoip_start failed", err == ERR_OK);
|
||||
#endif /* USE_DHCP */
|
||||
#else /* USE_ETHERNET_TCPIP */
|
||||
/* Use ethernet for PPPoE only */
|
||||
netif.flags &= ~(NETIF_FLAG_ETHARP | NETIF_FLAG_IGMP); /* no ARP */
|
||||
netif.flags |= NETIF_FLAG_ETHERNET; /* but pure ethernet */
|
||||
#endif /* USE_ETHERNET_TCPIP */
|
||||
|
||||
#if USE_PPP && PPPOE_SUPPORT
|
||||
/* start PPPoE after ethernet netif is added! */
|
||||
ppp = pppoe_create(&ppp_netif, &netif, NULL, NULL, pppLinkStatusCallback, NULL);
|
||||
if (ppp == NULL) {
|
||||
printf("pppos_create error\n");
|
||||
} else {
|
||||
ppp_set_auth(ppp, PPPAUTHTYPE_ANY, username, password);
|
||||
ppp_connect(ppp, 0);
|
||||
}
|
||||
#endif /* USE_PPP && PPPOE_SUPPORT */
|
||||
|
||||
#endif /* USE_ETHERNET */
|
||||
#if USE_SLIPIF
|
||||
#if LWIP_IPV4
|
||||
#define SLIP1_ADDRS &ipaddr_slip1, &netmask_slip1, &gw_slip1,
|
||||
LWIP_PORT_INIT_SLIP1_IPADDR(&ipaddr_slip1);
|
||||
LWIP_PORT_INIT_SLIP1_GW(&gw_slip1);
|
||||
LWIP_PORT_INIT_SLIP1_NETMASK(&netmask_slip1);
|
||||
printf("Starting lwIP slipif, local interface IP is %s\n", ip4addr_ntoa(&ipaddr_slip1));
|
||||
#else
|
||||
#define SLIP1_ADDRS
|
||||
printf("Starting lwIP slipif\n");
|
||||
#endif
|
||||
#if defined(SIO_USE_COMPORT) && SIO_USE_COMPORT
|
||||
num_slip1++; /* COM ports cannot be 0-based */
|
||||
#endif
|
||||
netif_add(&slipif1, SLIP1_ADDRS &num_slip1, slipif_init, ip_input);
|
||||
#if !USE_ETHERNET
|
||||
netif_set_default(&slipif1);
|
||||
#endif /* !USE_ETHERNET */
|
||||
#if LWIP_IPV6
|
||||
netif_create_ip6_linklocal_address(&slipif1, 1);
|
||||
printf("SLIP ip6 linklocal address: ");
|
||||
ip6_addr_debug_print(0xFFFFFFFF & ~LWIP_DBG_HALT, netif_ip6_addr(&slipif1, 0));
|
||||
printf("\n");
|
||||
#endif /* LWIP_IPV6 */
|
||||
#if LWIP_NETIF_STATUS_CALLBACK
|
||||
netif_set_status_callback(&slipif1, status_callback);
|
||||
#endif /* LWIP_NETIF_STATUS_CALLBACK */
|
||||
#if LWIP_NETIF_LINK_CALLBACK
|
||||
netif_set_link_callback(&slipif1, link_callback);
|
||||
#endif /* LWIP_NETIF_LINK_CALLBACK */
|
||||
netif_set_up(&slipif1);
|
||||
|
||||
#if USE_SLIPIF > 1
|
||||
#if LWIP_IPV4
|
||||
#define SLIP2_ADDRS &ipaddr_slip2, &netmask_slip2, &gw_slip2,
|
||||
LWIP_PORT_INIT_SLIP2_IPADDR(&ipaddr_slip2);
|
||||
LWIP_PORT_INIT_SLIP2_GW(&gw_slip2);
|
||||
LWIP_PORT_INIT_SLIP2_NETMASK(&netmask_slip2);
|
||||
printf("Starting lwIP SLIP if #2, local interface IP is %s\n", ip4addr_ntoa(&ipaddr_slip2));
|
||||
#else
|
||||
#define SLIP2_ADDRS
|
||||
printf("Starting lwIP SLIP if #2\n");
|
||||
#endif
|
||||
#if defined(SIO_USE_COMPORT) && SIO_USE_COMPORT
|
||||
num_slip2++; /* COM ports cannot be 0-based */
|
||||
#endif
|
||||
netif_add(&slipif2, SLIP2_ADDRS &num_slip2, slipif_init, ip_input);
|
||||
#if LWIP_IPV6
|
||||
netif_create_ip6_linklocal_address(&slipif1, 1);
|
||||
printf("SLIP2 ip6 linklocal address: ");
|
||||
ip6_addr_debug_print(0xFFFFFFFF & ~LWIP_DBG_HALT, netif_ip6_addr(&slipif2, 0));
|
||||
printf("\n");
|
||||
#endif /* LWIP_IPV6 */
|
||||
#if LWIP_NETIF_STATUS_CALLBACK
|
||||
netif_set_status_callback(&slipif2, status_callback);
|
||||
#endif /* LWIP_NETIF_STATUS_CALLBACK */
|
||||
#if LWIP_NETIF_LINK_CALLBACK
|
||||
netif_set_link_callback(&slipif2, link_callback);
|
||||
#endif /* LWIP_NETIF_LINK_CALLBACK */
|
||||
netif_set_up(&slipif2);
|
||||
#endif /* USE_SLIPIF > 1*/
|
||||
#endif /* USE_SLIPIF */
|
||||
}
|
||||
|
||||
#if LWIP_DNS_APP && LWIP_DNS
|
||||
static void
|
||||
dns_found(const char *name, const ip_addr_t *addr, void *arg)
|
||||
{
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
printf("%s: %s\n", name, addr ? ipaddr_ntoa(addr) : "<not found>");
|
||||
}
|
||||
|
||||
static void
|
||||
dns_dorequest(void *arg)
|
||||
{
|
||||
const char* dnsname = "3com.com";
|
||||
ip_addr_t dnsresp;
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
|
||||
if (dns_gethostbyname(dnsname, &dnsresp, dns_found, 0) == ERR_OK) {
|
||||
dns_found(dnsname, &dnsresp, 0);
|
||||
}
|
||||
}
|
||||
#endif /* LWIP_DNS_APP && LWIP_DNS */
|
||||
|
||||
#if LWIP_LWIPERF_APP
|
||||
static void
|
||||
lwiperf_report(void *arg, enum lwiperf_report_type report_type,
|
||||
const ip_addr_t* local_addr, u16_t local_port, const ip_addr_t* remote_addr, u16_t remote_port,
|
||||
u32_t bytes_transferred, u32_t ms_duration, u32_t bandwidth_kbitpsec)
|
||||
{
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
LWIP_UNUSED_ARG(local_addr);
|
||||
LWIP_UNUSED_ARG(local_port);
|
||||
|
||||
printf("IPERF report: type=%d, remote: %s:%d, total bytes: %lu, duration in ms: %lu, kbits/s: %lu\n",
|
||||
(int)report_type, ipaddr_ntoa(remote_addr), (int)remote_port, bytes_transferred, ms_duration, bandwidth_kbitpsec);
|
||||
}
|
||||
#endif /* LWIP_LWIPERF_APP */
|
||||
|
||||
#if LWIP_MDNS_RESPONDER
|
||||
static void srv_txt(struct mdns_service *service, void *txt_userdata)
|
||||
{
|
||||
err_t res = mdns_resp_add_service_txtitem(service, "path=/", 6);
|
||||
LWIP_ERROR("mdns add service txt failed\n", (res == ERR_OK), return);
|
||||
LWIP_UNUSED_ARG(txt_userdata);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function initializes applications */
|
||||
static void
|
||||
apps_init(void)
|
||||
{
|
||||
#if LWIP_DNS_APP && LWIP_DNS
|
||||
/* wait until the netif is up (for dhcp, autoip or ppp) */
|
||||
sys_timeout(5000, dns_dorequest, NULL);
|
||||
#endif /* LWIP_DNS_APP && LWIP_DNS */
|
||||
|
||||
#if LWIP_CHARGEN_APP && LWIP_SOCKET
|
||||
chargen_init();
|
||||
#endif /* LWIP_CHARGEN_APP && LWIP_SOCKET */
|
||||
|
||||
#if LWIP_PING_APP && LWIP_RAW && LWIP_ICMP
|
||||
ping_init(&netif.gw);
|
||||
#endif /* LWIP_PING_APP && LWIP_RAW && LWIP_ICMP */
|
||||
|
||||
#if LWIP_NETBIOS_APP && LWIP_UDP
|
||||
netbiosns_init();
|
||||
#ifndef NETBIOS_LWIP_NAME
|
||||
#if LWIP_NETIF_HOSTNAME
|
||||
netbiosns_set_name(netif_default->hostname);
|
||||
#else
|
||||
netbiosns_set_name("NETBIOSLWIPDEV");
|
||||
#endif
|
||||
#endif
|
||||
#endif /* LWIP_NETBIOS_APP && LWIP_UDP */
|
||||
|
||||
#if LWIP_HTTPD_APP && LWIP_TCP
|
||||
#ifdef LWIP_HTTPD_APP_NETCONN
|
||||
http_server_netconn_init();
|
||||
#else /* LWIP_HTTPD_APP_NETCONN */
|
||||
httpd_init();
|
||||
#endif /* LWIP_HTTPD_APP_NETCONN */
|
||||
#endif /* LWIP_HTTPD_APP && LWIP_TCP */
|
||||
|
||||
#if LWIP_MDNS_RESPONDER
|
||||
mdns_resp_init();
|
||||
#if LWIP_NETIF_HOSTNAME
|
||||
mdns_resp_add_netif(netif_default, netif_default->hostname, 3600);
|
||||
#else
|
||||
mdns_resp_add_netif(netif_default, "lwip", 3600);
|
||||
#endif
|
||||
mdns_resp_add_service(netif_default, "lwipweb", "_http", DNSSD_PROTO_TCP, HTTPD_SERVER_PORT, 3600, srv_txt, NULL);
|
||||
#endif
|
||||
|
||||
#if LWIP_NETIO_APP && LWIP_TCP
|
||||
netio_init();
|
||||
#endif /* LWIP_NETIO_APP && LWIP_TCP */
|
||||
|
||||
#if LWIP_RTP_APP && LWIP_SOCKET && LWIP_IGMP
|
||||
rtp_init();
|
||||
#endif /* LWIP_RTP_APP && LWIP_SOCKET && LWIP_IGMP */
|
||||
|
||||
#if LWIP_SNTP_APP
|
||||
sntp_init();
|
||||
#endif /* LWIP_SNTP_APP */
|
||||
|
||||
#if LWIP_SHELL_APP && LWIP_NETCONN
|
||||
shell_init();
|
||||
#endif /* LWIP_SHELL_APP && LWIP_NETCONN */
|
||||
#if LWIP_TCPECHO_APP
|
||||
#if LWIP_NETCONN && defined(LWIP_TCPECHO_APP_NETCONN)
|
||||
tcpecho_init();
|
||||
#else /* LWIP_NETCONN && defined(LWIP_TCPECHO_APP_NETCONN) */
|
||||
tcpecho_raw_init();
|
||||
#endif
|
||||
#endif /* LWIP_TCPECHO_APP && LWIP_NETCONN */
|
||||
#if LWIP_UDPECHO_APP && LWIP_NETCONN
|
||||
udpecho_init();
|
||||
#endif /* LWIP_UDPECHO_APP && LWIP_NETCONN */
|
||||
#if LWIP_LWIPERF_APP
|
||||
lwiperf_start_tcp_server_default(lwiperf_report, NULL);
|
||||
#endif
|
||||
#if LWIP_SOCKET_EXAMPLES_APP && LWIP_SOCKET
|
||||
socket_examples_init();
|
||||
#endif /* LWIP_SOCKET_EXAMPLES_APP && LWIP_SOCKET */
|
||||
#if LWIP_SNMP && LWIP_UDP
|
||||
#if LWIP_SNMP_V3
|
||||
snmpv3_dummy_init();
|
||||
#endif
|
||||
snmp_init();
|
||||
#endif /* LWIP_SNMP && LWIP_UDP */
|
||||
#ifdef LWIP_APP_INIT
|
||||
LWIP_APP_INIT();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This function initializes this lwIP test. When NO_SYS=1, this is done in
|
||||
* the main_loop context (there is no other one), when NO_SYS=0, this is done
|
||||
* in the tcpip_thread context */
|
||||
static void
|
||||
test_init(void * arg)
|
||||
{ /* remove compiler warning */
|
||||
#if NO_SYS
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
#else /* NO_SYS */
|
||||
sys_sem_t *init_sem;
|
||||
LWIP_ASSERT("arg != NULL", arg != NULL);
|
||||
init_sem = (sys_sem_t*)arg;
|
||||
#endif /* NO_SYS */
|
||||
|
||||
/* init randomizer again (seed per thread) */
|
||||
srand((unsigned int)time(0));
|
||||
|
||||
/* init network interfaces */
|
||||
msvc_netif_init();
|
||||
|
||||
/* init apps */
|
||||
apps_init();
|
||||
|
||||
#if !NO_SYS
|
||||
sys_sem_signal(init_sem);
|
||||
#endif /* !NO_SYS */
|
||||
}
|
||||
|
||||
/* This is somewhat different to other ports: we have a main loop here:
|
||||
* a dedicated task that waits for packets to arrive. This would normally be
|
||||
* done from interrupt context with embedded hardware, but we don't get an
|
||||
* interrupt in windows for that :-) */
|
||||
static void
|
||||
main_loop(void)
|
||||
{
|
||||
#if !NO_SYS
|
||||
err_t err;
|
||||
sys_sem_t init_sem;
|
||||
#endif /* NO_SYS */
|
||||
#if USE_PPP
|
||||
#if !USE_ETHERNET
|
||||
int count;
|
||||
u8_t rxbuf[1024];
|
||||
#endif
|
||||
volatile int callClosePpp = 0;
|
||||
#endif /* USE_PPP */
|
||||
|
||||
/* initialize lwIP stack, network interfaces and applications */
|
||||
#if NO_SYS
|
||||
lwip_init();
|
||||
test_init(NULL);
|
||||
#else /* NO_SYS */
|
||||
err = sys_sem_new(&init_sem, 0);
|
||||
LWIP_ASSERT("failed to create init_sem", err == ERR_OK);
|
||||
LWIP_UNUSED_ARG(err);
|
||||
tcpip_init(test_init, &init_sem);
|
||||
/* we have to wait for initialization to finish before
|
||||
* calling update_adapter()! */
|
||||
sys_sem_wait(&init_sem);
|
||||
sys_sem_free(&init_sem);
|
||||
#endif /* NO_SYS */
|
||||
|
||||
#if (LWIP_SOCKET || LWIP_NETCONN) && LWIP_NETCONN_SEM_PER_THREAD
|
||||
netconn_thread_init();
|
||||
#endif
|
||||
|
||||
/* MAIN LOOP for driver update (and timers if NO_SYS) */
|
||||
while (!lwip_win32_keypressed()) {
|
||||
#if NO_SYS
|
||||
/* handle timers (already done in tcpip.c when NO_SYS=0) */
|
||||
sys_check_timeouts();
|
||||
#endif /* NO_SYS */
|
||||
|
||||
#if USE_ETHERNET
|
||||
#if !PCAPIF_RX_USE_THREAD
|
||||
/* check for packets and link status*/
|
||||
pcapif_poll(&netif);
|
||||
/* When pcapif_poll comes back, there are not packets, so sleep to
|
||||
prevent 100% CPU load. Don't do this in an embedded system since it
|
||||
increases latency! */
|
||||
sys_msleep(1);
|
||||
#else /* !PCAPIF_RX_USE_THREAD */
|
||||
sys_msleep(50);
|
||||
#endif /* !PCAPIF_RX_USE_THREAD */
|
||||
#else /* USE_ETHERNET */
|
||||
/* try to read characters from serial line and pass them to PPPoS */
|
||||
count = sio_read(ppp_sio, (u8_t*)rxbuf, 1024);
|
||||
if(count > 0) {
|
||||
pppos_input(ppp, rxbuf, count);
|
||||
} else {
|
||||
/* nothing received, give other tasks a chance to run */
|
||||
sys_msleep(1);
|
||||
}
|
||||
|
||||
#endif /* USE_ETHERNET */
|
||||
#if USE_SLIPIF
|
||||
slipif_poll(&slipif1);
|
||||
#if USE_SLIPIF > 1
|
||||
slipif_poll(&slipif2);
|
||||
#endif /* USE_SLIPIF > 1 */
|
||||
#endif /* USE_SLIPIF */
|
||||
#if ENABLE_LOOPBACK && !LWIP_NETIF_LOOPBACK_MULTITHREADING
|
||||
/* check for loopback packets on all netifs */
|
||||
netif_poll_all();
|
||||
#endif /* ENABLE_LOOPBACK && !LWIP_NETIF_LOOPBACK_MULTITHREADING */
|
||||
#if USE_PPP
|
||||
{
|
||||
int do_hup = 0;
|
||||
if(do_hup) {
|
||||
ppp_close(ppp, 1);
|
||||
do_hup = 0;
|
||||
}
|
||||
}
|
||||
if(callClosePpp && ppp) {
|
||||
/* make sure to disconnect PPP before stopping the program... */
|
||||
callClosePpp = 0;
|
||||
#if NO_SYS
|
||||
ppp_close(ppp, 0);
|
||||
#else
|
||||
pppapi_close(ppp, 0);
|
||||
#endif
|
||||
ppp = NULL;
|
||||
}
|
||||
#endif /* USE_PPP */
|
||||
}
|
||||
|
||||
#if USE_PPP
|
||||
if(ppp) {
|
||||
u32_t started;
|
||||
printf("Closing PPP connection...\n");
|
||||
/* make sure to disconnect PPP before stopping the program... */
|
||||
#if NO_SYS
|
||||
ppp_close(ppp, 0);
|
||||
#else
|
||||
pppapi_close(ppp, 0);
|
||||
#endif
|
||||
ppp = NULL;
|
||||
/* Wait for some time to let PPP finish... */
|
||||
started = sys_now();
|
||||
do
|
||||
{
|
||||
#if USE_ETHERNET && !PCAPIF_RX_USE_THREAD
|
||||
pcapif_poll(&netif);
|
||||
#else /* USE_ETHERNET && !PCAPIF_RX_USE_THREAD */
|
||||
sys_msleep(50);
|
||||
#endif /* USE_ETHERNET && !PCAPIF_RX_USE_THREAD */
|
||||
/* @todo: need a better check here: only wait until PPP is down */
|
||||
} while(sys_now() - started < 5000);
|
||||
}
|
||||
#endif /* USE_PPP */
|
||||
#if (LWIP_SOCKET || LWIP_NETCONN) && LWIP_NETCONN_SEM_PER_THREAD
|
||||
netconn_thread_cleanup();
|
||||
#endif
|
||||
#if USE_ETHERNET
|
||||
/* release the pcap library... */
|
||||
pcapif_shutdown(&netif);
|
||||
#endif /* USE_ETHERNET */
|
||||
}
|
||||
|
||||
#if USE_PPP && PPPOS_SUPPORT
|
||||
int main(int argc, char **argv)
|
||||
#else /* USE_PPP && PPPOS_SUPPORT */
|
||||
int main(void)
|
||||
#endif /* USE_PPP && PPPOS_SUPPORT */
|
||||
{
|
||||
#if USE_PPP && PPPOS_SUPPORT
|
||||
if(argc > 1) {
|
||||
sio_idx = (u8_t)atoi(argv[1]);
|
||||
}
|
||||
printf("Using serial port %d for PPP\n", sio_idx);
|
||||
#endif /* USE_PPP && PPPOS_SUPPORT */
|
||||
/* no stdio-buffering, please! */
|
||||
setvbuf(stdout, NULL,_IONBF, 0);
|
||||
|
||||
main_loop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
13
ext/lwip.patch
Normal file
13
ext/lwip.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index b7632489..f6ab59f6 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -44,6 +44,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
+#include <errno.h>
|
||||
+
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */
|
||||
@@ -1,9 +0,0 @@
|
||||
lwIP is licenced under the BSD licence:
|
||||
|
||||
Copyright (c) 2001-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. 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.
|
||||
@@ -1,15 +0,0 @@
|
||||
api/ - The code for the high-level wrapper API. Not needed if
|
||||
you use the lowel-level call-back/raw API.
|
||||
|
||||
apps/ - Higher layer applications that are specifically programmed
|
||||
with the lwIP low-level raw API.
|
||||
|
||||
core/ - The core of the TPC/IP stack; protocol implementations,
|
||||
memory and buffer management, and the low-level raw API.
|
||||
|
||||
include/ - lwIP include files.
|
||||
|
||||
netif/ - Generic network interface device drivers are kept here.
|
||||
|
||||
For more information on the various subdirectories, check the FILES
|
||||
file in each directory.
|
||||
@@ -1,181 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2001, 2002 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>
|
||||
#
|
||||
|
||||
# COREFILES, CORE4FILES: The minimum set of files needed for lwIP.
|
||||
COREFILES=$(LWIPDIR)/core/init.c \
|
||||
$(LWIPDIR)/core/def.c \
|
||||
$(LWIPDIR)/core/dns.c \
|
||||
$(LWIPDIR)/core/inet_chksum.c \
|
||||
$(LWIPDIR)/core/ip.c \
|
||||
$(LWIPDIR)/core/mem.c \
|
||||
$(LWIPDIR)/core/memp.c \
|
||||
$(LWIPDIR)/core/netif.c \
|
||||
$(LWIPDIR)/core/pbuf.c \
|
||||
$(LWIPDIR)/core/raw.c \
|
||||
$(LWIPDIR)/core/stats.c \
|
||||
$(LWIPDIR)/core/sys.c \
|
||||
$(LWIPDIR)/core/tcp.c \
|
||||
$(LWIPDIR)/core/tcp_in.c \
|
||||
$(LWIPDIR)/core/tcp_out.c \
|
||||
$(LWIPDIR)/core/timeouts.c \
|
||||
$(LWIPDIR)/core/udp.c
|
||||
|
||||
CORE4FILES=$(LWIPDIR)/core/ipv4/autoip.c \
|
||||
$(LWIPDIR)/core/ipv4/dhcp.c \
|
||||
$(LWIPDIR)/core/ipv4/etharp.c \
|
||||
$(LWIPDIR)/core/ipv4/icmp.c \
|
||||
$(LWIPDIR)/core/ipv4/igmp.c \
|
||||
$(LWIPDIR)/core/ipv4/ip4_frag.c \
|
||||
$(LWIPDIR)/core/ipv4/ip4.c \
|
||||
$(LWIPDIR)/core/ipv4/ip4_addr.c
|
||||
|
||||
CORE6FILES=$(LWIPDIR)/core/ipv6/dhcp6.c \
|
||||
$(LWIPDIR)/core/ipv6/ethip6.c \
|
||||
$(LWIPDIR)/core/ipv6/icmp6.c \
|
||||
$(LWIPDIR)/core/ipv6/inet6.c \
|
||||
$(LWIPDIR)/core/ipv6/ip6.c \
|
||||
$(LWIPDIR)/core/ipv6/ip6_addr.c \
|
||||
$(LWIPDIR)/core/ipv6/ip6_frag.c \
|
||||
$(LWIPDIR)/core/ipv6/mld6.c \
|
||||
$(LWIPDIR)/core/ipv6/nd6.c
|
||||
|
||||
# APIFILES: The files which implement the sequential and socket APIs.
|
||||
APIFILES=$(LWIPDIR)/api/api_lib.c \
|
||||
$(LWIPDIR)/api/api_msg.c \
|
||||
$(LWIPDIR)/api/err.c \
|
||||
$(LWIPDIR)/api/netbuf.c \
|
||||
$(LWIPDIR)/api/netdb.c \
|
||||
$(LWIPDIR)/api/netifapi.c \
|
||||
$(LWIPDIR)/api/sockets.c \
|
||||
$(LWIPDIR)/api/tcpip.c
|
||||
|
||||
# NETIFFILES: Files implementing various generic network interface functions
|
||||
NETIFFILES=$(LWIPDIR)/netif/ethernet.c
|
||||
#\ $(LWIPDIR)/netif/slipif.c
|
||||
|
||||
# SIXLOWPAN: 6LoWPAN
|
||||
SIXLOWPAN=$(LWIPDIR)/netif/lowpan6.c \
|
||||
|
||||
# PPPFILES: PPP
|
||||
PPPFILES=$(LWIPDIR)/netif/ppp/auth.c \
|
||||
$(LWIPDIR)/netif/ppp/ccp.c \
|
||||
$(LWIPDIR)/netif/ppp/chap-md5.c \
|
||||
$(LWIPDIR)/netif/ppp/chap_ms.c \
|
||||
$(LWIPDIR)/netif/ppp/chap-new.c \
|
||||
$(LWIPDIR)/netif/ppp/demand.c \
|
||||
$(LWIPDIR)/netif/ppp/eap.c \
|
||||
$(LWIPDIR)/netif/ppp/ecp.c \
|
||||
$(LWIPDIR)/netif/ppp/eui64.c \
|
||||
$(LWIPDIR)/netif/ppp/fsm.c \
|
||||
$(LWIPDIR)/netif/ppp/ipcp.c \
|
||||
$(LWIPDIR)/netif/ppp/ipv6cp.c \
|
||||
$(LWIPDIR)/netif/ppp/lcp.c \
|
||||
$(LWIPDIR)/netif/ppp/magic.c \
|
||||
$(LWIPDIR)/netif/ppp/mppe.c \
|
||||
$(LWIPDIR)/netif/ppp/multilink.c \
|
||||
$(LWIPDIR)/netif/ppp/ppp.c \
|
||||
$(LWIPDIR)/netif/ppp/pppapi.c \
|
||||
$(LWIPDIR)/netif/ppp/pppcrypt.c \
|
||||
$(LWIPDIR)/netif/ppp/pppoe.c \
|
||||
$(LWIPDIR)/netif/ppp/pppol2tp.c \
|
||||
$(LWIPDIR)/netif/ppp/pppos.c \
|
||||
$(LWIPDIR)/netif/ppp/upap.c \
|
||||
$(LWIPDIR)/netif/ppp/utils.c \
|
||||
$(LWIPDIR)/netif/ppp/vj.c \
|
||||
$(LWIPDIR)/netif/ppp/polarssl/arc4.c \
|
||||
$(LWIPDIR)/netif/ppp/polarssl/des.c \
|
||||
$(LWIPDIR)/netif/ppp/polarssl/md4.c \
|
||||
$(LWIPDIR)/netif/ppp/polarssl/md5.c \
|
||||
$(LWIPDIR)/netif/ppp/polarssl/sha1.c
|
||||
|
||||
# LWIPNOAPPSFILES: All LWIP files without apps
|
||||
LWIPNOAPPSFILES=$(COREFILES) \
|
||||
$(CORE4FILES) \
|
||||
$(CORE6FILES) \
|
||||
$(APIFILES) \
|
||||
$(NETIFFILES) \
|
||||
$(SIXLOWPAN)
|
||||
# $(PPPFILES)
|
||||
|
||||
# SNMPFILES: SNMPv2c agent
|
||||
SNMPFILES=$(LWIPDIR)/apps/snmp/snmp_asn1.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_core.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_mib2.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_mib2_icmp.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_mib2_interfaces.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_mib2_ip.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_mib2_snmp.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_mib2_system.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_mib2_tcp.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_mib2_udp.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_msg.c \
|
||||
$(LWIPDIR)/apps/snmp/snmpv3.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_netconn.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_pbuf_stream.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_raw.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_scalar.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_table.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_threadsync.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_traps.c \
|
||||
$(LWIPDIR)/apps/snmp/snmpv3_mbedtls.c \
|
||||
$(LWIPDIR)/apps/snmp/snmpv3_dummy.c
|
||||
|
||||
# HTTPDFILES: HTTP server
|
||||
HTTPDFILES=$(LWIPDIR)/apps/httpd/fs.c \
|
||||
$(LWIPDIR)/apps/httpd/httpd.c
|
||||
|
||||
# LWIPERFFILES: IPERF server
|
||||
LWIPERFFILES=$(LWIPDIR)/apps/lwiperf/lwiperf.c
|
||||
|
||||
# SNTPFILES: SNTP client
|
||||
SNTPFILES=$(LWIPDIR)/apps/sntp/sntp.c
|
||||
|
||||
# MDNSFILES: MDNS responder
|
||||
MDNSFILES=$(LWIPDIR)/apps/mdns/mdns.c
|
||||
|
||||
# NETBIOSNSFILES: NetBIOS name server
|
||||
NETBIOSNSFILES=$(LWIPDIR)/apps/netbiosns/netbiosns.c
|
||||
|
||||
# TFTPFILES: TFTP server files
|
||||
TFTPFILES=$(LWIPDIR)/apps/tftp/tftp_server.c
|
||||
|
||||
# MQTTFILES: MQTT client files
|
||||
MQTTFILES=$(LWIPDIR)/apps/mqtt/mqtt.c
|
||||
|
||||
# LWIPAPPFILES: All LWIP APPs
|
||||
LWIPAPPFILES=$(SNMPFILES) \
|
||||
$(HTTPDFILES) \
|
||||
$(LWIPERFFILES) \
|
||||
$(SNTPFILES) \
|
||||
$(MDNSFILES) \
|
||||
$(NETBIOSNSFILES) \
|
||||
$(TFTPFILES) \
|
||||
$(MQTTFILES)
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,115 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
* Error Management module
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-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. 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>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/err.h"
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/sys.h"
|
||||
|
||||
#include "errno.h"
|
||||
|
||||
#if !NO_SYS
|
||||
/** Table to quickly map an lwIP error (err_t) to a socket error
|
||||
* by using -err as an index */
|
||||
static const int err_to_errno_table[] = {
|
||||
0, /* ERR_OK 0 No error, everything OK. */
|
||||
ENOMEM, /* ERR_MEM -1 Out of memory error. */
|
||||
ENOBUFS, /* ERR_BUF -2 Buffer error. */
|
||||
EWOULDBLOCK, /* ERR_TIMEOUT -3 Timeout */
|
||||
EHOSTUNREACH, /* ERR_RTE -4 Routing problem. */
|
||||
EINPROGRESS, /* ERR_INPROGRESS -5 Operation in progress */
|
||||
EINVAL, /* ERR_VAL -6 Illegal value. */
|
||||
EWOULDBLOCK, /* ERR_WOULDBLOCK -7 Operation would block. */
|
||||
EADDRINUSE, /* ERR_USE -8 Address in use. */
|
||||
EALREADY, /* ERR_ALREADY -9 Already connecting. */
|
||||
EISCONN, /* ERR_ISCONN -10 Conn already established.*/
|
||||
ENOTCONN, /* ERR_CONN -11 Not connected. */
|
||||
-1, /* ERR_IF -12 Low-level netif error */
|
||||
ECONNABORTED, /* ERR_ABRT -13 Connection aborted. */
|
||||
ECONNRESET, /* ERR_RST -14 Connection reset. */
|
||||
ENOTCONN, /* ERR_CLSD -15 Connection closed. */
|
||||
EIO /* ERR_ARG -16 Illegal argument. */
|
||||
};
|
||||
|
||||
int
|
||||
err_to_errno(err_t err)
|
||||
{
|
||||
if ((err > 0) || (-err >= (err_t)LWIP_ARRAYSIZE(err_to_errno_table))) {
|
||||
return EIO;
|
||||
}
|
||||
return err_to_errno_table[-err];
|
||||
}
|
||||
#endif /* !NO_SYS */
|
||||
|
||||
#ifdef LWIP_DEBUG
|
||||
|
||||
static const char *err_strerr[] = {
|
||||
"Ok.", /* ERR_OK 0 */
|
||||
"Out of memory error.", /* ERR_MEM -1 */
|
||||
"Buffer error.", /* ERR_BUF -2 */
|
||||
"Timeout.", /* ERR_TIMEOUT -3 */
|
||||
"Routing problem.", /* ERR_RTE -4 */
|
||||
"Operation in progress.", /* ERR_INPROGRESS -5 */
|
||||
"Illegal value.", /* ERR_VAL -6 */
|
||||
"Operation would block.", /* ERR_WOULDBLOCK -7 */
|
||||
"Address in use.", /* ERR_USE -8 */
|
||||
"Already connecting.", /* ERR_ALREADY -9 */
|
||||
"Already connected.", /* ERR_ISCONN -10 */
|
||||
"Not connected.", /* ERR_CONN -11 */
|
||||
"Low-level netif error.", /* ERR_IF -12 */
|
||||
"Connection aborted.", /* ERR_ABRT -13 */
|
||||
"Connection reset.", /* ERR_RST -14 */
|
||||
"Connection closed.", /* ERR_CLSD -15 */
|
||||
"Illegal argument." /* ERR_ARG -16 */
|
||||
};
|
||||
|
||||
/**
|
||||
* Convert an lwip internal error to a string representation.
|
||||
*
|
||||
* @param err an lwip internal err_t
|
||||
* @return a string representation for err
|
||||
*/
|
||||
const char *
|
||||
lwip_strerr(err_t err)
|
||||
{
|
||||
if ((err > 0) || (-err >= (err_t)LWIP_ARRAYSIZE(err_strerr))) {
|
||||
return "Unknown error.";
|
||||
}
|
||||
return err_strerr[-err];
|
||||
}
|
||||
|
||||
#endif /* LWIP_DEBUG */
|
||||
@@ -1,246 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
* Network buffer management
|
||||
*
|
||||
* @defgroup netbuf Network buffers
|
||||
* @ingroup netconn
|
||||
* Network buffer descriptor for @ref netconn. Based on @ref pbuf internally
|
||||
* to avoid copying data around.\n
|
||||
* Buffers must not be shared accross multiple threads, all functions except
|
||||
* netbuf_new() and netbuf_delete() are not thread-safe.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-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. 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>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */
|
||||
|
||||
#include "lwip/netbuf.h"
|
||||
#include "lwip/memp.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* @ingroup netbuf
|
||||
* Create (allocate) and initialize a new netbuf.
|
||||
* The netbuf doesn't yet contain a packet buffer!
|
||||
*
|
||||
* @return a pointer to a new netbuf
|
||||
* NULL on lack of memory
|
||||
*/
|
||||
struct
|
||||
netbuf *netbuf_new(void)
|
||||
{
|
||||
struct netbuf *buf;
|
||||
|
||||
buf = (struct netbuf *)memp_malloc(MEMP_NETBUF);
|
||||
if (buf != NULL) {
|
||||
memset(buf, 0, sizeof(struct netbuf));
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup netbuf
|
||||
* Deallocate a netbuf allocated by netbuf_new().
|
||||
*
|
||||
* @param buf pointer to a netbuf allocated by netbuf_new()
|
||||
*/
|
||||
void
|
||||
netbuf_delete(struct netbuf *buf)
|
||||
{
|
||||
if (buf != NULL) {
|
||||
if (buf->p != NULL) {
|
||||
pbuf_free(buf->p);
|
||||
buf->p = buf->ptr = NULL;
|
||||
}
|
||||
memp_free(MEMP_NETBUF, buf);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup netbuf
|
||||
* Allocate memory for a packet buffer for a given netbuf.
|
||||
*
|
||||
* @param buf the netbuf for which to allocate a packet buffer
|
||||
* @param size the size of the packet buffer to allocate
|
||||
* @return pointer to the allocated memory
|
||||
* NULL if no memory could be allocated
|
||||
*/
|
||||
void *
|
||||
netbuf_alloc(struct netbuf *buf, u16_t size)
|
||||
{
|
||||
LWIP_ERROR("netbuf_alloc: invalid buf", (buf != NULL), return NULL;);
|
||||
|
||||
/* Deallocate any previously allocated memory. */
|
||||
if (buf->p != NULL) {
|
||||
pbuf_free(buf->p);
|
||||
}
|
||||
buf->p = pbuf_alloc(PBUF_TRANSPORT, size, PBUF_RAM);
|
||||
if (buf->p == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
LWIP_ASSERT("check that first pbuf can hold size",
|
||||
(buf->p->len >= size));
|
||||
buf->ptr = buf->p;
|
||||
return buf->p->payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup netbuf
|
||||
* Free the packet buffer included in a netbuf
|
||||
*
|
||||
* @param buf pointer to the netbuf which contains the packet buffer to free
|
||||
*/
|
||||
void
|
||||
netbuf_free(struct netbuf *buf)
|
||||
{
|
||||
LWIP_ERROR("netbuf_free: invalid buf", (buf != NULL), return;);
|
||||
if (buf->p != NULL) {
|
||||
pbuf_free(buf->p);
|
||||
}
|
||||
buf->p = buf->ptr = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup netbuf
|
||||
* Let a netbuf reference existing (non-volatile) data.
|
||||
*
|
||||
* @param buf netbuf which should reference the data
|
||||
* @param dataptr pointer to the data to reference
|
||||
* @param size size of the data
|
||||
* @return ERR_OK if data is referenced
|
||||
* ERR_MEM if data couldn't be referenced due to lack of memory
|
||||
*/
|
||||
err_t
|
||||
netbuf_ref(struct netbuf *buf, const void *dataptr, u16_t size)
|
||||
{
|
||||
LWIP_ERROR("netbuf_ref: invalid buf", (buf != NULL), return ERR_ARG;);
|
||||
if (buf->p != NULL) {
|
||||
pbuf_free(buf->p);
|
||||
}
|
||||
buf->p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_REF);
|
||||
if (buf->p == NULL) {
|
||||
buf->ptr = NULL;
|
||||
return ERR_MEM;
|
||||
}
|
||||
((struct pbuf_rom*)buf->p)->payload = dataptr;
|
||||
buf->p->len = buf->p->tot_len = size;
|
||||
buf->ptr = buf->p;
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup netbuf
|
||||
* Chain one netbuf to another (@see pbuf_chain)
|
||||
*
|
||||
* @param head the first netbuf
|
||||
* @param tail netbuf to chain after head, freed by this function, may not be reference after returning
|
||||
*/
|
||||
void
|
||||
netbuf_chain(struct netbuf *head, struct netbuf *tail)
|
||||
{
|
||||
LWIP_ERROR("netbuf_chain: invalid head", (head != NULL), return;);
|
||||
LWIP_ERROR("netbuf_chain: invalid tail", (tail != NULL), return;);
|
||||
pbuf_cat(head->p, tail->p);
|
||||
head->ptr = head->p;
|
||||
memp_free(MEMP_NETBUF, tail);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup netbuf
|
||||
* Get the data pointer and length of the data inside a netbuf.
|
||||
*
|
||||
* @param buf netbuf to get the data from
|
||||
* @param dataptr pointer to a void pointer where to store the data pointer
|
||||
* @param len pointer to an u16_t where the length of the data is stored
|
||||
* @return ERR_OK if the information was retrieved,
|
||||
* ERR_BUF on error.
|
||||
*/
|
||||
err_t
|
||||
netbuf_data(struct netbuf *buf, void **dataptr, u16_t *len)
|
||||
{
|
||||
LWIP_ERROR("netbuf_data: invalid buf", (buf != NULL), return ERR_ARG;);
|
||||
LWIP_ERROR("netbuf_data: invalid dataptr", (dataptr != NULL), return ERR_ARG;);
|
||||
LWIP_ERROR("netbuf_data: invalid len", (len != NULL), return ERR_ARG;);
|
||||
|
||||
if (buf->ptr == NULL) {
|
||||
return ERR_BUF;
|
||||
}
|
||||
*dataptr = buf->ptr->payload;
|
||||
*len = buf->ptr->len;
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup netbuf
|
||||
* Move the current data pointer of a packet buffer contained in a netbuf
|
||||
* to the next part.
|
||||
* The packet buffer itself is not modified.
|
||||
*
|
||||
* @param buf the netbuf to modify
|
||||
* @return -1 if there is no next part
|
||||
* 1 if moved to the next part but now there is no next part
|
||||
* 0 if moved to the next part and there are still more parts
|
||||
*/
|
||||
s8_t
|
||||
netbuf_next(struct netbuf *buf)
|
||||
{
|
||||
LWIP_ERROR("netbuf_next: invalid buf", (buf != NULL), return -1;);
|
||||
if (buf->ptr->next == NULL) {
|
||||
return -1;
|
||||
}
|
||||
buf->ptr = buf->ptr->next;
|
||||
if (buf->ptr->next == NULL) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup netbuf
|
||||
* Move the current data pointer of a packet buffer contained in a netbuf
|
||||
* to the beginning of the packet.
|
||||
* The packet buffer itself is not modified.
|
||||
*
|
||||
* @param buf the netbuf to modify
|
||||
*/
|
||||
void
|
||||
netbuf_first(struct netbuf *buf)
|
||||
{
|
||||
LWIP_ERROR("netbuf_first: invalid buf", (buf != NULL), return;);
|
||||
buf->ptr = buf->p;
|
||||
}
|
||||
|
||||
#endif /* LWIP_NETCONN */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user