[LWIP] Implement a LibTCPGetSocketStatus() function in our LwIP glue
authorPierre Schweitzer <pierre@reactos.org>
Fri, 23 Nov 2018 21:39:14 +0000 (22:39 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Fri, 23 Nov 2018 21:51:35 +0000 (22:51 +0100)
It is used to query a socket state (established, closed, and so on).

sdk/lib/drivers/lwip/src/include/rosip.h
sdk/lib/drivers/lwip/src/rostcp.c

index 2838da8..03aaf0c 100644 (file)
@@ -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);
index ea06d75..8e22ccd 100644 (file)
@@ -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;
+}