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.

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