2000-08-02 00:24:26 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS TCP/IP protocol driver
|
|
|
|
* FILE: include/tcpip.h
|
|
|
|
* PURPOSE: TCP/IP protocol driver definitions
|
|
|
|
* NOTES: Spin lock acquire order:
|
|
|
|
* - Net table list lock
|
|
|
|
* - Interface lock
|
|
|
|
* - Interface list lock
|
|
|
|
* - Prefix list lock
|
|
|
|
* - Neighbor cache lock
|
|
|
|
* - Route cache lock
|
|
|
|
*/
|
2010-02-26 11:43:19 +00:00
|
|
|
|
|
|
|
#pragma once
|
2000-08-02 00:24:26 +00:00
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#include <basetsd.h>
|
|
|
|
#include <ntddk.h>
|
|
|
|
#include <windef.h>
|
|
|
|
#include <ndis.h>
|
|
|
|
#include <tdikrnl.h>
|
|
|
|
#include <tdiinfo.h>
|
|
|
|
#else
|
2005-12-01 21:37:19 +00:00
|
|
|
#include <ntddk.h>
|
|
|
|
#include <ndis.h>
|
|
|
|
#include <tdikrnl.h>
|
|
|
|
#include <tdiinfo.h>
|
2000-08-02 00:24:26 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <debug.h>
|
|
|
|
|
2009-08-24 17:12:25 +00:00
|
|
|
#define TAG_STRING ' RTS' /* string */
|
2000-08-02 00:24:26 +00:00
|
|
|
|
|
|
|
/* Define _NTTEST_ to make test version. Device names are prefixed with
|
|
|
|
'NT' to allow the driver to run side by side with MS TCP/IP driver */
|
2001-01-21 21:04:53 +00:00
|
|
|
//#define _NTTEST_
|
2000-08-02 00:24:26 +00:00
|
|
|
|
|
|
|
/* FIXME: The following should be moved to ntddk.h or tdi headers */
|
|
|
|
#ifndef _MSC_VER
|
|
|
|
|
|
|
|
#ifndef IO_NETWORK_INCREMENT
|
|
|
|
#define IO_NETWORK_INCREMENT 2
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
/* EXPORTED is already defined ddk/defines.h */
|
|
|
|
#define EXPORTED __declspec(dllexport)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <titypes.h>
|
|
|
|
#include <ticonsts.h>
|
|
|
|
|
|
|
|
/* Macros */
|
|
|
|
|
|
|
|
#define MIN(value1, value2) \
|
|
|
|
((value1 < value2)? value1 : value2)
|
|
|
|
|
|
|
|
#define MAX(value1, value2) \
|
|
|
|
((value1 > value2)? value1 : value2)
|
|
|
|
|
2004-06-09 18:11:39 +00:00
|
|
|
#define NDIS_BUFFER_TAG FOURCC('n','b','u','f')
|
|
|
|
#define NDIS_PACKET_TAG FOURCC('n','p','k','t')
|
2000-08-02 00:24:26 +00:00
|
|
|
|
|
|
|
#ifdef i386
|
|
|
|
|
|
|
|
/* DWORD network to host byte order conversion for i386 */
|
|
|
|
#define DN2H(dw) \
|
|
|
|
((((dw) & 0xFF000000L) >> 24) | \
|
|
|
|
(((dw) & 0x00FF0000L) >> 8) | \
|
|
|
|
(((dw) & 0x0000FF00L) << 8) | \
|
|
|
|
(((dw) & 0x000000FFL) << 24))
|
|
|
|
|
|
|
|
/* DWORD host to network byte order conversion for i386 */
|
|
|
|
#define DH2N(dw) \
|
|
|
|
((((dw) & 0xFF000000L) >> 24) | \
|
|
|
|
(((dw) & 0x00FF0000L) >> 8) | \
|
|
|
|
(((dw) & 0x0000FF00L) << 8) | \
|
|
|
|
(((dw) & 0x000000FFL) << 24))
|
|
|
|
|
|
|
|
/* WORD network to host order conversion for i386 */
|
|
|
|
#define WN2H(w) \
|
|
|
|
((((w) & 0xFF00) >> 8) | \
|
|
|
|
(((w) & 0x00FF) << 8))
|
|
|
|
|
|
|
|
/* WORD host to network byte order conversion for i386 */
|
|
|
|
#define WH2N(w) \
|
|
|
|
((((w) & 0xFF00) >> 8) | \
|
|
|
|
(((w) & 0x00FF) << 8))
|
|
|
|
|
|
|
|
#else /* i386 */
|
|
|
|
|
|
|
|
/* DWORD network to host byte order conversion for other architectures */
|
|
|
|
#define DN2H(dw) \
|
|
|
|
(dw)
|
|
|
|
|
|
|
|
/* DWORD host to network byte order conversion for other architectures */
|
|
|
|
#define DH2N(dw) \
|
|
|
|
(dw)
|
|
|
|
|
|
|
|
/* WORD network to host order conversion for other architectures */
|
|
|
|
#define WN2H(w) \
|
|
|
|
(w)
|
|
|
|
|
|
|
|
/* WORD host to network byte order conversion for other architectures */
|
|
|
|
#define WH2N(w) \
|
|
|
|
(w)
|
|
|
|
|
|
|
|
#endif /* i386 */
|
|
|
|
|
2005-06-22 17:58:42 +00:00
|
|
|
/* AF_INET and other things Arty likes to use ;) */
|
|
|
|
#define AF_INET 2
|
|
|
|
#define SOCK_STREAM 1
|
|
|
|
|
2005-06-22 19:33:26 +00:00
|
|
|
/* Should use TDI structure, but Arty wants to keep BSD style */
|
|
|
|
typedef unsigned char u_char;
|
|
|
|
typedef unsigned short u_short;
|
|
|
|
typedef unsigned int u_int;
|
|
|
|
typedef unsigned long u_long;
|
2007-10-19 23:21:45 +00:00
|
|
|
struct in_addr
|
2005-06-22 19:33:26 +00:00
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
union
|
2005-06-22 19:33:26 +00:00
|
|
|
{
|
|
|
|
struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
|
|
|
|
struct { u_short s_w1,s_w2; } S_un_w;
|
|
|
|
u_long S_addr;
|
|
|
|
} S_un;
|
|
|
|
#define s_addr S_un.S_addr
|
|
|
|
#define s_host S_un.S_un_b.s_b2
|
|
|
|
#define s_net S_un.S_un_b.s_b1
|
|
|
|
#define s_imp S_un.S_un_w.s_w2
|
|
|
|
#define s_impno S_un.S_un_b.s_b4
|
|
|
|
#define s_lh S_un.S_un_b.s_b3
|
|
|
|
};
|
2007-10-19 23:21:45 +00:00
|
|
|
struct sockaddr_in
|
2005-06-22 19:33:26 +00:00
|
|
|
{
|
|
|
|
short sin_family;
|
|
|
|
u_short sin_port;
|
|
|
|
struct in_addr sin_addr;
|
|
|
|
char sin_zero[8];
|
|
|
|
};
|
|
|
|
typedef struct sockaddr_in SOCKADDR_IN;
|
|
|
|
struct sockaddr
|
|
|
|
{
|
|
|
|
u_short sa_family;
|
|
|
|
char sa_data[14];
|
|
|
|
};
|
|
|
|
|
2004-06-09 18:11:39 +00:00
|
|
|
/* Sufficient information to manage the entity list */
|
|
|
|
typedef struct {
|
|
|
|
UINT tei_entity;
|
|
|
|
UINT tei_instance;
|
|
|
|
PVOID context;
|
2009-10-09 02:40:38 +00:00
|
|
|
UINT flags;
|
2004-06-09 18:11:39 +00:00
|
|
|
} TDIEntityInfo;
|
|
|
|
|
|
|
|
#ifndef htons
|
2005-03-18 02:56:29 +00:00
|
|
|
#define htons(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
|
2004-06-09 18:11:39 +00:00
|
|
|
#endif
|
2000-08-02 00:24:26 +00:00
|
|
|
|
|
|
|
/* Global variable */
|
|
|
|
extern PDEVICE_OBJECT TCPDeviceObject;
|
|
|
|
extern PDEVICE_OBJECT UDPDeviceObject;
|
|
|
|
extern PDEVICE_OBJECT IPDeviceObject;
|
|
|
|
extern PDEVICE_OBJECT RawIPDeviceObject;
|
|
|
|
extern LIST_ENTRY InterfaceListHead;
|
|
|
|
extern KSPIN_LOCK InterfaceListLock;
|
|
|
|
extern LIST_ENTRY AddressFileListHead;
|
|
|
|
extern KSPIN_LOCK AddressFileListLock;
|
|
|
|
extern NDIS_HANDLE GlobalPacketPool;
|
|
|
|
extern NDIS_HANDLE GlobalBufferPool;
|
2004-03-08 10:20:18 +00:00
|
|
|
extern KSPIN_LOCK EntityListLock;
|
2004-06-09 18:11:39 +00:00
|
|
|
extern TDIEntityInfo *EntityList;
|
2000-08-02 00:24:26 +00:00
|
|
|
extern ULONG EntityCount;
|
2004-03-12 04:21:59 +00:00
|
|
|
extern ULONG EntityMax;
|
2000-08-02 00:24:26 +00:00
|
|
|
|
2004-11-07 20:37:21 +00:00
|
|
|
extern NTSTATUS TiGetProtocolNumber( PUNICODE_STRING FileName,
|
|
|
|
PULONG Protocol );
|
|
|
|
|
2000-08-02 00:24:26 +00:00
|
|
|
/* EOF */
|