2000-08-01 18:43:15 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS NDIS library
|
|
|
|
* FILE: ndis/miniport.h
|
|
|
|
* PURPOSE: Definitions for routines used by NDIS miniport drivers
|
|
|
|
*/
|
|
|
|
|
2010-02-26 11:43:19 +00:00
|
|
|
#pragma once
|
2000-08-01 18:43:15 +00:00
|
|
|
|
2005-05-20 08:06:27 +00:00
|
|
|
struct _ADAPTER_BINDING;
|
2000-08-01 18:43:15 +00:00
|
|
|
|
2000-08-27 16:31:41 +00:00
|
|
|
typedef struct _HARDWARE_ADDRESS {
|
|
|
|
union {
|
|
|
|
UCHAR Medium802_3[ETH_LENGTH_OF_ADDRESS];
|
|
|
|
} Type;
|
|
|
|
} HARDWARE_ADDRESS, *PHARDWARE_ADDRESS;
|
|
|
|
|
2000-08-01 18:43:15 +00:00
|
|
|
/* Information about a miniport */
|
2005-08-24 01:51:49 +00:00
|
|
|
typedef struct _NDIS_M_DRIVER_BLOCK {
|
|
|
|
LIST_ENTRY ListEntry; /* Entry on global list */
|
|
|
|
KSPIN_LOCK Lock; /* Protecting spin lock */
|
|
|
|
NDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics; /* Miniport characteristics */
|
|
|
|
WORK_QUEUE_ITEM WorkItem; /* Work item */
|
|
|
|
PDRIVER_OBJECT DriverObject; /* Driver object of miniport */
|
|
|
|
LIST_ENTRY DeviceList; /* Adapters created by miniport */
|
|
|
|
PUNICODE_STRING RegistryPath; /* SCM Registry key */
|
2010-08-10 13:53:10 +00:00
|
|
|
#if !defined(_MSC_VER) && defined(_NDIS_)
|
2008-11-27 15:02:47 +00:00
|
|
|
} NDIS_M_DRIVER_BLOCK_COMPATIBILITY_HACK_DONT_USE;
|
|
|
|
#else
|
2005-08-24 01:51:49 +00:00
|
|
|
} NDIS_M_DRIVER_BLOCK, *PNDIS_M_DRIVER_BLOCK;
|
2008-11-27 15:02:47 +00:00
|
|
|
#endif
|
2000-08-01 18:43:15 +00:00
|
|
|
|
2009-04-20 20:59:40 +00:00
|
|
|
/* There must be some defined struct to do this... */
|
|
|
|
typedef struct _NDIS_M_DEVICE_BLOCK {
|
|
|
|
PDEVICE_OBJECT DeviceObject;
|
|
|
|
PNDIS_STRING SymbolicName;
|
2012-08-03 08:23:02 +00:00
|
|
|
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1];
|
2009-04-20 20:59:40 +00:00
|
|
|
} NDIS_M_DEVICE_BLOCK, *PNDIS_M_DEVICE_BLOCK;
|
|
|
|
|
2003-07-30 22:11:20 +00:00
|
|
|
/* resources allocated on behalf on the miniport */
|
2009-09-12 02:26:33 +00:00
|
|
|
#define MINIPORT_RESOURCE_TYPE_REGISTRY_DATA 0
|
|
|
|
#define MINIPORT_RESOURCE_TYPE_MEMORY 1
|
2003-07-30 22:11:20 +00:00
|
|
|
typedef struct _MINIPORT_RESOURCE {
|
|
|
|
LIST_ENTRY ListEntry;
|
|
|
|
ULONG ResourceType;
|
|
|
|
PVOID Resource;
|
|
|
|
} MINIPORT_RESOURCE, *PMINIPORT_RESOURCE;
|
|
|
|
|
|
|
|
/* Configuration context */
|
|
|
|
typedef struct _MINIPORT_CONFIGURATION_CONTEXT {
|
|
|
|
NDIS_HANDLE Handle;
|
|
|
|
LIST_ENTRY ResourceListHead;
|
|
|
|
KSPIN_LOCK ResourceLock;
|
|
|
|
} MINIPORT_CONFIGURATION_CONTEXT, *PMINIPORT_CONFIGURATION_CONTEXT;
|
|
|
|
|
2003-08-07 05:28:33 +00:00
|
|
|
/* Bugcheck callback context */
|
|
|
|
typedef struct _MINIPORT_BUGCHECK_CONTEXT {
|
|
|
|
PVOID DriverContext;
|
2003-09-04 06:53:31 +00:00
|
|
|
ADAPTER_SHUTDOWN_HANDLER ShutdownHandler;
|
2003-08-07 05:28:33 +00:00
|
|
|
PKBUGCHECK_CALLBACK_RECORD CallbackRecord;
|
|
|
|
} MINIPORT_BUGCHECK_CONTEXT, *PMINIPORT_BUGCHECK_CONTEXT;
|
|
|
|
|
2003-09-04 06:53:31 +00:00
|
|
|
/* a miniport's shared memory */
|
|
|
|
typedef struct _MINIPORT_SHARED_MEMORY {
|
2009-03-28 17:49:27 +00:00
|
|
|
PDMA_ADAPTER AdapterObject;
|
|
|
|
ULONG Length;
|
|
|
|
PHYSICAL_ADDRESS PhysicalAddress;
|
|
|
|
PVOID VirtualAddress;
|
|
|
|
BOOLEAN Cached;
|
|
|
|
PNDIS_MINIPORT_BLOCK Adapter;
|
|
|
|
PVOID Context;
|
2011-12-01 22:31:54 +00:00
|
|
|
PIO_WORKITEM WorkItem;
|
2003-09-04 06:53:31 +00:00
|
|
|
} MINIPORT_SHARED_MEMORY, *PMINIPORT_SHARED_MEMORY;
|
|
|
|
|
2004-11-23 18:58:47 +00:00
|
|
|
/* A structure of WrapperConfigurationContext (not compatible with the
|
|
|
|
Windows one). */
|
|
|
|
typedef struct _NDIS_WRAPPER_CONTEXT {
|
|
|
|
HANDLE RegistryHandle;
|
|
|
|
PDEVICE_OBJECT DeviceObject;
|
2003-09-04 06:53:31 +00:00
|
|
|
ULONG BusNumber;
|
2009-05-21 00:54:10 +00:00
|
|
|
ULONG SlotNumber;
|
2004-11-23 18:58:47 +00:00
|
|
|
} NDIS_WRAPPER_CONTEXT, *PNDIS_WRAPPER_CONTEXT;
|
|
|
|
|
2005-08-24 01:51:49 +00:00
|
|
|
#define GET_MINIPORT_DRIVER(Handle)((PNDIS_M_DRIVER_BLOCK)Handle)
|
2003-09-04 06:53:31 +00:00
|
|
|
|
2000-08-01 18:43:15 +00:00
|
|
|
/* Information about a logical adapter */
|
2005-05-08 02:16:32 +00:00
|
|
|
typedef struct _LOGICAL_ADAPTER
|
2003-10-12 16:39:52 +00:00
|
|
|
{
|
|
|
|
NDIS_MINIPORT_BLOCK NdisMiniportBlock; /* NDIS defined fields */
|
2005-08-24 01:51:49 +00:00
|
|
|
PNDIS_MINIPORT_WORK_ITEM WorkQueueHead; /* Head of work queue */
|
|
|
|
PNDIS_MINIPORT_WORK_ITEM WorkQueueTail; /* Tail of work queue */
|
2000-08-01 18:43:15 +00:00
|
|
|
LIST_ENTRY ListEntry; /* Entry on global list */
|
|
|
|
LIST_ENTRY MiniportListEntry; /* Entry on miniport driver list */
|
2000-08-27 16:31:41 +00:00
|
|
|
LIST_ENTRY ProtocolListHead; /* List of bound protocols */
|
|
|
|
ULONG MediumHeaderSize; /* Size of medium header */
|
|
|
|
HARDWARE_ADDRESS Address; /* Hardware address of adapter */
|
|
|
|
ULONG AddressLength; /* Length of hardware address */
|
2003-09-04 06:53:31 +00:00
|
|
|
PMINIPORT_BUGCHECK_CONTEXT BugcheckContext; /* Adapter's shutdown handler */
|
2000-08-01 18:43:15 +00:00
|
|
|
} LOGICAL_ADAPTER, *PLOGICAL_ADAPTER;
|
|
|
|
|
|
|
|
#define GET_LOGICAL_ADAPTER(Handle)((PLOGICAL_ADAPTER)Handle)
|
|
|
|
|
|
|
|
extern LIST_ENTRY MiniportListHead;
|
|
|
|
extern KSPIN_LOCK MiniportListLock;
|
|
|
|
extern LIST_ENTRY AdapterListHead;
|
|
|
|
extern KSPIN_LOCK AdapterListLock;
|
|
|
|
|
2000-08-27 16:31:41 +00:00
|
|
|
|
2009-06-17 12:44:05 +00:00
|
|
|
#if DBG
|
2000-08-27 16:31:41 +00:00
|
|
|
VOID
|
|
|
|
MiniDisplayPacket(
|
2018-07-02 20:29:05 +00:00
|
|
|
PNDIS_PACKET Packet,
|
|
|
|
PCSTR Reason);
|
2000-08-27 16:31:41 +00:00
|
|
|
#endif /* DBG */
|
|
|
|
|
|
|
|
VOID
|
|
|
|
MiniIndicateData(
|
|
|
|
PLOGICAL_ADAPTER Adapter,
|
|
|
|
NDIS_HANDLE MacReceiveContext,
|
|
|
|
PVOID HeaderBuffer,
|
|
|
|
UINT HeaderBufferSize,
|
|
|
|
PVOID LookaheadBuffer,
|
|
|
|
UINT LookaheadBufferSize,
|
|
|
|
UINT PacketSize);
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
MiniAdapterHasAddress(
|
|
|
|
PLOGICAL_ADAPTER Adapter,
|
|
|
|
PNDIS_PACKET Packet);
|
|
|
|
|
|
|
|
PLOGICAL_ADAPTER
|
|
|
|
MiniLocateDevice(
|
2000-08-01 18:43:15 +00:00
|
|
|
PNDIS_STRING AdapterName);
|
|
|
|
|
2000-08-27 16:31:41 +00:00
|
|
|
NDIS_STATUS
|
|
|
|
MiniQueryInformation(
|
2000-08-01 18:43:15 +00:00
|
|
|
PLOGICAL_ADAPTER Adapter,
|
|
|
|
NDIS_OID Oid,
|
|
|
|
ULONG Size,
|
2005-08-24 02:20:41 +00:00
|
|
|
PVOID Buffer,
|
2000-08-01 18:43:15 +00:00
|
|
|
PULONG BytesWritten);
|
|
|
|
|
2008-11-22 17:02:56 +00:00
|
|
|
VOID
|
2000-08-27 16:31:41 +00:00
|
|
|
FASTCALL
|
|
|
|
MiniQueueWorkItem(
|
2005-08-24 01:51:49 +00:00
|
|
|
PLOGICAL_ADAPTER Adapter,
|
2000-08-27 16:31:41 +00:00
|
|
|
NDIS_WORK_ITEM_TYPE WorkItemType,
|
2008-11-22 17:02:56 +00:00
|
|
|
PVOID WorkItemContext,
|
|
|
|
BOOLEAN Top);
|
2000-08-27 16:31:41 +00:00
|
|
|
|
|
|
|
NDIS_STATUS
|
|
|
|
FASTCALL
|
|
|
|
MiniDequeueWorkItem(
|
|
|
|
PLOGICAL_ADAPTER Adapter,
|
|
|
|
NDIS_WORK_ITEM_TYPE *WorkItemType,
|
2004-11-23 18:58:47 +00:00
|
|
|
PVOID *WorkItemContext);
|
2000-08-27 16:31:41 +00:00
|
|
|
|
|
|
|
NDIS_STATUS
|
|
|
|
MiniDoRequest(
|
2008-09-27 21:25:27 +00:00
|
|
|
PLOGICAL_ADAPTER Adapter,
|
2000-08-27 16:31:41 +00:00
|
|
|
PNDIS_REQUEST NdisRequest);
|
|
|
|
|
2005-05-08 02:16:32 +00:00
|
|
|
BOOLEAN
|
2003-09-04 06:53:31 +00:00
|
|
|
NdisFindDevice(
|
2005-05-08 02:16:32 +00:00
|
|
|
UINT VendorID,
|
|
|
|
UINT DeviceID,
|
|
|
|
PUINT BusNumber,
|
2003-09-04 06:53:31 +00:00
|
|
|
PUINT SlotNumber);
|
|
|
|
|
|
|
|
VOID
|
2011-03-15 18:41:17 +00:00
|
|
|
NdisStartDevices(VOID);
|
2003-09-04 06:53:31 +00:00
|
|
|
|
2008-10-13 01:18:04 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2008-11-22 17:02:56 +00:00
|
|
|
MiniportWorker(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN PVOID WorkItem);
|
2008-10-13 01:18:04 +00:00
|
|
|
|
2008-10-20 21:57:06 +00:00
|
|
|
VOID NTAPI
|
|
|
|
MiniSendComplete(
|
|
|
|
IN NDIS_HANDLE MiniportAdapterHandle,
|
|
|
|
IN PNDIS_PACKET Packet,
|
|
|
|
IN NDIS_STATUS Status);
|
|
|
|
|
2008-11-29 01:51:19 +00:00
|
|
|
BOOLEAN
|
|
|
|
MiniIsBusy(
|
|
|
|
PLOGICAL_ADAPTER Adapter,
|
|
|
|
NDIS_WORK_ITEM_TYPE Type);
|
|
|
|
|
2009-06-30 18:44:26 +00:00
|
|
|
NDIS_STATUS
|
|
|
|
MiniReset(
|
|
|
|
PLOGICAL_ADAPTER Adapter);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
MiniDoAddressingReset(
|
|
|
|
PLOGICAL_ADAPTER Adapter);
|
|
|
|
|
2013-04-29 10:01:39 +00:00
|
|
|
VOID
|
|
|
|
MiniWorkItemComplete(
|
|
|
|
PLOGICAL_ADAPTER Adapter,
|
|
|
|
NDIS_WORK_ITEM_TYPE WorkItemType);
|
|
|
|
|
2000-08-01 18:43:15 +00:00
|
|
|
/* EOF */
|