commit
f6151020de
|
@ -44,6 +44,7 @@
|
|||
|
||||
#ifdef LOSCFG_NET_LWIP_SACK
|
||||
#include "lwip/lwipopts.h"
|
||||
#include "lwip/sockets.h"
|
||||
#define CONFIG_NSOCKET_DESCRIPTORS LWIP_CONFIG_NUM_SOCKETS
|
||||
#else
|
||||
#define CONFIG_NSOCKET_DESCRIPTORS 0
|
||||
|
|
|
@ -32,19 +32,42 @@
|
|||
#ifndef _LWIP_PORTING_CC_H_
|
||||
#define _LWIP_PORTING_CC_H_
|
||||
|
||||
#ifdef LITTLE_ENDIAN
|
||||
#undef LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef BIG_ENDIAN
|
||||
#undef BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#include <endian.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "securec.h"
|
||||
#include "log.h"
|
||||
#include "memory_pool.h"
|
||||
|
||||
#ifdef htons
|
||||
#define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#define LWIP_PROVIDE_ERRNO 1
|
||||
#define __SIZEOF_POINTER__ 4 // 32位系统
|
||||
#define SOCKLEN_T_DEFINED
|
||||
#define SA_FAMILY_T_DEFINED
|
||||
#define IN_PORT_T_DEFINED
|
||||
|
||||
#define LOS_TASK_STATUS_DETACHED 0x0100 // 预留字段
|
||||
#define LWIP_TIMEVAL_PRIVATE 0
|
||||
#define LWIP_ERRNO_STDINCLUDE
|
||||
#define LWIP_SOCKET_STDINCLUDE
|
||||
|
||||
#define LWIP_DNS_API_DEFINE_ERRORS 0
|
||||
#define LWIP_DNS_API_DEFINE_FLAGS 0
|
||||
#define LWIP_DNS_API_DECLARE_STRUCTS 0
|
||||
|
||||
#ifndef __SIZEOF_POINTER__
|
||||
#define __SIZEOF_POINTER__ 4 // 32 bit system
|
||||
#endif
|
||||
|
||||
#define LOS_TASK_STATUS_DETACHED 0x0100 // reserved
|
||||
|
||||
#if defined(__arm__) && defined(__ARMCC_VERSION)
|
||||
/* Keil uVision4 tools */
|
||||
|
@ -96,7 +119,6 @@ extern void HilogPrintf(const char *fmt, ...);
|
|||
#define init_waitqueue_head(...)
|
||||
#define poll_check_waiters(...)
|
||||
#define IOCTL_CMD_CASE_HANDLER()
|
||||
#define DF_NADDR(addr)
|
||||
|
||||
#define DNS_SERVER_ADDRESS(ipaddr) (ip4_addr_set_u32(ipaddr, ipaddr_addr("114.114.114.114")))
|
||||
#define DNS_SERVER_ADDRESS_SECONDARY(ipaddr) (ip4_addr_set_u32(ipaddr, ipaddr_addr("114.114.115.115")))
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
#define _LWIP_PORTING_SYS_ARCH_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "memory_pool.h"
|
||||
#include "los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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 copyright holder 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.
|
||||
*/
|
||||
|
||||
#ifndef _LWIP_PORTING_INET_H_
|
||||
#define _LWIP_PORTING_INET_H_
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include_next <lwip/inet.h>
|
||||
|
||||
#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))
|
||||
|
||||
/* directly map this to the lwip internal functions */
|
||||
#define inet_addr(cp) ipaddr_addr(cp)
|
||||
#define inet_aton(cp, addr) ip4addr_aton(cp, (ip4_addr_t*)addr)
|
||||
#define inet_ntoa(addr) ip4addr_ntoa((const ip4_addr_t*)&(addr))
|
||||
#define inet_ntoa_r(addr, buf, buflen) ip4addr_ntoa_r((const ip4_addr_t*)&(addr), buf, buflen)
|
||||
#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);}
|
||||
#endif /* LWIP_IPV6 */
|
||||
|
||||
#endif /* _LWIP_PORTING_INET_H_ */
|
|
@ -134,8 +134,7 @@
|
|||
#define LWIP_NETIF_LOOPBACK 1
|
||||
#define LWIP_POSIX_SOCKETS_IO_NAMES 0
|
||||
#define LWIP_RAW 1
|
||||
#define CONFIG_NFILE_DESCRIPTORS 1
|
||||
#define LWIP_SOCKET_OFFSET CONFIG_NFILE_DESCRIPTORS
|
||||
#define LWIP_SOCKET_OFFSET FAT_MAX_OPEN_FILES
|
||||
#define LWIP_SO_RCVBUF 1
|
||||
#define LWIP_SO_RCVTIMEO 1
|
||||
#define LWIP_SO_SNDTIMEO 1
|
||||
|
|
|
@ -1,39 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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 copyright holder 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.
|
||||
*/
|
||||
|
||||
#ifndef __LITEOS_NETDB_PORTING_H__
|
||||
#define __LITEOS_NETDB_PORTING_H__
|
||||
|
||||
#include "lwip/netdb.h"
|
||||
|
||||
struct hostent *gethostbyname(const char *name);
|
||||
|
||||
#endif // __LITEOS_NETDB_PORTING_H__
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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 copyright holder 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.
|
||||
*/
|
||||
|
||||
#ifndef _LWIP_PORTING_NETDB_H_
|
||||
#define _LWIP_PORTING_NETDB_H_
|
||||
|
||||
#include <netdb.h>
|
||||
#include_next <lwip/netdb.h>
|
||||
|
||||
#ifdef h_errno
|
||||
#undef h_errno
|
||||
#endif
|
||||
|
||||
#endif /* _LWIP_PORTING_NETDB_H_ */
|
|
@ -32,6 +32,9 @@
|
|||
#ifndef _LWIP_PORTING_NETIF_H_
|
||||
#define _LWIP_PORTING_NETIF_H_
|
||||
|
||||
#include <net/if.h>
|
||||
#include <netinet/ip.h>
|
||||
|
||||
#define netif_find netifapi_netif_find_by_name
|
||||
|
||||
#if LWIP_DHCPS
|
||||
|
@ -39,12 +42,11 @@
|
|||
LWIP_NETIF_CLIENT_DATA_INDEX_DHCPS
|
||||
#endif
|
||||
|
||||
#define LWIP_NETIF_FULLNAME 16
|
||||
#define linkoutput linkoutput; \
|
||||
void (*drv_send)(struct netif *netif, struct pbuf *p); \
|
||||
u8_t (*drv_set_hwaddr)(struct netif *netif, u8_t *addr, u8_t len); \
|
||||
void (*drv_config)(struct netif *netif, u32_t config_flags, u8_t setBit); \
|
||||
char full_name[LWIP_NETIF_FULLNAME]; \
|
||||
char full_name[IFNAMSIZ]; \
|
||||
u16_t link_layer_type
|
||||
#include_next <lwip/netif.h>
|
||||
#undef linkoutput
|
||||
|
@ -52,7 +54,7 @@
|
|||
#undef LWIP_NETIF_CLIENT_DATA_INDEX_DHCP
|
||||
#endif
|
||||
|
||||
#include <lwip/etharp.h> // For ETHARP_HWADDR_LEN, by `hieth-sf src/interface.c' and `wal/wal_net.c'
|
||||
#include <lwip/etharp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -60,9 +62,9 @@ extern "C" {
|
|||
|
||||
// redefine NETIF_NAMESIZE which was defined in netif.h
|
||||
#undef NETIF_NAMESIZE
|
||||
#define NETIF_NAMESIZE LWIP_NETIF_FULLNAME
|
||||
#define NETIF_NAMESIZE IFNAMSIZ
|
||||
|
||||
#define LOOPBACK_IF 0 // 772
|
||||
#define LOOPBACK_IF 0
|
||||
#define ETHERNET_DRIVER_IF 1
|
||||
#define WIFI_DRIVER_IF 801
|
||||
#define BT_PROXY_IF 802
|
||||
|
|
|
@ -1,79 +1,83 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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 copyright holder 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SOCKET_PORTING_H
|
||||
#define _SYS_SOCKET_PORTING_H
|
||||
|
||||
#include "lwip/sockets.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int socket (int, int, int);
|
||||
|
||||
int bind (int, const struct sockaddr *, socklen_t);
|
||||
int connect (int, const struct sockaddr *, socklen_t);
|
||||
int listen (int, int);
|
||||
int accept (int, struct sockaddr *__restrict, socklen_t *__restrict);
|
||||
|
||||
int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict);
|
||||
int getpeername (int, struct sockaddr *__restrict, socklen_t *__restrict);
|
||||
|
||||
ssize_t send (int, const void *, size_t, int);
|
||||
ssize_t recv (int, void *, size_t, int);
|
||||
ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
|
||||
ssize_t recvfrom (int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict);
|
||||
ssize_t sendmsg (int, const struct msghdr *, int);
|
||||
ssize_t recvmsg (int, struct msghdr *, int);
|
||||
|
||||
int getsockopt (int, int, int, void *__restrict, socklen_t *__restrict);
|
||||
int setsockopt (int, int, int, const void *, socklen_t);
|
||||
|
||||
const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
|
||||
int inet_pton(int af, const char *src, void *dst);
|
||||
|
||||
int shutdown (int, int);
|
||||
int closesocket(int sockfd);
|
||||
|
||||
int ioctlsocket(int s, long cmd, void *argp);
|
||||
|
||||
#if LWIP_SOCKET_SELECT
|
||||
int select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset, struct timeval *timeout);
|
||||
#endif
|
||||
#if LWIP_SOCKET_POLL
|
||||
int poll(struct pollfd *fds, nfds_t nfds, int timeout);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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 copyright holder 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.
|
||||
*/
|
||||
|
||||
#ifndef _LWIP_PORTING_SOCKETS_H_
|
||||
#define _LWIP_PORTING_SOCKETS_H_
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <poll.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/select.h>
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
#include_next <lwip/sockets.h>
|
||||
#include <fatfs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if FD_SETSIZE < (LWIP_SOCKET_OFFSET + MEMP_NUM_NETCONN)
|
||||
#error "external FD_SETSIZE too small for number of sockets"
|
||||
#else
|
||||
#define LWIP_SELECT_MAXNFDS FD_SETSIZE
|
||||
#endif
|
||||
|
||||
#if IOV_MAX > 0xFFFF
|
||||
#error "IOV_MAX larger than supported by LwIP"
|
||||
#endif
|
||||
|
||||
#if LWIP_UDP && LWIP_UDPLITE
|
||||
#define UDPLITE_SEND_CSCOV 0x01 /* sender checksum coverage */
|
||||
#define UDPLITE_RECV_CSCOV 0x02 /* minimal receiver checksum coverage */
|
||||
#endif
|
||||
|
||||
// For BSD 4.4 socket sa_len compatibility
|
||||
#define DF_NADDR(addr)
|
||||
#define SA_LEN(addr, _) (IP_IS_V4_VAL(addr) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6))
|
||||
#define sa_len sa_data[0] * 0 + SA_LEN(naddr, _)
|
||||
#define sin_len sin_zero[0]
|
||||
#define sin6_len sin6_addr.s6_addr[0]
|
||||
|
||||
// for sockets.c, TCP_KEEPALIVE is not supported currently
|
||||
#define TCP_KEEPALIVE 0xFF
|
||||
#define SIN_ZERO_LEN 8
|
||||
|
||||
int closesocket(int sockfd);
|
||||
int ioctlsocket(int s, long cmd, void *argp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LWIP_PORTING_SOCKETS_H_ */
|
|
@ -29,7 +29,7 @@
|
|||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "netdb.h"
|
||||
#include "lwip/netdb.h"
|
||||
|
||||
struct hostent *gethostbyname(const char *name)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,10 @@
|
|||
#ifndef LWIP_TEST_H
|
||||
#define LWIP_TEST_H
|
||||
|
||||
#include "lwip/arch.h"
|
||||
#include "lwip/sockets.h"
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include "log.h"
|
||||
#include "securec.h"
|
||||
|
||||
|
|
|
@ -30,14 +30,19 @@
|
|||
*/
|
||||
|
||||
#include "lwip_test.h"
|
||||
#include "lwipopts.h"
|
||||
#include <arch/sys_arch.h>
|
||||
#include <lwip/sys.h>
|
||||
|
||||
#define MSG "Hi, I am UDP"
|
||||
#define TEST_CASE 120
|
||||
|
||||
static char g_buf[BUF_SIZE + 1] = { 0 };
|
||||
extern sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stackSize, int prio);
|
||||
|
||||
int UdpTest(void)
|
||||
void UdpTestTask(void *p)
|
||||
{
|
||||
(void)p;
|
||||
LogPrintln("net_socket_test_002.c enter");
|
||||
g_testCase = TEST_CASE;
|
||||
int sfd;
|
||||
|
@ -111,6 +116,13 @@ int UdpTest(void)
|
|||
/* close socket */
|
||||
ret = closesocket(sfd);
|
||||
LWIP_ASSERT("socket invalid param.", ret != -1);
|
||||
return LWIP_TEST_RET_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
int UdpTest()
|
||||
{
|
||||
int ret = sys_thread_new("udp_test", UdpTestTask, NULL,
|
||||
STACK_TEST_SIZE, TCPIP_THREAD_PRIO);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(ret, -1, 23);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -310,8 +310,9 @@ static struct netif *CreateBtNetIf()
|
|||
return btNetif;
|
||||
}
|
||||
|
||||
int UdpTestNetif(void)
|
||||
static void UdpTestNetifTask(void *p)
|
||||
{
|
||||
(void)p;
|
||||
LogPrintln("net_socket_test_011.c enter");
|
||||
g_testCase = TEST_CASE;
|
||||
int sfd;
|
||||
|
@ -363,7 +364,15 @@ int UdpTestNetif(void)
|
|||
/* close socket */
|
||||
ret = closesocket(sfd);
|
||||
LWIP_ASSERT("socket invalid param.", ret != -1);
|
||||
return LWIP_TEST_RET_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
int UdpTestNetif()
|
||||
{
|
||||
int ret = sys_thread_new("udp_test_netif", UdpTestNetifTask, NULL,
|
||||
STACK_TEST_SIZE, TCPIP_THREAD_PRIO);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(ret, -1, 23);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void ArpPackageProc(struct netif *netif, struct pbuf *p)
|
||||
|
|
|
@ -119,7 +119,7 @@ static void LwipTestTimeoutCallback(void const *argument)
|
|||
|
||||
osTimerId_t g_lwipTestTimerId = NULL;
|
||||
|
||||
void LwipTestStartTimer(uint32 timeout)
|
||||
void LwipTestStartTimer(uint32_t timeout)
|
||||
{
|
||||
osStatus_t status;
|
||||
if (g_lwipTestTimerId != NULL) {
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#define PATH_MAX 256
|
||||
#define MQ_PRIO_MAX 1
|
||||
#define PTHREAD_STACK_MIN LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE
|
||||
#define IOV_MAX 1024
|
||||
#define SSIZE_MAX LONG_MAX
|
||||
#include_next <limits.h>
|
||||
#else
|
||||
|
||||
|
|
Loading…
Reference in New Issue