2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS TCP/IP protocol driver
4 * FILE: include/tcpip.h
5 * PURPOSE: TCP/IP protocol driver definitions
6 * NOTES: Spin lock acquire order:
7 * - Net table list lock
9 * - Interface list lock
11 * - Neighbor cache lock
33 #define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
34 #define TAG_STRING TAG('S', 'T', 'R', ' ') /* string */
36 /* Define _NTTEST_ to make test version. Device names are prefixed with
37 'NT' to allow the driver to run side by side with MS TCP/IP driver */
40 /* FIXME: The following should be moved to ntddk.h or tdi headers */
43 #ifndef IO_NETWORK_INCREMENT
44 #define IO_NETWORK_INCREMENT 2
50 /* EXPORTED is already defined ddk/defines.h */
51 #define EXPORTED __declspec(dllexport)
60 #define MIN(value1, value2) \
61 ((value1 < value2)? value1 : value2)
63 #define MAX(value1, value2) \
64 ((value1 > value2)? value1 : value2)
66 #define NDIS_BUFFER_TAG FOURCC('n','b','u','f')
67 #define NDIS_PACKET_TAG FOURCC('n','p','k','t')
71 /* DWORD network to host byte order conversion for i386 */
73 ((((dw) & 0xFF000000L) >> 24) | \
74 (((dw) & 0x00FF0000L) >> 8) | \
75 (((dw) & 0x0000FF00L) << 8) | \
76 (((dw) & 0x000000FFL) << 24))
78 /* DWORD host to network byte order conversion for i386 */
80 ((((dw) & 0xFF000000L) >> 24) | \
81 (((dw) & 0x00FF0000L) >> 8) | \
82 (((dw) & 0x0000FF00L) << 8) | \
83 (((dw) & 0x000000FFL) << 24))
85 /* WORD network to host order conversion for i386 */
87 ((((w) & 0xFF00) >> 8) | \
88 (((w) & 0x00FF) << 8))
90 /* WORD host to network byte order conversion for i386 */
92 ((((w) & 0xFF00) >> 8) | \
93 (((w) & 0x00FF) << 8))
97 /* DWORD network to host byte order conversion for other architectures */
101 /* DWORD host to network byte order conversion for other architectures */
105 /* WORD network to host order conversion for other architectures */
109 /* WORD host to network byte order conversion for other architectures */
115 /* AF_INET and other things Arty likes to use ;) */
117 #define SOCK_STREAM 1
119 /* Should use TDI structure, but Arty wants to keep BSD style */
120 typedef unsigned char u_char
;
121 typedef unsigned short u_short
;
122 typedef unsigned int u_int
;
123 typedef unsigned long u_long
;
128 struct { u_char s_b1
,s_b2
,s_b3
,s_b4
; } S_un_b
;
129 struct { u_short s_w1
,s_w2
; } S_un_w
;
132 #define s_addr S_un.S_addr
133 #define s_host S_un.S_un_b.s_b2
134 #define s_net S_un.S_un_b.s_b1
135 #define s_imp S_un.S_un_w.s_w2
136 #define s_impno S_un.S_un_b.s_b4
137 #define s_lh S_un.S_un_b.s_b3
143 struct in_addr sin_addr
;
146 typedef struct sockaddr_in SOCKADDR_IN
;
153 typedef TDI_STATUS (*InfoRequest_f
)( UINT InfoClass
,
161 typedef TDI_STATUS (*InfoSet_f
)( UINT InfoClass
,
169 /* Sufficient information to manage the entity list */
174 InfoRequest_f info_req
;
179 #define htons(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
182 /* Global variable */
183 extern PDEVICE_OBJECT TCPDeviceObject
;
184 extern PDEVICE_OBJECT UDPDeviceObject
;
185 extern PDEVICE_OBJECT IPDeviceObject
;
186 extern PDEVICE_OBJECT RawIPDeviceObject
;
187 extern LIST_ENTRY InterfaceListHead
;
188 extern KSPIN_LOCK InterfaceListLock
;
189 extern LIST_ENTRY AddressFileListHead
;
190 extern KSPIN_LOCK AddressFileListLock
;
191 extern NDIS_HANDLE GlobalPacketPool
;
192 extern NDIS_HANDLE GlobalBufferPool
;
193 extern KSPIN_LOCK EntityListLock
;
194 extern TDIEntityInfo
*EntityList
;
195 extern ULONG EntityCount
;
196 extern ULONG EntityMax
;
198 extern NTSTATUS
TiGetProtocolNumber( PUNICODE_STRING FileName
,
201 #endif /* __TCPIP_H */