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.

1925 lines
71 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. // Max frame size
  568. ULONG MaximumFrameSize;
  569. // Max multicast list size
  570. ULONG MaxMulticastListSize;
  571. // Current 802.3 address
  572. UCHAR MacAddress[ETH_LENGTH_OF_ADDRESS];
  573. // sanity check
  574. ULONG Signature;
  575. #ifdef BUILD_WIN9X
  576. MY_CMCONFIGHANDLER NdisCmConfigHandler;
  577. MY_DEVNODE DevNode;
  578. ULONG WrapContextOffset;
  579. #endif
  580. #if DBG
  581. ULONG MicroportReceivesOutstanding;
  582. PUCHAR pSendLogBuffer;
  583. ULONG LogBufferSize;
  584. PUCHAR pSendLogWrite;
  585. #endif // DBG
  586. } RNDISMP_ADAPTER, *PRNDISMP_ADAPTER;
  587. typedef
  588. VOID
  589. (*RM_MULTIPLE_SEND_HANDLER) (
  590. IN PRNDISMP_ADAPTER pAdapter,
  591. IN PRNDISMP_VC pVc OPTIONAL,
  592. IN PPNDIS_PACKET PacketArray,
  593. IN UINT NumberofPackets);
  594. //
  595. // Structure to keep context about a single received RNDIS message.
  596. //
  597. typedef struct _RNDISMP_RECV_MSG_CONTEXT
  598. {
  599. LIST_ENTRY Link;
  600. NDIS_HANDLE MicroportMessageContext;
  601. PMDL pMdl;
  602. ULONG TotalLength;
  603. PRNDIS_MESSAGE pMessage;
  604. NDIS_STATUS ReceiveStatus;
  605. BOOLEAN bMessageCopied;
  606. RM_CHANNEL_TYPE ChannelType;
  607. } RNDISMP_RECV_MSG_CONTEXT, *PRNDISMP_RECV_MSG_CONTEXT;
  608. //
  609. // Structure to keep context about a single received RNDIS_PACKET -message-.
  610. // Note that this can contain more than one packet. We store a pointer to
  611. // this structure in our reserved section of each received NDIS_PACKET.
  612. //
  613. typedef struct _RNDISMP_RECV_DATA_FRAME
  614. {
  615. NDIS_HANDLE MicroportMessageContext;
  616. union {
  617. PMDL pMicroportMdl;
  618. PRNDIS_MESSAGE pLocalMessageCopy;
  619. };
  620. ULONG ReturnsPending;
  621. BOOLEAN bMessageCopy; // did we make a copy?
  622. } RNDISMP_RECV_DATA_FRAME, *PRNDISMP_RECV_DATA_FRAME;
  623. //
  624. // Per NDIS_PACKET context for received packets. This goes into MiniportReserved.
  625. //
  626. typedef struct _RNDISMP_RECV_PKT_RESERVED
  627. {
  628. PRNDISMP_RECV_DATA_FRAME pRcvFrame;
  629. PRNDISMP_VC pVc;
  630. } RNDISMP_RECV_PKT_RESERVED, *PRNDISMP_RECV_PKT_RESERVED;
  631. //
  632. // Used to overlay ProtocolReserved in a packet queued for indicating up.
  633. //
  634. typedef struct _RNDISMP_RECV_PKT_LINKAGE
  635. {
  636. LIST_ENTRY Link;
  637. } RNDISMP_RECV_PKT_LINKAGE, *PRNDISMP_RECV_PKT_LINKAGE;
  638. //
  639. // Global Data
  640. //
  641. extern DRIVER_BLOCK RndismpMiniportBlockListHead;
  642. extern UINT RndismpNumMicroports;
  643. extern NDIS_SPIN_LOCK RndismpGlobalLock;
  644. extern NDIS_OID RndismpSupportedOids[];
  645. extern UINT RndismpSupportedOidsNum;
  646. extern NDIS_PHYSICAL_ADDRESS HighestAcceptableMax;
  647. #if DBG
  648. extern UINT RndismpDebugFlags;
  649. #endif
  650. //
  651. // Macros
  652. //
  653. // Given a request message type value, return its completion message type
  654. #define RNDIS_COMPLETION(_Type) ((_Type) | 0x80000000)
  655. // Convert an RNdisMediumXXX value to its NdisMediumXXX equivalent
  656. #define RNDIS_TO_NDIS_MEDIUM(_RndisMedium) ((NDIS_MEDIUM)(_RndisMedium))
  657. #define RNDISMP_GET_ALIGNED_LENGTH(_AlignedLength, _InputLen, _pAdapter) \
  658. { \
  659. ULONG _Length = _InputLen; \
  660. if (_Length == 0) \
  661. (_AlignedLength) = 0; \
  662. else \
  663. (_AlignedLength) = ((_Length + (_pAdapter)->AlignmentIncr) & \
  664. (_pAdapter)->AlignmentMask); \
  665. }
  666. // The minimum MessageLength expected in an RNDIS message of a given type.
  667. #define RNDISMP_MIN_MESSAGE_LENGTH(_MsgTypeField) \
  668. FIELD_OFFSET(RNDIS_MESSAGE, Message) + sizeof(((PRNDIS_MESSAGE)0)->Message._MsgTypeField##)
  669. // memory move macro
  670. #define RNDISMP_MOVE_MEM(dest,src,size) NdisMoveMemory(dest,src,size)
  671. // Macros to extract high and low bytes of a word.
  672. #define MSB(Value) ((UCHAR)((((ULONG)Value) >> 8) & 0xff))
  673. #define LSB(Value) ((UCHAR)(((ULONG)Value) & 0xff))
  674. // Acquire the adapter lock
  675. #define RNDISMP_ACQUIRE_ADAPTER_LOCK(_pAdapter) \
  676. NdisAcquireSpinLock(&(_pAdapter)->Lock);
  677. // Release the adapter lock
  678. #define RNDISMP_RELEASE_ADAPTER_LOCK(_pAdapter) \
  679. NdisReleaseSpinLock(&(_pAdapter)->Lock);
  680. // Increment adapter statistics.
  681. #define RNDISMP_INCR_STAT(_pAdapter, _StatsCount) \
  682. NdisInterlockedIncrement(&(_pAdapter)->Statistics._StatsCount)
  683. // Get adapter statistics
  684. #define RNDISMP_GET_ADAPTER_STATS(_pAdapter, _StatsCount) \
  685. ((_pAdapter)->Statistics._StatsCount)
  686. // Get the send packet reserved field
  687. #define PRNDISMP_RESERVED_FROM_SEND_PACKET(_Packet) \
  688. ((PRNDISMP_SEND_PKT_RESERVED)((_Packet)->MiniportReserved))
  689. #define PRNDISMP_RESERVED_TEMP_FROM_SEND_PACKET(_Packet) \
  690. ((PRNDISMP_SEND_PKT_RESERVED_TEMP)((_Packet)->MiniportReserved))
  691. #define PRNDISMP_RESERVED_FROM_RECV_PACKET(_Packet) \
  692. ((PRNDISMP_RECV_PKT_RESERVED)((_Packet)->MiniportReserved))
  693. // store receive frame context in miniport reserved field
  694. #define RECEIVE_FRAME_TO_NDIS_PACKET(_Packet, _ReceiveFrame) \
  695. { \
  696. PRNDISMP_RECEIVE_FRAME *TmpPtr; \
  697. TmpPtr = (PRNDISMP_RECEIVE_FRAME *) \
  698. &(_Packet->MiniportReserved); \
  699. *TmpPtr = _ReceiveFrame; \
  700. }
  701. // Get adapter context from handle passed in NDIS routines
  702. #define PRNDISMP_ADAPTER_FROM_CONTEXT_HANDLE(_Handle) \
  703. ((PRNDISMP_ADAPTER)(_Handle))
  704. // Get miniport context handle from adapter context
  705. #define CONTEXT_HANDLE_FROM_PRNDISMP_ADAPTER(_Ptr) \
  706. ((NDIS_HANDLE)(_Ptr))
  707. // Get VC context from handle passed in from NDIS
  708. #define PRNDISMP_VC_FROM_CONTEXT_HANDLE(_Handle) \
  709. ((PRNDISMP_VC)(_Handle))
  710. // Get miniport context from VC
  711. #define CONTEXT_HANDLE_FROM_PRNDISMP_VC(_pVc) \
  712. ((NDIS_HANDLE)(_Vc))
  713. // Get message frame from message handle
  714. #define MESSAGE_FRAME_FROM_HANDLE(_Handle) \
  715. ((PRNDISMP_MESSAGE_FRAME)(_Handle))
  716. // Get a pointer to the data buff in an RNDIS_PACKET
  717. #define GET_PTR_TO_RNDIS_DATA_BUFF(_Message) \
  718. ((PVOID) ((PUCHAR)(_Message) + _Message->DataOffset))
  719. // Get a pointer to the OOBD data in an RNDIS_PACKET
  720. #define GET_PTR_TO_OOB_DATA(_Message) \
  721. ((PVOID) ((PUCHAR)(_Message) + _Message->OOBDataOffset))
  722. // Get a pointer to the per packet info in an RNDIS_PACKET
  723. #define GET_PTR_TO_PER_PACKET_INFO(_Message) \
  724. ((PVOID) ((PUCHAR)(_Message) + _Message->PerPacketInfoOffset))
  725. // Get an offset to the data buff in an RNDIS_PACKET
  726. #define GET_OFFSET_TO_RNDIS_DATA_BUFF(_Message) \
  727. (sizeof(RNDIS_PACKET))
  728. // Get an offset to the OOBD data in an RNDIS_PACKET
  729. #define GET_OFFSET_TO_OOB_DATA(_Message) \
  730. (sizeof(RNDIS_PACKET) + Message->DataLength)
  731. // Get an offset to the per packet info in an RNDIS_PACKET
  732. #define GET_OFFSET_TO_PER_PACKET_INFO(_Message) \
  733. (sizeof(RNDIS_PACKET) + _Message->DataLength + _Message->OOBDataLength)
  734. #define RNDISMP_GET_INFO_BUFFER_FROM_QUERY_MSG(_Message) \
  735. ((PUCHAR)(_Message) + (_Message)->InformationBufferOffset)
  736. #define MIN(x,y) ((x > y) ? y : x)
  737. // Return the virtual address for a received message MDL.
  738. #if defined(BUILD_WIN9X) || defined(BUILD_WIN2K)
  739. #define RNDISMP_GET_MDL_ADDRESS(_pMdl) MmGetSystemAddressForMdl(_pMdl)
  740. #else
  741. #define RNDISMP_GET_MDL_ADDRESS(_pMdl) MmGetSystemAddressForMdlSafe(_pMdl, NormalPagePriority)
  742. #endif
  743. // Return the MDL chained to this MDL
  744. #define RNDISMP_GET_MDL_NEXT(_pMdl) ((_pMdl)->Next)
  745. // Return the MDL length
  746. #define RNDISMP_GET_MDL_LENGTH(_pMdl) MmGetMdlByteCount(_pMdl)
  747. // Access the RNDIS message from our Message Frame structure.
  748. #define RNDISMP_GET_MSG_FROM_FRAME(_pMsgFrame) \
  749. RNDISMP_GET_MDL_ADDRESS(_pMsgFrame->pMessageMdl)
  750. // Return an RNDIS message back to the microport.
  751. #if DBG
  752. #define RNDISMP_RETURN_TO_MICROPORT(_pAdapter, _pMdl, _MicroportMsgContext) \
  753. { \
  754. NdisInterlockedDecrement(&(_pAdapter)->MicroportReceivesOutstanding); \
  755. (_pAdapter)->RmReturnMessageHandler((_pAdapter)->MicroportAdapterContext,\
  756. (_pMdl), \
  757. (_MicroportMsgContext)); \
  758. }
  759. #else
  760. #define RNDISMP_RETURN_TO_MICROPORT(_pAdapter, _pMdl, _MicroportMsgContext) \
  761. (_pAdapter)->RmReturnMessageHandler((_pAdapter)->MicroportAdapterContext,\
  762. (_pMdl), \
  763. (_MicroportMsgContext))
  764. #endif // DBG
  765. // Send an RNDIS message to the microport.
  766. #if THROTTLE_MESSAGES
  767. #define RNDISMP_SEND_TO_MICROPORT(_pAdapter, _pMsgFrame, _bQueueForResponse, _CallbackFunc) \
  768. { \
  769. TRACE2(("Send: Adapter %x, MsgFrame %x, Mdl %x\n", \
  770. _pAdapter, _pMsgFrame, _pMsgFrame->pMessageMdl)); \
  771. (_pMsgFrame)->pCallback = _CallbackFunc; \
  772. QueueMessageToMicroport(_pAdapter, _pMsgFrame, _bQueueForResponse); \
  773. }
  774. #else
  775. #define RNDISMP_SEND_TO_MICROPORT(_pAdapter, _pMsgFrame, _bQueueForResponse, _CallbackFunc) \
  776. { \
  777. (_pMsgFrame)->pCallback = _CallbackFunc; \
  778. if (_bQueueForResponse) \
  779. { \
  780. RNDISMP_ACQUIRE_ADAPTER_LOCK(_pAdapter); \
  781. InsertTailList(&(_pAdapter)->PendingFrameList, &(_pMsgFrame)->Link);\
  782. RNDISMP_RELEASE_ADAPTER_LOCK(_pAdapter); \
  783. } \
  784. (_pAdapter)->RmSendMessageHandler((_pAdapter)->MicroportAdapterContext, \
  785. (_pMsgFrame)->pMessageMdl, \
  786. (_pMsgFrame)); \
  787. }
  788. #endif // THROTTLE_MESSAGES
  789. // Return the handler function for a given message type.
  790. #define RNDISMP_GET_MSG_HANDLER(_pMsgHandlerFunc, _MessageType) \
  791. { \
  792. switch (_MessageType) \
  793. { \
  794. case REMOTE_NDIS_HALT_MSG: \
  795. _pMsgHandlerFunc = HaltMessage; \
  796. break; \
  797. case REMOTE_NDIS_PACKET_MSG: \
  798. _pMsgHandlerFunc = ReceivePacketMessage; \
  799. break; \
  800. case REMOTE_NDIS_INDICATE_STATUS_MSG: \
  801. _pMsgHandlerFunc = IndicateStatusMessage; \
  802. break; \
  803. case REMOTE_NDIS_QUERY_CMPLT: \
  804. case REMOTE_NDIS_SET_CMPLT: \
  805. _pMsgHandlerFunc = QuerySetCompletionMessage; \
  806. break; \
  807. case REMOTE_NDIS_KEEPALIVE_MSG: \
  808. _pMsgHandlerFunc = KeepAliveMessage; \
  809. break; \
  810. case REMOTE_NDIS_KEEPALIVE_CMPLT: \
  811. _pMsgHandlerFunc = KeepAliveCompletionMessage; \
  812. break; \
  813. case REMOTE_NDIS_RESET_CMPLT: \
  814. _pMsgHandlerFunc = ResetCompletionMessage; \
  815. break; \
  816. case REMOTE_NDIS_INITIALIZE_CMPLT: \
  817. _pMsgHandlerFunc = InitCompletionMessage; \
  818. break; \
  819. case REMOTE_CONDIS_MP_CREATE_VC_CMPLT: \
  820. _pMsgHandlerFunc = ReceiveCreateVcComplete; \
  821. break; \
  822. case REMOTE_CONDIS_MP_DELETE_VC_CMPLT: \
  823. _pMsgHandlerFunc = ReceiveDeleteVcComplete; \
  824. break; \
  825. case REMOTE_CONDIS_MP_ACTIVATE_VC_CMPLT: \
  826. _pMsgHandlerFunc = ReceiveActivateVcComplete; \
  827. break; \
  828. case REMOTE_CONDIS_MP_DEACTIVATE_VC_CMPLT: \
  829. _pMsgHandlerFunc = ReceiveDeactivateVcComplete; \
  830. break; \
  831. default: \
  832. _pMsgHandlerFunc = UnknownMessage; \
  833. break; \
  834. } \
  835. }
  836. //
  837. // Look up a message frame on the adapter given a request ID. If found,
  838. // remove it from the pending list and return it.
  839. //
  840. #define RNDISMP_LOOKUP_PENDING_MESSAGE(_pMsgFrame, _pAdapter, _ReqId) \
  841. { \
  842. PLIST_ENTRY _pEnt; \
  843. PRNDISMP_MESSAGE_FRAME _pFrame; \
  844. \
  845. (_pMsgFrame) = NULL; \
  846. RNDISMP_ACQUIRE_ADAPTER_LOCK(_pAdapter); \
  847. for (_pEnt = (_pAdapter)->PendingFrameList.Flink; \
  848. _pEnt != &(_pAdapter)->PendingFrameList; \
  849. _pEnt = _pEnt->Flink) \
  850. { \
  851. _pFrame = CONTAINING_RECORD(_pEnt, RNDISMP_MESSAGE_FRAME, Link); \
  852. if (_pFrame->RequestId == (_ReqId)) \
  853. { \
  854. RemoveEntryList(_pEnt); \
  855. (_pMsgFrame) = _pFrame; \
  856. break; \
  857. } \
  858. } \
  859. RNDISMP_RELEASE_ADAPTER_LOCK(_pAdapter); \
  860. }
  861. #if DBG_TIME_STAMPS
  862. #define RNDISMP_GET_TIME_STAMP(_pTs) \
  863. { \
  864. LONGLONG systime_usec; \
  865. NdisGetCurrentSystemTime((PVOID)&systime_usec); \
  866. *_pTs = (ULONG)((*(PULONG)&systime_usec)/1000); \
  867. }
  868. #else
  869. #define RNDISMP_GET_TIME_STAMP(_pTs)
  870. #endif
  871. #define RNDISMP_INIT_LOCK(_pLock) \
  872. NdisAllocateSpinLock((_pLock));
  873. #define RNDISMP_ACQUIRE_LOCK(_pLock) \
  874. NdisAcquireSpinLock((_pLock));
  875. #define RNDISMP_RELEASE_LOCK(_pLock) \
  876. NdisReleaseSpinLock((_pLock));
  877. #define RNDISMP_ACQUIRE_LOCK_DPC(_pLock) \
  878. NdisDprAcquireSpinLock((_pLock));
  879. #define RNDISMP_RELEASE_LOCK_DPC(_pLock) \
  880. NdisDprReleaseSpinLock((_pLock));
  881. #define RNDISMP_INIT_VC_LOCK(_pVc) \
  882. RNDISMP_INIT_LOCK(&((_pVc)->Lock))
  883. #define RNDISMP_ACQUIRE_VC_LOCK(_pVc) \
  884. RNDISMP_ACQUIRE_LOCK(&((_pVc))->Lock)
  885. #define RNDISMP_RELEASE_VC_LOCK(_pVc) \
  886. RNDISMP_RELEASE_LOCK(&((_pVc))->Lock)
  887. #define RNDISMP_ACQUIRE_VC_LOCK_DPC(_pVc) \
  888. RNDISMP_ACQUIRE_LOCK_DPC(&((_pVc))->Lock)
  889. #define RNDISMP_RELEASE_VC_LOCK_DPC(_pVc) \
  890. RNDISMP_RELEASE_LOCK_DPC(&((_pVc))->Lock)
  891. #define RNDISMP_REF_VC(_pVc) \
  892. NdisInterlockedIncrement(&(_pVc)->RefCount);
  893. #define RNDISMP_DEREF_VC(_pVc, _pRefCount) \
  894. { \
  895. ULONG _RefCount; \
  896. \
  897. RNDISMP_ACQUIRE_VC_LOCK(_pVc); \
  898. \
  899. RNDISMP_DEREF_VC_LOCKED(_pVc, &_RefCount); \
  900. *(_pRefCount) = _RefCount; \
  901. if (_RefCount != 0) \
  902. { \
  903. RNDISMP_RELEASE_VC_LOCK(_pVc); \
  904. } \
  905. }
  906. #define RNDISMP_DEREF_VC_LOCKED(_pVc, _pRefCount) \
  907. { \
  908. ULONG __RefCount; \
  909. NDIS_HANDLE __NdisVcHandle; \
  910. \
  911. __RefCount = NdisInterlockedDecrement(&(_pVc)->RefCount); \
  912. *(_pRefCount) = __RefCount; \
  913. if (__RefCount == 0) \
  914. { \
  915. RNDISMP_RELEASE_VC_LOCK(_pVc); \
  916. DeallocateVc(_pVc); \
  917. } \
  918. else \
  919. { \
  920. if ((__RefCount == 1) && \
  921. ((_pVc)->VcState == RNDISMP_VC_DEACTIVATED)) \
  922. { \
  923. __NdisVcHandle = (_pVc)->NdisVcHandle; \
  924. (_pVc)->VcState = RNDISMP_VC_CREATED; \
  925. NdisInterlockedIncrement(&(_pVc)->RefCount); \
  926. \
  927. RNDISMP_RELEASE_VC_LOCK(_pVc); \
  928. \
  929. NdisMCoDeactivateVcComplete(NDIS_STATUS_SUCCESS, \
  930. __NdisVcHandle); \
  931. \
  932. RNDISMP_ACQUIRE_VC_LOCK(_pVc); \
  933. \
  934. __RefCount = NdisInterlockedDecrement(&(_pVc)->RefCount); \
  935. *(_pRefCount) = __RefCount; \
  936. if (__RefCount == 0) \
  937. { \
  938. RNDISMP_RELEASE_VC_LOCK(_pVc); \
  939. DeallocateVc(_pVc); \
  940. } \
  941. } \
  942. } \
  943. }
  944. //
  945. // Prototypes for functions in rndismp.c
  946. //
  947. NTSTATUS
  948. DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath);
  949. NDIS_STATUS
  950. RndisMInitializeWrapper(OUT PNDIS_HANDLE pNdisWrapperHandle,
  951. IN PVOID MicroportContext,
  952. IN PVOID DriverObject,
  953. IN PVOID RegistryPath,
  954. IN PRNDIS_MICROPORT_CHARACTERISTICS pCharacteristics);
  955. VOID
  956. RndismpUnload(IN PDRIVER_OBJECT pDriverObject);
  957. NTSTATUS
  958. DllUnload(VOID);
  959. VOID
  960. RndismpHalt(IN NDIS_HANDLE MiniportAdapterContext);
  961. VOID
  962. RndismpInternalHalt(IN NDIS_HANDLE MiniportAdapterContext,
  963. IN BOOLEAN bCalledFromHalt);
  964. NDIS_STATUS
  965. RndismpReconfigure(OUT PNDIS_STATUS pStatus,
  966. IN NDIS_HANDLE MiniportAdapterContext,
  967. IN NDIS_HANDLE ConfigContext);
  968. NDIS_STATUS
  969. RndismpReset(OUT PBOOLEAN AddressingReset,
  970. IN NDIS_HANDLE MiniportAdapterContext);
  971. BOOLEAN
  972. RndismpCheckForHang(IN NDIS_HANDLE MiniportAdapterContext);
  973. NDIS_STATUS
  974. RndismpInitialize(OUT PNDIS_STATUS OpenErrorStatus,
  975. OUT PUINT SelectedMediumIndex,
  976. IN PNDIS_MEDIUM MediumArray,
  977. IN UINT MediumArraySize,
  978. IN NDIS_HANDLE MiniportAdapterHandle,
  979. IN NDIS_HANDLE ConfigurationHandle);
  980. VOID
  981. RndisMSendComplete(IN NDIS_HANDLE MiniportAdapterContext,
  982. IN NDIS_HANDLE RndisMessageHandle,
  983. IN NDIS_STATUS SendStatus);
  984. BOOLEAN
  985. InitCompletionMessage(IN PRNDISMP_ADAPTER pAdapter,
  986. IN PRNDIS_MESSAGE pMessage,
  987. IN PMDL pMdl,
  988. IN ULONG TotalLength,
  989. IN NDIS_HANDLE MicroportMessageContext,
  990. IN NDIS_STATUS ReceiveStatus,
  991. IN BOOLEAN bMessageCopied);
  992. BOOLEAN
  993. HaltMessage(IN PRNDISMP_ADAPTER pAdapter,
  994. IN PRNDIS_MESSAGE pMessage,
  995. IN PMDL pMdl,
  996. IN ULONG TotalLength,
  997. IN NDIS_HANDLE MicroportMessageContext,
  998. IN NDIS_STATUS ReceiveStatus,
  999. IN BOOLEAN bMessageCopied);
  1000. BOOLEAN
  1001. ResetCompletionMessage(IN PRNDISMP_ADAPTER pAdapter,
  1002. IN PRNDIS_MESSAGE pMessage,
  1003. IN PMDL pMdl,
  1004. IN ULONG TotalLength,
  1005. IN NDIS_HANDLE MicroportMessageContext,
  1006. IN NDIS_STATUS ReceiveStatus,
  1007. IN BOOLEAN bMessageCopied);
  1008. BOOLEAN
  1009. KeepAliveCompletionMessage(IN PRNDISMP_ADAPTER pAdapter,
  1010. IN PRNDIS_MESSAGE pMessage,
  1011. IN PMDL pMdl,
  1012. IN ULONG TotalLength,
  1013. IN NDIS_HANDLE MicroportMessageContext,
  1014. IN NDIS_STATUS ReceiveStatus,
  1015. IN BOOLEAN bMessageCopied);
  1016. BOOLEAN
  1017. KeepAliveMessage(IN PRNDISMP_ADAPTER pAdapter,
  1018. IN PRNDIS_MESSAGE pMessage,
  1019. IN PMDL pMdl,
  1020. IN ULONG TotalLength,
  1021. IN NDIS_HANDLE MicroportMessageContext,
  1022. IN NDIS_STATUS ReceiveStatus,
  1023. IN BOOLEAN bMessageCopied);
  1024. VOID
  1025. RndismpShutdownHandler(IN NDIS_HANDLE MiniportAdapterContext);
  1026. VOID
  1027. RndismpDisableInterrupt(IN NDIS_HANDLE MiniportAdapterContext);
  1028. VOID
  1029. RndismpEnableInterrupt(IN NDIS_HANDLE MiniportAdapterContext);
  1030. VOID
  1031. RndismpHandleInterrupt(IN NDIS_HANDLE MiniportAdapterContext);
  1032. VOID
  1033. RndismpIsr(OUT PBOOLEAN InterruptRecognized,
  1034. OUT PBOOLEAN QueueDpc,
  1035. IN PVOID Context);
  1036. VOID
  1037. CompleteSendInit(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1038. IN NDIS_STATUS SendStatus);
  1039. VOID
  1040. CompleteSendHalt(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1041. IN NDIS_STATUS SendStatus);
  1042. VOID
  1043. CompleteSendReset(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1044. IN NDIS_STATUS SendStatus);
  1045. VOID
  1046. CompleteMiniportReset(IN PRNDISMP_ADAPTER pAdapter,
  1047. IN NDIS_STATUS ResetStatus,
  1048. IN BOOLEAN AddressingReset);
  1049. NDIS_STATUS
  1050. ReadAndSetRegistryParameters(IN PRNDISMP_ADAPTER pAdapter,
  1051. IN NDIS_HANDLE ConfigurationContext);
  1052. NDIS_STATUS
  1053. SendConfiguredParameter(IN PRNDISMP_ADAPTER pAdapter,
  1054. IN NDIS_HANDLE ConfigHandle,
  1055. IN PNDIS_STRING pParameterName,
  1056. IN PNDIS_STRING pParameterType);
  1057. VOID
  1058. RndismpPnPEventNotify(IN NDIS_HANDLE MiniportAdapterContext,
  1059. IN NDIS_DEVICE_PNP_EVENT EventCode,
  1060. IN PVOID InformationBuffer,
  1061. IN ULONG InformationBufferLength);
  1062. //
  1063. // Prototypes for functions in init.c
  1064. //
  1065. NDIS_STATUS
  1066. SetupSendQueues(IN PRNDISMP_ADAPTER Adapter);
  1067. NDIS_STATUS
  1068. SetupReceiveQueues(IN PRNDISMP_ADAPTER Adapter);
  1069. NDIS_STATUS
  1070. AllocateTransportResources(IN PRNDISMP_ADAPTER Adapter);
  1071. VOID
  1072. FreeTransportResources(IN PRNDISMP_ADAPTER Adapter);
  1073. VOID
  1074. FreeSendResources(IN PRNDISMP_ADAPTER Adapter);
  1075. VOID
  1076. FreeReceiveResources(IN PRNDISMP_ADAPTER Adapter);
  1077. //
  1078. // Prototypes for functions in receive.c
  1079. //
  1080. VOID
  1081. RndismpReturnPacket(IN NDIS_HANDLE MiniportAdapterContext,
  1082. IN PNDIS_PACKET Packet);
  1083. VOID
  1084. DereferenceRcvFrame(IN PRNDISMP_RECV_DATA_FRAME pRcvFrame,
  1085. IN PRNDISMP_ADAPTER pAdapter);
  1086. VOID
  1087. RndisMIndicateReceive(IN NDIS_HANDLE MiniportAdapterContext,
  1088. IN PMDL pMessageHead,
  1089. IN NDIS_HANDLE MicroportMessageContext,
  1090. IN RM_CHANNEL_TYPE ChannelType,
  1091. IN NDIS_STATUS ReceiveStatus);
  1092. VOID
  1093. IndicateReceive(IN PRNDISMP_ADAPTER pAdapter,
  1094. IN PRNDISMP_VC pVc OPTIONAL,
  1095. IN PRNDISMP_RECV_DATA_FRAME pRcvFrame,
  1096. IN PPNDIS_PACKET PacketArray,
  1097. IN ULONG NumberOfPackets,
  1098. IN NDIS_STATUS ReceiveStatus);
  1099. PRNDIS_MESSAGE
  1100. CoalesceMultiMdlMessage(IN PMDL pMdl,
  1101. IN ULONG TotalLength);
  1102. VOID
  1103. FreeRcvMessageCopy(IN PRNDIS_MESSAGE pMessage);
  1104. BOOLEAN
  1105. ReceivePacketMessage(IN PRNDISMP_ADAPTER pAdapter,
  1106. IN PRNDIS_MESSAGE pMessage,
  1107. IN PMDL pMdl,
  1108. IN ULONG TotalLength,
  1109. IN NDIS_HANDLE MicroportMessageContext,
  1110. IN NDIS_STATUS ReceiveStatus,
  1111. IN BOOLEAN bMessageCopied);
  1112. BOOLEAN
  1113. ReceivePacketMessageRaw(IN PRNDISMP_ADAPTER pAdapter,
  1114. IN PRNDIS_MESSAGE pMessage,
  1115. IN PMDL pMdl,
  1116. IN ULONG TotalLength,
  1117. IN NDIS_HANDLE MicroportMessageContext,
  1118. IN NDIS_STATUS ReceiveStatus,
  1119. IN BOOLEAN bMessageCopied);
  1120. BOOLEAN
  1121. IndicateStatusMessage(IN PRNDISMP_ADAPTER pAdapter,
  1122. IN PRNDIS_MESSAGE pMessage,
  1123. IN PMDL pMdl,
  1124. IN ULONG TotalLength,
  1125. IN NDIS_HANDLE MicroportMessageContext,
  1126. IN NDIS_STATUS ReceiveStatus,
  1127. IN BOOLEAN bMessageCopied);
  1128. BOOLEAN
  1129. UnknownMessage(IN PRNDISMP_ADAPTER pAdapter,
  1130. IN PRNDIS_MESSAGE pMessage,
  1131. IN PMDL pMdl,
  1132. IN ULONG TotalLength,
  1133. IN NDIS_HANDLE MicroportMessageContext,
  1134. IN NDIS_STATUS ReceiveStatus,
  1135. IN BOOLEAN bMessageCopied);
  1136. PRNDISMP_RECV_DATA_FRAME
  1137. AllocateReceiveFrame(IN PRNDISMP_ADAPTER pAdapter);
  1138. VOID
  1139. FreeReceiveFrame(IN PRNDISMP_RECV_DATA_FRAME pRcvFrame,
  1140. IN PRNDISMP_ADAPTER pAdapter);
  1141. VOID
  1142. IndicateTimeout(IN PVOID SystemSpecific1,
  1143. IN PVOID Context,
  1144. IN PVOID SystemSpecific2,
  1145. IN PVOID SystemSpecific3);
  1146. //
  1147. // Prototypes for functions in send.c
  1148. //
  1149. VOID
  1150. RndismpMultipleSend(IN NDIS_HANDLE MiniportAdapterContext,
  1151. IN PPNDIS_PACKET PacketArray,
  1152. IN UINT NumberOfPackets);
  1153. VOID
  1154. DoMultipleSend(IN PRNDISMP_ADAPTER pAdapter,
  1155. IN PRNDISMP_VC pVc OPTIONAL,
  1156. IN PPNDIS_PACKET PacketArray,
  1157. IN UINT NumberOfPackets);
  1158. VOID
  1159. DoMultipleSendRaw(IN PRNDISMP_ADAPTER pAdapter,
  1160. IN PRNDISMP_VC pVc OPTIONAL,
  1161. IN PPNDIS_PACKET PacketArray,
  1162. IN UINT NumberOfPackets);
  1163. PRNDISMP_PACKET_WRAPPER
  1164. PrepareDataMessage(IN PNDIS_PACKET pNdisPacket,
  1165. IN PRNDISMP_ADAPTER pAdapter,
  1166. IN PRNDISMP_VC pVc OPTIONAL,
  1167. IN OUT PULONG pTotalMessageLength);
  1168. PRNDISMP_PACKET_WRAPPER
  1169. PrepareDataMessageRaw(IN PNDIS_PACKET pNdisPacket,
  1170. IN PRNDISMP_ADAPTER pAdapter,
  1171. IN OUT PULONG pTotalMessageLength);
  1172. PRNDISMP_PACKET_WRAPPER
  1173. AllocatePacketMsgWrapper(IN PRNDISMP_ADAPTER pAdapter,
  1174. IN ULONG MsgHeaderLength);
  1175. VOID
  1176. FreePacketMsgWrapper(IN PRNDISMP_PACKET_WRAPPER pPktWrapper);
  1177. VOID
  1178. CompleteSendData(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1179. IN NDIS_STATUS SendStatus);
  1180. VOID
  1181. FreeMsgAfterSend(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1182. IN NDIS_STATUS SendStatus);
  1183. #if THROTTLE_MESSAGES
  1184. VOID
  1185. QueueMessageToMicroport(IN PRNDISMP_ADAPTER pAdapter,
  1186. IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1187. IN BOOLEAN bQueueMessageForResponse);
  1188. VOID
  1189. FlushPendingMessages(IN PRNDISMP_ADAPTER pAdapter);
  1190. #endif
  1191. VOID
  1192. SendProcessTimeout(IN PVOID SystemSpecific1,
  1193. IN PVOID Context,
  1194. IN PVOID SystemSpecific2,
  1195. IN PVOID SystemSpecific3);
  1196. //
  1197. // Prototypes for functions in request.c
  1198. //
  1199. NDIS_STATUS
  1200. RndismpQueryInformation(IN NDIS_HANDLE MiniportAdapterContext,
  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. ProcessQueryInformation(IN PRNDISMP_ADAPTER pAdapter,
  1208. IN PRNDISMP_VC pVc,
  1209. IN PNDIS_REQUEST pRequest,
  1210. IN NDIS_OID Oid,
  1211. IN PVOID InformationBuffer,
  1212. IN ULONG InformationBufferLength,
  1213. OUT PULONG pBytesWritten,
  1214. OUT PULONG pBytesNeeded);
  1215. NDIS_STATUS
  1216. RndismpSetInformation(IN NDIS_HANDLE MiniportAdapterContext,
  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. ProcessSetInformation(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 pBytesRead,
  1230. OUT PULONG pBytesNeeded);
  1231. NDIS_STATUS
  1232. DriverQueryInformation(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. DeviceQueryInformation(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 pBytesWritten,
  1248. OUT PULONG pBytesNeeded);
  1249. NDIS_STATUS
  1250. DriverSetInformation(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. NDIS_STATUS
  1259. DeviceSetInformation(IN PRNDISMP_ADAPTER pAdapter,
  1260. IN PRNDISMP_VC pVc OPTIONAL,
  1261. IN PNDIS_REQUEST pRequest OPTIONAL,
  1262. IN NDIS_OID Oid,
  1263. IN PVOID InformationBuffer,
  1264. IN ULONG InformationBufferLength,
  1265. OUT PULONG pBytesRead,
  1266. OUT PULONG pBytesNeeded);
  1267. BOOLEAN
  1268. QuerySetCompletionMessage(IN PRNDISMP_ADAPTER pAdapter,
  1269. IN PRNDIS_MESSAGE pMessage,
  1270. IN PMDL pMdl,
  1271. IN ULONG TotalLength,
  1272. IN NDIS_HANDLE MicroportMessageContext,
  1273. IN NDIS_STATUS ReceiveStatus,
  1274. IN BOOLEAN bMessageCopied);
  1275. VOID
  1276. CompleteSendDeviceRequest(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1277. IN NDIS_STATUS SendStatus);
  1278. #ifdef BUILD_WIN9X
  1279. VOID
  1280. CompleteSendDiscardDeviceRequest(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1281. IN NDIS_STATUS SendStatus);
  1282. #endif // BUILD_WIN9X
  1283. NDIS_STATUS
  1284. BuildOIDLists(IN PRNDISMP_ADAPTER Adapter,
  1285. IN PNDIS_OID DeviceOIDList,
  1286. IN UINT NumDeviceOID,
  1287. IN PNDIS_OID DriverOIDList,
  1288. IN UINT NumDriverOID);
  1289. UINT
  1290. GetOIDSupport(IN PRNDISMP_ADAPTER Adapter, IN NDIS_OID Oid);
  1291. VOID
  1292. FreeOIDLists(IN PRNDISMP_ADAPTER Adapter);
  1293. PRNDISMP_REQUEST_CONTEXT
  1294. AllocateRequestContext(IN PRNDISMP_ADAPTER pAdapter);
  1295. VOID
  1296. FreeRequestContext(IN PRNDISMP_ADAPTER pAdapter,
  1297. IN PRNDISMP_REQUEST_CONTEXT pReqContext);
  1298. NDIS_STATUS
  1299. SyncQueryDevice(IN PRNDISMP_ADAPTER pAdapter,
  1300. IN NDIS_OID Oid,
  1301. IN OUT PUCHAR InformationBuffer,
  1302. IN ULONG InformationBufferLength);
  1303. //
  1304. // Prototypes for functions in util.c
  1305. //
  1306. NDIS_STATUS
  1307. MemAlloc(OUT PVOID *Buffer, IN UINT Length);
  1308. VOID
  1309. MemFree(IN PVOID Buffer, IN UINT Length);
  1310. VOID
  1311. AddAdapter(IN PRNDISMP_ADAPTER Adapter);
  1312. VOID
  1313. RemoveAdapter(IN PRNDISMP_ADAPTER Adapter);
  1314. VOID
  1315. DeviceObjectToAdapterAndDriverBlock(IN PDEVICE_OBJECT pDeviceObject,
  1316. OUT PRNDISMP_ADAPTER * ppAdapter,
  1317. OUT PDRIVER_BLOCK * ppDriverBlock);
  1318. VOID
  1319. AddDriverBlock(IN PDRIVER_BLOCK Head, IN PDRIVER_BLOCK Item);
  1320. VOID
  1321. RemoveDriverBlock(IN PDRIVER_BLOCK BlockHead, IN PDRIVER_BLOCK Item);
  1322. PDRIVER_BLOCK
  1323. DeviceObjectToDriverBlock(IN PDRIVER_BLOCK Head,
  1324. IN PDEVICE_OBJECT DeviceObject);
  1325. PDRIVER_BLOCK
  1326. DriverObjectToDriverBlock(IN PDRIVER_BLOCK Head,
  1327. IN PDRIVER_OBJECT DriverObject);
  1328. PRNDISMP_MESSAGE_FRAME
  1329. AllocateMsgFrame(IN PRNDISMP_ADAPTER pAdapter);
  1330. VOID
  1331. DereferenceMsgFrame(IN PRNDISMP_MESSAGE_FRAME pMsgFrame);
  1332. VOID
  1333. ReferenceMsgFrame(IN PRNDISMP_MESSAGE_FRAME pMsgFrame);
  1334. VOID
  1335. EnqueueNDISPacket(IN PRNDISMP_ADAPTER Adapter, IN PNDIS_PACKET Packet);
  1336. PNDIS_PACKET
  1337. DequeueNDISPacket(IN PRNDISMP_ADAPTER Adapter);
  1338. VOID
  1339. KeepAliveTimerHandler(IN PVOID SystemSpecific1,
  1340. IN PVOID Context,
  1341. IN PVOID SystemSpecific2,
  1342. IN PVOID SystemSpecific3);
  1343. VOID
  1344. CompleteSendKeepAlive(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1345. IN NDIS_STATUS SendStatus);
  1346. PRNDISMP_MESSAGE_FRAME
  1347. BuildRndisMessageCommon(IN PRNDISMP_ADAPTER Adapter,
  1348. IN PRNDISMP_VC pVc,
  1349. IN UINT NdisMessageType,
  1350. IN NDIS_OID Oid,
  1351. IN PVOID InformationBuffer,
  1352. IN ULONG InformationBufferLength);
  1353. PRNDISMP_MESSAGE_FRAME
  1354. AllocateMessageAndFrame(IN PRNDISMP_ADAPTER Adapter,
  1355. IN UINT MessageSize);
  1356. VOID
  1357. FreeAdapter(IN PRNDISMP_ADAPTER pAdapter);
  1358. PRNDISMP_VC
  1359. AllocateVc(IN PRNDISMP_ADAPTER pAdapter);
  1360. VOID
  1361. DeallocateVc(IN PRNDISMP_VC pVc);
  1362. PRNDISMP_VC
  1363. LookupVcId(IN PRNDISMP_ADAPTER pAdapter,
  1364. IN UINT32 VcId);
  1365. VOID
  1366. EnterVcIntoHashTable(IN PRNDISMP_ADAPTER pAdapter,
  1367. IN PRNDISMP_VC pVc);
  1368. VOID
  1369. RemoveVcFromHashTable(IN PRNDISMP_ADAPTER pAdapter,
  1370. IN PRNDISMP_VC pVc);
  1371. //
  1372. // Prototypes for functions in comini.c
  1373. //
  1374. NDIS_STATUS
  1375. RndismpCoCreateVc(IN NDIS_HANDLE MiniportAdapterContext,
  1376. IN NDIS_HANDLE NdisVcHandle,
  1377. IN PNDIS_HANDLE pMiniportVcContext);
  1378. VOID
  1379. CompleteSendCoCreateVc(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1380. IN NDIS_STATUS SendStatus);
  1381. VOID
  1382. HandleCoCreateVcFailure(IN PRNDISMP_VC pVc,
  1383. IN NDIS_STATUS Status);
  1384. NDIS_STATUS
  1385. RndismpCoDeleteVc(IN NDIS_HANDLE MiniportVcContext);
  1386. NDIS_STATUS
  1387. StartVcDeletion(IN PRNDISMP_VC pVc);
  1388. VOID
  1389. CompleteSendCoDeleteVc(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1390. IN NDIS_STATUS SendStatus);
  1391. VOID
  1392. HandleCoDeleteVcFailure(IN PRNDISMP_VC pVc,
  1393. IN NDIS_STATUS Status);
  1394. NDIS_STATUS
  1395. RndismpCoActivateVc(IN NDIS_HANDLE MiniportVcContext,
  1396. IN PCO_CALL_PARAMETERS pCallParameters);
  1397. NDIS_STATUS
  1398. StartVcActivation(IN PRNDISMP_VC pVc);
  1399. VOID
  1400. CompleteSendCoActivateVc(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1401. IN NDIS_STATUS SendStatus);
  1402. NDIS_STATUS
  1403. RndismpCoDeactivateVc(IN NDIS_HANDLE MiniportVcContext);
  1404. VOID
  1405. CompleteSendCoDeactivateVc(IN PRNDISMP_MESSAGE_FRAME pMsgFrame,
  1406. IN NDIS_STATUS SendStatus);
  1407. NDIS_STATUS
  1408. RndismpCoRequest(IN NDIS_HANDLE MiniportAdapterContext,
  1409. IN NDIS_HANDLE MiniportVcContext,
  1410. IN OUT PNDIS_REQUEST pRequest);
  1411. VOID
  1412. RndismpCoSendPackets(IN NDIS_HANDLE MiniportVcContext,
  1413. IN PNDIS_PACKET * PacketArray,
  1414. IN UINT NumberOfPackets);
  1415. BOOLEAN
  1416. ReceiveCreateVcComplete(IN PRNDISMP_ADAPTER pAdapter,
  1417. IN PRNDIS_MESSAGE pMessage,
  1418. IN PMDL pMdl,
  1419. IN ULONG TotalLength,
  1420. IN NDIS_HANDLE MicroportMessageContext,
  1421. IN NDIS_STATUS ReceiveStatus,
  1422. IN BOOLEAN bMessageCopied);
  1423. BOOLEAN
  1424. ReceiveActivateVcComplete(IN PRNDISMP_ADAPTER pAdapter,
  1425. IN PRNDIS_MESSAGE pMessage,
  1426. IN PMDL pMdl,
  1427. IN ULONG TotalLength,
  1428. IN NDIS_HANDLE MicroportMessageContext,
  1429. IN NDIS_STATUS ReceiveStatus,
  1430. IN BOOLEAN bMessageCopied);
  1431. BOOLEAN
  1432. ReceiveDeleteVcComplete(IN PRNDISMP_ADAPTER pAdapter,
  1433. IN PRNDIS_MESSAGE pMessage,
  1434. IN PMDL pMdl,
  1435. IN ULONG TotalLength,
  1436. IN NDIS_HANDLE MicroportMessageContext,
  1437. IN NDIS_STATUS ReceiveStatus,
  1438. IN BOOLEAN bMessageCopied);
  1439. BOOLEAN
  1440. ReceiveDeactivateVcComplete(IN PRNDISMP_ADAPTER pAdapter,
  1441. IN PRNDIS_MESSAGE pMessage,
  1442. IN PMDL pMdl,
  1443. IN ULONG TotalLength,
  1444. IN NDIS_HANDLE MicroportMessageContext,
  1445. IN NDIS_STATUS ReceiveStatus,
  1446. IN BOOLEAN bMessageCopied);
  1447. PRNDISMP_MESSAGE_FRAME
  1448. BuildRndisMessageCoMiniport(IN PRNDISMP_ADAPTER pAdapter,
  1449. IN PRNDISMP_VC pVc,
  1450. IN UINT NdisMessageType,
  1451. IN PCO_CALL_PARAMETERS pCallParameters OPTIONAL);
  1452. VOID
  1453. CompleteSendDataOnVc(IN PRNDISMP_VC pVc,
  1454. IN PNDIS_PACKET pNdisPacket,
  1455. IN NDIS_STATUS Status);
  1456. VOID
  1457. IndicateReceiveDataOnVc(IN PRNDISMP_VC pVc,
  1458. IN PNDIS_PACKET * PacketArray,
  1459. IN UINT NumberOfPackets);
  1460. //
  1461. // Prototypes for functions in wdmutil.c
  1462. //
  1463. PDRIVER_OBJECT
  1464. DeviceObjectToDriverObject(IN PDEVICE_OBJECT DeviceObject);
  1465. NTSTATUS
  1466. GetDeviceFriendlyName(IN PDEVICE_OBJECT pDeviceObject,
  1467. OUT PANSI_STRING pAnsiString,
  1468. OUT PUNICODE_STRING pUnicodeString);
  1469. VOID
  1470. HookPnpDispatchRoutine(IN PDRIVER_BLOCK DriverBlock);
  1471. NTSTATUS
  1472. PnPDispatch(IN PDEVICE_OBJECT pDeviceObject,
  1473. IN PIRP pIrp);
  1474. #ifdef BUILD_WIN9X
  1475. VOID
  1476. HookNtKernCMHandler(IN PRNDISMP_ADAPTER pAdapter);
  1477. VOID
  1478. UnHookNtKernCMHandler(IN PRNDISMP_ADAPTER pAdapter);
  1479. MY_CONFIGRET __cdecl
  1480. RndisCMHandler(IN MY_CONFIGFUNC cfFuncName,
  1481. IN MY_SUBCONFIGFUNC cfSubFuncName,
  1482. IN MY_DEVNODE cfDevNode,
  1483. IN ULONG dwRefData,
  1484. IN ULONG ulFlags);
  1485. #endif
  1486. #if DBG
  1487. //
  1488. // Prototypes for functions in debug.c
  1489. //
  1490. PCHAR
  1491. GetOidName(IN NDIS_OID Oid);
  1492. VOID
  1493. DisplayOidList(IN PRNDISMP_ADAPTER Adapter);
  1494. VOID
  1495. RndisPrintHexDump(PVOID Pointer,
  1496. ULONG Length);
  1497. VOID
  1498. RndisLogSendMessage(
  1499. IN PRNDISMP_ADAPTER pAdapter,
  1500. IN PRNDISMP_MESSAGE_FRAME pMsgFrame);
  1501. #endif
  1502. #endif // _RNDISMP_H_