初始化版本
This commit is contained in:
128
lwip/lwip-2.2.1/contrib/ports/CMakeCommon.cmake
Normal file
128
lwip/lwip-2.2.1/contrib/ports/CMakeCommon.cmake
Normal file
@ -0,0 +1,128 @@
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0")
|
||||
include_guard(GLOBAL)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
message(STATUS "CMAKE_BUILD_TYPE not set - defaulting to Debug build.")
|
||||
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build, options are: ${CMAKE_CONFIGURATION_TYPES}." FORCE)
|
||||
endif()
|
||||
message (STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
set(LWIP_CONTRIB_DIR ${LWIP_DIR}/contrib)
|
||||
|
||||
# ARM mbedtls support https://tls.mbed.org/
|
||||
if(NOT DEFINED LWIP_MBEDTLSDIR)
|
||||
set(LWIP_MBEDTLSDIR ${LWIP_DIR}/../mbedtls)
|
||||
message(STATUS "LWIP_MBEDTLSDIR not set - using default location ${LWIP_MBEDTLSDIR}")
|
||||
endif()
|
||||
if(EXISTS ${LWIP_MBEDTLSDIR}/CMakeLists.txt)
|
||||
set(LWIP_HAVE_MBEDTLS ON BOOL)
|
||||
|
||||
# Prevent building MBEDTLS programs and tests
|
||||
set(ENABLE_PROGRAMS OFF CACHE BOOL "")
|
||||
set(ENABLE_TESTING OFF CACHE BOOL "")
|
||||
|
||||
# mbedtls uses cmake. Sweet!
|
||||
add_subdirectory(${LWIP_MBEDTLSDIR} mbedtls)
|
||||
|
||||
set (LWIP_MBEDTLS_DEFINITIONS
|
||||
LWIP_HAVE_MBEDTLS=1
|
||||
)
|
||||
set (LWIP_MBEDTLS_INCLUDE_DIRS
|
||||
${LWIP_MBEDTLSDIR}/include
|
||||
)
|
||||
set (LWIP_MBEDTLS_LINK_LIBRARIES
|
||||
mbedtls
|
||||
mbedcrypto
|
||||
mbedx509
|
||||
)
|
||||
endif()
|
||||
|
||||
set(LWIP_COMPILER_FLAGS_GNU_CLANG
|
||||
$<$<CONFIG:Debug>:-Og>
|
||||
$<$<CONFIG:Debug>:-g>
|
||||
$<$<CONFIG:Release>:-O3>
|
||||
-Wall
|
||||
-pedantic
|
||||
-Werror
|
||||
-Wparentheses
|
||||
-Wsequence-point
|
||||
-Wswitch-default
|
||||
-Wextra
|
||||
-Wundef
|
||||
-Wshadow
|
||||
-Wpointer-arith
|
||||
-Wcast-qual
|
||||
-Wwrite-strings
|
||||
$<$<COMPILE_LANGUAGE:C>:-Wold-style-definition>
|
||||
-Wcast-align
|
||||
$<$<COMPILE_LANGUAGE:C>:-Wmissing-prototypes>
|
||||
$<$<COMPILE_LANGUAGE:C>:-Wnested-externs>
|
||||
-Wunreachable-code
|
||||
-Wuninitialized
|
||||
-Wmissing-prototypes
|
||||
-Waggregate-return
|
||||
-Wlogical-not-parentheses
|
||||
)
|
||||
|
||||
if (NOT LWIP_HAVE_MBEDTLS)
|
||||
list(APPEND LWIP_COMPILER_FLAGS_GNU_CLANG
|
||||
-Wredundant-decls
|
||||
$<$<COMPILE_LANGUAGE:C>:-Wc++-compat>
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
list(APPEND LWIP_COMPILER_FLAGS_GNU_CLANG
|
||||
-Wlogical-op
|
||||
-Wtrampolines
|
||||
)
|
||||
|
||||
if (NOT LWIP_HAVE_MBEDTLS)
|
||||
list(APPEND LWIP_COMPILER_FLAGS_GNU_CLANG
|
||||
$<$<COMPILE_LANGUAGE:C>:-Wc90-c99-compat>
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)
|
||||
if(LWIP_USE_SANITIZERS)
|
||||
list(APPEND LWIP_COMPILER_FLAGS_GNU_CLANG
|
||||
-fsanitize=address
|
||||
-fsanitize=undefined
|
||||
-fno-sanitize=alignment
|
||||
-fstack-protector
|
||||
-fstack-check
|
||||
)
|
||||
set(LWIP_SANITIZER_LIBS asan ubsan)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(LWIP_COMPILER_FLAGS ${LWIP_COMPILER_FLAGS_GNU_CLANG})
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
list(APPEND LWIP_COMPILER_FLAGS_GNU_CLANG
|
||||
-Wdocumentation
|
||||
-Wno-documentation-deprecated-sync
|
||||
)
|
||||
|
||||
if(LWIP_USE_SANITIZERS)
|
||||
list(APPEND LWIP_COMPILER_FLAGS_GNU_CLANG
|
||||
-fsanitize=address
|
||||
-fsanitize=undefined
|
||||
-fno-sanitize=alignment
|
||||
)
|
||||
set(LWIP_SANITIZER_LIBS asan ubsan)
|
||||
endif()
|
||||
|
||||
set(LWIP_COMPILER_FLAGS ${LWIP_COMPILER_FLAGS_GNU_CLANG})
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
|
||||
set(LWIP_COMPILER_FLAGS
|
||||
$<$<CONFIG:Debug>:/Od>
|
||||
$<$<CONFIG:Release>:/Ox>
|
||||
/W4
|
||||
/WX
|
||||
)
|
||||
endif()
|
||||
91
lwip/lwip-2.2.1/contrib/ports/Common.allports.mk
Normal file
91
lwip/lwip-2.2.1/contrib/ports/Common.allports.mk
Normal file
@ -0,0 +1,91 @@
|
||||
#
|
||||
# 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 -DLWIP_DEBUG -Wall -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 -Wnested-externs \
|
||||
-Wunreachable-code -Wuninitialized -Wmissing-prototypes \
|
||||
-Wredundant-decls -Waggregate-return -Wlogical-not-parentheses
|
||||
# -Wconversion -Wsign-compare -Wmissing-include-dirs
|
||||
|
||||
ifeq (,$(findstring clang,$(CC)))
|
||||
CFLAGS+= -Wlogical-op -Wc90-c99-compat -Wtrampolines
|
||||
# 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
|
||||
|
||||
CONTRIBDIR?=../../..
|
||||
ARFLAGS?=rs
|
||||
|
||||
#Set this to where you have the lwip core module checked out from git
|
||||
#default assumes it's a dir above the contrib module
|
||||
LWIPDIR?=$(CONTRIBDIR)/..
|
||||
|
||||
CFLAGS+=-I. \
|
||||
-I$(CONTRIBDIR) \
|
||||
-I$(LWIPDIR)/include \
|
||||
-I$(LWIPARCH)/include
|
||||
|
||||
# Add include path and link to mbedTLS lib if available
|
||||
MBEDTLSDIR?=$(LWIPDIR)/../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 -Wno-c90-c99-compat
|
||||
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 $<
|
||||
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Simon Goldschmidt
|
||||
* 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: Simon Goldschmdit <goldsimon@gmx.de>
|
||||
*
|
||||
*/
|
||||
#ifndef LWIP_ARCH_SYS_ARCH_H
|
||||
#define LWIP_ARCH_SYS_ARCH_H
|
||||
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/arch.h"
|
||||
|
||||
/** This is returned by _fromisr() sys functions to tell the outermost function
|
||||
* that a higher priority task was woken and the scheduler needs to be invoked.
|
||||
*/
|
||||
#define ERR_NEED_SCHED 123
|
||||
|
||||
/* This port includes FreeRTOS headers in sys_arch.c only.
|
||||
* FreeRTOS uses pointers as object types. We use wrapper structs instead of
|
||||
* void pointers directly to get a tiny bit of type safety.
|
||||
*/
|
||||
|
||||
void sys_arch_msleep(u32_t delay_ms);
|
||||
#define sys_msleep(ms) sys_arch_msleep(ms)
|
||||
|
||||
#if SYS_LIGHTWEIGHT_PROT
|
||||
typedef u32_t sys_prot_t;
|
||||
#endif /* SYS_LIGHTWEIGHT_PROT */
|
||||
|
||||
#if !LWIP_COMPAT_MUTEX
|
||||
struct _sys_mut {
|
||||
void *mut;
|
||||
};
|
||||
typedef struct _sys_mut sys_mutex_t;
|
||||
#define sys_mutex_valid_val(mutex) ((mutex).mut != NULL)
|
||||
#define sys_mutex_valid(mutex) (((mutex) != NULL) && sys_mutex_valid_val(*(mutex)))
|
||||
#define sys_mutex_set_invalid(mutex) ((mutex)->mut = NULL)
|
||||
#endif /* !LWIP_COMPAT_MUTEX */
|
||||
|
||||
struct _sys_sem {
|
||||
void *sem;
|
||||
};
|
||||
typedef struct _sys_sem sys_sem_t;
|
||||
#define sys_sem_valid_val(sema) ((sema).sem != NULL)
|
||||
#define sys_sem_valid(sema) (((sema) != NULL) && sys_sem_valid_val(*(sema)))
|
||||
#define sys_sem_set_invalid(sema) ((sema)->sem = NULL)
|
||||
|
||||
struct _sys_mbox {
|
||||
void *mbx;
|
||||
};
|
||||
typedef struct _sys_mbox sys_mbox_t;
|
||||
#define sys_mbox_valid_val(mbox) ((mbox).mbx != NULL)
|
||||
#define sys_mbox_valid(mbox) (((mbox) != NULL) && sys_mbox_valid_val(*(mbox)))
|
||||
#define sys_mbox_set_invalid(mbox) ((mbox)->mbx = NULL)
|
||||
|
||||
struct _sys_thread {
|
||||
void *thread_handle;
|
||||
};
|
||||
typedef struct _sys_thread sys_thread_t;
|
||||
|
||||
#if LWIP_NETCONN_SEM_PER_THREAD
|
||||
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()
|
||||
#endif /* LWIP_NETCONN_SEM_PER_THREAD */
|
||||
|
||||
#endif /* LWIP_ARCH_SYS_ARCH_H */
|
||||
607
lwip/lwip-2.2.1/contrib/ports/freertos/sys_arch.c
Normal file
607
lwip/lwip-2.2.1/contrib/ports/freertos/sys_arch.c
Normal file
@ -0,0 +1,607 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Simon Goldschmidt
|
||||
* 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: Simon Goldschmidt <goldsimon@gmx.de>
|
||||
*
|
||||
*/
|
||||
|
||||
/* lwIP includes. */
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/stats.h"
|
||||
#include "lwip/tcpip.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "semphr.h"
|
||||
#include "task.h"
|
||||
|
||||
/** Set this to 1 if you want the stack size passed to sys_thread_new() to be
|
||||
* interpreted as number of stack words (FreeRTOS-like).
|
||||
* Default is that they are interpreted as byte count (lwIP-like).
|
||||
*/
|
||||
#ifndef LWIP_FREERTOS_THREAD_STACKSIZE_IS_STACKWORDS
|
||||
#define LWIP_FREERTOS_THREAD_STACKSIZE_IS_STACKWORDS 0
|
||||
#endif
|
||||
|
||||
/** Set this to 1 to use a mutex for SYS_ARCH_PROTECT() critical regions.
|
||||
* Default is 0 and locks interrupts/scheduler for SYS_ARCH_PROTECT().
|
||||
*/
|
||||
#ifndef LWIP_FREERTOS_SYS_ARCH_PROTECT_USES_MUTEX
|
||||
#define LWIP_FREERTOS_SYS_ARCH_PROTECT_USES_MUTEX 0
|
||||
#endif
|
||||
|
||||
/** Set this to 1 to include a sanity check that SYS_ARCH_PROTECT() and
|
||||
* SYS_ARCH_UNPROTECT() are called matching.
|
||||
*/
|
||||
#ifndef LWIP_FREERTOS_SYS_ARCH_PROTECT_SANITY_CHECK
|
||||
#define LWIP_FREERTOS_SYS_ARCH_PROTECT_SANITY_CHECK 0
|
||||
#endif
|
||||
|
||||
/** Set this to 1 to let sys_mbox_free check that queues are empty when freed */
|
||||
#ifndef LWIP_FREERTOS_CHECK_QUEUE_EMPTY_ON_FREE
|
||||
#define LWIP_FREERTOS_CHECK_QUEUE_EMPTY_ON_FREE 0
|
||||
#endif
|
||||
|
||||
/** Set this to 1 to enable core locking check functions in this port.
|
||||
* For this to work, you'll have to define LWIP_ASSERT_CORE_LOCKED()
|
||||
* and LWIP_MARK_TCPIP_THREAD() correctly in your lwipopts.h! */
|
||||
#ifndef LWIP_FREERTOS_CHECK_CORE_LOCKING
|
||||
#define LWIP_FREERTOS_CHECK_CORE_LOCKING 0
|
||||
#endif
|
||||
|
||||
/** Set this to 0 to implement sys_now() yourself, e.g. using a hw timer.
|
||||
* Default is 1, where FreeRTOS ticks are used to calculate back to ms.
|
||||
*/
|
||||
#ifndef LWIP_FREERTOS_SYS_NOW_FROM_FREERTOS
|
||||
#define LWIP_FREERTOS_SYS_NOW_FROM_FREERTOS 1
|
||||
#endif
|
||||
|
||||
#if !configSUPPORT_DYNAMIC_ALLOCATION
|
||||
# error "lwIP FreeRTOS port requires configSUPPORT_DYNAMIC_ALLOCATION"
|
||||
#endif
|
||||
#if !INCLUDE_vTaskDelay
|
||||
# error "lwIP FreeRTOS port requires INCLUDE_vTaskDelay"
|
||||
#endif
|
||||
#if !INCLUDE_vTaskSuspend
|
||||
# error "lwIP FreeRTOS port requires INCLUDE_vTaskSuspend"
|
||||
#endif
|
||||
#if LWIP_FREERTOS_SYS_ARCH_PROTECT_USES_MUTEX || !LWIP_COMPAT_MUTEX
|
||||
#if !configUSE_MUTEXES
|
||||
# error "lwIP FreeRTOS port requires configUSE_MUTEXES"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if SYS_LIGHTWEIGHT_PROT && LWIP_FREERTOS_SYS_ARCH_PROTECT_USES_MUTEX
|
||||
static SemaphoreHandle_t sys_arch_protect_mutex;
|
||||
#endif
|
||||
#if SYS_LIGHTWEIGHT_PROT && LWIP_FREERTOS_SYS_ARCH_PROTECT_SANITY_CHECK
|
||||
static sys_prot_t sys_arch_protect_nesting;
|
||||
#endif
|
||||
|
||||
/* Initialize this module (see description in sys.h) */
|
||||
void
|
||||
sys_init(void)
|
||||
{
|
||||
#if SYS_LIGHTWEIGHT_PROT && LWIP_FREERTOS_SYS_ARCH_PROTECT_USES_MUTEX
|
||||
/* initialize sys_arch_protect global mutex */
|
||||
sys_arch_protect_mutex = xSemaphoreCreateRecursiveMutex();
|
||||
LWIP_ASSERT("failed to create sys_arch_protect mutex",
|
||||
sys_arch_protect_mutex != NULL);
|
||||
#endif /* SYS_LIGHTWEIGHT_PROT && LWIP_FREERTOS_SYS_ARCH_PROTECT_USES_MUTEX */
|
||||
}
|
||||
|
||||
#if configUSE_16_BIT_TICKS == 1
|
||||
#error This port requires 32 bit ticks or timer overflow will fail
|
||||
#endif
|
||||
|
||||
#if LWIP_FREERTOS_SYS_NOW_FROM_FREERTOS
|
||||
u32_t
|
||||
sys_now(void)
|
||||
{
|
||||
return xTaskGetTickCount() * portTICK_PERIOD_MS;
|
||||
}
|
||||
#endif
|
||||
|
||||
u32_t
|
||||
sys_jiffies(void)
|
||||
{
|
||||
return xTaskGetTickCount();
|
||||
}
|
||||
|
||||
#if SYS_LIGHTWEIGHT_PROT
|
||||
|
||||
sys_prot_t
|
||||
sys_arch_protect(void)
|
||||
{
|
||||
#if LWIP_FREERTOS_SYS_ARCH_PROTECT_USES_MUTEX
|
||||
BaseType_t ret;
|
||||
LWIP_ASSERT("sys_arch_protect_mutex != NULL", sys_arch_protect_mutex != NULL);
|
||||
|
||||
ret = xSemaphoreTakeRecursive(sys_arch_protect_mutex, portMAX_DELAY);
|
||||
LWIP_ASSERT("sys_arch_protect failed to take the mutex", ret == pdTRUE);
|
||||
#else /* LWIP_FREERTOS_SYS_ARCH_PROTECT_USES_MUTEX */
|
||||
taskENTER_CRITICAL();
|
||||
#endif /* LWIP_FREERTOS_SYS_ARCH_PROTECT_USES_MUTEX */
|
||||
#if LWIP_FREERTOS_SYS_ARCH_PROTECT_SANITY_CHECK
|
||||
{
|
||||
/* every nested call to sys_arch_protect() returns an increased number */
|
||||
sys_prot_t ret = sys_arch_protect_nesting;
|
||||
sys_arch_protect_nesting++;
|
||||
LWIP_ASSERT("sys_arch_protect overflow", sys_arch_protect_nesting > ret);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
sys_arch_unprotect(sys_prot_t pval)
|
||||
{
|
||||
#if LWIP_FREERTOS_SYS_ARCH_PROTECT_USES_MUTEX
|
||||
BaseType_t ret;
|
||||
#endif
|
||||
#if LWIP_FREERTOS_SYS_ARCH_PROTECT_SANITY_CHECK
|
||||
LWIP_ASSERT("unexpected sys_arch_protect_nesting", sys_arch_protect_nesting > 0);
|
||||
sys_arch_protect_nesting--;
|
||||
LWIP_ASSERT("unexpected sys_arch_protect_nesting", sys_arch_protect_nesting == pval);
|
||||
#endif
|
||||
|
||||
#if LWIP_FREERTOS_SYS_ARCH_PROTECT_USES_MUTEX
|
||||
LWIP_ASSERT("sys_arch_protect_mutex != NULL", sys_arch_protect_mutex != NULL);
|
||||
|
||||
ret = xSemaphoreGiveRecursive(sys_arch_protect_mutex);
|
||||
LWIP_ASSERT("sys_arch_unprotect failed to give the mutex", ret == pdTRUE);
|
||||
#else /* LWIP_FREERTOS_SYS_ARCH_PROTECT_USES_MUTEX */
|
||||
taskEXIT_CRITICAL();
|
||||
#endif /* LWIP_FREERTOS_SYS_ARCH_PROTECT_USES_MUTEX */
|
||||
LWIP_UNUSED_ARG(pval);
|
||||
}
|
||||
|
||||
#endif /* SYS_LIGHTWEIGHT_PROT */
|
||||
|
||||
void
|
||||
sys_arch_msleep(u32_t delay_ms)
|
||||
{
|
||||
TickType_t delay_ticks = delay_ms / portTICK_RATE_MS;
|
||||
vTaskDelay(delay_ticks);
|
||||
}
|
||||
|
||||
#if !LWIP_COMPAT_MUTEX
|
||||
|
||||
/* Create a new mutex*/
|
||||
err_t
|
||||
sys_mutex_new(sys_mutex_t *mutex)
|
||||
{
|
||||
LWIP_ASSERT("mutex != NULL", mutex != NULL);
|
||||
|
||||
mutex->mut = xSemaphoreCreateRecursiveMutex();
|
||||
if(mutex->mut == NULL) {
|
||||
SYS_STATS_INC(mutex.err);
|
||||
return ERR_MEM;
|
||||
}
|
||||
SYS_STATS_INC_USED(mutex);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void
|
||||
sys_mutex_lock(sys_mutex_t *mutex)
|
||||
{
|
||||
BaseType_t ret;
|
||||
LWIP_ASSERT("mutex != NULL", mutex != NULL);
|
||||
LWIP_ASSERT("mutex->mut != NULL", mutex->mut != NULL);
|
||||
|
||||
ret = xSemaphoreTakeRecursive(mutex->mut, portMAX_DELAY);
|
||||
LWIP_ASSERT("failed to take the mutex", ret == pdTRUE);
|
||||
}
|
||||
|
||||
void
|
||||
sys_mutex_unlock(sys_mutex_t *mutex)
|
||||
{
|
||||
BaseType_t ret;
|
||||
LWIP_ASSERT("mutex != NULL", mutex != NULL);
|
||||
LWIP_ASSERT("mutex->mut != NULL", mutex->mut != NULL);
|
||||
|
||||
ret = xSemaphoreGiveRecursive(mutex->mut);
|
||||
LWIP_ASSERT("failed to give the mutex", ret == pdTRUE);
|
||||
}
|
||||
|
||||
void
|
||||
sys_mutex_free(sys_mutex_t *mutex)
|
||||
{
|
||||
LWIP_ASSERT("mutex != NULL", mutex != NULL);
|
||||
LWIP_ASSERT("mutex->mut != NULL", mutex->mut != NULL);
|
||||
|
||||
SYS_STATS_DEC(mutex.used);
|
||||
vSemaphoreDelete(mutex->mut);
|
||||
mutex->mut = NULL;
|
||||
}
|
||||
|
||||
#endif /* !LWIP_COMPAT_MUTEX */
|
||||
|
||||
err_t
|
||||
sys_sem_new(sys_sem_t *sem, u8_t initial_count)
|
||||
{
|
||||
LWIP_ASSERT("sem != NULL", sem != NULL);
|
||||
LWIP_ASSERT("initial_count invalid (not 0 or 1)",
|
||||
(initial_count == 0) || (initial_count == 1));
|
||||
|
||||
sem->sem = xSemaphoreCreateBinary();
|
||||
if(sem->sem == NULL) {
|
||||
SYS_STATS_INC(sem.err);
|
||||
return ERR_MEM;
|
||||
}
|
||||
SYS_STATS_INC_USED(sem);
|
||||
|
||||
if(initial_count == 1) {
|
||||
BaseType_t ret = xSemaphoreGive(sem->sem);
|
||||
LWIP_ASSERT("sys_sem_new: initial give failed", ret == pdTRUE);
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void
|
||||
sys_sem_signal(sys_sem_t *sem)
|
||||
{
|
||||
BaseType_t ret;
|
||||
LWIP_ASSERT("sem != NULL", sem != NULL);
|
||||
LWIP_ASSERT("sem->sem != NULL", sem->sem != NULL);
|
||||
|
||||
ret = xSemaphoreGive(sem->sem);
|
||||
/* queue full is OK, this is a signal only... */
|
||||
LWIP_ASSERT("sys_sem_signal: sane return value",
|
||||
(ret == pdTRUE) || (ret == errQUEUE_FULL));
|
||||
}
|
||||
|
||||
u32_t
|
||||
sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout_ms)
|
||||
{
|
||||
BaseType_t ret;
|
||||
LWIP_ASSERT("sem != NULL", sem != NULL);
|
||||
LWIP_ASSERT("sem->sem != NULL", sem->sem != NULL);
|
||||
|
||||
if(!timeout_ms) {
|
||||
/* wait infinite */
|
||||
ret = xSemaphoreTake(sem->sem, portMAX_DELAY);
|
||||
LWIP_ASSERT("taking semaphore failed", ret == pdTRUE);
|
||||
} else {
|
||||
TickType_t timeout_ticks = timeout_ms / portTICK_RATE_MS;
|
||||
ret = xSemaphoreTake(sem->sem, timeout_ticks);
|
||||
if (ret == errQUEUE_EMPTY) {
|
||||
/* timed out */
|
||||
return SYS_ARCH_TIMEOUT;
|
||||
}
|
||||
LWIP_ASSERT("taking semaphore failed", ret == pdTRUE);
|
||||
}
|
||||
|
||||
/* Old versions of lwIP required us to return the time waited.
|
||||
This is not the case any more. Just returning != SYS_ARCH_TIMEOUT
|
||||
here is enough. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
sys_sem_free(sys_sem_t *sem)
|
||||
{
|
||||
LWIP_ASSERT("sem != NULL", sem != NULL);
|
||||
LWIP_ASSERT("sem->sem != NULL", sem->sem != NULL);
|
||||
|
||||
SYS_STATS_DEC(sem.used);
|
||||
vSemaphoreDelete(sem->sem);
|
||||
sem->sem = NULL;
|
||||
}
|
||||
|
||||
err_t
|
||||
sys_mbox_new(sys_mbox_t *mbox, int size)
|
||||
{
|
||||
LWIP_ASSERT("mbox != NULL", mbox != NULL);
|
||||
LWIP_ASSERT("size > 0", size > 0);
|
||||
|
||||
mbox->mbx = xQueueCreate((UBaseType_t)size, sizeof(void *));
|
||||
if(mbox->mbx == NULL) {
|
||||
SYS_STATS_INC(mbox.err);
|
||||
return ERR_MEM;
|
||||
}
|
||||
SYS_STATS_INC_USED(mbox);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void
|
||||
sys_mbox_post(sys_mbox_t *mbox, void *msg)
|
||||
{
|
||||
BaseType_t ret;
|
||||
LWIP_ASSERT("mbox != NULL", mbox != NULL);
|
||||
LWIP_ASSERT("mbox->mbx != NULL", mbox->mbx != NULL);
|
||||
|
||||
ret = xQueueSendToBack(mbox->mbx, &msg, portMAX_DELAY);
|
||||
LWIP_ASSERT("mbox post failed", ret == pdTRUE);
|
||||
}
|
||||
|
||||
err_t
|
||||
sys_mbox_trypost(sys_mbox_t *mbox, void *msg)
|
||||
{
|
||||
BaseType_t ret;
|
||||
LWIP_ASSERT("mbox != NULL", mbox != NULL);
|
||||
LWIP_ASSERT("mbox->mbx != NULL", mbox->mbx != NULL);
|
||||
|
||||
ret = xQueueSendToBack(mbox->mbx, &msg, 0);
|
||||
if (ret == pdTRUE) {
|
||||
return ERR_OK;
|
||||
} else {
|
||||
LWIP_ASSERT("mbox trypost failed", ret == errQUEUE_FULL);
|
||||
SYS_STATS_INC(mbox.err);
|
||||
return ERR_MEM;
|
||||
}
|
||||
}
|
||||
|
||||
err_t
|
||||
sys_mbox_trypost_fromisr(sys_mbox_t *mbox, void *msg)
|
||||
{
|
||||
BaseType_t ret;
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
LWIP_ASSERT("mbox != NULL", mbox != NULL);
|
||||
LWIP_ASSERT("mbox->mbx != NULL", mbox->mbx != NULL);
|
||||
|
||||
ret = xQueueSendToBackFromISR(mbox->mbx, &msg, &xHigherPriorityTaskWoken);
|
||||
if (ret == pdTRUE) {
|
||||
if (xHigherPriorityTaskWoken == pdTRUE) {
|
||||
return ERR_NEED_SCHED;
|
||||
}
|
||||
return ERR_OK;
|
||||
} else {
|
||||
LWIP_ASSERT("mbox trypost failed", ret == errQUEUE_FULL);
|
||||
SYS_STATS_INC(mbox.err);
|
||||
return ERR_MEM;
|
||||
}
|
||||
}
|
||||
|
||||
u32_t
|
||||
sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout_ms)
|
||||
{
|
||||
BaseType_t ret;
|
||||
void *msg_dummy;
|
||||
LWIP_ASSERT("mbox != NULL", mbox != NULL);
|
||||
LWIP_ASSERT("mbox->mbx != NULL", mbox->mbx != NULL);
|
||||
|
||||
if (!msg) {
|
||||
msg = &msg_dummy;
|
||||
}
|
||||
|
||||
if (!timeout_ms) {
|
||||
/* wait infinite */
|
||||
ret = xQueueReceive(mbox->mbx, &(*msg), portMAX_DELAY);
|
||||
LWIP_ASSERT("mbox fetch failed", ret == pdTRUE);
|
||||
} else {
|
||||
TickType_t timeout_ticks = timeout_ms / portTICK_RATE_MS;
|
||||
ret = xQueueReceive(mbox->mbx, &(*msg), timeout_ticks);
|
||||
if (ret == errQUEUE_EMPTY) {
|
||||
/* timed out */
|
||||
*msg = NULL;
|
||||
return SYS_ARCH_TIMEOUT;
|
||||
}
|
||||
LWIP_ASSERT("mbox fetch failed", ret == pdTRUE);
|
||||
}
|
||||
|
||||
/* Old versions of lwIP required us to return the time waited.
|
||||
This is not the case any more. Just returning != SYS_ARCH_TIMEOUT
|
||||
here is enough. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
u32_t
|
||||
sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg)
|
||||
{
|
||||
BaseType_t ret;
|
||||
void *msg_dummy;
|
||||
LWIP_ASSERT("mbox != NULL", mbox != NULL);
|
||||
LWIP_ASSERT("mbox->mbx != NULL", mbox->mbx != NULL);
|
||||
|
||||
if (!msg) {
|
||||
msg = &msg_dummy;
|
||||
}
|
||||
|
||||
ret = xQueueReceive(mbox->mbx, &(*msg), 0);
|
||||
if (ret == errQUEUE_EMPTY) {
|
||||
*msg = NULL;
|
||||
return SYS_MBOX_EMPTY;
|
||||
}
|
||||
LWIP_ASSERT("mbox fetch failed", ret == pdTRUE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
sys_mbox_free(sys_mbox_t *mbox)
|
||||
{
|
||||
LWIP_ASSERT("mbox != NULL", mbox != NULL);
|
||||
LWIP_ASSERT("mbox->mbx != NULL", mbox->mbx != NULL);
|
||||
|
||||
#if LWIP_FREERTOS_CHECK_QUEUE_EMPTY_ON_FREE
|
||||
{
|
||||
UBaseType_t msgs_waiting = uxQueueMessagesWaiting(mbox->mbx);
|
||||
LWIP_ASSERT("mbox quence not empty", msgs_waiting == 0);
|
||||
|
||||
if (msgs_waiting != 0) {
|
||||
SYS_STATS_INC(mbox.err);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
vQueueDelete(mbox->mbx);
|
||||
|
||||
SYS_STATS_DEC(mbox.used);
|
||||
}
|
||||
|
||||
sys_thread_t
|
||||
sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio)
|
||||
{
|
||||
TaskHandle_t rtos_task;
|
||||
BaseType_t ret;
|
||||
sys_thread_t lwip_thread;
|
||||
size_t rtos_stacksize;
|
||||
|
||||
LWIP_ASSERT("invalid stacksize", stacksize > 0);
|
||||
#if LWIP_FREERTOS_THREAD_STACKSIZE_IS_STACKWORDS
|
||||
rtos_stacksize = (size_t)stacksize;
|
||||
#else
|
||||
rtos_stacksize = (size_t)stacksize / sizeof(StackType_t);
|
||||
#endif
|
||||
|
||||
/* lwIP's lwip_thread_fn matches FreeRTOS' TaskFunction_t, so we can pass the
|
||||
thread function without adaption here. */
|
||||
ret = xTaskCreate(thread, name, (configSTACK_DEPTH_TYPE)rtos_stacksize, arg, prio, &rtos_task);
|
||||
LWIP_ASSERT("task creation failed", ret == pdTRUE);
|
||||
|
||||
lwip_thread.thread_handle = rtos_task;
|
||||
return lwip_thread;
|
||||
}
|
||||
|
||||
#if LWIP_NETCONN_SEM_PER_THREAD
|
||||
#if configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0
|
||||
|
||||
sys_sem_t *
|
||||
sys_arch_netconn_sem_get(void)
|
||||
{
|
||||
void* ret;
|
||||
TaskHandle_t task = xTaskGetCurrentTaskHandle();
|
||||
LWIP_ASSERT("task != NULL", task != NULL);
|
||||
|
||||
ret = pvTaskGetThreadLocalStoragePointer(task, 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
sys_arch_netconn_sem_alloc(void)
|
||||
{
|
||||
void *ret;
|
||||
TaskHandle_t task = xTaskGetCurrentTaskHandle();
|
||||
LWIP_ASSERT("task != NULL", task != NULL);
|
||||
|
||||
ret = pvTaskGetThreadLocalStoragePointer(task, 0);
|
||||
if(ret == NULL) {
|
||||
sys_sem_t *sem;
|
||||
err_t err;
|
||||
/* need to allocate the memory for this semaphore */
|
||||
sem = mem_malloc(sizeof(sys_sem_t));
|
||||
LWIP_ASSERT("sem != NULL", sem != NULL);
|
||||
err = sys_sem_new(sem, 0);
|
||||
LWIP_ASSERT("err == ERR_OK", err == ERR_OK);
|
||||
LWIP_ASSERT("sem invalid", sys_sem_valid(sem));
|
||||
vTaskSetThreadLocalStoragePointer(task, 0, sem);
|
||||
}
|
||||
}
|
||||
|
||||
void sys_arch_netconn_sem_free(void)
|
||||
{
|
||||
void* ret;
|
||||
TaskHandle_t task = xTaskGetCurrentTaskHandle();
|
||||
LWIP_ASSERT("task != NULL", task != NULL);
|
||||
|
||||
ret = pvTaskGetThreadLocalStoragePointer(task, 0);
|
||||
if(ret != NULL) {
|
||||
sys_sem_t *sem = ret;
|
||||
sys_sem_free(sem);
|
||||
mem_free(sem);
|
||||
vTaskSetThreadLocalStoragePointer(task, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
#else /* configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 */
|
||||
#error LWIP_NETCONN_SEM_PER_THREAD needs configNUM_THREAD_LOCAL_STORAGE_POINTERS
|
||||
#endif /* configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 */
|
||||
|
||||
#endif /* LWIP_NETCONN_SEM_PER_THREAD */
|
||||
|
||||
#if LWIP_FREERTOS_CHECK_CORE_LOCKING
|
||||
#if LWIP_TCPIP_CORE_LOCKING
|
||||
|
||||
/** Flag the core lock held. A counter for recursive locks. */
|
||||
static u8_t lwip_core_lock_count;
|
||||
static TaskHandle_t lwip_core_lock_holder_thread;
|
||||
|
||||
void
|
||||
sys_lock_tcpip_core(void)
|
||||
{
|
||||
sys_mutex_lock(&lock_tcpip_core);
|
||||
if (lwip_core_lock_count == 0) {
|
||||
lwip_core_lock_holder_thread = xTaskGetCurrentTaskHandle();
|
||||
}
|
||||
lwip_core_lock_count++;
|
||||
}
|
||||
|
||||
void
|
||||
sys_unlock_tcpip_core(void)
|
||||
{
|
||||
lwip_core_lock_count--;
|
||||
if (lwip_core_lock_count == 0) {
|
||||
lwip_core_lock_holder_thread = 0;
|
||||
}
|
||||
sys_mutex_unlock(&lock_tcpip_core);
|
||||
}
|
||||
|
||||
#endif /* LWIP_TCPIP_CORE_LOCKING */
|
||||
|
||||
#if !NO_SYS
|
||||
static TaskHandle_t lwip_tcpip_thread;
|
||||
#endif
|
||||
|
||||
void
|
||||
sys_mark_tcpip_thread(void)
|
||||
{
|
||||
#if !NO_SYS
|
||||
lwip_tcpip_thread = xTaskGetCurrentTaskHandle();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
sys_check_core_locking(void)
|
||||
{
|
||||
/* Embedded systems should check we are NOT in an interrupt context here */
|
||||
/* E.g. core Cortex-M3/M4 ports:
|
||||
configASSERT( ( portNVIC_INT_CTRL_REG & portVECTACTIVE_MASK ) == 0 );
|
||||
|
||||
Instead, we use more generic FreeRTOS functions here, which should fail from ISR: */
|
||||
taskENTER_CRITICAL();
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
#if !NO_SYS
|
||||
if (lwip_tcpip_thread != 0) {
|
||||
TaskHandle_t current_thread = xTaskGetCurrentTaskHandle();
|
||||
|
||||
#if LWIP_TCPIP_CORE_LOCKING
|
||||
LWIP_ASSERT("Function called without core lock",
|
||||
current_thread == lwip_core_lock_holder_thread && lwip_core_lock_count > 0);
|
||||
#else /* LWIP_TCPIP_CORE_LOCKING */
|
||||
LWIP_ASSERT("Function called from wrong thread", current_thread == lwip_tcpip_thread);
|
||||
#endif /* LWIP_TCPIP_CORE_LOCKING */
|
||||
}
|
||||
#endif /* !NO_SYS */
|
||||
}
|
||||
|
||||
#endif /* LWIP_FREERTOS_CHECK_CORE_LOCKING*/
|
||||
51
lwip/lwip-2.2.1/contrib/ports/unix/Common.mk
Normal file
51
lwip/lwip-2.2.1/contrib/ports/unix/Common.mk
Normal file
@ -0,0 +1,51 @@
|
||||
#
|
||||
# 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/list.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+=-lutil
|
||||
|
||||
UNAME_S:= $(shell uname -s)
|
||||
ifneq ($(UNAME_S),Darwin)
|
||||
# Darwin doesn't have pthreads or POSIX real-time extensions libs
|
||||
LDFLAGS+=-pthread -lrt
|
||||
endif
|
||||
44
lwip/lwip-2.2.1/contrib/ports/unix/Filelists.cmake
Normal file
44
lwip/lwip-2.2.1/contrib/ports/unix/Filelists.cmake
Normal file
@ -0,0 +1,44 @@
|
||||
# This file is indended to be included in end-user CMakeLists.txt
|
||||
# include(/path/to/Filelists.cmake)
|
||||
# It assumes the variable LWIP_CONTRIB_DIR is defined pointing to the
|
||||
# root path of lwIP/contrib sources.
|
||||
#
|
||||
# This file is NOT designed (on purpose) to be used as cmake
|
||||
# subdir via add_subdirectory()
|
||||
# The intention is to provide greater flexibility to users to
|
||||
# create their own targets using the *_SRCS variables.
|
||||
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0")
|
||||
include_guard(GLOBAL)
|
||||
endif()
|
||||
|
||||
set(lwipcontribportunix_SRCS
|
||||
${LWIP_CONTRIB_DIR}/ports/unix/port/sys_arch.c
|
||||
${LWIP_CONTRIB_DIR}/ports/unix/port/perf.c
|
||||
)
|
||||
|
||||
set(lwipcontribportunixnetifs_SRCS
|
||||
${LWIP_CONTRIB_DIR}/ports/unix/port/netif/tapif.c
|
||||
${LWIP_CONTRIB_DIR}/ports/unix/port/netif/list.c
|
||||
${LWIP_CONTRIB_DIR}/ports/unix/port/netif/sio.c
|
||||
${LWIP_CONTRIB_DIR}/ports/unix/port/netif/fifo.c
|
||||
)
|
||||
|
||||
add_library(lwipcontribportunix EXCLUDE_FROM_ALL ${lwipcontribportunix_SRCS} ${lwipcontribportunixnetifs_SRCS})
|
||||
target_include_directories(lwipcontribportunix PRIVATE ${LWIP_INCLUDE_DIRS} ${LWIP_MBEDTLS_INCLUDE_DIRS})
|
||||
target_compile_options(lwipcontribportunix PRIVATE ${LWIP_COMPILER_FLAGS})
|
||||
target_compile_definitions(lwipcontribportunix PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS})
|
||||
target_link_libraries(lwipcontribportunix PUBLIC ${LWIP_MBEDTLS_LINK_LIBRARIES})
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
find_library(LIBUTIL util)
|
||||
find_library(LIBPTHREAD pthread)
|
||||
find_library(LIBRT rt)
|
||||
target_link_libraries(lwipcontribportunix PUBLIC ${LIBUTIL} ${LIBPTHREAD} ${LIBRT})
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
# Darwin doesn't have pthreads or POSIX real-time extensions libs
|
||||
find_library(LIBUTIL util)
|
||||
target_link_libraries(lwipcontribportunix PUBLIC ${LIBUTIL})
|
||||
endif()
|
||||
25
lwip/lwip-2.2.1/contrib/ports/unix/README
Normal file
25
lwip/lwip-2.2.1/contrib/ports/unix/README
Normal file
@ -0,0 +1,25 @@
|
||||
This port contains infrastructure and examples for running lwIP on Unix-like
|
||||
operating systems (Linux, OpenBSD, cygwin). Much of this is targeted 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.
|
||||
|
||||
* 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):
|
||||
|
||||
* 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.
|
||||
61
lwip/lwip-2.2.1/contrib/ports/unix/check/CMakeLists.txt
Normal file
61
lwip/lwip-2.2.1/contrib/ports/unix/check/CMakeLists.txt
Normal file
@ -0,0 +1,61 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
set (CMAKE_CONFIGURATION_TYPES "Debug;Release")
|
||||
|
||||
project(lwipunittests C)
|
||||
|
||||
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_SYSTEM_NAME STREQUAL "GNU")
|
||||
message(FATAL_ERROR "Unit test are currently only working on Linux, Darwin or Hurd")
|
||||
endif()
|
||||
|
||||
set(LWIP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../..)
|
||||
if (NOT CMAKE_SYSTEM_NAME STREQUAL "GNU")
|
||||
set(LWIP_USE_SANITIZERS true)
|
||||
endif()
|
||||
include(${LWIP_DIR}/contrib/ports/CMakeCommon.cmake)
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
# check.h causes 'error: token pasting of ',' and __VA_ARGS__ is a GNU extension' with clang 9.0.0
|
||||
list(LWIP_COMPILER_FLAGS APPEND -Wno-gnu-zero-variadic-macro-arguments)
|
||||
endif()
|
||||
|
||||
set (LWIP_DEFINITIONS -DLWIP_DEBUG -DLWIP_NOASSERT_ON_ERROR)
|
||||
set (LWIP_INCLUDE_DIRS
|
||||
"${LWIP_DIR}/test/unit"
|
||||
"${LWIP_DIR}/src/include"
|
||||
"${LWIP_CONTRIB_DIR}/"
|
||||
"${LWIP_CONTRIB_DIR}/ports/unix/port/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/"
|
||||
)
|
||||
|
||||
include(${LWIP_CONTRIB_DIR}/ports/unix/Filelists.cmake)
|
||||
include(${LWIP_DIR}/src/Filelists.cmake)
|
||||
include(${LWIP_DIR}/test/unit/Filelists.cmake)
|
||||
|
||||
add_executable(lwip_unittests ${LWIP_TESTFILES})
|
||||
target_include_directories(lwip_unittests PRIVATE ${LWIP_INCLUDE_DIRS})
|
||||
target_compile_options(lwip_unittests PRIVATE ${LWIP_COMPILER_FLAGS})
|
||||
target_compile_definitions(lwip_unittests PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS})
|
||||
|
||||
find_library(LIBCHECK check)
|
||||
find_library(LIBM m)
|
||||
target_link_libraries(lwip_unittests ${LWIP_SANITIZER_LIBS} lwipallapps lwipcore ${LIBCHECK} ${LIBM})
|
||||
|
||||
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
# check installed via brew on Darwin doesn't have a separate subunit library (must be statically linked)
|
||||
find_library(LIBSUBUNIT subunit)
|
||||
target_link_libraries(lwip_unittests ${LIBSUBUNIT})
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "GNU")
|
||||
find_library(LIBUTIL util)
|
||||
find_library(LIBPTHREAD pthread)
|
||||
find_library(LIBRT rt)
|
||||
target_link_libraries(lwip_unittests ${LIBUTIL} ${LIBPTHREAD} ${LIBRT})
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
# Darwin doesn't have pthreads or POSIX real-time extensions libs
|
||||
find_library(LIBUTIL util)
|
||||
target_link_libraries(lwip_unittests ${LIBUTIL})
|
||||
endif()
|
||||
94
lwip/lwip-2.2.1/contrib/ports/unix/check/Makefile
Normal file
94
lwip/lwip-2.2.1/contrib/ports/unix/check/Makefile
Normal file
@ -0,0 +1,94 @@
|
||||
#
|
||||
# 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
|
||||
|
||||
LWIPDIR=../../../../src
|
||||
|
||||
# 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
|
||||
|
||||
# Ignore 'too many arguments for format' warnings which happen with GCCs
|
||||
# from check 0.15.2 on fail_if/fail_unless macros with text.
|
||||
# See https://github.com/libcheck/check/pull/298/commits/82540c5428d3818b64d
|
||||
CFLAGS+=-Wno-error=format-extra-args
|
||||
|
||||
ifeq (clang,$(findstring clang,$(CC)))
|
||||
# check.h causes 'error: token pasting of ',' and __VA_ARGS__ is a GNU extension' with clang 9.0.0
|
||||
CFLAGS+=-Wno-gnu-zero-variadic-macro-arguments
|
||||
endif
|
||||
|
||||
# Prevent compiling sys_arch.c of unix port because unit test provide their own port
|
||||
SYSARCH?=
|
||||
include ../Common.mk
|
||||
|
||||
LDFLAGS:=-lcheck -lm $(LDFLAGS)
|
||||
|
||||
ifneq ($(UNAME_S),Darwin)
|
||||
# check installed via brew on Darwin doesn't have a separate subunit library (must be statically linked)
|
||||
LDFLAGS+=-lsubunit
|
||||
endif
|
||||
|
||||
TESTDIR=$(LWIPDIR)/../test/unit
|
||||
include $(TESTDIR)/Filelists.mk
|
||||
TESTOBJS=$(notdir $(TESTFILES:.c=.o))
|
||||
|
||||
DEPFILES=.depend_test .depend_lwip .depend_app
|
||||
|
||||
clean:
|
||||
@rm -f *.o $(LWIPLIBCOMMON) $(APPLIB) lwip_unittests *.s $(DEPFILES) *.core core lwip_unittests.xml
|
||||
|
||||
depend dep: $(DEPFILES)
|
||||
@true
|
||||
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
include $(DEPFILES)
|
||||
endif
|
||||
|
||||
.depend_test: $(TESTFILES)
|
||||
$(CCDEP) $(CFLAGS) -MM $^ > .depend_test || rm -f .depend_test
|
||||
.depend_lwip: $(LWIPFILES)
|
||||
$(CCDEP) $(CFLAGS) -MM $^ > .depend_lwip || rm -f .depend_lwip
|
||||
.depend_app: $(APPFILES)
|
||||
$(CCDEP) $(CFLAGS) -MM $^ > .depend_app || rm -f .depend_app
|
||||
|
||||
ifneq ($(UNAME_S),Darwin)
|
||||
# clang on Darwin doesn't support --start-group
|
||||
lwip_unittests: $(DEPFILES) $(TESTOBJS) $(LWIPLIBCOMMON) $(APPLIB)
|
||||
$(CC) $(CFLAGS) -o lwip_unittests $(TESTOBJS) -Wl,--start-group $(LWIPLIBCOMMON) $(APPLIB) $(LDFLAGS) -Wl,--end-group
|
||||
else
|
||||
lwip_unittests: $(DEPFILES) $(TESTOBJS) $(LWIPLIBCOMMON) $(APPLIB)
|
||||
$(CC) $(CFLAGS) -o lwip_unittests $(TESTOBJS) $(LWIPLIBCOMMON) $(APPLIB) $(LDFLAGS)
|
||||
endif
|
||||
|
||||
check: lwip_unittests
|
||||
@./lwip_unittests
|
||||
8
lwip/lwip-2.2.1/contrib/ports/unix/check/README
Normal file
8
lwip/lwip-2.2.1/contrib/ports/unix/check/README
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
Helper files to run lwIP unit tests on unix-like systems.
|
||||
|
||||
1. Install the check library, through a package manager or from https://libcheck.github.io/check/
|
||||
2. Put the lwip code in a directory called 'lwip'
|
||||
3. Run `make check`
|
||||
4. Make sure all tests pass
|
||||
|
||||
2
lwip/lwip-2.2.1/contrib/ports/unix/check/config.h
Normal file
2
lwip/lwip-2.2.1/contrib/ports/unix/check/config.h
Normal file
@ -0,0 +1,2 @@
|
||||
/* Enable this to simplify debugging */
|
||||
/* #define LWIP_UNITTESTS_NOFORK */
|
||||
@ -0,0 +1,27 @@
|
||||
include(${LWIP_DIR}/contrib/ports/CMakeCommon.cmake)
|
||||
|
||||
set (LWIP_INCLUDE_DIRS
|
||||
"${LWIP_DIR}/src/include"
|
||||
"${LWIP_DIR}/contrib/"
|
||||
"${LWIP_DIR}/contrib/ports/unix/port/include"
|
||||
"${LWIP_DIR}/contrib/examples/example_app"
|
||||
)
|
||||
|
||||
include(${LWIP_DIR}/src/Filelists.cmake)
|
||||
include(${LWIP_DIR}/contrib/Filelists.cmake)
|
||||
include(${LWIP_DIR}/contrib/ports/unix/Filelists.cmake)
|
||||
|
||||
if(NOT EXISTS ${LWIP_DIR}/contrib/examples/example_app/lwipcfg.h)
|
||||
message(WARNING "${LWIP_DIR}/contrib/examples/example_app is missing lwipcfg.h
|
||||
Copy ${LWIP_DIR}/contrib/examples/example_app/lwipcfg.h.example to ${LWIP_DIR}/contrib/examples/example_app/lwipcfg.h and edit appropriately")
|
||||
endif()
|
||||
add_executable(example_app ${LWIP_DIR}/contrib/examples/example_app/test.c default_netif.c)
|
||||
target_include_directories(example_app PRIVATE ${LWIP_INCLUDE_DIRS})
|
||||
target_compile_options(example_app PRIVATE ${LWIP_COMPILER_FLAGS})
|
||||
target_compile_definitions(example_app PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS})
|
||||
target_link_libraries(example_app ${LWIP_SANITIZER_LIBS} lwipcontribexamples lwipcontribapps lwipcontribaddons lwipallapps lwipcontribportunix lwipcore lwipmbedtls)
|
||||
|
||||
add_executable(makefsdata ${lwipmakefsdata_SRCS})
|
||||
target_compile_options(makefsdata PRIVATE ${LWIP_COMPILER_FLAGS})
|
||||
target_include_directories(makefsdata PRIVATE ${LWIP_INCLUDE_DIRS})
|
||||
target_link_libraries(makefsdata ${LWIP_SANITIZER_LIBS})
|
||||
60
lwip/lwip-2.2.1/contrib/ports/unix/example_app/Makefile
Normal file
60
lwip/lwip-2.2.1/contrib/ports/unix/example_app/Makefile
Normal file
@ -0,0 +1,60 @@
|
||||
#
|
||||
# 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: example_app makefsdata
|
||||
.PHONY: all
|
||||
|
||||
LWIPDIR=../../../../src
|
||||
|
||||
include ../Common.mk
|
||||
|
||||
CFLAGS+=-I$(CONTRIBDIR)/examples/example_app
|
||||
|
||||
TESTFLAGS?=
|
||||
CFLAGS+=$(TESTFLAGS)
|
||||
|
||||
MAKEFSDATAOBJS=$(notdir $(MAKEFSDATAFILES:.c=.o))
|
||||
|
||||
clean:
|
||||
rm -f *.o $(LWIPLIBCOMMON) $(APPLIB) example_app makefsdata *.s .depend* *.core core
|
||||
|
||||
depend dep: .depend
|
||||
|
||||
include .depend
|
||||
|
||||
.depend: $(CONTRIBDIR)/examples/example_app/test.c default_netif.c $(LWIPFILES) $(APPFILES) $(MAKEFSDATAFILES)
|
||||
$(CCDEP) $(CFLAGS) -MM $^ > .depend || rm -f .depend
|
||||
|
||||
example_app: .depend $(LWIPLIBCOMMON) $(APPLIB) default_netif.o test.o
|
||||
$(CC) $(CFLAGS) -o example_app test.o default_netif.o -Wl,--start-group $(APPLIB) $(LWIPLIBCOMMON) -Wl,--end-group $(LDFLAGS)
|
||||
|
||||
makefsdata: .depend $(MAKEFSDATAOBJS)
|
||||
$(CC) $(CFLAGS) -o makefsdata $(MAKEFSDATAOBJS)
|
||||
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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/netif.h"
|
||||
#include "lwip/ip_addr.h"
|
||||
#include "lwip/tcpip.h"
|
||||
#include "netif/tapif.h"
|
||||
#include "examples/example_app/default_netif.h"
|
||||
|
||||
static struct netif netif;
|
||||
|
||||
#if LWIP_IPV4
|
||||
#define NETIF_ADDRS ipaddr, netmask, gw,
|
||||
void init_default_netif(const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw)
|
||||
#else
|
||||
#define NETIF_ADDRS
|
||||
void init_default_netif(void)
|
||||
#endif
|
||||
{
|
||||
#if NO_SYS
|
||||
netif_add(&netif, NETIF_ADDRS NULL, tapif_init, netif_input);
|
||||
#else
|
||||
netif_add(&netif, NETIF_ADDRS NULL, tapif_init, tcpip_input);
|
||||
#endif
|
||||
netif_set_default(&netif);
|
||||
}
|
||||
|
||||
void
|
||||
default_netif_poll(void)
|
||||
{
|
||||
tapif_poll(&netif);
|
||||
}
|
||||
|
||||
void
|
||||
default_netif_shutdown(void)
|
||||
{
|
||||
}
|
||||
34
lwip/lwip-2.2.1/contrib/ports/unix/example_app/iteropts.sh
Normal file
34
lwip/lwip-2.2.1/contrib/ports/unix/example_app/iteropts.sh
Normal file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
LOGFILE=iteropts.log
|
||||
EXAPPDIR=../../../examples/example_app
|
||||
RETVAL=0
|
||||
|
||||
pushd `dirname "$0"`
|
||||
pwd
|
||||
echo Starting Iteropts run >> $LOGFILE
|
||||
for f in $EXAPPDIR/test_configs/*.h
|
||||
do
|
||||
echo Cleaning...
|
||||
make clean > /dev/null
|
||||
BUILDLOG=$(basename "$f" ".h").log
|
||||
echo testing $f
|
||||
echo testing $f >> $LOGFILE
|
||||
rm -f $EXAPPDIR/lwipopts_test.h
|
||||
# cat the file to update its timestamp
|
||||
cat $f > $EXAPPDIR/lwipopts_test.h
|
||||
make TESTFLAGS="-DLWIP_OPTTEST_FILE -Wno-documentation" -j 4 1> $BUILDLOG 2>&1
|
||||
ERR=$?
|
||||
if [ $ERR != 0 ]; then
|
||||
cat $BUILDLOG
|
||||
echo file $f failed with $ERR >> $LOGFILE
|
||||
echo ++++++++ $f FAILED +++++++
|
||||
RETVAL=1
|
||||
fi
|
||||
echo test $f done >> $LOGFILE
|
||||
done
|
||||
echo done, cleaning
|
||||
make clean > /dev/null
|
||||
popd
|
||||
echo Exit value: $RETVAL
|
||||
exit $RETVAL
|
||||
33
lwip/lwip-2.2.1/contrib/ports/unix/lib/CMakeLists.txt
Normal file
33
lwip/lwip-2.2.1/contrib/ports/unix/lib/CMakeLists.txt
Normal file
@ -0,0 +1,33 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
project(lwip C)
|
||||
|
||||
set (BUILD_SHARED_LIBS ON)
|
||||
|
||||
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT CMAKE_SYSTEM_NAME STREQUAL "GNU")
|
||||
message(FATAL_ERROR "Lwip shared library is only working on Linux or the Hurd")
|
||||
endif()
|
||||
|
||||
set(LWIP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../..)
|
||||
include(${LWIP_DIR}/contrib/ports/CMakeCommon.cmake)
|
||||
|
||||
set (LWIP_DEFINITIONS -DLWIP_DEBUG)
|
||||
set (LWIP_INCLUDE_DIRS
|
||||
"${LWIP_DIR}/src/include"
|
||||
"${LWIP_CONTRIB_DIR}/"
|
||||
"${LWIP_CONTRIB_DIR}/ports/unix/port/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/"
|
||||
)
|
||||
|
||||
set (LWIP_EXCLUDE_SLIPIF TRUE)
|
||||
include(${LWIP_CONTRIB_DIR}/ports/unix/Filelists.cmake)
|
||||
include(${LWIP_DIR}/src/Filelists.cmake)
|
||||
|
||||
add_library(lwip ${lwipnoapps_SRCS} ${lwipcontribportunix_SRCS} ${lwipcontribportunixnetifs_SRCS})
|
||||
target_compile_options(lwip PRIVATE ${LWIP_COMPILER_FLAGS})
|
||||
target_compile_definitions(lwip PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS})
|
||||
target_include_directories(lwip PRIVATE ${LWIP_INCLUDE_DIRS} ${LWIP_MBEDTLS_INCLUDE_DIRS})
|
||||
target_link_libraries(lwip ${LWIP_SANITIZER_LIBS})
|
||||
|
||||
find_library(LIBPTHREAD pthread)
|
||||
target_link_libraries(lwip ${LIBPTHREAD})
|
||||
28
lwip/lwip-2.2.1/contrib/ports/unix/lib/README
Normal file
28
lwip/lwip-2.2.1/contrib/ports/unix/lib/README
Normal file
@ -0,0 +1,28 @@
|
||||
This directory contains an example of how to compile lwIP as a shared library
|
||||
on Linux.
|
||||
|
||||
Some brief instructions:
|
||||
|
||||
* Compile the code:
|
||||
|
||||
> mkdir build
|
||||
> cd build
|
||||
> cmake ..
|
||||
> make clean all
|
||||
|
||||
This should produce liblwip.so. This is the shared library.
|
||||
|
||||
* Link an application against the shared library
|
||||
|
||||
If you're using gcc you can do this by including -llwip in your link command.
|
||||
|
||||
* Run your application
|
||||
|
||||
Ensure that LD_LIBRARY_PATH includes the directory that contains liblwip.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/>
|
||||
435
lwip/lwip-2.2.1/contrib/ports/unix/lib/lwipopts.h
Normal file
435
lwip/lwip-2.2.1/contrib/ports/unix/lib/lwipopts.h
Normal file
@ -0,0 +1,435 @@
|
||||
/**
|
||||
* @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 don't 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 simultaneously 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 simultaneously 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.
|
||||
* (requires NO_SYS==0)
|
||||
*/
|
||||
#define MEMP_NUM_SYS_TIMEOUT 8
|
||||
|
||||
/**
|
||||
* 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 32
|
||||
|
||||
/**
|
||||
* 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 TCP_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 accommodate 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
|
||||
|
||||
/**
|
||||
* SO_REUSE==1: Enable SO_REUSEADDR
|
||||
*/
|
||||
#define SO_REUSE 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
|
||||
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------------
|
||||
---------- Threading options ----------
|
||||
---------------------------------------
|
||||
*/
|
||||
|
||||
#define LWIP_TCPIP_CORE_LOCKING 1
|
||||
|
||||
#if !NO_SYS
|
||||
void sys_check_core_locking(void);
|
||||
#define LWIP_ASSERT_CORE_LOCKED() sys_check_core_locking()
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_LWIPOPTS_H */
|
||||
99
lwip/lwip-2.2.1/contrib/ports/unix/port/include/arch/cc.h
Normal file
99
lwip/lwip-2.2.1/contrib/ports/unix/port/include/arch/cc.h
Normal file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
* 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 __FreeBSD__
|
||||
#define LWIP_UNIX_FREEBSD
|
||||
#elif defined __FreeBSD_kernel__ && __GLIBC__
|
||||
#define LWIP_UNIX_KFREEBSD
|
||||
#elif defined __CYGWIN__
|
||||
#define LWIP_UNIX_CYGWIN
|
||||
#elif defined __GNU__
|
||||
#define LWIP_UNIX_HURD
|
||||
#endif
|
||||
|
||||
#define LWIP_TIMEVAL_PRIVATE 0
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define LWIP_ERRNO_INCLUDE <errno.h>
|
||||
|
||||
#if defined(LWIP_UNIX_LINUX) || defined(LWIP_UNIX_HURD) || defined(LWIP_UNIX_KFREEBSD)
|
||||
#define LWIP_ERRNO_STDINCLUDE 1
|
||||
#endif
|
||||
|
||||
extern unsigned int lwip_port_rand(void);
|
||||
#define LWIP_RAND() (lwip_port_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
|
||||
|
||||
#if defined(LWIP_UNIX_MACH)
|
||||
/* sys/types.h and signal.h bring in Darwin byte order macros. pull the
|
||||
header here and disable LwIP's version so that apps still can get
|
||||
the macros via LwIP headers and use system headers */
|
||||
#include <sys/types.h>
|
||||
#define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS
|
||||
#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
|
||||
|
||||
typedef unsigned int sys_prot_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_ARCH_CC_H */
|
||||
71
lwip/lwip-2.2.1/contrib/ports/unix/port/include/arch/perf.h
Normal file
71
lwip/lwip-2.2.1/contrib/ports/unix/port/include/arch/perf.h
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* 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 __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_ARCH_PERF_H */
|
||||
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#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;
|
||||
|
||||
#if LWIP_NETCONN_SEM_PER_THREAD
|
||||
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()
|
||||
#endif /* #if LWIP_NETCONN_SEM_PER_THREAD */
|
||||
|
||||
#define LWIP_EXAMPLE_APP_ABORT() lwip_unix_keypressed()
|
||||
int lwip_unix_keypressed(void);
|
||||
|
||||
/*
|
||||
---------------------------------------
|
||||
---------- Threading options ----------
|
||||
---------------------------------------
|
||||
*/
|
||||
|
||||
void sys_mark_tcpip_thread(void);
|
||||
#define LWIP_MARK_TCPIP_THREAD() sys_mark_tcpip_thread()
|
||||
|
||||
#if LWIP_TCPIP_CORE_LOCKING
|
||||
void sys_lock_tcpip_core(void);
|
||||
#define LOCK_TCPIP_CORE() sys_lock_tcpip_core()
|
||||
void sys_unlock_tcpip_core(void);
|
||||
#define UNLOCK_TCPIP_CORE() sys_unlock_tcpip_core()
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_ARCH_SYS_ARCH_H */
|
||||
62
lwip/lwip-2.2.1/contrib/ports/unix/port/include/netif/fifo.h
Normal file
62
lwip/lwip-2.2.1/contrib/ports/unix/port/include/netif/fifo.h
Normal file
@ -0,0 +1,62 @@
|
||||
#ifndef FIFO_H
|
||||
#define FIFO_H
|
||||
|
||||
#include "lwip/sys.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** 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 supposed 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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
34
lwip/lwip-2.2.1/contrib/ports/unix/port/include/netif/list.h
Normal file
34
lwip/lwip-2.2.1/contrib/ports/unix/port/include/netif/list.h
Normal file
@ -0,0 +1,34 @@
|
||||
|
||||
#ifndef LWIP_LIST_H
|
||||
#define LWIP_LIST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
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));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
err_t pcapif_init(struct netif *netif);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_PCAPIF_H */
|
||||
68
lwip/lwip-2.2.1/contrib/ports/unix/port/include/netif/sio.h
Normal file
68
lwip/lwip-2.2.1/contrib/ports/unix/port/include/netif/sio.h
Normal file
@ -0,0 +1,68 @@
|
||||
#ifndef SIO_UNIX_H
|
||||
#define SIO_UNIX_H
|
||||
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/netif.h"
|
||||
#include "netif/fifo.h"
|
||||
/*#include "netif/pppif.h"*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
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 received, 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 );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
err_t tapif_init(struct netif *netif);
|
||||
void tapif_poll(struct netif *netif);
|
||||
#if NO_SYS
|
||||
int tapif_select(struct netif *netif);
|
||||
#endif /* NO_SYS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_TAPIF_H */
|
||||
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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_VDEIF_H
|
||||
#define LWIP_VDEIF_H
|
||||
|
||||
#include "lwip/netif.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
err_t vdeif_init(struct netif *netif);
|
||||
void vdeif_poll(struct netif *netif);
|
||||
#if NO_SYS
|
||||
int vdeif_select(struct netif *netif);
|
||||
#endif /* NO_SYS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_VDEIF_H */
|
||||
139
lwip/lwip-2.2.1/contrib/ports/unix/port/netif/fifo.c
Normal file
139
lwip/lwip-2.2.1/contrib/ports/unix/port/netif/fifo.c
Normal file
@ -0,0 +1,139 @@
|
||||
/* 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;
|
||||
}
|
||||
152
lwip/lwip-2.2.1/contrib/ports/unix/port/netif/list.c
Normal file
152
lwip/lwip-2.2.1/contrib/ports/unix/port/netif/list.c
Normal file
@ -0,0 +1,152 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
207
lwip/lwip-2.2.1/contrib/ports/unix/port/netif/pcapif.c
Normal file
207
lwip/lwip-2.2.1/contrib/ports/unix/port/netif/pcapif.c
Normal file
@ -0,0 +1,207 @@
|
||||
/*
|
||||
* 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 "lwip/sys.h"
|
||||
|
||||
#include "lwip/ip.h"
|
||||
|
||||
|
||||
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);
|
||||
|
||||
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 */
|
||||
490
lwip/lwip-2.2.1/contrib/ports/unix/port/netif/sio.c
Normal file
490
lwip/lwip-2.2.1/contrib/ports/unix/port/netif/sio.c
Normal file
@ -0,0 +1,490 @@
|
||||
/* Author: Magnus Ivarsson <magnus.ivarsson@volvo.com> */
|
||||
|
||||
/* to get rid of implicit function declarations */
|
||||
#ifndef __FreeBSD__
|
||||
/* defining this on FreeBSD hides non-standard defines that sio.c depends on */
|
||||
#define _XOPEN_SOURCE 600
|
||||
#endif
|
||||
#define _GNU_SOURCE
|
||||
|
||||
/* build with Darwin C extensions not part of POSIX, i.e. FASYNC, SIGIO.
|
||||
we can't use LWIP_UNIX_MACH because extensions need to be turned
|
||||
on before any system headers (which are pulled in through cc.h)
|
||||
are included */
|
||||
#if defined(__APPLE__)
|
||||
#define _DARWIN_C_SOURCE
|
||||
#endif
|
||||
|
||||
#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) || defined(LWIP_UNIX_MACH)
|
||||
#include <util.h>
|
||||
#elif defined(LWIP_UNIX_FREEBSD)
|
||||
#include <libutil.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 don't 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)
|
||||
memset(&saio, 0, sizeof(struct sigaction));
|
||||
/* 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;
|
||||
}
|
||||
|
||||
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, const 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;
|
||||
}
|
||||
}
|
||||
432
lwip/lwip-2.2.1/contrib/ports/unix/port/netif/tapif.c
Normal file
432
lwip/lwip-2.2.1/contrib/ports/unix/port/netif/tapif.c
Normal file
@ -0,0 +1,432 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
#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) - 1);
|
||||
} else {
|
||||
strncpy(ifr.ifr_name, DEVTAP_DEFAULT_IF, sizeof(ifr.ifr_name) - 1);
|
||||
}
|
||||
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[1518]; /* max packet size including VLAN excluding CRC */
|
||||
ssize_t written;
|
||||
|
||||
#if 0
|
||||
if (((double)rand()/(double)RAND_MAX) < 0.2) {
|
||||
printf("drop output\n");
|
||||
return ERR_OK; /* ERR_OK because we simulate packet loss on cable */
|
||||
}
|
||||
#endif
|
||||
|
||||
if (p->tot_len > sizeof(buf)) {
|
||||
MIB2_STATS_NETIF_INC(netif, ifoutdiscards);
|
||||
perror("tapif: packet too large");
|
||||
return ERR_IF;
|
||||
}
|
||||
|
||||
/* 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 < p->tot_len) {
|
||||
MIB2_STATS_NETIF_INC(netif, ifoutdiscards);
|
||||
perror("tapif: write");
|
||||
return ERR_IF;
|
||||
} 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[1518]; /* max packet size including VLAN excluding CRC */
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
tapif_poll(struct netif *netif)
|
||||
{
|
||||
tapif_input(netif);
|
||||
}
|
||||
|
||||
#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 */
|
||||
344
lwip/lwip-2.2.1/contrib/ports/unix/port/netif/vdeif.c
Normal file
344
lwip/lwip-2.2.1/contrib/ports/unix/port/netif/vdeif.c
Normal file
@ -0,0 +1,344 @@
|
||||
/*
|
||||
* VDE (virtual distributed ethernet) interface for ale4net
|
||||
* (based on tapif interface Adam Dunkels <adam@sics.se>)
|
||||
* 2005,2010,2011,2023 Renzo Davoli University of Bologna - Italy
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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"
|
||||
#include <libvdeplug.h>
|
||||
|
||||
#include "netif/vdeif.h"
|
||||
|
||||
/* Define those to better describe your network interface. */
|
||||
#define IFNAME0 'v'
|
||||
#define IFNAME1 'd'
|
||||
|
||||
#ifndef VDEIF_DEBUG
|
||||
#define VDEIF_DEBUG LWIP_DBG_OFF
|
||||
#endif
|
||||
|
||||
static char vdedescr[] = "lwip";
|
||||
|
||||
struct vdeif {
|
||||
VDECONN *vdeconn;
|
||||
};
|
||||
|
||||
/* Forward declarations. */
|
||||
static void vdeif_input(struct netif *netif);
|
||||
#if !NO_SYS
|
||||
static void vdeif_thread(void *arg);
|
||||
#endif /* !NO_SYS */
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
low_level_init(struct netif *netif, char *vderl)
|
||||
{
|
||||
struct vdeif *vdeif;
|
||||
int randaddr;
|
||||
struct timeval now;
|
||||
|
||||
vdeif = (struct vdeif *)netif->state;
|
||||
gettimeofday(&now, NULL);
|
||||
srand(now.tv_sec + now.tv_usec);
|
||||
randaddr = rand();
|
||||
|
||||
/* Obtain MAC address from network interface. */
|
||||
|
||||
/* (We just fake an address...) */
|
||||
netif->hwaddr[0] = 0x02;
|
||||
netif->hwaddr[1] = 0x2;
|
||||
netif->hwaddr[2] = randaddr >> 24;
|
||||
netif->hwaddr[3] = randaddr >> 16;
|
||||
netif->hwaddr[4] = randaddr >> 8;
|
||||
netif->hwaddr[5] = randaddr;
|
||||
netif->hwaddr_len = 6;
|
||||
|
||||
/* device capabilities */
|
||||
netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_IGMP;
|
||||
|
||||
vdeif->vdeconn = vde_open(vderl, vdedescr, NULL);
|
||||
LWIP_DEBUGF(VDEIF_DEBUG, ("vdeif_init: ok = %d\n", !!vdeif->vdeconn));
|
||||
if (vdeif->vdeconn == NULL) {
|
||||
perror("vdeif_init: cannot open vde net");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
netif_set_link_up(netif);
|
||||
|
||||
#if !NO_SYS
|
||||
sys_thread_new("vdeif_thread", vdeif_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 vdeif *vdeif = (struct vdeif *)netif->state;
|
||||
char buf[1518]; /* max packet size including VLAN excluding CRC */
|
||||
ssize_t written;
|
||||
|
||||
if (p->tot_len > sizeof(buf)) {
|
||||
MIB2_STATS_NETIF_INC(netif, ifoutdiscards);
|
||||
perror("vdeif: packet too large");
|
||||
return ERR_IF;
|
||||
}
|
||||
|
||||
/* initiate transfer(); */
|
||||
pbuf_copy_partial(p, buf, p->tot_len, 0);
|
||||
|
||||
/* signal that packet should be sent(); */
|
||||
written = vde_send(vdeif->vdeconn, buf, p->tot_len, 0);
|
||||
if (written < p->tot_len) {
|
||||
MIB2_STATS_NETIF_INC(netif, ifoutdiscards);
|
||||
perror("vdeif: write");
|
||||
return ERR_IF;
|
||||
} 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[1518]; /* max packet size including VLAN excluding CRC */
|
||||
struct vdeif *vdeif = (struct vdeif *)netif->state;
|
||||
|
||||
/* Obtain the size of the packet and put it into the "len"
|
||||
variable. */
|
||||
readlen = vde_recv(vdeif->vdeconn, buf, sizeof(buf), 0);
|
||||
if (readlen < 0) {
|
||||
perror("read returned -1");
|
||||
exit(1);
|
||||
}
|
||||
len = (u16_t)readlen;
|
||||
|
||||
MIB2_STATS_NETIF_ADD(netif, ifinoctets, len);
|
||||
|
||||
/* 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, ("vdeif_input: could not allocate pbuf\n"));
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* vdeif_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
|
||||
vdeif_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(VDEIF_DEBUG, ("vdeif_input: low_level_input returned NULL\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (netif->input(p, netif) != ERR_OK) {
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("vdeif_input: netif input error\n"));
|
||||
pbuf_free(p);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* vdeif_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
|
||||
vdeif_init(struct netif *netif)
|
||||
{
|
||||
char *vderl = (char *) netif->state;
|
||||
struct vdeif *vdeif = (struct vdeif *)mem_malloc(sizeof(struct vdeif));
|
||||
|
||||
if (vdeif == NULL) {
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("vdeif_init: out of memory for vdeif\n"));
|
||||
return ERR_MEM;
|
||||
}
|
||||
netif->state = vdeif;
|
||||
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, vderl);
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
vdeif_poll(struct netif *netif)
|
||||
{
|
||||
vdeif_input(netif);
|
||||
}
|
||||
|
||||
#if NO_SYS
|
||||
|
||||
int
|
||||
vdeif_select(struct netif *netif)
|
||||
{
|
||||
fd_set fdset;
|
||||
int ret;
|
||||
struct timeval tv;
|
||||
struct vdeif *vdeif;
|
||||
u32_t msecs = sys_timeouts_sleeptime();
|
||||
int datafd;
|
||||
|
||||
vdeif = (struct vdeif *)netif->state;
|
||||
datafd = vde_datafd(vdeif->vdeconn);
|
||||
|
||||
tv.tv_sec = msecs / 1000;
|
||||
tv.tv_usec = (msecs % 1000) * 1000;
|
||||
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(datafd, &fdset);
|
||||
|
||||
ret = select(datafd + 1, &fdset, NULL, NULL, &tv);
|
||||
if (ret > 0) {
|
||||
vdeif_input(netif);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#else /* NO_SYS */
|
||||
|
||||
static void
|
||||
vdeif_thread(void *arg)
|
||||
{
|
||||
struct netif *netif;
|
||||
struct vdeif *vdeif;
|
||||
fd_set fdset;
|
||||
int ret;
|
||||
int datafd;
|
||||
|
||||
netif = (struct netif *)arg;
|
||||
vdeif = (struct vdeif *)netif->state;
|
||||
datafd = vde_datafd(vdeif->vdeconn);
|
||||
|
||||
while(1) {
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(datafd, &fdset);
|
||||
|
||||
/* Wait for a packet to arrive. */
|
||||
ret = select(datafd + 1, &fdset, NULL, NULL, NULL);
|
||||
|
||||
if(ret == 1) {
|
||||
/* Handle incoming packet. */
|
||||
vdeif_input(netif);
|
||||
} else if(ret == -1) {
|
||||
perror("vdeif_thread: select");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* NO_SYS */
|
||||
65
lwip/lwip-2.2.1/contrib/ports/unix/port/perf.c
Normal file
65
lwip/lwip-2.2.1/contrib/ports/unix/port/perf.c
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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");
|
||||
}
|
||||
|
||||
840
lwip/lwip-2.2.1/contrib/ports/unix/port/sys_arch.c
Normal file
840
lwip/lwip-2.2.1/contrib/ports/unix/port/sys_arch.c
Normal file
@ -0,0 +1,840 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
#define _GNU_SOURCE /* pull in pthread_setname_np() on Linux */
|
||||
|
||||
#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"
|
||||
#include "lwip/tcpip.h"
|
||||
|
||||
#if LWIP_NETCONN_SEM_PER_THREAD
|
||||
/* pthread key to *our* thread local storage entry */
|
||||
static pthread_key_t sys_thread_sem_key;
|
||||
#endif
|
||||
|
||||
/* Return code for an interrupted timed wait */
|
||||
#define SYS_ARCH_INTR 0xfffffffeUL
|
||||
|
||||
u32_t
|
||||
lwip_port_rand(void)
|
||||
{
|
||||
return (u32_t)rand();
|
||||
}
|
||||
|
||||
static void
|
||||
get_monotonic_time(struct timespec *ts)
|
||||
{
|
||||
#ifdef LWIP_UNIX_MACH
|
||||
/* darwin impl (no CLOCK_MONOTONIC) */
|
||||
u64_t t = mach_absolute_time();
|
||||
mach_timebase_info_data_t timebase_info = {0, 0};
|
||||
mach_timebase_info(&timebase_info);
|
||||
u64_t nano = (t * timebase_info.numer) / (timebase_info.denom);
|
||||
u64_t sec = nano/1000000000L;
|
||||
nano -= sec * 1000000000L;
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nano;
|
||||
#else
|
||||
clock_gettime(CLOCK_MONOTONIC, ts);
|
||||
#endif
|
||||
}
|
||||
|
||||
#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 */
|
||||
|
||||
#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;
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
struct thread_wrapper_data
|
||||
{
|
||||
lwip_thread_fn function;
|
||||
void *arg;
|
||||
};
|
||||
|
||||
static void *
|
||||
thread_wrapper(void *arg)
|
||||
{
|
||||
struct thread_wrapper_data *thread_data = (struct thread_wrapper_data *)arg;
|
||||
|
||||
thread_data->function(thread_data->arg);
|
||||
|
||||
/* we should never get here */
|
||||
free(arg);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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;
|
||||
struct thread_wrapper_data *thread_data;
|
||||
LWIP_UNUSED_ARG(name);
|
||||
LWIP_UNUSED_ARG(stacksize);
|
||||
LWIP_UNUSED_ARG(prio);
|
||||
|
||||
thread_data = (struct thread_wrapper_data *)malloc(sizeof(struct thread_wrapper_data));
|
||||
thread_data->arg = arg;
|
||||
thread_data->function = function;
|
||||
code = pthread_create(&tmp,
|
||||
NULL,
|
||||
thread_wrapper,
|
||||
thread_data);
|
||||
|
||||
#ifdef LWIP_UNIX_LINUX
|
||||
pthread_setname_np(tmp, name);
|
||||
#endif
|
||||
|
||||
if (0 == code) {
|
||||
st = introduce_thread(tmp);
|
||||
}
|
||||
|
||||
if (NULL == st) {
|
||||
LWIP_DEBUGF(SYS_DEBUG, ("sys_thread_new: pthread_create %d, st = 0x%lx\n",
|
||||
code, (unsigned long)st));
|
||||
abort();
|
||||
}
|
||||
return st;
|
||||
}
|
||||
|
||||
#if LWIP_TCPIP_CORE_LOCKING
|
||||
static pthread_t lwip_core_lock_holder_thread_id;
|
||||
void sys_lock_tcpip_core(void)
|
||||
{
|
||||
sys_mutex_lock(&lock_tcpip_core);
|
||||
lwip_core_lock_holder_thread_id = pthread_self();
|
||||
}
|
||||
|
||||
void sys_unlock_tcpip_core(void)
|
||||
{
|
||||
lwip_core_lock_holder_thread_id = 0;
|
||||
sys_mutex_unlock(&lock_tcpip_core);
|
||||
}
|
||||
#endif /* LWIP_TCPIP_CORE_LOCKING */
|
||||
|
||||
static pthread_t lwip_tcpip_thread_id;
|
||||
void sys_mark_tcpip_thread(void)
|
||||
{
|
||||
lwip_tcpip_thread_id = pthread_self();
|
||||
}
|
||||
|
||||
void sys_check_core_locking(void)
|
||||
{
|
||||
/* Embedded systems should check we are NOT in an interrupt context here */
|
||||
|
||||
if (lwip_tcpip_thread_id != 0) {
|
||||
pthread_t current_thread_id = pthread_self();
|
||||
|
||||
#if LWIP_TCPIP_CORE_LOCKING
|
||||
LWIP_ASSERT("Function called without core lock", current_thread_id == lwip_core_lock_holder_thread_id);
|
||||
#else /* LWIP_TCPIP_CORE_LOCKING */
|
||||
LWIP_ASSERT("Function called from wrong thread", current_thread_id == lwip_tcpip_thread_id);
|
||||
#endif /* LWIP_TCPIP_CORE_LOCKING */
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* 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;
|
||||
}
|
||||
|
||||
err_t
|
||||
sys_mbox_trypost_fromisr(sys_mbox_t *q, void *msg)
|
||||
{
|
||||
return sys_mbox_trypost(q, msg);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
#ifdef LWIP_UNIX_HURD
|
||||
#define pthread_cond_wait pthread_hurd_cond_wait_np
|
||||
#define pthread_cond_timedwait pthread_hurd_cond_timedwait_np
|
||||
#endif
|
||||
|
||||
if (timeout == 0) {
|
||||
ret = pthread_cond_wait(cond, mutex);
|
||||
return
|
||||
#ifdef LWIP_UNIX_HURD
|
||||
/* On the Hurd, ret == 1 means the RPC has been cancelled.
|
||||
* The thread is awakened (not terminated) and execution must continue */
|
||||
ret == 1 ? SYS_ARCH_INTR :
|
||||
#endif
|
||||
(u32_t)ret;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
#ifdef LWIP_UNIX_HURD
|
||||
/* On the Hurd, ret == 1 means the RPC has been cancelled.
|
||||
* The thread is awakened (not terminated) and execution must continue */
|
||||
} else if (ret == EINTR) {
|
||||
return SYS_ARCH_INTR;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* 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;
|
||||
#ifdef LWIP_UNIX_HURD
|
||||
} else if(time_needed == SYS_ARCH_INTR) {
|
||||
pthread_mutex_unlock(&(sem->mutex));
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
/* pthread_mutex_unlock(&(sem->mutex));
|
||||
return time_needed; */
|
||||
} else if(cond_wait(&(sem->cond), &(sem->mutex), 0)) {
|
||||
/* Some error happened or the thread has been awakened but not by lwip */
|
||||
pthread_mutex_unlock(&(sem->mutex));
|
||||
return 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 */
|
||||
|
||||
#if LWIP_NETCONN_SEM_PER_THREAD
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Semaphore per thread located TLS */
|
||||
|
||||
static void
|
||||
sys_thread_sem_free(void* data)
|
||||
{
|
||||
sys_sem_t *sem = (sys_sem_t*)(data);
|
||||
|
||||
if (sem) {
|
||||
sys_sem_free(sem);
|
||||
free(sem);
|
||||
}
|
||||
}
|
||||
|
||||
static sys_sem_t*
|
||||
sys_thread_sem_alloc(void)
|
||||
{
|
||||
sys_sem_t *sem;
|
||||
err_t err;
|
||||
int ret;
|
||||
|
||||
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);
|
||||
ret = pthread_setspecific(sys_thread_sem_key, sem);
|
||||
LWIP_ASSERT("failed to initialise TLS semaphore storage", ret == 0);
|
||||
return sem;
|
||||
}
|
||||
|
||||
sys_sem_t*
|
||||
sys_arch_netconn_sem_get(void)
|
||||
{
|
||||
sys_sem_t* sem = (sys_sem_t*)pthread_getspecific(sys_thread_sem_key);
|
||||
if (!sem) {
|
||||
sem = sys_thread_sem_alloc();
|
||||
}
|
||||
LWIP_DEBUGF(SYS_DEBUG, ("sys_thread_sem_get s=%p\n", (void*)sem));
|
||||
return sem;
|
||||
}
|
||||
|
||||
void
|
||||
sys_arch_netconn_sem_alloc(void)
|
||||
{
|
||||
sys_sem_t* sem = sys_thread_sem_alloc();
|
||||
LWIP_DEBUGF(SYS_DEBUG, ("sys_thread_sem created s=%p\n", (void*)sem));
|
||||
}
|
||||
|
||||
void
|
||||
sys_arch_netconn_sem_free(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
sys_sem_t *sem = (sys_sem_t *)pthread_getspecific(sys_thread_sem_key);
|
||||
sys_thread_sem_free(sem);
|
||||
ret = pthread_setspecific(sys_thread_sem_key, NULL);
|
||||
LWIP_ASSERT("failed to de-init TLS semaphore storage", ret == 0);
|
||||
}
|
||||
#endif /* LWIP_NETCONN_SEM_PER_THREAD */
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Time */
|
||||
u32_t
|
||||
sys_now(void)
|
||||
{
|
||||
struct timespec ts;
|
||||
u32_t now;
|
||||
|
||||
get_monotonic_time(&ts);
|
||||
now = (u32_t)(ts.tv_sec * 1000L + ts.tv_nsec / 1000000L);
|
||||
#ifdef LWIP_FUZZ_SYS_NOW
|
||||
now += sys_now_offset;
|
||||
#endif
|
||||
return now;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
#if LWIP_NETCONN_SEM_PER_THREAD
|
||||
pthread_key_create(&sys_thread_sem_key, sys_thread_sem_free);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* 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())
|
||||
{
|
||||
lwprot_count--;
|
||||
if (lwprot_count == 0)
|
||||
{
|
||||
lwprot_thread = (pthread_t) 0xDEAD;
|
||||
pthread_mutex_unlock(&lwprot_mutex);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* SYS_LIGHTWEIGHT_PROT */
|
||||
|
||||
#if !NO_SYS
|
||||
/* get keyboard state to terminate the debug app by using select */
|
||||
int
|
||||
lwip_unix_keypressed(void)
|
||||
{
|
||||
struct timeval tv = { 0L, 0L };
|
||||
fd_set fds;
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(0, &fds);
|
||||
return select(1, &fds, NULL, NULL, &tv);
|
||||
}
|
||||
#endif /* !NO_SYS */
|
||||
94
lwip/lwip-2.2.1/contrib/ports/unix/posixlib/CMakeLists.txt
Normal file
94
lwip/lwip-2.2.1/contrib/ports/unix/posixlib/CMakeLists.txt
Normal file
@ -0,0 +1,94 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
project(liblwip
|
||||
VERSION 2.2.0
|
||||
DESCRIPTION "lwip library for linux"
|
||||
HOMEPAGE_URL "http://wiki.virtualsquare.org"
|
||||
LANGUAGES C)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(CheckIncludeFile)
|
||||
|
||||
set (BUILD_SHARED_LIBS ON)
|
||||
|
||||
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
message(FATAL_ERROR "Lwip shared library is only working on Linux or the Hurd")
|
||||
endif()
|
||||
|
||||
set(LWIP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../..)
|
||||
|
||||
find_library(LIB_VDEPLUGOK vdeplug)
|
||||
check_include_file(libvdeplug.h INCLUDE_VDEPLUGOK)
|
||||
if (LIB_VDEPLUGOK AND INCLUDE_VDEPLUGOK)
|
||||
message(STATUS "Found libvdeplug: vde support added")
|
||||
else()
|
||||
message(STATUS "Libvdeplug needs to be installed to add vde support")
|
||||
endif()
|
||||
|
||||
include(${LWIP_DIR}/contrib/ports/CMakeCommon.cmake)
|
||||
|
||||
set (LWIP_DEFINITIONS -DLWIP_DEBUG)
|
||||
set (LWIP_INCLUDE_DIRS
|
||||
"include"
|
||||
"${LWIP_DIR}/src/include"
|
||||
"${LWIP_CONTRIB_DIR}/"
|
||||
"${LWIP_CONTRIB_DIR}/ports/unix/port/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/"
|
||||
)
|
||||
|
||||
set (LWIP_EXCLUDE_SLIPIF TRUE)
|
||||
include(${LWIP_CONTRIB_DIR}/ports/unix/Filelists.cmake)
|
||||
include(${LWIP_DIR}/src/Filelists.cmake)
|
||||
if (LIB_VDEPLUGOK AND INCLUDE_VDEPLUGOK)
|
||||
set(lwipnoapps_SRCS ${lwipnoapps_SRCS}
|
||||
${LWIP_DIR}/contrib/ports/unix/port/netif/vdeif.c)
|
||||
endif()
|
||||
|
||||
add_library(lwip ${lwipnoapps_SRCS} ${lwipcontribportunix_SRCS} ${lwipcontribportunixnetifs_SRCS})
|
||||
target_compile_options(lwip PRIVATE ${LWIP_COMPILER_FLAGS})
|
||||
target_compile_definitions(lwip PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS})
|
||||
target_include_directories(lwip PRIVATE ${LWIP_INCLUDE_DIRS} ${LWIP_MBEDTLS_INCLUDE_DIRS})
|
||||
if (LIB_VDEPLUGOK AND INCLUDE_VDEPLUGOK)
|
||||
target_link_libraries(lwip ${LWIP_SANITIZER_LIBS} vdeplug)
|
||||
else()
|
||||
target_link_libraries(lwip ${LWIP_SANITIZER_LIBS})
|
||||
endif()
|
||||
|
||||
find_library(LIBPTHREAD pthread)
|
||||
target_link_libraries(lwip ${LIBPTHREAD})
|
||||
|
||||
install(TARGETS lwip
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
set_target_properties(lwip PROPERTIES VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR})
|
||||
|
||||
install(DIRECTORY "${LWIP_DIR}/src/include/lwip"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/lwip"
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
|
||||
install(DIRECTORY "${LWIP_DIR}/src/include/netif"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/lwip"
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
|
||||
install(FILES lwipopts.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/lwip")
|
||||
|
||||
install(DIRECTORY "${LWIP_DIR}/contrib/ports/unix/port/include/arch"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/lwip"
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
|
||||
install(DIRECTORY "${LWIP_DIR}/contrib/ports/unix/port/include/netif"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/lwip"
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
|
||||
install(DIRECTORY "${LWIP_DIR}/contrib/ports/unix/posixlib/include/posix"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/lwip"
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
|
||||
add_custom_target(uninstall
|
||||
"${CMAKE_COMMAND}" -P "${PROJECT_SOURCE_DIR}/Uninstall.cmake")
|
||||
|
||||
22
lwip/lwip-2.2.1/contrib/ports/unix/posixlib/Uninstall.cmake
Normal file
22
lwip/lwip-2.2.1/contrib/ports/unix/posixlib/Uninstall.cmake
Normal file
@ -0,0 +1,22 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
set(MANIFEST "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt")
|
||||
|
||||
if(NOT EXISTS ${MANIFEST})
|
||||
message(FATAL_ERROR "Cannot find install manifest: '${MANIFEST}'")
|
||||
endif()
|
||||
|
||||
file(STRINGS ${MANIFEST} files)
|
||||
foreach(file ${files})
|
||||
if(EXISTS ${file} OR IS_SYMLINK ${file})
|
||||
message(STATUS "Removing: ${file}")
|
||||
|
||||
execute_process(
|
||||
COMMAND rm -f ${file}
|
||||
RESULT_VARIABLE retcode
|
||||
)
|
||||
|
||||
if(NOT "${retcode}" STREQUAL "0")
|
||||
message(WARNING "Failed to remove: ${file}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach(file)
|
||||
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Joan Lled<65> <jlledom@member.fsf.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef HURD_LWIP_POSIX_INET_H
|
||||
#define HURD_LWIP_POSIX_INET_H
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if LWIP_IPV4
|
||||
|
||||
#define inet_addr_from_ip4addr(target_inaddr, source_ipaddr) ((target_inaddr)->s_addr = ip4_addr_get_u32(source_ipaddr))
|
||||
#define inet_addr_to_ip4addr(target_ipaddr, source_inaddr) (ip4_addr_set_u32(target_ipaddr, (source_inaddr)->s_addr))
|
||||
|
||||
#ifdef LWIP_UNIX_HURD
|
||||
#define IP_PKTINFO 8
|
||||
|
||||
struct in_pktinfo {
|
||||
unsigned int ipi_ifindex; /* Interface index */
|
||||
struct in_addr ipi_addr; /* Destination (from header) address */
|
||||
};
|
||||
#endif /* LWIP_UNIX_HURD */
|
||||
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
#if LWIP_IPV6
|
||||
#define inet6_addr_from_ip6addr(target_in6addr, source_ip6addr) {(target_in6addr)->s6_addr32[0] = (source_ip6addr)->addr[0]; \
|
||||
(target_in6addr)->s6_addr32[1] = (source_ip6addr)->addr[1]; \
|
||||
(target_in6addr)->s6_addr32[2] = (source_ip6addr)->addr[2]; \
|
||||
(target_in6addr)->s6_addr32[3] = (source_ip6addr)->addr[3];}
|
||||
#define inet6_addr_to_ip6addr(target_ip6addr, source_in6addr) {(target_ip6addr)->addr[0] = (source_in6addr)->s6_addr32[0]; \
|
||||
(target_ip6addr)->addr[1] = (source_in6addr)->s6_addr32[1]; \
|
||||
(target_ip6addr)->addr[2] = (source_in6addr)->s6_addr32[2]; \
|
||||
(target_ip6addr)->addr[3] = (source_in6addr)->s6_addr32[3]; \
|
||||
ip6_addr_clear_zone(target_ip6addr);}
|
||||
/* ATTENTION: the next define only works because both in6_addr and ip6_addr_t are an u32_t[4] effectively! */
|
||||
#define inet6_addr_to_ip6addr_p(target_ip6addr_p, source_in6addr) ((target_ip6addr_p) = (ip6_addr_t*)(source_in6addr))
|
||||
#endif /* LWIP_IPV6 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HURD_LWIP_POSIX_INET_H */
|
||||
@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Joan Lled<65> <jlledom@member.fsf.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef HURD_LWIP_POSIX_SOCKET_H
|
||||
#define HURD_LWIP_POSIX_SOCKET_H
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <poll.h>
|
||||
#include <errno.h>
|
||||
#include LWIP_SOCKET_EXTERNAL_HEADER_INET_H
|
||||
typedef size_t msg_iovlen_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _HAVE_SA_LEN
|
||||
#define HAVE_SA_LEN _HAVE_SA_LEN
|
||||
#else
|
||||
#define HAVE_SA_LEN 0
|
||||
#endif /* _HAVE_SA_LEN */
|
||||
|
||||
/* Address length safe read and write */
|
||||
#if HAVE_SA_LEN
|
||||
#define IP4ADDR_SOCKADDR_SET_LEN(sin) \
|
||||
(sin)->sin_len = sizeof(struct sockaddr_in)
|
||||
#define IP6ADDR_SOCKADDR_SET_LEN(sin6) \
|
||||
(sin6)->sin6_len = sizeof(struct sockaddr_in6)
|
||||
#define IPADDR_SOCKADDR_GET_LEN(addr) \
|
||||
(addr)->sa.sa_len
|
||||
#else
|
||||
#define IP4ADDR_SOCKADDR_SET_LEN(addr)
|
||||
#define IP6ADDR_SOCKADDR_SET_LEN(addr)
|
||||
#define IPADDR_SOCKADDR_GET_LEN(addr) \
|
||||
((addr)->sa.sa_family == AF_INET ? sizeof(struct sockaddr_in) \
|
||||
: ((addr)->sa.sa_family == AF_INET6 ? sizeof(struct sockaddr_in6) : 0))
|
||||
#endif /* HAVE_SA_LEN */
|
||||
|
||||
#define SIN_ZERO_LEN sizeof (struct sockaddr) - \
|
||||
__SOCKADDR_COMMON_SIZE - \
|
||||
sizeof (in_port_t) - \
|
||||
sizeof (struct in_addr)
|
||||
|
||||
#if !defined IOV_MAX
|
||||
#define IOV_MAX 0xFFFF
|
||||
#elif IOV_MAX > 0xFFFF
|
||||
#error "IOV_MAX larger than supported by LwIP"
|
||||
#endif /* IOV_MAX */
|
||||
|
||||
#define LWIP_SELECT_MAXNFDS (FD_SETSIZE + LWIP_SOCKET_OFFSET)
|
||||
|
||||
#if LWIP_UDP && LWIP_UDPLITE
|
||||
/*
|
||||
* Options for level IPPROTO_UDPLITE
|
||||
*/
|
||||
#define UDPLITE_SEND_CSCOV 0x01 /* sender checksum coverage */
|
||||
#define UDPLITE_RECV_CSCOV 0x02 /* minimal receiver checksum coverage */
|
||||
#endif /* LWIP_UDP && LWIP_UDPLITE*/
|
||||
|
||||
#if 0
|
||||
void lwip_socket_thread_init(void); /* LWIP_NETCONN_SEM_PER_THREAD==1: initialize thread-local semaphore */
|
||||
void lwip_socket_thread_cleanup(void); /* LWIP_NETCONN_SEM_PER_THREAD==1: destroy thread-local semaphore */
|
||||
|
||||
int lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
|
||||
int lwip_bind(int s, const struct sockaddr *name, socklen_t namelen);
|
||||
int lwip_shutdown(int s, int how);
|
||||
int lwip_getpeername (int s, struct sockaddr *name, socklen_t *namelen);
|
||||
int lwip_getsockname (int s, struct sockaddr *name, socklen_t *namelen);
|
||||
int lwip_getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen);
|
||||
int lwip_setsockopt (int s, int level, int optname, const void *optval, socklen_t optlen);
|
||||
int lwip_close(int s);
|
||||
int lwip_connect(int s, const struct sockaddr *name, socklen_t namelen);
|
||||
int lwip_listen(int s, int backlog);
|
||||
ssize_t lwip_recv(int s, void *mem, size_t len, int flags);
|
||||
ssize_t lwip_read(int s, void *mem, size_t len);
|
||||
ssize_t lwip_readv(int s, const struct iovec *iov, int iovcnt);
|
||||
ssize_t lwip_recvfrom(int s, void *mem, size_t len, int flags,
|
||||
struct sockaddr *from, socklen_t *fromlen);
|
||||
ssize_t lwip_recvmsg(int s, struct msghdr *message, int flags);
|
||||
ssize_t lwip_send(int s, const void *dataptr, size_t size, int flags);
|
||||
ssize_t lwip_sendmsg(int s, const struct msghdr *message, int flags);
|
||||
ssize_t lwip_sendto(int s, const void *dataptr, size_t size, int flags,
|
||||
const struct sockaddr *to, socklen_t tolen);
|
||||
int lwip_socket(int domain, int type, int protocol);
|
||||
ssize_t lwip_write(int s, const void *dataptr, size_t size);
|
||||
ssize_t lwip_writev(int s, const struct iovec *iov, int iovcnt);
|
||||
#if LWIP_SOCKET_SELECT
|
||||
int lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
|
||||
struct timeval *timeout);
|
||||
#endif
|
||||
#if LWIP_SOCKET_POLL
|
||||
int lwip_poll(struct pollfd *fds, nfds_t nfds, int timeout);
|
||||
#endif
|
||||
int lwip_ioctl(int s, long cmd, void *argp);
|
||||
int lwip_fcntl(int s, int cmd, int val);
|
||||
const char *lwip_inet_ntop(int af, const void *src, char *dst, socklen_t size);
|
||||
int lwip_inet_pton(int af, const char *src, void *dst);
|
||||
#endif
|
||||
|
||||
/* Unsupported identifiers */
|
||||
#ifndef SO_NO_CHECK
|
||||
#define SO_NO_CHECK 0xFF
|
||||
#endif
|
||||
#ifndef SO_BINDTODEVICE
|
||||
#define SO_BINDTODEVICE 0xFE
|
||||
#endif
|
||||
#ifndef MSG_MORE
|
||||
#define MSG_MORE 0x0
|
||||
#endif
|
||||
#ifndef TCP_KEEPALIVE
|
||||
#define TCP_KEEPALIVE 0xFF
|
||||
#endif
|
||||
#ifndef TCP_KEEPIDLE
|
||||
#define TCP_KEEPIDLE 0xFE
|
||||
#endif
|
||||
#ifndef TCP_KEEPINTVL
|
||||
#define TCP_KEEPINTVL 0xFD
|
||||
#endif
|
||||
#ifndef TCP_KEEPCNT
|
||||
#define TCP_KEEPCNT 0xFC
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HURD_LWIP_POSIX_SOCKET_H */
|
||||
180
lwip/lwip-2.2.1/contrib/ports/unix/posixlib/lwipopts.h
Normal file
180
lwip/lwip-2.2.1/contrib/ports/unix/posixlib/lwipopts.h
Normal file
@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Joan Lled<65> <jlledom@member.fsf.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef UNIX_LWIP_LWIPOPTS_H
|
||||
#define UNIX_LWIP_LWIPOPTS_H
|
||||
|
||||
/* An OS is present */
|
||||
#define NO_SYS 0
|
||||
|
||||
/* Sockets API config */
|
||||
#define LWIP_COMPAT_SOCKETS 0
|
||||
#define LWIP_SOCKET_OFFSET 1
|
||||
#define LWIP_POLL 1
|
||||
|
||||
/* User posix socket headers */
|
||||
#define LWIP_SOCKET_EXTERNAL_HEADERS 1
|
||||
#define LWIP_SOCKET_EXTERNAL_HEADER_SOCKETS_H "posix/sockets.h"
|
||||
#define LWIP_SOCKET_EXTERNAL_HEADER_INET_H "posix/inet.h"
|
||||
#define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS 1
|
||||
|
||||
/* Use Glibc malloc()/free() */
|
||||
#define MEM_LIBC_MALLOC 1
|
||||
#define MEMP_MEM_MALLOC 1
|
||||
#define MEM_USE_POOLS 0
|
||||
|
||||
/* Only send complete packets to the device */
|
||||
#define LWIP_NETIF_TX_SINGLE_PBUF 1
|
||||
|
||||
/* Randomize local ports */
|
||||
#define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS 1
|
||||
|
||||
/* Glibc sends more than one packet in a row during an ARP resolution */
|
||||
#define ARP_QUEUEING 1
|
||||
#define ARP_QUEUE_LEN 10
|
||||
|
||||
/*
|
||||
* Activate loopback, but don't use lwip's default loopback interface,
|
||||
* we provide our own.
|
||||
*/
|
||||
#define LWIP_NETIF_LOOPBACK 1
|
||||
#define LWIP_HAVE_LOOPIF 0
|
||||
|
||||
/* IPv4 stuff */
|
||||
#define IP_FORWARD 1
|
||||
|
||||
/* SLAAC support and other IPv6 stuff */
|
||||
#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 1
|
||||
#define LWIP_IPV6_SEND_ROUTER_SOLICIT 1
|
||||
#define LWIP_IPV6_AUTOCONFIG 1
|
||||
#define LWIP_IPV6_FORWARD 1
|
||||
#define MEMP_NUM_MLD6_GROUP 16
|
||||
#define LWIP_IPV6_NUM_ADDRESSES 6
|
||||
#define IPV6_FRAG_COPYHEADER 1
|
||||
|
||||
/* TCP tuning */
|
||||
#define TCP_MSS 1460
|
||||
#define TCP_WND 0xFFFF
|
||||
#define LWIP_WND_SCALE 1
|
||||
#define TCP_RCV_SCALE 0x1
|
||||
#define TCP_SND_BUF TCP_WND
|
||||
|
||||
/* Throughput settings */
|
||||
#define LWIP_CHECKSUM_ON_COPY 1
|
||||
|
||||
/* Disable stats */
|
||||
#define LWIP_STATS 0
|
||||
#define LWIP_STATS_DISPLAY 0
|
||||
|
||||
/* Enable all socket operations */
|
||||
#define LWIP_TCP_KEEPALIVE 1
|
||||
#define LWIP_SO_SNDTIMEO 1
|
||||
#define LWIP_SO_RCVTIMEO 1
|
||||
#define LWIP_SO_RCVBUF 1
|
||||
#define LWIP_SO_LINGER 1
|
||||
#define SO_REUSE 1
|
||||
#define LWIP_MULTICAST_TX_OPTIONS 1
|
||||
|
||||
/* Enable modules */
|
||||
#define LWIP_ARP 1
|
||||
#define LWIP_ETHERNET 1
|
||||
#define LWIP_IPV4 1
|
||||
#define LWIP_ICMP 1
|
||||
#define LWIP_IGMP 1
|
||||
#define LWIP_RAW 1
|
||||
#define LWIP_UDP 1
|
||||
#define LWIP_UDPLITE 1
|
||||
#define LWIP_TCP 1
|
||||
#define LWIP_IPV6 1
|
||||
#define LWIP_ICMP6 1
|
||||
#define LWIP_IPV6_MLD 1
|
||||
|
||||
/* Don't abort the whole stack when an error is detected */
|
||||
#define LWIP_NOASSERT_ON_ERROR 1
|
||||
|
||||
/* Threading options */
|
||||
#define LWIP_TCPIP_CORE_LOCKING 1
|
||||
|
||||
/* If the system is 64 bit */
|
||||
#if defined __LP64__
|
||||
#define MEM_ALIGNMENT 8
|
||||
#else
|
||||
#define MEM_ALIGNMENT 4
|
||||
#endif
|
||||
|
||||
#if !NO_SYS
|
||||
void sys_check_core_locking(void);
|
||||
#define LWIP_ASSERT_CORE_LOCKED() sys_check_core_locking()
|
||||
#if 0
|
||||
void sys_mark_tcpip_thread(void);
|
||||
#define LWIP_MARK_TCPIP_THREAD() sys_mark_tcpip_thread()
|
||||
|
||||
#if LWIP_TCPIP_CORE_LOCKING
|
||||
void sys_lock_tcpip_core(void);
|
||||
#define LOCK_TCPIP_CORE() sys_lock_tcpip_core()
|
||||
void sys_unlock_tcpip_core(void);
|
||||
#define UNLOCK_TCPIP_CORE() sys_unlock_tcpip_core()
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Debug mode */
|
||||
#ifdef LWIP_DEBUG
|
||||
#define ETHARP_DEBUG LWIP_DBG_OFF
|
||||
#define NETIF_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 SOCKETS_DEBUG LWIP_DBG_OFF
|
||||
#define ICMP_DEBUG LWIP_DBG_OFF
|
||||
#define IGMP_DEBUG LWIP_DBG_OFF
|
||||
#define INET_DEBUG LWIP_DBG_OFF
|
||||
#define IP_DEBUG LWIP_DBG_OFF
|
||||
#define IP_REASS_DEBUG LWIP_DBG_OFF
|
||||
#define RAW_DEBUG LWIP_DBG_OFF
|
||||
#define MEM_DEBUG LWIP_DBG_OFF
|
||||
#define MEMP_DEBUG LWIP_DBG_OFF
|
||||
#define SYS_DEBUG LWIP_DBG_OFF
|
||||
#define TIMERS_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_INPUT_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_FR_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_OUTPUT_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_RST_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_QLEN_DEBUG LWIP_DBG_OFF
|
||||
#define UDP_DEBUG LWIP_DBG_OFF
|
||||
#define TCPIP_DEBUG LWIP_DBG_OFF
|
||||
#define SLIP_DEBUG LWIP_DBG_OFF
|
||||
#define DHCP_DEBUG LWIP_DBG_OFF
|
||||
#define AUTOIP_DEBUG LWIP_DBG_OFF
|
||||
#define DNS_DEBUG LWIP_DBG_OFF
|
||||
#define IP6_DEBUG LWIP_DBG_OFF
|
||||
#endif
|
||||
|
||||
#endif /* UNIX_LWIP_LWIPOPTS_H */
|
||||
22
lwip/lwip-2.2.1/contrib/ports/unix/setup-tapif
Normal file
22
lwip/lwip-2.2.1/contrib/ports/unix/setup-tapif
Normal file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script needs bridge-util debian package or similar
|
||||
# for other distros.
|
||||
|
||||
# Run 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 example_app.
|
||||
# Enter 192.168.1.200 or "http://lwip.local/" (Zeroconf)
|
||||
# in your webbrowser to see example_app webpage.
|
||||
|
||||
export PRECONFIGURED_TAPIF=tap0
|
||||
|
||||
sudo ip tuntap add dev $PRECONFIGURED_TAPIF mode tap user `whoami`
|
||||
sudo ip link set $PRECONFIGURED_TAPIF up
|
||||
sudo brctl addbr lwipbridge
|
||||
sudo brctl addif lwipbridge $PRECONFIGURED_TAPIF
|
||||
sudo ip addr add 192.168.1.1/24 dev lwipbridge
|
||||
sudo ip link set dev lwipbridge up
|
||||
51
lwip/lwip-2.2.1/contrib/ports/win32/Common.mk
Normal file
51
lwip/lwip-2.2.1/contrib/ports/win32/Common.mk
Normal file
@ -0,0 +1,51 @@
|
||||
#
|
||||
# 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
|
||||
SYSARCH?=$(LWIPARCH)/sys_arch.c
|
||||
ARCHFILES=$(SYSARCH) $(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)
|
||||
46
lwip/lwip-2.2.1/contrib/ports/win32/Filelists.cmake
Normal file
46
lwip/lwip-2.2.1/contrib/ports/win32/Filelists.cmake
Normal file
@ -0,0 +1,46 @@
|
||||
# This file is indended to be included in end-user CMakeLists.txt
|
||||
# include(/path/to/Filelists.cmake)
|
||||
# It assumes the variable LWIP_CONTRIB_DIR is defined pointing to the
|
||||
# root path of lwIP/contrib sources.
|
||||
#
|
||||
# This file is NOT designed (on purpose) to be used as cmake
|
||||
# subdir via add_subdirectory()
|
||||
# The intention is to provide greater flexibility to users to
|
||||
# create their own targets using the *_SRCS variables.
|
||||
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0")
|
||||
include_guard(GLOBAL)
|
||||
endif()
|
||||
|
||||
set(lwipcontribportwindows_SRCS
|
||||
${LWIP_CONTRIB_DIR}/ports/win32/sys_arch.c
|
||||
${LWIP_CONTRIB_DIR}/ports/win32/sio.c
|
||||
${LWIP_CONTRIB_DIR}/ports/win32/pcapif.c
|
||||
${LWIP_CONTRIB_DIR}/ports/win32/pcapif_helper.c
|
||||
)
|
||||
|
||||
# pcapif needs WinPcap developer package: https://www.winpcap.org/devel.htm
|
||||
if(NOT DEFINED WPDPACK_DIR)
|
||||
set(WPDPACK_DIR ${LWIP_DIR}/../WpdPack)
|
||||
message(STATUS "WPDPACK_DIR not set - using default location ${WPDPACK_DIR}")
|
||||
endif()
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(WPDPACK_LIB_DIR ${WPDPACK_DIR}/lib/x64)
|
||||
else()
|
||||
set(WPDPACK_LIB_DIR ${WPDPACK_DIR}/lib)
|
||||
endif()
|
||||
set(WPCAP ${WPDPACK_LIB_DIR}/wpcap.lib)
|
||||
set(PACKET ${WPDPACK_LIB_DIR}/packet.lib)
|
||||
else()
|
||||
find_library(WPCAP wpcap HINTS ${WPDPACK_DIR}/lib/x64)
|
||||
find_library(PACKET packet HINTS ${WPDPACK_DIR}/lib/x64)
|
||||
endif()
|
||||
message(STATUS "WPCAP library: ${WPCAP}")
|
||||
message(STATUS "PACKET library: ${PACKET}")
|
||||
|
||||
add_library(lwipcontribportwindows EXCLUDE_FROM_ALL ${lwipcontribportwindows_SRCS})
|
||||
target_include_directories(lwipcontribportwindows PRIVATE ${LWIP_INCLUDE_DIRS} "${WPDPACK_DIR}/include" ${LWIP_MBEDTLS_INCLUDE_DIRS})
|
||||
target_compile_options(lwipcontribportwindows PRIVATE ${LWIP_COMPILER_FLAGS})
|
||||
target_compile_definitions(lwipcontribaddons PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS})
|
||||
target_link_libraries(lwipcontribportwindows PUBLIC ${WPCAP} ${PACKET} ${LWIP_MBEDTLS_LINK_LIBRARIES})
|
||||
1
lwip/lwip-2.2.1/contrib/ports/win32/check/check_stdint.h
Normal file
1
lwip/lwip-2.2.1/contrib/ports/win32/check/check_stdint.h
Normal file
@ -0,0 +1 @@
|
||||
/* deliberateliy empty */
|
||||
29
lwip/lwip-2.2.1/contrib/ports/win32/check/config.h
Normal file
29
lwip/lwip-2.2.1/contrib/ports/win32/check/config.h
Normal file
@ -0,0 +1,29 @@
|
||||
/* 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 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>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef unsigned int clockid_t;
|
||||
typedef unsigned int timer_t;
|
||||
9
lwip/lwip-2.2.1/contrib/ports/win32/check/stdbool.h
Normal file
9
lwip/lwip-2.2.1/contrib/ports/win32/check/stdbool.h
Normal file
@ -0,0 +1,9 @@
|
||||
#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
|
||||
12
lwip/lwip-2.2.1/contrib/ports/win32/check/sys/time.h
Normal file
12
lwip/lwip-2.2.1/contrib/ports/win32/check/sys/time.h
Normal file
@ -0,0 +1,12 @@
|
||||
#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
|
||||
66
lwip/lwip-2.2.1/contrib/ports/win32/check/time.c
Normal file
66
lwip/lwip-2.2.1/contrib/ports/win32/check/time.c
Normal file
@ -0,0 +1,66 @@
|
||||
#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;
|
||||
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
local_result = localtime (timer);
|
||||
if (local_result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(result, local_result, sizeof(*result));
|
||||
return result;
|
||||
}
|
||||
7
lwip/lwip-2.2.1/contrib/ports/win32/check/unistd.h
Normal file
7
lwip/lwip-2.2.1/contrib/ports/win32/check/unistd.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef LWIP_UNISTD_H
|
||||
#define LWIP_UNISTD_H
|
||||
|
||||
/* include io.h for read() and write() */
|
||||
#include <io.h>
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,27 @@
|
||||
include(${LWIP_DIR}/contrib/ports/CMakeCommon.cmake)
|
||||
|
||||
set (LWIP_INCLUDE_DIRS
|
||||
"${LWIP_DIR}/src/include"
|
||||
"${LWIP_DIR}/contrib/"
|
||||
"${LWIP_DIR}/contrib/ports/win32/include"
|
||||
"${LWIP_DIR}/contrib/examples/example_app"
|
||||
)
|
||||
|
||||
include(${LWIP_DIR}/src/Filelists.cmake)
|
||||
include(${LWIP_DIR}/contrib/Filelists.cmake)
|
||||
include(${LWIP_DIR}/contrib/ports/win32/Filelists.cmake)
|
||||
|
||||
if(NOT EXISTS ${LWIP_DIR}/contrib/examples/example_app/lwipcfg.h)
|
||||
message(WARNING "${LWIP_DIR}/contrib/examples/example_app is missing lwipcfg.h
|
||||
Copy ${LWIP_DIR}/contrib/examples/example_app/lwipcfg.h.example to ${LWIP_DIR}/contrib/examples/example_app/lwipcfg.h and edit appropriately")
|
||||
endif()
|
||||
add_executable(example_app ${LWIP_DIR}/contrib/examples/example_app/test.c default_netif.c)
|
||||
target_include_directories(example_app PRIVATE ${LWIP_INCLUDE_DIRS})
|
||||
target_compile_options(example_app PRIVATE ${LWIP_COMPILER_FLAGS})
|
||||
target_compile_definitions(example_app PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS})
|
||||
target_link_libraries(example_app ${LWIP_SANITIZER_LIBS} lwipallapps lwipcontribexamples lwipcontribapps lwipcontribaddons lwipcontribportwindows lwipcore lwipmbedtls)
|
||||
|
||||
add_executable(makefsdata ${lwipmakefsdata_SRCS})
|
||||
target_compile_options(makefsdata PRIVATE ${LWIP_COMPILER_FLAGS})
|
||||
target_include_directories(makefsdata PRIVATE ${LWIP_INCLUDE_DIRS})
|
||||
target_link_libraries(makefsdata ${LWIP_SANITIZER_LIBS} lwipcore lwipcontribportwindows)
|
||||
55
lwip/lwip-2.2.1/contrib/ports/win32/example_app/Makefile
Normal file
55
lwip/lwip-2.2.1/contrib/ports/win32/example_app/Makefile
Normal file
@ -0,0 +1,55 @@
|
||||
#
|
||||
# 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: example_app makefsdata
|
||||
.PHONY: all
|
||||
|
||||
include ../Common.mk
|
||||
|
||||
CFLAGS+=-I$(CONTRIBDIR)/examples/example_app
|
||||
|
||||
MAKEFSDATAOBJS=$(notdir $(MAKEFSDATAFILES:.c=.o))
|
||||
|
||||
clean:
|
||||
cmd /c del /q *.o $(LWIPLIBCOMMON) $(APPLIB) test.exe *.s .depend* *.map
|
||||
|
||||
depend dep: .depend
|
||||
|
||||
include .depend
|
||||
|
||||
.depend: $(CONTRIBDIR)/examples/example_app/test.c default_netif.c $(LWIPFILES) $(APPFILES) $(MAKEFSDATAFILES)
|
||||
$(CCDEP) $(CFLAGS) -MM $^ > .depend || cmd /c del .depend
|
||||
|
||||
example_app: .depend $(LWIPLIBCOMMON) $(APPLIB) default_netif.o test.o
|
||||
$(CC) $(CFLAGS) -o example_app test.o default_netif.o -Wl,--start-group $(APPLIB) $(LWIPLIBCOMMON) -Wl,--end-group $(LDFLAGS) -Xlinker -Map=test.map
|
||||
|
||||
makefsdata: .depend $(MAKEFSDATAOBJS)
|
||||
$(CC) $(CFLAGS) -o makefsdata $(MAKEFSDATAOBJS)
|
||||
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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/netif.h"
|
||||
#include "lwip/ip_addr.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/tcpip.h"
|
||||
#include "../pcapif.h"
|
||||
#include "examples/example_app/default_netif.h"
|
||||
|
||||
static struct netif netif;
|
||||
|
||||
#if LWIP_IPV4
|
||||
#define NETIF_ADDRS ipaddr, netmask, gw,
|
||||
void init_default_netif(const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw)
|
||||
#else
|
||||
#define NETIF_ADDRS
|
||||
void init_default_netif(void)
|
||||
#endif
|
||||
{
|
||||
#if NO_SYS
|
||||
netif_add(&netif, NETIF_ADDRS NULL, pcapif_init, netif_input);
|
||||
#else /* NO_SYS */
|
||||
netif_add(&netif, NETIF_ADDRS NULL, pcapif_init, tcpip_input);
|
||||
#endif /* NO_SYS */
|
||||
netif_set_default(&netif);
|
||||
}
|
||||
|
||||
void
|
||||
default_netif_poll(void)
|
||||
{
|
||||
#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 */
|
||||
}
|
||||
|
||||
void
|
||||
default_netif_shutdown(void)
|
||||
{
|
||||
/* release the pcap library... */
|
||||
pcapif_shutdown(&netif);
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
#pragma pack(push,1)
|
||||
119
lwip/lwip-2.2.1/contrib/ports/win32/include/arch/cc.h
Normal file
119
lwip/lwip-2.2.1/contrib/ports/win32/include/arch/cc.h
Normal file
@ -0,0 +1,119 @@
|
||||
/*
|
||||
* 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' */
|
||||
#pragma warning (disable: 4711) /* The compiler performed inlining on the given function, although it was not marked for inlining */
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if _MSC_VER >= 1910
|
||||
#include <errno.h> /* use MSVC errno for >= 2017 */
|
||||
#else
|
||||
#define LWIP_PROVIDE_ERRNO /* provide errno for MSVC pre-2017 */
|
||||
#endif
|
||||
#else /* _MSC_VER */
|
||||
#define LWIP_PROVIDE_ERRNO /* provide errno for non-MSVC */
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define LWIP_TIMEVAL_PRIVATE 0
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
/* 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"
|
||||
#ifdef _WIN64
|
||||
#define SZT_F "llu"
|
||||
#else
|
||||
#define SZT_F "lu"
|
||||
#endif
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* Compiler hints for packing structures */
|
||||
#define PACK_STRUCT_USE_INCLUDES
|
||||
|
||||
#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
|
||||
LWIP_PLATFORM_DIAG(("Assertion \"%s\" failed at line %d in %s\n", message, __LINE__, __FILE__)); \
|
||||
handler;} } while(0)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* C runtime functions redefined */
|
||||
#if _MSC_VER < 1910
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
#define strdup _strdup
|
||||
#endif
|
||||
|
||||
/* Define an example for LWIP_PLATFORM_DIAG: since this uses varargs and the old
|
||||
* C standard lwIP targets does not support this in macros, we have extra brackets
|
||||
* around the arguments, which are left out in the following macro definition:
|
||||
*/
|
||||
#if !defined(LWIP_TESTMODE) || !LWIP_TESTMODE
|
||||
void lwip_win32_platform_diag(const char *format, ...);
|
||||
#define LWIP_PLATFORM_DIAG(x) lwip_win32_platform_diag x
|
||||
#endif
|
||||
|
||||
extern unsigned int lwip_port_rand(void);
|
||||
#define LWIP_RAND() ((uint32_t)lwip_port_rand())
|
||||
|
||||
#define PPP_INCLUDE_SETTINGS_HEADER
|
||||
|
||||
#endif /* LWIP_ARCH_CC_H */
|
||||
@ -0,0 +1 @@
|
||||
#pragma pack(pop)
|
||||
40
lwip/lwip-2.2.1/contrib/ports/win32/include/arch/perf.h
Normal file
40
lwip/lwip-2.2.1/contrib/ports/win32/include/arch/perf.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2001, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef LWIP_PERF_H
|
||||
#define LWIP_PERF_H
|
||||
|
||||
#define PERF_START /* null definition */
|
||||
#define PERF_STOP(x) /* null definition */
|
||||
|
||||
#endif /* LWIP_PERF_H */
|
||||
91
lwip/lwip-2.2.1/contrib/ports/win32/include/arch/sys_arch.h
Normal file
91
lwip/lwip-2.2.1/contrib/ports/win32/include/arch/sys_arch.h
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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()
|
||||
|
||||
#define LWIP_EXAMPLE_APP_ABORT() lwip_win32_keypressed()
|
||||
int lwip_win32_keypressed(void);
|
||||
|
||||
/* Threading options */
|
||||
void sys_mark_tcpip_thread(void);
|
||||
#define LWIP_MARK_TCPIP_THREAD() sys_mark_tcpip_thread()
|
||||
|
||||
#if LWIP_TCPIP_CORE_LOCKING
|
||||
void sys_lock_tcpip_core(void);
|
||||
#define LOCK_TCPIP_CORE() sys_lock_tcpip_core()
|
||||
void sys_unlock_tcpip_core(void);
|
||||
#define UNLOCK_TCPIP_CORE() sys_unlock_tcpip_core()
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_ARCH_SYS_ARCH_H */
|
||||
159
lwip/lwip-2.2.1/contrib/ports/win32/msvc/libcheck.vcxproj
Normal file
159
lwip/lwip-2.2.1/contrib/ports/win32/msvc/libcheck.vcxproj
Normal file
@ -0,0 +1,159 @@
|
||||
<?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="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{EBB156DC-01BF-47B2-B69C-1A750B6B5F09}</ProjectGuid>
|
||||
<RootNamespace>libcheck</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</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>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</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)'=='Release|x64'" 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>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" 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'">$(Configuration)\$(ProjectName)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\$(ProjectName)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(Platform)\$(Configuration)\$(ProjectName)\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(Platform)\$(Configuration)\$(ProjectName)\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</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)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\check;..\..\..\..\..\check\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;WIN32;_DEBUG;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</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>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<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>
|
||||
@ -0,0 +1,96 @@
|
||||
<?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>
|
||||
1040
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwIP.vcxproj
Normal file
1040
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwIP.vcxproj
Normal file
File diff suppressed because it is too large
Load Diff
1075
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwIP.vcxproj.filters
Normal file
1075
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwIP.vcxproj.filters
Normal file
File diff suppressed because it is too large
Load Diff
57
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwIP_Test.sln
Normal file
57
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwIP_Test.sln
Normal file
@ -0,0 +1,57 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.7.34031.279
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
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
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
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}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8CC0CE51-32CF-4585-BFAF-A9343BC5A96D}.Debug|x64.Build.0 = Debug|x64
|
||||
{8CC0CE51-32CF-4585-BFAF-A9343BC5A96D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{8CC0CE51-32CF-4585-BFAF-A9343BC5A96D}.Release|Win32.Build.0 = Release|Win32
|
||||
{8CC0CE51-32CF-4585-BFAF-A9343BC5A96D}.Release|x64.ActiveCfg = Release|x64
|
||||
{8CC0CE51-32CF-4585-BFAF-A9343BC5A96D}.Release|x64.Build.0 = Release|x64
|
||||
{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}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6F44E49E-9F21-4144-91EC-53B92AEF62CE}.Debug|x64.Build.0 = Debug|x64
|
||||
{6F44E49E-9F21-4144-91EC-53B92AEF62CE}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6F44E49E-9F21-4144-91EC-53B92AEF62CE}.Release|Win32.Build.0 = Release|Win32
|
||||
{6F44E49E-9F21-4144-91EC-53B92AEF62CE}.Release|x64.ActiveCfg = Release|x64
|
||||
{6F44E49E-9F21-4144-91EC-53B92AEF62CE}.Release|x64.Build.0 = Release|x64
|
||||
{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}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug|x64.Build.0 = Debug|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|Win32.Build.0 = Release|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|x64.ActiveCfg = Release|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|x64.Build.0 = Release|x64
|
||||
{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}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0BFC0F21-8E84-4E68-A9E1-CE2A09B72F6D}.Debug|x64.Build.0 = Debug|x64
|
||||
{0BFC0F21-8E84-4E68-A9E1-CE2A09B72F6D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{0BFC0F21-8E84-4E68-A9E1-CE2A09B72F6D}.Release|Win32.Build.0 = Release|Win32
|
||||
{0BFC0F21-8E84-4E68-A9E1-CE2A09B72F6D}.Release|x64.ActiveCfg = Release|x64
|
||||
{0BFC0F21-8E84-4E68-A9E1-CE2A09B72F6D}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
321
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwIP_Test.vcxproj
Normal file
321
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwIP_Test.vcxproj
Normal file
@ -0,0 +1,321 @@
|
||||
<?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="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{8CC0CE51-32CF-4585-BFAF-A9343BC5A96D}</ProjectGuid>
|
||||
<RootNamespace>lwIP_test</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</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>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</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)'=='Debug|x64'" 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>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" 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>
|
||||
<IntDir>$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">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>..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..\..\..\examples\example_app;..\..\..;%(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>Level4</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;..\..\..\..\..\winpcap\WpdPack\Lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ProgramDatabaseFile>.\Release/test.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
<MapFileName>$(TargetDir)$(TargetName).map</MapFileName>
|
||||
<DelayLoadDLLs>Packet.dll;wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TypeLibraryName>.\Release/test.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..\..\..\examples\example_app;..\..\..;%(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>Level4</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;..\..\..\..\..\winpcap\WpdPack\Lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ProgramDatabaseFile>.\Release/test.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
<MapFileName>$(TargetDir)$(TargetName).map</MapFileName>
|
||||
<DelayLoadDLLs>Packet.dll;wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<TypeLibraryName>.\Debug/test.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..\..\..\examples\example_app;..\..\..;%(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>Level4</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;..\..\..\..\..\winpcap\WpdPack\Lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateMapFile>false</GenerateMapFile>
|
||||
<MapFileName>$(TargetDir)$(TargetName).map</MapFileName>
|
||||
<DelayLoadDLLs>Packet.dll;wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TypeLibraryName>.\Debug/test.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..\..\..\examples\example_app;..\..\..;%(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>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</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;..\..\..\..\..\winpcap\WpdPack\Lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<GenerateMapFile>false</GenerateMapFile>
|
||||
<MapFileName>$(TargetDir)$(TargetName).map</MapFileName>
|
||||
<DelayLoadDLLs>Packet.dll;wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\addons\ipv6_static_routing\ip6_route_table.c" />
|
||||
<ClCompile Include="..\..\..\addons\tcp_isn\tcp_isn.c" />
|
||||
<ClCompile Include="..\..\..\apps\tcpecho_raw\tcpecho_raw.c" />
|
||||
<ClCompile Include="..\..\..\apps\udpecho_raw\udpecho_raw.c" />
|
||||
<ClCompile Include="..\..\..\examples\example_app\test.c" />
|
||||
<ClCompile Include="..\..\..\examples\httpd\cgi_example\cgi_example.c" />
|
||||
<ClCompile Include="..\..\..\examples\httpd\fs_example\fs_example.c" />
|
||||
<ClCompile Include="..\..\..\examples\httpd\genfiles_example\genfiles_example.c" />
|
||||
<ClCompile Include="..\..\..\examples\httpd\https_example\https_example.c" />
|
||||
<ClCompile Include="..\..\..\examples\httpd\post_example\post_example.c" />
|
||||
<ClCompile Include="..\..\..\examples\httpd\ssi_example\ssi_example.c" />
|
||||
<ClCompile Include="..\..\..\examples\lwiperf\lwiperf_example.c" />
|
||||
<ClCompile Include="..\..\..\examples\mdns\mdns_example.c" />
|
||||
<ClCompile Include="..\..\..\examples\mqtt\mqtt_example.c" />
|
||||
<ClCompile Include="..\..\..\examples\ppp\pppos_example.c" />
|
||||
<ClCompile Include="..\..\..\examples\snmp\snmp_example.c" />
|
||||
<ClCompile Include="..\..\..\examples\snmp\snmp_private_mib\lwip_prvmib.c" />
|
||||
<ClCompile Include="..\..\..\examples\snmp\snmp_v3\snmpv3_dummy.c" />
|
||||
<ClCompile Include="..\..\..\examples\sntp\sntp_example.c" />
|
||||
<ClCompile Include="..\..\..\examples\tftp\tftp_example.c" />
|
||||
<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="..\example_app\default_netif.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\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\udpecho_raw\udpecho_raw.h" />
|
||||
<ClInclude Include="..\..\..\examples\httpd\cgi_example\cgi_example.h" />
|
||||
<ClInclude Include="..\..\..\examples\httpd\fs_example\fs_example.h" />
|
||||
<ClInclude Include="..\..\..\examples\httpd\genfiles_example\genfiles_example.h" />
|
||||
<ClInclude Include="..\..\..\examples\httpd\https_example\https_example.h" />
|
||||
<ClInclude Include="..\..\..\examples\httpd\ssi_example\ssi_example.h" />
|
||||
<ClInclude Include="..\..\..\examples\lwiperf\lwiperf_example.h" />
|
||||
<ClInclude Include="..\..\..\examples\mdns\mdns_example.h" />
|
||||
<ClInclude Include="..\..\..\examples\mqtt\mqtt_example.h" />
|
||||
<ClInclude Include="..\..\..\examples\ppp\pppos_example.h" />
|
||||
<ClInclude Include="..\..\..\examples\snmp\snmp_example.h" />
|
||||
<ClInclude Include="..\..\..\examples\snmp\snmp_private_mib\private_mib.h" />
|
||||
<ClInclude Include="..\..\..\examples\snmp\snmp_v3\snmpv3_dummy.h" />
|
||||
<ClInclude Include="..\..\..\examples\sntp\sntp_example.h" />
|
||||
<ClInclude Include="..\..\..\examples\tftp\tftp_example.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>
|
||||
@ -0,0 +1,252 @@
|
||||
<?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>
|
||||
<Filter Include="Source Files\examples">
|
||||
<UniqueIdentifier>{6456d2d6-61e6-4c99-9f1f-1f225437a642}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\examples\httpd">
|
||||
<UniqueIdentifier>{75bb877e-aa45-4e2e-82fe-946ddadc6a64}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\examples\snmp">
|
||||
<UniqueIdentifier>{78411edf-fe39-4edb-a6bd-2833755e0342}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\examples\httpd\fs_example">
|
||||
<UniqueIdentifier>{531dd0cf-ec13-42b7-a3bb-b837382d4ecd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\examples\httpd\ssi_example">
|
||||
<UniqueIdentifier>{d71bdb12-c5ed-4823-99f0-2d537765a2eb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\examples\snmp\snmp_private_mib">
|
||||
<UniqueIdentifier>{0b9db8c7-f352-4ca6-86c6-1a6c58482c5d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\examples\snmp\snmp_v3">
|
||||
<UniqueIdentifier>{97f0ea5c-16cf-4640-a6b3-ace059ed2388}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\examples\httpd\cgi_example">
|
||||
<UniqueIdentifier>{24079d2d-aab1-49f9-b0fa-57910a18b93a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\examples\httpd\genfiles_example">
|
||||
<UniqueIdentifier>{d38ed32b-9498-429e-a02c-08332c463725}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\examples\httpd\post_example">
|
||||
<UniqueIdentifier>{672a49fd-94ff-4126-8de3-e96c9c32dfb8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\examples\mdns">
|
||||
<UniqueIdentifier>{e5276e3f-3e2a-4376-aee3-85aafd12c77b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\examples\tftp">
|
||||
<UniqueIdentifier>{f6d95ce0-df4f-4988-8654-624468dd4ecd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\examples\sntp">
|
||||
<UniqueIdentifier>{a37e5539-232e-4d91-9c10-3d7a851b8c4c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\examples\ppp">
|
||||
<UniqueIdentifier>{a2a65260-5055-4a0d-bd0b-4a3ca3560918}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\examples\lwiperf">
|
||||
<UniqueIdentifier>{aa359e5e-131e-4f20-9e5d-416f9ae76abd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\examples\mqtt">
|
||||
<UniqueIdentifier>{bd6f1fcc-c88f-4b96-a267-401f6bf9898b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\examples\httpd\https_example">
|
||||
<UniqueIdentifier>{1098bc59-6867-48a3-afa4-b896510241d1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<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="..\..\..\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="..\..\..\examples\httpd\fs_example\fs_example.c">
|
||||
<Filter>Source Files\examples\httpd\fs_example</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\examples\httpd\ssi_example\ssi_example.c">
|
||||
<Filter>Source Files\examples\httpd\ssi_example</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\examples\snmp\snmp_private_mib\lwip_prvmib.c">
|
||||
<Filter>Source Files\examples\snmp\snmp_private_mib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\examples\snmp\snmp_v3\snmpv3_dummy.c">
|
||||
<Filter>Source Files\examples\snmp\snmp_v3</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\examples\httpd\cgi_example\cgi_example.c">
|
||||
<Filter>Source Files\examples\httpd\cgi_example</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\examples\httpd\genfiles_example\genfiles_example.c">
|
||||
<Filter>Source Files\examples\httpd\genfiles_example</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\examples\httpd\post_example\post_example.c">
|
||||
<Filter>Source Files\examples\httpd\post_example</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\examples\mdns\mdns_example.c">
|
||||
<Filter>Source Files\examples\mdns</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\examples\tftp\tftp_example.c">
|
||||
<Filter>Source Files\examples\tftp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\examples\snmp\snmp_example.c">
|
||||
<Filter>Source Files\examples\snmp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\examples\sntp\sntp_example.c">
|
||||
<Filter>Source Files\examples\sntp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\examples\ppp\pppos_example.c">
|
||||
<Filter>Source Files\examples\ppp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\examples\lwiperf\lwiperf_example.c">
|
||||
<Filter>Source Files\examples\lwiperf</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\examples\mqtt\mqtt_example.c">
|
||||
<Filter>Source Files\examples\mqtt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\examples\example_app\test.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\example_app\default_netif.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\examples\httpd\https_example\https_example.c">
|
||||
<Filter>Source Files\examples\httpd\https_example</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="..\..\..\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="..\..\..\examples\httpd\fs_example\fs_example.h">
|
||||
<Filter>Source Files\examples\httpd\fs_example</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\examples\httpd\ssi_example\ssi_example.h">
|
||||
<Filter>Source Files\examples\httpd\ssi_example</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\examples\snmp\snmp_private_mib\private_mib.h">
|
||||
<Filter>Source Files\examples\snmp\snmp_private_mib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\examples\snmp\snmp_v3\snmpv3_dummy.h">
|
||||
<Filter>Source Files\examples\snmp\snmp_v3</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\examples\httpd\cgi_example\cgi_example.h">
|
||||
<Filter>Source Files\examples\httpd\cgi_example</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\examples\httpd\genfiles_example\genfiles_example.h">
|
||||
<Filter>Source Files\examples\httpd\genfiles_example</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\examples\mdns\mdns_example.h">
|
||||
<Filter>Source Files\examples\mdns</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\examples\tftp\tftp_example.h">
|
||||
<Filter>Source Files\examples\tftp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\examples\snmp\snmp_example.h">
|
||||
<Filter>Source Files\examples\snmp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\examples\sntp\sntp_example.h">
|
||||
<Filter>Source Files\examples\sntp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\examples\ppp\pppos_example.h">
|
||||
<Filter>Source Files\examples\ppp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\examples\lwiperf\lwiperf_example.h">
|
||||
<Filter>Source Files\examples\lwiperf</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\examples\mqtt\mqtt_example.h">
|
||||
<Filter>Source Files\examples\mqtt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\examples\httpd\https_example\https_example.h">
|
||||
<Filter>Source Files\examples\httpd\https_example</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\addons\ipv6_static_routing\README">
|
||||
<Filter>Source Files\addons\ipv6_static_routing</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
78
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwIP_fuzz.sln
Normal file
78
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwIP_fuzz.sln
Normal file
@ -0,0 +1,78 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.7.34031.279
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lwIP", "lwIP.vcxproj", "{2CC276FA-B226-49C9-8F82-7FCD5A228E28}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lwip_fuzz", "lwip_fuzz.vcxproj", "{71B3B3F4-621C-11EE-8C99-0242AC120002}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug_fuzz2|x64 = Debug_fuzz2|x64
|
||||
Debug_fuzz2|x86 = Debug_fuzz2|x86
|
||||
Debug_fuzz3|x64 = Debug_fuzz3|x64
|
||||
Debug_fuzz3|x86 = Debug_fuzz3|x86
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release_fuzz2|x64 = Release_fuzz2|x64
|
||||
Release_fuzz2|x86 = Release_fuzz2|x86
|
||||
Release_fuzz3|x64 = Release_fuzz3|x64
|
||||
Release_fuzz3|x86 = Release_fuzz3|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug_fuzz2|x64.ActiveCfg = Debug fuzz|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug_fuzz2|x64.Build.0 = Debug fuzz|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug_fuzz2|x86.ActiveCfg = Debug fuzz|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug_fuzz2|x86.Build.0 = Debug fuzz|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug_fuzz3|x64.ActiveCfg = Debug fuzz|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug_fuzz3|x64.Build.0 = Debug fuzz|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug_fuzz3|x86.ActiveCfg = Debug fuzz|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug_fuzz3|x86.Build.0 = Debug fuzz|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug|x64.ActiveCfg = Debug fuzz|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug|x64.Build.0 = Debug fuzz|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug|x86.ActiveCfg = Debug fuzz|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug|x86.Build.0 = Debug fuzz|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release_fuzz2|x64.ActiveCfg = Release fuzz|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release_fuzz2|x64.Build.0 = Release fuzz|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release_fuzz2|x86.ActiveCfg = Release fuzz|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release_fuzz2|x86.Build.0 = Release fuzz|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release_fuzz3|x64.ActiveCfg = Release fuzz|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release_fuzz3|x64.Build.0 = Release fuzz|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release_fuzz3|x86.ActiveCfg = Release fuzz|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release_fuzz3|x86.Build.0 = Release fuzz|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|x64.ActiveCfg = Release fuzz|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|x64.Build.0 = Release fuzz|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|x86.ActiveCfg = Release fuzz|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|x86.Build.0 = Release fuzz|Win32
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Debug_fuzz2|x64.ActiveCfg = Debug fuzz2|x64
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Debug_fuzz2|x64.Build.0 = Debug fuzz2|x64
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Debug_fuzz2|x86.ActiveCfg = Debug fuzz2|Win32
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Debug_fuzz2|x86.Build.0 = Debug fuzz2|Win32
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Debug_fuzz3|x64.ActiveCfg = Debug fuzz3|x64
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Debug_fuzz3|x64.Build.0 = Debug fuzz3|x64
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Debug_fuzz3|x86.ActiveCfg = Debug fuzz3|Win32
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Debug_fuzz3|x86.Build.0 = Debug fuzz3|Win32
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Debug|x64.Build.0 = Debug|x64
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Debug|x86.Build.0 = Debug|Win32
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Release_fuzz2|x64.ActiveCfg = Release fuzz2|x64
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Release_fuzz2|x64.Build.0 = Release fuzz2|x64
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Release_fuzz2|x86.ActiveCfg = Release fuzz2|Win32
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Release_fuzz2|x86.Build.0 = Release fuzz2|Win32
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Release_fuzz3|x64.ActiveCfg = Release fuzz3|x64
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Release_fuzz3|x64.Build.0 = Release fuzz3|x64
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Release_fuzz3|x86.ActiveCfg = Release fuzz3|Win32
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Release_fuzz3|x86.Build.0 = Release fuzz3|Win32
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Release|x64.ActiveCfg = Release|x64
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Release|x64.Build.0 = Release|x64
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Release|x86.ActiveCfg = Release|Win32
|
||||
{71B3B3F4-621C-11EE-8C99-0242AC120002}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
190
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwIP_pcapif.vcxproj
Normal file
190
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwIP_pcapif.vcxproj
Normal file
@ -0,0 +1,190 @@
|
||||
<?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="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>lwIP pcapif</ProjectName>
|
||||
<ProjectGuid>{6F44E49E-9F21-4144-91EC-53B92AEF62CE}</ProjectGuid>
|
||||
<RootNamespace>lwIP pcapif</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</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>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</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)'=='Release|x64'" 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)'=='Debug|x64'" 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>$(Configuration)\$(ProjectName)\</OutDir>
|
||||
<IntDir>$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..\..\..\examples\example_app;.\;$(PCAP_DIR)\Include;..\..\..\..\..\winpcap\WpdPack\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>Level4</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)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..\..\..\examples\example_app;.\;$(PCAP_DIR)\Include;..\..\..\..\..\winpcap\WpdPack\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>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</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>..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..\..\..\examples\example_app;.\;$(PCAP_DIR)\Include;..\..\..\..\..\winpcap\WpdPack\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>Level4</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>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..\..\..\examples\example_app;.\;$(PCAP_DIR)\Include;..\..\..\..\..\winpcap\WpdPack\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>Level4</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>
|
||||
@ -0,0 +1,28 @@
|
||||
<?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>
|
||||
50
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwIP_unittests.sln
Normal file
50
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwIP_unittests.sln
Normal file
@ -0,0 +1,50 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.7.34031.279
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
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
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
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}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}.Debug|x64.Build.0 = Debug|x64
|
||||
{6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}.Release|Win32.Build.0 = Release|Win32
|
||||
{6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}.Release|x64.ActiveCfg = Release|x64
|
||||
{6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}.Release|x64.Build.0 = Release|x64
|
||||
{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}.Debug|x64.ActiveCfg = Debug unittests|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug|x64.Build.0 = Debug unittests|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|Win32.ActiveCfg = Release unittests|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|Win32.Build.0 = Release unittests|Win32
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|x64.ActiveCfg = Release unittests|x64
|
||||
{2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|x64.Build.0 = Release unittests|x64
|
||||
{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}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{EBB156DC-01BF-47B2-B69C-1A750B6B5F09}.Debug|x64.Build.0 = Debug|x64
|
||||
{EBB156DC-01BF-47B2-B69C-1A750B6B5F09}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{EBB156DC-01BF-47B2-B69C-1A750B6B5F09}.Release|Win32.Build.0 = Release|Win32
|
||||
{EBB156DC-01BF-47B2-B69C-1A750B6B5F09}.Release|x64.ActiveCfg = Release|x64
|
||||
{EBB156DC-01BF-47B2-B69C-1A750B6B5F09}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {18F9EDCF-BE44-4F9F-A7F6-5DCF2B7687C5}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
476
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwip_fuzz.vcxproj
Normal file
476
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwip_fuzz.vcxproj
Normal file
@ -0,0 +1,476 @@
|
||||
<?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 fuzz2|Win32">
|
||||
<Configuration>Debug fuzz2</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug fuzz2|x64">
|
||||
<Configuration>Debug fuzz2</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug fuzz3|Win32">
|
||||
<Configuration>Debug fuzz3</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug fuzz3|x64">
|
||||
<Configuration>Debug fuzz3</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release fuzz2|Win32">
|
||||
<Configuration>Release fuzz2</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release fuzz2|x64">
|
||||
<Configuration>Release fuzz2</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release fuzz3|Win32">
|
||||
<Configuration>Release fuzz3</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release fuzz3|x64">
|
||||
<Configuration>Release fuzz3</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{71B3B3F4-621C-11EE-8C99-0242AC120002}</ProjectGuid>
|
||||
<RootNamespace>lwip_fuzz</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</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>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release fuzz3|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release fuzz3|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release fuzz2|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release fuzz2|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug fuzz3|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug fuzz3|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug fuzz2|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug fuzz2|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</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)'=='Release|x64'" 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)'=='Release fuzz3|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)'=='Release fuzz3|x64'" 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)'=='Release fuzz2|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)'=='Release fuzz2|x64'" 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>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" 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 fuzz3|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 fuzz3|x64'" 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 fuzz2|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 fuzz2|x64'" 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>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug fuzz3|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug fuzz2|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release fuzz3|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release fuzz2|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug fuzz2|x64'">
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug fuzz3|x64'">
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release fuzz2|x64'">
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release fuzz3|x64'">
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\test\fuzz;..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;WIN32;_DEBUG;LWIP_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</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)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\test\fuzz;..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;WIN32;_DEBUG;LWIP_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4820</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug fuzz3|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\test\fuzz;..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;WIN32;_DEBUG;LWIP_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</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)'=='Debug fuzz3|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\test\fuzz;..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;WIN32;_DEBUG;LWIP_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4820</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug fuzz2|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\test\fuzz;..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;WIN32;_DEBUG;LWIP_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</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)'=='Debug fuzz2|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\test\fuzz;..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;WIN32;_DEBUG;LWIP_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4820</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\test\fuzz;..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\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>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\test\fuzz;..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\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>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release fuzz3|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\test\fuzz;..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\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>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release fuzz3|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\test\fuzz;..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\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>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release fuzz2|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\test\fuzz;..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\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>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release fuzz2|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\test\fuzz;..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\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>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="lwIP.vcxproj">
|
||||
<Project>{2cc276fa-b226-49c9-8f82-7fcd5a228e28}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\test\fuzz\config.h" />
|
||||
<ClInclude Include="..\..\..\..\test\fuzz\fuzz_common.h" />
|
||||
<ClInclude Include="..\..\..\..\test\fuzz\lwipopts.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\test\fuzz\fuzz.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug fuzz2|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug fuzz2|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug fuzz3|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug fuzz3|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release fuzz2|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release fuzz2|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release fuzz3|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release fuzz3|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\fuzz\fuzz2.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug fuzz3|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug fuzz3|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release fuzz3|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release fuzz3|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\fuzz\fuzz3.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug fuzz2|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug fuzz2|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release fuzz2|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release fuzz2|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\fuzz\fuzz_common.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
217
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwip_unittests.vcxproj
Normal file
217
lwip/lwip-2.2.1/contrib/ports/win32/msvc/lwip_unittests.vcxproj
Normal file
@ -0,0 +1,217 @@
|
||||
<?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="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}</ProjectGuid>
|
||||
<RootNamespace>lwip_unittests</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</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>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</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)'=='Release|x64'" 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>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" 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>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\check;..\..\..\..\..\check\src;..\..\..\..\test\unit;..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;WIN32;_DEBUG;LWIP_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4820</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\check;..\..\..\..\..\check\src;..\..\..\..\test\unit;..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;WIN32;_DEBUG;LWIP_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4820</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\check;..\..\..\..\..\check\src;..\..\..\..\test\unit;..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\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>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\check;..\..\..\..\..\check\src;..\..\..\..\test\unit;..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\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>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\test\unit\api\test_sockets.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\arch\sys_arch.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\core\test_def.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\core\test_dns.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\core\test_mem.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\core\test_netif.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\core\test_pbuf.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\core\test_timers.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\ip4\test_ip4.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\ip6\test_ip6.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\mdns\test_mdns.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\mqtt\test_mqtt.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\ppp\test_pppos.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\tcp\tcp_helper.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\tcp\test_tcp.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\tcp\test_tcp_oos.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\tcp\test_tcp_state.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\udp\test_udp.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\etharp\test_etharp.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\dhcp\test_dhcp.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\lwip_unittests.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\test\unit\api\test_sockets.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\arch\sys_arch.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\core\test_def.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\core\test_dns.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\core\test_mem.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\core\test_netif.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\core\test_pbuf.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\core\test_timers.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\ip4\test_ip4.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\ip6\test_ip6.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\mdns\test_mdns.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\mqtt\test_mqtt.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\ppp\test_pppos.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\tcp\tcp_helper.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\tcp\test_tcp.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\tcp\test_tcp_oos.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\tcp\test_tcp_state.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\udp\test_udp.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\etharp\test_etharp.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\dhcp\test_dhcp.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\lwip_check.h" />
|
||||
<ClInclude Include="..\..\..\..\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>
|
||||
@ -0,0 +1,168 @@
|
||||
<?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>
|
||||
<Filter Include="ipv6">
|
||||
<UniqueIdentifier>{924d29be-e5e4-4b25-8bc4-92db91ce4c49}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="ppp">
|
||||
<UniqueIdentifier>{4d24c808-c024-4aba-a214-e5bc276e124d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\test\unit\core\test_mem.c">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\core\test_pbuf.c">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\tcp\tcp_helper.c">
|
||||
<Filter>tcp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\tcp\test_tcp.c">
|
||||
<Filter>tcp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\tcp\test_tcp_oos.c">
|
||||
<Filter>tcp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\udp\test_udp.c">
|
||||
<Filter>udp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\etharp\test_etharp.c">
|
||||
<Filter>etharp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\dhcp\test_dhcp.c">
|
||||
<Filter>dhcp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\lwip_unittests.c" />
|
||||
<ClCompile Include="..\..\..\..\test\unit\mdns\test_mdns.c">
|
||||
<Filter>mdns</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\api\test_sockets.c">
|
||||
<Filter>api</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\arch\sys_arch.c">
|
||||
<Filter>arch</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\mqtt\test_mqtt.c">
|
||||
<Filter>mqtt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\ip4\test_ip4.c">
|
||||
<Filter>ip4</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\core\test_def.c">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\core\test_timers.c">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\core\test_netif.c">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\ip6\test_ip6.c">
|
||||
<Filter>ipv6</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\core\test_dns.c">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\ppp\test_pppos.c">
|
||||
<Filter>ppp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\test\unit\tcp\test_tcp_state.c">
|
||||
<Filter>tcp</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\test\unit\core\test_mem.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\core\test_pbuf.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\tcp\tcp_helper.h">
|
||||
<Filter>tcp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\tcp\test_tcp.h">
|
||||
<Filter>tcp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\tcp\test_tcp_oos.h">
|
||||
<Filter>tcp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\udp\test_udp.h">
|
||||
<Filter>udp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\etharp\test_etharp.h">
|
||||
<Filter>etharp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\dhcp\test_dhcp.h">
|
||||
<Filter>dhcp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\lwip_check.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\lwipopts.h" />
|
||||
<ClInclude Include="..\..\..\..\test\unit\mdns\test_mdns.h">
|
||||
<Filter>mdns</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\api\test_sockets.h">
|
||||
<Filter>api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\arch\sys_arch.h">
|
||||
<Filter>arch</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\mqtt\test_mqtt.h">
|
||||
<Filter>mqtt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\ip4\test_ip4.h">
|
||||
<Filter>ip4</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\core\test_def.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\core\test_timers.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\core\test_netif.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\ip6\test_ip6.h">
|
||||
<Filter>ipv6</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\core\test_dns.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\ppp\test_pppos.h">
|
||||
<Filter>ppp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\test\unit\tcp\test_tcp_state.h">
|
||||
<Filter>tcp</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
173
lwip/lwip-2.2.1/contrib/ports/win32/msvc/makefsdata.vcxproj
Normal file
173
lwip/lwip-2.2.1/contrib/ports/win32/msvc/makefsdata.vcxproj
Normal file
@ -0,0 +1,173 @@
|
||||
<?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="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\src\apps\http\makefsdata\makefsdata.c" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{0BFC0F21-8E84-4E68-A9E1-CE2A09B72F6D}</ProjectGuid>
|
||||
<RootNamespace>makefsdata</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</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>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</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)'=='Release|x64'" 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>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" 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>
|
||||
<IntDir>$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..\..\..\examples\example_app;%(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)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..\..\..\examples\example_app;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..\..\..\examples\example_app;%(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>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\src\include;..\..\..\..\src\include\ipv4;..\..\..\..\src\include\ipv6;..\include;..\..\..\examples\example_app;%(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>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@ -0,0 +1,14 @@
|
||||
<?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="..\..\..\..\src\apps\http\makefsdata\makefsdata.c">
|
||||
<Filter>Quelldateien</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
1129
lwip/lwip-2.2.1/contrib/ports/win32/pcapif.c
Normal file
1129
lwip/lwip-2.2.1/contrib/ports/win32/pcapif.c
Normal file
File diff suppressed because it is too large
Load Diff
32
lwip/lwip-2.2.1/contrib/ports/win32/pcapif.h
Normal file
32
lwip/lwip-2.2.1/contrib/ports/win32/pcapif.h
Normal file
@ -0,0 +1,32 @@
|
||||
#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 */
|
||||
172
lwip/lwip-2.2.1/contrib/ports/win32/pcapif_helper.c
Normal file
172
lwip/lwip-2.2.1/contrib/ports/win32/pcapif_helper.c
Normal file
@ -0,0 +1,172 @@
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
||||
/** Helper function for PCAPIF_RX_READONLY for windows: copy the date to a new
|
||||
* page which is set to READONLY after copying.
|
||||
* This is a helper to simulate hardware that receives to memory that cannot be
|
||||
* written by the CPU.
|
||||
*/
|
||||
void *
|
||||
pcapifh_alloc_readonly_copy(void *data, size_t len)
|
||||
{
|
||||
DWORD oldProtect;
|
||||
void *ret;
|
||||
if (len > 4096) {
|
||||
lwip_win32_platform_diag("pcapifh_alloc_readonly_copy: invalid len: %d\n", len);
|
||||
while(1);
|
||||
}
|
||||
ret = VirtualAlloc(NULL, 4096, MEM_COMMIT, PAGE_READWRITE);
|
||||
if (ret == NULL) {
|
||||
lwip_win32_platform_diag("VirtualAlloc failed: %d\n", GetLastError());
|
||||
while(1);
|
||||
}
|
||||
memcpy(ret, data, len);
|
||||
if (!VirtualProtect(ret, len, PAGE_READONLY, &oldProtect)) {
|
||||
lwip_win32_platform_diag("VirtualProtect failed: %d\n", GetLastError());
|
||||
while(1);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
pcapifh_free_readonly_mem(void *data)
|
||||
{
|
||||
if (!VirtualFree(data, 0, MEM_RELEASE)) {
|
||||
lwip_win32_platform_diag("VirtualFree(0x%08x) failed: %d\n", data, GetLastError());
|
||||
while(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Npcap keeps its DLLs in a different directory for compatibility with winpcap.
|
||||
* Make sure they get found by adding that directory to the DLL search path.
|
||||
*/
|
||||
void pcapifh_init_npcap(void)
|
||||
{
|
||||
char npcap_dir[512];
|
||||
unsigned int len;
|
||||
static char npcap_initialized = 0;
|
||||
|
||||
if (!npcap_initialized)
|
||||
{
|
||||
npcap_initialized = 1;
|
||||
|
||||
len = GetSystemDirectory(npcap_dir, 480);
|
||||
if (!len) {
|
||||
lwip_win32_platform_diag("Error in GetSystemDirectory: %x", GetLastError());
|
||||
return;
|
||||
}
|
||||
strcat_s(npcap_dir, 512, "\\Npcap");
|
||||
if (SetDllDirectory(npcap_dir) == 0) {
|
||||
lwip_win32_platform_diag("Error in SetDllDirectory: %x", GetLastError());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
void pcapifh_init_npcap(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* WIN32 */
|
||||
31
lwip/lwip-2.2.1/contrib/ports/win32/pcapif_helper.h
Normal file
31
lwip/lwip-2.2.1/contrib/ports/win32/pcapif_helper.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef LWIP_PCAPIF_HELPER_H
|
||||
#define LWIP_PCAPIF_HELPER_H
|
||||
|
||||
#include <stddef.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);
|
||||
|
||||
void *pcapifh_alloc_readonly_copy(void *data, size_t len);
|
||||
void pcapifh_free_readonly_mem(void *data);
|
||||
|
||||
void pcapifh_init_npcap(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_PCAPIF_HELPER_H */
|
||||
26
lwip/lwip-2.2.1/contrib/ports/win32/readme.txt
Normal file
26
lwip/lwip-2.2.1/contrib/ports/win32/readme.txt
Normal file
@ -0,0 +1,26 @@
|
||||
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, the CMake files, or the Makefile
|
||||
in the 'mingw' subdir.
|
||||
|
||||
For all compilers/build systems:
|
||||
- you have to set an environment variable PCAP_DIR pointing to the WinPcap Developer's
|
||||
Pack (containing 'include' and 'lib')
|
||||
alternatively, place the WinPcap Developer's pack next to the "lwip" folder:
|
||||
"winpcap\WpdPack"
|
||||
|
||||
You also will have to copy the file 'contrib/examples/example_app/lwipcfg.h.example' to
|
||||
'contrib/examples/example_app/lwipcfg.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.
|
||||
304
lwip/lwip-2.2.1/contrib/ports/win32/sio.c
Normal file
304
lwip/lwip-2.2.1/contrib/ports/win32/sio.c
Normal file
@ -0,0 +1,304 @@
|
||||
/*
|
||||
* 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.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, const 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;
|
||||
}
|
||||
782
lwip/lwip-2.2.1/contrib/ports/win32/sys_arch.c
Normal file
782
lwip/lwip-2.2.1/contrib/ports/win32/sys_arch.c
Normal file
@ -0,0 +1,782 @@
|
||||
/*
|
||||
* 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>
|
||||
#include <lwip/tcpip.h>
|
||||
|
||||
/** Set this to 1 to enable assertion checks that SYS_ARCH_PROTECT() is only
|
||||
* called once in a call stack (calling it nested might cause trouble in some
|
||||
* implementations, so let's avoid this in core code as long as we can).
|
||||
*/
|
||||
#ifndef LWIP_SYS_ARCH_CHECK_NESTED_PROTECT
|
||||
#define LWIP_SYS_ARCH_CHECK_NESTED_PROTECT 1
|
||||
#endif
|
||||
|
||||
/** Set this to 1 to enable assertion checks that SYS_ARCH_PROTECT() is *not*
|
||||
* called before functions potentiolly involving the OS scheduler.
|
||||
*
|
||||
* This scheme is currently broken only for non-core-locking when waking up
|
||||
* threads waiting on a socket via select/poll.
|
||||
*/
|
||||
#ifndef LWIP_SYS_ARCH_CHECK_SCHEDULING_UNPROTECTED
|
||||
#define LWIP_SYS_ARCH_CHECK_SCHEDULING_UNPROTECTED LWIP_TCPIP_CORE_LOCKING
|
||||
#endif
|
||||
|
||||
#define LWIP_WIN32_SYS_ARCH_ENABLE_PROTECT_COUNTER (LWIP_SYS_ARCH_CHECK_NESTED_PROTECT || LWIP_SYS_ARCH_CHECK_SCHEDULING_UNPROTECTED)
|
||||
|
||||
/* These functions are used from NO_SYS also, for precise timer triggering */
|
||||
static LARGE_INTEGER freq, sys_start_time;
|
||||
#define SYS_INITIALIZED() (freq.QuadPart != 0)
|
||||
|
||||
static DWORD netconn_sem_tls_index;
|
||||
|
||||
static HCRYPTPROV hcrypt;
|
||||
|
||||
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)) {
|
||||
char errbuf[128];
|
||||
err = GetLastError();
|
||||
snprintf(errbuf, sizeof(errbuf), "CryptAcquireContext failed with error %d", (int)err);
|
||||
LWIP_UNUSED_ARG(err);
|
||||
LWIP_ASSERT(errbuf, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int
|
||||
lwip_port_rand(void)
|
||||
{
|
||||
u32_t ret;
|
||||
if (CryptGenRandom(hcrypt, sizeof(ret), (BYTE*)&ret)) {
|
||||
return ret;
|
||||
}
|
||||
/* maybe CryptAcquireContext has not been called... */
|
||||
sys_win_rand_init();
|
||||
if (CryptGenRandom(hcrypt, sizeof(ret), (BYTE*)&ret)) {
|
||||
return ret;
|
||||
}
|
||||
LWIP_ASSERT("CryptGenRandom failed", 0);
|
||||
return 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)
|
||||
{
|
||||
u32_t now = (u32_t)sys_get_ms_longlong();
|
||||
#ifdef LWIP_FUZZ_SYS_NOW
|
||||
now += sys_now_offset;
|
||||
#endif
|
||||
return now;
|
||||
}
|
||||
|
||||
CRITICAL_SECTION critSec;
|
||||
#if LWIP_WIN32_SYS_ARCH_ENABLE_PROTECT_COUNTER
|
||||
static int protection_depth;
|
||||
#endif
|
||||
|
||||
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);
|
||||
#if LWIP_SYS_ARCH_CHECK_NESTED_PROTECT
|
||||
LWIP_ASSERT("nested SYS_ARCH_PROTECT", protection_depth == 0);
|
||||
#endif
|
||||
#if LWIP_WIN32_SYS_ARCH_ENABLE_PROTECT_COUNTER
|
||||
protection_depth++;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
sys_arch_unprotect(sys_prot_t pval)
|
||||
{
|
||||
LWIP_UNUSED_ARG(pval);
|
||||
#if LWIP_SYS_ARCH_CHECK_NESTED_PROTECT
|
||||
LWIP_ASSERT("missing SYS_ARCH_PROTECT", protection_depth == 1);
|
||||
#else
|
||||
LWIP_ASSERT("missing SYS_ARCH_PROTECT", protection_depth > 0);
|
||||
#endif
|
||||
#if LWIP_WIN32_SYS_ARCH_ENABLE_PROTECT_COUNTER
|
||||
protection_depth--;
|
||||
#endif
|
||||
LeaveCriticalSection(&critSec);
|
||||
}
|
||||
|
||||
#if LWIP_SYS_ARCH_CHECK_SCHEDULING_UNPROTECTED
|
||||
/** This checks that SYS_ARCH_PROTECT() hasn't been called by protecting
|
||||
* and then checking the level
|
||||
*/
|
||||
static void
|
||||
sys_arch_check_not_protected(void)
|
||||
{
|
||||
sys_arch_protect();
|
||||
LWIP_ASSERT("SYS_ARCH_PROTECT before scheduling", protection_depth == 1);
|
||||
sys_arch_unprotect(0);
|
||||
}
|
||||
#else
|
||||
#define sys_arch_check_not_protected()
|
||||
#endif
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
static 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) {
|
||||
if (SYS_INITIALIZED()) {
|
||||
SYS_ARCH_LOCKED(SYS_STATS_INC_USED(sem));
|
||||
} else {
|
||||
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... */
|
||||
if (SYS_INITIALIZED()) {
|
||||
SYS_ARCH_LOCKED(SYS_STATS_INC(sem.err));
|
||||
} else {
|
||||
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_ARCH_LOCKED(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;
|
||||
sys_arch_check_not_protected();
|
||||
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_ARCH_LOCKED(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_ARCH_LOCKED(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_ARCH_LOCKED(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)
|
||||
{
|
||||
sys_arch_check_not_protected();
|
||||
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 DWORD WINAPI
|
||||
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
|
||||
return 0;
|
||||
}
|
||||
|
||||
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, 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;
|
||||
}
|
||||
|
||||
#if !NO_SYS
|
||||
#if LWIP_TCPIP_CORE_LOCKING
|
||||
|
||||
static DWORD lwip_core_lock_holder_thread_id;
|
||||
|
||||
void
|
||||
sys_lock_tcpip_core(void)
|
||||
{
|
||||
sys_mutex_lock(&lock_tcpip_core);
|
||||
lwip_core_lock_holder_thread_id = GetCurrentThreadId();
|
||||
}
|
||||
|
||||
void
|
||||
sys_unlock_tcpip_core(void)
|
||||
{
|
||||
lwip_core_lock_holder_thread_id = 0;
|
||||
sys_mutex_unlock(&lock_tcpip_core);
|
||||
}
|
||||
#endif /* LWIP_TCPIP_CORE_LOCKING */
|
||||
|
||||
static DWORD lwip_tcpip_thread_id;
|
||||
|
||||
void
|
||||
sys_mark_tcpip_thread(void)
|
||||
{
|
||||
lwip_tcpip_thread_id = GetCurrentThreadId();
|
||||
}
|
||||
|
||||
void
|
||||
sys_check_core_locking(void)
|
||||
{
|
||||
/* Embedded systems should check we are NOT in an interrupt context here */
|
||||
|
||||
if (lwip_tcpip_thread_id != 0) {
|
||||
DWORD current_thread_id = GetCurrentThreadId();
|
||||
|
||||
#if LWIP_TCPIP_CORE_LOCKING
|
||||
LWIP_ASSERT("Function called without core lock", current_thread_id == lwip_core_lock_holder_thread_id);
|
||||
#else /* LWIP_TCPIP_CORE_LOCKING */
|
||||
LWIP_ASSERT("Function called from wrong thread", current_thread_id == lwip_tcpip_thread_id);
|
||||
#endif /* LWIP_TCPIP_CORE_LOCKING */
|
||||
LWIP_UNUSED_ARG(current_thread_id); /* for LWIP_NOASSERT */
|
||||
}
|
||||
}
|
||||
#endif /* !NO_SYS */
|
||||
|
||||
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_ARCH_LOCKED(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_ARCH_LOCKED(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);
|
||||
sys_arch_check_not_protected();
|
||||
|
||||
/* 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);
|
||||
sys_arch_check_not_protected();
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
err_t
|
||||
sys_mbox_trypost_fromisr(sys_mbox_t *q, void *msg)
|
||||
{
|
||||
return sys_mbox_trypost(q, msg);
|
||||
}
|
||||
|
||||
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();
|
||||
ret = WaitForSingleObject(q->sem, timeout);
|
||||
if (ret == 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);
|
||||
|
||||
ret = WaitForSingleObject(q->sem, 0);
|
||||
if (ret == 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_MBOX_EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
#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 && num) {
|
||||
ReadConsoleInput(h, &rec, 1, &num);
|
||||
if (rec.EventType == KEY_EVENT) {
|
||||
if (rec.Event.KeyEvent.bKeyDown) {
|
||||
/* not a special key? */
|
||||
if (rec.Event.KeyEvent.uChar.AsciiChar != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
/* This is an example implementation for LWIP_PLATFORM_DIAG:
|
||||
* format a string and pass it to your output function.
|
||||
*/
|
||||
void
|
||||
lwip_win32_platform_diag(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
/* get the varargs */
|
||||
va_start(ap, format);
|
||||
/* print via varargs; to use another output function, you could use
|
||||
vsnprintf here */
|
||||
vprintf(format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
Reference in New Issue
Block a user