https://git.reactos.org/?p=reactos.git;a=commitdiff;h=29c15104230e95467229a3515e092c5e744bdeff

commit 29c15104230e95467229a3515e092c5e744bdeff
Author:     Pierre Schweitzer <[email protected]>
AuthorDate: Fri Nov 23 22:39:14 2018 +0100
Commit:     Pierre Schweitzer <[email protected]>
CommitDate: Fri Nov 23 22:51:35 2018 +0100

    [LWIP] Implement a LibTCPGetSocketStatus() function in our LwIP glue
    
    It is used to query a socket state (established, closed, and so on).
---
 sdk/lib/drivers/lwip/src/include/rosip.h | 1 +
 sdk/lib/drivers/lwip/src/rostcp.c        | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/sdk/lib/drivers/lwip/src/include/rosip.h 
b/sdk/lib/drivers/lwip/src/include/rosip.h
index 2838da8a9e..03aaf0c6a9 100644
--- a/sdk/lib/drivers/lwip/src/include/rosip.h
+++ b/sdk/lib/drivers/lwip/src/include/rosip.h
@@ -110,6 +110,7 @@ err_t       LibTCPGetPeerName(PTCP_PCB pcb, struct ip_addr 
*const ipaddr, u16_t
 err_t       LibTCPGetHostName(PTCP_PCB pcb, struct ip_addr *const ipaddr, 
u16_t *const port);
 void        LibTCPAccept(PTCP_PCB pcb, struct tcp_pcb *listen_pcb, void *arg);
 void        LibTCPSetNoDelay(PTCP_PCB pcb, BOOLEAN Set);
+void        LibTCPGetSocketStatus(PTCP_PCB pcb, PULONG State);
 
 /* IP functions */
 void LibIPInsertPacket(void *ifarg, const void *const data, const u32_t size);
diff --git a/sdk/lib/drivers/lwip/src/rostcp.c 
b/sdk/lib/drivers/lwip/src/rostcp.c
index ea06d75a7f..8e22ccd5c2 100644
--- a/sdk/lib/drivers/lwip/src/rostcp.c
+++ b/sdk/lib/drivers/lwip/src/rostcp.c
@@ -840,3 +840,12 @@ LibTCPSetNoDelay(
     else
         pcb->flags &= ~TF_NODELAY;
 }
+
+void
+LibTCPGetSocketStatus(
+    PTCP_PCB pcb,
+    PULONG State)
+{
+    /* Translate state from enum tcp_state -> MIB_TCP_STATE */
+    *State = pcb->state + 1;
+}

Reply via email to