[LWIP] Implement a LibTCPGetSocketStatus() function in our LwIP glue

It is used to query a socket state (established, closed, and so on).
This commit is contained in:
Pierre Schweitzer 2018-11-23 22:39:14 +01:00
parent a2819679ec
commit 29c1510423
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
2 changed files with 10 additions and 0 deletions

View 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);

View 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;
}