Remove unnecessary executable bits
[reactos.git] / sdk / lib / drivers / lwip / src / include / rosip.h
1 #ifndef _ROS_IP_H_
2 #define _ROS_IP_H_
3
4 #include "lwip/tcp.h"
5 #include "lwip/pbuf.h"
6 #include "lwip/ip_addr.h"
7 #include "tcpip.h"
8
9 #ifndef LWIP_TAG
10 #define LWIP_TAG 'PIwl'
11 #define LWIP_MESSAGE_TAG 'sMwl'
12 #define LWIP_QUEUE_TAG 'uQwl'
13 #endif
14
15 typedef struct tcp_pcb* PTCP_PCB;
16
17 typedef struct _QUEUE_ENTRY
18 {
19 struct pbuf *p;
20 ULONG Offset;
21 LIST_ENTRY ListEntry;
22 } QUEUE_ENTRY, *PQUEUE_ENTRY;
23
24 struct lwip_callback_msg
25 {
26 /* Synchronization */
27 KEVENT Event;
28
29 /* Input */
30 union {
31 struct {
32 PVOID Arg;
33 } Socket;
34 struct {
35 PCONNECTION_ENDPOINT Connection;
36 struct ip_addr *IpAddress;
37 u16_t Port;
38 } Bind;
39 struct {
40 PCONNECTION_ENDPOINT Connection;
41 u8_t Backlog;
42 } Listen;
43 struct {
44 PCONNECTION_ENDPOINT Connection;
45 void *Data;
46 u16_t DataLength;
47 } Send;
48 struct {
49 PCONNECTION_ENDPOINT Connection;
50 struct ip_addr *IpAddress;
51 u16_t Port;
52 } Connect;
53 struct {
54 PCONNECTION_ENDPOINT Connection;
55 int shut_rx;
56 int shut_tx;
57 } Shutdown;
58 struct {
59 PCONNECTION_ENDPOINT Connection;
60 int Callback;
61 } Close;
62 } Input;
63
64 /* Output */
65 union {
66 struct {
67 struct tcp_pcb *NewPcb;
68 } Socket;
69 struct {
70 err_t Error;
71 } Bind;
72 struct {
73 struct tcp_pcb *NewPcb;
74 } Listen;
75 struct {
76 err_t Error;
77 u32_t Information;
78 } Send;
79 struct {
80 err_t Error;
81 } Connect;
82 struct {
83 err_t Error;
84 } Shutdown;
85 struct {
86 err_t Error;
87 } Close;
88 } Output;
89 };
90
91 NTSTATUS LibTCPGetDataFromConnectionQueue(PCONNECTION_ENDPOINT Connection, PUCHAR RecvBuffer, UINT RecvLen, UINT *Received);
92
93 /* External TCP event handlers */
94 extern void TCPConnectEventHandler(void *arg, const err_t err);
95 extern void TCPAcceptEventHandler(void *arg, PTCP_PCB newpcb);
96 extern void TCPSendEventHandler(void *arg, const u16_t space);
97 extern void TCPFinEventHandler(void *arg, const err_t err);
98 extern void TCPRecvEventHandler(void *arg);
99
100 /* TCP functions */
101 PTCP_PCB LibTCPSocket(void *arg);
102 err_t LibTCPBind(PCONNECTION_ENDPOINT Connection, struct ip_addr *const ipaddr, const u16_t port);
103 PTCP_PCB LibTCPListen(PCONNECTION_ENDPOINT Connection, const u8_t backlog);
104 err_t LibTCPSend(PCONNECTION_ENDPOINT Connection, void *const dataptr, const u16_t len, u32_t *sent, const int safe);
105 err_t LibTCPConnect(PCONNECTION_ENDPOINT Connection, struct ip_addr *const ipaddr, const u16_t port);
106 err_t LibTCPShutdown(PCONNECTION_ENDPOINT Connection, const int shut_rx, const int shut_tx);
107 err_t LibTCPClose(PCONNECTION_ENDPOINT Connection, const int safe, const int callback);
108
109 err_t LibTCPGetPeerName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port);
110 err_t LibTCPGetHostName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port);
111 void LibTCPAccept(PTCP_PCB pcb, struct tcp_pcb *listen_pcb, void *arg);
112 void LibTCPSetNoDelay(PTCP_PCB pcb, BOOLEAN Set);
113
114 /* IP functions */
115 void LibIPInsertPacket(void *ifarg, const void *const data, const u32_t size);
116 void LibIPInitialize(void);
117 void LibIPShutdown(void);
118
119 #endif