Leaked source code of windows server 2003
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.

180 lines
5.1 KiB

  1. /*
  2. *
  3. * Copyright (c) Microsoft Corporation. All rights reserved.
  4. *
  5. * Module Name:
  6. * ndispnp.h
  7. *
  8. * Abstract:
  9. * Include file for PnP message apis to NDIS.
  10. *
  11. * Environment:
  12. * These routines are statically linked in the caller's executable and are callable in user mode.
  13. */
  14. #ifndef _NDISPNP_
  15. #define _NDISPNP_
  16. #if defined (_MSC_VER)
  17. #if ( _MSC_VER >= 800 )
  18. #pragma warning(push)
  19. #pragma warning(disable:4001)
  20. #pragma warning(disable:4201)
  21. #pragma warning(disable:4214)
  22. #pragma warning(disable:4514)
  23. #endif
  24. #if (_MSC_VER >= 1020)
  25. #pragma once
  26. #endif
  27. #endif
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. //
  32. // Definitions for Layer
  33. //
  34. #define NDIS 0x01
  35. #define TDI 0x02
  36. //
  37. // Definitions for Operation
  38. //
  39. #define BIND 0x01
  40. #define UNBIND 0x02
  41. #define RECONFIGURE 0x03
  42. #define UNBIND_FORCE 0x04
  43. #define UNLOAD 0x05
  44. #define REMOVE_DEVICE 0x06 // This is a notification that a device is about to be removed.
  45. #define ADD_IGNORE_BINDING 0x07
  46. #define DEL_IGNORE_BINDING 0x08
  47. #define BIND_LIST 0x09 // this is a notification that a protocol's bind list has changed
  48. //
  49. // Return code from this api is to be treated as a BOOL. Link with ndispnp.lib for this.
  50. //
  51. extern
  52. UINT
  53. NdisHandlePnPEvent(
  54. IN UINT Layer,
  55. IN UINT Operation,
  56. IN PUNICODE_STRING LowerComponent,
  57. IN PUNICODE_STRING UpperComponent,
  58. IN PUNICODE_STRING BindList,
  59. IN PVOID ReConfigBuffer OPTIONAL,
  60. IN UINT ReConfigBufferSize OPTIONAL
  61. );
  62. #define MEDIA_STATE_CONNECTED 1
  63. #define MEDIA_STATE_DISCONNECTED 0
  64. #define MEDIA_STATE_UNKNOWN -1
  65. #define DEVICE_STATE_CONNECTED 1
  66. #define DEVICE_STATE_DISCONNECTED 0
  67. typedef struct
  68. {
  69. ULONG Size; // Of this structure
  70. ULONG DeviceState; // DEVICE_STATE_XXX above
  71. ULONG MediaType; // NdisMediumXXX
  72. ULONG MediaState; // MEDIA_STATE_XXX above
  73. ULONG PhysicalMediaType;
  74. ULONG LinkSpeed; // In 100bits/s. 10Mb/s = 100000
  75. ULONGLONG PacketsSent;
  76. ULONGLONG PacketsReceived;
  77. ULONG InitTime; // In milliseconds
  78. ULONG ConnectTime; // In seconds
  79. ULONGLONG BytesSent; // 0 - Unknown (or not supported)
  80. ULONGLONG BytesReceived; // 0 - Unknown (or not supported)
  81. ULONGLONG DirectedBytesReceived;
  82. ULONGLONG DirectedPacketsReceived;
  83. ULONG PacketsReceiveErrors;
  84. ULONG PacketsSendErrors;
  85. ULONG ResetCount;
  86. ULONG MediaSenseConnectCount;
  87. ULONG MediaSenseDisconnectCount;
  88. } NIC_STATISTICS, *PNIC_STATISTICS;
  89. extern
  90. UINT
  91. NdisQueryHwAddress(
  92. IN PUNICODE_STRING DeviceGUID, // Device name of the form "\Device\{GUID}
  93. OUT PUCHAR CurrentAddress, // Has space for HW address
  94. OUT PUCHAR PermanentAddress, // Has space for HW address
  95. OUT PUCHAR VendorId // Has space for Vendor Id
  96. );
  97. extern
  98. UINT
  99. NdisQueryStatistics(
  100. IN PUNICODE_STRING DeviceGUID, // Device name of the form "\Device\{GUID}
  101. OUT PNIC_STATISTICS Statistics
  102. );
  103. typedef struct _NDIS_INTERFACE
  104. {
  105. UNICODE_STRING DeviceName;
  106. UNICODE_STRING DeviceDescription;
  107. } NDIS_INTERFACE, *PNDIS_INTERFACE;
  108. typedef struct _NDIS_ENUM_INTF
  109. {
  110. UINT TotalInterfaces; // in Interface array below
  111. UINT AvailableInterfaces; // >= TotalInterfaces
  112. UINT BytesNeeded; // for all available interfaces
  113. UINT Reserved;
  114. NDIS_INTERFACE Interface[1];
  115. } NDIS_ENUM_INTF, *PNDIS_ENUM_INTF;
  116. extern
  117. UINT
  118. NdisEnumerateInterfaces(
  119. IN PNDIS_ENUM_INTF Interfaces,
  120. IN UINT Size
  121. );
  122. typedef enum
  123. {
  124. BundlePrimary,
  125. BundleSecondary
  126. } BUNDLE_TYPE;
  127. typedef struct _DEVICE_BUNDLE_ENRTY
  128. {
  129. UNICODE_STRING Name;
  130. BUNDLE_TYPE Type;
  131. } DEVICE_BUNDLE_ENRTY, *PDEVICE_BUNDLE_ENRTY;
  132. typedef struct _DEVICE_BUNDLE
  133. {
  134. UINT TotalEntries;
  135. UINT AvailableEntries;
  136. DEVICE_BUNDLE_ENRTY Entries[1];
  137. } DEVICE_BUNDLE, *PDEVICE_BUNDLE;
  138. extern
  139. UINT
  140. NdisQueryDeviceBundle(
  141. IN PUNICODE_STRING DeviceGUID, // Device name of the form "\Device\{GUID}
  142. OUT PDEVICE_BUNDLE BundleBuffer,
  143. IN UINT BufferSize
  144. );
  145. #define POINTER_TO_OFFSET(val, start) \
  146. (val) = ((val) == NULL) ? NULL : (PVOID)( (PCHAR)(val) - (ULONG_PTR)(start) )
  147. #define OFFSET_TO_POINTER(val, start) \
  148. (val) = ((val) == NULL) ? NULL : (PVOID)( (PCHAR)(val) + (ULONG_PTR)(start) )
  149. #ifdef __cplusplus
  150. } // extern "C"
  151. #endif
  152. #if defined (_MSC_VER) && ( _MSC_VER >= 800 )
  153. #pragma warning(pop)
  154. #endif
  155. #endif // _NDISPNP_