ReactOS  0.4.15-dev-506-ga3ec01c
miniport.h
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS NDIS library
4  * FILE: ndis/miniport.h
5  * PURPOSE: Definitions for routines used by NDIS miniport drivers
6  */
7 
8 #pragma once
9 
10 struct _ADAPTER_BINDING;
11 
12 typedef struct _HARDWARE_ADDRESS {
13  union {
15  } Type;
17 
18 /* Information about a miniport */
19 typedef struct _NDIS_M_DRIVER_BLOCK {
20  LIST_ENTRY ListEntry; /* Entry on global list */
21  KSPIN_LOCK Lock; /* Protecting spin lock */
23  WORK_QUEUE_ITEM WorkItem; /* Work item */
24  PDRIVER_OBJECT DriverObject; /* Driver object of miniport */
25  LIST_ENTRY DeviceList; /* Adapters created by miniport */
26  PUNICODE_STRING RegistryPath; /* SCM Registry key */
27 #if !defined(_MSC_VER) && defined(_NDIS_)
28 } NDIS_M_DRIVER_BLOCK_COMPATIBILITY_HACK_DONT_USE;
29 #else
31 #endif
32 
33 /* There must be some defined struct to do this... */
34 typedef struct _NDIS_M_DEVICE_BLOCK {
39 
40 /* resources allocated on behalf on the miniport */
41 #define MINIPORT_RESOURCE_TYPE_REGISTRY_DATA 0
42 #define MINIPORT_RESOURCE_TYPE_MEMORY 1
43 typedef struct _MINIPORT_RESOURCE {
48 
49 /* Configuration context */
55 
56 /* Bugcheck callback context */
62 
63 /* a miniport's shared memory */
64 typedef struct _MINIPORT_SHARED_MEMORY {
74 
75 /* A structure of WrapperConfigurationContext (not compatible with the
76  Windows one). */
77 typedef struct _NDIS_WRAPPER_CONTEXT {
83 
84 #define GET_MINIPORT_DRIVER(Handle)((PNDIS_M_DRIVER_BLOCK)Handle)
85 
86 /* Information about a logical adapter */
87 typedef struct _LOGICAL_ADAPTER
88 {
89  NDIS_MINIPORT_BLOCK NdisMiniportBlock; /* NDIS defined fields */
90  PNDIS_MINIPORT_WORK_ITEM WorkQueueHead; /* Head of work queue */
91  PNDIS_MINIPORT_WORK_ITEM WorkQueueTail; /* Tail of work queue */
92  LIST_ENTRY ListEntry; /* Entry on global list */
93  LIST_ENTRY MiniportListEntry; /* Entry on miniport driver list */
94  LIST_ENTRY ProtocolListHead; /* List of bound protocols */
95  ULONG MediumHeaderSize; /* Size of medium header */
96  HARDWARE_ADDRESS Address; /* Hardware address of adapter */
97  ULONG AddressLength; /* Length of hardware address */
98  PMINIPORT_BUGCHECK_CONTEXT BugcheckContext; /* Adapter's shutdown handler */
100 
101 #define GET_LOGICAL_ADAPTER(Handle)((PLOGICAL_ADAPTER)Handle)
102 
107 
108 
109 #if DBG
110 VOID
111 MiniDisplayPacket(
113  PCSTR Reason);
114 #endif /* DBG */
115 
116 VOID
118  PLOGICAL_ADAPTER Adapter,
119  NDIS_HANDLE MacReceiveContext,
120  PVOID HeaderBuffer,
121  UINT HeaderBufferSize,
122  PVOID LookaheadBuffer,
123  UINT LookaheadBufferSize,
124  UINT PacketSize);
125 
126 BOOLEAN
128  PLOGICAL_ADAPTER Adapter,
130 
134 
137  PLOGICAL_ADAPTER Adapter,
138  NDIS_OID Oid,
139  ULONG Size,
140  PVOID Buffer,
142 
143 VOID
144 FASTCALL
146  PLOGICAL_ADAPTER Adapter,
147  NDIS_WORK_ITEM_TYPE WorkItemType,
148  PVOID WorkItemContext,
149  BOOLEAN Top);
150 
152 FASTCALL
154  PLOGICAL_ADAPTER Adapter,
155  NDIS_WORK_ITEM_TYPE *WorkItemType,
156  PVOID *WorkItemContext);
157 
160  PLOGICAL_ADAPTER Adapter,
162 
163 BOOLEAN
165  UINT VendorID,
166  UINT DeviceID,
168  PUINT SlotNumber);
169 
170 VOID
172 
173 VOID
174 NTAPI
177  IN PVOID WorkItem);
178 
179 VOID NTAPI
184 
185 BOOLEAN
186 MiniIsBusy(
187  PLOGICAL_ADAPTER Adapter,
189 
191 MiniReset(
192  PLOGICAL_ADAPTER Adapter);
193 
194 VOID
196  PLOGICAL_ADAPTER Adapter);
197 
198 VOID
200  PLOGICAL_ADAPTER Adapter,
201  NDIS_WORK_ITEM_TYPE WorkItemType);
202 
203 /* EOF */
LIST_ENTRY DeviceList
Definition: miniport.h:25
PKBUGCHECK_CALLBACK_RECORD CallbackRecord
Definition: miniport.h:60
LIST_ENTRY MiniportListEntry
Definition: miniport.h:93
PHYSICAL_ADDRESS PhysicalAddress
Definition: miniport.h:67
struct _MINIPORT_RESOURCE * PMINIPORT_RESOURCE
#define IN
Definition: typedefs.h:39
ADAPTER_SHUTDOWN_HANDLER ShutdownHandler
Definition: miniport.h:59
_In_opt_ NDIS_HANDLE _In_opt_ NDIS_HANDLE _Inout_ PNDIS_REQUEST NdisRequest
Definition: ndis.h:1571
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesWritten
Definition: fltkernel.h:1293
NDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics
Definition: miniport.h:22
PMINIPORT_BUGCHECK_CONTEXT BugcheckContext
Definition: miniport.h:98
PNDIS_MINIPORT_BLOCK Adapter
Definition: miniport.h:70
Type
Definition: Type.h:6
VOID NTAPI MiniportWorker(IN PDEVICE_OBJECT DeviceObject, IN PVOID WorkItem)
Definition: miniport.c:1223
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1548
LIST_ENTRY MiniportListHead
Definition: miniport.c:53
VOID MiniIndicateData(PLOGICAL_ADAPTER Adapter, NDIS_HANDLE MacReceiveContext, PVOID HeaderBuffer, UINT HeaderBufferSize, PVOID LookaheadBuffer, UINT LookaheadBufferSize, UINT PacketSize)
Definition: miniport.c:175
VOID MiniWorkItemComplete(PLOGICAL_ADAPTER Adapter, NDIS_WORK_ITEM_TYPE WorkItemType)
Definition: miniport.c:964
struct _MINIPORT_BUGCHECK_CONTEXT * PMINIPORT_BUGCHECK_CONTEXT
PNDIS_MINIPORT_WORK_ITEM WorkQueueHead
Definition: miniport.h:90
#define IRP_MJ_MAXIMUM_FUNCTION
_In_ USHORT DeviceID
Definition: iotypes.h:862
ULONG NDIS_OID
Definition: ntddndis.h:230
_In_ NDIS_HANDLE MiniportAdapterHandle
Definition: ndis.h:4668
VOID NTAPI MiniSendComplete(IN NDIS_HANDLE MiniportAdapterHandle, IN PNDIS_PACKET Packet, IN NDIS_STATUS Status)
Definition: miniport.c:530
NDIS_STATUS FASTCALL MiniDequeueWorkItem(PLOGICAL_ADAPTER Adapter, NDIS_WORK_ITEM_TYPE *WorkItemType, PVOID *WorkItemContext)
Definition: miniport.c:1050
VOID FASTCALL MiniQueueWorkItem(PLOGICAL_ADAPTER Adapter, NDIS_WORK_ITEM_TYPE WorkItemType, PVOID WorkItemContext, BOOLEAN Top)
Definition: miniport.c:982
VOID MiniDoAddressingReset(PLOGICAL_ADAPTER Adapter)
Definition: miniport.c:888
#define FASTCALL
Definition: nt_native.h:50
struct _MINIPORT_SHARED_MEMORY MINIPORT_SHARED_MEMORY
int NDIS_STATUS
Definition: ntddndis.h:471
enum _NDIS_WORK_ITEM_TYPE NDIS_WORK_ITEM_TYPE
HARDWARE_ADDRESS Address
Definition: miniport.h:96
union _HARDWARE_ADDRESS::@1003 Type
struct _MINIPORT_SHARED_MEMORY * PMINIPORT_SHARED_MEMORY
struct _NDIS_WRAPPER_CONTEXT NDIS_WRAPPER_CONTEXT
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
struct _NDIS_M_DRIVER_BLOCK * PNDIS_M_DRIVER_BLOCK
NDIS_STATUS MiniQueryInformation(PLOGICAL_ADAPTER Adapter, NDIS_OID Oid, ULONG Size, PVOID Buffer, PULONG BytesWritten)
Definition: miniport.c:805
PDEVICE_OBJECT DeviceObject
Definition: miniport.h:79
unsigned char BOOLEAN
Definition: bufpool.h:45
LIST_ENTRY AdapterListHead
Definition: miniport.c:57
BOOLEAN MiniAdapterHasAddress(PLOGICAL_ADAPTER Adapter, PNDIS_PACKET Packet)
Definition: miniport.c:616
ULONG AddressLength
Definition: miniport.h:97
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
VOID(NTAPI * ADAPTER_SHUTDOWN_HANDLER)(_In_ PVOID ShutdownContext)
Definition: ndis.h:2025
NDIS_MINIPORT_BLOCK NdisMiniportBlock
Definition: miniport.h:89
NDIS_STATUS MiniDoRequest(PLOGICAL_ADAPTER Adapter, PNDIS_REQUEST NdisRequest)
Definition: miniport.c:1107
LIST_ENTRY ListEntry
Definition: miniport.h:92
KSPIN_LOCK Lock
Definition: miniport.h:21
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG _In_ ULONG SlotNumber
Definition: halfuncs.h:156
LIST_ENTRY ProtocolListHead
Definition: miniport.h:94
unsigned char UCHAR
Definition: xmlstorage.h:181
NDIS_STATUS MiniReset(PLOGICAL_ADAPTER Adapter)
Definition: miniport.c:902
struct _HARDWARE_ADDRESS * PHARDWARE_ADDRESS
PIO_WORKITEM WorkItem
Definition: miniport.h:72
struct _LOGICAL_ADAPTER * PLOGICAL_ADAPTER
BOOLEAN MiniIsBusy(PLOGICAL_ADAPTER Adapter, NDIS_WORK_ITEM_TYPE Type)
Definition: miniport.c:142
LIST_ENTRY ListEntry
Definition: miniport.h:44
Definition: typedefs.h:118
PDMA_ADAPTER AdapterObject
Definition: miniport.h:65
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: miniport.h:37
struct _MINIPORT_CONFIGURATION_CONTEXT * PMINIPORT_CONFIGURATION_CONTEXT
struct _NDIS_M_DRIVER_BLOCK NDIS_M_DRIVER_BLOCK
struct _MINIPORT_RESOURCE MINIPORT_RESOURCE
Status
Definition: gdiplustypes.h:24
ULONG ResourceType
Definition: miniport.h:45
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1569
struct _HARDWARE_ADDRESS HARDWARE_ADDRESS
DRIVER_DISPATCH * PDRIVER_DISPATCH
Definition: iotypes.h:2156
KSPIN_LOCK AdapterListLock
Definition: miniport.c:58
_In_ USHORT PacketSize
Definition: iofuncs.h:1056
PNDIS_MINIPORT_WORK_ITEM WorkQueueTail
Definition: miniport.h:91
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
PUNICODE_STRING RegistryPath
Definition: miniport.h:26
LIST_ENTRY ListEntry
Definition: miniport.h:20
KSPIN_LOCK MiniportListLock
Definition: miniport.c:54
unsigned int * PULONG
Definition: retypes.h:1
#define ETH_LENGTH_OF_ADDRESS
Definition: efilter.h:16
unsigned int UINT
Definition: ndis.h:50
struct _NDIS_WRAPPER_CONTEXT * PNDIS_WRAPPER_CONTEXT
WORK_QUEUE_ITEM WorkItem
Definition: miniport.h:23
struct _LOGICAL_ADAPTER LOGICAL_ADAPTER
PDEVICE_OBJECT DeviceObject
Definition: miniport.h:35
PLOGICAL_ADAPTER MiniLocateDevice(PNDIS_STRING AdapterName)
Definition: miniport.c:690
struct _MINIPORT_BUGCHECK_CONTEXT MINIPORT_BUGCHECK_CONTEXT
unsigned int ULONG
Definition: retypes.h:1
PDRIVER_OBJECT DriverObject
Definition: miniport.h:24
BOOLEAN NdisFindDevice(UINT VendorID, UINT DeviceID, PUINT BusNumber, PUINT SlotNumber)
struct _NDIS_M_DEVICE_BLOCK * PNDIS_M_DEVICE_BLOCK
const char * PCSTR
Definition: typedefs.h:52
struct _MINIPORT_CONFIGURATION_CONTEXT MINIPORT_CONFIGURATION_CONTEXT
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _Out_ PUINT _In_ UINT _In_ NDIS_HANDLE _In_ NDIS_HANDLE _In_ PNDIS_STRING AdapterName
Definition: ndis.h:6013
ULONG MediumHeaderSize
Definition: miniport.h:95
PVOID PVOID PWCHAR PVOID USHORT PULONG Reason
Definition: env.c:45
struct _NDIS_M_DEVICE_BLOCK NDIS_M_DEVICE_BLOCK
static LPHIST_ENTRY Top
Definition: history.c:53
UCHAR Medium802_3[ETH_LENGTH_OF_ADDRESS]
Definition: miniport.h:14
unsigned int * PUINT
Definition: ndis.h:50
VOID NdisStartDevices(VOID)
PNDIS_STRING SymbolicName
Definition: miniport.h:36