https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a0a19c60d04a5076188a4…
commit a0a19c60d04a5076188a4753bd356d7680a96319
Author: Victor Perevertkin <victor.perevertkin(a)reactos.org>
AuthorDate: Tue Jan 31 03:07:51 2023 +0300
Commit: Victor Perevertkin <victor.perevertkin(a)reactos.org>
CommitDate: Wed Feb 1 02:31:14 2023 +0300
[TCPIP] Rearrange LwIP glue code.
Reduce unnecessary stuff in LwIP itself.
---
drivers/network/tcpip/CMakeLists.txt | 6 ++----
drivers/network/tcpip/ip/CMakeLists.txt | 17 ++++++++---------
.../tcpip/{lwip/src/rosip.c => ip/lwip_glue/ip.c} | 12 +++++-------
.../src/include/rosip.h => ip/lwip_glue/lwip_glue.h} | 12 ++++++------
.../tcpip/{lwip/src/rosmem.c => ip/lwip_glue/memory.c} | 5 +----
.../network/tcpip/{lwip/src => ip/lwip_glue}/sys_arch.c | 11 +++--------
.../tcpip/{lwip/src/rostcp.c => ip/lwip_glue/tcp.c} | 9 +++------
drivers/network/tcpip/ip/precomp.h | 1 +
drivers/network/tcpip/ip/transport/tcp/accept.c | 2 +-
drivers/network/tcpip/ip/transport/tcp/event.c | 2 +-
drivers/network/tcpip/ip/transport/tcp/tcp.c | 2 +-
drivers/network/tcpip/lwip/CMakeLists.txt | 11 +++--------
drivers/network/tcpip/lwip/src/include/arch/sys_arch.h | 4 ----
13 files changed, 35 insertions(+), 59 deletions(-)
diff --git a/drivers/network/tcpip/CMakeLists.txt b/drivers/network/tcpip/CMakeLists.txt
index 7e6426d24f3..0105aa31659 100644
--- a/drivers/network/tcpip/CMakeLists.txt
+++ b/drivers/network/tcpip/CMakeLists.txt
@@ -33,11 +33,9 @@ add_library(tcpip MODULE
${CMAKE_CURRENT_BINARY_DIR}/tcpip.def)
target_include_directories(tcpip BEFORE
- PRIVATE include
- PRIVATE lwip/src/include
- PRIVATE lwip/src/include/ipv4)
+ PRIVATE include)
-target_link_libraries(tcpip ip lwip ${PSEH_LIB})
+target_link_libraries(tcpip ip ${PSEH_LIB})
set_module_type(tcpip kernelmodedriver)
add_importlibs(tcpip ndis ntoskrnl hal)
add_pch(tcpip include/precomp.h SOURCE)
diff --git a/drivers/network/tcpip/ip/CMakeLists.txt
b/drivers/network/tcpip/ip/CMakeLists.txt
index 65488a5df19..9a35b04d0ee 100644
--- a/drivers/network/tcpip/ip/CMakeLists.txt
+++ b/drivers/network/tcpip/ip/CMakeLists.txt
@@ -1,14 +1,13 @@
-include_directories(
- BEFORE ${REACTOS_SOURCE_DIR}/drivers/network/tcpip/include
- ${REACTOS_SOURCE_DIR}/sdk/lib/drivers/lwip/src/include
- ${REACTOS_SOURCE_DIR}/sdk/lib/drivers/lwip/src/include/ipv4)
-
if(ARCH STREQUAL "i386")
add_asm_files(ip_asm network/i386/checksum.S)
endif()
list(APPEND SOURCE
+ lwip_glue/ip.c
+ lwip_glue/memory.c
+ lwip_glue/sys_arch.c
+ lwip_glue/tcp.c
network/address.c
network/arp.c
network/checksum.c
@@ -30,11 +29,11 @@ list(APPEND SOURCE
transport/tcp/tcp.c
transport/udp/udp.c)
-add_library(ip ${SOURCE} ${ip_asm})
+add_library(ip OBJECT ${SOURCE} ${ip_asm})
+
+target_link_libraries(ip lwip)
target_include_directories(ip BEFORE
- PRIVATE ${REACTOS_SOURCE_DIR}/drivers/network/tcpip/include
- PRIVATE ${REACTOS_SOURCE_DIR}/drivers/network/tcpip/lwip/src/include
- PRIVATE ${REACTOS_SOURCE_DIR}/drivers/network/tcpip/lwip/src/include/ipv4)
+ PRIVATE ${REACTOS_SOURCE_DIR}/drivers/network/tcpip/include)
add_pch(ip precomp.h SOURCE)
diff --git a/drivers/network/tcpip/lwip/src/rosip.c
b/drivers/network/tcpip/ip/lwip_glue/ip.c
similarity index 85%
rename from drivers/network/tcpip/lwip/src/rosip.c
rename to drivers/network/tcpip/ip/lwip_glue/ip.c
index 37700776ddf..b6c5ae11129 100644
--- a/drivers/network/tcpip/lwip/src/rosip.c
+++ b/drivers/network/tcpip/ip/lwip_glue/ip.c
@@ -1,13 +1,11 @@
-#include "lwip/sys.h"
-#include "lwip/netif.h"
-#include "lwip/tcpip.h"
-
-#include "rosip.h"
-
-#include <debug.h>
+#include <lwip/netif.h>
+#include <lwip/tcpip.h>
typedef struct netif* PNETIF;
+void
+sys_shutdown(void);
+
void
LibIPInsertPacket(void *ifarg,
const void *const data,
diff --git a/drivers/network/tcpip/lwip/src/include/rosip.h
b/drivers/network/tcpip/ip/lwip_glue/lwip_glue.h
similarity index 96%
rename from drivers/network/tcpip/lwip/src/include/rosip.h
rename to drivers/network/tcpip/ip/lwip_glue/lwip_glue.h
index 701a65614da..5fdd5b73446 100644
--- a/drivers/network/tcpip/lwip/src/include/rosip.h
+++ b/drivers/network/tcpip/ip/lwip_glue/lwip_glue.h
@@ -1,10 +1,10 @@
-#ifndef _ROS_IP_H_
-#define _ROS_IP_H_
+#ifndef _LWIP_GLUE_H_
+#define _LWIP_GLUE_H_
-#include "lwip/tcp.h"
-#include "lwip/pbuf.h"
-#include "lwip/ip_addr.h"
-#include "tcpip.h"
+#include <lwip/tcp.h>
+#include <lwip/pbuf.h>
+#include <lwip/ip_addr.h>
+#include <tcpip.h>
#ifndef LWIP_TAG
#define LWIP_TAG 'PIwl'
diff --git a/drivers/network/tcpip/lwip/src/rosmem.c
b/drivers/network/tcpip/ip/lwip_glue/memory.c
similarity index 94%
rename from drivers/network/tcpip/lwip/src/rosmem.c
rename to drivers/network/tcpip/ip/lwip_glue/memory.c
index b8f1f40956f..32675c58462 100644
--- a/drivers/network/tcpip/lwip/src/rosmem.c
+++ b/drivers/network/tcpip/ip/lwip_glue/memory.c
@@ -1,7 +1,4 @@
-#include "lwip/opt.h"
-
-#include "lwip/def.h"
-#include "lwip/mem.h"
+#include <lwip/mem.h>
#ifndef LWIP_TAG
#define LWIP_TAG 'PIwl'
diff --git a/drivers/network/tcpip/lwip/src/sys_arch.c
b/drivers/network/tcpip/ip/lwip_glue/sys_arch.c
similarity index 98%
rename from drivers/network/tcpip/lwip/src/sys_arch.c
rename to drivers/network/tcpip/ip/lwip_glue/sys_arch.c
index 5b9c0483b2d..8636b22f6f3 100644
--- a/drivers/network/tcpip/lwip/src/sys_arch.c
+++ b/drivers/network/tcpip/ip/lwip_glue/sys_arch.c
@@ -1,12 +1,7 @@
-#include "lwip/sys.h"
-
-#include "lwip/tcp.h"
-#include "lwip/pbuf.h"
-#include "lwip/err.h"
-
-#include "rosip.h"
-
#include <debug.h>
+#include <lwip/sys.h>
+
+#include "lwip_glue.h"
static LIST_ENTRY ThreadListHead;
static KSPIN_LOCK ThreadListLock;
diff --git a/drivers/network/tcpip/lwip/src/rostcp.c
b/drivers/network/tcpip/ip/lwip_glue/tcp.c
similarity index 99%
rename from drivers/network/tcpip/lwip/src/rostcp.c
rename to drivers/network/tcpip/ip/lwip_glue/tcp.c
index cc0dd4bc0d6..4b04d1d4073 100644
--- a/drivers/network/tcpip/lwip/src/rostcp.c
+++ b/drivers/network/tcpip/ip/lwip_glue/tcp.c
@@ -1,10 +1,7 @@
-#include "lwip/sys.h"
-#include "lwip/netif.h"
-#include "lwip/tcpip.h"
-
-#include "rosip.h"
-
#include <debug.h>
+#include <lwip/tcpip.h>
+
+#include "lwip_glue.h"
static const char * const tcp_state_str[] = {
"CLOSED",
diff --git a/drivers/network/tcpip/ip/precomp.h b/drivers/network/tcpip/ip/precomp.h
index 85f756ecc64..c07744085a2 100644
--- a/drivers/network/tcpip/ip/precomp.h
+++ b/drivers/network/tcpip/ip/precomp.h
@@ -20,5 +20,6 @@
#include <interface.h>
#include <ports.h>
#include <chew.h>
+#include "lwip_glue/lwip_glue.h"
#endif /* _IP_PCH_ */
diff --git a/drivers/network/tcpip/ip/transport/tcp/accept.c
b/drivers/network/tcpip/ip/transport/tcp/accept.c
index 19b6d4644ca..62c96cf5f33 100644
--- a/drivers/network/tcpip/ip/transport/tcp/accept.c
+++ b/drivers/network/tcpip/ip/transport/tcp/accept.c
@@ -10,7 +10,7 @@
#include "precomp.h"
-#include "rosip.h"
+#include <lwip_glue/lwip_glue.h>
extern NPAGED_LOOKASIDE_LIST TdiBucketLookasideList;
diff --git a/drivers/network/tcpip/ip/transport/tcp/event.c
b/drivers/network/tcpip/ip/transport/tcp/event.c
index 9294815d3d1..d95c571da9e 100644
--- a/drivers/network/tcpip/ip/transport/tcp/event.c
+++ b/drivers/network/tcpip/ip/transport/tcp/event.c
@@ -14,7 +14,7 @@
#include "lwip/tcp.h"
#include "lwip/api.h"
-#include "rosip.h"
+#include <lwip_glue/lwip_glue.h>
extern NPAGED_LOOKASIDE_LIST TdiBucketLookasideList;
diff --git a/drivers/network/tcpip/ip/transport/tcp/tcp.c
b/drivers/network/tcpip/ip/transport/tcp/tcp.c
index 7bdc8ab7486..604ce11bd62 100644
--- a/drivers/network/tcpip/ip/transport/tcp/tcp.c
+++ b/drivers/network/tcpip/ip/transport/tcp/tcp.c
@@ -21,7 +21,7 @@ PORT_SET TCPPorts;
#include "lwip/init.h"
#include "lwip/arch.h"
-#include "rosip.h"
+#include <lwip_glue/lwip_glue.h>
NPAGED_LOOKASIDE_LIST TdiBucketLookasideList;
diff --git a/drivers/network/tcpip/lwip/CMakeLists.txt
b/drivers/network/tcpip/lwip/CMakeLists.txt
index c9d799914dd..45202843215 100644
--- a/drivers/network/tcpip/lwip/CMakeLists.txt
+++ b/drivers/network/tcpip/lwip/CMakeLists.txt
@@ -1,9 +1,5 @@
list(APPEND SOURCE
- src/rosip.c
- src/rostcp.c
- src/rosmem.c
- src/sys_arch.c
src/api/api_lib.c
src/api/api_msg.c
src/api/err.c
@@ -49,10 +45,9 @@ list(APPEND SOURCE
add_library(lwip ${SOURCE})
-target_include_directories(lwip BEFORE
- PRIVATE ${REACTOS_SOURCE_DIR}/drivers/network/tcpip/include
- PRIVATE ${REACTOS_SOURCE_DIR}/drivers/network/tcpip/lwip/src/include
- PRIVATE ${REACTOS_SOURCE_DIR}/drivers/network/tcpip/lwip/src/include/ipv4)
+target_include_directories(lwip
+ PUBLIC src/include
+ PUBLIC src/include/ipv4)
add_dependencies(lwip bugcodes xdk)
add_pch(lwip precomp.h SOURCE)
diff --git a/drivers/network/tcpip/lwip/src/include/arch/sys_arch.h
b/drivers/network/tcpip/lwip/src/include/arch/sys_arch.h
index 963d10a3d53..03746199062 100644
--- a/drivers/network/tcpip/lwip/src/include/arch/sys_arch.h
+++ b/drivers/network/tcpip/lwip/src/include/arch/sys_arch.h
@@ -37,7 +37,3 @@ sys_arch_protect(sys_prot_t *lev);
void
sys_arch_unprotect(sys_prot_t lev);
-
-void
-sys_shutdown(void);
-