adapt.h
上传用户:zhuzhu0204
上传日期:2020-07-13
资源大小:13165k
文件大小:4k
- //adapt.h
- /*--------------------------------------------------------------------------------
- ADAPT结构体
- (1) Structure used by both the miniport as well as the protocol part of the
- intermediate driver to represent an adapter and its corres. lower bindings
- (2) 一个ADAPT结构体代表一个绑定的适配器
- (3) 可以与OPEN_CONTEXT结构相互访问
- --------------------------------------------------------------------------------*/
- typedef struct _ADAPT
- {
- struct _ADAPT * Next;
-
- NDIS_HANDLE BindingHandle; // To the lower miniport
- NDIS_HANDLE MiniportHandle; // NDIS Handle to for miniport up-calls
- NDIS_HANDLE SendPacketPoolHandle;
- NDIS_HANDLE RecvPacketPoolHandle;
- NDIS_STATUS Status; // Open Status
- NDIS_EVENT Event; // Used by bind/halt for Open/Close Adapter synch.
- NDIS_MEDIUM Medium;
- NDIS_REQUEST Request; // This is used to wrap a request coming down
- // to us. This exploits the fact that requests
- // are serialized down to us.
- PULONG BytesNeeded;
- PULONG BytesReadOrWritten;
- BOOLEAN IndicateRcvComplete;
-
- BOOLEAN OutstandingRequests; // TRUE iff a request is pending
- // at the miniport below
- BOOLEAN QueuedRequest; // TRUE iff a request is queued at
- // this IM miniport
- BOOLEAN StandingBy; // True - When the miniport or protocol is transitioning from a D0 to Standby (>D0) State
- BOOLEAN UnbindingInProcess;
- NDIS_SPIN_LOCK Lock;
- // False - At all other times, - Flag is cleared after a transition to D0
- NDIS_DEVICE_POWER_STATE MPDeviceState; // Miniport's Device State
- NDIS_DEVICE_POWER_STATE PTDeviceState; // Protocol's Device State
- NDIS_STRING DeviceName; // For initializing the miniport edge
- // BEGIN_PTUSERIO
- NDIS_STRING LowerDeviceName; // 设备对象的名称,这是传递给NdisOpenAdapter的参数
- ULONG RefCount; // 此结构的引用计数
- POPEN_CONTEXT pOpenContext;
- // END_PTUSERIO
- NDIS_EVENT MiniportInitEvent; // For blocking UnbindAdapter while
- // an IM Init is in progress.
- BOOLEAN MiniportInitPending; // TRUE iff IMInit in progress
- NDIS_STATUS LastIndicatedStatus; // The last indicated media status
- NDIS_STATUS LatestUnIndicateStatus; // The latest suppressed media status
- ULONG OutstandingSends;
- // BEGIN_PTEX_FILTER
- ULONG FilterReserved[16]; // 为过滤数据预留的空间 每个打开句柄的过滤相关数据
- // END_PTEX_FILTER
- } ADAPT, *PADAPT;
- //ADAPT结构体对应的函数
- //绑定一个下层的微端口(该函数在protocol.c中已实现)
- //VOID PtBindAdapt(……);
- //增加对适配器(PADAPT结构)的引用
- VOID PtRefAdapter(PADAPT pAdapt);
- //减少对适配器(PADAPT结构)的引用;若减为0,则释放内存
- VOID PtDerefAdapter(PADAPT pAdapt);