[TCPIP] Add ip_addr_t typedef

ip_addr_t is used in later versions of LWIP.
This commit is contained in:
Hervé Poussineau 2024-04-20 19:22:54 +02:00
parent 5e5b31ecbd
commit bc94df7288
5 changed files with 24 additions and 23 deletions

View file

@ -13,6 +13,7 @@
#endif #endif
typedef struct tcp_pcb* PTCP_PCB; typedef struct tcp_pcb* PTCP_PCB;
typedef struct ip_addr ip4_addr_t;
typedef struct _QUEUE_ENTRY typedef struct _QUEUE_ENTRY
{ {
@ -36,7 +37,7 @@ struct lwip_callback_msg
} FreeSocket; } FreeSocket;
struct { struct {
PCONNECTION_ENDPOINT Connection; PCONNECTION_ENDPOINT Connection;
struct ip_addr *IpAddress; ip_addr_t *IpAddress;
u16_t Port; u16_t Port;
} Bind; } Bind;
struct { struct {
@ -50,7 +51,7 @@ struct lwip_callback_msg
} Send; } Send;
struct { struct {
PCONNECTION_ENDPOINT Connection; PCONNECTION_ENDPOINT Connection;
struct ip_addr *IpAddress; ip_addr_t *IpAddress;
u16_t Port; u16_t Port;
} Connect; } Connect;
struct { struct {
@ -103,15 +104,15 @@ extern void TCPRecvEventHandler(void *arg);
/* TCP functions */ /* TCP functions */
PTCP_PCB LibTCPSocket(void *arg); PTCP_PCB LibTCPSocket(void *arg);
VOID LibTCPFreeSocket(PTCP_PCB pcb); VOID LibTCPFreeSocket(PTCP_PCB pcb);
err_t LibTCPBind(PCONNECTION_ENDPOINT Connection, struct ip_addr *const ipaddr, const u16_t port); err_t LibTCPBind(PCONNECTION_ENDPOINT Connection, ip4_addr_t *const ipaddr, const u16_t port);
PTCP_PCB LibTCPListen(PCONNECTION_ENDPOINT Connection, const u8_t backlog); PTCP_PCB LibTCPListen(PCONNECTION_ENDPOINT Connection, const u8_t backlog);
err_t LibTCPSend(PCONNECTION_ENDPOINT Connection, void *const dataptr, const u16_t len, u32_t *sent, const int safe); err_t LibTCPSend(PCONNECTION_ENDPOINT Connection, void *const dataptr, const u16_t len, ULONG *sent, const int safe);
err_t LibTCPConnect(PCONNECTION_ENDPOINT Connection, struct ip_addr *const ipaddr, const u16_t port); err_t LibTCPConnect(PCONNECTION_ENDPOINT Connection, ip4_addr_t *const ipaddr, const u16_t port);
err_t LibTCPShutdown(PCONNECTION_ENDPOINT Connection, const int shut_rx, const int shut_tx); err_t LibTCPShutdown(PCONNECTION_ENDPOINT Connection, const int shut_rx, const int shut_tx);
err_t LibTCPClose(PCONNECTION_ENDPOINT Connection, const int safe, const int callback); err_t LibTCPClose(PCONNECTION_ENDPOINT Connection, const int safe, const int callback);
err_t LibTCPGetPeerName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port); err_t LibTCPGetPeerName(PTCP_PCB pcb, ip4_addr_t *const ipaddr, u16_t *const port);
err_t LibTCPGetHostName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port); err_t LibTCPGetHostName(PTCP_PCB pcb, ip4_addr_t *const ipaddr, u16_t *const port);
void LibTCPAccept(PTCP_PCB pcb, struct tcp_pcb *listen_pcb, void *arg); void LibTCPAccept(PTCP_PCB pcb, struct tcp_pcb *listen_pcb, void *arg);
void LibTCPSetNoDelay(PTCP_PCB pcb, BOOLEAN Set); void LibTCPSetNoDelay(PTCP_PCB pcb, BOOLEAN Set);
void LibTCPGetSocketStatus(PTCP_PCB pcb, PULONG State); void LibTCPGetSocketStatus(PTCP_PCB pcb, PULONG State);

View file

@ -412,7 +412,7 @@ done:
} }
err_t err_t
LibTCPBind(PCONNECTION_ENDPOINT Connection, struct ip_addr *const ipaddr, const u16_t port) LibTCPBind(PCONNECTION_ENDPOINT Connection, ip4_addr_t *const ipaddr, const u16_t port)
{ {
struct lwip_callback_msg *msg; struct lwip_callback_msg *msg;
err_t ret; err_t ret;
@ -554,7 +554,7 @@ done:
} }
err_t err_t
LibTCPSend(PCONNECTION_ENDPOINT Connection, void *const dataptr, const u16_t len, u32_t *sent, const int safe) LibTCPSend(PCONNECTION_ENDPOINT Connection, void *const dataptr, const u16_t len, ULONG *sent, const int safe)
{ {
err_t ret; err_t ret;
struct lwip_callback_msg *msg; struct lwip_callback_msg *msg;
@ -619,7 +619,7 @@ done:
} }
err_t err_t
LibTCPConnect(PCONNECTION_ENDPOINT Connection, struct ip_addr *const ipaddr, const u16_t port) LibTCPConnect(PCONNECTION_ENDPOINT Connection, ip_addr_t *const ipaddr, const u16_t port)
{ {
struct lwip_callback_msg *msg; struct lwip_callback_msg *msg;
err_t ret; err_t ret;
@ -841,7 +841,7 @@ LibTCPAccept(PTCP_PCB pcb, struct tcp_pcb *listen_pcb, void *arg)
} }
err_t err_t
LibTCPGetHostName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port) LibTCPGetHostName(PTCP_PCB pcb, ip_addr_t *const ipaddr, u16_t *const port)
{ {
if (!pcb) if (!pcb)
return ERR_CLSD; return ERR_CLSD;
@ -853,7 +853,7 @@ LibTCPGetHostName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port)
} }
err_t err_t
LibTCPGetPeerName(PTCP_PCB pcb, struct ip_addr * const ipaddr, u16_t * const port) LibTCPGetPeerName(PTCP_PCB pcb, ip_addr_t * const ipaddr, u16_t * const port)
{ {
if (!pcb) if (!pcb)
return ERR_CLSD; return ERR_CLSD;

View file

@ -21,7 +21,7 @@ NTSTATUS TCPCheckPeerForAccept(PVOID Context,
NTSTATUS Status; NTSTATUS Status;
PTDI_CONNECTION_INFORMATION WhoIsConnecting; PTDI_CONNECTION_INFORMATION WhoIsConnecting;
PTA_IP_ADDRESS RemoteAddress; PTA_IP_ADDRESS RemoteAddress;
struct ip_addr ipaddr; ip_addr_t ipaddr;
if (Request->RequestFlags & TDI_QUERY_ACCEPT) if (Request->RequestFlags & TDI_QUERY_ACCEPT)
DbgPrint("TDI_QUERY_ACCEPT NOT SUPPORTED!!!\n"); DbgPrint("TDI_QUERY_ACCEPT NOT SUPPORTED!!!\n");
@ -47,7 +47,7 @@ NTSTATUS TCPCheckPeerForAccept(PVOID Context,
NTSTATUS TCPListen(PCONNECTION_ENDPOINT Connection, UINT Backlog) NTSTATUS TCPListen(PCONNECTION_ENDPOINT Connection, UINT Backlog)
{ {
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
struct ip_addr AddressToBind; ip_addr_t AddressToBind;
TA_IP_ADDRESS LocalAddress; TA_IP_ADDRESS LocalAddress;
ASSERT(Connection); ASSERT(Connection);

View file

@ -9,7 +9,7 @@
#include <ipifcons.h> #include <ipifcons.h>
err_t err_t
TCPSendDataCallback(struct netif *netif, struct pbuf *p, struct ip_addr *dest) TCPSendDataCallback(struct netif *netif, struct pbuf *p, ip4_addr_t *dest)
{ {
NDIS_STATUS NdisStatus; NDIS_STATUS NdisStatus;
PNEIGHBOR_CACHE_ENTRY NCE; PNEIGHBOR_CACHE_ENTRY NCE;
@ -117,9 +117,9 @@ TCPInterfaceInit(struct netif *netif)
VOID VOID
TCPRegisterInterface(PIP_INTERFACE IF) TCPRegisterInterface(PIP_INTERFACE IF)
{ {
struct ip_addr ipaddr; ip_addr_t ipaddr;
struct ip_addr netmask; ip_addr_t netmask;
struct ip_addr gw; ip_addr_t gw;
gw.addr = 0; gw.addr = 0;
ipaddr.addr = 0; ipaddr.addr = 0;
@ -143,9 +143,9 @@ TCPUnregisterInterface(PIP_INTERFACE IF)
VOID VOID
TCPUpdateInterfaceIPInformation(PIP_INTERFACE IF) TCPUpdateInterfaceIPInformation(PIP_INTERFACE IF)
{ {
struct ip_addr ipaddr; ip_addr_t ipaddr;
struct ip_addr netmask; ip_addr_t netmask;
struct ip_addr gw; ip_addr_t gw;
gw.addr = 0; gw.addr = 0;

View file

@ -306,7 +306,7 @@ NTSTATUS TCPConnect
PVOID Context ) PVOID Context )
{ {
NTSTATUS Status; NTSTATUS Status;
struct ip_addr bindaddr, connaddr; ip_addr_t bindaddr, connaddr;
IP_ADDRESS RemoteAddress; IP_ADDRESS RemoteAddress;
USHORT RemotePort; USHORT RemotePort;
TA_IP_ADDRESS LocalAddress; TA_IP_ADDRESS LocalAddress;
@ -660,7 +660,7 @@ NTSTATUS TCPGetSockAddress
BOOLEAN GetRemote ) BOOLEAN GetRemote )
{ {
PTA_IP_ADDRESS AddressIP = (PTA_IP_ADDRESS)Address; PTA_IP_ADDRESS AddressIP = (PTA_IP_ADDRESS)Address;
struct ip_addr ipaddr; ip_addr_t ipaddr;
NTSTATUS Status; NTSTATUS Status;
AddressIP->TAAddressCount = 1; AddressIP->TAAddressCount = 1;