adapt.h
上传用户:zhuzhu0204
上传日期:2020-07-13
资源大小:13165k
文件大小:4k
开发平台:

Visual C++

  1. //adapt.h
  2. /*--------------------------------------------------------------------------------
  3. ADAPT结构体
  4. (1) Structure used by both the miniport as well as the protocol part of the 
  5. intermediate driver to represent an adapter and its corres. lower bindings
  6. (2) 一个ADAPT结构体代表一个绑定的适配器
  7. (3) 可以与OPEN_CONTEXT结构相互访问
  8. --------------------------------------------------------------------------------*/
  9. typedef struct _ADAPT
  10. {
  11.     struct _ADAPT *                Next;
  12.     
  13.     NDIS_HANDLE                    BindingHandle;    // To the lower miniport
  14.     NDIS_HANDLE                    MiniportHandle;    // NDIS Handle to for miniport up-calls
  15.     NDIS_HANDLE                    SendPacketPoolHandle;
  16.     NDIS_HANDLE                    RecvPacketPoolHandle;
  17.     NDIS_STATUS                    Status;            // Open Status
  18.     NDIS_EVENT                     Event;            // Used by bind/halt for Open/Close Adapter synch.
  19.     NDIS_MEDIUM                    Medium;
  20.     NDIS_REQUEST                   Request;        // This is used to wrap a request coming down
  21.                                                 // to us. This exploits the fact that requests
  22.                                                 // are serialized down to us.
  23.     PULONG                         BytesNeeded;
  24.     PULONG                         BytesReadOrWritten;
  25.     BOOLEAN                        IndicateRcvComplete;
  26.     
  27.     BOOLEAN                        OutstandingRequests;      // TRUE iff a request is pending
  28.                                                         // at the miniport below
  29.     BOOLEAN                        QueuedRequest;            // TRUE iff a request is queued at
  30.                                                         // this IM miniport
  31.     BOOLEAN                        StandingBy;                // True - When the miniport or protocol is transitioning from a D0 to Standby (>D0) State
  32.     BOOLEAN                        UnbindingInProcess;
  33.     NDIS_SPIN_LOCK                 Lock;
  34.                                                         // False - At all other times, - Flag is cleared after a transition to D0
  35.     NDIS_DEVICE_POWER_STATE        MPDeviceState;            // Miniport's Device State 
  36.     NDIS_DEVICE_POWER_STATE        PTDeviceState;            // Protocol's Device State 
  37.     NDIS_STRING                    DeviceName;                // For initializing the miniport edge
  38. // BEGIN_PTUSERIO
  39.     NDIS_STRING                    LowerDeviceName;     // 设备对象的名称,这是传递给NdisOpenAdapter的参数    
  40.     ULONG                          RefCount; // 此结构的引用计数
  41.     POPEN_CONTEXT                  pOpenContext;
  42. // END_PTUSERIO
  43.     NDIS_EVENT                     MiniportInitEvent;        // For blocking UnbindAdapter while
  44.                                                         // an IM Init is in progress.
  45.     BOOLEAN                        MiniportInitPending;    // TRUE iff IMInit in progress
  46.     NDIS_STATUS                    LastIndicatedStatus;    // The last indicated media status
  47.     NDIS_STATUS                    LatestUnIndicateStatus; // The latest suppressed media status
  48.     ULONG                          OutstandingSends;
  49. // BEGIN_PTEX_FILTER
  50.     ULONG                          FilterReserved[16]; // 为过滤数据预留的空间  每个打开句柄的过滤相关数据
  51. // END_PTEX_FILTER
  52. } ADAPT, *PADAPT;
  53. //ADAPT结构体对应的函数
  54. //绑定一个下层的微端口(该函数在protocol.c中已实现)
  55. //VOID PtBindAdapt(……);
  56. //增加对适配器(PADAPT结构)的引用
  57. VOID PtRefAdapter(PADAPT pAdapt);
  58. //减少对适配器(PADAPT结构)的引用;若减为0,则释放内存
  59. VOID PtDerefAdapter(PADAPT pAdapt);