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.

1908 lines
68 KiB

  1. /***************************************************************************
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. RNDISMP.H
  5. Abstract:
  6. Header file for Remote NDIS Miniport driver. Sits on top of Remote
  7. NDIS bus specific layers.
  8. Environment:
  9. kernel mode only
  10. Notes:
  11. THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  12. KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  13. IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  14. PURPOSE.
  15. Copyright (c) 1999 Microsoft Corporation. All Rights Reserved.
  16. Revision History:
  17. 5/6/99 : created
  18. Author:
  19. Tom Green
  20. ****************************************************************************/
  21. #ifndef _RNDISMP_H_
  22. #define _RNDISMP_H_
  23. #ifndef OID_GEN_RNDIS_CONFIG_PARAMETER
  24. #define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B // Set only
  25. #endif
  26. //
  27. // DEBUG stuff
  28. //
  29. #if DBG
  30. //
  31. // Definitions for all of the Debug macros. If we're in a debug (DBG) mode,
  32. // these macros will print information to the debug terminal. If the
  33. // driver is compiled in a free (non-debug) environment the macros become
  34. // NOPs.
  35. //
  36. VOID
  37. NTAPI
  38. DbgBreakPoint(VOID);
  39. //
  40. // DEBUG enable bit definitions
  41. //
  42. #define DBG_LEVEL0 0x1000 // Display TRACE0 messages
  43. #define DBG_LEVEL1 0x0001 // Display TRACE1 messages
  44. #define DBG_LEVEL2 0x0002 // Display TRACE2 messages
  45. #define DBG_LEVEL3 0x0004 // Display TRACE3 messages
  46. #define DBG_OID_LIST 0x0008 // display OID list
  47. #define DBG_OID_NAME 0x0010 // display name of OID in query and set routines
  48. #define DBG_DUMP 0x0020 // Display buffer dumps
  49. #define DBG_LOG_SENDS 0x0100 // Log sent messages.
  50. #define TRACE0(S) {if(RndismpDebugFlags & DBG_LEVEL0) {DbgPrint("RNDISMP: "); DbgPrint S;}}
  51. #define TRACE1(S) {if(RndismpDebugFlags & DBG_LEVEL1) {DbgPrint("RNDISMP: "); DbgPrint S;}}
  52. #define TRACE2(S) {if(RndismpDebugFlags & DBG_LEVEL2) {DbgPrint("RNDISMP: "); DbgPrint S;}}
  53. #define TRACE3(S) {if(RndismpDebugFlags & DBG_LEVEL3) {DbgPrint("RNDISMP: "); DbgPrint S;}}
  54. #define TRACEDUMP(_s, _buf, _len) {if(RndismpDebugFlags & DBG_DUMP) {DbgPrint("RNDISMP: "); DbgPrint _s; RndisPrintHexDump(_buf, _len);}}
  55. #define DISPLAY_OID_LIST(Adapter) DisplayOidList(Adapter)
  56. #define GET_OID_NAME(Oid) GetOidName(Oid)
  57. #define OID_NAME_TRACE(Oid, s) \
  58. { \
  59. if(RndismpDebugFlags & DBG_OID_NAME) \
  60. DbgPrint("RNDISMP: %s: (%s) (%08X)\n", s, GET_OID_NAME(Oid), Oid); \
  61. }
  62. #undef ASSERT
  63. #define ASSERT(exp) \
  64. { \
  65. if(!(exp)) \
  66. { \
  67. DbgPrint("Assertion Failed: %s:%d %s\n", \
  68. __FILE__,__LINE__,#exp); \
  69. DbgBreakPoint(); \
  70. } \
  71. }
  72. #define DBGINT(S) \
  73. { \
  74. DbgPrint("%s:%d - ", __FILE__, __LINE__); \
  75. DbgPrint S; \
  76. DbgBreakPoint(); \
  77. }
  78. // check frame for problems
  79. #define CHECK_VALID_FRAME(Frame) \
  80. { \
  81. ASSERT(Frame); \
  82. if(Frame) \
  83. { \
  84. if(Frame->Signature != FRAME_SIGNATURE) \
  85. { \
  86. DbgPrint("RNDISMP: Invalid Frame (%p) Signature: %s:%d\n",\
  87. Frame, __FILE__,__LINE__); \
  88. DbgBreakPoint(); \
  89. } \
  90. } \
  91. }
  92. // check adapter for problems
  93. #define CHECK_VALID_ADAPTER(Adapter) \
  94. { \
  95. ASSERT(Adapter); \
  96. if(Adapter) \
  97. { \
  98. if(Adapter->Signature != ADAPTER_SIGNATURE) \
  99. { \
  100. DbgPrint("RNDISMP: Invalid Adapter Signature: %s:%d\n",\
  101. __FILE__,__LINE__); \
  102. DbgBreakPoint(); \
  103. } \
  104. } \
  105. }
  106. // check block for problems
  107. #define CHECK_VALID_BLOCK(Block) \
  108. { \
  109. ASSERT(Block); \
  110. if(Block) \
  111. { \
  112. if(Block->Signature != BLOCK_SIGNATURE) \
  113. { \
  114. DbgPrint("RNDISMP: Invalid Block Signature: %s:%d\n",\
  115. __FILE__,__LINE__); \
  116. DbgBreakPoint(); \
  117. } \
  118. } \
  119. }
  120. #define RNDISMP_ASSERT_AT_PASSIVE() \
  121. { \
  122. KIRQL Irql = KeGetCurrentIrql(); \
  123. if (Irql != PASSIVE_LEVEL) \
  124. { \
  125. DbgPrint("RNDISMP: found IRQL %d instead of passive!\n", Irql); \
  126. DbgPrint("RNDISMP: at line %d, file %s\n", __LINE__, __FILE__); \
  127. DbgBreakPoint(); \
  128. } \
  129. }
  130. #define RNDISMP_ASSERT_AT_DISPATCH() \
  131. { \
  132. KIRQL Irql = KeGetCurrentIrql(); \
  133. if (Irql != DISPATCH_LEVEL) \
  134. { \
  135. DbgPrint("RNDISMP: found IRQL %d instead of dispatch!\n", Irql); \
  136. DbgPrint("RNDISMP: at line %d, file %s\n", __LINE__, __FILE__); \
  137. DbgBreakPoint(); \
  138. } \
  139. }
  140. #define DBG_LOG_SEND_MSG(_pAdapter, _pMsgFrame) \
  141. { \
  142. if (RndismpDebugFlags & DBG_LOG_SENDS) \
  143. { \
  144. RndisLogSendMessage(_pAdapter, _pMsgFrame); \
  145. } \
  146. }
  147. #else // !DBG
  148. #define TRACE0(S)
  149. #define TRACE1(S)
  150. #define TRACE2(S)
  151. #define TRACE3(S)
  152. #define TRACEDUMP(_s, _buf, _len)
  153. #undef ASSERT
  154. #define ASSERT(exp)
  155. #define DBGINT(S)
  156. #define CHECK_VALID_FRAME(Frame)
  157. #define CHECK_VALID_ADAPTER(Adapter)
  158. #define CHECK_VALID_BLOCK(Block)
  159. #define DISPLAY_OID_LIST(Adapter)
  160. #define OID_NAME_TRACE(Oid, s)
  161. #define RNDISMP_ASSERT_AT_PASSIVE()
  162. #define RNDISMP_ASSERT_AT_DISPATCH()
  163. #define DBG_LOG_SEND_MSG(_pAdapter, _pMsgFrame)
  164. #endif //DBG
  165. //
  166. // Defines
  167. //
  168. #define MINIMUM_ETHERNET_PACKET_SIZE 60
  169. #define MAXIMUM_ETHERNET_PACKET_SIZE 1514
  170. #define NUM_BYTES_PROTOCOL_RESERVED_SECTION (4*sizeof(PVOID))
  171. #define ETHERNET_HEADER_SIZE 14
  172. #define INITIAL_RECEIVE_FRAMES 20
  173. #define MAX_RECEIVE_FRAMES 400
  174. // this is the size of the buffer we will use to pass Data packet header data
  175. // to the remote device.
  176. #define RNDIS_PACKET_MESSAGE_HEADER_SIZE 128
  177. // align all RNDIS packets on 4 byte boundaries
  178. #define RNDIS_PACKET_MESSAGE_BOUNDARY (4)
  179. #define ONE_SECOND 1000 // in milliseconds
  180. #define KEEP_ALIVE_TIMER (5 * ONE_SECOND)
  181. #define REQUEST_TIMEOUT (10 * ONE_SECOND)
  182. #define FRAME_SIGNATURE ((ULONG)('GSRF'))
  183. #define ADAPTER_SIGNATURE ((ULONG)('GSDA'))
  184. #define BLOCK_SIGNATURE ((ULONG)('GSLB'))
  185. #define RNDISMP_TAG_GEN_ALLOC ((ULONG)(' MNR'))
  186. #define RNDISMP_TAG_SEND_FRAME ((ULONG)('sMNR'))
  187. #define RNDISMP_TAG_RECV_DATA_FRAME ((ULONG)('rMNR'))
  188. #if DBG
  189. #define MINIPORT_INIT_TIMEOUT (10 * ONE_SECOND)
  190. #define MINIPORT_HALT_TIMEOUT (5 * ONE_SECOND)
  191. #else
  192. #define MINIPORT_INIT_TIMEOUT (5 * ONE_SECOND)
  193. #define MINIPORT_HALT_TIMEOUT (2 * ONE_SECOND)
  194. #endif
  195. #ifndef MAX
  196. #define MAX(a, b) (((a) > (b)) ? (a) : (b))
  197. #endif
  198. // flags for driver and device supported OIDs
  199. #define OID_NOT_SUPPORTED 0x0000
  200. #define DRIVER_SUPPORTED_OID 0x0001
  201. #define DEVICE_SUPPORTED_OID 0x0002
  202. //
  203. // Defines for OID_GEN_MAC_OPTIONS - most of the bits returned
  204. // in response to this query are driver-specific, however some
  205. // are device-specific.
  206. //
  207. #define RNDIS_DRIVER_MAC_OPTIONS (NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA | \
  208. NDIS_MAC_OPTION_TRANSFERS_NOT_PEND | \
  209. NDIS_MAC_OPTION_NO_LOOPBACK)
  210. #define RNDIS_DEVICE_MAC_OPTIONS_MASK NDIS_MAC_OPTION_8021P_PRIORITY
  211. //
  212. // Data structures
  213. //
  214. typedef NDIS_SPIN_LOCK RNDISMP_SPIN_LOCK;
  215. #ifdef BUILD_WIN9X
  216. //
  217. // Equivalents of types defined for Win9X config mgr.
  218. //
  219. typedef ULONG MY_CONFIGRET;
  220. typedef ULONG MY_DEVNODE;
  221. typedef ULONG MY_CONFIGFUNC;
  222. typedef ULONG MY_SUBCONFIGFUNC;
  223. typedef MY_CONFIGRET (_cdecl *MY_CMCONFIGHANDLER)(MY_CONFIGFUNC, MY_SUBCONFIGFUNC, MY_DEVNODE, ULONG, ULONG);
  224. #define MY_CR_SUCCESS 0x00000000
  225. #define MY_CONFIG_PREREMOVE 0x0000000C
  226. #define MY_CONFIG_PRESHUTDOWN 0x00000012
  227. #endif
  228. //
  229. // This structure contains information about a specific
  230. // microport the miniport sits on top of. One of these
  231. // per microport
  232. //
  233. typedef struct _DRIVER_BLOCK
  234. {
  235. // NDIS wrapper handle from NdisInitializeWrapper
  236. NDIS_HANDLE NdisWrapperHandle;
  237. // The NDIS version we manage to register this miniport instance as.
  238. UCHAR MajorNdisVersion;
  239. UCHAR MinorNdisVersion;
  240. struct _DRIVER_BLOCK *NextDriverBlock;
  241. // pointer to driver object this block is associated with
  242. PDRIVER_OBJECT DriverObject;
  243. // intercepted dispatch function for IRP_MJ_PNP
  244. PDRIVER_DISPATCH SavedPnPDispatch;
  245. // Handlers registered by Remote NDIS microport
  246. RM_DEVICE_INIT_HANDLER RmInitializeHandler;
  247. RM_DEVICE_INIT_CMPLT_NOTIFY_HANDLER RmInitCompleteNotifyHandler;
  248. RM_DEVICE_HALT_HANDLER RmHaltHandler;
  249. RM_SHUTDOWN_HANDLER RmShutdownHandler;
  250. RM_UNLOAD_HANDLER RmUnloadHandler;
  251. RM_SEND_MESSAGE_HANDLER RmSendMessageHandler;
  252. RM_RETURN_MESSAGE_HANDLER RmReturnMessageHandler;
  253. // "Global" context for Microport
  254. PVOID MicroportContext;
  255. // list of adapters registered for this Miniport driver.
  256. struct _RNDISMP_ADAPTER *AdapterList;
  257. // number of adapters in use with this driver block
  258. ULONG NumberAdapters;
  259. // sanity check
  260. ULONG Signature;
  261. } DRIVER_BLOCK, *PDRIVER_BLOCK;
  262. typedef
  263. VOID
  264. (*PRNDISMP_MSG_COMPLETE_HANDLER) (
  265. IN struct _RNDISMP_MESSAGE_FRAME * pMsgFrame,
  266. IN NDIS_STATUS Status
  267. );
  268. typedef
  269. BOOLEAN
  270. (*PRNDISMP_MSG_HANDLER_FUNC) (
  271. IN struct _RNDISMP_ADAPTER * pAdapter,
  272. IN PRNDIS_MESSAGE pMessage,
  273. IN PMDL pMdl,
  274. IN ULONG TotalLength,
  275. IN NDIS_HANDLE MicroportMessageContext,
  276. IN NDIS_STATUS ReceiveStatus,
  277. IN BOOLEAN bMessageCopied
  278. );
  279. //
  280. // One of these structures for each NDIS_PACKET that we send.
  281. //
  282. typedef struct _RNDISMP_PACKET_WRAPPER
  283. {
  284. struct _RNDISMP_MESSAGE_FRAME * pMsgFrame;
  285. PNDIS_PACKET pNdisPacket;
  286. struct _RNDISMP_VC * pVc;
  287. // MDL to describe the RNDIS NdisPacket header:
  288. PMDL pHeaderMdl;
  289. // Last MDL in the list of MDLs describing this RNDIS packet.
  290. PMDL pTailMdl;
  291. // Space for the RNDIS Packet header:
  292. UCHAR Packet[sizeof(PVOID)];
  293. } RNDISMP_PACKET_WRAPPER, *PRNDISMP_PACKET_WRAPPER;
  294. //
  295. // Structure used to overlay the MiniportReserved field
  296. // of outgoing (sent) packets.
  297. //
  298. typedef struct _RNDISMP_SEND_PKT_RESERVED
  299. {
  300. // Points to the next packet for multi-packet sends.
  301. PNDIS_PACKET pNext;
  302. // Points to more detailed information about this packet, too much
  303. // to fit into one PVOID.
  304. PRNDISMP_PACKET_WRAPPER pPktWrapper;
  305. } RNDISMP_SEND_PKT_RESERVED, *PRNDISMP_SEND_PKT_RESERVED;
  306. //
  307. // Structure used to TEMPORARILY overlay the MiniportReserved field
  308. // of sent packets -- this is used to link packets in a list pending
  309. // actual transmission from a timeout routine.
  310. //
  311. typedef struct _RNDISMP_SEND_PKT_RESERVED_TEMP
  312. {
  313. LIST_ENTRY Link;
  314. } RNDISMP_SEND_PKT_RESERVED_TEMP, *PRNDISMP_SEND_PKT_RESERVED_TEMP;
  315. //
  316. // Request context - holds information about a pended request (Set or Query)
  317. //
  318. typedef struct _RNDISMP_REQUEST_CONTEXT
  319. {
  320. PNDIS_REQUEST pNdisRequest;
  321. struct _RNDISMP_VC * pVc;
  322. NDIS_OID Oid;
  323. PVOID InformationBuffer;
  324. UINT InformationBufferLength;
  325. PUINT pBytesRead; // for Set
  326. PUINT pBytesWritten; // for Query
  327. PUINT pBytesNeeded;
  328. BOOLEAN bInternal;
  329. NDIS_STATUS CompletionStatus;
  330. ULONG RetryCount;
  331. PNDIS_EVENT pEvent;
  332. } RNDISMP_REQUEST_CONTEXT, *PRNDISMP_REQUEST_CONTEXT;
  333. //
  334. // Message Frame - generic structure to hold context about all
  335. // messages sent via the microport.
  336. //
  337. typedef struct _RNDISMP_MESSAGE_FRAME
  338. {
  339. LIST_ENTRY Link; // used to queue this if
  340. // a response is expected
  341. // from the device.
  342. ULONG RefCount; // Determines when to free
  343. // this message frame.
  344. struct _RNDISMP_ADAPTER * pAdapter;
  345. struct _RNDISMP_VC * pVc;
  346. union
  347. {
  348. PNDIS_PACKET pNdisPacket; // if DATA message
  349. PRNDISMP_REQUEST_CONTEXT pReqContext; // if Request message
  350. };
  351. PMDL pMessageMdl; // what goes to the microport
  352. UINT32 NdisMessageType;// copied from the RNDIS message
  353. UINT32 RequestId; // to match requests/responses
  354. PRNDISMP_MSG_COMPLETE_HANDLER pCallback; // called on completion of message send
  355. ULONG TicksOnQueue;
  356. ULONG TimeSent;
  357. #if THROTTLE_MESSAGES
  358. LIST_ENTRY PendLink; // used to queue this
  359. // pending send to microport
  360. #endif
  361. ULONG Signature;
  362. } RNDISMP_MESSAGE_FRAME, *PRNDISMP_MESSAGE_FRAME;
  363. //
  364. // linked list entry for transport frames (transmit, receive, request)
  365. //
  366. typedef struct _RNDISMP_LIST_ENTRY
  367. {
  368. LIST_ENTRY Link;
  369. } RNDISMP_LIST_ENTRY, *PRNDISMP_LIST_ENTRY;
  370. //
  371. // RNDIS VC states.
  372. //
  373. typedef enum
  374. {
  375. RNDISMP_VC_ALLOCATED = 0,
  376. RNDISMP_VC_CREATING,
  377. RNDISMP_VC_CREATING_ACTIVATE_PENDING,
  378. RNDISMP_VC_CREATING_DELETE_PENDING,
  379. RNDISMP_VC_CREATE_FAILURE,
  380. RNDISMP_VC_CREATED,
  381. RNDISMP_VC_ACTIVATING,
  382. RNDISMP_VC_ACTIVATED,
  383. RNDISMP_VC_DEACTIVATING,
  384. RNDISMP_VC_DEACTIVATED,
  385. RNDISMP_VC_DELETING,
  386. RNDISMP_VC_DELETE_FAIL
  387. } RNDISMP_VC_STATE;
  388. //
  389. // RNDIS Call states.
  390. //
  391. typedef enum
  392. {
  393. RNDISMP_CALL_IDLE
  394. // others TBD
  395. } RNDISMP_CALL_STATE;
  396. #define NULL_DEVICE_CONTEXT 0
  397. //
  398. // All information about a single VC/call.
  399. //
  400. typedef struct _RNDISMP_VC
  401. {
  402. // link to list of VCs on adapter.
  403. LIST_ENTRY VcList;
  404. // owning adapter
  405. struct _RNDISMP_ADAPTER * pAdapter;
  406. // VC handle sent to the device, also our hash lookup key.
  407. UINT32 VcId;
  408. // base VC state
  409. RNDISMP_VC_STATE VcState;
  410. // call state, relevant only for devices that are call managers.
  411. RNDISMP_CALL_STATE CallState;
  412. ULONG RefCount;
  413. // NDIS Wrapper's handle for this Vc
  414. NDIS_HANDLE NdisVcHandle;
  415. // remote device's context for this VC
  416. RNDIS_HANDLE DeviceVcContext;
  417. RNDISMP_SPIN_LOCK Lock;
  418. // sends on this VC that haven't been completed.
  419. ULONG PendingSends;
  420. // receive indications that haven't been returned to us.
  421. ULONG PendingReceives;
  422. // NDIS requests that haven't been completed.
  423. ULONG PendingRequests;
  424. // VC activation (or call setup) parameters.
  425. PCO_CALL_PARAMETERS pCallParameters;
  426. } RNDISMP_VC, *PRNDISMP_VC;
  427. //
  428. // VC hash table.
  429. //
  430. #define RNDISMP_VC_HASH_TABLE_SIZE 41
  431. typedef struct _RNDISMP_VC_HASH_TABLE
  432. {
  433. ULONG NumEntries;
  434. LIST_ENTRY HashEntry[RNDISMP_VC_HASH_TABLE_SIZE];
  435. } RNDISMP_VC_HASH_TABLE, *PRNDISMP_VC_HASH_TABLE;
  436. #define RNDISMP_HASH_VCID(_VcId) ((_VcId) % RNDISMP_VC_HASH_TABLE_SIZE)
  437. //
  438. // High and low watermarks for messages pending
  439. // at the microport
  440. //
  441. #define RNDISMP_PENDED_SEND_HIWAT 0xffff
  442. #define RNDISMP_PENDED_SEND_LOWAT 0xfff
  443. typedef VOID (*RM_MULTIPLE_SEND_HANDLER) ();
  444. //
  445. // This structure contains all the information about a single
  446. // adapter that this driver is controlling
  447. //
  448. typedef struct _RNDISMP_ADAPTER
  449. {
  450. // This is the handle given by the wrapper for calling NDIS functions.
  451. NDIS_HANDLE MiniportAdapterHandle;
  452. // pointer to next adapter in list hanging off driver block
  453. struct _RNDISMP_ADAPTER *NextAdapter;
  454. // pointer to driver block for this adapter
  455. PDRIVER_BLOCK DriverBlock;
  456. // Friendly name:
  457. ANSI_STRING FriendlyNameAnsi;
  458. UNICODE_STRING FriendlyNameUnicode;
  459. #if THROTTLE_MESSAGES
  460. // Counters for messages pending at the microport
  461. ULONG HiWatPendedMessages;
  462. ULONG LoWatPendedMessages;
  463. ULONG CurPendedMessages;
  464. // Messages not yet sent to microport.
  465. LIST_ENTRY WaitingMessageList;
  466. BOOLEAN SendInProgress;
  467. #endif // THROTTLE_MESSAGES
  468. // Messages sent to microport, awaiting completion
  469. LIST_ENTRY PendingAtMicroportList;
  470. BOOLEAN SendProcessInProgress;
  471. LIST_ENTRY PendingSendProcessList;
  472. NDIS_TIMER SendProcessTimer;
  473. // Pool of RNDISMP_MESSAGE_FRAME structures
  474. NPAGED_LOOKASIDE_LIST MsgFramePool;
  475. BOOLEAN MsgFramePoolAlloced;
  476. RNDIS_REQUEST_ID RequestId;
  477. // Receive Routine Data Area
  478. NDIS_HANDLE ReceivePacketPool;
  479. NDIS_HANDLE ReceiveBufferPool;
  480. ULONG InitialReceiveFrames;
  481. ULONG MaxReceiveFrames;
  482. NPAGED_LOOKASIDE_LIST RcvFramePool;
  483. BOOLEAN RcvFramePoolAlloced;
  484. BOOLEAN IndicatingReceives;
  485. // Messages to be processed.
  486. LIST_ENTRY PendingRcvMessageList;
  487. NDIS_TIMER IndicateTimer;
  488. // handlers registered by Remote NDIS microport
  489. RM_DEVICE_INIT_HANDLER RmInitializeHandler;
  490. RM_DEVICE_INIT_CMPLT_NOTIFY_HANDLER RmInitCompleteNotifyHandler;
  491. RM_DEVICE_HALT_HANDLER RmHaltHandler;
  492. RM_SHUTDOWN_HANDLER RmShutdownHandler;
  493. RM_SEND_MESSAGE_HANDLER RmSendMessageHandler;
  494. RM_RETURN_MESSAGE_HANDLER RmReturnMessageHandler;
  495. // handler for DoMultipleSend
  496. RM_MULTIPLE_SEND_HANDLER MultipleSendFunc;
  497. // context for microport adapter
  498. NDIS_HANDLE MicroportAdapterContext;
  499. // pointer to list of OIDs supported
  500. PNDIS_OID SupportedOIDList;
  501. // size of OID list
  502. UINT SupportedOIDListSize;
  503. // pointer to list of flags indicating whether the OID is driver or device supported
  504. PUINT OIDHandlerList;
  505. // size of OID handler list
  506. UINT OIDHandlerListSize;
  507. // pointer to list of Driver OIDs
  508. PNDIS_OID DriverOIDList;
  509. // size of Driver OID list, in OIDs
  510. UINT NumDriverOIDs;
  511. // total number of OIDs we support
  512. UINT NumOIDSupported;
  513. // medium type supported by the device.
  514. NDIS_MEDIUM Medium;
  515. // device flags reported by the device.
  516. ULONG DeviceFlags;
  517. // max NDIS_PACKETs that can be sent in one RNDIS message
  518. ULONG MaxPacketsPerMessage;
  519. BOOLEAN bMultiPacketSupported;
  520. // max message size supported for receive by the microport
  521. ULONG MaxReceiveSize;
  522. // max message size supported by the device
  523. ULONG MaxTransferSize;
  524. // alignment required by the device
  525. ULONG AlignmentIncr;
  526. ULONG AlignmentMask;
  527. // list of message frames pending completion by the device
  528. LIST_ENTRY PendingFrameList;
  529. // synchronization
  530. NDIS_SPIN_LOCK Lock;
  531. // timer to see if we need to send a keep alive message
  532. NDIS_TIMER KeepAliveTimer;
  533. BOOLEAN TimerCancelled;
  534. // timer tick saved last time a message was received from device
  535. ULONG LastMessageFromDevice;
  536. // used by check for hang handler to determine if the device is in trouble
  537. BOOLEAN NeedReset;
  538. // are we waiting for a response to NdisReset?
  539. BOOLEAN ResetPending;
  540. // used by check for hang handler to determine if the device is in trouble
  541. BOOLEAN KeepAliveMessagePending;
  542. // are we initializing?
  543. BOOLEAN Initing;
  544. // are we halting?
  545. BOOLEAN Halting;
  546. // to wait until we complete sending the Halt message
  547. NDIS_EVENT HaltWaitEvent;
  548. // request ID of last Keepalive message we have sent
  549. RNDIS_REQUEST_ID KeepAliveMessagePendingId;
  550. PRNDIS_INITIALIZE_COMPLETE pInitCompleteMessage;
  551. // are we running on Win9x (WinMe)?
  552. BOOLEAN bRunningOnWin9x;
  553. // are we running on Win98 Gold?
  554. BOOLEAN bRunningOnWin98Gold;
  555. // CONDIS - Vc hash table
  556. PRNDISMP_VC_HASH_TABLE pVcHashTable;
  557. ULONG LastVcId;
  558. // Statistics
  559. RNDISMP_ADAPTER_STATS Statistics;
  560. ULONG MaxSendCompleteTime;
  561. // FDO for this device.
  562. PVOID pDeviceObject;
  563. // PDO for this device.
  564. PVOID pPhysDeviceObject;
  565. // MAC options
  566. ULONG MacOptions;
  567. // sanity check
  568. ULONG Signature;
  569. #ifdef BUILD_WIN9X
  570. MY_CMCONFIGHANDLER NdisCmConfigHandler;
  571. MY_DEVNODE DevNode;
  572. ULONG WrapContextOffset;
  573. #endif
  574. #if DBG
  575. ULONG MicroportReceivesOutstanding;
  576. PUCHAR pSendLogBuffer;
  577. ULONG LogBufferSize;
  578. PUCHAR pSendLogWrite;
  579. #endif // DBG
  580. } RNDISMP_ADAPTER, *PRNDISMP_ADAPTER;
  581. typedef
  582. VOID
  583. (*RM_MULTIPLE_SEND_HANDLER) (
  584. IN PRNDISMP_ADAPTER pAdapter,
  585. IN PRNDISMP_VC pVc OPTIONAL,
  586. IN PPNDIS_PACKET PacketArray,
  587. IN UINT NumberofPackets);
  588. //
  589. // Structure to keep context about a single received RNDIS message.
  590. //
  591. typedef struct _RNDISMP_RECV_MSG_CONTEXT
  592. {
  593. LIST_ENTRY Link;
  594. NDIS_HANDLE MicroportMessageContext;
  595. PMDL pMdl;
  596. ULONG TotalLength;
  597. PRNDIS_MESSAGE pMessage;
  598. NDIS_STATUS ReceiveStatus;
  599. BOOLEAN bMessageCopied;
  600. RM_CHANNEL_TYPE ChannelType;
  601. } RNDISMP_RECV_MSG_CONTEXT, *PRNDISMP_RECV_MSG_CONTEXT;
  602. //
  603. // Structure to keep context about a single received RNDIS_PACKET -message-.
  604. // Note that this can contain more than one packet. We store a pointer to
  605. // this structure in our reserved section of each received NDIS_PACKET.
  606. //
  607. typedef struct _RNDISMP_RECV_DATA_FRAME
  608. {
  609. NDIS_HANDLE MicroportMessageContext;
  610. union {
  611. PMDL pMicroportMdl;
  612. PRNDIS_MESSAGE pLocalMessageCopy;
  613. };
  614. ULONG ReturnsPending;
  615. BOOLEAN bMessageCopy; // did we make a copy?
  616. } RNDISMP_RECV_DATA_FRAME, *PRNDISMP_RECV_DATA_FRAME;
  617. //
  618. // Per NDIS_PACKET context for received packets. This goes into MiniportReserved.
  619. //
  620. typedef struct _RNDISMP_RECV_PKT_RESERVED
  621. {
  622. PRNDISMP_RECV_DATA_FRAME pRcvFrame;
  623. PRNDISMP_VC pVc;
  624. } RNDISMP_RECV_PKT_RESERVED, *PRNDISMP_RECV_PKT_RESERVED;
  625. //
  626. // Used to overlay ProtocolReserved in a packet queued for indicating up.
  627. //
  628. typedef struct _RNDISMP_RECV_PKT_LINKAGE
  629. {
  630. LIST_ENTRY Link;
  631. } RNDISMP_RECV_PKT_LINKAGE, *PRNDISMP_RECV_PKT_LINKAGE;
  632. //
  633. // Global Data
  634. //
  635. extern DRIVER_BLOCK RndismpMiniportBlockListHead;
  636. extern UINT RndismpNumMicroports;
  637. extern NDIS_SPIN_LOCK RndismpGlobalLock;
  638. extern NDIS_OID RndismpSupportedOids[];
  639. extern UINT RndismpSupportedOidsNum;
  640. extern NDIS_PHYSICAL_ADDRESS HighestAcceptableMax;
  641. #if DBG
  642. extern UINT RndismpDebugFlags;
  643. #endif
  644. //
  645. // Macros
  646. //
  647. // Given a request message type value, return its completion message type
  648. #define RNDIS_COMPLETION(_Type) ((_Type) | 0x80000000)
  649. // Convert an RNdisMediumXXX value to its NdisMediumXXX equivalent
  650. #define RNDIS_TO_NDIS_MEDIUM(_RndisMedium) ((NDIS_MEDIUM)(_RndisMedium))
  651. #define RNDISMP_GET_ALIGNED_LENGTH(_AlignedLength, _InputLen, _pAdapter) \
  652. { \
  653. ULONG _Length = _InputLen; \
  654. if (_Length == 0) \
  655. (_AlignedLength) = 0; \
  656. else \
  657. (_AlignedLength) = ((_Length + (_pAdapter)->AlignmentIncr) & \
  658. (_pAdapter)->AlignmentMask); \
  659. }
  660. // The minimum MessageLength expected in an RNDIS message of a given type.
  661. #define RNDISMP_MIN_MESSAGE_LENGTH(_MsgTypeField) \
  662. FIELD_OFFSET(RNDIS_MESSAGE, Message) + sizeof(((PRNDIS_MESSAGE)0)->Message._MsgTypeField##)
  663. // memory move macro
  664. #define RNDISMP_MOVE_MEM(dest,src,size) NdisMoveMemory(dest,src,size)
  665. // Macros to extract high and low bytes of a word.
  666. #define MSB(Value) ((UCHAR)((((ULONG)Value) >> 8) & 0xff))
  667. #define LSB(Value) ((UCHAR)(((ULONG)Value) & 0xff))
  668. // Acquire the adapter lock
  669. #define RNDISMP_ACQUIRE_ADAPTER_LOCK(_pAdapter) \
  670. NdisAcquireSpinLock(&(_pAdapter)->Lock);
  671. // Release the adapter lock
  672. #define RNDISMP_RELEASE_ADAPTER_LOCK(_pAdapter) \
  673. NdisReleaseSpinLock(&(_pAdapter)->Lock);
  674. // Increment adapter statistics.
  675. #define RNDISMP_INCR_STAT(_pAdapter, _StatsCount) \
  676. NdisInterlockedIncrement(&(_pAdapter)->Statistics._StatsCount)
  677. // Get adapter statistics
  678. #define RNDISMP_GET_ADAPTER_STATS(_pAdapter, _StatsCount) \
  679. ((_pAdapter)->Statistics._StatsCount)
  680. // Get the send packet reserved field
  681. #define PRNDISMP_RESERVED_FROM_SEND_PACKET(_Packet) \
  682. ((PRNDISMP_SEND_PKT_RESERVED)((_Packet)->MiniportReserved))
  683. #define PRNDISMP_RESERVED_TEMP_FROM_SEND_PACKET(_Packet) \
  684. ((PRNDISMP_SEND_PKT_RESERVED_TEMP)((_Packet)->MiniportReserved))
  685. #define PRNDISMP_RESERVED_FROM_RECV_PACKET(_Packet) \
  686. ((PRNDISMP_RECV_PKT_RESERVED)((_Packet)->MiniportReserved))
  687. // store receive frame context in miniport reserved field
  688. #define RECEIVE_FRAME_TO_NDIS_PACKET(_Packet, _ReceiveFrame) \
  689. { \
  690. PRNDISMP_RECEIVE_FRAME *TmpPtr; \
  691. TmpPtr = (PRNDISMP_RECEIVE_FRAME *) \
  692. &(_Packet->MiniportReserved); \
  693. *TmpPtr = _ReceiveFrame; \
  694. }
  695. // Get adapter context from handle passed in NDIS routines
  696. #define PRNDISMP_ADAPTER_FROM_CONTEXT_HANDLE(_Handle) \
  697. ((PRNDISMP_ADAPTER)(_Handle))
  698. // Get miniport context handle from adapter context
  699. #define CONTEXT_HANDLE_FROM_PRNDISMP_ADAPTER(_Ptr) \
  700. ((NDIS_HANDLE)(_Ptr))
  701. // Get VC context from handle passed in from NDIS
  702. #define PRNDISMP_VC_FROM_CONTEXT_HANDLE(_Handle) \
  703. ((PRNDISMP_VC)(_Handle))
  704. // Get miniport context from VC
  705. #define CONTEXT_HANDLE_FROM_PRNDISMP_VC(_pVc) \
  706. ((NDIS_HANDLE)(_Vc))
  707. // Get message frame from message handle
  708. #define MESSAGE_FRAME_FROM_HANDLE(_Handle) \
  709. ((PRNDISMP_MESSAGE_FRAME)(_Handle))
  710. // Get a pointer to the data buff in an RNDIS_PACKET
  711. #define GET_PTR_TO_RNDIS_DATA_BUFF(_Message) \
  712. ((PVOID) ((PUCHAR)(_Message) + _Message->DataOffset))
  713. // Get a pointer to the OOBD data in an RNDIS_PACKET
  714. #define GET_PTR_TO_OOB_DATA(_Message) \
  715. ((PVOID) ((PUCHAR)(_Message) + _Message->OOBDataOffset))
  716. // Get a pointer to the per packet info in an RNDIS_PACKET
  717. #define GET_PTR_TO_PER_PACKET_INFO(_Message) \
  718. ((PVOID) ((PUCHAR)(_Message) + _Message->PerPacketInfoOffset))
  719. // Get an offset to the data buff in an RNDIS_PACKET
  720. #define GET_OFFSET_TO_RNDIS_DATA_BUFF(_Message) \
  721. (sizeof(RNDIS_PACKET))
  722. // Get an offset to the OOBD data in an RNDIS_PACKET
  723. #define GET_OFFSET_TO_OOB_DATA(_Message) \
  724. (sizeof(RNDIS_PACKET) + Message->DataLength)
  725. // Get an offset to the per packet info in an RNDIS_PACKET
  726. #define GET_OFFSET_TO_PER_PACKET_INFO(_Message) \
  727. (sizeof(RNDIS_PACKET) + _Message->DataLength + _Message->OOBDataLength)
  728. #define RNDISMP_GET_INFO_BUFFER_FROM_QUERY_MSG(_Message) \
  729. ((PUCHAR)(_Message) + (_Message)->InformationBufferOffset)
  730. #define MIN(x,y) ((x > y) ? y : x)
  731. // Return the virtual address for a received message MDL.
  732. #if NDIS_WDM
  733. #define RNDISMP_GET_MDL_ADDRESS(_pMdl) MmGetSystemAddressForMdl(_pMdl)
  734. #else
  735. #define RNDISMP_GET_MDL_ADDRESS(_pMdl) MmGetSystemAddressForMdlSafe(_pMdl, NormalPagePriority)
  736. #endif
  737. // Return the MDL chained to this MDL
  738. #define RNDISMP_GET_MDL_NEXT(_pMdl) ((_pMdl)->Next)
  739. // Return the MDL length
  740. #define RNDISMP_GET_MDL_LENGTH(_pMdl) MmGetMdlByteCount(_pMdl)
  741. // Access the RNDIS message from our Message Frame structure.
  742. #define RNDISMP_GET_MSG_FROM_FRAME(_pMsgFrame) \
  743. RNDISMP_GET_MDL_ADDRESS(_pMsgFrame->pMessageMdl)
  744. // Return an RNDIS message back to the microport.
  745. #if DBG
  746. #define RNDISMP_RETURN_TO_MICROPORT(_pAdapter, _pMdl, _MicroportMsgContext) \
  747. { \
  748. NdisInterlockedDecrement(&(_pAdapter)->MicroportReceivesOutstanding); \
  749. (_pAdapter)->RmReturnMessageHandler((_pAdapter)->MicroportAdapterContext,\
  750. (_pMdl), \
  751. (_MicroportMsgContext)); \
  752. }
  753. #else
  754. #define RNDISMP_RETURN_TO_MICROPORT(_pAdapter, _pMdl, _MicroportMsgContext) \
  755. (_pAdapter)->RmReturnMessageHandler((_pAdapter)->MicroportAdapterContext,\
  756. (_pMdl), \
  757. (_MicroportMsgContext))
  758. #endif // DBG
  759. // Send an RNDIS message to the microport.
  760. #if THROTTLE_MESSAGES
  761. #define RNDISMP_SEND_TO_MICROPORT(_pAdapter, _pMsgFrame, _bQueueForResponse, _CallbackFunc) \
  762. { \
  763. TRACE2(("Send: Adapter %x, MsgFrame %x, Mdl %x\n", \
  764. _pAdapter, _pMsgFrame, _pMsgFrame->pMessageMdl)); \
  765. (_pMsgFrame)->pCallback = _CallbackFunc; \
  766. QueueMessageToMicroport(_pAdapter, _pMsgFrame, _bQueueForResponse); \
  767. }
  768. #else
  769. #define RNDISMP_SEND_TO_MICROPORT(_pAdapter, _pMsgFrame, _bQueueForResponse, _CallbackFunc) \
  770. { \
  771. (_pMsgFrame)->pCallback = _CallbackFunc; \
  772. if (_bQueueForResponse) \
  773. { \
  774. RNDISMP_ACQUIRE_ADAPTER_LOCK(_pAdapter); \
  775. InsertTailList(&(_pAdapter)->PendingFrameList, &(_pMsgFrame)->Link);\
  776. RNDISMP_RELEASE_ADAPTER_LOCK(_pAdapter); \
  777. } \
  778. (_pAdapter)->RmSendMessageHandler((_pAdapter)->MicroportAdapterContext, \
  779. (_pMsgFrame)->pMessageMdl, \
  780. (_pMsgFrame)); \
  781. }
  782. #endif // THROTTLE_MESSAGES
  783. // Return the handler function for a given message type.
  784. #define RNDISMP_GET_MSG_HANDLER(_pMsgHandlerFunc, _MessageType) \
  785. { \
  786. switch (_MessageType) \
  787. { \
  788. case REMOTE_NDIS_HALT_MSG: \
  789. _pMsgHandlerFunc = HaltMessage; \
  790. break; \
  791. case REMOTE_NDIS_PACKET_MSG: \
  792. _pMsgHandlerFunc = ReceivePacketMessage; \
  793. break; \
  794. case REMOTE_NDIS_INDICATE_STATUS_MSG: \
  795. _pMsgHandlerFunc = IndicateStatusMessage; \
  796. break; \
  797. case REMOTE_NDIS_QUERY_CMPLT: \
  798. case REMOTE_NDIS_SET_CMPLT: \
  799. _pMsgHandlerFunc = QuerySetCompletionMessage; \
  800. break; \
  801. case REMOTE_NDIS_KEEPALIVE_MSG: \
  802. _pMsgHandlerFunc = KeepAliveMessage; \
  803. break; \
  804. case REMOTE_NDIS_KEEPALIVE_CMPLT: \
  805. _pMsgHandlerFunc = KeepAliveCompletionMessage; \
  806. break; \
  807. case REMOTE_NDIS_RESET_CMPLT: \
  808. _pMsgHandlerFunc = ResetCompletionMessage; \
  809. break; \
  810. case REMOTE_NDIS_INITIALIZE_CMPLT: \
  811. _pMsgHandlerFunc = InitCompletionMessage; \
  812. break; \
  813. case REMOTE_CONDIS_MP_CREATE_VC_CMPLT: \
  814. _pMsgHandlerFunc = ReceiveCreateVcComplete; \
  815. break; \
  816. case REMOTE_CONDIS_MP_DELETE_VC_CMPLT: \
  817. _pMsgHandlerFunc = ReceiveDeleteVcComplete; \
  818. break; \
  819. case REMOTE_CONDIS_MP_ACTIVATE_VC_CMPLT: \
  820. _pMsgHandlerFunc = ReceiveActivateVcComplete; \
  821. break; \
  822. case REMOTE_CONDIS_MP_DEACTIVATE_VC_CMPLT: \
  823. _pMsgHandlerFunc = ReceiveDeactivateVcComplete; \
  824. break; \
  825. default: \
  826. _pMsgHandlerFunc = UnknownMessage; \
  827. break; \
  828. } \
  829. }
  830. //
  831. // Look up a message frame on the adapter given a request ID. If found,
  832. // remove it from the pending list and return it.
  833. //
  834. #define RNDISMP_LOOKUP_PENDING_MESSAGE(_pMsgFrame, _pAdapter, _ReqId) \
  835. { \
  836. PLIST_ENTRY _pEnt; \
  837. PRNDISMP_MESSAGE_FRAME _pFrame; \
  838. \
  839. (_pMsgFrame) = NULL; \
  840. RNDISMP_ACQUIRE_ADAPTER_LOCK(_pAdapter); \
  841. for (_pEnt = (_pAdapter)->PendingFrameList.Flink; \
  842. _pEnt != &(_pAdapter)->PendingFrameList; \
  843. _pEnt = _pEnt->Flink) \
  844. { \
  845. _pFrame = CONTAINING_RECORD(_pEnt, RNDISMP_MESSAGE_FRAME, Link); \
  846. if (_pFrame->RequestId == (_ReqId)) \
  847. { \
  848. RemoveEntryList(_pEnt); \
  849. (_pMsgFrame) = _pFrame; \
  850. break; \
  851. } \
  852. } \
  853. RNDISMP_RELEASE_ADAPTER_LOCK(_pAdapter); \
  854. }
  855. #if DBG_TIME_STAMPS
  856. #define RNDISMP_GET_TIME_STAMP(_pTs) \
  857. { \
  858. LONGLONG systime_usec; \
  859. NdisGetCurrentSystemTime((PVOID)&systime_usec); \
  860. *_pTs = (ULONG)((*(PULONG)&systime_usec)/1000); \
  861. }
  862. #else
  863. #define RNDISMP_GET_TIME_STAMP(_pTs)
  864. #endif
  865. #define RNDISMP_INIT_LOCK(_pLock) \
  866. NdisAllocateSpinLock((_pLock));
  867. #define RNDISMP_ACQUIRE_LOCK(_pLock) \
  868. NdisAcquireSpinLock((_pLock));
  869. #define RNDISMP_RELEASE_LOCK(_pLock) \
  870. NdisReleaseSpinLock((_pLock));
  871. #define RNDISMP_ACQUIRE_LOCK_DPC(_pLock) \
  872. NdisDprAcquireSpinLock((_pLock));
  873. #define RNDISMP_RELEASE_LOCK_DPC(_pLock) \
  874. NdisDprReleaseSpinLock((_pLock));
  875. #define RNDISMP_INIT_VC_LOCK(_pVc) \
  876. RNDISMP_INIT_LOCK(&((_pVc)->Lock))
  877. #define RNDISMP_ACQUIRE_VC_LOCK(_pVc) \
  878. RNDISMP_ACQUIRE_LOCK(&((_pVc))->Lock)
  879. #define RNDISMP_RELEASE_VC_LOCK(_pVc) \
  880. RNDISMP_RELEASE_LOCK(&((_pVc))->Lock)
  881. #define RNDISMP_ACQUIRE_VC_LOCK_DPC(_pVc) \
  882. RNDISMP_ACQUIRE_LOCK_DPC(&((_pVc))->Lock)
  883. #define RNDISMP_RELEASE_VC_LOCK_DPC(_pVc) \
  884. RNDISMP_RELEASE_LOCK_DPC(&((_pVc))->Lock)
  885. #define RNDISMP_REF_VC(_pVc) \
  886. NdisInterlockedIncrement(&(_pVc)->RefCount);
  887. #define RNDISMP_DEREF_VC(_pVc, _pRefCount) \
  888. { \
  889. ULONG _RefCount; \
  890. \
  891. RNDISMP_ACQUIRE_VC_LOCK(_pVc); \
  892. \
  893. RNDISMP_DEREF_VC_LOCKED(_pVc, &_RefCount); \
  894. *(_pRefCount) = _RefCount; \
  895. if (_RefCount != 0) \
  896. { \
  897. RNDISMP_RELEASE_VC_LOCK(_pVc); \
  898. } \
  899. }
  900. #define RNDISMP_DEREF_VC_LOCKED(_pVc, _pRefCount) \
  901. { \
  902. ULONG __RefCount; \
  903. NDIS_HANDLE __NdisVcHandle; \
  904. \
  905. __RefCount = NdisInterlockedDecrement(&(_pVc)->RefCount); \
  906. *(_pRefCount) = __RefCount; \
  907. if (__RefCount == 0) \
  908. { \
  909. RNDISMP_RELEASE_VC_LOCK(_pVc); \
  910. DeallocateVc(_pVc); \
  911. } \
  912. else \
  913. { \
  914. if ((__RefCount == 1) && \
  915. ((_pVc)->VcState == RNDISMP_VC_DEACTIVATED)) \
  916. { \
  917. __NdisVcHandle = (_pVc)->NdisVcHandle; \
  918. (_pVc)->VcState = RNDISMP_VC_CREATED; \
  919. NdisInterlockedIncrement(&(_pVc)->RefCount); \
  920. \
  921. RNDISMP_RELEASE_VC_LOCK(_pVc); \
  922. \
  923. NdisMCoDeactivateVcComplete(NDIS_STATUS_SUCCESS, \
  924. __NdisVcHandle); \
  925. \
  926. RNDISMP_ACQUIRE_VC_LOCK(_pVc); \
  927. \
  928. __RefCount = NdisInterlockedDecrement(&(_pVc)->RefCount); \
  929. *(_pRefCount) = __RefCount; \
  930. if (__RefCount == 0) \
  931. { \
  932. RNDISMP_RELEASE_VC_LOCK(_pVc); \
  933. DeallocateVc(_pVc); \
  934. } \
  935. } \
  936. } \
  937. }
  938. //
  939. // Prototypes for functions in rndismp.c
  940. //
  941. NTSTATUS
  942. DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath);
  943. NDIS_STATUS
  944. RndisMInitializeWrapper(OUT PNDIS_HANDLE pNdisWrapperHandle,
  945. IN PVOID MicroportContext,
  946. IN PVOID DriverObject,
  947. IN PVOID RegistryPath,
  948. IN PRNDIS_MICROPORT_CHARACTERISTICS pCharacteristics);
  949. VOID
  950. RndismpUnload(IN PDRIVER_OBJECT pDriverObject);
  951. NTSTATUS
  952. DllUnload(VOID);
  953. VOID
  954. RndismpHalt(IN NDIS_HANDLE MiniportAdapterContext);
  955. VOID
  956. RndismpInternalHalt(IN NDIS_HANDLE MiniportAdapterContext,
  957. IN BOOLEAN bCalledFromHalt);
  958. NDIS_STATUS
  959. RndismpReconfigure(OUT PNDIS_STATUS pStatus,
  960. IN NDIS_HANDLE MiniportAdapterContext,
  961. IN NDIS_HANDLE ConfigContext);
  962. NDIS_STATUS
  963. RndismpReset(OUT PBOOLEAN AddressingReset,
  964. IN NDIS_HANDLE MiniportAdapterContext);
  965. BOOLEAN
  966. RndismpCheckForHang(IN NDIS_HANDLE MiniportAdapterContext);
  967. NDIS_STATUS
  968. RndismpInitialize(OUT PNDIS_STATUS OpenErrorStatus,
  969. OUT PUINT SelectedMediumIndex,
  970. IN PNDIS_MEDIUM MediumArray,
  971. IN UINT MediumArraySize,
  972. IN NDIS_HANDLE MiniportAdapterHandle,
  973. IN NDIS_HANDLE ConfigurationHandle);
  974. VOID
  975. RndisMSendComplete(IN NDIS_HANDLE MiniportAdapterContext,
  976. IN NDIS_HANDLE RndisMessageHandle,
  977. IN NDIS_STATUS SendStatus);
  978. BOOLEAN
  979. InitCompletionMessage(IN PRNDISMP_ADAPTER pAdapter,
  980. IN PRNDIS_MESSAGE pMessage,
  981. IN PMDL pMdl,
  982. IN ULONG TotalLength,
  983. IN NDIS_HANDLE MicroportMessageContext,
  984. IN NDIS_STATUS ReceiveStatus,
  985. IN BOOLEAN bMessageCopied);
  986. BOOLEAN
  987. HaltMessage(IN PRNDISMP_ADAPTER pAdapter,
  988. IN PRNDIS_MESSAGE pMessage,
  989. IN PMDL pMdl,
  990. IN ULONG TotalLength,
  991. IN NDIS_HANDLE MicroportMessageContext,
  992. IN NDIS_STATUS ReceiveStatus,
  993. IN BOOLEAN bMessageCopied);
  994. BOOLEAN
  995. ResetCompletionMessage(IN PRNDISMP_ADAPTER pAdapter,
  996. IN PRNDIS_MESSAGE pMessage,
  997. IN PMDL pMdl,
  998. IN ULONG TotalLength,
  999. IN NDIS_HANDLE MicroportMessageContext,
  1000. IN NDIS_STATUS ReceiveStatus,
  1001. IN BOOLEAN bMessageCopied);
  1002. BOOLEAN
  1003. KeepAliveCompletionMessage(IN PRNDISMP_ADAPTER pAdapter,
  1004. IN PRNDIS_MESSAGE pMessage,
  1005. IN PMDL pMdl,
  1006. IN ULONG TotalLength,
  1007. IN NDIS_HANDLE MicroportMessageContext,
  1008. IN NDIS_STATUS ReceiveStatus,
  1009. IN BOOLEAN bMessageCopied);
  1010. BOOLEAN
  1011. KeepAliveMessage(IN PRNDISMP_ADAPTER pAdapter,
  1012. IN PRNDIS_MESSAGE pMessage,
  1013. IN PMDL pMdl,
  1014. IN ULONG TotalLength,
  1015. IN NDIS_HANDLE MicroportMessageContext,
  1016. IN NDIS_STATUS ReceiveStatus,
  1017. IN BOOLEAN bMessageCopied);
  1018. VOID
  1019. RndismpShutdownHandler(IN NDIS_HANDLE MiniportAdapterContext);
  1020. VOID
  1021. RndismpDisableInterrupt(IN NDIS_HANDLE MiniportAdapterContext);
  1022. VOID
  1023. RndismpEnableInterrupt(IN NDIS_HANDLE MiniportAdapterContext);
  1024. VOID
  1025. RndismpHandleInterrupt(IN NDIS_HANDLE MiniportAdapterContext);
  1026. VOID
  1027. RndismpIsr(OUT PBOOLEAN InterruptRecognized,
  1028. OUT PBOOLEAN QueueDpc,
  1029. IN PVOID Context);
  1030. VOID
  1031. CompleteSendHalt(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1032. IN NDIS_STATUS SendStatus);
  1033. VOID
  1034. CompleteSendReset(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1035. IN NDIS_STATUS SendStatus);
  1036. VOID
  1037. CompleteMiniportReset(IN PRNDISMP_ADAPTER pAdapter,
  1038. IN NDIS_STATUS ResetStatus,
  1039. IN BOOLEAN AddressingReset);
  1040. NDIS_STATUS
  1041. ReadAndSetRegistryParameters(IN PRNDISMP_ADAPTER pAdapter,
  1042. IN NDIS_HANDLE ConfigurationContext);
  1043. NDIS_STATUS
  1044. SendConfiguredParameter(IN PRNDISMP_ADAPTER pAdapter,
  1045. IN NDIS_HANDLE ConfigHandle,
  1046. IN PNDIS_STRING pParameterName,
  1047. IN PNDIS_STRING pParameterType);
  1048. VOID
  1049. RndismpPnPEventNotify(IN NDIS_HANDLE MiniportAdapterContext,
  1050. IN NDIS_DEVICE_PNP_EVENT EventCode,
  1051. IN PVOID InformationBuffer,
  1052. IN ULONG InformationBufferLength);
  1053. //
  1054. // Prototypes for functions in init.c
  1055. //
  1056. NDIS_STATUS
  1057. SetupSendQueues(IN PRNDISMP_ADAPTER Adapter);
  1058. NDIS_STATUS
  1059. SetupReceiveQueues(IN PRNDISMP_ADAPTER Adapter);
  1060. NDIS_STATUS
  1061. AllocateTransportResources(IN PRNDISMP_ADAPTER Adapter);
  1062. VOID
  1063. FreeTransportResources(IN PRNDISMP_ADAPTER Adapter);
  1064. VOID
  1065. FreeSendResources(IN PRNDISMP_ADAPTER Adapter);
  1066. VOID
  1067. FreeReceiveResources(IN PRNDISMP_ADAPTER Adapter);
  1068. //
  1069. // Prototypes for functions in receive.c
  1070. //
  1071. VOID
  1072. RndismpReturnPacket(IN NDIS_HANDLE MiniportAdapterContext,
  1073. IN PNDIS_PACKET Packet);
  1074. VOID
  1075. DereferenceRcvFrame(IN PRNDISMP_RECV_DATA_FRAME pRcvFrame,
  1076. IN PRNDISMP_ADAPTER pAdapter);
  1077. VOID
  1078. RndisMIndicateReceive(IN NDIS_HANDLE MiniportAdapterContext,
  1079. IN PMDL pMessageHead,
  1080. IN NDIS_HANDLE MicroportMessageContext,
  1081. IN RM_CHANNEL_TYPE ChannelType,
  1082. IN NDIS_STATUS ReceiveStatus);
  1083. VOID
  1084. IndicateReceive(IN PRNDISMP_ADAPTER pAdapter,
  1085. IN PRNDISMP_VC pVc OPTIONAL,
  1086. IN PRNDISMP_RECV_DATA_FRAME pRcvFrame,
  1087. IN PPNDIS_PACKET PacketArray,
  1088. IN ULONG NumberOfPackets,
  1089. IN NDIS_STATUS ReceiveStatus);
  1090. PRNDIS_MESSAGE
  1091. CoalesceMultiMdlMessage(IN PMDL pMdl,
  1092. IN ULONG TotalLength);
  1093. VOID
  1094. FreeRcvMessageCopy(IN PRNDIS_MESSAGE pMessage);
  1095. BOOLEAN
  1096. ReceivePacketMessage(IN PRNDISMP_ADAPTER pAdapter,
  1097. IN PRNDIS_MESSAGE pMessage,
  1098. IN PMDL pMdl,
  1099. IN ULONG TotalLength,
  1100. IN NDIS_HANDLE MicroportMessageContext,
  1101. IN NDIS_STATUS ReceiveStatus,
  1102. IN BOOLEAN bMessageCopied);
  1103. BOOLEAN
  1104. ReceivePacketMessageRaw(IN PRNDISMP_ADAPTER pAdapter,
  1105. IN PRNDIS_MESSAGE pMessage,
  1106. IN PMDL pMdl,
  1107. IN ULONG TotalLength,
  1108. IN NDIS_HANDLE MicroportMessageContext,
  1109. IN NDIS_STATUS ReceiveStatus,
  1110. IN BOOLEAN bMessageCopied);
  1111. BOOLEAN
  1112. IndicateStatusMessage(IN PRNDISMP_ADAPTER pAdapter,
  1113. IN PRNDIS_MESSAGE pMessage,
  1114. IN PMDL pMdl,
  1115. IN ULONG TotalLength,
  1116. IN NDIS_HANDLE MicroportMessageContext,
  1117. IN NDIS_STATUS ReceiveStatus,
  1118. IN BOOLEAN bMessageCopied);
  1119. BOOLEAN
  1120. UnknownMessage(IN PRNDISMP_ADAPTER pAdapter,
  1121. IN PRNDIS_MESSAGE pMessage,
  1122. IN PMDL pMdl,
  1123. IN ULONG TotalLength,
  1124. IN NDIS_HANDLE MicroportMessageContext,
  1125. IN NDIS_STATUS ReceiveStatus,
  1126. IN BOOLEAN bMessageCopied);
  1127. PRNDISMP_RECV_DATA_FRAME
  1128. AllocateReceiveFrame(IN PRNDISMP_ADAPTER pAdapter);
  1129. VOID
  1130. FreeReceiveFrame(IN PRNDISMP_RECV_DATA_FRAME pRcvFrame,
  1131. IN PRNDISMP_ADAPTER pAdapter);
  1132. VOID
  1133. IndicateTimeout(IN PVOID SystemSpecific1,
  1134. IN PVOID Context,
  1135. IN PVOID SystemSpecific2,
  1136. IN PVOID SystemSpecific3);
  1137. //
  1138. // Prototypes for functions in send.c
  1139. //
  1140. VOID
  1141. RndismpMultipleSend(IN NDIS_HANDLE MiniportAdapterContext,
  1142. IN PPNDIS_PACKET PacketArray,
  1143. IN UINT NumberOfPackets);
  1144. VOID
  1145. DoMultipleSend(IN PRNDISMP_ADAPTER pAdapter,
  1146. IN PRNDISMP_VC pVc OPTIONAL,
  1147. IN PPNDIS_PACKET PacketArray,
  1148. IN UINT NumberOfPackets);
  1149. VOID
  1150. DoMultipleSendRaw(IN PRNDISMP_ADAPTER pAdapter,
  1151. IN PRNDISMP_VC pVc OPTIONAL,
  1152. IN PPNDIS_PACKET PacketArray,
  1153. IN UINT NumberOfPackets);
  1154. PRNDISMP_PACKET_WRAPPER
  1155. PrepareDataMessage(IN PNDIS_PACKET pNdisPacket,
  1156. IN PRNDISMP_ADAPTER pAdapter,
  1157. IN PRNDISMP_VC pVc OPTIONAL,
  1158. IN OUT PULONG pTotalMessageLength);
  1159. PRNDISMP_PACKET_WRAPPER
  1160. PrepareDataMessageRaw(IN PNDIS_PACKET pNdisPacket,
  1161. IN PRNDISMP_ADAPTER pAdapter,
  1162. IN OUT PULONG pTotalMessageLength);
  1163. PRNDISMP_PACKET_WRAPPER
  1164. AllocatePacketMsgWrapper(IN PRNDISMP_ADAPTER pAdapter,
  1165. IN ULONG MsgHeaderLength);
  1166. VOID
  1167. FreePacketMsgWrapper(IN PRNDISMP_PACKET_WRAPPER pPktWrapper);
  1168. VOID
  1169. CompleteSendData(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1170. IN NDIS_STATUS SendStatus);
  1171. VOID
  1172. FreeMsgAfterSend(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1173. IN NDIS_STATUS SendStatus);
  1174. #if THROTTLE_MESSAGES
  1175. VOID
  1176. QueueMessageToMicroport(IN PRNDISMP_ADAPTER pAdapter,
  1177. IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1178. IN BOOLEAN bQueueMessageForResponse);
  1179. VOID
  1180. FlushPendingMessages(IN PRNDISMP_ADAPTER pAdapter);
  1181. #endif
  1182. VOID
  1183. SendProcessTimeout(IN PVOID SystemSpecific1,
  1184. IN PVOID Context,
  1185. IN PVOID SystemSpecific2,
  1186. IN PVOID SystemSpecific3);
  1187. //
  1188. // Prototypes for functions in request.c
  1189. //
  1190. NDIS_STATUS
  1191. RndismpQueryInformation(IN NDIS_HANDLE MiniportAdapterContext,
  1192. IN NDIS_OID Oid,
  1193. IN PVOID InformationBuffer,
  1194. IN ULONG InformationBufferLength,
  1195. OUT PULONG pBytesWritten,
  1196. OUT PULONG pBytesNeeded);
  1197. NDIS_STATUS
  1198. ProcessQueryInformation(IN PRNDISMP_ADAPTER pAdapter,
  1199. IN PRNDISMP_VC pVc,
  1200. IN PNDIS_REQUEST pRequest,
  1201. IN NDIS_OID Oid,
  1202. IN PVOID InformationBuffer,
  1203. IN ULONG InformationBufferLength,
  1204. OUT PULONG pBytesWritten,
  1205. OUT PULONG pBytesNeeded);
  1206. NDIS_STATUS
  1207. RndismpSetInformation(IN NDIS_HANDLE MiniportAdapterContext,
  1208. IN NDIS_OID Oid,
  1209. IN PVOID InformationBuffer,
  1210. IN ULONG InformationBufferLength,
  1211. OUT PULONG pBytesRead,
  1212. OUT PULONG pBytesNeeded);
  1213. NDIS_STATUS
  1214. ProcessSetInformation(IN PRNDISMP_ADAPTER pAdapter,
  1215. IN PRNDISMP_VC pVc OPTIONAL,
  1216. IN PNDIS_REQUEST pRequest OPTIONAL,
  1217. IN NDIS_OID Oid,
  1218. IN PVOID InformationBuffer,
  1219. IN ULONG InformationBufferLength,
  1220. OUT PULONG pBytesRead,
  1221. OUT PULONG pBytesNeeded);
  1222. NDIS_STATUS
  1223. DriverQueryInformation(IN PRNDISMP_ADAPTER pAdapter,
  1224. IN PRNDISMP_VC pVc OPTIONAL,
  1225. IN PNDIS_REQUEST pRequest OPTIONAL,
  1226. IN NDIS_OID Oid,
  1227. IN PVOID InformationBuffer,
  1228. IN ULONG InformationBufferLength,
  1229. OUT PULONG pBytesWritten,
  1230. OUT PULONG pBytesNeeded);
  1231. NDIS_STATUS
  1232. DeviceQueryInformation(IN PRNDISMP_ADAPTER pAdapter,
  1233. IN PRNDISMP_VC pVc OPTIONAL,
  1234. IN PNDIS_REQUEST pRequest OPTIONAL,
  1235. IN NDIS_OID Oid,
  1236. IN PVOID InformationBuffer,
  1237. IN ULONG InformationBufferLength,
  1238. OUT PULONG pBytesWritten,
  1239. OUT PULONG pBytesNeeded);
  1240. NDIS_STATUS
  1241. DriverSetInformation(IN PRNDISMP_ADAPTER pAdapter,
  1242. IN PRNDISMP_VC pVc OPTIONAL,
  1243. IN PNDIS_REQUEST pRequest OPTIONAL,
  1244. IN NDIS_OID Oid,
  1245. IN PVOID InformationBuffer,
  1246. IN ULONG InformationBufferLength,
  1247. OUT PULONG pBytesRead,
  1248. OUT PULONG pBytesNeeded);
  1249. NDIS_STATUS
  1250. DeviceSetInformation(IN PRNDISMP_ADAPTER pAdapter,
  1251. IN PRNDISMP_VC pVc OPTIONAL,
  1252. IN PNDIS_REQUEST pRequest OPTIONAL,
  1253. IN NDIS_OID Oid,
  1254. IN PVOID InformationBuffer,
  1255. IN ULONG InformationBufferLength,
  1256. OUT PULONG pBytesRead,
  1257. OUT PULONG pBytesNeeded);
  1258. BOOLEAN
  1259. QuerySetCompletionMessage(IN PRNDISMP_ADAPTER pAdapter,
  1260. IN PRNDIS_MESSAGE pMessage,
  1261. IN PMDL pMdl,
  1262. IN ULONG TotalLength,
  1263. IN NDIS_HANDLE MicroportMessageContext,
  1264. IN NDIS_STATUS ReceiveStatus,
  1265. IN BOOLEAN bMessageCopied);
  1266. VOID
  1267. CompleteSendDeviceRequest(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1268. IN NDIS_STATUS SendStatus);
  1269. #ifdef BUILD_WIN9X
  1270. VOID
  1271. CompleteSendDiscardDeviceRequest(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1272. IN NDIS_STATUS SendStatus);
  1273. #endif // BUILD_WIN9X
  1274. NDIS_STATUS
  1275. BuildOIDLists(IN PRNDISMP_ADAPTER Adapter,
  1276. IN PNDIS_OID DeviceOIDList,
  1277. IN UINT NumDeviceOID,
  1278. IN PNDIS_OID DriverOIDList,
  1279. IN UINT NumDriverOID);
  1280. UINT
  1281. GetOIDSupport(IN PRNDISMP_ADAPTER Adapter, IN NDIS_OID Oid);
  1282. VOID
  1283. FreeOIDLists(IN PRNDISMP_ADAPTER Adapter);
  1284. PRNDISMP_REQUEST_CONTEXT
  1285. AllocateRequestContext(IN PRNDISMP_ADAPTER pAdapter);
  1286. VOID
  1287. FreeRequestContext(IN PRNDISMP_ADAPTER pAdapter,
  1288. IN PRNDISMP_REQUEST_CONTEXT pReqContext);
  1289. //
  1290. // Prototypes for functions in util.c
  1291. //
  1292. NDIS_STATUS
  1293. MemAlloc(OUT PVOID *Buffer, IN UINT Length);
  1294. VOID
  1295. MemFree(IN PVOID Buffer, IN UINT Length);
  1296. VOID
  1297. AddAdapter(IN PRNDISMP_ADAPTER Adapter);
  1298. VOID
  1299. RemoveAdapter(IN PRNDISMP_ADAPTER Adapter);
  1300. VOID
  1301. DeviceObjectToAdapterAndDriverBlock(IN PDEVICE_OBJECT pDeviceObject,
  1302. OUT PRNDISMP_ADAPTER * ppAdapter,
  1303. OUT PDRIVER_BLOCK * ppDriverBlock);
  1304. VOID
  1305. AddDriverBlock(IN PDRIVER_BLOCK Head, IN PDRIVER_BLOCK Item);
  1306. VOID
  1307. RemoveDriverBlock(IN PDRIVER_BLOCK BlockHead, IN PDRIVER_BLOCK Item);
  1308. PDRIVER_BLOCK
  1309. DeviceObjectToDriverBlock(IN PDRIVER_BLOCK Head,
  1310. IN PDEVICE_OBJECT DeviceObject);
  1311. PDRIVER_BLOCK
  1312. DriverObjectToDriverBlock(IN PDRIVER_BLOCK Head,
  1313. IN PDRIVER_OBJECT DriverObject);
  1314. PRNDISMP_MESSAGE_FRAME
  1315. AllocateMsgFrame(IN PRNDISMP_ADAPTER pAdapter);
  1316. VOID
  1317. DereferenceMsgFrame(IN PRNDISMP_MESSAGE_FRAME pMsgFrame);
  1318. VOID
  1319. ReferenceMsgFrame(IN PRNDISMP_MESSAGE_FRAME pMsgFrame);
  1320. VOID
  1321. EnqueueNDISPacket(IN PRNDISMP_ADAPTER Adapter, IN PNDIS_PACKET Packet);
  1322. PNDIS_PACKET
  1323. DequeueNDISPacket(IN PRNDISMP_ADAPTER Adapter);
  1324. VOID
  1325. KeepAliveTimerHandler(IN PVOID SystemSpecific1,
  1326. IN PVOID Context,
  1327. IN PVOID SystemSpecific2,
  1328. IN PVOID SystemSpecific3);
  1329. VOID
  1330. CompleteSendKeepAlive(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1331. IN NDIS_STATUS SendStatus);
  1332. PRNDISMP_MESSAGE_FRAME
  1333. BuildRndisMessageCommon(IN PRNDISMP_ADAPTER Adapter,
  1334. IN PRNDISMP_VC pVc,
  1335. IN UINT NdisMessageType,
  1336. IN NDIS_OID Oid,
  1337. IN PVOID InformationBuffer,
  1338. IN ULONG InformationBufferLength);
  1339. PRNDISMP_MESSAGE_FRAME
  1340. AllocateMessageAndFrame(IN PRNDISMP_ADAPTER Adapter,
  1341. IN UINT MessageSize);
  1342. VOID
  1343. FreeAdapter(IN PRNDISMP_ADAPTER pAdapter);
  1344. PRNDISMP_VC
  1345. AllocateVc(IN PRNDISMP_ADAPTER pAdapter);
  1346. VOID
  1347. DeallocateVc(IN PRNDISMP_VC pVc);
  1348. PRNDISMP_VC
  1349. LookupVcId(IN PRNDISMP_ADAPTER pAdapter,
  1350. IN UINT32 VcId);
  1351. VOID
  1352. EnterVcIntoHashTable(IN PRNDISMP_ADAPTER pAdapter,
  1353. IN PRNDISMP_VC pVc);
  1354. VOID
  1355. RemoveVcFromHashTable(IN PRNDISMP_ADAPTER pAdapter,
  1356. IN PRNDISMP_VC pVc);
  1357. //
  1358. // Prototypes for functions in comini.c
  1359. //
  1360. NDIS_STATUS
  1361. RndismpCoCreateVc(IN NDIS_HANDLE MiniportAdapterContext,
  1362. IN NDIS_HANDLE NdisVcHandle,
  1363. IN PNDIS_HANDLE pMiniportVcContext);
  1364. VOID
  1365. CompleteSendCoCreateVc(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1366. IN NDIS_STATUS SendStatus);
  1367. VOID
  1368. HandleCoCreateVcFailure(IN PRNDISMP_VC pVc,
  1369. IN NDIS_STATUS Status);
  1370. NDIS_STATUS
  1371. RndismpCoDeleteVc(IN NDIS_HANDLE MiniportVcContext);
  1372. NDIS_STATUS
  1373. StartVcDeletion(IN PRNDISMP_VC pVc);
  1374. VOID
  1375. CompleteSendCoDeleteVc(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1376. IN NDIS_STATUS SendStatus);
  1377. VOID
  1378. HandleCoDeleteVcFailure(IN PRNDISMP_VC pVc,
  1379. IN NDIS_STATUS Status);
  1380. NDIS_STATUS
  1381. RndismpCoActivateVc(IN NDIS_HANDLE MiniportVcContext,
  1382. IN PCO_CALL_PARAMETERS pCallParameters);
  1383. NDIS_STATUS
  1384. StartVcActivation(IN PRNDISMP_VC pVc);
  1385. VOID
  1386. CompleteSendCoActivateVc(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1387. IN NDIS_STATUS SendStatus);
  1388. NDIS_STATUS
  1389. RndismpCoDeactivateVc(IN NDIS_HANDLE MiniportVcContext);
  1390. VOID
  1391. CompleteSendCoDeactivateVc(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1392. IN NDIS_STATUS SendStatus);
  1393. NDIS_STATUS
  1394. RndismpCoRequest(IN NDIS_HANDLE MiniportAdapterContext,
  1395. IN NDIS_HANDLE MiniportVcContext,
  1396. IN OUT PNDIS_REQUEST pRequest);
  1397. VOID
  1398. RndismpCoSendPackets(IN NDIS_HANDLE MiniportVcContext,
  1399. IN PNDIS_PACKET * PacketArray,
  1400. IN UINT NumberOfPackets);
  1401. BOOLEAN
  1402. ReceiveCreateVcComplete(IN PRNDISMP_ADAPTER pAdapter,
  1403. IN PRNDIS_MESSAGE pMessage,
  1404. IN PMDL pMdl,
  1405. IN ULONG TotalLength,
  1406. IN NDIS_HANDLE MicroportMessageContext,
  1407. IN NDIS_STATUS ReceiveStatus,
  1408. IN BOOLEAN bMessageCopied);
  1409. BOOLEAN
  1410. ReceiveActivateVcComplete(IN PRNDISMP_ADAPTER pAdapter,
  1411. IN PRNDIS_MESSAGE pMessage,
  1412. IN PMDL pMdl,
  1413. IN ULONG TotalLength,
  1414. IN NDIS_HANDLE MicroportMessageContext,
  1415. IN NDIS_STATUS ReceiveStatus,
  1416. IN BOOLEAN bMessageCopied);
  1417. BOOLEAN
  1418. ReceiveDeleteVcComplete(IN PRNDISMP_ADAPTER pAdapter,
  1419. IN PRNDIS_MESSAGE pMessage,
  1420. IN PMDL pMdl,
  1421. IN ULONG TotalLength,
  1422. IN NDIS_HANDLE MicroportMessageContext,
  1423. IN NDIS_STATUS ReceiveStatus,
  1424. IN BOOLEAN bMessageCopied);
  1425. BOOLEAN
  1426. ReceiveDeactivateVcComplete(IN PRNDISMP_ADAPTER pAdapter,
  1427. IN PRNDIS_MESSAGE pMessage,
  1428. IN PMDL pMdl,
  1429. IN ULONG TotalLength,
  1430. IN NDIS_HANDLE MicroportMessageContext,
  1431. IN NDIS_STATUS ReceiveStatus,
  1432. IN BOOLEAN bMessageCopied);
  1433. PRNDISMP_MESSAGE_FRAME
  1434. BuildRndisMessageCoMiniport(IN PRNDISMP_ADAPTER pAdapter,
  1435. IN PRNDISMP_VC pVc,
  1436. IN UINT NdisMessageType,
  1437. IN PCO_CALL_PARAMETERS pCallParameters OPTIONAL);
  1438. VOID
  1439. CompleteSendDataOnVc(IN PRNDISMP_VC pVc,
  1440. IN PNDIS_PACKET pNdisPacket,
  1441. IN NDIS_STATUS Status);
  1442. VOID
  1443. IndicateReceiveDataOnVc(IN PRNDISMP_VC pVc,
  1444. IN PNDIS_PACKET * PacketArray,
  1445. IN UINT NumberOfPackets);
  1446. //
  1447. // Prototypes for functions in wdmutil.c
  1448. //
  1449. PDRIVER_OBJECT
  1450. DeviceObjectToDriverObject(IN PDEVICE_OBJECT DeviceObject);
  1451. NTSTATUS
  1452. GetDeviceFriendlyName(IN PDEVICE_OBJECT pDeviceObject,
  1453. OUT PANSI_STRING pAnsiString,
  1454. OUT PUNICODE_STRING pUnicodeString);
  1455. VOID
  1456. HookPnpDispatchRoutine(IN PDRIVER_BLOCK DriverBlock);
  1457. NTSTATUS
  1458. PnPDispatch(IN PDEVICE_OBJECT pDeviceObject,
  1459. IN PIRP pIrp);
  1460. #ifdef BUILD_WIN9X
  1461. VOID
  1462. HookNtKernCMHandler(IN PRNDISMP_ADAPTER pAdapter);
  1463. VOID
  1464. UnHookNtKernCMHandler(IN PRNDISMP_ADAPTER pAdapter);
  1465. MY_CONFIGRET __cdecl
  1466. RndisCMHandler(IN MY_CONFIGFUNC cfFuncName,
  1467. IN MY_SUBCONFIGFUNC cfSubFuncName,
  1468. IN MY_DEVNODE cfDevNode,
  1469. IN ULONG dwRefData,
  1470. IN ULONG ulFlags);
  1471. #endif
  1472. #if DBG
  1473. //
  1474. // Prototypes for functions in debug.c
  1475. //
  1476. PCHAR
  1477. GetOidName(IN NDIS_OID Oid);
  1478. VOID
  1479. DisplayOidList(IN PRNDISMP_ADAPTER Adapter);
  1480. VOID
  1481. RndisPrintHexDump(PVOID Pointer,
  1482. ULONG Length);
  1483. VOID
  1484. RndisLogSendMessage(
  1485. IN PRNDISMP_ADAPTER pAdapter,
  1486. IN PRNDISMP_MESSAGE_FRAME pMsgFrame);
  1487. #endif
  1488. #endif // _RNDISMP_H_