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.

624 lines
15 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. D:\nt\private\ntos\tdi\rawwan\core\rwanpub.h
  5. Abstract:
  6. Null Transport Public definitions. This is included by helper
  7. routines that perform media/Address family specific actions.
  8. Revision History:
  9. Who When What
  10. -------- -------- ----------------------------------------------
  11. arvindm 04-24-97 Created
  12. Notes:
  13. --*/
  14. #ifndef __TDI_RWANPUB__H
  15. #define __TDI_RWANPUB__H
  16. //
  17. // Null Transport status codes. Used between the core Null Transport
  18. // and helper routines.
  19. //
  20. typedef ULONG RWAN_STATUS;
  21. #define RWAN_STATUS_SUCCESS 0x00000000
  22. #define RWAN_STATUS_FAILURE 0xc0000001
  23. #define RWAN_STATUS_BAD_ADDRESS 0x00000001
  24. #define RWAN_STATUS_NULL_ADDRESS 0x00000002
  25. #define RWAN_STATUS_WILDCARD_ADDRESS 0x00000003
  26. #define RWAN_STATUS_BAD_PARAMETER 0x00000010
  27. #define RWAN_STATUS_MISSING_PARAMETER 0x00000020
  28. #define RWAN_STATUS_RESOURCES 0x00000040
  29. #define RWAN_STATUS_PENDING 0x00000103
  30. typedef PVOID RWAN_HANDLE, *PRWAN_HANDLE;
  31. //
  32. // Bit definitions for CallFlags
  33. //
  34. // Bit 0 is set iff Incoming Call:
  35. #define RWAN_CALLF_OUTGOING_CALL 0x00000000
  36. #define RWAN_CALLF_INCOMING_CALL 0x00000001
  37. #define RWAN_CALLF_CALL_DIRECTION_MASK 0x00000001
  38. // Bit 1 is set iff Point to Multipoint Call:
  39. #define RWAN_CALLF_POINT_TO_POINT 0x00000000
  40. #define RWAN_CALLF_POINT_TO_MULTIPOINT 0x00000002
  41. #define RWAN_CALLF_CALL_TYPE_MASK 0x00000002
  42. // Bit 2 is set iff Add Party:
  43. #define RWAN_CALLF_PMP_FIRST_LEAF 0x00000000
  44. #define RWAN_CALLF_PMP_ADDNL_LEAF 0x00000004
  45. #define RWAN_CALLF_PMP_LEAF_TYPE_MASK 0x00000004
  46. #ifndef EXTERN
  47. #define EXTERN extern
  48. #endif
  49. //
  50. // Entry points for NDIS AF-specific helper routines. All media/AF specific
  51. // actions are done by these routines.
  52. //
  53. //
  54. // Init routine. Called once when loading.
  55. //
  56. typedef
  57. RWAN_STATUS
  58. (*AFSP_INIT_HANDLER)();
  59. //
  60. // Shutdown routine. Called once when unloading.
  61. //
  62. typedef
  63. VOID
  64. (*AFSP_SHUTDOWN_HANDLER)();
  65. //
  66. // Set up context for an NDIS AF open. This is called after a
  67. // successful OpenAddressFamily for a supported AF+Medium.
  68. // The AF-specific module must allocate its context for this AF
  69. // open, perform any initializations (including OID queries to
  70. // the CM/Miniport) and return this context to us.
  71. // If the handler returns RWAN_STATUS_PENDING, it must call
  72. // RWanAfSpOpenAfComplete to complete this call.
  73. //
  74. typedef
  75. RWAN_STATUS
  76. (*AFSP_OPEN_AF_HANDLER)(
  77. IN RWAN_HANDLE AfSpContext,
  78. IN RWAN_HANDLE RWanAFHandle,
  79. OUT PRWAN_HANDLE pAfSpAFContext,
  80. OUT PULONG pMaxMsgSize
  81. );
  82. //
  83. // Shut down prior to closing an NDIS AF open. This gives a chance
  84. // for the AF-specific module to perform any clean up operations,
  85. // including freeing any context, for an NDIS AF open.
  86. // If the handler returns RWAN_STATUS_PENDING, it must call
  87. // RWanAfSpCloseAfComplete to complete this call.
  88. //
  89. typedef
  90. RWAN_STATUS
  91. (*AFSP_CLOSE_AF_HANDLER)(
  92. IN RWAN_HANDLE AfSpAFContext
  93. );
  94. //
  95. // Notify media-specific module of a new Address Object being
  96. // opened for this medium. The media-specific module creates
  97. // its context for this address object and returns it.
  98. //
  99. typedef
  100. RWAN_STATUS
  101. (*AFSP_OPEN_ADDRESS_HANDLER)(
  102. IN RWAN_HANDLE AfSpContext,
  103. IN RWAN_HANDLE RWanAddrHandle,
  104. OUT PRWAN_HANDLE pAfSpAddrContext
  105. );
  106. //
  107. // Notify media-specific module of an Address Object being
  108. // closed.
  109. //
  110. typedef
  111. VOID
  112. (*AFSP_CLOSE_ADDRESS_HANDLER)(
  113. IN RWAN_HANDLE AfSpAddrContext
  114. );
  115. //
  116. // Notify media-specific module of a new Connection Object being
  117. // associated with an Address Object belonging to this media. The
  118. // media-specific module would typically create its context for
  119. // the Connection Object and return a pointer to it.
  120. //
  121. typedef
  122. RWAN_STATUS
  123. (*AFSP_ASSOCIATE_CONN_HANDLER)(
  124. IN RWAN_HANDLE AfSpAddrContext,
  125. IN RWAN_HANDLE RWanConnHandle,
  126. OUT PRWAN_HANDLE pAfSpConnContext
  127. );
  128. //
  129. // Notify media-specific module of an existing Connection Object
  130. // being disassociated from an Address Object belonging to this module.
  131. //
  132. typedef
  133. VOID
  134. (*AFSP_DISASSOCIATE_CONN_HANDLER)(
  135. IN RWAN_HANDLE AfSpConnContext
  136. );
  137. //
  138. // Convert options in TDI format to NDIS call parameters. The handler
  139. // is supposed to allocate space for NDIS call parameters, and return
  140. // this to the caller (via ppCallParameters).
  141. //
  142. // Also this returns the RWAN handle for the AF on which the call should
  143. // be placed. If this is NULL, then the first AF is chosen.
  144. //
  145. typedef
  146. RWAN_STATUS
  147. (*AFSP_TDI2NDIS_OPTIONS_HANDLER)(
  148. IN RWAN_HANDLE AfSpConnContext,
  149. IN ULONG CallFlags,
  150. IN PTDI_CONNECTION_INFORMATION pTdiInfo,
  151. IN PVOID pTdiQoS,
  152. IN ULONG TdiQoSLength,
  153. OUT PRWAN_HANDLE pAfHandle,
  154. OUT PCO_CALL_PARAMETERS * ppCallParameters
  155. );
  156. //
  157. // Update NDIS call parameters with TDI options. This typically
  158. // happens when an incoming call is accepted with modified parameters.
  159. //
  160. typedef
  161. RWAN_STATUS
  162. (*AFSP_UPDATE_NDIS_OPTIONS_HANDLER)(
  163. IN RWAN_HANDLE AfSpAFContext,
  164. IN RWAN_HANDLE AfSpConnContext,
  165. IN ULONG CallFlags,
  166. IN PTDI_CONNECTION_INFORMATION pTdiInfo,
  167. IN PVOID pTdiQoS,
  168. IN ULONG TdiQoSLength,
  169. IN OUT PCO_CALL_PARAMETERS * ppCallParameters
  170. );
  171. //
  172. // Return space allocated for NDIS Options to the AF Specific module.
  173. // See AFSP_TDI2NDIS_OPTIONS_HANDLER.
  174. //
  175. typedef
  176. VOID
  177. (*AFSP_RETURN_NDIS_OPTIONS_HANDLER)(
  178. IN RWAN_HANDLE AfSpAFContext,
  179. IN PCO_CALL_PARAMETERS pCallParameters
  180. );
  181. //
  182. // Convert NDIS call parameters to TDI-style options. The handler
  183. // is supposed to allocate space for options+data+QoS parameters,
  184. // and return these to the caller. When the caller is done with
  185. // these, it will call the TDI Options return handler with
  186. // a context returned by the handler.
  187. //
  188. typedef
  189. RWAN_STATUS
  190. (*AFSP_NDIS2TDI_OPTIONS_HANDLER)(
  191. IN RWAN_HANDLE AfSpAFContext,
  192. IN ULONG CallFlags,
  193. IN PCO_CALL_PARAMETERS pCallParameters,
  194. OUT PTDI_CONNECTION_INFORMATION *ppTdiInfo,
  195. OUT PVOID * ppTdiQoS,
  196. OUT PULONG pTdiQoSLength,
  197. OUT PRWAN_HANDLE pAfSpTdiOptionsContext
  198. );
  199. //
  200. // Update TDI-style options from NDIS call parameters. This is usually
  201. // done when completing an outgoing call.
  202. //
  203. typedef
  204. RWAN_STATUS
  205. (*AFSP_UPDATE_TDI_OPTIONS_HANDLER)(
  206. IN RWAN_HANDLE AfSpAFContext,
  207. IN RWAN_HANDLE AfSpConnContext,
  208. IN ULONG CallFlags,
  209. IN PCO_CALL_PARAMETERS pCallParameters,
  210. IN OUT PTDI_CONNECTION_INFORMATION * pTdiInfo,
  211. IN OUT PUCHAR pTdiQoS,
  212. IN OUT PULONG pTdiQoSLength
  213. );
  214. //
  215. // Return space allocated for TDI options etc to the AF Specific module.
  216. // See AFSP_NDIS2TDI_OPTIONS_HANDLER.
  217. //
  218. typedef
  219. VOID
  220. (*AFSP_RETURN_TDI_OPTIONS_HANDLER)(
  221. IN RWAN_HANDLE AfSpAFContext,
  222. IN RWAN_HANDLE AfSpTdiOptionsContext
  223. );
  224. //
  225. // Get a valid Transport Address from a list of addresses.
  226. //
  227. typedef
  228. TA_ADDRESS *
  229. (*AFSP_GET_VALID_TDI_ADDRESS_HANDLER)(
  230. IN RWAN_HANDLE AfSpContext,
  231. IN TRANSPORT_ADDRESS UNALIGNED *pAddressList,
  232. IN ULONG AddrListLength
  233. );
  234. //
  235. // Check if a given Transport address is non-NULL. This means that it is
  236. // usable as a SAP address.
  237. //
  238. typedef
  239. BOOLEAN
  240. (*AFSP_IS_NULL_ADDRESS_HANDLER)(
  241. IN RWAN_HANDLE AfSpContext,
  242. IN TA_ADDRESS * pTransportAddress
  243. );
  244. //
  245. // Convert a TDI-style address specification to an NDIS SAP.
  246. // Allocate space for the NDIS SAP and return it if successful.
  247. //
  248. typedef
  249. RWAN_STATUS
  250. (*AFSP_TDI2NDIS_SAP_HANDLER)(
  251. IN RWAN_HANDLE AfSpContext,
  252. IN USHORT TdiAddressType,
  253. IN USHORT TdiAddressLength,
  254. IN PVOID pTdiAddress,
  255. OUT PCO_SAP * ppCoSap
  256. );
  257. //
  258. // Return space allocated for an NDIS SAP. See AFSP_TDI2NDIS_SAP_HANDLER.
  259. //
  260. typedef
  261. VOID
  262. (*AFSP_RETURN_NDIS_SAP_HANDLER)(
  263. IN RWAN_HANDLE AfSpContext,
  264. IN PCO_SAP pCoSap
  265. );
  266. //
  267. // Complete a media-specific module's call to RWanAfSpDeregisterNdisAF
  268. // that had pended.
  269. //
  270. typedef
  271. VOID
  272. (*AFSP_DEREG_NDIS_AF_COMP_HANDLER)(
  273. IN RWAN_STATUS RWanStatus,
  274. IN RWAN_HANDLE AfSpNdisAFContext
  275. );
  276. //
  277. // Complete a media-specific module's call to RWanAfSpDeregisterTdiProtocol
  278. // that had pended.
  279. //
  280. typedef
  281. VOID
  282. (*AFSP_DEREG_TDI_PROTO_COMP_HANDLER)(
  283. IN RWAN_STATUS RWanStatus,
  284. IN RWAN_HANDLE AfSpTdiProtocolContext
  285. );
  286. //
  287. // Complete a media-specific module's call to send an NDIS Request
  288. // to the miniport
  289. //
  290. typedef
  291. VOID
  292. (*AFSP_ADAPTER_REQUEST_COMP_HANDLER)(
  293. IN NDIS_STATUS Status,
  294. IN RWAN_HANDLE AfSpAFContext,
  295. IN RWAN_HANDLE AfSpReqContext,
  296. IN NDIS_REQUEST_TYPE RequestType,
  297. IN NDIS_OID Oid,
  298. IN PVOID pBuffer,
  299. IN ULONG BufferLength
  300. );
  301. //
  302. // Complete a media-specific module's call to send an NDIS Request
  303. // to the Call Manager (AF-specific request)
  304. //
  305. typedef
  306. VOID
  307. (*AFSP_AF_REQUEST_COMP_HANDLER)(
  308. IN NDIS_STATUS Status,
  309. IN RWAN_HANDLE AfSpAFContext,
  310. IN RWAN_HANDLE AfSpReqContext,
  311. IN NDIS_REQUEST_TYPE RequestType,
  312. IN NDIS_OID Oid,
  313. IN PVOID pBuffer,
  314. IN ULONG BufferLength
  315. );
  316. //
  317. // Process a media-specific global Query Information IOCTL from the Winsock2 helper DLL.
  318. //
  319. typedef
  320. RWAN_STATUS
  321. (*AFSP_QUERY_GLOBAL_INFO_HANDLER)(
  322. IN RWAN_HANDLE AfSpContext,
  323. IN PVOID pInputBuffer,
  324. IN ULONG InputBufferLength,
  325. IN PVOID pOutputBuffer,
  326. IN OUT PULONG pOutputBufferLength
  327. );
  328. //
  329. // Process a media-specific global Set Information IOCTL from the Winsock2 helper DLL.
  330. //
  331. typedef
  332. RWAN_STATUS
  333. (*AFSP_SET_GLOBAL_INFO_HANDLER)(
  334. IN RWAN_HANDLE AfSpContext,
  335. IN PVOID pInputBuffer,
  336. IN ULONG InputBufferLength
  337. );
  338. //
  339. // Process a media-specific per-connection Query Information IOCTL
  340. // from the Winsock2 helper DLL.
  341. //
  342. typedef
  343. RWAN_STATUS
  344. (*AFSP_QUERY_CONN_INFORMATION_HANDLER)(
  345. IN RWAN_HANDLE AfSpConnContext,
  346. IN PVOID pInputBuffer,
  347. IN ULONG InputBufferLength,
  348. OUT PVOID pOutputBuffer,
  349. IN OUT PULONG pOutputBufferLength
  350. );
  351. //
  352. // Process a media-specific per-connection Set Information IOCTL
  353. // from the Winsock2 helper DLL.
  354. //
  355. typedef
  356. RWAN_STATUS
  357. (*AFSP_SET_CONN_INFORMATION_HANDLER)(
  358. IN RWAN_HANDLE AfSpConnContext,
  359. IN PVOID pInputBuffer,
  360. IN ULONG InputBufferLength
  361. );
  362. //
  363. // Process a media-specific per-AddressObject Query Information IOCTL
  364. // from the Winsock2 helper DLL.
  365. //
  366. typedef
  367. RWAN_STATUS
  368. (*AFSP_QUERY_ADDR_INFORMATION_HANDLER)(
  369. IN RWAN_HANDLE AfSpAddrContext,
  370. IN PVOID pInputBuffer,
  371. IN ULONG InputBufferLength,
  372. IN PVOID pOutputBuffer,
  373. IN OUT PULONG pOutputBufferLength
  374. );
  375. //
  376. // Process a media-specific per-AddressObject Set Information IOCTL
  377. // from the Winsock2 helper DLL.
  378. //
  379. typedef
  380. RWAN_STATUS
  381. (*AFSP_SET_ADDR_INFORMATION_HANDLER)(
  382. IN RWAN_HANDLE AfSpAddrContext,
  383. IN PVOID pInputBuffer,
  384. IN ULONG InputBufferLength
  385. );
  386. //
  387. // ***** NDIS AF Characteristics *****
  388. //
  389. // AF-specific information about a supported NDIS Address Family on
  390. // a supported NDIS medium. One of these exists for each
  391. // <CO_ADDRESS_FAMILY, NDIS_MEDIUM> pair.
  392. //
  393. typedef struct _RWAN_NDIS_AF_CHARS
  394. {
  395. ULONG MajorVersion;
  396. ULONG MinorVersion;
  397. NDIS_MEDIUM Medium;
  398. CO_ADDRESS_FAMILY AddressFamily;
  399. ULONG MaxAddressLength;
  400. AFSP_OPEN_AF_HANDLER pAfSpOpenAf;
  401. AFSP_CLOSE_AF_HANDLER pAfSpCloseAf;
  402. AFSP_OPEN_ADDRESS_HANDLER pAfSpOpenAddress;
  403. AFSP_CLOSE_ADDRESS_HANDLER pAfSpCloseAddress;
  404. AFSP_ASSOCIATE_CONN_HANDLER pAfSpAssociateConnection;
  405. AFSP_DISASSOCIATE_CONN_HANDLER pAfSpDisassociateConnection;
  406. AFSP_TDI2NDIS_OPTIONS_HANDLER pAfSpTdi2NdisOptions;
  407. AFSP_RETURN_NDIS_OPTIONS_HANDLER pAfSpReturnNdisOptions;
  408. AFSP_UPDATE_NDIS_OPTIONS_HANDLER pAfSpUpdateNdisOptions;
  409. AFSP_NDIS2TDI_OPTIONS_HANDLER pAfSpNdis2TdiOptions;
  410. AFSP_RETURN_TDI_OPTIONS_HANDLER pAfSpReturnTdiOptions;
  411. AFSP_UPDATE_TDI_OPTIONS_HANDLER pAfSpUpdateTdiOptions;
  412. AFSP_GET_VALID_TDI_ADDRESS_HANDLER pAfSpGetValidTdiAddress;
  413. AFSP_IS_NULL_ADDRESS_HANDLER pAfSpIsNullAddress;
  414. AFSP_TDI2NDIS_SAP_HANDLER pAfSpTdi2NdisSap;
  415. AFSP_RETURN_NDIS_SAP_HANDLER pAfSpReturnNdisSap;
  416. AFSP_DEREG_NDIS_AF_COMP_HANDLER pAfSpDeregNdisAFComplete;
  417. AFSP_ADAPTER_REQUEST_COMP_HANDLER pAfSpAdapterRequestComplete;
  418. AFSP_AF_REQUEST_COMP_HANDLER pAfSpAfRequestComplete;
  419. AFSP_QUERY_GLOBAL_INFO_HANDLER pAfSpQueryGlobalInfo;
  420. AFSP_SET_GLOBAL_INFO_HANDLER pAfSpSetGlobalInfo;
  421. AFSP_QUERY_CONN_INFORMATION_HANDLER pAfSpQueryConnInformation;
  422. AFSP_SET_CONN_INFORMATION_HANDLER pAfSpSetConnInformation;
  423. AFSP_QUERY_ADDR_INFORMATION_HANDLER pAfSpQueryAddrInformation;
  424. AFSP_SET_ADDR_INFORMATION_HANDLER pAfSpSetAddrInformation;
  425. } RWAN_NDIS_AF_CHARS, *PRWAN_NDIS_AF_CHARS;
  426. //
  427. // ***** TDI Protocol Characteristics *****
  428. //
  429. // This contains information about a TDI protocol that's supported over
  430. // an <NDIS AF, medium> pair. This is used by the AF+Medium specific module
  431. // in a call to RWanAfSpRegisterTdiProtocol.
  432. //
  433. typedef struct _RWAN_TDI_PROTOCOL_CHARS
  434. {
  435. UINT TdiProtocol;
  436. UINT SockAddressFamily;
  437. UINT SockProtocol;
  438. UINT SockType;
  439. BOOLEAN bAllowConnObjects;
  440. BOOLEAN bAllowAddressObjects;
  441. USHORT MaxAddressLength;
  442. TDI_PROVIDER_INFO ProviderInfo;
  443. PNDIS_STRING pDeviceName;
  444. AFSP_DEREG_TDI_PROTO_COMP_HANDLER pAfSpDeregTdiProtocolComplete;
  445. } RWAN_TDI_PROTOCOL_CHARS, *PRWAN_TDI_PROTOCOL_CHARS;
  446. //
  447. // ***** AF-Specific Module Entry *****
  448. //
  449. // This contains the basic entry points for an AF/medium-specific module.
  450. //
  451. typedef struct _RWAN_AFSP_MODULE_CHARS
  452. {
  453. AFSP_INIT_HANDLER pAfSpInitHandler;
  454. AFSP_SHUTDOWN_HANDLER pAfSpShutdownHandler;
  455. } RWAN_AFSP_MODULE_CHARS, *PRWAN_AFSP_MODULE_CHARS;
  456. //
  457. // Exported Routines. Media/AF specific modules can call these.
  458. //
  459. EXTERN
  460. RWAN_STATUS
  461. RWanAfSpRegisterNdisAF(
  462. IN PRWAN_NDIS_AF_CHARS pAfChars,
  463. IN RWAN_HANDLE AfSpContext,
  464. OUT PRWAN_HANDLE pRWanSpHandle
  465. );
  466. EXTERN
  467. RWAN_STATUS
  468. RWanAfSpDeregisterNdisAF(
  469. IN RWAN_HANDLE RWanSpAFHandle
  470. );
  471. EXTERN
  472. RWAN_STATUS
  473. RWanAfSpRegisterTdiProtocol(
  474. IN RWAN_HANDLE RWanSpHandle,
  475. IN PRWAN_TDI_PROTOCOL_CHARS pTdiChars,
  476. OUT PRWAN_HANDLE pRWanProtHandle
  477. );
  478. EXTERN
  479. VOID
  480. RWanAfSpDeregisterTdiProtocol(
  481. IN RWAN_HANDLE RWanProtHandle
  482. );
  483. EXTERN
  484. VOID
  485. RWanAfSpOpenAfComplete(
  486. IN RWAN_STATUS RWanStatus,
  487. IN RWAN_HANDLE RWanAfHandle,
  488. IN RWAN_HANDLE AfSpAFContext,
  489. IN ULONG MaxMessageSize
  490. );
  491. EXTERN
  492. VOID
  493. RWanAfSpCloseAfComplete(
  494. IN RWAN_HANDLE RWanAfHandle
  495. );
  496. EXTERN
  497. RWAN_STATUS
  498. RWanAfSpSendAdapterRequest(
  499. IN RWAN_HANDLE RWanAfHandle,
  500. IN RWAN_HANDLE AfSpReqContext,
  501. IN NDIS_REQUEST_TYPE RequestType,
  502. IN NDIS_OID Oid,
  503. IN PVOID pBuffer,
  504. IN ULONG BufferLength
  505. );
  506. EXTERN
  507. RWAN_STATUS
  508. RWanAfSpSendAfRequest(
  509. IN RWAN_HANDLE RWanAfHandle,
  510. IN RWAN_HANDLE AfSpReqContext,
  511. IN NDIS_REQUEST_TYPE RequestType,
  512. IN NDIS_OID Oid,
  513. IN PVOID pBuffer,
  514. IN ULONG BufferLength
  515. );
  516. #endif // __TDI_RWANPUB__H