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.

761 lines
22 KiB

  1. //
  2. // Function types for NDIS_PROTOCOL_CHARACTERISTICS
  3. //
  4. typedef
  5. VOID
  6. (*OPEN_ADAPTER_COMPLETE_HANDLER)(
  7. IN NDIS_HANDLE ProtocolBindingContext,
  8. IN NDIS_STATUS Status,
  9. IN NDIS_STATUS OpenErrorStatus
  10. );
  11. typedef
  12. VOID
  13. (*CLOSE_ADAPTER_COMPLETE_HANDLER)(
  14. IN NDIS_HANDLE ProtocolBindingContext,
  15. IN NDIS_STATUS Status
  16. );
  17. typedef
  18. VOID
  19. (*RESET_COMPLETE_HANDLER)(
  20. IN NDIS_HANDLE ProtocolBindingContext,
  21. IN NDIS_STATUS Status
  22. );
  23. typedef
  24. VOID
  25. (*REQUEST_COMPLETE_HANDLER)(
  26. IN NDIS_HANDLE ProtocolBindingContext,
  27. IN PNDIS_REQUEST NdisRequest,
  28. IN NDIS_STATUS Status
  29. );
  30. typedef
  31. VOID
  32. (*STATUS_HANDLER)(
  33. IN NDIS_HANDLE ProtocolBindingContext,
  34. IN NDIS_STATUS GeneralStatus,
  35. IN PVOID StatusBuffer,
  36. IN UINT StatusBufferSize
  37. );
  38. typedef
  39. VOID
  40. (*STATUS_COMPLETE_HANDLER)(
  41. IN NDIS_HANDLE ProtocolBindingContext
  42. );
  43. typedef
  44. VOID
  45. (*SEND_COMPLETE_HANDLER)(
  46. IN NDIS_HANDLE ProtocolBindingContext,
  47. IN PNDIS_PACKET Packet,
  48. IN NDIS_STATUS Status
  49. );
  50. typedef
  51. VOID
  52. (*WAN_SEND_COMPLETE_HANDLER) (
  53. IN NDIS_HANDLE ProtocolBindingContext,
  54. IN PNDIS_WAN_PACKET Packet,
  55. IN NDIS_STATUS Status
  56. );
  57. typedef
  58. VOID
  59. (*TRANSFER_DATA_COMPLETE_HANDLER)(
  60. IN NDIS_HANDLE ProtocolBindingContext,
  61. IN PNDIS_PACKET Packet,
  62. IN NDIS_STATUS Status,
  63. IN UINT BytesTransferred
  64. );
  65. typedef
  66. VOID
  67. (*WAN_TRANSFER_DATA_COMPLETE_HANDLER)(
  68. VOID
  69. );
  70. typedef
  71. NDIS_STATUS
  72. (*RECEIVE_HANDLER)(
  73. IN NDIS_HANDLE ProtocolBindingContext,
  74. IN NDIS_HANDLE MacReceiveContext,
  75. IN PVOID HeaderBuffer,
  76. IN UINT HeaderBufferSize,
  77. IN PVOID LookAheadBuffer,
  78. IN UINT LookaheadBufferSize,
  79. IN UINT PacketSize
  80. );
  81. typedef
  82. NDIS_STATUS
  83. (*WAN_RECEIVE_HANDLER)(
  84. IN NDIS_HANDLE NdisLinkHandle,
  85. IN PUCHAR Packet,
  86. IN ULONG PacketSize
  87. );
  88. typedef
  89. VOID
  90. (*RECEIVE_COMPLETE_HANDLER)(
  91. IN NDIS_HANDLE ProtocolBindingContext
  92. );
  93. //
  94. // Protocol characteristics for down-level NDIS 3.0 protocols
  95. //
  96. typedef struct _NDIS30_PROTOCOL_CHARACTERISTICS
  97. {
  98. UCHAR MajorNdisVersion;
  99. UCHAR MinorNdisVersion;
  100. USHORT Filler;
  101. union
  102. {
  103. UINT Reserved;
  104. UINT Flags;
  105. };
  106. OPEN_ADAPTER_COMPLETE_HANDLER OpenAdapterCompleteHandler;
  107. CLOSE_ADAPTER_COMPLETE_HANDLER CloseAdapterCompleteHandler;
  108. union
  109. {
  110. SEND_COMPLETE_HANDLER SendCompleteHandler;
  111. WAN_SEND_COMPLETE_HANDLER WanSendCompleteHandler;
  112. };
  113. union
  114. {
  115. TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler;
  116. WAN_TRANSFER_DATA_COMPLETE_HANDLER WanTransferDataCompleteHandler;
  117. };
  118. RESET_COMPLETE_HANDLER ResetCompleteHandler;
  119. REQUEST_COMPLETE_HANDLER RequestCompleteHandler;
  120. union
  121. {
  122. RECEIVE_HANDLER ReceiveHandler;
  123. WAN_RECEIVE_HANDLER WanReceiveHandler;
  124. };
  125. RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler;
  126. STATUS_HANDLER StatusHandler;
  127. STATUS_COMPLETE_HANDLER StatusCompleteHandler;
  128. NDIS_STRING Name;
  129. } NDIS30_PROTOCOL_CHARACTERISTICS;
  130. //
  131. // Function types extensions for NDIS 4.0 Protocols
  132. //
  133. typedef
  134. INT
  135. (*RECEIVE_PACKET_HANDLER)(
  136. IN NDIS_HANDLE ProtocolBindingContext,
  137. IN PNDIS_PACKET Packet
  138. );
  139. typedef
  140. VOID
  141. (*BIND_HANDLER)(
  142. OUT PNDIS_STATUS Status,
  143. IN NDIS_HANDLE BindContext,
  144. IN PNDIS_STRING DeviceName,
  145. IN PVOID SystemSpecific1,
  146. IN PVOID SystemSpecific2
  147. );
  148. typedef
  149. VOID
  150. (*UNBIND_HANDLER)(
  151. OUT PNDIS_STATUS Status,
  152. IN NDIS_HANDLE ProtocolBindingContext,
  153. IN NDIS_HANDLE UnbindContext
  154. );
  155. typedef
  156. NDIS_STATUS
  157. (*PNP_EVENT_HANDLER)(
  158. IN NDIS_HANDLE ProtocolBindingContext,
  159. IN PNET_PNP_EVENT NetPnPEvent
  160. );
  161. typedef
  162. VOID
  163. (*UNLOAD_PROTOCOL_HANDLER)(
  164. VOID
  165. );
  166. //
  167. // Protocol characteristics for NDIS 4.0 protocols
  168. //
  169. typedef struct _NDIS40_PROTOCOL_CHARACTERISTICS
  170. {
  171. #ifdef __cplusplus
  172. NDIS30_PROTOCOL_CHARACTERISTICS Ndis30Chars;
  173. #else
  174. NDIS30_PROTOCOL_CHARACTERISTICS;
  175. #endif
  176. //
  177. // Start of NDIS 4.0 extensions.
  178. //
  179. RECEIVE_PACKET_HANDLER ReceivePacketHandler;
  180. //
  181. // PnP protocol entry-points
  182. //
  183. BIND_HANDLER BindAdapterHandler;
  184. UNBIND_HANDLER UnbindAdapterHandler;
  185. PNP_EVENT_HANDLER PnPEventHandler;
  186. UNLOAD_PROTOCOL_HANDLER UnloadHandler;
  187. } NDIS40_PROTOCOL_CHARACTERISTICS;
  188. //
  189. // Protocol (5.0) handler proto-types - used by clients as well as call manager modules
  190. //
  191. typedef
  192. VOID
  193. (*CO_SEND_COMPLETE_HANDLER)(
  194. IN NDIS_STATUS Status,
  195. IN NDIS_HANDLE ProtocolVcContext,
  196. IN PNDIS_PACKET Packet
  197. );
  198. typedef
  199. VOID
  200. (*CO_STATUS_HANDLER)(
  201. IN NDIS_HANDLE ProtocolBindingContext,
  202. IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
  203. IN NDIS_STATUS GeneralStatus,
  204. IN PVOID StatusBuffer,
  205. IN UINT StatusBufferSize
  206. );
  207. typedef
  208. UINT
  209. (*CO_RECEIVE_PACKET_HANDLER)(
  210. IN NDIS_HANDLE ProtocolBindingContext,
  211. IN NDIS_HANDLE ProtocolVcContext,
  212. IN PNDIS_PACKET Packet
  213. );
  214. typedef
  215. NDIS_STATUS
  216. (*CO_REQUEST_HANDLER)(
  217. IN NDIS_HANDLE ProtocolAfContext,
  218. IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
  219. IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
  220. IN OUT PNDIS_REQUEST NdisRequest
  221. );
  222. typedef
  223. VOID
  224. (*CO_REQUEST_COMPLETE_HANDLER)(
  225. IN NDIS_STATUS Status,
  226. IN NDIS_HANDLE ProtocolAfContext OPTIONAL,
  227. IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
  228. IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
  229. IN PNDIS_REQUEST NdisRequest
  230. );
  231. //
  232. // CO_CREATE_VC_HANDLER and CO_DELETE_VC_HANDLER are synchronous calls
  233. //
  234. typedef
  235. NDIS_STATUS
  236. (*CO_CREATE_VC_HANDLER)(
  237. IN NDIS_HANDLE ProtocolAfContext,
  238. IN NDIS_HANDLE NdisVcHandle,
  239. OUT PNDIS_HANDLE ProtocolVcContext
  240. );
  241. typedef
  242. NDIS_STATUS
  243. (*CO_DELETE_VC_HANDLER)(
  244. IN NDIS_HANDLE ProtocolVcContext
  245. );
  246. typedef
  247. VOID
  248. (*CO_AF_REGISTER_NOTIFY_HANDLER)(
  249. IN NDIS_HANDLE ProtocolBindingContext,
  250. IN PCO_ADDRESS_FAMILY AddressFamily
  251. );
  252. typedef struct _NDIS50_PROTOCOL_CHARACTERISTICS
  253. {
  254. #ifdef __cplusplus
  255. NDIS40_PROTOCOL_CHARACTERISTICS Ndis40Chars;
  256. #else
  257. NDIS40_PROTOCOL_CHARACTERISTICS;
  258. #endif
  259. //
  260. // Placeholders for protocol extensions for PnP/PM etc.
  261. //
  262. PVOID ReservedHandlers[4];
  263. //
  264. // Start of NDIS 5.0 extensions.
  265. //
  266. CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler;
  267. CO_STATUS_HANDLER CoStatusHandler;
  268. CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler;
  269. CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler;
  270. } NDIS50_PROTOCOL_CHARACTERISTICS;
  271. #if (defined(NDIS50) || defined(NDIS51))
  272. typedef NDIS50_PROTOCOL_CHARACTERISTICS NDIS_PROTOCOL_CHARACTERISTICS;
  273. #else
  274. #if NDIS40
  275. typedef NDIS40_PROTOCOL_CHARACTERISTICS NDIS_PROTOCOL_CHARACTERISTICS;
  276. #else
  277. typedef NDIS30_PROTOCOL_CHARACTERISTICS NDIS_PROTOCOL_CHARACTERISTICS;
  278. #endif
  279. #endif
  280. typedef NDIS_PROTOCOL_CHARACTERISTICS *PNDIS_PROTOCOL_CHARACTERISTICS;
  281. //
  282. // Requests used by Protocol Modules
  283. //
  284. EXPORT
  285. VOID
  286. NdisRegisterProtocol(
  287. OUT PNDIS_STATUS Status,
  288. OUT PNDIS_HANDLE NdisProtocolHandle,
  289. IN PNDIS_PROTOCOL_CHARACTERISTICS ProtocolCharacteristics,
  290. IN UINT CharacteristicsLength
  291. );
  292. EXPORT
  293. VOID
  294. NdisDeregisterProtocol(
  295. OUT PNDIS_STATUS Status,
  296. IN NDIS_HANDLE NdisProtocolHandle
  297. );
  298. EXPORT
  299. VOID
  300. NdisOpenAdapter(
  301. OUT PNDIS_STATUS Status,
  302. OUT PNDIS_STATUS OpenErrorStatus,
  303. OUT PNDIS_HANDLE NdisBindingHandle,
  304. OUT PUINT SelectedMediumIndex,
  305. IN PNDIS_MEDIUM MediumArray,
  306. IN UINT MediumArraySize,
  307. IN NDIS_HANDLE NdisProtocolHandle,
  308. IN NDIS_HANDLE ProtocolBindingContext,
  309. IN PNDIS_STRING AdapterName,
  310. IN UINT OpenOptions,
  311. IN PSTRING AddressingInformation OPTIONAL
  312. );
  313. EXPORT
  314. VOID
  315. NdisCloseAdapter(
  316. OUT PNDIS_STATUS Status,
  317. IN NDIS_HANDLE NdisBindingHandle
  318. );
  319. EXPORT
  320. VOID
  321. NdisCompleteBindAdapter(
  322. IN NDIS_HANDLE BindAdapterContext,
  323. IN NDIS_STATUS Status,
  324. IN NDIS_STATUS OpenStatus
  325. );
  326. EXPORT
  327. VOID
  328. NdisCompleteUnbindAdapter(
  329. IN NDIS_HANDLE UnbindAdapterContext,
  330. IN NDIS_STATUS Status
  331. );
  332. EXPORT
  333. VOID
  334. NdisSetProtocolFilter(
  335. OUT PNDIS_STATUS Status,
  336. IN NDIS_HANDLE NdisBindingHandle,
  337. IN RECEIVE_HANDLER ReceiveHandler,
  338. IN RECEIVE_PACKET_HANDLER ReceivePacketHandler,
  339. IN NDIS_MEDIUM Medium,
  340. IN UINT Offset,
  341. IN UINT Size,
  342. IN PUCHAR Pattern
  343. );
  344. EXPORT
  345. VOID
  346. NdisOpenProtocolConfiguration(
  347. OUT PNDIS_STATUS Status,
  348. OUT PNDIS_HANDLE ConfigurationHandle,
  349. IN PNDIS_STRING ProtocolSection
  350. );
  351. EXPORT
  352. VOID
  353. NdisGetDriverHandle(
  354. IN NDIS_HANDLE NdisBindingHandle,
  355. OUT PNDIS_HANDLE NdisDriverHandle
  356. );
  357. EXPORT
  358. VOID
  359. NdisReEnumerateProtocolBindings(
  360. IN NDIS_HANDLE NdisProtocolHandle
  361. );
  362. EXPORT
  363. NDIS_STATUS
  364. NdisWriteEventLogEntry(
  365. IN PVOID LogHandle,
  366. IN NDIS_STATUS EventCode,
  367. IN ULONG UniqueEventValue,
  368. IN USHORT NumStrings,
  369. IN PVOID StringsList OPTIONAL,
  370. IN ULONG DataSize,
  371. IN PVOID Data OPTIONAL
  372. );
  373. //
  374. // The following routine is used by transports to complete pending
  375. // network PnP events.
  376. //
  377. EXPORT
  378. VOID
  379. NdisCompletePnPEvent(
  380. IN NDIS_STATUS Status,
  381. IN NDIS_HANDLE NdisBindingHandle,
  382. IN PNET_PNP_EVENT NetPnPEvent
  383. );
  384. //
  385. // The following routine is used by a transport to query the localized
  386. // friendly instance name of the adapter that they are bound to. There
  387. // are two variations of this, one uses the binding handle and the other
  388. // the binding context. Some transports need this before they bind - like
  389. // TCP/IP for instance.
  390. //
  391. EXPORT
  392. NDIS_STATUS
  393. NdisQueryAdapterInstanceName(
  394. OUT PNDIS_STRING pAdapterInstanceName,
  395. IN NDIS_HANDLE NdisBindingHandle
  396. );
  397. EXPORT
  398. NDIS_STATUS
  399. NdisQueryBindInstanceName(
  400. OUT PNDIS_STRING pAdapterInstanceName,
  401. IN NDIS_HANDLE BindingContext
  402. );
  403. //
  404. // The following is used by TDI/NDIS interface as part of Network PnP.
  405. // For use by TDI alone.
  406. //
  407. typedef
  408. NTSTATUS
  409. (*TDI_REGISTER_CALLBACK)(
  410. IN PUNICODE_STRING DeviceName,
  411. OUT HANDLE * TdiHandle
  412. );
  413. typedef
  414. NTSTATUS
  415. (*TDI_PNP_HANDLER)(
  416. IN PUNICODE_STRING UpperComponent,
  417. IN PUNICODE_STRING LowerComponent,
  418. IN PUNICODE_STRING BindList,
  419. IN PVOID ReconfigBuffer,
  420. IN UINT ReconfigBufferSize,
  421. IN UINT Operation
  422. );
  423. EXPORT
  424. VOID
  425. NdisRegisterTdiCallBack(
  426. IN TDI_REGISTER_CALLBACK RegsterCallback,
  427. IN TDI_PNP_HANDLER PnPHandler
  428. );
  429. EXPORT
  430. VOID
  431. NdisRegisterTdiPnpHandler(
  432. IN TDI_PNP_HANDLER PnPHandler
  433. );
  434. VOID
  435. NdisReset(
  436. OUT PNDIS_STATUS Status,
  437. IN NDIS_HANDLE NdisBindingHandle
  438. );
  439. VOID
  440. NdisRequest(
  441. OUT PNDIS_STATUS Status,
  442. IN NDIS_HANDLE NdisBindingHandle,
  443. IN PNDIS_REQUEST NdisRequest
  444. );
  445. #if BINARY_COMPATIBLE
  446. VOID
  447. NdisSend(
  448. OUT PNDIS_STATUS Status,
  449. IN NDIS_HANDLE NdisBindingHandle,
  450. IN PNDIS_PACKET Packet
  451. );
  452. VOID
  453. NdisSendPackets(
  454. IN NDIS_HANDLE NdisBindingHandle,
  455. IN PPNDIS_PACKET PacketArray,
  456. IN UINT NumberOfPackets
  457. );
  458. VOID
  459. NdisTransferData(
  460. OUT PNDIS_STATUS Status,
  461. IN NDIS_HANDLE NdisBindingHandle,
  462. IN NDIS_HANDLE MacReceiveContext,
  463. IN UINT ByteOffset,
  464. IN UINT BytesToTransfer,
  465. IN OUT PNDIS_PACKET Packet,
  466. OUT PUINT BytesTransferred
  467. );
  468. #else // BINARY_COMPATIBLE
  469. #ifdef __cplusplus
  470. #define NdisSend(Status, NdisBindingHandle, Packet) \
  471. { \
  472. *(Status) = \
  473. (((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->NdisCommonOpenBlock.SendHandler)( \
  474. ((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->NdisCommonOpenBlock.BindingHandle, \
  475. (Packet)); \
  476. }
  477. #define NdisSendPackets(NdisBindingHandle, PacketArray, NumberOfPackets) \
  478. { \
  479. (((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->NdisCommonOpenBlock.SendPacketsHandler)( \
  480. (PNDIS_OPEN_BLOCK)(NdisBindingHandle), \
  481. (PacketArray), \
  482. (NumberOfPackets)); \
  483. }
  484. #define WanMiniportSend(Status, \
  485. NdisBindingHandle, \
  486. NdisLinkHandle, \
  487. WanPacket) \
  488. { \
  489. *(Status) = \
  490. ((((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->NdisCommonOpenBlock.WanSendHandler))( \
  491. ((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->NdisCommonOpenBlock.BindingHandle, \
  492. (NdisLinkHandle), \
  493. (PNDIS_PACKET)(WanPacket)); \
  494. }
  495. #define NdisTransferData(Status, \
  496. NdisBindingHandle, \
  497. MacReceiveContext, \
  498. ByteOffset, \
  499. BytesToTransfer, \
  500. Packet, \
  501. BytesTransferred) \
  502. { \
  503. *(Status) = \
  504. (((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->NdisCommonOpenBlock.TransferDataHandler)( \
  505. ((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->NdisCommonOpenBlock.BindingHandle, \
  506. (MacReceiveContext), \
  507. (ByteOffset), \
  508. (BytesToTransfer), \
  509. (Packet), \
  510. (BytesTransferred)); \
  511. }
  512. #else
  513. #define NdisSend(Status, NdisBindingHandle, Packet) \
  514. { \
  515. *(Status) = \
  516. (((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->SendHandler)( \
  517. ((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->BindingHandle, \
  518. (Packet)); \
  519. }
  520. #define NdisSendPackets(NdisBindingHandle, PacketArray, NumberOfPackets) \
  521. { \
  522. (((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->SendPacketsHandler)( \
  523. (PNDIS_OPEN_BLOCK)(NdisBindingHandle), \
  524. (PacketArray), \
  525. (NumberOfPackets)); \
  526. }
  527. #define WanMiniportSend(Status, \
  528. NdisBindingHandle, \
  529. NdisLinkHandle, \
  530. WanPacket) \
  531. { \
  532. *(Status) = \
  533. ((((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->WanSendHandler))( \
  534. ((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->BindingHandle, \
  535. (NdisLinkHandle), \
  536. (PNDIS_PACKET)(WanPacket)); \
  537. }
  538. #define NdisTransferData(Status, \
  539. NdisBindingHandle, \
  540. MacReceiveContext, \
  541. ByteOffset, \
  542. BytesToTransfer, \
  543. Packet, \
  544. BytesTransferred) \
  545. { \
  546. *(Status) = \
  547. (((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->TransferDataHandler)( \
  548. ((PNDIS_OPEN_BLOCK)(NdisBindingHandle))->BindingHandle, \
  549. (MacReceiveContext), \
  550. (ByteOffset), \
  551. (BytesToTransfer), \
  552. (Packet), \
  553. (BytesTransferred)); \
  554. }
  555. #endif // ifdef __cplusplus
  556. #endif // BINARY_COMPATIBLE
  557. //
  558. // Routines to access packet flags
  559. //
  560. /*++
  561. VOID
  562. NdisSetSendFlags(
  563. IN PNDIS_PACKET Packet,
  564. IN UINT Flags
  565. );
  566. --*/
  567. #define NdisSetSendFlags(_Packet,_Flags) (_Packet)->Private.Flags = (_Flags)
  568. /*++
  569. VOID
  570. NdisQuerySendFlags(
  571. IN PNDIS_PACKET Packet,
  572. OUT PUINT Flags
  573. );
  574. --*/
  575. #define NdisQuerySendFlags(_Packet,_Flags) *(_Flags) = (_Packet)->Private.Flags
  576. //
  577. // The following is the minimum size of packets a miniport must allocate
  578. // when it indicates packets via NdisMIndicatePacket or NdisMCoIndicatePacket
  579. //
  580. #define PROTOCOL_RESERVED_SIZE_IN_PACKET (4 * sizeof(PVOID))
  581. EXPORT
  582. VOID
  583. NdisReturnPackets(
  584. IN PNDIS_PACKET * PacketsToReturn,
  585. IN UINT NumberOfPackets
  586. );
  587. EXPORT
  588. PNDIS_PACKET
  589. NdisGetReceivedPacket(
  590. IN NDIS_HANDLE NdisBindingHandle,
  591. IN NDIS_HANDLE MacContext
  592. );
  593. //
  594. // Macros to portably manipulate NDIS buffers.
  595. //
  596. #if BINARY_COMPATIBLE
  597. EXPORT
  598. ULONG
  599. NdisBufferLength(
  600. IN PNDIS_BUFFER Buffer
  601. );
  602. EXPORT
  603. PVOID
  604. NdisBufferVirtualAddress(
  605. IN PNDIS_BUFFER Buffer
  606. );
  607. #else // BINARY_COMPATIBLE
  608. #define NdisBufferLength(Buffer) MmGetMdlByteCount(Buffer)
  609. #define NdisBufferVirtualAddress(_Buffer) MmGetSystemAddressForMdl(_Buffer)
  610. #define NdisBufferVirtualAddressSafe(_Buffer, _Priority) MmGetSystemAddressForMdlSafe(_Buffer, _Priority)
  611. #endif // BINARY_COMPATIBLE
  612. //
  613. // Ndis 5.1 entry points for setting/gettign packet's CancelId and cancelling send packets
  614. //
  615. // #if (defined(NDIS50) || defined(NDIS51) || defined(NDIS50_MINIPORT) || defined(NDIS51_MINIPORT))
  616. /*
  617. EXPORT
  618. VOID
  619. NdisSetPacketCancelId(
  620. IN PNDIS_PACKET Packet,
  621. IN PVOID CancelId
  622. );
  623. */
  624. #define NdisSetPacketCancelId(_Packet, _CancelId) NDIS_SET_PACKET_CANCEL_ID(_Packet, _CancelId);
  625. /*
  626. EXPORT
  627. PVOID
  628. NdisGetPacketCancelId(
  629. IN PNDIS_PACKET Packet
  630. );
  631. */
  632. #define NdisGetPacketCancelId(_Packet) NDIS_GET_PACKET_CANCEL_ID(_Packet);
  633. EXPORT
  634. VOID
  635. NdisCancelSendPackets(
  636. IN NDIS_HANDLE NdisBindingHandle,
  637. IN PVOID CancelId
  638. );
  639. EXPORT
  640. NDIS_STATUS
  641. NdisQueryPendingIOCount(
  642. IN PVOID NdisBindingHandle,
  643. IN OUT PULONG IoCount
  644. );
  645. EXPORT
  646. UCHAR
  647. NdisGeneratePartialCancelId(
  648. VOID
  649. );
  650. // #endif // NDIS51