Added networking code from Casper Hornstrup

svn path=/trunk/; revision=1281
This commit is contained in:
David Welch 2000-08-01 23:54:06 +00:00
parent 2c41cbbe57
commit 792773e953
13 changed files with 7275 additions and 228 deletions

View file

@ -1,110 +0,0 @@
# $Id: Makefile_rex,v 1.2 2000/03/08 22:37:02 ea Exp $
#
# TCPIP.SYS build spec
#
TARGETNAME=tcpip
BASE_CFLAGS = -I../../../include
OBJECTS_MISC = misc/main.o misc/iface.o misc/$(TARGETNAME).coff
OBJECTS = $(OBJECTS_MISC)
all: $(TARGETNAME).sys
misc/$(TARGETNAME).coff: misc/$(TARGETNAME).rc ../../../include/reactos/resource.h
ifeq ($(DOSCLI),yes)
CLEAN_FILES = \
misc\*.o misc\*.coff \
$(TARGETNAME).o $(TARGETNAME).a \
junk.tmp base.tmp temp.exp \
$(TARGETNAME).sys $(TARGETNAME).sym
else
CLEAN_FILES = \
misc/*.o misc/*.coff \
$(TARGETNAME).o $(TARGETNAME).a \
junk.tmp base.tmp temp.exp \
$(TARGETNAME).sys $(TARGETNAME).sym
endif
$(TARGETNAME).sys: $(OBJECTS) misc/$(TARGETNAME).def
$(LD) -r $(OBJECTS) -o $(TARGETNAME).o
$(DLLTOOL) \
--dllname $(TARGETNAME).sys \
--def misc/$(TARGETNAME).def \
--output-lib $(TARGETNAME).a \
--kill-at
$(CC) \
--subsystem=native \
-mdll \
--dll \
-e _DriverEntry@8 \
-o junk.tmp \
-Wl,--image-base,0x0 \
-Wl,--file-alignment,0x1000 \
-Wl,--section-alignment,0x1000 \
-Wl,--defsym,_end=end \
-Wl,--defsym,_edata=__data_end__ \
-Wl,--defsym,_etext=etext \
-Wl,--base-file,base.tmp $(TARGETNAME).o \
-specs=../../../specs \
../../../ntoskrnl/ntoskrnl.a
- $(RM) junk.tmp
$(DLLTOOL) \
--dllname $(TARGETNAME).sys \
--base-file base.tmp \
--output-exp temp.exp \
--def misc/$(TARGETNAME).edf \
--kill-at
- $(RM) base.tmp
$(CC) \
--subsystem=native \
-mdll \
--dll \
-e _DllMain@8 \
-o $(TARGETNAME).sys \
$(TARGETNAME).o \
../../../ntoskrnl/ntoskrnl.a \
-Wl,--image-base,0x0 \
-Wl,--file-alignment,0x1000 \
-Wl,--section-alignment,0x1000 \
-Wl,--defsym,_end=end \
-Wl,--defsym,_edata=__data_end__ \
-Wl,--defsym,_etext=etext \
-Wl,temp.exp \
-specs=../../../specs
- $(RM) temp.exp
$(NM) --numeric-sort $(TARGETNAME).sys > $(TARGETNAME).sym
clean: $(CLEAN_FILES:%=%_clean)
$(CLEAN_FILES:%=%_clean): %_clean:
- $(RM) $*
.PHONY: clean $(CLEAN_FILES:%=%_clean)
floppy: $(FLOPPY_DIR)/drivers/$(TARGETNAME).sys
$(FLOPPY_DIR)/drivers/$(TARGETNAME).sys: $(TARGETNAME).sys
ifeq ($(DOSCLI),yes)
$(CP) $(TARGETNAME).sys $(FLOPPY_DIR)\drivers\$(TARGETNAME).sys
else
$(CP) $(TARGETNAME).sys $(FLOPPY_DIR)/drivers/$(TARGETNAME).sys
endif
dist: $(DIST_DIR)/drivers/$(TARGETNAME).sys
$(DIST_DIR)/drivers/$(TARGETNAME).sys: $(TARGETNAME).sys
ifeq ($(DOSCLI),yes)
$(CP) $(TARGETNAME).sys ..\..\$(DIST_DIR)\drivers\$(TARGETNAME).sys
else
$(CP) $(TARGETNAME).sys ../../$(DIST_DIR)/drivers/$(TARGETNAME).sys
endif
#WITH_DEBUGGING = yes
#WIN32_LEAN_AND_MEAN = yes
#WARNINGS_ARE_ERRORS = yes
include ../../../rules.mak

View file

@ -1,39 +0,0 @@
/* $Id: iface.c,v 1.1 1999/11/20 20:36:46 ea Exp $
*
* reactos/services/net/tcpip/misc/iface.c
*/
#include <ntos.h>
VOID
STDCALL
IPAddInterface (
DWORD Unknown0,
DWORD Unknown1,
DWORD Unknown2,
DWORD Unknown3,
DWORD Unknown4
)
{
}
VOID
STDCALL
IPDelInterface (
DWORD Unknown0
)
{
}
VOID
STDCALL
LookupRoute (
DWORD Unknown0,
DWORD Unknown1
)
{
}
/* EOF */

View file

@ -1,16 +0,0 @@
/* $Id: main.c,v 1.2 2000/03/08 22:37:02 ea Exp $ */
#include <ntos.h>
NTSTATUS
STDCALL
DriverEntry (
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath
)
{
return STATUS_UNSUCCESSFUL;
}
/* EOF */

View file

@ -1,12 +0,0 @@
; $Id: tcpip.def,v 1.1 1999/11/20 20:36:46 ea Exp $
;
; TCPIP.SYS
;
LIBRARY tcpip.sys
EXPORTS
IPAddInterface@20
IPDelInterface@4
LookupRoute@8
; EOF

View file

@ -1,12 +0,0 @@
; $Id: tcpip.edf,v 1.1 1999/11/20 20:36:46 ea Exp $
;
; TCPIP.SYS
;
LIBRARY tcpip.sys
EXPORTS
IPAddInterface=IPAddInterface@20
IPDelInterface=IPDelInterface@4
LookupRoute=LookupRoute@8
; EOF

View file

@ -1,39 +0,0 @@
/* $Id: tcpip.rc,v 1.1 1999/11/20 20:36:46 ea Exp $ */
#include <defines.h>
#include <reactos/resource.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO VERSIONINFO
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", RES_STR_COMPANY_NAME
VALUE "FileDescription", "TCP/IP kernel module\0"
VALUE "FileVersion", "0.0.0\0"
VALUE "InternalName", "tcpip\0"
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
VALUE "OriginalFilename", "tcpip.sys\0"
VALUE "ProductName", RES_STR_PRODUCT_NAME
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View file

@ -0,0 +1,849 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS NDIS library
* FILE: include/net/miniport.h
* PURPOSE: Type definitions available only to NDIS miniport drivers
*/
#ifndef __MINIPORT_H
#define __MINIPORT_H
#ifdef _MSC_VER
#include <ntstatus.h>
#else /* _MSC_VER */
#include <ddk/status.h>
#endif /* _MSC_VER */
/* Base types */
#define IN
#define OUT
#define OPTIONAL
#define ANYSIZE_ARRAY 1
#define CONST const
#ifdef _MSC_VER
#ifdef i386
#define STDCALL _stdcall
#define CDECL _cdecl
#else /* i386 */
#define STDCALL
#define CDECL
#endif /* i386 */
#else /* _MSC_VER */
#ifdef i386
#define STDCALL __attribute__ ((stdcall))
#define CDECL __attribute__ ((cdecl))
#else /* i386 */
#define STDCALL
#define CDECL
#endif /* i386 */
#endif /* _MSC_VER */
typedef void VOID, *PVOID;
typedef char CHAR, *PCHAR;
typedef unsigned char UCHAR, *PUCHAR;
typedef short SHORT, *PSHORT;
typedef unsigned short USHORT, *PUSHORT;
typedef long LONG,*PLONG;
typedef unsigned long ULONG,*PULONG;
typedef double DOUBLE, *PDOUBLE;
typedef struct _QUAD {
double DoNotUseThisField;
} QUAD,*PQUAD;
typedef QUAD UQUAD, *PUQUAD;
typedef signed int INT, *PINT;
typedef unsigned int UINT, *PUINT;
typedef double LONGLONG, *PLONGLONG;
typedef double ULONGLONG, *PULONGLONG;
typedef UCHAR BOOLEAN, *PBOOLEAN;
typedef ULONG DWORD, *PDWORD;
/* Cardinal types */
typedef CHAR CCHAR, *PCCHAR;
typedef SHORT CSHORT, *PCSHORT;
typedef ULONG CLONG, *PCLONG;
/* UNICODE (wide character) types */
#ifndef __cplusplus
typedef short unsigned int wchar_t;
#endif /* __cplusplus */
typedef wchar_t WCHAR;
typedef WCHAR *PWCHAR;
typedef WCHAR *LPWCH, *PWCH;
typedef CONST WCHAR *LPCWCH, *PCWCH;
typedef WCHAR *NWPSTR;
typedef WCHAR *LPWSTR, *PWSTR;
typedef CONST WCHAR *LPCWSTR, *PCWSTR;
/* ANSI (multi-byte character) types */
typedef CHAR *LPCH, *PCH;
typedef CONST CHAR *LPCCH, *PCCH;
typedef CHAR *NPSTR;
typedef CHAR *LPSTR, *PSTR;
typedef CONST CHAR *LPCSTR, *PCSTR;
/* Neutral ANSI/UNICODE types */
#ifdef UNICODE
typedef WCHAR TCHAR, *PTCHAR;
typedef WCHAR TUCHAR, *PTUCHAR;
typedef LPWSTR LPTCH, PTCH;
typedef LPWSTR PTSTR, LPTSTR;
typedef LPCWSTR LPCTSTR;
typedef LPWSTR LP;
#define _TEXT(string) L##string
#define _T(string) L##string
#else /* UNICODE */
typedef CHAR TCHAR, *PTCHAR;
typedef UCHAR TUCHAR, *PTUCHAR;
typedef LPSTR LPTCH, PTCH;
typedef LPSTR PTSTR, LPTSTR;
typedef LPCSTR LPCTSTR;
#define _TEXT(string) string
#define _T(string) string
#endif /* UNICODE */
#define TEXT(string) __TEXT(string)
typedef union _LARGE_INTEGER {
struct {
ULONG LowPart;
LONG HighPart;
};
struct {
ULONG LowPart;
LONG HighPart;
} u;
LONGLONG QuadPart;
} LARGE_INTEGER;
typedef LARGE_INTEGER *PLARGE_INTEGER;
typedef union _ULARGE_INTEGER {
struct {
ULONG LowPart;
ULONG HighPart;
};
struct {
ULONG LowPart;
ULONG HighPart;
} u;
ULONGLONG QuadPart;
} ULARGE_INTEGER;
typedef ULARGE_INTEGER *PULARGE_INTEGER;
typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
/* NT status type and macros for checking status */
typedef LONG NTSTATUS;
typedef NTSTATUS *PNTSTATUS;
#ifdef _MSC_VER
#define NT_SUCCESS(Status) ((ULONG)(Status) >= 0)
#endif /* _MSC_VER */
#define NT_INFORMATION(Status) ((ULONG)(Status) >> 30 == 1)
#define NT_WARNING(Status) ((ULONG)(Status) >> 30 == 2)
#define NT_ERROR(Status) ((ULONG)(Status) >> 30 == 3)
#define APPLICATION_ERROR_MASK 0x20000000
#define ERROR_SEVERITY_SUCCESS 0x00000000
#define ERROR_SEVERITY_INFORMATIONAL 0x40000000
#define ERROR_SEVERITY_WARNING 0x80000000
#define ERROR_SEVERITY_ERROR 0xC0000000
/* Basic constants */
#define FALSE 0
#define TRUE 1
#define NULL ((PVOID)0)
/* Counted strings */
typedef struct _STRING
{
USHORT Length;
USHORT MaximumLength;
PCHAR Buffer;
} STRING, *PSTRING;
typedef STRING ANSI_STRING, *PANSI_STRING;
typedef STRING OEM_STRING, *POEM_STRING;
#define ANSI_NULL ((CHAR)0)
typedef struct _CSTRING
{
USHORT Length;
USHORT MaximumLength;
CONST CHAR *Buffer;
} CSTRING, *PCSTRING;
typedef CSTRING CANSI_STRING, *PCANSI_STRING;
typedef struct _UNICODE_STRING
{
USHORT Length;
USHORT MaximumLength;
PWSTR Buffer;
} UNICODE_STRING, *PUNICODE_STRING;
typedef struct _CUNICODE_STRING
{
USHORT Length;
USHORT MaximumLength;
CONST PWSTR Buffer;
} CUNICODE_STRING, *PCUNICODE_STRING;
#define UNICODE_NULL ((WCHAR)0)
/* Linked lists */
typedef struct _LIST_ENTRY
{
struct _LIST_ENTRY *Flink;
struct _LIST_ENTRY *Blink;
} LIST_ENTRY, *PLIST_ENTRY;
typedef struct _SINGLE_LIST_ENTRY
{
struct _SINGLE_LIST_ENTRY *Next;
} SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
/*
* VOID InitializeListHead(
* PLIST_ENTRY ListHead);
*/
#define InitializeListHead(ListHead) \
{ \
(ListHead)->Flink = (ListHead); \
(ListHead)->Blink = (ListHead); \
}
/*
* VOID InsertHeadList(
* LIST_ENTRY ListHead,
* PLIST_ENTRY Entry);
*/
#define InsertHeadList(ListHead, ListEntry) \
{ \
PLIST_ENTRY OldFlink; \
OldFlink = (ListHead)->Flink; \
(ListEntry)->Flink = OldFlink; \
(ListEntry)->Blink = (ListHead); \
OldFlink->Blink = (ListEntry); \
(ListHead)->Flink = (ListEntry); \
}
/*
* VOID InsertTailList(
* PLIST_ENTRY ListHead,
* PLIST_ENTRY Entry);
*/
#define InsertTailList(ListHead, ListEntry) \
{ \
PLIST_ENTRY OldBlink; \
OldBlink = (ListHead)->Blink; \
(ListEntry)->Flink = (ListHead); \
(ListEntry)->Blink = OldBlink; \
OldBlink->Flink = (ListEntry); \
(ListHead)->Blink = (ListEntry); \
}
/*
* BOOLEAN IsListEmpty(
* PLIST_ENTRY ListHead);
*/
#define IsListEmpty(ListHead) \
((ListHead)->Flink == (ListHead))
/*
* PSINGLE_LIST_ENTRY PopEntryList(
* PSINGLE_LIST_ENTRY ListHead);
*/
#define PopEntryList(ListHead) \
(ListHead)->Next; \
{ \
PSINGLE_LIST_ENTRY FirstEntry; \
\
FirstEntry = (ListHead)->Next; \
if (FirstEntry != NULL) \
{ \
(ListHead)->Next = FirstEntry->Next; \
} \
}
/*
* VOID PushEntryList(
* PSINGLE_LIST_ENTRY ListHead,
* PSINGLE_LIST_ENTRY Entry);
*/
#define PushEntryList(ListHead, Entry) \
(Entry)->Next = (ListHead)->Next; \
(ListHead)->Next = (Entry)
/*
* VOID RemoveEntryList(
* PLIST_ENTRY Entry);
*/
#define RemoveEntryList(ListEntry) \
{ \
PLIST_ENTRY OldFlink; \
PLIST_ENTRY OldBlink; \
OldFlink = (ListEntry)->Flink; \
OldBlink = (ListEntry)->Blink; \
OldFlink->Blink = OldBlink; \
OldBlink->Flink = OldFlink; \
}
/*
* PLIST_ENTRY RemoveHeadList(
* PLIST_ENTRY ListHead);
*/
#define RemoveHeadList(ListHead) \
(ListHead)->Flink; \
{ \
RemoveEntryList((ListHead)->Flink) \
}
/*
* PLIST_ENTRY RemoveTailList(
* PLIST_ENTRY ListHead);
*/
#define RemoveTailList(ListHead) \
(ListHead)->Blink; \
{ \
RemoveEntryList((ListHead)->Blink) \
}
/* Hardware */
typedef UCHAR KIRQL, *PKIRQL;
typedef struct _KSPIN_LOCK
{
ULONG Lock;
} KSPIN_LOCK, *PKSPIN_LOCK;
typedef struct _ADAPTER_OBJECT *PADAPTER_OBJECT;
typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT;
typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
typedef struct _FILE_OBJECT *PFILE_OBJECT;
typedef struct _KINTERRUPT *PKINTERRUPT;
/* Memory Descriptor List */
typedef struct _MDL {
struct _MDL *Next;
CSHORT Size;
CSHORT MdlFlags;
struct _EPROCESS *Process;
PVOID MappedSystemVa;
PVOID StartVa;
ULONG ByteCount;
ULONG ByteOffset;
} MDL, *PMDL;
#define MDL_MAPPED_TO_SYSTEM_VA 0x0001
#define MDL_PAGES_LOCKED 0x0002
#define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
#define MDL_ALLOCATED_FIXED_SIZE 0x0008
#define MDL_PARTIAL 0x0010
#define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020
#define MDL_IO_PAGE_READ 0x0040
#define MDL_WRITE_OPERATION 0x0080
#define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100
#define MDL_LOCK_HELD 0x0200
#define MDL_PHYSICAL_VIEW 0x0400
#define MDL_IO_SPACE 0x0800
#define MDL_NETWORK_HEADER 0x1000
#define MDL_MAPPING_CAN_FAIL 0x2000
#define MDL_ALLOCATED_MUST_SUCCEED 0x4000
#define MDL_MAPPING_FLAGS (MDL_MAPPED_TO_SYSTEM_VA | \
MDL_PAGES_LOCKED | \
MDL_SOURCE_IS_NONPAGED_POOL | \
MDL_PARTIAL_HAS_BEEN_MAPPED | \
MDL_PARENT_MAPPED_SYSTEM_VA | \
MDL_LOCK_HELD | \
MDL_SYSTEM_VA | \
MDL_IO_SPACE )
typedef struct _DISPATCHER_HEADER
{
UCHAR Type;
UCHAR Absolute;
UCHAR Size;
UCHAR Inserted;
LONG SignalState;
LIST_ENTRY WaitListHead;
} DISPATCHER_HEADER;
typedef struct _KEVENT
{
DISPATCHER_HEADER Header;
} KEVENT, *PKEVENT;
typedef struct _KTIMER
{
DISPATCHER_HEADER Header;
ULARGE_INTEGER DueTime;
LIST_ENTRY TimerListEntry;
struct _KDPC *Dpc;
LONG Period;
} KTIMER, *PKTIMER;
typedef enum _KDPC_IMPORTANCE
{
LowImportance,
MediumImportance,
HighImportance
} KDPC_IMPORTANCE;
/* Forward declaration */
struct _KDPC;
typedef VOID (*PKDEFERRED_ROUTINE)(
IN struct _KDPC *Dpc,
IN PVOID DeferredContext,
IN PVOID SystemArgument1,
IN PVOID SystemArgument2);
/* Deferred Procedure Call */
typedef struct _KDPC {
CSHORT Type;
UCHAR Number;
UCHAR Importance;
LIST_ENTRY DpcListEntry;
PKDEFERRED_ROUTINE DeferredRoutine;
PVOID DeferredContext;
PVOID SystemArgument1;
PVOID SystemArgument2;
PULONG Lock;
} KDPC, *PKDPC;
typedef enum _INTERFACE_TYPE
{
InterfaceTypeUndefined = -1,
Internal,
Isa,
Eisa,
MicroChannel,
TurboChannel,
PCIBus,
VMEBus,
NuBus,
PCMCIABus,
CBus,
MPIBus,
MPSABus,
ProcessorInternal,
InternalPowerBus,
PNPISABus,
MaximumInterfaceType
} INTERFACE_TYPE, *PINTERFACE_TYPE;
typedef enum _DMA_WIDTH
{
Width8Bits,
Width16Bits,
Width32Bits,
MaximumDmaWidth
} DMA_WIDTH, *PDMA_WIDTH;
typedef enum _DMA_SPEED
{
Compatible,
TypeA,
TypeB,
TypeC,
TypeF,
MaximumDmaSpeed
} DMA_SPEED, *PDMA_SPEED;
typedef enum _KINTERRUPT_MODE
{
LevelSensitive,
Latched
} KINTERRUPT_MODE;
typedef struct _DMA_CONFIGURATION_BYTE0
{
UCHAR Channel:3;
UCHAR Reserved:3;
UCHAR Shared:1;
UCHAR MoreEntries:1;
} DMA_CONFIGURATION_BYTE0;
typedef struct _DMA_CONFIGURATION_BYTE1
{
UCHAR Reserved0:2;
UCHAR TransferSize:2;
UCHAR Timing:2;
UCHAR Reserved1:2;
} DMA_CONFIGURATION_BYTE1;
typedef struct _CM_MCA_POS_DATA
{
USHORT AdapterId;
UCHAR PosData1;
UCHAR PosData2;
UCHAR PosData3;
UCHAR PosData4;
} CM_MCA_POS_DATA, *PCM_MCA_POS_DATA;
typedef struct _EISA_MEMORY_TYPE
{
UCHAR ReadWrite:1;
UCHAR Cached:1;
UCHAR Reserved0:1;
UCHAR Type:2;
UCHAR Shared:1;
UCHAR Reserved1:1;
UCHAR MoreEntries:1;
} EISA_MEMORY_TYPE, *PEISA_MEMORY_TYPE;
typedef struct _EISA_MEMORY_CONFIGURATION
{
EISA_MEMORY_TYPE ConfigurationByte;
UCHAR DataSize;
USHORT AddressLowWord;
UCHAR AddressHighByte;
USHORT MemorySize;
} EISA_MEMORY_CONFIGURATION, *PEISA_MEMORY_CONFIGURATION;
typedef struct _EISA_IRQ_DESCRIPTOR
{
UCHAR Interrupt:4;
UCHAR Reserved:1;
UCHAR LevelTriggered:1;
UCHAR Shared:1;
UCHAR MoreEntries:1;
} EISA_IRQ_DESCRIPTOR, *PEISA_IRQ_DESCRIPTOR;
typedef struct _EISA_IRQ_CONFIGURATION
{
EISA_IRQ_DESCRIPTOR ConfigurationByte;
UCHAR Reserved;
} EISA_IRQ_CONFIGURATION, *PEISA_IRQ_CONFIGURATION;
typedef struct _EISA_DMA_CONFIGURATION
{
DMA_CONFIGURATION_BYTE0 ConfigurationByte0;
DMA_CONFIGURATION_BYTE1 ConfigurationByte1;
} EISA_DMA_CONFIGURATION, *PEISA_DMA_CONFIGURATION;
typedef struct _EISA_PORT_DESCRIPTOR
{
UCHAR NumberPorts:5;
UCHAR Reserved:1;
UCHAR Shared:1;
UCHAR MoreEntries:1;
} EISA_PORT_DESCRIPTOR, *PEISA_PORT_DESCRIPTOR;
typedef struct _EISA_PORT_CONFIGURATION
{
EISA_PORT_DESCRIPTOR Configuration;
USHORT PortAddress;
} EISA_PORT_CONFIGURATION, *PEISA_PORT_CONFIGURATION;
typedef struct _CM_EISA_SLOT_INFORMATION
{
UCHAR ReturnCode;
UCHAR ReturnFlags;
UCHAR MajorRevision;
UCHAR MinorRevision;
USHORT Checksum;
UCHAR NumberFunctions;
UCHAR FunctionInformation;
ULONG CompressedId;
} CM_EISA_SLOT_INFORMATION, *PCM_EISA_SLOT_INFORMATION;
typedef struct _CM_EISA_FUNCTION_INFORMATION
{
ULONG CompressedId;
UCHAR IdSlotFlags1;
UCHAR IdSlotFlags2;
UCHAR MinorRevision;
UCHAR MajorRevision;
UCHAR Selections[26];
UCHAR FunctionFlags;
UCHAR TypeString[80];
EISA_MEMORY_CONFIGURATION EisaMemory[9];
EISA_IRQ_CONFIGURATION EisaIrq[7];
EISA_DMA_CONFIGURATION EisaDma[4];
EISA_PORT_CONFIGURATION EisaPort[20];
UCHAR InitializationData[60];
} CM_EISA_FUNCTION_INFORMATION, *PCM_EISA_FUNCTION_INFORMATION;
typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR
{
UCHAR Type;
UCHAR ShareDisposition;
USHORT Flags;
union {
struct {
PHYSICAL_ADDRESS Start;
ULONG Length;
} Generic;
struct {
PHYSICAL_ADDRESS Start;
ULONG Length;
} Port;
struct {
ULONG Level;
ULONG Vector;
ULONG Affinity;
} Interrupt;
struct {
PHYSICAL_ADDRESS Start;
ULONG Length;
} Memory;
struct {
ULONG Channel;
ULONG Port;
ULONG Reserved1;
} Dma;
struct {
ULONG Data[3];
} DevicePrivate;
struct {
ULONG Start;
ULONG Length;
ULONG Reserved;
} BusNumber;
struct {
ULONG DataSize;
ULONG Reserved1;
ULONG Reserved2;
} DeviceSpecificData;
} u;
} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
typedef struct _CM_PARTIAL_RESOURCE_LIST
{
USHORT Version;
USHORT Revision;
ULONG Count;
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
} CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
typedef struct _CM_FULL_RESOURCE_DESCRIPTOR
{
INTERFACE_TYPE InterfaceType;
ULONG BusNumber;
CM_PARTIAL_RESOURCE_LIST PartialResourceList;
} CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
typedef struct _CM_RESOURCE_LIST
{
ULONG Count;
CM_FULL_RESOURCE_DESCRIPTOR List[1];
} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
/* Operating System services */
/* Debugging */
ULONG CDECL DbgPrint(
PCH Format,
...);
#ifdef DBG
VOID
STDCALL
RtlAssert(
PVOID FailedAssertion,
PVOID FileName,
ULONG LineNumber,
PCHAR Message);
#define ASSERT(exp) \
if (!(exp)) \
RtlAssert(#exp, __FILE__, __LINE__, NULL)
#define ASSERTMSG(msg, exp) \
if (!(exp)) \
RtlAssert(#exp, __FILE__, __LINE__, msg)
#else /* DBG */
#define ASSERT(exp)
#define ASSERTMSG(msg, exp)
#endif /* DBG */
/* Runtime library */
#define RtlEqualMemory(Destination,Source,Length) (!memcmp((Destination), (Source), (Length)))
#define RtlMoveMemory(Destination,Source,Length) memmove((Destination), (Source), (Length))
#define RtlCopyMemory(Destination,Source,Length) memcpy((Destination), (Source), (Length))
#define RtlFillMemory(Destination,Length,Fill) memset((Destination), (Fill),(Length))
#define RtlZeroMemory(Destination,Length) memset((Destination), 0, (Length))
/* Core kernel functions */
VOID
STDCALL
KeStallExecutionProcessor(
ULONG MicroSeconds);
/* I/O functions */
VOID
STDCALL
READ_PORT_BUFFER_UCHAR(
PUCHAR Port,
PUCHAR Value,
ULONG Count);
VOID
STDCALL
READ_PORT_BUFFER_ULONG(
PULONG Port,
PULONG Value,
ULONG Count);
VOID
STDCALL
READ_PORT_BUFFER_USHORT(
PUSHORT Port,
PUSHORT Value,
ULONG Count);
UCHAR
STDCALL
READ_PORT_UCHAR(
PUCHAR Port);
ULONG
STDCALL
READ_PORT_ULONG(
PULONG Port);
USHORT
STDCALL
READ_PORT_USHORT(
PUSHORT Port);
VOID
STDCALL
WRITE_PORT_BUFFER_UCHAR(
PUCHAR Port,
PUCHAR Value,
ULONG Count);
VOID
STDCALL
WRITE_PORT_BUFFER_ULONG(
PULONG Port,
PULONG Value,
ULONG Count);
VOID
STDCALL
WRITE_PORT_BUFFER_USHORT(
PUSHORT Port,
PUSHORT Value,
ULONG Count);
VOID
STDCALL
WRITE_PORT_UCHAR(
PUCHAR Port,
UCHAR Value);
VOID
STDCALL
WRITE_PORT_ULONG(
PULONG Port,
ULONG Value);
VOID
STDCALL
WRITE_PORT_USHORT(
PUSHORT Port,
USHORT Value);
VOID
STDCALL
WRITE_REGISTER_UCHAR(
PUCHAR Register,
UCHAR Value);
VOID
STDCALL
WRITE_REGISTER_ULONG(
PULONG Register,
ULONG Value);
VOID
STDCALL
WRITE_REGISTER_USHORT(
PUSHORT Register,
USHORT Value);
#endif /* __MINIPORT_H */
/* EOF */

4455
reactos/include/net/ndis.h Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,410 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS NDIS library
* FILE: include/net/ndisoid.h
* PURPOSE: NDIS Object ID constants
*/
#ifndef __NDISOID_H
#define __NDISOID_H
typedef ULONG NDIS_OID, *PNDIS_OID;
/* Self-contained variable data structure */
typedef struct _NDIS_VAR_DATA_DESC
{
USHORT Length; /* Number of bytes of data */
USHORT MaximumLength; /* Number of bytes available */
LONG Offset; /* Offset of data relative to the descriptor */
} NDIS_VAR_DATA_DESC, *PNDIS_VAR_DATA_DESC;
/* NDIS 4.0 structures */
/* Structure used by TRANSLATE_NAME IOCTL */
typedef struct _NET_PNP_ID
{
ULONG ClassId;
ULONG Token;
} NET_PNP_ID, *PNET_PNP_ID;
typedef struct _NET_PNP_TRANSLATE_LIST
{
ULONG BytesNeeded;
NET_PNP_ID IdArray[ANYSIZE_ARRAY];
} NET_PNP_TRANSLATE_LIST, *PNET_PNP_TRANSLATE_LIST;
/* Generel objects */
/* General operational characteristics */
/* Mandatory */
#define OID_GEN_SUPPORTED_LIST 0x00010101
#define OID_GEN_HARDWARE_STATUS 0x00010102
#define OID_GEN_MEDIA_SUPPORTED 0x00010103
#define OID_GEN_MEDIA_IN_USE 0x00010104
#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
#define OID_GEN_LINK_SPEED 0x00010107
#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
#define OID_GEN_VENDOR_ID 0x0001010C
#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D
#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
#define OID_GEN_DRIVER_VERSION 0x00010110
#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
#define OID_GEN_PROTOCOL_OPTIONS 0x00010112
#define OID_GEN_MAC_OPTIONS 0x00010113
#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
/* Optional */
#define OID_GEN_SUPPORTED_GUIDS 0x00010117
#define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
#define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
/* General statistics */
/* Mandatory */
#define OID_GEN_XMIT_OK 0x00020101
#define OID_GEN_RCV_OK 0x00020102
#define OID_GEN_XMIT_ERROR 0x00020103
#define OID_GEN_RCV_ERROR 0x00020104
#define OID_GEN_RCV_NO_BUFFER 0x00020105
/* Optional */
#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201
#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203
#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204
#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205
#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206
#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207
#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208
#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209
#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A
#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B
#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C
#define OID_GEN_RCV_CRC_ERROR 0x0002020D
#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
/* Ethernet objects */
/* Ethernet operational characteristics */
/* Mandatory */
#define OID_802_3_PERMANENT_ADDRESS 0x01010101
#define OID_802_3_CURRENT_ADDRESS 0x01010102
#define OID_802_3_MULTICAST_LIST 0x01010103
#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
/* Optional */
#define OID_802_3_MAC_OPTIONS 0x01010105
/* Ethernet statistics */
/* Mandatory */
#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
#define OID_802_3_XMIT_ONE_COLLISION 0x01020102
#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
/* Optional */
#define OID_802_3_XMIT_DEFERRED 0x01020201
#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
#define OID_802_3_RCV_OVERRUN 0x01020203
#define OID_802_3_XMIT_UNDERRUN 0x01020204
#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
/* Token Ring objects */
/* Token Ring operational characteristics */
/* Mandatory */
#define OID_802_5_PERMANENT_ADDRESS 0x02010101
#define OID_802_5_CURRENT_ADDRESS 0x02010102
#define OID_802_5_CURRENT_FUNCTIONAL 0x02010103
#define OID_802_5_CURRENT_GROUP 0x02010104
#define OID_802_5_LAST_OPEN_STATUS 0x02010105
#define OID_802_5_CURRENT_RING_STATUS 0x02010106
#define OID_802_5_CURRENT_RING_STATE 0x02010107
/* Token Ring statistics */
/* Mandatory */
#define OID_802_5_LINE_ERRORS 0x02020101
#define OID_802_5_LOST_FRAMES 0x02020102
#define OID_802_5_BURST_ERRORS 0x02020201
#define OID_802_5_AC_ERRORS 0x02020202
#define OID_802_5_ABORT_DELIMETERS 0x02020203
#define OID_802_5_FRAME_COPIED_ERRORS 0x02020204
#define OID_802_5_FREQUENCY_ERRORS 0x02020205
#define OID_802_5_TOKEN_ERRORS 0x02020206
#define OID_802_5_INTERNAL_ERRORS 0x02020207
/* FDDI objects */
/* FDDI operational characteristics */
/* Mandatory */
#define OID_FDDI_LONG_PERMANENT_ADDR 0x03010101
#define OID_FDDI_LONG_CURRENT_ADDR 0x03010102
#define OID_FDDI_LONG_MULTICAST_LIST 0x03010103
#define OID_FDDI_LONG_MAX_LIST_SIZE 0x03010104
#define OID_FDDI_SHORT_PERMANENT_ADDR 0x03010105
#define OID_FDDI_SHORT_CURRENT_ADDR 0x03010106
#define OID_FDDI_SHORT_MULTICAST_LIST 0x03010107
#define OID_FDDI_SHORT_MAX_LIST_SIZE 0x03010108
/* FDDI statistics */
/* Mandatory */
#define OID_FDDI_ATTACHMENT_TYPE 0x03020101
#define OID_FDDI_UPSTREAM_NODE_LONG 0x03020102
#define OID_FDDI_DOWNSTREAM_NODE_LONG 0x03020103
#define OID_FDDI_FRAME_ERRORS 0x03020104
#define OID_FDDI_FRAMES_LOST 0x03020105
#define OID_FDDI_RING_MGT_STATE 0x03020106
#define OID_FDDI_LCT_FAILURES 0x03020107
#define OID_FDDI_LEM_REJECTS 0x03020108
#define OID_FDDI_LCONNECTION_STATE 0x03020109
/* LocalTalk objects */
/* LocalTalk operational characteristics */
/* Mandatory */
#define OID_LTALK_CURRENT_NODE_ID 0x05010102
/* LocalTalk statistics */
/* Mandatory */
#define OID_LTALK_IN_BROADCASTS 0x05020101
#define OID_LTALK_IN_LENGTH_ERRORS 0x05020102
/* Optional */
#define OID_LTALK_OUT_NO_HANDLERS 0x05020201
#define OID_LTALK_COLLISIONS 0x05020202
#define OID_LTALK_DEFERS 0x05020203
#define OID_LTALK_NO_DATA_ERRORS 0x05020204
#define OID_LTALK_RANDOM_CTS_ERRORS 0x05020205
#define OID_LTALK_FCS_ERRORS 0x05020206
/* ARCNET objects */
/* ARCNET operational characteristics */
/* Mandatory */
#define OID_ARCNET_PERMANENT_ADDRESS 0x06010101
#define OID_ARCNET_CURRENT_ADDRESS 0x06010102
/* ARCNET statistics */
/* Optional */
#define OID_ARCNET_RECONFIGURATIONS 0x06020201
/* WAN objects */
/* Mandatory */
#define OID_WAN_PERMANENT_ADDRESS 0x04010101
#define OID_WAN_CURRENT_ADDRESS 0x04010102
#define OID_WAN_QUALITY_OF_SERVICE 0x04010103
#define OID_WAN_PROTOCOL_TYPE 0x04010104
#define OID_WAN_MEDIUM_SUBTYPE 0x04010105
#define OID_WAN_HEADER_FORMAT 0x04010106
#define OID_WAN_GET_INFO 0x04010107
#define OID_WAN_SET_LINK_INFO 0x04010108
#define OID_WAN_GET_LINK_INFO 0x04010109
#define OID_WAN_LINE_COUNT 0x0401010A
#define OID_WAN_PROTOCOL_CAPS 0x0401010B
#define OID_WAN_GET_BRIDGE_INFO 0x0401020A
#define OID_WAN_SET_BRIDGE_INFO 0x0401020B
/* Optional */
#define OID_WAN_GET_COMP_INFO 0x0401020C
#define OID_WAN_SET_COMP_INFO 0x0401020D
#define OID_WAN_GET_STATS_INFO 0x0401020E
/* TAPI objects */
/* Madatory */
#define OID_TAPI_ANSWER 0x07030102
#define OID_TAPI_CLOSE 0x07030103
#define OID_TAPI_CLOSE_CALL 0x07030104
#define OID_TAPI_CONDITIONAL_MEDIA_DETECTION 0x07030105
#define OID_TAPI_DROP 0x07030109
#define OID_TAPI_GET_ADDRESS_CAPS 0x0703010A
#define OID_TAPI_GET_ADDRESS_ID 0x0703010B
#define OID_TAPI_GET_ADDRESS_STATUS 0x0703010C
#define OID_TAPI_GET_CALL_ADDRESS_ID 0x0703010D
#define OID_TAPI_GET_CALL_INFO 0x0703010E
#define OID_TAPI_GET_CALL_STATUS 0x0703010F
#define OID_TAPI_GET_DEV_CAPS 0x07030110
#define OID_TAPI_GET_DEV_CONFIG 0x07030111
#define OID_TAPI_GET_ID 0x07030113
#define OID_TAPI_GET_LINE_DEV_STATUS 0x07030114
#define OID_TAPI_MAKE_CALL 0x07030115
#define OID_TAPI_OPEN 0x07030117
#define OID_TAPI_PROVIDER_INITIALIZE 0x07030118
#define OID_TAPI_PROVIDER_SHUTDOWN 0x07030119
#define OID_TAPI_SET_APP_SPECIFIC 0x0703011D
#define OID_TAPI_SET_CALL_PARAMS 0x0703011E
#define OID_TAPI_SET_DEFAULT_MEDIA_DETECTION 0x0703011F
#define OID_TAPI_SET_MEDIA_MODE 0x07030121
#define OID_TAPI_SET_STATUS_MESSAGES 0x07030122
/* Optional */
#define OID_TAPI_ACCEPT 0x07030101
#define OID_TAPI_CONFIG_DIALOG 0x07030106
#define OID_TAPI_DEV_SPECIFIC 0x07030107
#define OID_TAPI_DIAL 0x07030108
#define OID_TAPI_GET_EXTENSION_ID 0x07030112
#define OID_TAPI_NEGOTIATE_EXT_VERSION 0x07030116
#define OID_TAPI_SET_DEV_CONFIG 0x07030120
#define OID_TAPI_SECURE_CALL 0x0703011A
#define OID_TAPI_SELECT_EXT_VERSION 0x0703011B
#define OID_TAPI_SEND_USER_USER_INFO 0x0703011C
/* Wireless objects */
/* Mandatory */
#define OID_WW_GEN_NETWORK_TYPES_SUPPORTED 0x09010101
#define OID_WW_GEN_NETWORK_TYPE_IN_USE 0x09010102
#define OID_WW_GEN_HEADER_FORMATS_SUPPORTED 0x09010103
#define OID_WW_GEN_HEADER_FORMAT_IN_USE 0x09010104
#define OID_WW_GEN_INDICATION_REQUEST 0x09010105
#define OID_WW_GEN_DEVICE_INFO 0x09010106
#define OID_WW_GEN_OPERATION_MODE 0x09010107
#define OID_WW_GEN_LOCK_STATUS 0x09010108
#define OID_WW_GEN_DISABLE_TRANSMITTER 0x09010109
#define OID_WW_GEN_NETWORK_ID 0x0901010A
#define OID_WW_GEN_PERMANENT_ADDRESS 0x0901010B
#define OID_WW_GEN_CURRENT_ADDRESS 0x0901010C
#define OID_WW_GEN_SUSPEND_DRIVER 0x0901010D
#define OID_WW_GEN_BASESTATION_ID 0x0901010E
#define OID_WW_GEN_CHANNEL_ID 0x0901010F
#define OID_WW_GEN_ENCRYPTION_SUPPORTED 0x09010110
#define OID_WW_GEN_ENCRYPTION_IN_USE 0x09010111
#define OID_WW_GEN_ENCRYPTION_STATE 0x09010112
#define OID_WW_GEN_CHANNEL_QUALITY 0x09010113
#define OID_WW_GEN_REGISTRATION_STATUS 0x09010114
#define OID_WW_GEN_RADIO_LINK_SPEED 0x09010115
#define OID_WW_GEN_LATENCY 0x09010116
#define OID_WW_GEN_BATTERY_LEVEL 0x09010117
#define OID_WW_GEN_EXTERNAL_POWER 0x09010118
/* Optional */
#define OID_WW_GEN_PING_ADDRESS 0x09010201
#define OID_WW_GEN_RSSI 0x09010202
#define OID_WW_GEN_SIM_STATUS 0x09010203
#define OID_WW_GEN_ENABLE_SIM_PIN 0x09010204
#define OID_WW_GEN_CHANGE_SIM_PIN 0x09010205
#define OID_WW_GEN_SIM_PUK 0x09010206
#define OID_WW_GEN_SIM_EXCEPTION 0x09010207
/* Metricom OIDs */
#define OID_WW_MET_FUNCTION 0x09190101
/* DataTac OIDs */
#define OID_WW_TAC_COMPRESSION 0x09150101
#define OID_WW_TAC_SET_CONFIG 0x09150102
#define OID_WW_TAC_GET_STATUS 0x09150103
#define OID_WW_TAC_USER_HEADER 0x09150104
/* Ardis OIDs */
#define OID_WW_ARD_SNDCP 0x09110101
#define OID_WW_ARD_TMLY_MSG 0x09110102
#define OID_WW_ARD_DATAGRAM 0x09110103
/* CDPD OIDs */
#define OID_WW_CDPD_CIRCUIT_SWITCHED 0x090D010E
#define OID_WW_CDPD_TEI 0x090D010F
#define OID_WW_CDPD_RSSI 0x090D0110
#define OID_WW_CDPD_CS_SERVICE_PREFERENCE 0x090D0111
#define OID_WW_CDPD_CS_SERVICE_STATUS 0x090D0112
#define OID_WW_CDPD_CS_INFO 0x090D0113
#define OID_WW_CDPD_CS_SUSPEND 0x090D0114
#define OID_WW_CDPD_CS_DEFAULT_DIAL_CODE 0x090D0115
#define OID_WW_CDPD_CS_CALLBACK 0x090D0116
#define OID_WW_CDPD_CS_SID_LIST 0x090D0117
#define OID_WW_CDPD_CS_CONFIGURATION 0x090D0118
/* Pinpoint OIDs */
#define OID_WW_PIN_LOC_AUTHORIZE 0x09090101
#define OID_WW_PIN_LAST_LOCATION 0x09090102
#define OID_WW_PIN_LOC_FIX 0x09090103
/* Mobitex OIDs */
#define OID_WW_MBX_SUBADDR 0x09050101
/* OID 0x09050102 is reserved and may not be used */
#define OID_WW_MBX_FLEXLIST 0x09050103
#define OID_WW_MBX_GROUPLIST 0x09050104
#define OID_WW_MBX_TRAFFIC_AREA 0x09050105
#define OID_WW_MBX_LIVE_DIE 0x09050106
#define OID_WW_MBX_TEMP_DEFAULTLIST 0x09050107
/* Connection-oriented objects */
/* Connection-oriented operational characteristics */
/* Mandatory */
#define OID_GEN_CO_SUPPORTED_LIST OID_GEN_SUPPORTED_LIST
#define OID_GEN_CO_HARDWARE_STATUS OID_GEN_HARDWARE_STATUS
#define OID_GEN_CO_MEDIA_SUPPORTED OID_GEN_MEDIA_SUPPORTED
#define OID_GEN_CO_MEDIA_IN_USE OID_GEN_MEDIA_IN_USE
#define OID_GEN_CO_LINK_SPEED OID_GEN_LINK_SPEED
#define OID_GEN_CO_VENDOR_ID OID_GEN_VENDOR_ID
#define OID_GEN_CO_VENDOR_DESCRIPTION OID_GEN_VENDOR_DESCRIPTION
#define OID_GEN_CO_DRIVER_VERSION OID_GEN_DRIVER_VERSION
#define OID_GEN_CO_PROTOCOL_OPTIONS OID_GEN_PROTOCOL_OPTIONS
#define OID_GEN_CO_MAC_OPTIONS OID_GEN_MAC_OPTIONS
#define OID_GEN_CO_MEDIA_CONNECT_STATUS OID_GEN_MEDIA_CONNECT_STATUS
#define OID_GEN_CO_VENDOR_DRIVER_VERSION OID_GEN_VENDOR_DRIVER_VERSION
/* Optional */
#define OID_GEN_CO_SUPPORTED_GUIDS OID_GEN_SUPPORTED_GUIDS
#define OID_GEN_CO_GET_TIME_CAPS OID_GEN_GET_TIME_CAPS
#define OID_GEN_CO_GET_NETCARD_TIME OID_GEN_GET_NETCARD_TIME
#define OID_GEN_CO_MINIMUM_LINK_SPEED 0x00020120
/* Connection-oriented statistics */
#define OID_GEN_CO_XMIT_PDUS_OK OID_GEN_XMIT_OK
#define OID_GEN_CO_RCV_PDUS_OK OID_GEN_RCV_OK
#define OID_GEN_CO_XMIT_PDUS_ERROR OID_GEN_XMIT_ERROR
#define OID_GEN_CO_RCV_PDUS_ERROR OID_GEN_RCV_ERROR
#define OID_GEN_CO_RCV_PDUS_NO_BUFFER OID_GEN_RCV_NO_BUFFER
#define OID_GEN_CO_RCV_CRC_ERROR OID_GEN_RCV_CRC_ERROR
#define OID_GEN_CO_TRANSMIT_QUEUE_LENGTH OID_GEN_TRANSMIT_QUEUE_LENGTH
#define OID_GEN_CO_BYTES_XMIT OID_GEN_DIRECTED_BYTES_XMIT
#define OID_GEN_CO_BYTES_RCV OID_GEN_DIRECTED_BYTES_RCV
#define OID_GEN_CO_NETCARD_LOAD OID_GEN_NETCARD_LOAD
#define OID_GEN_CO_DEVICE_PROFILE OID_GEN_DEVICE_PROFILE
#define OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020221
#endif /* __NDISOID_H */
/* EOF */

View file

@ -0,0 +1,16 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS NDIS library
* FILE: include/net/netevent.h
* PURPOSE: Network event constants
*/
#ifndef __NETEVENT_H
#define __NETEVENT_H
#define EVENT_TRANSPORT_REGISTER_FAILED 0xC000232CL
#define EVENT_TRANSPORT_ADAPTER_NOT_FOUND 0xC000232EL
#endif /* __NETEVENT_H */
/* EOF */

644
reactos/include/net/tdi.h Normal file
View file

@ -0,0 +1,644 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS TDI library
* FILE: include/net/tdi.h
* PURPOSE: TDI definitions for user mode clients
*/
#ifndef __TDI_H
#define __TDI_H
/* FIXME: Missed some definitions in ntddk.h */
/* Could be defined in ndis.h */
#ifndef __NDIS_H
typedef signed int INT, *PINT;
#endif
/* Basic types */
typedef LONG TDI_STATUS;
typedef PVOID CONNECTION_CONTEXT;
/* TDI status codes */
#define TDI_SUCCESS STATUS_SUCCESS
#define TDI_NO_RESOURCES STATUS_INSUFFICIENT_RESOURCES
#define TDI_ADDR_IN_USE STATUS_ADDRESS_ALREADY_EXISTS
#define TDI_BAD_ADDR STATUS_INVALID_ADDRESS_COMPONENT
#define TDI_NO_FREE_ADDR STATUS_TOO_MANY_ADDRESSES
#define TDI_ADDR_INVALID STATUS_INVALID_ADDRESS
#define TDI_ADDR_DELETED STATUS_ADDRESS_CLOSED
#define TDI_BUFFER_OVERFLOW STATUS_BUFFER_OVERFLOW
#define TDI_BAD_EVENT_TYPE STATUS_INVALID_PARAMETER
#define TDI_BAD_OPTION STATUS_INVALID_PARAMETER
#define TDI_CONN_REFUSED STATUS_CONNECTION_REFUSED
#define TDI_INVALID_CONNECTION STATUS_CONNECTION_INVALID
#define TDI_ALREADY_ASSOCIATED STATUS_ADDRESS_ALREADY_ASSOCIATED
#define TDI_NOT_ASSOCIATED STATUS_ADDRESS_NOT_ASSOCIATED
#define TDI_CONNECTION_ACTIVE STATUS_CONNECTION_ACTIVE
#define TDI_CONNECTION_ABORTED STATUS_CONNECTION_ABORTED
#define TDI_CONNECTION_RESET STATUS_CONNECTION_RESET
#define TDI_TIMED_OUT STATUS_IO_TIMEOUT
#define TDI_GRACEFUL_DISC STATUS_GRACEFUL_DISCONNECT
#define TDI_NOT_ACCEPTED STATUS_DATA_NOT_ACCEPTED
#define TDI_MORE_PROCESSING STATUS_MORE_PROCESSING_REQUIRED
#define TDI_INVALID_STATE STATUS_INVALID_DEVICE_STATE
#define TDI_INVALID_PARAMETER STATUS_INVALID_PARAMETER
#define TDI_DEST_NET_UNREACH STATUS_NETWORK_UNREACHABLE
#define TDI_DEST_HOST_UNREACH STATUS_HOST_UNREACHABLE
#define TDI_DEST_UNREACHABLE TDI_DEST_HOST_UNREACH
#define TDI_DEST_PROT_UNREACH STATUS_PROTOCOL_UNREACHABLE
#define TDI_DEST_PORT_UNREACH STATUS_PORT_UNREACHABLE
#define TDI_INVALID_QUERY STATUS_INVALID_DEVICE_REQUEST
#define TDI_REQ_ABORTED STATUS_REQUEST_ABORTED
#define TDI_BUFFER_TOO_SMALL STATUS_BUFFER_TOO_SMALL
#define TDI_CANCELLED STATUS_CANCELLED
#define TDI_BUFFER_TOO_BIG STATUS_INVALID_BUFFER_SIZE
#define TDI_INVALID_REQUEST STATUS_INVALID_DEVICE_REQUEST
#define TDI_PENDING STATUS_PENDING
#define TDI_ITEM_NOT_FOUND STATUS_OBJECT_NAME_NOT_FOUND
#define TDI_OPTION_EOL 0
#define TDI_ADDRESS_OPTION_REUSE 1
#define TDI_ADDRESS_OPTION_DHCP 2
/* TDI IOCTL codes */
#define TDI_CONTROL_CODE(Request, Method) \
CTL_CODE(FILE_DEVICE_TRANSPORT, Request, Method, FILE_ANY_ACCESS)
#define IOCTL_TDI_ACCEPT TDI_CONTROL_CODE(0, METHOD_BUFFERED)
#define IOCTL_TDI_CONNECT TDI_CONTROL_CODE(1, METHOD_BUFFERED)
#define IOCTL_TDI_DISCONNECT TDI_CONTROL_CODE(2, METHOD_BUFFERED)
#define IOCTL_TDI_LISTEN TDI_CONTROL_CODE(3, METHOD_BUFFERED)
#define IOCTL_TDI_QUERY_INFORMATION TDI_CONTROL_CODE(4, METHOD_OUT_DIRECT)
#define IOCTL_TDI_RECEIVE TDI_CONTROL_CODE(5, METHOD_OUT_DIRECT)
#define IOCTL_TDI_RECEIVE_DATAGRAM TDI_CONTROL_CODE(6, METHOD_OUT_DIRECT)
#define IOCTL_TDI_SEND TDI_CONTROL_CODE(7, METHOD_IN_DIRECT)
#define IOCTL_TDI_SEND_DATAGRAM TDI_CONTROL_CODE(8, METHOD_IN_DIRECT)
#define IOCTL_TDI_SET_EVENT_HANDLER TDI_CONTROL_CODE(9, METHOD_BUFFERED)
#define IOCTL_TDI_SET_INFORMATION TDI_CONTROL_CODE(10, METHOD_IN_DIRECT)
#define IOCTL_TDI_ASSOCIATE_ADDRESS TDI_CONTROL_CODE(11, METHOD_BUFFERED)
#define IOCTL_TDI_DISASSOCIATE_ADDRESS TDI_CONTROL_CODE(12, METHOD_BUFFERED)
#define IOCTL_TDI_ACTION TDI_CONTROL_CODE(13, METHOD_OUT_DIRECT)
/* TDI transport driver dispatch routines */
NTSTATUS TdiDispatchCleanup(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS TdiDispatchClose(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS TdiDispatchCreate(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS TdiDispatchDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PIO_STACK_LOCATION IrpSp);
BOOLEAN TdiDispatchFastDeviceControl(
IN PFILE_OBJECT FileObject,
IN BOOLEAN Wait,
IN PVOID InputBuffer,
IN ULONG InputBufferLength,
IN OUT PVOID OutputBuffer,
IN ULONG OutputBufferLength,
IN ULONG IoControlCode,
OUT PIO_STATUS_BLOCK IoStatus);
NTSTATUS TdiDispatchInternalDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
/* TDI structures */
typedef struct _TDI_CONNECTION_INFORMATION
{
LONG UserDataLength;
PVOID UserData;
LONG OptionsLength;
PVOID Options;
LONG RemoteAddressLength;
PVOID RemoteAddress;
} TDI_CONNECTION_INFORMATION, *PTDI_CONNECTION_INFORMATION;
typedef struct _TDI_REQUEST
{
union {
HANDLE AddressHandle;
CONNECTION_CONTEXT ConnectionContext;
HANDLE ControlChannel;
} Handle;
PVOID RequestNotifyObject;
PVOID RequestContext;
TDI_STATUS TdiStatus;
} TDI_REQUEST, *PTDI_REQUEST;
typedef struct _TDI_REQUEST_STATUS
{
TDI_STATUS Status;
PVOID RequestContext;
ULONG BytesTransferred;
} TDI_REQUEST_STATUS, *PTDI_REQUEST_STATUS;
typedef struct _TA_ADDRESS
{
USHORT AddressLength;
USHORT AddressType;
UCHAR Address[1];
} TA_ADDRESS, *PTA_ADDRESS;
#define TDI_ADDRESS_TYPE_UNSPEC 0
#define TDI_ADDRESS_TYPE_UNIX 1
#define TDI_ADDRESS_TYPE_IP 2
#define TDI_ADDRESS_TYPE_IMPLINK 3
#define TDI_ADDRESS_TYPE_PUP 4
#define TDI_ADDRESS_TYPE_CHAOS 5
#define TDI_ADDRESS_TYPE_NS 6
#define TDI_ADDRESS_TYPE_IPX 6
#define TDI_ADDRESS_TYPE_NBS 7
#define TDI_ADDRESS_TYPE_ECMA 8
#define TDI_ADDRESS_TYPE_DATAKIT 9
#define TDI_ADDRESS_TYPE_CCITT 10
#define TDI_ADDRESS_TYPE_SNA 11
#define TDI_ADDRESS_TYPE_DECnet 12
#define TDI_ADDRESS_TYPE_DLI 13
#define TDI_ADDRESS_TYPE_LAT 14
#define TDI_ADDRESS_TYPE_HYLINK 15
#define TDI_ADDRESS_TYPE_APPLETALK 16
#define TDI_ADDRESS_TYPE_NETBIOS 17
#define TDI_ADDRESS_TYPE_8022 18
#define TDI_ADDRESS_TYPE_OSI_TSAP 19
#define TDI_ADDRESS_TYPE_NETONE 20
#define TDI_ADDRESS_TYPE_VNS 21
#define TDI_ADDRESS_TYPE_NETBIOS_EX 22
#define TdiTransportAddress "TransportAddress"
#define TdiConnectionContext "ConnectionContext"
#define TDI_TRANSPORT_ADDRESS_LENGTH (sizeof(TdiTransportAddress) - 1)
#define TDI_CONNECTION_CONTEXT_LENGTH (sizeof(TdiConnectionContext) - 1)
typedef struct _TRANSPORT_ADDRESS
{
LONG TAAddressCount;
TA_ADDRESS Address[1];
} TRANSPORT_ADDRESS, *PTRANSPORT_ADDRESS;
typedef struct _TDI_ADDRESS_INFO
{
ULONG ActivityCount;
TRANSPORT_ADDRESS Address;
} TDI_ADDRESS_INFO, *PTDI_ADDRESS_INFO;
typedef struct _TDI_ACTION_HEADER
{
ULONG TransportId;
USHORT ActionCode;
USHORT Reserved;
} TDI_ACTION_HEADER, *PTDI_ACTION_HEADER;
typedef struct _TDI_ADDRESS_8022
{
UCHAR MACAddress[6];
} TDI_ADDRESS_8022, *PTDI_ADDRESS_8022;
typedef struct _TDI_ADDRESS_APPLETALK
{
USHORT Network;
UCHAR Node;
UCHAR Socket;
} TDI_ADDRESS_APPLETALK, *PTDI_ADDRESS_APPLETALK;
#define TDI_ADDRESS_LENGTH_APPLETALK sizeof(TDI_ADDRESS_APPLETALK)
typedef struct _TDI_ADDRESS_IP
{
USHORT sin_port;
ULONG in_addr;
UCHAR sin_zero[8];
} TDI_ADDRESS_IP, *PTDI_ADDRESS_IP;
#define TDI_ADDRESS_LENGTH_IP sizeof(TDI_ADDRESS_IP)
typedef struct _TDI_ADDRESS_IPX
{
ULONG NetworkAddress;
UCHAR NodeAddress[6];
USHORT Socket;
} TDI_ADDRESS_IPX, *PTDI_ADDRESS_IPX;
#define TDI_ADDRESS_LENGTH_IPX sizeof(TDI_ADDRESS_IPX)
typedef struct _TDI_ADDRESS_NETBIOS
{
USHORT NetbiosNameType;
UCHAR NetbiosName[16];
} TDI_ADDRESS_NETBIOS, *PTDI_ADDRESS_NETBIOS;
#define TDI_ADDRESS_NETBIOS_TYPE_UNIQUE 0x0000
#define TDI_ADDRESS_NETBIOS_TYPE_GROUP 0x0001
#define TDI_ADDRESS_NETBIOS_TYPE_QUICK_UNIQUE 0x0002
#define TDI_ADDRESS_NETBIOS_TYPE_QUICK_GROUP 0x0003
#define TDI_ADDRESS_LENGTH_NETBIOS sizeof(TDI_ADDRESS_NETBIOS)
typedef struct _TDI_ADDRESS_NETBIOS_EX
{
UCHAR EndpointName[16];
TDI_ADDRESS_NETBIOS NetbiosAddress;
} TDI_ADDRESS_NETBIOS_EX, *PTDI_ADDRESS_NETBIOS_EX;
#define TDI_ADDRESS_LENGTH_NETBIOS_EX sizeof(TDI_ADDRESS_NETBIOS_EX)
typedef struct _TDI_ADDRESS_NETONE
{
USHORT NetoneNameType;
UCHAR NetoneName[20];
} TDI_ADDRESS_NETONE, *PTDI_ADDRESS_NETONE;
#define TDI_ADDRESS_NETONE_TYPE_UNIQUE 0x0000
#define TDI_ADDRESS_NETONE_TYPE_ROTORED 0x0001
#define TDI_ADDRESS_LENGTH_NETONE sizeof(TDI_ADDRESS_NETONE)
typedef struct _TDI_ADDRESS_NS
{
ULONG NetworkAddress;
UCHAR NodeAddress[6];
USHORT Socket;
} TDI_ADDRESS_NS, *PTDI_ADDRESS_NS;
#define TDI_ADDRESS_LENGTH_NS sizeof(TDI_ADDRESS_NS)
#define ISO_MAX_ADDR_LENGTH 64
#define ISO_HIERARCHICAL 0
#define ISO_NON_HIERARCHICAL 1
typedef struct _TDI_ADDRESS_OSI_TSAP
{
USHORT tp_addr_type;
USHORT tp_taddr_len;
USHORT tp_tsel_len;
UCHAR tp_addr[ISO_MAX_ADDR_LENGTH];
} TDI_ADDRESS_OSI_TSAP, *PTDI_ADDRESS_OSI_TSAP;
#define TDI_ADDRESS_LENGTH_OSI_TSAP sizeof(TDI_ADDRESS_OSI_TSAP)
typedef struct _TDI_ADDRESS_VNS
{
UCHAR net_address[4];
UCHAR subnet_addr[2];
UCHAR port[2];
UCHAR hops;
UCHAR filler[5];
} TDI_ADDRESS_VNS, *PTDI_ADDRESS_VNS;
#define TDI_ADDRESS_LENGTH_VNS sizeof(TDI_ADDRESS_VNS)
/* TDI request structures */
typedef struct _TDI_CONNECT_REQUEST
{
TDI_REQUEST Request;
PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
LARGE_INTEGER Timeout;
} TDI_REQUEST_CONNECT, *PTDI_REQUEST_CONNECT;
typedef struct _TDI_REQUEST_ACCEPT
{
TDI_REQUEST Request;
PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
} TDI_REQUEST_ACCEPT, *PTDI_REQUEST_ACCEPT;
typedef struct _TDI_REQUEST_LISTEN
{
TDI_REQUEST Request;
PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
USHORT ListenFlags;
} TDI_REQUEST_LISTEN, *PTDI_REQUEST_LISTEN;
typedef struct _TDI_DISCONNECT_REQUEST
{
TDI_REQUEST Request;
LARGE_INTEGER Timeout;
} TDI_REQUEST_DISCONNECT, *PTDI_REQUEST_DISCONNECT;
typedef struct _TDI_REQUEST_SEND
{
TDI_REQUEST Request;
USHORT SendFlags;
} TDI_REQUEST_SEND, *PTDI_REQUEST_SEND;
typedef struct _TDI_REQUEST_RECEIVE
{
TDI_REQUEST Request;
USHORT ReceiveFlags;
} TDI_REQUEST_RECEIVE, *PTDI_REQUEST_RECEIVE;
typedef struct _TDI_REQUEST_SEND_DATAGRAM
{
TDI_REQUEST Request;
PTDI_CONNECTION_INFORMATION SendDatagramInformation;
} TDI_REQUEST_SEND_DATAGRAM, *PTDI_REQUEST_SEND_DATAGRAM;
typedef struct _TDI_REQUEST_RECEIVE_DATAGRAM
{
TDI_REQUEST Request;
PTDI_CONNECTION_INFORMATION ReceiveDatagramInformation;
PTDI_CONNECTION_INFORMATION ReturnInformation;
USHORT ReceiveFlags;
} TDI_REQUEST_RECEIVE_DATAGRAM, *PTDI_REQUEST_RECEIVE_DATAGRAM;
typedef struct _TDI_REQUEST_SET_EVENT
{
TDI_REQUEST Request;
LONG EventType;
PVOID EventHandler;
PVOID EventContext;
} TDI_REQUEST_SET_EVENT_HANDLER, *PTDI_REQUEST_SET_EVENT_HANDLER;
#define TDI_RECEIVE_BROADCAST 0x00000004
#define TDI_RECEIVE_MULTICAST 0x00000008
#define TDI_RECEIVE_PARTIAL 0x00000010
#define TDI_RECEIVE_NORMAL 0x00000020
#define TDI_RECEIVE_EXPEDITED 0x00000040
#define TDI_RECEIVE_PEEK 0x00000080
#define TDI_RECEIVE_NO_RESPONSE_EXP 0x00000100
#define TDI_RECEIVE_COPY_LOOKAHEAD 0x00000200
#define TDI_RECEIVE_ENTIRE_MESSAGE 0x00000400
#define TDI_RECEIVE_AT_DISPATCH_LEVEL 0x00000800
/* Listen flags */
#define TDI_QUERY_ACCEPT 0x00000001
/* Options used for both SendOptions and ReceiveIndicators */
#define TDI_SEND_EXPEDITED 0x0020
#define TDI_SEND_PARTIAL 0x0040
#define TDI_SEND_NO_RESPONSE_EXPECTED 0x0080
#define TDI_SEND_NON_BLOCKING 0x0100
/* Disconnect Flags */
#define TDI_DISCONNECT_WAIT 0x0001
#define TDI_DISCONNECT_ABORT 0x0002
#define TDI_DISCONNECT_RELEASE 0x0004
/* TdiRequest structure for TdiQueryInformation request */
typedef struct _TDI_REQUEST_QUERY_INFORMATION
{
TDI_REQUEST Request;
ULONG QueryType;
PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
} TDI_REQUEST_QUERY_INFORMATION, *PTDI_REQUEST_QUERY_INFORMATION;
/* TdiRequest structure for TdiSetInformation request */
typedef struct _TDI_REQUEST_SET_INFORMATION
{
TDI_REQUEST Request;
ULONG SetType;
PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
} TDI_REQUEST_SET_INFORMATION, *PTDI_REQUEST_SET_INFORMATION;
typedef union _TDI_REQUEST_TYPE
{
TDI_REQUEST_ACCEPT TdiAccept;
TDI_REQUEST_CONNECT TdiConnect;
TDI_REQUEST_DISCONNECT TdiDisconnect;
TDI_REQUEST_LISTEN TdiListen;
TDI_REQUEST_QUERY_INFORMATION TdiQueryInformation;
TDI_REQUEST_RECEIVE TdiReceive;
TDI_REQUEST_RECEIVE_DATAGRAM TdiReceiveDatagram;
TDI_REQUEST_SEND TdiSend;
TDI_REQUEST_SEND_DATAGRAM TdiSendDatagram;
TDI_REQUEST_SET_EVENT_HANDLER TdiSetEventHandler;
TDI_REQUEST_SET_INFORMATION TdiSetInformation;
} TDI_REQUEST_TYPE, *PTDI_REQUEST_TYPE;
/* Query information types */
/* Generic query info types that must be supported by all transports */
#define TDI_QUERY_BROADCAST_ADDRESS 0x00000001
#define TDI_QUERY_PROVIDER_INFO 0x00000002
#define TDI_QUERY_ADDRESS_INFO 0x00000003
#define TDI_QUERY_CONNECTION_INFO 0x00000004
#define TDI_QUERY_PROVIDER_STATISTICS 0x00000005
#define TDI_QUERY_DATAGRAM_INFO 0x00000006
#define TDI_QUERY_DATA_LINK_ADDRESS 0x00000007
#define TDI_QUERY_NETWORK_ADDRESS 0x00000008
#define TDI_QUERY_MAX_DATAGRAM_INFO 0x00000009
/* Netbios specific query information types */
#define TDI_QUERY_ADAPTER_STATUS 0x00000100
#define TDI_QUERY_SESSION_STATUS 0x00000200
#define TDI_QUERY_FIND_NAME 0x00000300
typedef struct _TA_APPLETALK_ADDR
{
LONG TAAddressCount;
struct _AddrAtalk {
USHORT AddressLength;
USHORT AddressType;
TDI_ADDRESS_APPLETALK Address[1];
} Address[1];
} TA_APPLETALK_ADDRESS, *PTA_APPLETALK_ADDRESS;
typedef struct _TA_ADDRESS_IP
{
LONG TAAddressCount;
struct _AddrIp {
USHORT AddressLength;
USHORT AddressType;
TDI_ADDRESS_IP Address[1];
} Address[1];
} TA_ADDRESS_IP, *PTA_ADDRESS_IP;
typedef struct _TA_ADDRESS_IPX
{
LONG TAAddressCount;
struct _AddrIpx {
USHORT AddressLength;
USHORT AddressType;
TDI_ADDRESS_IP Address[1];
} Address[1];
} TA_IPX_ADDRESS, *PTA_IPX_ADDRESS;
typedef struct _TA_NETBIOS_ADDRESS
{
LONG TAAddressCount;
struct _Addr{
USHORT AddressLength;
USHORT AddressType;
TDI_ADDRESS_NETBIOS Address[1];
} Address[1];
} TA_NETBIOS_ADDRESS, *PTA_NETBIOS_ADDRESS;
typedef struct _TA_ADDRESS_NS
{
LONG TAAddressCount;
struct _AddrNs {
USHORT AddressLength;
USHORT AddressType;
TDI_ADDRESS_NS Address[1];
} Address[1];
} TA_NS_ADDRESS, *PTA_NS_ADDRESS;
typedef struct _TA_ADDRESS_VNS
{
LONG TAAddressCount;
struct _AddrVns {
USHORT AddressLength;
USHORT AddressType;
TDI_ADDRESS_VNS Address[1];
} Address[1];
} TA_VNS_ADDRESS, *PTA_VNS_ADDRESS;
/* Structures used for TdiQueryInformation and TdiSetInformation */
typedef struct _TDI_ENDPOINT_INFO
{
ULONG State;
ULONG Event;
ULONG TransmittedTsdus;
ULONG ReceivedTsdus;
ULONG TransmissionErrors;
ULONG ReceiveErrors;
ULONG MinimumLookaheadData;
ULONG MaximumLookaheadData;
ULONG PriorityLevel;
ULONG SecurityLevel;
ULONG SecurityCompartment;
} TDI_ENDPOINT_INFO, *PTDI_ENDPOINT_INFO;
typedef struct _TDI_CONNECTION_INFO
{
ULONG State;
ULONG Event;
ULONG TransmittedTsdus;
ULONG ReceivedTsdus;
ULONG TransmissionErrors;
ULONG ReceiveErrors;
LARGE_INTEGER Throughput;
LARGE_INTEGER Delay;
ULONG SendBufferSize;
ULONG ReceiveBufferSize;
BOOLEAN Unreliable;
} TDI_CONNECTION_INFO, *PTDI_CONNECTION_INFO;
typedef struct _TDI_DATAGRAM_INFO
{
ULONG MaximumDatagramBytes;
ULONG MaximumDatagramCount;
} TDI_DATAGRAM_INFO, *PTDI_DATAGRAM_INFO;
typedef struct _TDI_MAX_DATAGRAM_INFO
{
ULONG MaxDatagramSize;
} TDI_MAX_DATAGRAM_INFO, *PTDI_MAX_DATAGRAM_INFO;
typedef struct _TDI_PROVIDER_INFO
{
ULONG Version;
ULONG MaxSendSize;
ULONG MaxConnectionUserData;
ULONG MaxDatagramSize;
ULONG ServiceFlags;
ULONG MinimumLookaheadData;
ULONG MaximumLookaheadData;
ULONG NumberOfResources;
LARGE_INTEGER StartTime;
} TDI_PROVIDER_INFO, *PTDI_PROVIDER_INFO;
#define TDI_SERVICE_CONNECTION_MODE 0x00000001
#define TDI_SERVICE_ORDERLY_RELEASE 0x00000002
#define TDI_SERVICE_CONNECTIONLESS_MODE 0x00000004
#define TDI_SERVICE_ERROR_FREE_DELIVERY 0x00000008
#define TDI_SERVICE_SECURITY_LEVEL 0x00000010
#define TDI_SERVICE_BROADCAST_SUPPORTED 0x00000020
#define TDI_SERVICE_MULTICAST_SUPPORTED 0x00000040
#define TDI_SERVICE_DELAYED_ACCEPTANCE 0x00000080
#define TDI_SERVICE_EXPEDITED_DATA 0x00000100
#define TDI_SERVICE_INTERNAL_BUFFERING 0x00000200
#define TDI_SERVICE_ROUTE_DIRECTED 0x00000400
#define TDI_SERVICE_NO_ZERO_LENGTH 0x00000800
#define TDI_SERVICE_POINT_TO_POINT 0x00001000
#define TDI_SERVICE_MESSAGE_MODE 0x00002000
#define TDI_SERVICE_HALF_DUPLEX 0x00004000
typedef struct _TDI_PROVIDER_RESOURCE_STATS
{
ULONG ResourceId;
ULONG MaximumResourceUsed;
ULONG AverageResourceUsed;
ULONG ResourceExhausted;
} TDI_PROVIDER_RESOURCE_STATS, *PTDI_PROVIDER_RESOURCE_STATS;
typedef struct _TDI_PROVIDER_STATISTICS
{
ULONG Version;
ULONG OpenConnections;
ULONG ConnectionsAfterNoRetry;
ULONG ConnectionsAfterRetry;
ULONG LocalDisconnects;
ULONG RemoteDisconnects;
ULONG LinkFailures;
ULONG AdapterFailures;
ULONG SessionTimeouts;
ULONG CancelledConnections;
ULONG RemoteResourceFailures;
ULONG LocalResourceFailures;
ULONG NotFoundFailures;
ULONG NoListenFailures;
ULONG DatagramsSent;
LARGE_INTEGER DatagramBytesSent;
ULONG DatagramsReceived;
LARGE_INTEGER DatagramBytesReceived;
ULONG PacketsSent;
ULONG PacketsReceived;
ULONG DataFramesSent;
LARGE_INTEGER DataFrameBytesSent;
ULONG DataFramesReceived;
LARGE_INTEGER DataFrameBytesReceived;
ULONG DataFramesResent;
LARGE_INTEGER DataFrameBytesResent;
ULONG DataFramesRejected;
LARGE_INTEGER DataFrameBytesRejected;
ULONG ResponseTimerExpirations;
ULONG AckTimerExpirations;
ULONG MaximumSendWindow;
ULONG AverageSendWindow;
ULONG PiggybackAckQueued;
ULONG PiggybackAckTimeouts;
LARGE_INTEGER WastedPacketSpace;
ULONG WastedSpacePackets;
ULONG NumberOfResources;
TDI_PROVIDER_RESOURCE_STATS Resources[1];
} TDI_PROVIDER_STATISTICS, *PTDI_PROVIDER_STATISTICS;
#endif /* __TDI_H */
/* EOF */

View file

@ -0,0 +1,96 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS TDI library
* FILE: include/net/tdiinfo.h
* PURPOSE: TDI definitions for Tdi(Query/Set)InformationEx
*/
#ifndef __TDIINFO_H
#define __TDIINFO_H
typedef struct TDIEntityID
{
ULONG tei_entity;
ULONG tei_instance;
} TDIEntityID;
typedef struct TDIObjectID
{
TDIEntityID toi_entity;
ULONG toi_class;
ULONG toi_type;
ULONG toi_id;
} TDIObjectID;
#define CONTEXT_SIZE 16
#define MAX_TDI_ENTITIES 512
#define INFO_CLASS_GENERIC 0x100
#define INFO_CLASS_PROTOCOL 0x200
#define INFO_CLASS_IMPLEMENTATION 0x300
#define INFO_TYPE_PROVIDER 0x100
#define INFO_TYPE_ADDRESS_OBJECT 0x200
#define INFO_TYPE_CONNECTION 0x300
#define ENTITY_LIST_ID 0
#define GENERIC_ENTITY 0
#define IF_ENTITY 0x200
#define AT_ENTITY 0x280
#define CO_NL_ENTITY 0x300
#define CL_NL_ENTITY 0x301
#define ER_ENTITY 0x380
#define CO_TL_ENTITY 0x400
#define CL_TL_ENTITY 0x401
/* IDs supported by all entities */
#define ENTITY_TYPE_ID 1
#define IF_GENERIC 0x200
#define IF_MIB 0x202
#define AT_ARP 0x280
#define AT_NULL 0x282
#define CL_NL_IPX 0x301
#define CL_NL_IP 0x303
#define ER_ICMP 0x380
#define CO_TL_NBF 0x400
#define CO_TL_SPX 0x402
#define CO_TL_TCP 0x404
#define CO_TL_SPP 0x406
#define CL_TL_NBF 0x401
#define CL_TL_UDP 0x403
/* TCP specific structures */
typedef struct _TCP_REQUEST_QUERY_INFORMATION_EX
{
TDIObjectID ID;
UCHAR Context[CONTEXT_SIZE];
} TCP_REQUEST_QUERY_INFORMATION_EX, *PTCP_REQUEST_QUERY_INFORMATION_EX;
typedef struct _TCP_REQUEST_SET_INFORMATION_EX
{
TDIObjectID ID;
UINT BufferSize;
UCHAR Buffer[1];
} TCP_REQUEST_SET_INFORMATION_EX, *PTCP_REQUEST_SET_INFORMATION_EX;
#endif /* __TDIINFO_H */
/* EOF */

View file

@ -0,0 +1,805 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS TDI library
* FILE: include/net/tdikrnl.h
* PURPOSE: TDI definitions for kernel mode drivers
*/
#ifndef __TDIKRNL_H
#define __TDIKRNL_H
#include "tdi.h"
#ifndef STDCALL
#define STDCALL
#endif
typedef struct _TDI_REQUEST_KERNEL
{
ULONG RequestFlags;
PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
PVOID RequestSpecific;
} TDI_REQUEST_KERNEL, *PTDI_REQUEST_KERNEL;
/* Request codes */
#define TDI_ASSOCIATE_ADDRESS 0x01
#define TDI_DISASSOCIATE_ADDRESS 0x02
#define TDI_CONNECT 0x03
#define TDI_LISTEN 0x04
#define TDI_ACCEPT 0x05
#define TDI_DISCONNECT 0x06
#define TDI_SEND 0x07
#define TDI_RECEIVE 0x08
#define TDI_SEND_DATAGRAM 0x09
#define TDI_RECEIVE_DATAGRAM 0x0A
#define TDI_SET_EVENT_HANDLER 0x0B
#define TDI_QUERY_INFORMATION 0x0C
#define TDI_SET_INFORMATION 0x0D
#define TDI_ACTION 0x0E
#define TDI_DIRECT_SEND 0x27
#define TDI_DIRECT_SEND_DATAGRAM 0x29
#define TDI_TRANSPORT_ADDRESS_FILE 1
#define TDI_CONNECTION_FILE 2
#define TDI_CONTROL_CHANNEL_FILE 3
/* Internal TDI IOCTLS */
#define IOCTL_TDI_QUERY_DIRECT_SEND_HANDLER TDI_CONTROL_CODE(0x80, METHOD_NEITHER)
#define IOCTL_TDI_QUERY_DIRECT_SENDDG_HANDLER TDI_CONTROL_CODE(0x81, METHOD_NEITHER)
/* TdiAssociateAddress */
typedef struct _TDI_REQUEST_KERNEL_ASSOCIATE
{
HANDLE AddressHandle;
} TDI_REQUEST_KERNEL_ASSOCIATE, *PTDI_REQUEST_KERNEL_ASSOCIATE;
/* TdiDisassociateAddress */
typedef TDI_REQUEST_KERNEL TDI_REQUEST_KERNEL_DISASSOCIATE,
*PTDI_REQUEST_KERNEL_DISASSOCIATE;
/* TdiAccept */
typedef struct _TDI_REQUEST_KERNEL_ACCEPT
{
PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
} TDI_REQUEST_KERNEL_ACCEPT, *PTDI_REQUEST_KERNEL_ACCEPT;
/* TdiReceive */
typedef struct _TDI_REQUEST_KERNEL_RECEIVE
{
ULONG ReceiveLength;
ULONG ReceiveFlags;
} TDI_REQUEST_KERNEL_RECEIVE, *PTDI_REQUEST_KERNEL_RECEIVE;
/* TdiReceiveDatagram */
typedef struct _TDI_REQUEST_KERNEL_RECEIVEDG
{
ULONG ReceiveLength;
PTDI_CONNECTION_INFORMATION ReceiveDatagramInformation;
PTDI_CONNECTION_INFORMATION ReturnDatagramInformation;
ULONG ReceiveFlags;
} TDI_REQUEST_KERNEL_RECEIVEDG, *PTDI_REQUEST_KERNEL_RECEIVEDG;
/* TdiSend */
typedef struct _TDI_REQUEST_KERNEL_SEND
{
ULONG SendLength;
ULONG SendFlags;
} TDI_REQUEST_KERNEL_SEND, *PTDI_REQUEST_KERNEL_SEND;
/* TdiSendDatagram */
typedef struct _TDI_REQUEST_KERNEL_SENDDG
{
ULONG SendLength;
PTDI_CONNECTION_INFORMATION SendDatagramInformation;
} TDI_REQUEST_KERNEL_SENDDG, *PTDI_REQUEST_KERNEL_SENDDG;
/* TdiSetEventHandler */
typedef struct _TDI_REQUEST_KERNEL_SET_EVENT
{
LONG EventType;
PVOID EventHandler;
PVOID EventContext;
} TDI_REQUEST_KERNEL_SET_EVENT, *PTDI_REQUEST_KERNEL_SET_EVENT;
/* TdiQueryInformation */
typedef struct _TDI_REQUEST_KERNEL_QUERY_INFO
{
LONG QueryType;
PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
} TDI_REQUEST_KERNEL_QUERY_INFORMATION, *PTDI_REQUEST_KERNEL_QUERY_INFORMATION;
/* TdiSetInformation */
typedef struct _TDI_REQUEST_KERNEL_SET_INFO
{
LONG SetType;
PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
} TDI_REQUEST_KERNEL_SET_INFORMATION, *PTDI_REQUEST_KERNEL_SET_INFORMATION;
/* Event types */
#define TDI_EVENT_CONNECT 0
#define TDI_EVENT_DISCONNECT 1
#define TDI_EVENT_ERROR 2
#define TDI_EVENT_RECEIVE 3
#define TDI_EVENT_RECEIVE_DATAGRAM 4
#define TDI_EVENT_RECEIVE_EXPEDITED 5
#define TDI_EVENT_SEND_POSSIBLE 6
#define TDI_EVENT_CHAINED_RECEIVE 7
#define TDI_EVENT_CHAINED_RECEIVE_DATAGRAM 8
#define TDI_EVENT_CHAINED_RECEIVE_EXPEDITED 9
typedef NTSTATUS (*PTDI_IND_CONNECT)(
IN PVOID TdiEventContext,
IN LONG RemoteAddressLength,
IN PVOID RemoteAddress,
IN LONG UserDataLength,
IN PVOID UserData,
IN LONG OptionsLength,
IN PVOID Options,
OUT CONNECTION_CONTEXT *ConnectionContext,
OUT PIRP *AcceptIrp);
NTSTATUS STDCALL TdiDefaultConnectHandler(
IN PVOID TdiEventContext,
IN LONG RemoteAddressLength,
IN PVOID RemoteAddress,
IN LONG UserDataLength,
IN PVOID UserData,
IN LONG OptionsLength,
IN PVOID Options,
OUT CONNECTION_CONTEXT *ConnectionContext,
OUT PIRP *AcceptIrp);
typedef NTSTATUS (*PTDI_IND_DISCONNECT)(
IN PVOID TdiEventContext,
IN CONNECTION_CONTEXT ConnectionContext,
IN LONG DisconnectDataLength,
IN PVOID DisconnectData,
IN LONG DisconnectInformationLength,
IN PVOID DisconnectInformation,
IN ULONG DisconnectFlags);
NTSTATUS STDCALL TdiDefaultDisconnectHandler(
IN PVOID TdiEventContext,
IN CONNECTION_CONTEXT ConnectionContext,
IN LONG DisconnectDataLength,
IN PVOID DisconnectData,
IN LONG DisconnectInformationLength,
IN PVOID DisconnectInformation,
IN ULONG DisconnectFlags);
typedef NTSTATUS (*PTDI_IND_ERROR)(
IN PVOID TdiEventContext,
IN NTSTATUS Status);
NTSTATUS STDCALL TdiDefaultErrorHandler(
IN PVOID TdiEventContext,
IN NTSTATUS Status);
typedef NTSTATUS (*PTDI_IND_RECEIVE)(
IN PVOID TdiEventContext,
IN CONNECTION_CONTEXT ConnectionContext,
IN ULONG ReceiveFlags,
IN ULONG BytesIndicated,
IN ULONG BytesAvailable,
OUT ULONG *BytesTaken,
IN PVOID Tsdu,
OUT PIRP *IoRequestPacket);
NTSTATUS STDCALL TdiDefaultReceiveHandler(
IN PVOID TdiEventContext,
IN CONNECTION_CONTEXT ConnectionContext,
IN ULONG ReceiveFlags,
IN ULONG BytesIndicated,
IN ULONG BytesAvailable,
OUT ULONG *BytesTaken,
IN PVOID Tsdu,
OUT PIRP *IoRequestPacket);
typedef NTSTATUS (*PTDI_IND_RECEIVE_DATAGRAM)(
IN PVOID TdiEventContext,
IN LONG SourceAddressLength,
IN PVOID SourceAddress,
IN LONG OptionsLength,
IN PVOID Options,
IN ULONG ReceiveDatagramFlags,
IN ULONG BytesIndicated,
IN ULONG BytesAvailable,
OUT ULONG *BytesTaken,
IN PVOID Tsdu,
OUT PIRP *IoRequestPacket);
NTSTATUS STDCALL TdiDefaultRcvDatagramHandler(
IN PVOID TdiEventContext,
IN LONG SourceAddressLength,
IN PVOID SourceAddress,
IN LONG OptionsLength,
IN PVOID Options,
IN ULONG ReceiveDatagramFlags,
IN ULONG BytesIndicated,
IN ULONG BytesAvailable,
OUT ULONG *BytesTaken,
IN PVOID Tsdu,
OUT PIRP *IoRequestPacket);
typedef NTSTATUS (*PTDI_IND_RECEIVE_EXPEDITED)(
IN PVOID TdiEventContext,
IN CONNECTION_CONTEXT ConnectionContext,
IN ULONG ReceiveFlags,
IN ULONG BytesIndicated,
IN ULONG BytesAvailable,
OUT ULONG *BytesTaken,
IN PVOID Tsdu,
OUT PIRP *IoRequestPacket);
NTSTATUS STDCALL TdiDefaultRcvExpeditedHandler(
IN PVOID TdiEventContext,
IN CONNECTION_CONTEXT ConnectionContext,
IN ULONG ReceiveFlags,
IN ULONG BytesIndicated,
IN ULONG BytesAvailable,
OUT ULONG *BytesTaken,
IN PVOID Tsdu,
OUT PIRP *IoRequestPacket);
typedef NTSTATUS (*PTDI_IND_CHAINED_RECEIVE)(
IN PVOID TdiEventContext,
IN CONNECTION_CONTEXT ConnectionContext,
IN ULONG ReceiveFlags,
IN ULONG ReceiveLength,
IN ULONG StartingOffset,
IN PMDL Tsdu,
IN PVOID TsduDescriptor);
NTSTATUS STDCALL TdiDefaultChainedReceiveHandler(
IN PVOID TdiEventContext,
IN CONNECTION_CONTEXT ConnectionContext,
IN ULONG ReceiveFlags,
IN ULONG ReceiveLength,
IN ULONG StartingOffset,
IN PMDL Tsdu,
IN PVOID TsduDescriptor);
typedef NTSTATUS (*PTDI_IND_CHAINED_RECEIVE_DATAGRAM)(
IN PVOID TdiEventContext,
IN LONG SourceAddressLength,
IN PVOID SourceAddress,
IN LONG OptionsLength,
IN PVOID Options,
IN ULONG ReceiveDatagramFlags,
IN ULONG ReceiveDatagramLength,
IN ULONG StartingOffset,
IN PMDL Tsdu,
IN PVOID TsduDescriptor);
NTSTATUS STDCALL TdiDefaultChainedRcvDatagramHandler(
IN PVOID TdiEventContext,
IN LONG SourceAddressLength,
IN PVOID SourceAddress,
IN LONG OptionsLength,
IN PVOID Options,
IN ULONG ReceiveDatagramFlags,
IN ULONG ReceiveDatagramLength,
IN ULONG StartingOffset,
IN PMDL Tsdu,
IN PVOID TsduDescriptor);
typedef NTSTATUS (*PTDI_IND_CHAINED_RECEIVE_EXPEDITED)(
IN PVOID TdiEventContext,
IN CONNECTION_CONTEXT ConnectionContext,
IN ULONG ReceiveFlags,
IN ULONG ReceiveLength,
IN ULONG StartingOffset,
IN PMDL Tsdu,
IN PVOID TsduDescriptor);
NTSTATUS STDCALL TdiDefaultChainedRcvExpeditedHandler(
IN PVOID TdiEventContext,
IN CONNECTION_CONTEXT ConnectionContext,
IN ULONG ReceiveFlags,
IN ULONG ReceiveLength,
IN ULONG StartingOffset,
IN PMDL Tsdu,
IN PVOID TsduDescriptor);
typedef NTSTATUS (*PTDI_IND_SEND_POSSIBLE)(
IN PVOID TdiEventContext,
IN PVOID ConnectionContext,
IN ULONG BytesAvailable);
NTSTATUS STDCALL TdiDefaultSendPossibleHandler(
IN PVOID TdiEventContext,
IN PVOID ConnectionContext,
IN ULONG BytesAvailable);
/* Macros and functions to build IRPs */
#define TdiBuildBaseIrp( \
Irp, DevObj, FileObj, CompRoutine, Contxt, IrpSp, Minor) \
{ \
IrpSp = IoGetNextIrpStackLocation(Irp); \
IrpSp->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \
IrpSp->MinorFunction = (Minor); \
IrpSp->DeviceObject = (DevObj); \
IrpSp->FileObject = (FileObj); \
\
if (CompRoutine) \
IoSetCompletionRoutine(Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE) \
else \
IoSetCompletionRoutine(Irp, NULL, NULL, FALSE, FALSE, FALSE); \
}
/*
* VOID TdiBuildAccept(
* IN PIRP Irp,
* IN PDEVICE_OBJECT DevObj,
* IN PFILE_OBJECT FileObj,
* IN PVOID CompRoutine,
* IN PVOID Contxt,
* IN PTDI_CONNECTION_INFORMATION RequestConnectionInfo,
* OUT PTDI_CONNECTION_INFORMATION ReturnConnectionInfo);
*/
#define TdiBuildAccept( \
Irp, DevObj, FileObj, CompRoutine, Contxt, \
RequestConnectionInfo, ReturnConnectionInfo) \
{ \
PTDI_REQUEST_KERNEL_ACCEPT _Request; \
PIO_STACK_LOCATION _IrpSp; \
\
_IrpSp = IoGetNextIrpStackLocation(Irp); \
\
TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
Contxt, _IrpSp, TDI_ACCEPT); \
\
_Request = (PTDI_REQUEST_KERNEL_ACCEPT)&_IrpSp->Parameters; \
_Request->RequestConnectionInformation = (RequestConnectionInfo); \
_Request->ReturnConnectionInformation = (ReturnConnectionInfo); \
}
/*
* VOID TdiBuildAction(
* IN PIRP Irp,
* IN PDEVICE_OBJECT DevObj,
* IN PFILE_OBJECT FileObj,
* IN PVOID CompRoutine,
* IN PVOID Contxt,
* IN PMDL MdlAddr);
*/
#define TdiBuildAction( \
Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr) \
{ \
PIO_STACK_LOCATION _IrpSp; \
\
_IrpSp = IoGetNextIrpStackLocation(Irp); \
\
TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
Contxt, _IrpSp, TDI_ACTION); \
\
(Irp)->MdlAddress = (MdlAddr); \
}
/*
* VOID TdiBuildAssociateAddress(
* IN PIRP Irp,
* IN PDEVICE_OBJECT DevObj,
* IN PFILE_OBJECT FileObj,
* IN PVOID CompRoutine,
* IN PVOID Contxt,
* IN HANDLE AddrHandle);
*/
#define TdiBuildAssociateAddress( \
Irp, DevObj, FileObj, CompRoutine, Contxt, AddrHandle) \
{ \
PTDI_REQUEST_KERNEL_ASSOCIATE _Request; \
PIO_STACK_LOCATION _IrpSp; \
\
_IrpSp = IoGetNextIrpStackLocation(Irp); \
\
TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
Contxt, _IrpSp, TDI_ASSOCIATE_ADDRESS); \
\
_Request = (PTDI_REQUEST_KERNEL_ASSOCIATE)&_IrpSp->Parameters; \
_Request->AddressHandle = (HANDLE)(AddrHandle); \
}
/*
* VOID TdiBuildConnect(
* IN PIRP Irp,
* IN PDEVICE_OBJECT DevObj,
* IN PFILE_OBJECT FileObj,
* IN PVOID CompRoutine,
* IN PVOID Contxt,
* IN PLARGE_INTEGER Time,
* IN PTDI_CONNECTION_INFORMATION RequestConnectionInfo,
* OUT PTDI_CONNECTION_INFORMATION ReturnConnectionInfo);
*/
#define TdiBuildConnect( \
Irp, DevObj, FileObj, CompRoutine, Contxt, \
Time, RequestConnectionInfo, ReturnConnectionInfo) \
{ \
PTDI_REQUEST_KERNEL _Request; \
PIO_STACK_LOCATION _IrpSp; \
\
_IrpSp = IoGetNextIrpStackLocation(Irp); \
\
TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
Contxt, _IrpSp, TDI_CONNECT); \
\
_Request = (PTDI_REQUEST_KERNEL)&_IrpSp->Parameters; \
_Request->RequestConnectionInformation = (RequestConnectionInfo); \
_Request->ReturnConnectionInformation = (ReturnConnectionInfo); \
_Request->RequestSpecific = (PVOID)(Time); \
}
/*
* VOID TdiBuildDisassociateAddress(
* IN PIRP Irp,
* IN PDEVICE_OBJECT DevObj,
* IN PFILE_OBJECT FileObj,
* IN PVOID CompRoutine,
* IN PVOID Contxt);
*/
#define TdiBuildDisassociateAddress( \
Irp, DevObj, FileObj, CompRoutine, Contxt) \
{ \
PIO_STACK_LOCATION _IrpSp; \
\
_IrpSp = IoGetNextIrpStackLocation(Irp); \
\
TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
Contxt, _IrpSp, TDI_DISASSOCIATE_ADDRESS); \
}
/*
* VOID TdiBuildDisconnect(
* IN PIRP Irp,
* IN PDEVICE_OBJECT DevObj,
* IN PFILE_OBJECT FileObj,
* IN PVOID CompRoutine,
* IN PVOID Contxt,
* IN PLARGE_INTEGER Time,
* IN PULONG Flags,
* IN PTDI_CONNECTION_INFORMATION RequestConnectionInfo,
* OUT PTDI_CONNECTION_INFORMATION ReturnConnectionInfo);
*/
#define TdiBuildDisconnect( \
Irp, DevObj, FileObj, CompRoutine, Contxt, Time, \
Flags, RequestConnectionInfo, ReturnConnectionInfo) \
{ \
PTDI_REQUEST_KERNEL _Request; \
PIO_STACK_LOCATION _IrpSp; \
\
_IrpSp = IoGetNextIrpStackLocation(Irp); \
\
TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
Contxt, _IrpSp, TDI_DISCONNECT); \
\
_Request = (PTDI_REQUEST_KERNEL)&_IrpSp->Parameters; \
_Request->RequestConnectionInformation = (RequestConnectionInfo); \
_Request->ReturnConnectionInformation = (ReturnConnectionInfo); \
_Request->RequestSpecific = (PVOID)(Time); \
_Request->RequestFlags = (Flags); \
}
/*
* PIRP TdiBuildInternalDeviceControlIrp(
* IN CCHAR IrpSubFunction,
* IN PDEVICE_OBJECT DeviceObject,
* IN PFILE_OBJECT FileObject,
* IN PKEVENT Event,
* IN PIO_STATUS_BLOCK IoStatusBlock);
*/
#define TdiBuildInternalDeviceControlIrp( \
IrpSubFunction, DeviceObject, \
FileObject, Event, IoStatusBlock) \
IoBuildDeviceIoControlRequest( \
0x00000003, DeviceObject, \
NULL, 0, NULL, 0, \
TRUE, Event, IoStatusBlock)
/*
* VOID TdiBuildListen(
* IN PIRP Irp,
* IN PDEVICE_OBJECT DevObj,
* IN PFILE_OBJECT FileObj,
* IN PVOID CompRoutine,
* IN PVOID Contxt,
* IN ULONG Flags,
* IN PTDI_CONNECTION_INFORMATION RequestConnectionInfo,
* OUT PTDI_CONNECTION_INFORMATION ReturnConnectionInfo);
*/
#define TdiBuildListen( \
Irp, DevObj, FileObj, CompRoutine, Contxt, \
Flags, RequestConnectionInfo, ReturnConnectionInfo) \
{ \
PTDI_REQUEST_KERNEL _Request; \
PIO_STACK_LOCATION _IrpSp; \
\
_IrpSp = IoGetNextIrpStackLocation(Irp); \
\
TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
Contxt, _IrpSp, TDI_LISTEN); \
\
_Request = (PTDI_REQUEST_KERNEL)&_IrpSp->Parameters; \
_Request->RequestConnectionInformation = (RequestConnectionInfo); \
_Request->ReturnConnectionInformation = (ReturnConnectionInfo); \
_Request->RequestFlags = (Flags); \
}
VOID STDCALL TdiBuildNetbiosAddress(
IN PUCHAR NetbiosName,
IN BOOLEAN IsGroupName,
IN OUT PTA_NETBIOS_ADDRESS NetworkName);
NTSTATUS STDCALL TdiBuildNetbiosAddressEa(
IN PUCHAR Buffer,
IN BOOLEAN IsGroupName,
IN PUCHAR NetbiosName);
/*
* VOID TdiBuildQueryInformation(
* IN PIRP Irp,
* IN PDEVICE_OBJECT DevObj,
* IN PFILE_OBJECT FileObj,
* IN PVOID CompRoutine,
* IN PVOID Contxt,
* IN UINT QType,
* IN PMDL MdlAddr);
*/
#define TdiBuildQueryInformation( \
Irp, DevObj, FileObj, CompRoutine, Contxt, QType, MdlAddr) \
{ \
PTDI_REQUEST_KERNEL_QUERY_INFORMATION _Request; \
PIO_STACK_LOCATION _IrpSp; \
\
_IrpSp = IoGetNextIrpStackLocation(Irp); \
\
TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
Contxt, _IrpSp, TDI_QUERY_INFORMATION); \
\
_Request = (PTDI_REQUEST_KERNEL_QUERY_INFORMATION)&_IrpSp->Parameters; \
_Request->RequestConnectionInformation = NULL; \
_Request->QueryType = (ULONG)(QType); \
(Irp)->MdlAddress = (MdlAddr); \
}
/*
* VOID TdiBuildReceive(
* IN PIRP Irp,
* IN PDEVICE_OBJECT DevObj,
* IN PFILE_OBJECT FileObj,
* IN PVOID CompRoutine,
* IN PVOID Contxt,
* IN PMDL MdlAddr,
* IN ULONG InFlags,
* IN ULONG ReceiveLen);
*/
#define TdiBuildReceive( \
Irp, DevObj, FileObj, CompRoutine, Contxt, \
MdlAddr, InFlags, ReceiveLen) \
{ \
PTDI_REQUEST_KERNEL_RECEIVE _Request; \
PIO_STACK_LOCATION _IrpSp; \
\
_IrpSp = IoGetNextIrpStackLocation(Irp); \
\
TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
Contxt, _IrpSp, TDI_RECEIVE); \
\
_Request = (PTDI_REQUEST_KERNEL_RECEIVE)&_IrpSp->Parameters; \
_Request->ReceiveFlags = (InFlags); \
_Request->ReceiveLength = (ReceiveLen); \
(Irp)->MdlAddress = (MdlAddr); \
}
/*
* VOID TdiBuildReceiveDatagram(
* IN PIRP Irp,
* IN PDEVICE_OBJECT DevObj,
* IN PFILE_OBJECT FileObj,
* IN PVOID CompRoutine,
* IN PVOID Contxt,
* IN PMDL MdlAddr,
* IN ULONG ReceiveLen,
* IN PTDI_CONNECTION_INFORMATION ReceiveDatagramInfo,
* OUT PTDI_CONNECTION_INFORMATION ReturnInfo,
* ULONG InFlags);
*/
#define TdiBuildReceiveDatagram( \
Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr, \
ReceiveLen, ReceiveDatagramInfo, ReturnInfo, InFlags) \
{ \
PTDI_REQUEST_KERNEL_RECEIVEDG _Request; \
PIO_STACK_LOCATION _IrpSp; \
\
_IrpSp = IoGetNextIrpStackLocation(Irp); \
\
TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
Contxt, _IrpSp, TDI_RECEIVE_DATAGRAM); \
\
_Request = (PTDI_REQUEST_KERNEL_RECEIVEDG)&_IrpSp->Parameters; \
_Request->ReceiveDatagramInformation = (ReceiveDatagramInfo); \
_Request->ReturnDatagramInformation = (ReturnInfo); \
_Request->ReceiveLength = (ReceiveLen); \
_Request->ReceiveFlags = (InFlags); \
(Irp)->MdlAddress = (MdlAddr); \
}
/*
* VOID TdiBuildSend(
* IN PIRP Irp,
* IN PDEVICE_OBJECT DevObj,
* IN PFILE_OBJECT FileObj,
* IN PVOID CompRoutine,
* IN PVOID Contxt,
* IN PMDL MdlAddr,
* IN ULONG InFlags,
* IN ULONG SendLen);
*/
#define TdiBuildSend( \
Irp, DevObj, FileObj, CompRoutine, Contxt, \
MdlAddr, InFlags, SendLen) \
{ \
PTDI_REQUEST_KERNEL_SEND _Request; \
PIO_STACK_LOCATION _IrpSp; \
\
_IrpSp = IoGetNextIrpStackLocation(Irp); \
\
TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
Contxt, _IrpSp, TDI_SEND); \
\
_Request = (PTDI_REQUEST_KERNEL_SEND)&_IrpSp->Parameters; \
_Request->SendFlags = (InFlags); \
_Request->SendLength = (SendLen); \
(Irp)->MdlAddress = (MdlAddr); \
}
/*
* VOID TdiBuildSendDatagram(
* IN PIRP Irp,
* IN PDEVICE_OBJECT DevObj,
* IN PFILE_OBJECT FileObj,
* IN PVOID CompRoutine,
* IN PVOID Contxt,
* IN PMDL MdlAddr,
* IN ULONG SendLen,
* IN PTDI_CONNECTION_INFORMATION SendDatagramInfo);
*/
#define TdiBuildSendDatagram( \
Irp, DevObj, FileObj, CompRoutine, Contxt, \
MdlAddr, SendLen, SendDatagramInfo) \
{ \
PTDI_REQUEST_KERNEL_SENDDG _Request; \
PIO_STACK_LOCATION _IrpSp; \
\
_IrpSp = IoGetNextIrpStackLocation(Irp); \
\
TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
Contxt, _IrpSp, TDI_SEND_DATAGRAM); \
\
_Request = (PTDI_REQUEST_KERNEL_SENDDG)&_IrpSp->Parameters; \
_Request->SendDatagramInformation = (SendDatagramInfo); \
_Request->SendLength = (SendLen); \
(Irp)->MdlAddress = (MdlAddr); \
}
/*
* VOID TdiBuildSetEventHandler(
* IN PIRP Irp,
* IN PDEVICE_OBJECT DevObj,
* IN PFILE_OBJECT FileObj,
* IN PVOID CompRoutine,
* IN PVOID Contxt,
* IN INT InEventType,
* IN PVOID InEventHandler,
* IN PVOID InEventContext);
*/
#define TdiBuildSetEventHandler( \
Irp, DevObj, FileObj, CompRoutine, Contxt, \
InEventType, InEventHandler, InEventContext) \
{ \
PTDI_REQUEST_KERNEL_SET_EVENT _Request; \
PIO_STACK_LOCATION _IrpSp; \
\
_IrpSp = IoGetNextIrpStackLocation(Irp); \
\
TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
Contxt, _IrpSp, TDI_SET_EVENT_HANDLER); \
\
_Request = (PTDI_REQUEST_KERNEL_SET_EVENT)&_IrpSp->Parameters; \
_Request->EventType = (InEventType); \
_Request->EventHandler = (PVOID)(InEventHandler); \
_Request->EventContext = (PVOID)(InEventContext); \
}
/*
* VOID TdiBuildSetInformation(
* IN PIRP Irp,
* IN PDEVICE_OBJECT DevObj,
* IN PFILE_OBJECT FileObj,
* IN PVOID CompRoutine,
* IN PVOID Contxt,
* IN UINT SType,
* IN PMDL MdlAddr);
*/
#define TdiBuildSetInformation( \
Irp, DevObj, FileObj, CompRoutine, Contxt, SType, MdlAddr) \
{ \
PTDI_REQUEST_KERNEL_SET_INFORMATION _Request; \
PIO_STACK_LOCATION _IrpSp; \
\
_IrpSp = IoGetNextIrpStackLocation(Irp); \
\
TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
Contxt, _IrpSp, TDI_SET_INFORMATION); \
\
_Request = (PTDI_REQUEST_KERNEL_SET_INFORMATION)&_IrpSp->Parameters; \
_Request->RequestConnectionInformation = NULL; \
_Request->SetType = (ULONG)(SType); \
(Irp)->MdlAddress = (MdlAddr); \
}
/* TDI functions */
/*
* VOID TdiCompleteRequest(
* IN PIRP Irp,
* IN NTSTATUS Status);
*/
#define TdiCompleteRequest(Irp, Status) \
{ \
(Irp)->IoStatus.Status = (Status); \
IoCompleteRequest((Irp), IO_NETWORK_INCREMENT); \
}
NTSTATUS STDCALL TdiCopyBufferToMdl(
IN PVOID SourceBuffer,
IN ULONG SourceOffset,
IN ULONG SourceBytesToCopy,
IN PMDL DestinationMdlChain,
IN ULONG DestinationOffset,
IN PULONG BytesCopied);
/*
* VOID TdiCopyLookaheadData(
* IN PVOID Destination,
* IN PVOID Source,
* IN ULONG Length,
* IN ULONG ReceiveFlags);
*/
#define TdiCopyLookaheadData(Destination, Source, Length, ReceiveFlags) \
RtlCopyMemory(Destination, Source, Length)
NTSTATUS STDCALL TdiCopyMdlToBuffer(
IN PMDL SourceMdlChain,
IN ULONG SourceOffset,
IN PVOID DestinationBuffer,
IN ULONG DestinationOffset,
IN ULONG DestinationBufferSize,
OUT PULONG BytesCopied);
VOID STDCALL TdiMapBuffer(
IN PMDL MdlChain);
NTSTATUS STDCALL TdiMapUserRequest(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PIO_STACK_LOCATION IrpSp);
VOID STDCALL TdiReturnChainedReceives(
IN PVOID *TsduDescriptors,
IN ULONG NumberOfTsdus);
VOID STDCALL TdiUnmapBuffer(
IN PMDL MdlChain);
#endif /* __TDIKRNL_H */
/* EOF */