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.

2436 lines
56 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1996 - 1999
  3. Module Name:
  4. RpcTrans.hxx
  5. Abstract:
  6. Interface to transport (network protocol) used by the RPC runtime.
  7. Each protocol supported by RPC must implement this interface.
  8. Environment:
  9. User mode Windows NT, Windows 95 and PPC Macintosh.
  10. Author:
  11. Mario Goertzel [MarioGo]
  12. Revision History:
  13. MarioGo 10/22/1996 Based on old, sync transport interface
  14. EdwardR 07/09/1997 Added support for message transports (Falcon).
  15. --*/
  16. #ifndef __RPC_TRANS_HXX
  17. #define __RPC_TRANS_HXX
  18. // The runtime and transport DLL must share the same version number
  19. const unsigned short RPC_TRANSPORT_INTERFACE_VERSION = 0x2004;
  20. #if defined(_RPCRT4_) && !defined(_RPCTRANS_)
  21. typedef PVOID BUFFER;
  22. #else
  23. typedef PUCHAR BUFFER;
  24. #endif
  25. //
  26. // When an IO completes an event it returned to the runtime.
  27. // Usually it will be one of connection/datagram | one of client/server
  28. // | one of send/receive. Example CONNECTION|SERVER|SEND indicates
  29. // that a send completed on a server-side connection.
  30. //
  31. //
  32. typedef UINT RPC_TRANSPORT_EVENT;
  33. const UINT CONNECTION = 0x0;
  34. const UINT DATAGRAM = 0x1;
  35. const UINT CLIENT = 0x0;
  36. const UINT SERVER = 0x4;
  37. const UINT SEND = 0x0;
  38. const UINT RECEIVE = 0x8;
  39. // there is some subtle namespace partitioning here. Complex_T will
  40. // be used only by HTTP2's connections, which we know are not
  41. // datagram or address. Therefore, the values 17 and 18, used
  42. // as RuntimePosted and NewAddress do not conflict with Complex_T
  43. // connections
  44. const UINT COMPLEX_T = 0x10;
  45. // Internal to transport - these bits should not be
  46. // set in any events which reach the RPC runtime.
  47. const UINT TRANSPORT = 0x10;
  48. const UINT ADDRESS = 0x2;
  49. // Masks for switching on a given event flag
  50. const UINT PROTO_MASK = 0x0003;
  51. const UINT TYPE_MASK = 0x0004;
  52. const UINT IO_MASK = 0x0008;
  53. // Event posted by the RPC runtime via POST_EVENT
  54. // and the context is whatever context the runtime
  55. // passed into POST_EVENT
  56. const UINT RuntimePosted = 0x11;
  57. const UINT NewAddress = 0x12;
  58. const UINT LastRuntimeConstant = COMPLEX_T | SERVER | RECEIVE;
  59. // Predefine events - these are the only combinations
  60. // that the transport interface can return.
  61. const UINT ConnectionServerReceive = CONNECTION | SERVER | RECEIVE;
  62. const UINT ConnectionServerSend = CONNECTION | SERVER | SEND;
  63. const UINT ConnectionClientReceive = CONNECTION | CLIENT | RECEIVE;
  64. const UINT ConnectionClientSend = CONNECTION | CLIENT | SEND;
  65. const UINT DatagramServerReceive = DATAGRAM | SERVER | RECEIVE;
  66. const UINT DatagramServerSend = DATAGRAM | SERVER | SEND;
  67. const UINT DatagramClientReceive = DATAGRAM | CLIENT | RECEIVE;
  68. const UINT DatagramClientSend = DATAGRAM | CLIENT | SEND;
  69. // Protocol or Endpoint ID's. These are associated with
  70. // the endpoint entry in the tower and are what the runtime
  71. // sees last before calling the transport interface.
  72. const INT TCP_TOWER_ID = 0x07; // TCP/IP protocol
  73. const INT UDP_TOWER_ID = 0x08; // UDP/IP protocol
  74. const INT LRPC_TOWER_ID = 0x09; // Used for debugging only - never goes
  75. // on the wire or in any tower. We just
  76. // use this number to be able to uniquely
  77. // identify all protocols with a single
  78. // number.
  79. const INT CDP_TOWER_ID = 0x00; // CDP/IP protocol
  80. #ifdef SPX_ON
  81. const INT SPX_TOWER_ID = 0x0C; // Netware SPX protocol
  82. #endif
  83. #ifdef IPX_ON
  84. const INT IPX_TOWER_ID = 0x0E; // Netware IPX protocol
  85. #endif
  86. const INT NMP_TOWER_ID = 0x0F; // Microsoft (SMB) named pipes
  87. #ifdef NETBIOS_ON
  88. const INT NB_TOWER_ID = 0x12; // Netbios protocol
  89. #endif
  90. #ifdef APPLETALK_ON
  91. const INT DSP_TOWER_ID = 0x16; // Appletalk datastream protocol
  92. const INT DDP_TOWER_ID = 0x17; // Appletalk datagram protocol
  93. #endif
  94. //const INT SPP_TOWER_ID = 0x1A; // Banyan stream protocol - no longer supported
  95. #ifdef NCADG_MQ_ON
  96. const INT MQ_TOWER_ID = 0x1D; // Falcon protocol
  97. #endif
  98. const INT HTTP_TOWER_ID = 0x1F; // HTTP protocol
  99. extern "C" {
  100. typedef void (*RUNTIME_EVENT_FN)(PVOID Context);
  101. typedef RPC_STATUS
  102. (RPC_ENTRY * PROCESS_CALLS)
  103. (
  104. IN INT Timeout,
  105. OUT RPC_TRANSPORT_EVENT *pEvent,
  106. OUT RPC_STATUS *pEventStatus,
  107. OUT PVOID *ppEventContext,
  108. OUT UINT *pBufferLength,
  109. OUT BUFFER *pBuffer,
  110. OUT PVOID *ppSourceContext
  111. );
  112. /*++
  113. Routine Description:
  114. This routine waits for any async IO to complete for all protocols
  115. within a transport DLL. It maybe called by multiple threads at a
  116. time. A minimum of one thread should always be calling this function
  117. for each DLL.
  118. Note: async clients with no outstanding IO may allow the
  119. last thread to timeout and only call this function again
  120. when a new call is started.
  121. Note: During calls to this API in connection oriented servers
  122. a callback to I_RpcTransServerNewConnection() may occur.
  123. Arguments:
  124. Timeout - Milliseconds to block or INFINITE (-1)
  125. pEvent - Indicates what sort of IO event has completed (finished)
  126. pEventStatus - Indicates the status of the IO event.
  127. RPC_S_OK - IO completed normally
  128. RPC_P_RECEIVE_FAILED - Some kind of receive failed.
  129. RPC_P_SEND_FAILED - CO_SEND failed and the connection has been aborted.
  130. RPC_P_OVERSIZED_PACKET - Datagram received a packet that was larger
  131. then the buffer size. (Partial datagram in buffer).
  132. RPC_P_ENDPOINT_CLOSED - ASync datagram client endpoint closed.
  133. RPC_P_CONNECTION_CLOSED - Transport closed a connection due
  134. to some internal resource issue.
  135. ppEventContext -
  136. An RPC_TRANSPORT_CONNECTION object for all Connection events
  137. An RPC_TRANSPORT_ENDPOINT for Datagram receive events.
  138. pBuffer - Will contain the sent or received buffer
  139. pBufferLength - The size of the data sent/received in pBuffer
  140. ppSourceContext - For connection sends this is SendContext parameter
  141. passed into the Send() call.
  142. For datagram this is the sources address (DG_TRANSPORT_ADDRESS)
  143. of the packet.
  144. Return Value:
  145. RPC_S_OK - IO completed successfully or with an error. See pEventStatus.
  146. RPC_P_TIMEOUT - Timeout period expired no IP completed.
  147. --*/
  148. typedef VOID
  149. (RPC_ENTRY * LISTEN_FOR_PNP_NOTIFICATIONS)
  150. (
  151. );
  152. typedef VOID
  153. (RPC_ENTRY * START_PNP_NOTIFICATIONS)
  154. (
  155. );
  156. typedef RPC_STATUS
  157. (RPC_ENTRY *TOWER_CONSTRUCT)
  158. (
  159. IN PCHAR Protseq,
  160. IN PCHAR NetworkAddress,
  161. IN PCHAR Endpoint,
  162. OUT PUSHORT Floors,
  163. OUT PULONG ByteCount,
  164. OUT PUCHAR *Tower
  165. );
  166. /*++
  167. Routine Description:
  168. Constructs a OSF tower for the protocol, network address and endpoint.
  169. Arguments:
  170. Protseq - The protocol for the tower.
  171. NetworkAddress - The network address to be encoded in the tower.
  172. Endpoint - The endpoint to be encoded in the tower.
  173. Floors - The number of twoer floors it encoded into the tower.
  174. ByteCount - The size of the "upper-transport-specific" tower that
  175. is encoded by this call.
  176. Tower - The encoded "upper tower" that is encoded by this call.
  177. This caller is responsible for freeing this memory.
  178. Return Value:
  179. RPC_S_OK
  180. RPC_S_OUT_OF_MEMORY
  181. RPC_S_OUT_OF_RESOURCES
  182. --*/
  183. typedef RPC_STATUS
  184. (RPC_ENTRY *TOWER_EXPLODE)
  185. (
  186. IN PUCHAR Tower,
  187. OUT PCHAR *Protseq,
  188. OUT PCHAR *NetworkAddress,
  189. OUT PCHAR *Endpoint
  190. );
  191. /*++
  192. Routine Description:
  193. Decodes an OSF transport "upper tower" for the runtime.
  194. Arguments:
  195. Tower - The encoded "upper tower" to decode
  196. Protseq - The protseq encoded in the Tower
  197. Does not need to be freed by the caller.
  198. NetworkAddress - The network address encoded in the Tower
  199. Must be freed by the caller.
  200. Endpoint - The endpoint encoded in the Tower.
  201. Must be freed by the caller.
  202. Return Value:
  203. RPC_S_OK
  204. RPC_S_OUT_OF_MEMORY
  205. --*/
  206. typedef RPC_STATUS
  207. (RPC_ENTRY *POST_EVENT)
  208. (
  209. IN DWORD Type,
  210. IN PVOID Context
  211. );
  212. /*++
  213. Routine Description:
  214. Posts an event to the completion port. This will complete
  215. with an event type of RuntimePosted, event status RPC_S_OK
  216. and event context of Context.
  217. Arguments:
  218. Context - Context associated with the event
  219. Return Value:
  220. RPC_S_OK
  221. RPC_S_OUT_OF_RESOURCES
  222. RPC_S_OUT_OF_MEMORY
  223. --*/
  224. } // extern "C"
  225. // This is the "base class" for each of the two types of transport
  226. // interfaces, connection and datagram. Each transport interface DLL
  227. // supports these common function and has only one implementation of
  228. // the ProcessCalls method.
  229. //
  230. // NOTE: Any changes here MUST also be made in BOTH the datagram and connection
  231. // specific transport interface definitions.
  232. struct RPC_TRANSPORT_INTERFACE_HEADER
  233. {
  234. UINT TransInterfaceVersion; // Compiled in version
  235. USHORT TransId; // OSF DCE Tower ID for the protocol (eg TCP)
  236. USHORT TransAddrId; // OSF DCE Tower ID for the address format (eg IP)
  237. const RPC_CHAR *ProtocolSequence; // DCE RPC Protseq
  238. const PCHAR WellKnownEndpoint; // Well known endpoint mapper endpoint
  239. PROCESS_CALLS ProcessCalls;
  240. #ifndef NO_PLUG_AND_PLAY
  241. START_PNP_NOTIFICATIONS PnpNotify;
  242. LISTEN_FOR_PNP_NOTIFICATIONS PnpListen;
  243. #endif
  244. TOWER_CONSTRUCT TowerConstruct;
  245. TOWER_EXPLODE TowerExplode;
  246. POST_EVENT PostEvent ;
  247. BOOL fDatagram;
  248. };
  249. //
  250. // Connection specific interface
  251. //
  252. typedef HANDLE RPC_TRANSPORT_CONNECTION; // Server or client connection
  253. typedef HANDLE RPC_TRANSPORT_ADDRESS; // Server listening object
  254. extern "C" {
  255. typedef RPC_STATUS
  256. (RPC_ENTRY *CO_CLIENT_INITIALIZE)
  257. (
  258. IN RPC_TRANSPORT_CONNECTION ThisConnection,
  259. IN RPC_CHAR * NetworkAddress,
  260. IN RPC_CHAR * NetworkOptions,
  261. IN BOOL fAsync
  262. );
  263. typedef void
  264. (RPC_ENTRY *CO_CLIENT_INITCOMPLETE)
  265. (
  266. IN RPC_TRANSPORT_CONNECTION ThisConnection
  267. );
  268. typedef RPC_STATUS
  269. (RPC_ENTRY *CO_CLIENT_OPEN)
  270. (
  271. IN RPC_TRANSPORT_CONNECTION ThisConnection,
  272. IN RPC_CHAR * ProtocolSequence,
  273. IN RPC_CHAR * NetworkAddress,
  274. IN RPC_CHAR * Endpoint,
  275. IN RPC_CHAR * NetworkOptions,
  276. IN UINT ConnTimeout,
  277. IN UINT SendBufferSize,
  278. IN UINT RecvBufferSize,
  279. IN OUT PVOID ResolverHint,
  280. IN BOOL fHintInitialized,
  281. IN ULONG CallTimeout,
  282. IN ULONG AdditionalTransportCredentialsType, OPTIONAL
  283. IN void *AdditionalCredentials OPTIONAL
  284. );
  285. /*++
  286. Routine Description:
  287. Opens a new client connection to the server specified.
  288. Arguments:
  289. ThisConnection - Pointer to uninitialzied memory large enough
  290. for the transports connection object. Used in future
  291. calls on the same connection.
  292. ProtocolSequence -
  293. NetworkAddress -
  294. Endpoint -
  295. NetworkOptions - (Optional)
  296. ConnTimeout - connection timeout in runtime units
  297. SendBufferSize -
  298. RecvBufferSize - (Both optional) Specifies the size of the send/recv
  299. transport buffers (or window).
  300. ResolverHint - storage (of ResolveHintSize in the interface) for transport.
  301. state.
  302. fHintInitialize - If TRUE, the ResolveHint has previous passed into
  303. open and the runtime wants to connect to the same server as it
  304. connected to the first time.
  305. If FALSE, the ResolveHint is not initialized and the runtime is
  306. willing to connect to any server.
  307. CallTimeout - the call timeout in milliseconds
  308. TransportCredentials - optional transport credentials
  309. Return Value:
  310. RPC_S_OK - Success
  311. RPC_S_OUT_OF_MEMORY
  312. RPC_S_OUT_OF_RESOURCES
  313. RPC_S_INVALID_NETWORK_OPTIONS
  314. RPC_S_SERVER_UNAVAILABLE
  315. RPC_S_INVALID_ENDPOINT_FORMAT
  316. RPC_S_ACCESS_DENIED
  317. RPC_S_CALL_CANCELLED
  318. --*/
  319. typedef RPC_STATUS
  320. (RPC_ENTRY *CO_ABORT)
  321. (
  322. IN RPC_TRANSPORT_CONNECTION ThisConnection
  323. );
  324. /*++
  325. Routine Description:
  326. This is the first step is destroying a client or server connection.
  327. This can be called at most once on any connection. Call this function
  328. guarantees that all outstanding IO on the connection will complete
  329. either successfully or with an error.
  330. Note: Sometimes when a transport call fails it will abort the connection.
  331. Arguments:
  332. ThisConnection - The connection to abort.
  333. Return Value:
  334. RPC_S_OK
  335. --*/
  336. typedef RPC_STATUS
  337. (RPC_ENTRY *CO_CLOSE)
  338. (
  339. IN RPC_TRANSPORT_CONNECTION ThisConnection,
  340. IN BOOL fDontFlush
  341. );
  342. /*++
  343. Routine Description:
  344. Closes a connection which has not outstanding IO pending on it.
  345. This must be exactly once on every connection opened.
  346. If a connection has outstanding IO then call Abort() and wait
  347. for the IO to fail.
  348. Arguments:
  349. ThisConnection - The connection to cleanup.
  350. Return Value:
  351. RPC_S_OK
  352. --*/
  353. typedef RPC_STATUS
  354. (RPC_ENTRY *CO_SEND)
  355. (
  356. IN RPC_TRANSPORT_CONNECTION ThisConnection,
  357. IN UINT Length,
  358. IN BUFFER Buffer,
  359. IN PVOID SendContext
  360. );
  361. /*++
  362. Routine Description:
  363. Submits a send of the buffer on the connection. Will complete with
  364. ConnectionServerSend or ConnectionClientSend event either when
  365. the data has been sent on the network or when the send fails.
  366. Arguments:
  367. ThisConnection - The connection to send the data on.
  368. Length - The length of the data to send.
  369. Buffer - The data to send.
  370. SendContext - A buffer of at least SendContextSize bytes
  371. which will be used during the call and returned
  372. when the send completes.
  373. Return Value:
  374. RPC_S_OK
  375. RPC_S_OUT_OF_MEMORY - Connection valid
  376. RPC_S_OUT_OF_RESOURCES - Connection valid
  377. RPC_P_SEND_FAILED - Connection aborted
  378. --*/
  379. typedef RPC_STATUS
  380. (RPC_ENTRY *CO_RECV)
  381. (
  382. IN RPC_TRANSPORT_CONNECTION ThisConnection
  383. );
  384. /*++
  385. Routine Description:
  386. Submits a receive on the connection. Will complete with a
  387. ConnectionServerReceive or ConnectionClientReceive event
  388. either when a PDU arrives or when the receive fails.
  389. Arguments:
  390. ThisConnection - The connection to wait on.
  391. Return Value:
  392. RPC_P_IO_PENDING - Success
  393. RPC_P_RECEIVE_FAILED - Connection aborted.
  394. --*/
  395. typedef RPC_STATUS
  396. (RPC_ENTRY *CO_SYNC_SEND)
  397. (
  398. IN RPC_TRANSPORT_CONNECTION ThisConnection,
  399. IN UINT Length,
  400. IN BUFFER Buffer,
  401. IN BOOL fDisableShutdownCheck,
  402. IN BOOL fDisableCancelCheck,
  403. IN ULONG Timeout
  404. );
  405. /*++
  406. Routine Description:
  407. Transmits the buffer (PDU) to the other side of the connection. May
  408. block while the data is transmitted.
  409. Arguments:
  410. ThisConnection - The connection to send the data on.
  411. Length - The length of the data to send.
  412. Buffer - The data to send.
  413. fDisableShutdownCheck - Normally FALSE, when true this disables
  414. the transport check for async shutdown PDUs. This is needed
  415. when sending the third leg.
  416. Return Value:
  417. RPC_S_OK
  418. RPC_S_OUT_OF_MEMORY - Connection valid
  419. RPC_S_OUT_OF_RESOURCES - Connection valid
  420. RPC_P_SEND_FAILED - Connection aborted
  421. --*/
  422. typedef RPC_STATUS
  423. (RPC_ENTRY *CO_CLIENT_SYNC_SEND_RECV)
  424. (
  425. IN RPC_TRANSPORT_CONNECTION ThisConnection,
  426. IN UINT InputBufferSize,
  427. IN BUFFER InputBuffer,
  428. OUT PUINT OutputBufferSize,
  429. OUT BUFFER *pOutputBuffer
  430. );
  431. /*++
  432. Routine Description:
  433. Sends a request to the server of the connection and waits for
  434. a reply. This is the same as calling CO_SYNC_SEND followed
  435. by CO_SYNC_RECV but might be faster. It is assumed that if
  436. this function is available from the transport it will always
  437. be used.
  438. Arguments:
  439. ThisConnection - The client connection to transfer the data on.
  440. InputBufferSize - The size in bytes of the data in InputBuffer
  441. InputBuffer - The data to send to the server
  442. OutputBufferSize - On output, the size of the reply message.
  443. pOutputBuffer - On output, the reply PDU.
  444. Return Value:
  445. RPC_S_OK - Success
  446. RPC_P_SEND_FAILED - Connection aborted, no data transmitted.
  447. RPC_P_RECEIVE_FAILED - Connection aborted, data may have been transmitted.
  448. --*/
  449. typedef RPC_STATUS
  450. (RPC_ENTRY *CO_CLIENT_SYNC_RECV)
  451. (
  452. IN RPC_TRANSPORT_CONNECTION ThisConnection,
  453. OUT BUFFER *pBuffer,
  454. OUT PUINT pBufferSize,
  455. IN ULONG Timeout
  456. );
  457. /*++
  458. Routine Description:
  459. Receive the next PDU to arrive at the connection.
  460. Arguments:
  461. ThisConnection - The connection to read from.
  462. pBuffer - If successful, points to a buffer containing the next PDU.
  463. pBufferSize - If successful, contains the length of the message.
  464. dwTimeout - the amount of time to wait for the receive. If -1, we wait
  465. infinitely.
  466. Return Value:
  467. RPC_S_OK
  468. RPC_S_OUT_OF_MEMORY - Connection not aborted, no data received.
  469. RPC_S_OUT_OF_RESOURCES - Connection not aborted, no data received.
  470. RPC_P_RECEIVE_FAILED - Connection aborted.
  471. RPC_P_CONNECTION_SHUTDOWN - Graceful close from server, connection aborted.
  472. RPC_S_CALL_CANCELLED - Cancel event signaled and wait timed out; connection aborted.
  473. --*/
  474. // Keepalive timeout can be specified either in the RPC's runtime scale
  475. // of a relative time from 0 to 10 (for the client) or as the number of
  476. // milliseconds between keepalive packets (for the server).
  477. enum KEEPALIVE_TIMEOUT_UNITS
  478. {
  479. tuMilliseconds,
  480. tuRuntime
  481. };
  482. union KEEPALIVE_TIMEOUT
  483. {
  484. ULONG Milliseconds;
  485. ULONG RuntimeUnits;
  486. };
  487. typedef RPC_STATUS
  488. (RPC_ENTRY *CO_TURN_ON_OFF_KEEPALIVES)
  489. (
  490. IN RPC_TRANSPORT_CONNECTION ThisConnection,
  491. IN BOOL TurnOn,
  492. IN BOOL bProtectIO,
  493. IN KEEPALIVE_TIMEOUT_UNITS Units,
  494. IN OUT KEEPALIVE_TIMEOUT KATime,
  495. IN ULONG KAInterval = 5000 OPTIONAL
  496. );
  497. /*++
  498. Routine Description:
  499. Turns on or off keep alives at a rate appropriate for that transport. Used
  500. to prevent hangs of async calls.
  501. Arguments:
  502. ThisConnection - The connection to turn keep alives on on.
  503. TurnOn - if non-zero, keep alives are turned on. If zero, keep alives
  504. are turned off.
  505. bProtectIO - Determines whether the setting the timeout will be protected with
  506. a call to StartingOtherIO. TRUE on the server, FALSE on the client.
  507. Units - is the itmeout specified in the relative scale or in milliseconds
  508. KATime - how much to wait before sending first keep alive
  509. KAInterval - the keepalive interval
  510. Return Value:
  511. RPC_S_OK or RPC_S_* / Win32 errors on failure
  512. --*/
  513. typedef void
  514. (RPC_ENTRY *CO_FREE_RESOLVER_HINT)
  515. (
  516. IN void *ResolverHint
  517. );
  518. /*++
  519. Routine Description:
  520. Gives the transport a chance to free any data associated with the resolver hint.
  521. Arguments:
  522. ResolverHint - pointer to the resolver hint
  523. Return Value:
  524. --*/
  525. typedef RPC_STATUS
  526. (RPC_ENTRY *CO_COPY_RESOLVER_HINT)
  527. (
  528. IN void *TargetResolverHint,
  529. IN void *SourceResolverHint,
  530. IN BOOL SourceWillBeAbandoned
  531. );
  532. /*++
  533. Routine Description:
  534. Tells the transport to copy the resolver hint from Source to Target
  535. Arguments:
  536. TargetResolverHint - pointer to the target resolver hint
  537. SourceResolverHint - pointer to the source resolver hint
  538. SourceWillBeAbandoned - non-zero if the source hint was in temporary
  539. location and will be abandoned. Zero otherwise.
  540. Return Value:
  541. if SourceWillBeAbandoned is specified, this function is guaranteed
  542. to return RPC_S_OK. Otherwise, it may return RPC_S_OUT_OF_MEMORY as well.
  543. --*/
  544. typedef int
  545. (RPC_ENTRY *CO_COMPARE_RESOLVER_HINT)
  546. (
  547. IN void *ResolverHint1,
  548. IN void *ResolverHint2
  549. );
  550. /*++
  551. Routine Description:
  552. Tells the transport to compare the given 2 resolver hints
  553. Arguments:
  554. ResolverHint1 - pointer to the first resolver hint
  555. ResolverHint2 - pointer to the second resolver hint
  556. Return Value:
  557. (same semantics as memcmp)
  558. 0 - the resolver hints are equal
  559. non-zero - the resolver hints are not equal
  560. --*/
  561. typedef RPC_STATUS
  562. (RPC_ENTRY *CO_SET_LAST_BUFFER_TO_FREE)
  563. (
  564. IN RPC_TRANSPORT_CONNECTION ThisConnection,
  565. IN void *Buffer
  566. );
  567. /*++
  568. Routine Description:
  569. Before the last send runtime may call this to tell the transport
  570. what buffer to free when the send is done.
  571. Arguments:
  572. ThisConnection - connection to act on.
  573. Buffer - the buffer to free
  574. Return Value:
  575. RPC_S_OK - the value was accepted.
  576. RPC_S_CANNOT_SUPPORT - the transport doesn't support this functionality.
  577. If this value is returned, ownership of the buffer remains with the
  578. transport.
  579. --*/
  580. #pragma warning(disable:4200) // nonstandard extension: zero-length array
  581. typedef struct
  582. {
  583. UINT Count;
  584. RPC_CHAR *NetworkAddresses[];
  585. } NETWORK_ADDRESS_VECTOR;
  586. #pragma warning(3:4200) // nonstandard extension: zero-length array
  587. #define MAX_PROTOCOLS 16
  588. typedef RPC_STATUS
  589. (RPC_ENTRY *CO_SERVER_LISTEN)
  590. (
  591. IN RPC_TRANSPORT_ADDRESS ThisAddress,
  592. IN RPC_CHAR *NetworkAddress,
  593. IN OUT RPC_CHAR **ppEndpoint,
  594. IN UINT PendingQueueSize,
  595. IN OPTIONAL PVOID SecurityDescriptor,
  596. IN ULONG EndpointFlags,
  597. IN ULONG NICFlags,
  598. OUT NETWORK_ADDRESS_VECTOR **ppNetworkAddressVector
  599. );
  600. /*++
  601. Routine Description:
  602. This routine allocates a transport endpoint (port/socket/pipe) to
  603. receive new client connections on. If successful a call to
  604. CompleteListen() will cause new connection callbacks to the
  605. RPC runtime for the newly created address.
  606. Arguments:
  607. ThisAddress - A pointer to uninitialized memory large enough to
  608. hold the transport address object.
  609. pEndpoint - The endpoint to listen on. Pointer to NULL for
  610. dynamic endpoints. Does not need to be freed by the
  611. RPC runtime.
  612. PendingQueueSize - A hint passed into the RPC runtime as the
  613. MaxCalls parameter to RpcServerUse*Protseq*(). It is intended
  614. as a hint in buffer allocations for new connections.
  615. SecurityDescriptor - NT security descriptor passed into
  616. RpcServerUseProtseq*. Optional, only by named pipes.
  617. EndpointFlags - Application flags passed into RPC via
  618. RpcServerUseProtseq*Ex.
  619. NICFlags - Application flags passed into RPC via
  620. RpcServerUseProtseq*Ex.
  621. ppNetworkAddressVector - A vector of network addresses listened
  622. to by the call. This parameter does not need to freed, will
  623. not and should not be changed.
  624. Return Value:
  625. RPC_S_OK - Success
  626. RPC_S_OUT_OF_MEMORY
  627. RPC_S_OUT_OF_RESOURCES
  628. RPC_S_INVALID_ENDPOINT_FORMAT
  629. RPC_S_INVALID_SECURITY_DESC
  630. RPC_S_CANT_CREATE_ENDPOINT
  631. --*/
  632. typedef void
  633. (RPC_ENTRY *CO_SERVER_ABORT_LISTEN)
  634. (
  635. IN RPC_TRANSPORT_ADDRESS ThisAddress
  636. );
  637. /*++
  638. Routine Description:
  639. Destroys on a newly, successfully created RPC_TRANS_ADDRESS which
  640. for some reason known only to the runtime will not be used.
  641. Arguments:
  642. ThisAddress - The address to destroy.
  643. Return Value:
  644. Must succeed.
  645. --*/
  646. typedef void
  647. (RPC_ENTRY *CO_SERVER_COMPLETE_LISTEN)
  648. (
  649. IN RPC_TRANSPORT_ADDRESS ThisAddress
  650. );
  651. /*++
  652. Routine Description:
  653. Called when the runtime is actually ready for new connection
  654. callbacks to start on the address. This call cannot fail since
  655. the runtime can't undo the operation at this point.
  656. Arguments:
  657. ThisAddress - The address the runtime is now ready to receive
  658. connections on.
  659. Return Value:
  660. Must succeed.
  661. --*/
  662. typedef RPC_STATUS
  663. (RPC_ENTRY *CO_SERVER_QUERY_ADDRESS)
  664. (
  665. IN RPC_TRANSPORT_CONNECTION ThisConnection,
  666. OUT RPC_CHAR **pClientAddress
  667. );
  668. /*++
  669. Routine Description:
  670. Returns the raw network address of the client to the connection.
  671. Arguments:
  672. ThisConnection - A server connection object.
  673. pClientAddress - Pointer to a unicode string allocated
  674. via I_RpcAllocate from the transport interface.
  675. Return Value:
  676. RPC_S_OK
  677. RPC_S_OUT_OF_MEMORY
  678. RPC_S_OUT_OF_RESOURCES
  679. --*/
  680. typedef RPC_STATUS
  681. (RPC_ENTRY *CO_SERVER_QUERY_LOCAL_ADDRESS)
  682. (
  683. IN RPC_TRANSPORT_CONNECTION ThisConnection,
  684. IN OUT void *Buffer,
  685. IN OUT unsigned long *BufferSize,
  686. OUT unsigned long *AddressFormat
  687. );
  688. /*++
  689. Routine Description:
  690. Returns the raw local network address of the connection.
  691. Arguments:
  692. ThisConnection - A server connection object.
  693. Buffer - The buffer that will receive the output address
  694. BufferSize - the size of the supplied Buffer on input. On output the
  695. number of bytes written to the buffer. If the buffer is too small
  696. to receive all the output data, ERROR_MORE_DATA is returned,
  697. nothing is written to the buffer, and BufferSize is set to
  698. the size of the buffer needed to return all the data.
  699. AddressFormat - a constant indicating the format of the returned address.
  700. Currently supported are RPC_P_ADDR_FORMAT_TCP_IPV4 and
  701. RPC_P_ADDR_FORMAT_TCP_IPV6.
  702. Return Value:
  703. RPC_S_OK, ERROR_MORE_DATA, RPC_S_* or Win32 error codes.
  704. --*/
  705. const int RPC_CLIENT_PROCESS_IDENTIFIER_ULONGLONG_ARRAY_SIZE = 0x10;
  706. const int RPC_CLIENT_PROCESS_IDENTIFIER_ULONG_ARRAY_SIZE = 0x20;
  707. class RPC_CLIENT_PROCESS_IDENTIFIER
  708. {
  709. public:
  710. inline void
  711. Set (
  712. IN RPC_CLIENT_PROCESS_IDENTIFIER *ClientProcess
  713. );
  714. inline void
  715. ZeroOut (
  716. void
  717. );
  718. inline int
  719. Compare (
  720. IN RPC_CLIENT_PROCESS_IDENTIFIER *ClientProcess
  721. );
  722. inline BOOL
  723. IsNull (
  724. void
  725. );
  726. inline ULONGLONG
  727. GetDebugULongLong1 (
  728. void
  729. );
  730. inline ULONGLONG
  731. GetDebugULongLong2 (
  732. void
  733. );
  734. inline ULONG
  735. GetDebugULong1 (
  736. void
  737. );
  738. inline ULONG
  739. GetDebugULong2 (
  740. void
  741. );
  742. inline BOOL
  743. IsLocal (
  744. void
  745. );
  746. // defined in wstrans.cxx to avoid general runtime dependency on
  747. // IPv6 headers
  748. void
  749. SetIPv6ClientIdentifier (
  750. IN void *Buffer,
  751. IN size_t BufferSize,
  752. IN BOOL fLocal
  753. );
  754. inline void
  755. SetIPv4ClientIdentifier (
  756. IN ULONG Addr,
  757. IN BOOL fLocal
  758. );
  759. void
  760. SetHTTP2ClientIdentifier (
  761. IN void *Buffer,
  762. IN size_t BufferSize,
  763. IN BOOL fLocal
  764. );
  765. inline void
  766. SetNMPClientIdentifier (
  767. IN FILE_PIPE_CLIENT_PROCESS_BUFFER *ClientId,
  768. IN BOOL fLocal
  769. );
  770. inline void
  771. SetIPXClientIdentifier (
  772. IN void *Buffer,
  773. IN size_t BufferSize,
  774. IN BOOL fLocal
  775. );
  776. private:
  777. BOOL fLocal;
  778. BOOL ZeroPadding; // if member wise initialization is done,
  779. // this must be set to 0. This allows callers
  780. // to call memcmp for the whole object.
  781. // provide storage for 0x80 bytes. This is the max client id
  782. // (the client id of an IPv6 client address)
  783. union
  784. {
  785. ULONGLONG ULongLongClientId[RPC_CLIENT_PROCESS_IDENTIFIER_ULONGLONG_ARRAY_SIZE];
  786. ULONG ULongClientId[RPC_CLIENT_PROCESS_IDENTIFIER_ULONG_ARRAY_SIZE];
  787. } u;
  788. };
  789. void
  790. RPC_CLIENT_PROCESS_IDENTIFIER::Set (
  791. IN RPC_CLIENT_PROCESS_IDENTIFIER *ClientProcess
  792. )
  793. /*++
  794. Routine Description:
  795. Initialize the client process identifier from another client
  796. process identifier
  797. Arguments:
  798. ClientProcess - a pointer to the other client process
  799. Return Value:
  800. --*/
  801. {
  802. RpcpMemoryCopy(this, ClientProcess, sizeof(RPC_CLIENT_PROCESS_IDENTIFIER));
  803. }
  804. void
  805. RPC_CLIENT_PROCESS_IDENTIFIER::ZeroOut (
  806. void
  807. )
  808. /*++
  809. Routine Description:
  810. Zero out a RPC_CLIENT_PROCESS_IDENTIFIED.
  811. Arguments:
  812. Return Value:
  813. --*/
  814. {
  815. RpcpMemorySet(this, 0, sizeof(RPC_CLIENT_PROCESS_IDENTIFIER));
  816. }
  817. int
  818. RPC_CLIENT_PROCESS_IDENTIFIER::Compare (
  819. IN RPC_CLIENT_PROCESS_IDENTIFIER *ClientProcess
  820. )
  821. /*++
  822. Routine Description:
  823. Compare two RPC_CLIENT_PROCESS_IDENTIFIED structs.
  824. Arguments:
  825. ClientProcess - a pointer to the ClientProcess ID to compare to
  826. Return Value:
  827. non-zero - the Client Process Ids are different.
  828. 0 - the Client process Ids are the same
  829. --*/
  830. {
  831. return RpcpMemoryCompare(this, ClientProcess, sizeof(RPC_CLIENT_PROCESS_IDENTIFIER));
  832. }
  833. BOOL
  834. RPC_CLIENT_PROCESS_IDENTIFIER::IsNull (
  835. void
  836. )
  837. /*++
  838. Routine Description:
  839. Utility function to check whether the ClientId portion is NULL.
  840. N.B. the function does not check for the fLocal flag!
  841. Arguments:
  842. Return Value:
  843. TRUE - the ClientId of the ClientProcess is all zeroes.
  844. FALSE - at least one element of the ClientId is non-zero
  845. --*/
  846. {
  847. int i;
  848. #if defined(_WIN64)
  849. for (i = 0; i < RPC_CLIENT_PROCESS_IDENTIFIER_ULONGLONG_ARRAY_SIZE; i ++)
  850. {
  851. if (u.ULongLongClientId[i] != 0)
  852. return FALSE;
  853. }
  854. #else
  855. for (i = 0; i < RPC_CLIENT_PROCESS_IDENTIFIER_ULONG_ARRAY_SIZE; i ++)
  856. {
  857. if (u.ULongClientId[i] != 0)
  858. return FALSE;
  859. }
  860. #endif
  861. return TRUE;
  862. }
  863. ULONGLONG
  864. RPC_CLIENT_PROCESS_IDENTIFIER::GetDebugULongLong1 (
  865. void
  866. )
  867. /*++
  868. Routine Description:
  869. Returns the first ULONGLONG from the ClientProcess identifier
  870. Used for debugging.
  871. Arguments:
  872. Return Value:
  873. the value used for debugging
  874. --*/
  875. {
  876. return u.ULongLongClientId[RPC_CLIENT_PROCESS_IDENTIFIER_ULONGLONG_ARRAY_SIZE - 2];
  877. }
  878. ULONGLONG
  879. RPC_CLIENT_PROCESS_IDENTIFIER::GetDebugULongLong2 (
  880. void
  881. )
  882. /*++
  883. Routine Description:
  884. Returns the second ULONGLONG from the ClientProcess identifier
  885. Used for debugging.
  886. Arguments:
  887. Return Value:
  888. the value used for debugging
  889. --*/
  890. {
  891. return u.ULongLongClientId[RPC_CLIENT_PROCESS_IDENTIFIER_ULONGLONG_ARRAY_SIZE - 1];
  892. }
  893. ULONG
  894. RPC_CLIENT_PROCESS_IDENTIFIER::GetDebugULong1 (
  895. void
  896. )
  897. /*++
  898. Routine Description:
  899. Returns the first ULONG from the ClientProcess identifier
  900. Used for debugging.
  901. Arguments:
  902. Return Value:
  903. the value used for debugging
  904. --*/
  905. {
  906. return u.ULongClientId[RPC_CLIENT_PROCESS_IDENTIFIER_ULONG_ARRAY_SIZE - 2];
  907. }
  908. ULONG
  909. RPC_CLIENT_PROCESS_IDENTIFIER::GetDebugULong2 (
  910. void
  911. )
  912. /*++
  913. Routine Description:
  914. Returns the second ULONG from the ClientProcess identifier
  915. Used for debugging.
  916. Arguments:
  917. Return Value:
  918. the value used for debugging
  919. --*/
  920. {
  921. return u.ULongClientId[RPC_CLIENT_PROCESS_IDENTIFIER_ULONG_ARRAY_SIZE - 1];
  922. }
  923. void
  924. RPC_CLIENT_PROCESS_IDENTIFIER::SetIPv4ClientIdentifier (
  925. IN ULONG Addr,
  926. IN BOOL fLocal
  927. )
  928. /*++
  929. Routine Description:
  930. IPv4 servers can use this to store their IP address in
  931. the client identifier.
  932. Arguments:
  933. Addr - IPv4 address
  934. fLocal - TRUE if the client is guaranteed to be Local. False otherwise.
  935. Return Value:
  936. --*/
  937. {
  938. this->fLocal = fLocal;
  939. u.ULongClientId[RPC_CLIENT_PROCESS_IDENTIFIER_ULONG_ARRAY_SIZE - 1] = Addr;
  940. }
  941. void
  942. RPC_CLIENT_PROCESS_IDENTIFIER::SetNMPClientIdentifier (
  943. IN FILE_PIPE_CLIENT_PROCESS_BUFFER *ClientId,
  944. IN BOOL fLocal
  945. )
  946. /*++
  947. Routine Description:
  948. Stores a client identifier as returned by the named pipes
  949. primitives
  950. Arguments:
  951. ClientId - the buffer the named pipe driver (NPFS or SVR)
  952. returned.
  953. fLocal - TRUE if the client is guaranteed to be Local. False otherwise.
  954. Return Value:
  955. --*/
  956. {
  957. this->fLocal = fLocal;
  958. #if defined(_WIN64) || defined(BUILD_WOW6432)
  959. u.ULongLongClientId[RPC_CLIENT_PROCESS_IDENTIFIER_ULONGLONG_ARRAY_SIZE - 2] = (ULONGLONG)ClientId->ClientSession;
  960. u.ULongLongClientId[RPC_CLIENT_PROCESS_IDENTIFIER_ULONGLONG_ARRAY_SIZE - 1] = (ULONGLONG)ClientId->ClientProcess;
  961. #else
  962. u.ULongClientId[RPC_CLIENT_PROCESS_IDENTIFIER_ULONG_ARRAY_SIZE - 2] = (ULONG)ClientId->ClientSession;
  963. u.ULongClientId[RPC_CLIENT_PROCESS_IDENTIFIER_ULONG_ARRAY_SIZE - 1] = (ULONG)ClientId->ClientProcess;
  964. #endif
  965. }
  966. void
  967. RPC_CLIENT_PROCESS_IDENTIFIER::SetIPXClientIdentifier (
  968. IN void *Buffer,
  969. IN size_t BufferSize,
  970. IN BOOL fLocal)
  971. /*++
  972. Routine Description:
  973. IPX servers can use this to store their client address in
  974. the client identifier.
  975. Arguments:
  976. Buffer - the buffer with the client identifier
  977. BufferSize - the size of the data in buffer
  978. fLocal - TRUE if the client is guaranteed to be Local. False otherwise.
  979. Return Value:
  980. --*/
  981. {
  982. ASSERT(BufferSize <= sizeof(u.ULongClientId));
  983. this->fLocal = fLocal;
  984. RpcpMemoryCopy(((unsigned char *)(&u.ULongClientId[RPC_CLIENT_PROCESS_IDENTIFIER_ULONG_ARRAY_SIZE])) - BufferSize, Buffer, BufferSize);
  985. }
  986. BOOL
  987. RPC_CLIENT_PROCESS_IDENTIFIER::IsLocal (
  988. void
  989. )
  990. /*++
  991. Routine Description:
  992. Returns TRUE if the client process identifier is for a local process.
  993. Arguments:
  994. Return Value:
  995. TRUE - the client process is guaranteed to be local.
  996. FALSE - the client process is either remote, or it is not known
  997. whether the client process is local or remote.
  998. --*/
  999. {
  1000. return fLocal;
  1001. }
  1002. typedef RPC_STATUS
  1003. (RPC_ENTRY *CO_SERVER_QUERY_CLIENT_ID)
  1004. (
  1005. IN RPC_TRANSPORT_CONNECTION ThisConnection,
  1006. OUT RPC_CLIENT_PROCESS_IDENTIFIER *pClientId
  1007. );
  1008. /*++
  1009. Routine Description:
  1010. For transport which support security this returns the ID of the
  1011. client process.
  1012. This API is optional and not support on most protocols.
  1013. Arguments:
  1014. ThisConnection - Server connection to the client in question.
  1015. pClientId - Will return the ID of the client connection/process.
  1016. Return Value:
  1017. RPC_S_OK
  1018. RPC_S_OUT_OF_RESOURCES
  1019. --*/
  1020. typedef RPC_STATUS
  1021. (RPC_ENTRY *CO_SERVER_IMPERSONATE)
  1022. (
  1023. IN RPC_TRANSPORT_CONNECTION ThisConnection
  1024. );
  1025. /*++
  1026. Routine Description:
  1027. For protocols which support security this impersonates the client.
  1028. Arguments:
  1029. ThisConnection - The server connection to the client to be impersonated.
  1030. Return Value:
  1031. RPC_S_OK
  1032. RPC_S_NO_CONTEXT_AVAILABLE
  1033. --*/
  1034. typedef RPC_STATUS
  1035. (RPC_ENTRY *CO_SERVER_REVERT)
  1036. (
  1037. IN RPC_TRANSPORT_CONNECTION ThisConnection
  1038. );
  1039. /*++
  1040. Routine Description:
  1041. Maybe called on a thread which has previously, successfully called
  1042. CO_SERVER_IMPERSONATE on the same connection.
  1043. Resets the threads token to that of the server process.
  1044. Arguments:
  1045. ThisConnection - The connection previously impersonated on this thread.
  1046. Return Value:
  1047. RPC_S_OK
  1048. --*/
  1049. extern RPC_STATUS RPC_ENTRY
  1050. COMMON_PostRuntimeEvent(
  1051. IN DWORD Type,
  1052. IN PVOID Context
  1053. );
  1054. } // extern "C"
  1055. // Connection oriented transport interface
  1056. struct RPC_CONNECTION_TRANSPORT
  1057. {
  1058. //
  1059. // RPC_TRANSPORT_INTERFACE_HEADER definitions
  1060. //
  1061. UINT TransInterfaceVersion;
  1062. USHORT TransId;
  1063. USHORT TransAddrId;
  1064. RPC_CHAR *ProtocolSequence;
  1065. PCHAR WellKnownEndpoint;
  1066. PROCESS_CALLS ProcessCalls;
  1067. #ifndef NO_PLUG_AND_PLAY
  1068. START_PNP_NOTIFICATIONS PnpNotify;
  1069. LISTEN_FOR_PNP_NOTIFICATIONS PnpListen;
  1070. #endif
  1071. TOWER_CONSTRUCT TowerConstruct;
  1072. TOWER_EXPLODE TowerExplode;
  1073. POST_EVENT PostEvent ;
  1074. BOOL fDatagram;
  1075. //
  1076. // Connection specific interface
  1077. //
  1078. UINT AddressSize;
  1079. UINT ClientConnectionSize;
  1080. UINT ServerConnectionSize;
  1081. UINT SendContextSize;
  1082. UINT ResolverHintSize;
  1083. UINT MaximumFragmentSize;
  1084. CO_CLIENT_INITIALIZE Initialize;
  1085. CO_CLIENT_INITCOMPLETE InitComplete;
  1086. // Operations on client-side connections
  1087. CO_CLIENT_OPEN Open;
  1088. CO_CLIENT_SYNC_SEND_RECV SyncSendRecv; OPTIONAL
  1089. CO_CLIENT_SYNC_RECV SyncRecv;
  1090. // Operations on connecitons
  1091. CO_ABORT Abort;
  1092. CO_CLOSE Close;
  1093. CO_SEND Send;
  1094. CO_RECV Recv;
  1095. CO_SYNC_SEND SyncSend;
  1096. // Client side explicit keep alive operations
  1097. CO_TURN_ON_OFF_KEEPALIVES TurnOnOffKeepAlives;
  1098. // Server only startup APIs
  1099. CO_SERVER_LISTEN Listen;
  1100. CO_SERVER_ABORT_LISTEN AbortListen;
  1101. CO_SERVER_COMPLETE_LISTEN CompleteListen;
  1102. // Operations on sever-side connections
  1103. CO_SERVER_QUERY_ADDRESS QueryClientAddress; OPTIONAL
  1104. CO_SERVER_QUERY_LOCAL_ADDRESS QueryLocalAddress; OPTIONAL
  1105. // Server-side security related APIs
  1106. CO_SERVER_QUERY_CLIENT_ID QueryClientId;
  1107. CO_SERVER_IMPERSONATE ImpersonateClient; OPTIONAL
  1108. CO_SERVER_REVERT RevertToSelf; OPTIONAL
  1109. // Resolver hint APIs
  1110. CO_FREE_RESOLVER_HINT FreeResolverHint; OPTIONAL
  1111. CO_COPY_RESOLVER_HINT CopyResolverHint; OPTIONAL
  1112. CO_COMPARE_RESOLVER_HINT CompareResolverHint; OPTIONAL
  1113. // Misc. APIs
  1114. CO_SET_LAST_BUFFER_TO_FREE SetLastBufferToFree; OPTIONAL
  1115. };
  1116. // Datagram specific transport interface
  1117. typedef struct tagDatagramTransportPair
  1118. {
  1119. HANDLE RemoteAddress;
  1120. HANDLE LocalAddress;
  1121. } DatagramTransportPair;
  1122. typedef HANDLE DG_TRANSPORT_ENDPOINT; // Listening/sending object
  1123. typedef HANDLE DG_TRANSPORT_ADDRESS; // Destination/source address
  1124. struct DG_ENDPOINT_STATS
  1125. {
  1126. unsigned long PreferredPduSize;
  1127. unsigned long MaxPduSize;
  1128. unsigned long MaxPacketSize;
  1129. unsigned long ReceiveBufferSize;
  1130. };
  1131. extern "C" {
  1132. typedef RPC_STATUS
  1133. (RPC_ENTRY *DG_SEND)
  1134. (
  1135. IN DG_TRANSPORT_ENDPOINT SourceEndpoint,
  1136. IN DG_TRANSPORT_ADDRESS DestinationAddress,
  1137. IN BUFFER Header,
  1138. IN UINT HeaderLength,
  1139. IN BUFFER Body,
  1140. IN UINT BodyLength,
  1141. IN BUFFER Trailer,
  1142. IN UINT TrailerLength
  1143. );
  1144. /*++
  1145. Routine Description:
  1146. Sends the complete packet (Header+Body+Trailer) to the destination
  1147. address from the source endpoint. Replys, if any, will then come back
  1148. to the source endpoint.
  1149. Arguments:
  1150. SourceEndpoint - Client or server endpoint object to send from.
  1151. DestinationAddress - The address to send the packet to.
  1152. Header - First part of the data.
  1153. HeaderLength - The number of bytes of Header to send.
  1154. Body - The main (bulk) of the data to send.
  1155. BodyLength - The number of bytes of Body to send.
  1156. Trailer - The last part of the data to send.
  1157. TrailerLength - The number of bytes of Trailer to send.
  1158. Return Value:
  1159. RPC_S_OK
  1160. RPC_S_OUT_OF_RESOURCES
  1161. RPC_P_SEND_FAILED
  1162. --*/
  1163. typedef RPC_STATUS
  1164. (RPC_ENTRY *DG_CLIENT_OPEN_ENDPOINT)
  1165. (
  1166. IN DG_TRANSPORT_ENDPOINT Endpoint,
  1167. IN BOOL fAsync,
  1168. IN DWORD Flags
  1169. );
  1170. /*++
  1171. Routine Description:
  1172. Creates a local endpoint object which can be used to send
  1173. and receive packets.
  1174. Arguments:
  1175. Endpoint - Storage for the transport endpoint object.
  1176. fAsync - TRUE - Transport should post and manage receives
  1177. which complete via ProcessCalls.
  1178. FALSE - Runtime will use Send and SyncRecv only
  1179. Flags - endpoint flags, one of RPC_C_USE_INTERNET_PORT or
  1180. RPC_C_USE_INTRANET_PORT
  1181. Return Value:
  1182. RPC_S_OK
  1183. RPC_S_OUT_OF_MEMORY
  1184. RPC_S_OUT_OF_RESOURCES
  1185. --*/
  1186. typedef RPC_STATUS
  1187. (RPC_ENTRY *DG_CLIENT_INITIALIZE_ADDRESS)
  1188. (
  1189. OUT DG_TRANSPORT_ADDRESS Address,
  1190. IN RPC_CHAR *NetworkAddress,
  1191. IN RPC_CHAR *Endpoint,
  1192. IN BOOL fUseCache,
  1193. IN BOOL fBroadcast
  1194. );
  1195. /*++
  1196. Routine Description:
  1197. Initializes a address object for sending to a server.
  1198. Arguments:
  1199. Address - Storage for the address
  1200. NetworkAddress - The address of the server or 0 if local
  1201. Endpoint - The endpoint of the server
  1202. fBroadcast - If TURE, NetworkAddress is ignored and a
  1203. transport-specific broadcast address is used.
  1204. fUseCache - If TRUE then the transport may use a cached
  1205. value from a previous call on the same NetworkAddress.
  1206. Return Value:
  1207. RPC_S_OK - Success, name resolved
  1208. RPC_P_FOUND_IN_CACHE - Success, returned only if fUseCache is TRUE
  1209. and the was name found in local cache.
  1210. RPC_P_MATCHED_CACHE - Partial success, fUseCache is FALSE and the
  1211. result of the lookup was the same as the value previously
  1212. in the cache.
  1213. RPC_S_OUT_OF_MEMORY
  1214. RPC_S_OUT_OF_RESOURCES
  1215. RPC_S_INVALID_ENDPOINT_FORMAT
  1216. RPC_S_SERVER_UNAVAILABLE
  1217. --*/
  1218. typedef RPC_STATUS
  1219. (RPC_ENTRY *DG_CLIENT_CLOSE)
  1220. (
  1221. IN DG_TRANSPORT_ENDPOINT Endpoint
  1222. );
  1223. /*++
  1224. Routine Description:
  1225. Closes a client endpoint object when it will no longer be needed.
  1226. Note: For async endpoint this doesn't actually destroy the endpoint,
  1227. but it will eventually cause a thread waiting in ProcessCalls
  1228. to get back an RPC_P_ENDPOINT_CLOSED completion for the endpoint.
  1229. In the meantime it is possible for new packets to arrive at the
  1230. endpoint.
  1231. Arguments:
  1232. Endpoing - The endpoint that should be closed.
  1233. Return Value:
  1234. RPC_S_OK - Sync endpoints
  1235. RPC_P_IO_PENDING - Async endpoints
  1236. --*/
  1237. typedef RPC_STATUS
  1238. (RPC_ENTRY *DG_CLIENT_SYNC_RECV)
  1239. (
  1240. IN DG_TRANSPORT_ENDPOINT Endpoint,
  1241. OUT DG_TRANSPORT_ADDRESS *pAddress,
  1242. OUT PUINT pBufferLength,
  1243. OUT BUFFER *pBuffer,
  1244. IN LONG Timeout
  1245. );
  1246. /*++
  1247. Routine Description:
  1248. Used to wait for a datagram from a server. Returns the data
  1249. returned and the ADDRESS of the machine which replied.
  1250. Arguments:
  1251. Endpoint - The endpoint to receive from.
  1252. pAddress - A block of memory which will contain the server's
  1253. address on completion.
  1254. BufferLength - The size of Buffer on input, the size of the
  1255. datagram received on output.
  1256. Timeout - Milliseconds to wait for a datagram.
  1257. Return Value:
  1258. RPC_S_OK
  1259. RPC_P_OVERSIZE_PACKET - Datagram > BufferLength arrived,
  1260. first BufferLength bytes of Buffer contain the partial datagram.
  1261. RPC_P_RECEIVE_FAILED
  1262. RPC_P_TIMEOUT
  1263. --*/
  1264. typedef RPC_STATUS
  1265. (RPC_ENTRY *DG_SERVER_LISTEN)
  1266. (
  1267. IN OUT DG_TRANSPORT_ENDPOINT ServerEndpoint,
  1268. IN RPC_CHAR *NetworkAddress,
  1269. IN OUT RPC_CHAR **Endpoint,
  1270. IN void *SecurityDescriptor,
  1271. IN ULONG EndpointFlags,
  1272. IN ULONG NICFlags,
  1273. OUT NETWORK_ADDRESS_VECTOR **pNetworkAddresses
  1274. );
  1275. /*++
  1276. Routine Description:
  1277. Creates a server endpoint object to receive packets. New
  1278. packets won't actually arrive until CompleteListen is
  1279. called.
  1280. Arguments:
  1281. ServerEndpoint - Storage for the server endpoint object.
  1282. Endpoint - The endpoint to listen on or a pointer to 0 if
  1283. the transport should choose the address.
  1284. Contains the endpoint listened to on output. The
  1285. caller should free this.
  1286. EndpointFlags - Application flags passed into RPC via
  1287. RpcServerUseProtseq*Ex.
  1288. NICFlags - Application flags passed into RPC via
  1289. RpcServerUseProtseq*Ex.
  1290. pNetworkAddresses - A vector of the network addresses
  1291. listened on by this call. This vector does
  1292. not need to be freed.
  1293. Return Value:
  1294. RPC_S_OK - Success
  1295. RPC_S_INVALID_ENDPOINT_FORMAT
  1296. RPC_S_DUPLICATE_ENDPOINT
  1297. RPC_S_CANT_CREATE_ENDPOINT
  1298. RPC_S_OUT_OF_MEMORY
  1299. RPC_S_OUT_OF_RESOURCES
  1300. --*/
  1301. typedef void
  1302. (RPC_ENTRY *DG_SERVER_ABORT_LISTEN)
  1303. (
  1304. IN RPC_TRANSPORT_ADDRESS ThisEndpoint
  1305. );
  1306. /*++
  1307. Routine Description:
  1308. Destroys on a newly, successfully created server endpoint
  1309. for some reason known only to the runtime will not be used.
  1310. Arguments:
  1311. ThisEndpoint - The endpoint to destroy.
  1312. Return Value:
  1313. Must succeed.
  1314. --*/
  1315. typedef void
  1316. (RPC_ENTRY *DG_SERVER_COMPLETE_LISTEN)
  1317. (
  1318. IN DG_TRANSPORT_ENDPOINT ThisAddress
  1319. );
  1320. /*++
  1321. Routine Description:
  1322. Called when the runtime is actually ready for packets to be
  1323. completed (received) on this endpoint. This call cannot fail since
  1324. the runtime can't undo the operation at this point.
  1325. Arguments:
  1326. ThisAddress - The address the runtime is now ready to receive
  1327. connections on.
  1328. Return Value:
  1329. Must succeed.
  1330. --*/
  1331. typedef RPC_STATUS
  1332. (RPC_ENTRY *DG_QUERY_ADDRESS)
  1333. (
  1334. IN DG_TRANSPORT_ADDRESS ThisAddress,
  1335. OUT RPC_CHAR *AddressString
  1336. );
  1337. /*++
  1338. Routine Description:
  1339. Converts the network address of a DG_TRANSPORT_ADDRESS into a string.
  1340. Arguments:
  1341. ThisAddress - The transport address containing the network address.
  1342. AddressString - Storage for the string form of the network address.
  1343. Note: This buffer is assumed to be <AddressSize> bytes.
  1344. Return Value:
  1345. RPC_S_OK
  1346. --*/
  1347. typedef RPC_STATUS
  1348. (RPC_ENTRY *DG_QUERY_ENDPOINT_STATS)
  1349. (
  1350. IN DG_TRANSPORT_ADDRESS ThisAddress,
  1351. OUT DG_ENDPOINT_STATS * pStats
  1352. );
  1353. /*++
  1354. Routine Description:
  1355. Returns the endpoint's receive buffer length and max PDU sizes.
  1356. Arguments:
  1357. ThisAddress - The transport address containing the network address.
  1358. pStats - a structure to fill with stats
  1359. Return Value:
  1360. RPC_S_OK
  1361. --*/
  1362. typedef RPC_STATUS
  1363. (RPC_ENTRY *DG_QUERY_ENDPOINT)
  1364. (
  1365. IN DG_TRANSPORT_ADDRESS ThisAddress,
  1366. OUT RPC_CHAR *EndpointString
  1367. );
  1368. /*++
  1369. Routine Description:
  1370. Converts the endpoint of a DG_TRANSPORT_ADDRESS into a string.
  1371. Arguments:
  1372. ThisAddress - The transport address containing the endpoint.
  1373. AddressString - Storage for the string form of the endpoint.
  1374. Note: This buffer is assumed to be <EndpointStringSize> bytes.
  1375. Return Value:
  1376. RPC_S_OK
  1377. --*/
  1378. typedef RPC_STATUS
  1379. (RPC_ENTRY * DG_CLIENT_INIT_OPTIONS)
  1380. (
  1381. IN void *pvTransportOptions
  1382. );
  1383. typedef RPC_STATUS
  1384. (RPC_ENTRY * DG_CLIENT_SET_OPTION)
  1385. (
  1386. IN void *pvTransportOptions,
  1387. IN ULONG Option,
  1388. IN ULONG_PTR OptionValue
  1389. );
  1390. typedef RPC_STATUS
  1391. (RPC_ENTRY * DG_CLIENT_INQ_OPTION)
  1392. (
  1393. IN void *pvTransportOptions,
  1394. IN ULONG Option,
  1395. OUT ULONG_PTR * pOptionValue
  1396. );
  1397. typedef RPC_STATUS
  1398. (RPC_ENTRY * DG_CLIENT_IMPLEMENT_OPTIONS)
  1399. (
  1400. IN DG_TRANSPORT_ENDPOINT pEndpoint,
  1401. IN void *pvTransportOptions
  1402. );
  1403. typedef BOOL
  1404. (RPC_ENTRY * DG_SERVER_ALLOW_RECEIVES)
  1405. (
  1406. IN DG_TRANSPORT_ENDPOINT pEndpoint,
  1407. IN BOOL fAllowReceives,
  1408. IN BOOL fCancelPendingIos
  1409. );
  1410. typedef RPC_STATUS
  1411. (RPC_ENTRY * DG_SERVER_INQUIRE_AUTH_CLIENT)
  1412. (
  1413. IN void *pClientEndpoint,
  1414. OUT RPC_CHAR **ppPrincipal,
  1415. OUT SID **ppSid,
  1416. OUT ULONG *pulAuthenLevel,
  1417. OUT ULONG *pulAuthnService,
  1418. OUT ULONG *pulAuthzService
  1419. );
  1420. typedef RPC_STATUS
  1421. (RPC_ENTRY *DG_SERVER_FORWARD_PACKET)
  1422. (
  1423. IN DG_TRANSPORT_ENDPOINT SourceEndpoint,
  1424. IN BUFFER Header,
  1425. IN UINT HeaderLength,
  1426. IN BUFFER Body,
  1427. IN UINT BodyLength,
  1428. IN BUFFER Trailer,
  1429. IN UINT TrailerLength,
  1430. IN CHAR *Endpoint
  1431. );
  1432. /*++
  1433. Routine Description:
  1434. A special form of DG_SEND which takes an string endpoint
  1435. to send to rather then a full DG_TRANSPORT_ADDRESS.
  1436. The packet is forwarded to the local machine.
  1437. Arguments:
  1438. SourceEndpoint - The endpoint to send from.
  1439. Headers - TrailerLength - Same as DG_SEND above
  1440. Endpoint - The string form of the endpoint to send to.
  1441. Return Value:
  1442. RPC_S_OK
  1443. --*/
  1444. }
  1445. struct RPC_DATAGRAM_TRANSPORT
  1446. {
  1447. //
  1448. // Common RPC_TRANSPORT_INTERFACE_HEADER definitions
  1449. //
  1450. UINT TransInterfaceVersion;
  1451. USHORT TransId;
  1452. USHORT TransAddrId;
  1453. RPC_CHAR *ProtocolSequence;
  1454. PCHAR WellKnownEndpoint;
  1455. PROCESS_CALLS ProcessCalls;
  1456. #ifndef NO_PLUG_AND_PLAY
  1457. START_PNP_NOTIFICATIONS PnpNotify;
  1458. LISTEN_FOR_PNP_NOTIFICATIONS PnpListen;
  1459. #endif
  1460. TOWER_CONSTRUCT TowerConstruct;
  1461. TOWER_EXPLODE TowerExplode;
  1462. POST_EVENT PostEvent ;
  1463. BOOL fDatagram;
  1464. //
  1465. // Datagram specific
  1466. //
  1467. UINT ServerEndpointSize;
  1468. UINT ClientEndpointSize;
  1469. UINT AddressSize;
  1470. UINT EndpointStringSize;
  1471. UINT AddressStringSize;
  1472. UINT BasePduSize;
  1473. UINT ExpectedPduSize;
  1474. DG_SEND Send;
  1475. DG_CLIENT_OPEN_ENDPOINT OpenEndpoint;
  1476. DG_CLIENT_INITIALIZE_ADDRESS InitializeAddress;
  1477. DG_CLIENT_CLOSE Close;
  1478. DG_CLIENT_SYNC_RECV SyncReceive;
  1479. DG_SERVER_LISTEN Listen;
  1480. DG_SERVER_ABORT_LISTEN AbortListen;
  1481. DG_SERVER_COMPLETE_LISTEN CompleteListen;
  1482. DG_SERVER_FORWARD_PACKET ForwardPacket;
  1483. DG_QUERY_ADDRESS QueryAddress;
  1484. DG_QUERY_ENDPOINT QueryEndpoint;
  1485. DG_QUERY_ENDPOINT_STATS QueryEndpointStats;
  1486. BOOL IsMessageTransport; // ncadg_mq message transport.
  1487. UINT OptionsSize; // Endpoint options.
  1488. DG_CLIENT_INIT_OPTIONS InitOptions;
  1489. DG_CLIENT_SET_OPTION SetOption;
  1490. DG_CLIENT_INQ_OPTION InqOption;
  1491. DG_CLIENT_IMPLEMENT_OPTIONS ImplementOptions;
  1492. DG_SERVER_ALLOW_RECEIVES AllowReceives;
  1493. DG_SERVER_INQUIRE_AUTH_CLIENT InquireAuthClient;
  1494. };
  1495. typedef RPC_TRANSPORT_INTERFACE_HEADER *RPC_TRANSPORT_INTERFACE;
  1496. typedef RPC_TRANSPORT_INTERFACE
  1497. (RPC_ENTRY *TRANSPORT_LOAD)(const RPC_CHAR *Protseq);
  1498. typedef HANDLE (RPC_ENTRY *FuncGetHandleForThread)(void);
  1499. typedef void (RPC_ENTRY *FuncReleaseHandleForThread)(HANDLE);
  1500. //
  1501. // Exports from the RPC runtime; used by the transport interface
  1502. //
  1503. extern "C" {
  1504. //
  1505. // Memory management APIs
  1506. //
  1507. // rpcdcep.h - I_RpcAllocate
  1508. // rpcdcep.h - I_RpcFree
  1509. // Connection allocation functions are called on either
  1510. // client-side or server-side connections during the
  1511. // receive path. Buffers must be 0 mod 8.
  1512. RPCRTAPI
  1513. BUFFER
  1514. RPC_ENTRY
  1515. I_RpcTransConnectionAllocatePacket(
  1516. RPC_TRANSPORT_CONNECTION ThisConnection,
  1517. UINT Size
  1518. );
  1519. RPCRTAPI
  1520. void
  1521. RPC_ENTRY
  1522. I_RpcTransConnectionFreePacket(
  1523. RPC_TRANSPORT_CONNECTION ThisConnection,
  1524. BUFFER Ptr
  1525. );
  1526. RPCRTAPI
  1527. RPC_STATUS
  1528. RPC_ENTRY
  1529. I_RpcTransConnectionReallocPacket(
  1530. IN RPC_TRANSPORT_CONNECTION ThisConnection,
  1531. IN BUFFER *ppBuffer,
  1532. IN UINT OldSize,
  1533. IN UINT NewSize
  1534. );
  1535. RPCRTAPI
  1536. BUFFER
  1537. RPC_ENTRY
  1538. I_RpcTransServerAllocatePacket(
  1539. RPC_TRANSPORT_CONNECTION ThisConnection,
  1540. UINT Size
  1541. );
  1542. RPCRTAPI
  1543. void
  1544. RPC_ENTRY
  1545. I_RpcTransServerFreePacket(
  1546. RPC_TRANSPORT_CONNECTION ThisConnection,
  1547. BUFFER Ptr
  1548. );
  1549. RPCRTAPI
  1550. RPC_STATUS
  1551. RPC_ENTRY
  1552. I_RpcTransServerReallocPacket(
  1553. IN RPC_TRANSPORT_CONNECTION ThisConnection,
  1554. IN BUFFER *ppBuffer,
  1555. IN UINT OldSize,
  1556. IN UINT NewSize
  1557. );
  1558. RPCRTAPI
  1559. RPC_STATUS
  1560. RPC_ENTRY
  1561. I_RpcTransDatagramAllocate(
  1562. IN RPC_TRANSPORT_ADDRESS ThisAddress,
  1563. OUT BUFFER *pBuffer,
  1564. OUT PUINT pBufferLength,
  1565. OUT DatagramTransportPair **pAddressPair
  1566. );
  1567. RPCRTAPI
  1568. RPC_STATUS
  1569. RPC_ENTRY
  1570. I_RpcTransDatagramAllocate2(
  1571. IN RPC_TRANSPORT_ADDRESS ThisAddress,
  1572. OUT BUFFER *pBuffer,
  1573. IN OUT PUINT pBufferLength,
  1574. OUT DG_TRANSPORT_ADDRESS *pAddress
  1575. );
  1576. RPCRTAPI
  1577. RPC_STATUS
  1578. RPC_ENTRY
  1579. I_RpcTransDatagramFree(
  1580. IN RPC_TRANSPORT_ADDRESS ThisAddress,
  1581. IN BUFFER Buffer
  1582. );
  1583. //
  1584. // Thread APIs
  1585. //
  1586. RPCRTAPI
  1587. PVOID
  1588. RPC_ENTRY
  1589. I_RpcTransProtectThread (
  1590. void
  1591. );
  1592. RPCRTAPI
  1593. void
  1594. RPC_ENTRY
  1595. I_RpcTransUnprotectThread (
  1596. IN PVOID Thread
  1597. );
  1598. //
  1599. // Runtime supplied per thread events.
  1600. //
  1601. RPCRTAPI
  1602. HANDLE
  1603. RPC_ENTRY
  1604. I_RpcTransGetThreadEvent(
  1605. );
  1606. //
  1607. // Misc connection oriented callbacks
  1608. //
  1609. RPCRTAPI
  1610. RPC_STATUS
  1611. RPC_ENTRY
  1612. I_RpcTransIoCancelled(
  1613. IN RPC_TRANSPORT_CONNECTION ThisConnection,
  1614. OUT PDWORD pTimeoutInMilliseconds
  1615. );
  1616. RPCRTAPI
  1617. BOOL
  1618. RPC_ENTRY
  1619. I_RpcTransPingServer(
  1620. IN RPC_TRANSPORT_CONNECTION ThisConnection
  1621. ) ;
  1622. RPCRTAPI
  1623. RPC_TRANSPORT_CONNECTION
  1624. RPC_ENTRY
  1625. I_RpcTransServerNewConnection (
  1626. IN RPC_TRANSPORT_ADDRESS ThisAddress
  1627. );
  1628. RPC_TRANSPORT_INTERFACE
  1629. TransportLoad (
  1630. IN const RPC_CHAR * RpcProtocolSequence
  1631. );
  1632. #define SU_TRANS_CONN 'o'
  1633. #define EV_ABORT 'R'
  1634. void RPC_ENTRY
  1635. I_RpcLogEvent (
  1636. IN unsigned char Subject,
  1637. IN unsigned char Verb,
  1638. IN void * SubjectPointer,
  1639. IN void * ObjectPointer,
  1640. IN unsigned Data,
  1641. IN BOOL fCaptureStackTrace,
  1642. IN int AdditionalFramesToSkip
  1643. );
  1644. //
  1645. // constants for CallTestHook
  1646. //
  1647. #define TH_X_DG_SEND MAKE_TEST_HOOK_ID( TH_TRANS_BASE, 1 )
  1648. // args:
  1649. // hook ID
  1650. // pointer to NCA_PACKET_HEADER
  1651. // pointer to DWORD status variable
  1652. // nonzero status will be returned to caller w/o sending a packet
  1653. #define TH_X_DG_SYNC_RECV MAKE_TEST_HOOK_ID( TH_TRANS_BASE, 2 )
  1654. // args:
  1655. // hook ID
  1656. // pointer to DG_TRANSPORT_ENDPOINT
  1657. // pointer to DWORD status variable
  1658. // nonzero status will be returned to caller w/o receiving
  1659. //
  1660. // Call to allocate an IP port. This allows control of dynamic port
  1661. // allocation by the RPC runtime.
  1662. //
  1663. RPCRTAPI
  1664. RPC_STATUS
  1665. RPC_ENTRY
  1666. I_RpcServerAllocateIpPort(
  1667. IN ULONG Flags,
  1668. OUT USHORT *pPort
  1669. );
  1670. void
  1671. I_RpcTransVerifyServerRuntimeCallFromContext(
  1672. void *SendContext
  1673. );
  1674. void
  1675. I_RpcTransVerifyClientRuntimeCallFromContext(
  1676. void *SendContext
  1677. );
  1678. BOOL
  1679. I_RpcTransIsClientConnectionExclusive(
  1680. void *RuntimeConnection
  1681. );
  1682. RPC_STATUS
  1683. I_RpcTransCertMatchPrincipalName(
  1684. PCCERT_CONTEXT Context,
  1685. RPC_CHAR PrincipalName[]
  1686. );
  1687. RPC_HTTP_TRANSPORT_CREDENTIALS_W *
  1688. I_RpcTransGetHttpCredentials (
  1689. const IN RPC_HTTP_TRANSPORT_CREDENTIALS_W *SourceCredentials
  1690. );
  1691. void I_RpcTransFreeHttpCredentials (
  1692. IN RPC_HTTP_TRANSPORT_CREDENTIALS_W *SourceCredentials
  1693. );
  1694. RPCRTAPI
  1695. RPC_STATUS
  1696. RPC_ENTRY
  1697. HTTP2IISDirectReceive (
  1698. IN void *Context
  1699. );
  1700. RPCRTAPI
  1701. RPC_STATUS
  1702. RPC_ENTRY
  1703. HTTP2DirectReceive (
  1704. IN void *Context,
  1705. OUT BYTE **ReceivedBuffer,
  1706. OUT ULONG *ReceivedBufferLength,
  1707. OUT void **RuntimeConnection,
  1708. OUT BOOL *IsServer
  1709. );
  1710. RPCRTAPI
  1711. RPC_STATUS
  1712. RPC_ENTRY
  1713. HTTP2WinHttpDirectReceive (
  1714. IN void *Context,
  1715. OUT BYTE **ReceivedBuffer,
  1716. OUT ULONG *ReceivedBufferLength,
  1717. OUT void **RuntimeConnection
  1718. );
  1719. RPCRTAPI
  1720. RPC_STATUS
  1721. RPC_ENTRY
  1722. HTTP2WinHttpDirectSend (
  1723. IN void *Context,
  1724. OUT BYTE **SentBuffer,
  1725. OUT void **SendContext
  1726. );
  1727. RPCRTAPI
  1728. RPC_STATUS
  1729. RPC_ENTRY
  1730. HTTP2PlugChannelDirectSend (
  1731. IN void *Context
  1732. );
  1733. RPCRTAPI
  1734. RPC_STATUS
  1735. RPC_ENTRY
  1736. HTTP2FlowControlChannelDirectSend (
  1737. IN void *Context,
  1738. OUT BOOL *IsServer,
  1739. OUT BOOL *SendToRuntime,
  1740. OUT void **SendContext,
  1741. OUT BUFFER *Buffer,
  1742. OUT UINT *BufferLength
  1743. );
  1744. RPCRTAPI
  1745. RPC_STATUS
  1746. RPC_ENTRY
  1747. HTTP2ChannelDataOriginatorDirectSend (
  1748. IN void *Context,
  1749. OUT BOOL *IsServer,
  1750. OUT void **SendContext,
  1751. OUT BUFFER *Buffer,
  1752. OUT UINT *BufferLength
  1753. );
  1754. RPCRTAPI
  1755. void
  1756. RPC_ENTRY
  1757. HTTP2TimerReschedule (
  1758. IN void *Context
  1759. );
  1760. RPCRTAPI
  1761. void
  1762. RPC_ENTRY
  1763. HTTP2AbortConnection (
  1764. IN void *Context
  1765. );
  1766. RPCRTAPI
  1767. void
  1768. RPC_ENTRY
  1769. HTTP2RecycleChannel (
  1770. IN void *Context
  1771. );
  1772. RPC_STATUS
  1773. HTTP2ProcessComplexTReceive (
  1774. IN OUT void **Connection,
  1775. IN RPC_STATUS EventStatus,
  1776. IN ULONG Bytes,
  1777. OUT BUFFER *Buffer,
  1778. OUT UINT *BufferLength
  1779. );
  1780. RPC_STATUS
  1781. HTTP2ProcessComplexTSend (
  1782. IN void *SendContext,
  1783. IN RPC_STATUS EventStatus,
  1784. OUT BUFFER *Buffer
  1785. );
  1786. RPCRTAPI
  1787. RPC_STATUS
  1788. RPC_ENTRY
  1789. HTTP2TestHook (
  1790. IN SystemFunction001Commands FunctionCode,
  1791. IN void *InData,
  1792. OUT void *OutData
  1793. );
  1794. // Note: Gathered send support.
  1795. //
  1796. // Scatter/gather support is a common hardware feature of networking
  1797. // devices. Gather support is often useful for both DG and CO RPC.
  1798. //
  1799. // Not all networking programming APIs, for example winsock 1.x, support
  1800. // the feature, for example winsock 1.x.
  1801. //
  1802. // When possible transport implementer's should implement gathered sends,
  1803. // but the following assumptions can be made for those who cannot support
  1804. // gathered sends:
  1805. //
  1806. // Sends will consist of three (3) buffers: Header, Body and Trailer.
  1807. //
  1808. // The following rules are maintained by the RPC runtime:
  1809. // - All three buffer remain valid until the send completes.
  1810. // - Header and Trailer are small in size
  1811. // - sizeof(Header) bytes *before* the Body pointer are valid
  1812. // and maybe used during the send. But must be restored when
  1813. // the send completes (with or without an error.)
  1814. // - sizeof(Trailer) bytes *after* the Body pointer are valid
  1815. // and maybe used during the send. But must be restored when
  1816. // the send completes (with or without an error.)
  1817. //
  1818. // Scattered recv support is interesting in some protocols but it is
  1819. // not practical to simulate scattered recv's in the transport. Since
  1820. // the CO header is variable in length
  1821. } // extern "C"
  1822. #endif // __RPC_TRANS_HXX