Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
5.3 KiB

  1. /*++
  2. Copyright (c) 1990-1995 Microsoft Corporation
  3. Module Name:
  4. Adapter.h
  5. Abstract:
  6. This file contains major data structures used by the NdisWan driver
  7. Author:
  8. Tony Bell (TonyBe) June 06, 1995
  9. Environment:
  10. Kernel Mode
  11. Revision History:
  12. TonyBe 06/06/95 Created
  13. --*/
  14. #ifndef _NDISWAN_ADAPTER_
  15. #define _NDISWAN_ADAPTER_
  16. //
  17. // This is the control block for the NdisWan adapter that is created by the NDIS Wrapper
  18. // making a call to NdisWanInitialize.
  19. //
  20. typedef struct _MINIPORTCB {
  21. LIST_ENTRY Linkage; // Used to link adapter into global list
  22. ULONG RefCount; // Adapter reference count
  23. NDIS_HANDLE MiniportHandle; // Assigned in MiniportInitialize
  24. LIST_ENTRY AfSapCBList;
  25. ULONG AfRefCount;
  26. LIST_ENTRY ProtocolCBList;
  27. ULONG Flags; // Flags
  28. #define RESET_IN_PROGRESS 0x00000001
  29. #define ASK_FOR_RESET 0x00000002
  30. #define RECEIVE_COMPLETE 0x00000004
  31. #define HALT_IN_PROGRESS 0x00000008
  32. #define PROTOCOL_KEEPS_STATS 0x00000010
  33. NDIS_MEDIUM MediumType; // Medium type that we are emulating
  34. NDIS_HARDWARE_STATUS HardwareStatus; // Hardware status (????)
  35. NDIS_STRING AdapterName; // Adapter Name (????)
  36. UCHAR NetworkAddress[ETH_LENGTH_OF_ADDRESS]; // Ethernet address for this adapter
  37. UCHAR Reserved1[2];
  38. ULONG NumberofProtocols;
  39. USHORT ProtocolType;
  40. USHORT Reserved2;
  41. struct _PROTOCOLCB *NbfProtocolCB;
  42. WAN_EVENT HaltEvent; // Async notification event
  43. NDIS_SPIN_LOCK Lock; // Structure access lock
  44. #if DBG
  45. LIST_ENTRY SendPacketList;
  46. LIST_ENTRY RecvPacketList;
  47. #endif
  48. } MINIPORTCB, *PMINIPORTCB;
  49. //
  50. // This is the open block for each WAN Miniport adapter that NdisWan binds to through
  51. // the NDIS Wrapper as a "protocol".
  52. //
  53. typedef struct _OPENCB {
  54. LIST_ENTRY Linkage; // Used to link adapter into global list
  55. ULONG RefCount;
  56. ULONG Flags;
  57. #define OPEN_LEGACY 0x00000001
  58. #define OPEN_CLOSING 0x00000002
  59. #define CLOSE_SCHEDULED 0x00000004
  60. #define SEND_RESOURCES 0x00000008
  61. #define OPEN_IN_BIND 0x00000010
  62. UINT ActiveLinkCount;
  63. NDIS_HANDLE BindingHandle; // Binding handle
  64. NDIS_STRING MiniportName; // WAN Miniport name
  65. GUID Guid; // Parsed GUID of this miniport
  66. NDIS_HANDLE UnbindContext;
  67. NDIS_MEDIUM MediumType; // WAN Miniport medium type
  68. NDIS_WAN_MEDIUM_SUBTYPE MediumSubType; // WAN Miniport medium subtype
  69. NDIS_WAN_HEADER_FORMAT WanHeaderFormat; // WAN Miniport header type
  70. NDIS_WORK_ITEM WorkItem;
  71. WAN_EVENT NotificationEvent; // Async notification event for adapter operations (open, close, ...)
  72. NDIS_STATUS NotificationStatus; // Notification status for async adapter events
  73. NDIS_WAN_INFO WanInfo; // WanInfo structure
  74. LIST_ENTRY WanRequestList;
  75. LIST_ENTRY AfSapCBList;
  76. LIST_ENTRY AfSapCBClosing;
  77. ULONG BufferSize;
  78. ULONG SendResources;
  79. union {
  80. NPAGED_LOOKASIDE_LIST WanPacketPool; // Used if no memory flags set
  81. struct {
  82. PUCHAR PacketMemory; // Used if memory flags set
  83. ULONG PacketMemorySize;
  84. SLIST_HEADER WanPacketList;
  85. };
  86. };
  87. ULONG AfRegisteringCount;
  88. WAN_EVENT AfRegisteringEvent;
  89. WAN_EVENT InitEvent;
  90. NDIS_SPIN_LOCK Lock; // Structure access lock
  91. #if DBG
  92. LIST_ENTRY SendPacketList;
  93. #endif
  94. } OPENCB, *POPENCB;
  95. #define MINIPORTCB_SIZE sizeof(MINIPORTCB)
  96. #define OPENCB_SIZE sizeof(OPENCB)
  97. //
  98. // Main control block for all global data
  99. //
  100. typedef struct _NDISWANCB {
  101. NDIS_SPIN_LOCK Lock; // Structure access lock
  102. ULONG RefCount;
  103. NDIS_HANDLE NdisWrapperHandle; // NDIS Wrapper handle
  104. NDIS_HANDLE MiniportDriverHandle; // Handle for this miniport
  105. NDIS_HANDLE ProtocolHandle; // Our protocol handle
  106. ULONG NumberOfProtocols; // Total number of protocols that we are bound to
  107. ULONG NumberOfLinks; // Total number of links for all WAN Miniport Adapters
  108. PDRIVER_OBJECT pDriverObject; // Pointer to the NT Driver Object
  109. PDEVICE_OBJECT pDeviceObject; // Pointer to the device object
  110. NDIS_HANDLE DeviceHandle;
  111. PDRIVER_UNLOAD NdisUnloadHandler;
  112. PIRP HibernateEventIrp;
  113. PMINIPORTCB PromiscuousAdapter;
  114. #ifdef MY_DEVICE_OBJECT
  115. PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]; // Device dispatch functions
  116. #endif
  117. }NDISWANCB, *PNDISWANCB;
  118. #endif // _NDISWAN_ADAPTER_