Browse Source

update ping debug commands

pull/123/head
wlyu 8 months ago
parent
commit
ebb1321b7c
  1. 24
      APP_Framework/Applications/control_app/Makefile
  2. 6
      APP_Framework/Applications/control_app/lwip_demo/lwip_ping_demo.c
  3. 35
      APP_Framework/Applications/control_app/lwip_demo/lwip_udp_demo.c
  4. 9
      APP_Framework/Applications/control_app/lwip_demo/ping.c
  5. 386
      APP_Framework/Applications/control_app/lwip_demo/udp_echo.c
  6. 2
      Ubiquitous/XiUOS/board/ok1052-c/third_party_driver/ethernet/enet_ethernetif.c
  7. 30
      Ubiquitous/XiUOS/resources/ethernet/LwIP/FILES
  8. 558
      Ubiquitous/XiUOS/resources/ethernet/LwIP/Filelists.cmake
  9. 410
      Ubiquitous/XiUOS/resources/ethernet/LwIP/Filelists.mk
  10. 2734
      Ubiquitous/XiUOS/resources/ethernet/LwIP/api/api_lib.c
  11. 4346
      Ubiquitous/XiUOS/resources/ethernet/LwIP/api/api_msg.c
  12. 254
      Ubiquitous/XiUOS/resources/ethernet/LwIP/api/err.c
  13. 204
      Ubiquitous/XiUOS/resources/ethernet/LwIP/api/if_api.c
  14. 500
      Ubiquitous/XiUOS/resources/ethernet/LwIP/api/netbuf.c
  15. 828
      Ubiquitous/XiUOS/resources/ethernet/LwIP/api/netdb.c
  16. 760
      Ubiquitous/XiUOS/resources/ethernet/LwIP/api/netifapi.c
  17. 8336
      Ubiquitous/XiUOS/resources/ethernet/LwIP/api/sockets.c
  18. 1316
      Ubiquitous/XiUOS/resources/ethernet/LwIP/api/tcpip.c
  19. 2356
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/altcp_tls/altcp_tls_mbedtls.c
  20. 420
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/altcp_tls/altcp_tls_mbedtls_mem.c
  21. 144
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/altcp_tls/altcp_tls_mbedtls_mem.h
  22. 166
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/altcp_tls/altcp_tls_mbedtls_structs.h
  23. 1168
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/http/altcp_proxyconnect.c
  24. 348
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/http/fs.c
  25. 674
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/http/fsdata.c
  26. 82
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/http/fsdata.h
  27. 1818
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/http/http_client.c
  28. 5492
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/http/httpd.c
  29. 246
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/http/httpd_structs.h
  30. 194
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/http/makefsdata/makefsdata
  31. 2502
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/http/makefsdata/makefsdata.c
  32. 26
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/http/makefsdata/readme.txt
  33. 1616
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/http/makefsdata/tinydir.h
  34. 1682
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/lwiperf/lwiperf.c
  35. 4814
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/mdns/mdns.c
  36. 2926
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/mqtt/mqtt.c
  37. 1066
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/netbiosns/netbiosns.c
  38. 3110
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/smtp/smtp.c
  39. 1408
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_asn1.c
  40. 226
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_asn1.h
  41. 2706
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_core.c
  42. 166
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_core_priv.h
  43. 232
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_mib2.c
  44. 364
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_mib2_icmp.c
  45. 736
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_mib2_interfaces.c
  46. 1462
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_mib2_ip.c
  47. 454
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_mib2_snmp.c
  48. 752
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_mib2_system.c
  49. 1214
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_mib2_tcp.c
  50. 744
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_mib2_udp.c
  51. 3902
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_msg.c
  52. 370
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_msg.h
  53. 246
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_netconn.c
  54. 312
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_pbuf_stream.c
  55. 144
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_pbuf_stream.h
  56. 206
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_raw.c
  57. 464
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_scalar.c
  58. 180
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_snmpv2_framework.c
  59. 820
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_snmpv2_usm.c
  60. 684
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_table.c
  61. 462
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_threadsync.c
  62. 916
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmp_traps.c
  63. 272
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmpv3.c
  64. 684
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmpv3_mbedtls.c
  65. 138
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/snmp/snmpv3_priv.h
  66. 1738
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/sntp/sntp.c
  67. 870
      Ubiquitous/XiUOS/resources/ethernet/LwIP/apps/tftp/tftp_server.c
  68. 192
      Ubiquitous/XiUOS/resources/ethernet/LwIP/arch/cc.h
  69. 172
      Ubiquitous/XiUOS/resources/ethernet/LwIP/arch/ethernetif.h
  70. 743
      Ubiquitous/XiUOS/resources/ethernet/LwIP/arch/lwipopts.h
  71. 100
      Ubiquitous/XiUOS/resources/ethernet/LwIP/arch/main.h
  72. 76
      Ubiquitous/XiUOS/resources/ethernet/LwIP/arch/perf.h
  73. 891
      Ubiquitous/XiUOS/resources/ethernet/LwIP/arch/sys_arch.c
  74. 204
      Ubiquitous/XiUOS/resources/ethernet/LwIP/arch/sys_arch.h
  75. 1362
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/altcp.c
  76. 174
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/altcp_alloc.c
  77. 1086
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/altcp_tcp.c
  78. 480
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/def.c
  79. 3262
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/dns.c
  80. 1216
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/inet_chksum.c
  81. 760
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/init.c
  82. 334
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ip.c
  83. 1054
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ipv4/autoip.c
  84. 3980
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ipv4/dhcp.c
  85. 2408
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ipv4/etharp.c
  86. 808
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ipv4/icmp.c
  87. 1602
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ipv4/igmp.c
  88. 2266
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ipv4/ip4.c
  89. 642
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ipv4/ip4_addr.c
  90. 1788
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ipv4/ip4_frag.c
  91. 1624
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ipv6/dhcp6.c
  92. 246
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ipv6/ethip6.c
  93. 850
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ipv6/icmp6.c
  94. 106
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ipv6/inet6.c
  95. 2984
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ipv6/ip6.c
  96. 686
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ipv6/ip6_addr.c
  97. 1724
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ipv6/ip6_frag.c
  98. 1252
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ipv6/mld6.c
  99. 4868
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/ipv6/nd6.c
  100. 2034
      Ubiquitous/XiUOS/resources/ethernet/LwIP/core/mem.c

24
APP_Framework/Applications/control_app/Makefile

@ -1,12 +1,12 @@
SRC_DIR :=
ifeq ($(CONFIG_RESOURCES_LWIP),y)
SRC_DIR += lwip_demo
ifeq ($(CONFIG_USING_CONTROL_PLC_OPCUA), y)
SRC_DIR += opcua_demo
endif
endif
include $(KERNEL_ROOT)/compiler.mk
SRC_DIR :=
ifeq ($(CONFIG_RESOURCES_LWIP),y)
SRC_DIR += lwip_demo
ifeq ($(CONFIG_USING_CONTROL_PLC_OPCUA), y)
SRC_DIR += opcua_demo
endif
endif
include $(KERNEL_ROOT)/compiler.mk

6
APP_Framework/Applications/control_app/lwip_demo/lwip_ping_demo.c

@ -32,9 +32,8 @@
* Includes
******************************************************************************/
#if LWIP_IPV4 && LWIP_RAW
//#if LWIP_IPV4 && LWIP_RAW
#if 1
#include "ping.h"
#include "lwip/opt.h"
@ -81,7 +80,6 @@
/* System clock name. */
#define TEST_CLOCK_NAME kCLOCK_CoreSysClk
/*******************************************************************************
* Prototypes
******************************************************************************/

35
APP_Framework/Applications/control_app/lwip_demo/lwip_udp_demo.c

@ -13,7 +13,7 @@
/**
* @file tcp_echo_socket_demo.c
* @brief One UDP demo based on LwIP
* @version 1.0
* @version 1.0
* @author AIIT XUOS Lab
* @date 2021-05-29
*/
@ -23,14 +23,19 @@
#include "udp_echo.h"
#include <connect_ethernet.h>
static void NetStackTaskCreate(void* param);
#define UDP_TASK_STACK_SIZE 2048
extern void TcpIpInit(void);
extern char* send_msg;
int UdpEchoSocketDemo(int argc, char *argv[])
{
static void NetStackTaskCreate(void* param)
{
TcpIpInit();
UdpEchoInit();
}
int LwipUdpDemo(int argc, char *argv[])
{
if (argc == 2)
{
send_msg = argv[1];
@ -42,28 +47,20 @@ int UdpEchoSocketDemo(int argc, char *argv[])
(const char* )"NetStackTaskCreate",
NetStackTaskCreate,
(void* )NULL,
(uint16_t )512,
(uint16_t )UDP_TASK_STACK_SIZE,
15);
if(thr_id >= 0)
StartupKTask(thr_id);
StartupKTask(thr_id);
else{
KPrintf("NetStackTaskCreate create failed !\n");
return -1;
return -1;
}
return 0;
}
#ifndef SEPARATE_COMPILE
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN),
UdpEchoSocketDemo, UdpEchoSocketDemo, tcp_echo_socket function );
UdpTest, LwipUdpDemo, UDP socket demo function);
#endif
static void NetStackTaskCreate(void* param)
{
TcpIpInit();
UdpEchoInit();
}

9
APP_Framework/Applications/control_app/lwip_demo/ping.c

@ -39,8 +39,7 @@
*/
#include "lwip/opt.h"
//tst by wly
#include "ip.h"
#if LWIP_RAW /* don't build if not configured for use in lwipopts.h */
#include "ping.h"
@ -184,8 +183,6 @@ ping_recv(int s)
struct sockaddr_storage from;
int fromlen = sizeof(from);
// lw_print("lw: [%s] recv %d\n",__func__, fromlen);
while((len = lwip_recvfrom(s, buf, sizeof(buf), 0, (struct sockaddr*)&from, (socklen_t*)&fromlen)) > 0) {
if (len >= (int)(sizeof(struct ip_hdr)+sizeof(struct icmp_echo_hdr))) {
ip_addr_t fromaddr;
@ -344,7 +341,6 @@ ping_send(struct raw_pcb *raw, const ip_addr_t *addr)
p = pbuf_alloc(PBUF_IP, (u16_t)ping_size, PBUF_RAM);
if (!p) {
lw_trace();
return;
}
if ((p->len == p->tot_len) && (p->next == NULL)) {
@ -380,9 +376,6 @@ ping_raw_init(void)
ping_pcb = raw_new(IP_PROTO_ICMP);
LWIP_ASSERT("ping_pcb != NULL", ping_pcb != NULL);
//tst by wly
lw_print("lw: [%s] pcb %p\n", __func__, ping_pcb);
raw_recv(ping_pcb, ping_recv, NULL);
raw_bind(ping_pcb, IP_ADDR_ANY);
sys_timeout(PING_DELAY, ping_timeout, ping_pcb);

386
APP_Framework/Applications/control_app/lwip_demo/udp_echo.c

@ -1,191 +1,195 @@
/*
* 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>
*
*/
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file tcpecho.c
* @brief Add UDP client function
* @version 1.0
* @author AIIT XUOS Lab
* @date 2021-05-29
*/
#include "udp_echo.h"
#include "lwip/opt.h"
#if LWIP_SOCKET
#include <lwip/sockets.h>
#include "lwip/sys.h"
#include "lwip/api.h"
#include <xs_ktask.h>
#define RECV_DATA (1024)
char* send_msg = "\n\nThis one is UDP pkg. Congratulations on you.\n\n";
static void UdpEchoThreadServer(void *arg)
{
KPrintf("UdpEchoThreadServer start.\n");
int sock = -1;
char *recv_data;
struct sockaddr_in udp_addr,seraddr;
int recv_data_len;
socklen_t addrlen;
while(1)
{
recv_data = (char *)malloc(RECV_DATA);
if (recv_data == NULL)
{
KPrintf("No memory\n");
goto __exit;
}
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0)
{
KPrintf("Socket error\n");
goto __exit;
}
udp_addr.sin_family = AF_INET;
udp_addr.sin_addr.s_addr = INADDR_ANY;
udp_addr.sin_port = htons(LOCAL_PORT_SERVER);
memset(&(udp_addr.sin_zero), 0, sizeof(udp_addr.sin_zero));
if (bind(sock, (struct sockaddr *)&udp_addr, sizeof(struct sockaddr)) == -1)
{
KPrintf("Unable to bind\n");
goto __exit;
}
KPrintf("UDP bind sucess, start to receive.\n");
KPrintf("\n\nLocal Port:%d\n\n", LOCAL_PORT_SERVER);
while(1)
{
memset(recv_data, 0, RECV_DATA);
recv_data_len=recvfrom(sock,recv_data,
RECV_DATA,0,
(struct sockaddr*)&seraddr,
&addrlen);
KPrintf("Receive from : %s\n",inet_ntoa(seraddr.sin_addr));
KPrintf("Recevce data : %s\n\n",recv_data);
sendto(sock,recv_data,
recv_data_len,0,
(struct sockaddr*)&seraddr,
addrlen);
}
__exit:
if (sock >= 0) closesocket(sock);
if (recv_data) free(recv_data);
}
}
static void UdpEchoThreadClient(void *arg)
{
KPrintf("UdpEchoThreadClient start.\n");
int sock_udp_send_once = -1;
sock_udp_send_once = socket(AF_INET, SOCK_DGRAM, 0);
if (sock_udp_send_once < 0)
{
KPrintf("Socket error\n");
goto __exit;
}
struct sockaddr_in udp_sock;
udp_sock.sin_family = AF_INET;
udp_sock.sin_port = htons(TARGET_PORT_CLIENT);
udp_sock.sin_addr.s_addr = PP_HTONL(LWIP_MAKEU32(IP_ADDR0_SERVER,IP_ADDR1_SERVER,IP_ADDR2_SERVER,IP_ADDR3_SERVER));
memset(&(udp_sock.sin_zero), 0, sizeof(udp_sock.sin_zero));
if (connect(sock_udp_send_once, (struct sockaddr *)&udp_sock, sizeof(struct sockaddr)))
{
KPrintf("Unable to connect\n");
goto __exit;
}
KPrintf("UDP connect sucess, start to send.\n");
KPrintf("\n\nTarget Port:%d\n\n", udp_sock.sin_port);
while (1)
{
KPrintf("Lwip client is running.\n");
sendto(sock_udp_send_once,send_msg,
strlen(send_msg),0,
(struct sockaddr*)&udp_sock,
sizeof(struct sockaddr));
KPrintf("Send UDP msg: %s ", send_msg);
MdelayKTask(1000);
}
__exit:
if (sock_udp_send_once >= 0) closesocket(sock_udp_send_once);
return;
}
void
UdpEchoInit(void)
{
#ifdef SET_AS_SERVER
sys_thread_new("UdpEchoThreadServer", UdpEchoThreadServer, NULL, 2048, 4);
#else
sys_thread_new("UdpEchoThreadClient", UdpEchoThreadClient, NULL, 2048, 4);
#endif
}
#endif /* LWIP_NETCONN */
/*
* 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>
*
*/
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file tcpecho.c
* @brief Add UDP client function
* @version 1.0
* @author AIIT XUOS Lab
* @date 2021-05-29
*/
#include "udp_echo.h"
#include "lwip/opt.h"
#if LWIP_SOCKET
#include <lwip/sockets.h>
#include "lwip/sys.h"
#include "lwip/api.h"
#include <xs_ktask.h>
#ifdef BOARD_CORTEX_M7_EVB
#define LWIP_UDP_TASK_STACK 4096
#else
#define LWIP_UDP_TASK_STACK 2048
#endif
#define RECV_DATA (1024)
char* send_msg = "\n\nThis one is UDP pkg. Congratulations on you.\n\n";
static void UdpEchoThreadServer(void *arg)
{
KPrintf("UdpEchoThreadServer start.\n");
int sock = -1;
char *recv_data;
struct sockaddr_in udp_addr,seraddr;
int recv_data_len;
socklen_t addrlen;
while(1)
{
recv_data = (char *)malloc(RECV_DATA);
if (recv_data == NULL)
{
KPrintf("No memory\n");
goto __exit;
}
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0)
{
KPrintf("Socket error\n");
goto __exit;
}
udp_addr.sin_family = AF_INET;
udp_addr.sin_addr.s_addr = INADDR_ANY;
udp_addr.sin_port = htons(LOCAL_PORT_SERVER);
memset(&(udp_addr.sin_zero), 0, sizeof(udp_addr.sin_zero));
if (bind(sock, (struct sockaddr *)&udp_addr, sizeof(struct sockaddr)) == -1)
{
KPrintf("Unable to bind\n");
goto __exit;
}
KPrintf("UDP bind sucess, start to receive.\n");
KPrintf("\n\nLocal Port:%d\n\n", LOCAL_PORT_SERVER);
while(1)
{
memset(recv_data, 0, RECV_DATA);
recv_data_len=recvfrom(sock,recv_data,
RECV_DATA,0,
(struct sockaddr*)&seraddr,
&addrlen);
KPrintf("Receive from : %s\n",inet_ntoa(seraddr.sin_addr));
KPrintf("Recevce data : %s\n\n",recv_data);
sendto(sock,recv_data,
recv_data_len,0,
(struct sockaddr*)&seraddr,
addrlen);
}
__exit:
if (sock >= 0) closesocket(sock);
if (recv_data) free(recv_data);
}
}
static void UdpEchoThreadClient(void *arg)
{
KPrintf("UdpEchoThreadClient start.\n");
int sock_udp_send_once = -1;
sock_udp_send_once = socket(AF_INET, SOCK_DGRAM, 0);
if (sock_udp_send_once < 0)
{
KPrintf("Socket error\n");
goto __exit;
}
struct sockaddr_in udp_sock;
udp_sock.sin_family = AF_INET;
udp_sock.sin_port = htons(TARGET_PORT_CLIENT);
udp_sock.sin_addr.s_addr = PP_HTONL(LWIP_MAKEU32(IP_ADDR0_SERVER,IP_ADDR1_SERVER,IP_ADDR2_SERVER,IP_ADDR3_SERVER));
memset(&(udp_sock.sin_zero), 0, sizeof(udp_sock.sin_zero));
if (connect(sock_udp_send_once, (struct sockaddr *)&udp_sock, sizeof(struct sockaddr)))
{
KPrintf("Unable to connect\n");
goto __exit;
}
KPrintf("UDP connect sucess, start to send.\n");
KPrintf("\n\nTarget Port:%d\n\n", udp_sock.sin_port);
while (1)
{
KPrintf("Lwip client is running.\n");
sendto(sock_udp_send_once,send_msg,
strlen(send_msg),0,
(struct sockaddr*)&udp_sock,
sizeof(struct sockaddr));
KPrintf("Send UDP msg: %s ", send_msg);
MdelayKTask(1000);
}
__exit:
if (sock_udp_send_once >= 0) closesocket(sock_udp_send_once);
return;
}
void
UdpEchoInit(void)
{
#ifdef SET_AS_SERVER
sys_thread_new("UdpEchoThreadServer", UdpEchoThreadServer, NULL, LWIP_UDP_TASK_STACK, 4);
#else
sys_thread_new("UdpEchoThreadClient", UdpEchoThreadClient, NULL, LWIP_UDP_TASK_STACK, 4);
#endif
}
#endif /* LWIP_NETCONN */

2
Ubiquitous/XiUOS/board/ok1052-c/third_party_driver/ethernet/enet_ethernetif.c

@ -287,7 +287,7 @@ err_t ethernetif_init(struct netif *netif, struct ethernetif *ethernetif,
/* Init ethernetif parameters.*/
*ethernetif_enet_ptr(ethernetif) = ethernetif_get_enet_base(enetIdx);
LWIP_ASSERT("*ethernetif_enet_ptr(ethernetif) != NULL", (*ethernetif_enet_ptr(ethernetif) != NULL));
// LWIP_ASSERT("*ethernetif_enet_ptr(ethernetif) != NULL", (*ethernetif_enet_ptr(ethernetif) != NULL));
/* set MAC hardware address length */
netif->hwaddr_len = ETH_HWADDR_LEN;

30
Ubiquitous/XiUOS/resources/ethernet/LwIP/FILES

@ -1,15 +1,15 @@
api/ - The code for the high-level wrapper API. Not needed if
you use the lowel-level call-back/raw API.
apps/ - Higher layer applications that are specifically programmed
with the lwIP low-level raw API.
core/ - The core of the TPC/IP stack; protocol implementations,
memory and buffer management, and the low-level raw API.
include/ - lwIP include files.
netif/ - Generic network interface device drivers are kept here.
For more information on the various subdirectories, check the FILES
file in each directory.
api/ - The code for the high-level wrapper API. Not needed if
you use the lowel-level call-back/raw API.
apps/ - Higher layer applications that are specifically programmed
with the lwIP low-level raw API.
core/ - The core of the TPC/IP stack; protocol implementations,
memory and buffer management, and the low-level raw API.
include/ - lwIP include files.
netif/ - Generic network interface device drivers are kept here.
For more information on the various subdirectories, check the FILES
file in each directory.

558
Ubiquitous/XiUOS/resources/ethernet/LwIP/Filelists.cmake

@ -1,279 +1,279 @@
# This file is indended to be included in end-user CMakeLists.txt
# include(/path/to/Filelists.cmake)
# It assumes the variable LWIP_DIR is defined pointing to the
# root path of lwIP 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.
set(LWIP_VERSION_MAJOR "2")
set(LWIP_VERSION_MINOR "1")
set(LWIP_VERSION_REVISION "2")
# LWIP_VERSION_RC is set to LWIP_RC_RELEASE for official releases
# LWIP_VERSION_RC is set to LWIP_RC_DEVELOPMENT for Git versions
# Numbers 1..31 are reserved for release candidates
set(LWIP_VERSION_RC "LWIP_RC_RELEASE")
if ("${LWIP_VERSION_RC}" STREQUAL "LWIP_RC_RELEASE")
set(LWIP_VERSION_STRING
"${LWIP_VERSION_MAJOR}.${LWIP_VERSION_MINOR}.${LWIP_VERSION_REVISION}"
)
elseif ("${LWIP_VERSION_RC}" STREQUAL "LWIP_RC_DEVELOPMENT")
set(LWIP_VERSION_STRING
"${LWIP_VERSION_MAJOR}.${LWIP_VERSION_MINOR}.${LWIP_VERSION_REVISION}.dev"
)
else ("${LWIP_VERSION_RC}" STREQUAL "LWIP_RC_RELEASE")
set(LWIP_VERSION_STRING
"${LWIP_VERSION_MAJOR}.${LWIP_VERSION_MINOR}.${LWIP_VERSION_REVISION}.rc${LWIP_VERSION_RC}"
)
endif ("${LWIP_VERSION_RC}" STREQUAL "LWIP_RC_RELEASE")
# The minimum set of files needed for lwIP.
set(lwipcore_SRCS
${LWIP_DIR}/src/core/init.c
${LWIP_DIR}/src/core/def.c
${LWIP_DIR}/src/core/dns.c
${LWIP_DIR}/src/core/inet_chksum.c
${LWIP_DIR}/src/core/ip.c
${LWIP_DIR}/src/core/mem.c
${LWIP_DIR}/src/core/memp.c
${LWIP_DIR}/src/core/netif.c
${LWIP_DIR}/src/core/pbuf.c
${LWIP_DIR}/src/core/raw.c
${LWIP_DIR}/src/core/stats.c
${LWIP_DIR}/src/core/sys.c
${LWIP_DIR}/src/core/altcp.c
${LWIP_DIR}/src/core/altcp_alloc.c
${LWIP_DIR}/src/core/altcp_tcp.c
${LWIP_DIR}/src/core/tcp.c
${LWIP_DIR}/src/core/tcp_in.c
${LWIP_DIR}/src/core/tcp_out.c
${LWIP_DIR}/src/core/timeouts.c
${LWIP_DIR}/src/core/udp.c
)
set(lwipcore4_SRCS
${LWIP_DIR}/src/core/ipv4/autoip.c
${LWIP_DIR}/src/core/ipv4/dhcp.c
${LWIP_DIR}/src/core/ipv4/etharp.c
${LWIP_DIR}/src/core/ipv4/icmp.c
${LWIP_DIR}/src/core/ipv4/igmp.c
${LWIP_DIR}/src/core/ipv4/ip4_frag.c
${LWIP_DIR}/src/core/ipv4/ip4.c
${LWIP_DIR}/src/core/ipv4/ip4_addr.c
)
set(lwipcore6_SRCS
${LWIP_DIR}/src/core/ipv6/dhcp6.c
${LWIP_DIR}/src/core/ipv6/ethip6.c
${LWIP_DIR}/src/core/ipv6/icmp6.c
${LWIP_DIR}/src/core/ipv6/inet6.c
${LWIP_DIR}/src/core/ipv6/ip6.c
${LWIP_DIR}/src/core/ipv6/ip6_addr.c
${LWIP_DIR}/src/core/ipv6/ip6_frag.c
${LWIP_DIR}/src/core/ipv6/mld6.c
${LWIP_DIR}/src/core/ipv6/nd6.c
)
# APIFILES: The files which implement the sequential and socket APIs.
set(lwipapi_SRCS
${LWIP_DIR}/src/api/api_lib.c
${LWIP_DIR}/src/api/api_msg.c
${LWIP_DIR}/src/api/err.c
${LWIP_DIR}/src/api/if_api.c
${LWIP_DIR}/src/api/netbuf.c
${LWIP_DIR}/src/api/netdb.c
${LWIP_DIR}/src/api/netifapi.c
${LWIP_DIR}/src/api/sockets.c
${LWIP_DIR}/src/api/tcpip.c
)
# Files implementing various generic network interface functions
set(lwipnetif_SRCS
${LWIP_DIR}/src/netif/ethernet.c
${LWIP_DIR}/src/netif/bridgeif.c
${LWIP_DIR}/src/netif/bridgeif_fdb.c
${LWIP_DIR}/src/netif/slipif.c
)
# 6LoWPAN
set(lwipsixlowpan_SRCS
${LWIP_DIR}/src/netif/lowpan6_common.c
${LWIP_DIR}/src/netif/lowpan6.c
${LWIP_DIR}/src/netif/lowpan6_ble.c
${LWIP_DIR}/src/netif/zepif.c
)
# PPP
set(lwipppp_SRCS
${LWIP_DIR}/src/netif/ppp/auth.c
${LWIP_DIR}/src/netif/ppp/ccp.c
${LWIP_DIR}/src/netif/ppp/chap-md5.c
${LWIP_DIR}/src/netif/ppp/chap_ms.c
${LWIP_DIR}/src/netif/ppp/chap-new.c
${LWIP_DIR}/src/netif/ppp/demand.c
${LWIP_DIR}/src/netif/ppp/eap.c
${LWIP_DIR}/src/netif/ppp/ecp.c
${LWIP_DIR}/src/netif/ppp/eui64.c
${LWIP_DIR}/src/netif/ppp/fsm.c
${LWIP_DIR}/src/netif/ppp/ipcp.c
${LWIP_DIR}/src/netif/ppp/ipv6cp.c
${LWIP_DIR}/src/netif/ppp/lcp.c
${LWIP_DIR}/src/netif/ppp/magic.c
${LWIP_DIR}/src/netif/ppp/mppe.c
${LWIP_DIR}/src/netif/ppp/multilink.c
${LWIP_DIR}/src/netif/ppp/ppp.c
${LWIP_DIR}/src/netif/ppp/pppapi.c
${LWIP_DIR}/src/netif/ppp/pppcrypt.c
${LWIP_DIR}/src/netif/ppp/pppoe.c
${LWIP_DIR}/src/netif/ppp/pppol2tp.c
${LWIP_DIR}/src/netif/ppp/pppos.c
${LWIP_DIR}/src/netif/ppp/upap.c
${LWIP_DIR}/src/netif/ppp/utils.c
${LWIP_DIR}/src/netif/ppp/vj.c
${LWIP_DIR}/src/netif/ppp/polarssl/arc4.c
${LWIP_DIR}/src/netif/ppp/polarssl/des.c
${LWIP_DIR}/src/netif/ppp/polarssl/md4.c
${LWIP_DIR}/src/netif/ppp/polarssl/md5.c
${LWIP_DIR}/src/netif/ppp/polarssl/sha1.c
)
# SNMPv3 agent
set(lwipsnmp_SRCS
${LWIP_DIR}/src/apps/snmp/snmp_asn1.c
${LWIP_DIR}/src/apps/snmp/snmp_core.c
${LWIP_DIR}/src/apps/snmp/snmp_mib2.c
${LWIP_DIR}/src/apps/snmp/snmp_mib2_icmp.c
${LWIP_DIR}/src/apps/snmp/snmp_mib2_interfaces.c
${LWIP_DIR}/src/apps/snmp/snmp_mib2_ip.c
${LWIP_DIR}/src/apps/snmp/snmp_mib2_snmp.c
${LWIP_DIR}/src/apps/snmp/snmp_mib2_system.c
${LWIP_DIR}/src/apps/snmp/snmp_mib2_tcp.c
${LWIP_DIR}/src/apps/snmp/snmp_mib2_udp.c
${LWIP_DIR}/src/apps/snmp/snmp_snmpv2_framework.c
${LWIP_DIR}/src/apps/snmp/snmp_snmpv2_usm.c
${LWIP_DIR}/src/apps/snmp/snmp_msg.c
${LWIP_DIR}/src/apps/snmp/snmpv3.c
${LWIP_DIR}/src/apps/snmp/snmp_netconn.c
${LWIP_DIR}/src/apps/snmp/snmp_pbuf_stream.c
${LWIP_DIR}/src/apps/snmp/snmp_raw.c
${LWIP_DIR}/src/apps/snmp/snmp_scalar.c
${LWIP_DIR}/src/apps/snmp/snmp_table.c
${LWIP_DIR}/src/apps/snmp/snmp_threadsync.c
${LWIP_DIR}/src/apps/snmp/snmp_traps.c
)
# HTTP server + client
set(lwiphttp_SRCS
${LWIP_DIR}/src/apps/http/altcp_proxyconnect.c
${LWIP_DIR}/src/apps/http/fs.c
${LWIP_DIR}/src/apps/http/http_client.c
${LWIP_DIR}/src/apps/http/httpd.c
)
# MAKEFSDATA HTTP server host utility
set(lwipmakefsdata_SRCS
${LWIP_DIR}/src/apps/http/makefsdata/makefsdata.c
)
# IPERF server
set(lwipiperf_SRCS
${LWIP_DIR}/src/apps/lwiperf/lwiperf.c
)
# SMTP client
set(lwipsmtp_SRCS
${LWIP_DIR}/src/apps/smtp/smtp.c
)
# SNTP client
set(lwipsntp_SRCS
${LWIP_DIR}/src/apps/sntp/sntp.c
)
# MDNS responder
set(lwipmdns_SRCS
${LWIP_DIR}/src/apps/mdns/mdns.c
)
# NetBIOS name server
set(lwipnetbios_SRCS
${LWIP_DIR}/src/apps/netbiosns/netbiosns.c
)
# TFTP server files
set(lwiptftp_SRCS
${LWIP_DIR}/src/apps/tftp/tftp_server.c
)
# MQTT client files
set(lwipmqtt_SRCS
${LWIP_DIR}/src/apps/mqtt/mqtt.c
)
# ARM MBEDTLS related files of lwIP rep
set(lwipmbedtls_SRCS
${LWIP_DIR}/src/apps/altcp_tls/altcp_tls_mbedtls.c
${LWIP_DIR}/src/apps/altcp_tls/altcp_tls_mbedtls_mem.c
${LWIP_DIR}/src/apps/snmp/snmpv3_mbedtls.c
)
# All LWIP files without apps
set(lwipnoapps_SRCS
${lwipcore_SRCS}
${lwipcore4_SRCS}
${lwipcore6_SRCS}
${lwipapi_SRCS}
${lwipnetif_SRCS}
${lwipsixlowpan_SRCS}
${lwipppp_SRCS}
)
# LWIPAPPFILES: All LWIP APPs
set(lwipallapps_SRCS
${lwipsnmp_SRCS}
${lwiphttp_SRCS}
${lwipiperf_SRCS}
${lwipsmtp_SRCS}
${lwipsntp_SRCS}
${lwipmdns_SRCS}
${lwipnetbios_SRCS}
${lwiptftp_SRCS}
${lwipmqtt_SRCS}
${lwipmbedtls_SRCS}
)
# Generate lwip/init.h (version info)
configure_file(${LWIP_DIR}/src/include/lwip/init.h.cmake.in ${LWIP_DIR}/src/include/lwip/init.h)
# Documentation
set(DOXYGEN_DIR ${LWIP_DIR}/doc/doxygen)
set(DOXYGEN_OUTPUT_DIR output)
set(DOXYGEN_IN ${LWIP_DIR}/doc/doxygen/lwip.Doxyfile.cmake.in)
set(DOXYGEN_OUT ${LWIP_DIR}/doc/doxygen/lwip.Doxyfile)
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT})
find_package(Doxygen)
if (DOXYGEN_FOUND)
message("Doxygen build started")
add_custom_target(lwipdocs
COMMAND ${CMAKE_COMMAND} -E remove_directory ${DOXYGEN_DIR}/${DOXYGEN_OUTPUT_DIR}/html
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${DOXYGEN_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
else (DOXYGEN_FOUND)
message("Doxygen needs to be installed to generate the doxygen documentation")
endif (DOXYGEN_FOUND)
# lwIP libraries
add_library(lwipcore EXCLUDE_FROM_ALL ${lwipnoapps_SRCS})
target_compile_options(lwipcore PRIVATE ${LWIP_COMPILER_FLAGS})
target_compile_definitions(lwipcore PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS})
target_include_directories(lwipcore PRIVATE ${LWIP_INCLUDE_DIRS} ${LWIP_MBEDTLS_INCLUDE_DIRS})
add_library(lwipallapps EXCLUDE_FROM_ALL ${lwipallapps_SRCS})
target_compile_options(lwipallapps PRIVATE ${LWIP_COMPILER_FLAGS})
target_compile_definitions(lwipallapps PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS})
target_include_directories(lwipallapps PRIVATE ${LWIP_INCLUDE_DIRS} ${LWIP_MBEDTLS_INCLUDE_DIRS})
# This file is indended to be included in end-user CMakeLists.txt
# include(/path/to/Filelists.cmake)
# It assumes the variable LWIP_DIR is defined pointing to the
# root path of lwIP 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.
set(LWIP_VERSION_MAJOR "2")
set(LWIP_VERSION_MINOR "1")
set(LWIP_VERSION_REVISION "2")
# LWIP_VERSION_RC is set to LWIP_RC_RELEASE for official releases
# LWIP_VERSION_RC is set to LWIP_RC_DEVELOPMENT for Git versions
# Numbers 1..31 are reserved for release candidates
set(LWIP_VERSION_RC "LWIP_RC_RELEASE")
if ("${LWIP_VERSION_RC}" STREQUAL "LWIP_RC_RELEASE")
set(LWIP_VERSION_STRING
"${LWIP_VERSION_MAJOR}.${LWIP_VERSION_MINOR}.${LWIP_VERSION_REVISION}"
)
elseif ("${LWIP_VERSION_RC}" STREQUAL "LWIP_RC_DEVELOPMENT")
set(LWIP_VERSION_STRING
"${LWIP_VERSION_MAJOR}.${LWIP_VERSION_MINOR}.${LWIP_VERSION_REVISION}.dev"
)
else ("${LWIP_VERSION_RC}" STREQUAL "LWIP_RC_RELEASE")
set(LWIP_VERSION_STRING
"${LWIP_VERSION_MAJOR}.${LWIP_VERSION_MINOR}.${LWIP_VERSION_REVISION}.rc${LWIP_VERSION_RC}"
)
endif ("${LWIP_VERSION_RC}" STREQUAL "LWIP_RC_RELEASE")
# The minimum set of files needed for lwIP.
set(lwipcore_SRCS
${LWIP_DIR}/src/core/init.c
${LWIP_DIR}/src/core/def.c
${LWIP_DIR}/src/core/dns.c
${LWIP_DIR}/src/core/inet_chksum.c
${LWIP_DIR}/src/core/ip.c
${LWIP_DIR}/src/core/mem.c
${LWIP_DIR}/src/core/memp.c
${LWIP_DIR}/src/core/netif.c
${LWIP_DIR}/src/core/pbuf.c
${LWIP_DIR}/src/core/raw.c
${LWIP_DIR}/src/core/stats.c
${LWIP_DIR}/src/core/sys.c
${LWIP_DIR}/src/core/altcp.c
${LWIP_DIR}/src/core/altcp_alloc.c
${LWIP_DIR}/src/core/altcp_tcp.c
${LWIP_DIR}/src/core/tcp.c
${LWIP_DIR}/src/core/tcp_in.c
${LWIP_DIR}/src/core/tcp_out.c
${LWIP_DIR}/src/core/timeouts.c
${LWIP_DIR}/src/core/udp.c
)
set(lwipcore4_SRCS
${LWIP_DIR}/src/core/ipv4/autoip.c
${LWIP_DIR}/src/core/ipv4/dhcp.c
${LWIP_DIR}/src/core/ipv4/etharp.c
${LWIP_DIR}/src/core/ipv4/icmp.c
${LWIP_DIR}/src/core/ipv4/igmp.c
${LWIP_DIR}/src/core/ipv4/ip4_frag.c
${LWIP_DIR}/src/core/ipv4/ip4.c
${LWIP_DIR}/src/core/ipv4/ip4_addr.c
)
set(lwipcore6_SRCS
${LWIP_DIR}/src/core/ipv6/dhcp6.c
${LWIP_DIR}/src/core/ipv6/ethip6.c
${LWIP_DIR}/src/core/ipv6/icmp6.c
${LWIP_DIR}/src/core/ipv6/inet6.c
${LWIP_DIR}/src/core/ipv6/ip6.c
${LWIP_DIR}/src/core/ipv6/ip6_addr.c
${LWIP_DIR}/src/core/ipv6/ip6_frag.c
${LWIP_DIR}/src/core/ipv6/mld6.c
${LWIP_DIR}/src/core/ipv6/nd6.c
)
# APIFILES: The files which implement the sequential and socket APIs.
set(lwipapi_SRCS
${LWIP_DIR}/src/api/api_lib.c
${LWIP_DIR}/src/api/api_msg.c
${LWIP_DIR}/src/api/err.c
${LWIP_DIR}/src/api/if_api.c
${LWIP_DIR}/src/api/netbuf.c
${LWIP_DIR}/src/api/netdb.c
${LWIP_DIR}/src/api/netifapi.c
${LWIP_DIR}/src/api/sockets.c
${LWIP_DIR}/src/api/tcpip.c
)
# Files implementing various generic network interface functions
set(lwipnetif_SRCS
${LWIP_DIR}/src/netif/ethernet.c
${LWIP_DIR}/src/netif/bridgeif.c
${LWIP_DIR}/src/netif/bridgeif_fdb.c
${LWIP_DIR}/src/netif/slipif.c
)
# 6LoWPAN
set(lwipsixlowpan_SRCS
${LWIP_DIR}/src/netif/lowpan6_common.c
${LWIP_DIR}/src/netif/lowpan6.c
${LWIP_DIR}/src/netif/lowpan6_ble.c
${LWIP_DIR}/src/netif/zepif.c
)
# PPP
set(lwipppp_SRCS
${LWIP_DIR}/src/netif/ppp/auth.c
${LWIP_DIR}/src/netif/ppp/ccp.c
${LWIP_DIR}/src/netif/ppp/chap-md5.c
${LWIP_DIR}/src/netif/ppp/chap_ms.c
${LWIP_DIR}/src/netif/ppp/chap-new.c
${LWIP_DIR}/src/netif/ppp/demand.c
${LWIP_DIR}/src/netif/ppp/eap.c
${LWIP_DIR}/src/netif/ppp/ecp.c
${LWIP_DIR}/src/netif/ppp/eui64.c
${LWIP_DIR}/src/netif/ppp/fsm.c
${LWIP_DIR}/src/netif/ppp/ipcp.c
${LWIP_DIR}/src/netif/ppp/ipv6cp.c
${LWIP_DIR}/src/netif/ppp/lcp.c
${LWIP_DIR}/src/netif/ppp/magic.c
${LWIP_DIR}/src/netif/ppp/mppe.c
${LWIP_DIR}/src/netif/ppp/multilink.c
${LWIP_DIR}/src/netif/ppp/ppp.c
${LWIP_DIR}/src/netif/ppp/pppapi.c
${LWIP_DIR}/src/netif/ppp/pppcrypt.c
${LWIP_DIR}/src/netif/ppp/pppoe.c
${LWIP_DIR}/src/netif/ppp/pppol2tp.c
${LWIP_DIR}/src/netif/ppp/pppos.c
${LWIP_DIR}/src/netif/ppp/upap.c
${LWIP_DIR}/src/netif/ppp/utils.c
${LWIP_DIR}/src/netif/ppp/vj.c
${LWIP_DIR}/src/netif/ppp/polarssl/arc4.c
${LWIP_DIR}/src/netif/ppp/polarssl/des.c
${LWIP_DIR}/src/netif/ppp/polarssl/md4.c
${LWIP_DIR}/src/netif/ppp/polarssl/md5.c
${LWIP_DIR}/src/netif/ppp/polarssl/sha1.c
)
# SNMPv3 agent
set(lwipsnmp_SRCS
${LWIP_DIR}/src/apps/snmp/snmp_asn1.c
${LWIP_DIR}/src/apps/snmp/snmp_core.c
${LWIP_DIR}/src/apps/snmp/snmp_mib2.c
${LWIP_DIR}/src/apps/snmp/snmp_mib2_icmp.c
${LWIP_DIR}/src/apps/snmp/snmp_mib2_interfaces.c
${LWIP_DIR}/src/apps/snmp/snmp_mib2_ip.c
${LWIP_DIR}/src/apps/snmp/snmp_mib2_snmp.c
${LWIP_DIR}/src/apps/snmp/snmp_mib2_system.c
${LWIP_DIR}/src/apps/snmp/snmp_mib2_tcp.c
${LWIP_DIR}/src/apps/snmp/snmp_mib2_udp.c
${LWIP_DIR}/src/apps/snmp/snmp_snmpv2_framework.c
${LWIP_DIR}/src/apps/snmp/snmp_snmpv2_usm.c
${LWIP_DIR}/src/apps/snmp/snmp_msg.c
${LWIP_DIR}/src/apps/snmp/snmpv3.c
${LWIP_DIR}/src/apps/snmp/snmp_netconn.c
${LWIP_DIR}/src/apps/snmp/snmp_pbuf_stream.c
${LWIP_DIR}/src/apps/snmp/snmp_raw.c
${LWIP_DIR}/src/apps/snmp/snmp_scalar.c
${LWIP_DIR}/src/apps/snmp/snmp_table.c
${LWIP_DIR}/src/apps/snmp/snmp_threadsync.c
${LWIP_DIR}/src/apps/snmp/snmp_traps.c
)
# HTTP server + client
set(lwiphttp_SRCS
${LWIP_DIR}/src/apps/http/altcp_proxyconnect.c
${LWIP_DIR}/src/apps/http/fs.c
${LWIP_DIR}/src/apps/http/http_client.c
${LWIP_DIR}/src/apps/http/httpd.c
)
# MAKEFSDATA HTTP server host utility
set(lwipmakefsdata_SRCS
${LWIP_DIR}/src/apps/http/makefsdata/makefsdata.c
)
# IPERF server
set(lwipiperf_SRCS
${LWIP_DIR}/src/apps/lwiperf/lwiperf.c
)
# SMTP client
set(lwipsmtp_SRCS
${LWIP_DIR}/src/apps/smtp/smtp.c
)
# SNTP client
set(lwipsntp_SRCS
${LWIP_DIR}/src/apps/sntp/sntp.c
)
# MDNS responder
set(lwipmdns_SRCS
${LWIP_DIR}/src/apps/mdns/mdns.c
)
# NetBIOS name server
set(lwipnetbios_SRCS
${LWIP_DIR}/src/apps/netbiosns/netbiosns.c
)
# TFTP server files
set(lwiptftp_SRCS
${LWIP_DIR}/src/apps/tftp/tftp_server.c
)
# MQTT client files
set(lwipmqtt_SRCS
${LWIP_DIR}/src/apps/mqtt/mqtt.c
)
# ARM MBEDTLS related files of lwIP rep
set(lwipmbedtls_SRCS
${LWIP_DIR}/src/apps/altcp_tls/altcp_tls_mbedtls.c
${LWIP_DIR}/src/apps/altcp_tls/altcp_tls_mbedtls_mem.c
${LWIP_DIR}/src/apps/snmp/snmpv3_mbedtls.c
)
# All LWIP files without apps
set(lwipnoapps_SRCS
${lwipcore_SRCS}
${lwipcore4_SRCS}
${lwipcore6_SRCS}
${lwipapi_SRCS}
${lwipnetif_SRCS}
${lwipsixlowpan_SRCS}
${lwipppp_SRCS}
)
# LWIPAPPFILES: All LWIP APPs
set(lwipallapps_SRCS
${lwipsnmp_SRCS}
${lwiphttp_SRCS}
${lwipiperf_SRCS}
${lwipsmtp_SRCS}
${lwipsntp_SRCS}
${lwipmdns_SRCS}
${lwipnetbios_SRCS}
${lwiptftp_SRCS}
${lwipmqtt_SRCS}
${lwipmbedtls_SRCS}
)
# Generate lwip/init.h (version info)
configure_file(${LWIP_DIR}/src/include/lwip/init.h.cmake.in ${LWIP_DIR}/src/include/lwip/init.h)
# Documentation
set(DOXYGEN_DIR ${LWIP_DIR}/doc/doxygen)
set(DOXYGEN_OUTPUT_DIR output)
set(DOXYGEN_IN ${LWIP_DIR}/doc/doxygen/lwip.Doxyfile.cmake.in)
set(DOXYGEN_OUT ${LWIP_DIR}/doc/doxygen/lwip.Doxyfile)
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT})
find_package(Doxygen)
if (DOXYGEN_FOUND)
message("Doxygen build started")
add_custom_target(lwipdocs
COMMAND