TdiBuildAccept macro
TdiBuildAccept sets up an internal device control IRP for a TDI_ACCEPT request to the underlying transport in which a local-node client has already opened a connection endpoint and associated it with a local-node address and to which the client has already issued a TDI_LISTEN request.
Syntax
VOID TdiBuildAccept(
[in] PIRP Irp,
[in] PDEVICE_OBJECT DevObj,
[in] PFILE_OBJECT FileObj,
[in] PVOID CompRoutine,
[in] PVOID Contxt,
[in] PTDI_CONNECTION_INFORMATION RequestConnectionInfo,
[out] PTDI_CONNECTION_INFORMATION ReturnConnectionInfo
);
Parameters
Irp [in]
Pointer to a client-supplied IRP, either originating in a higher level network component or allocated with TdiBuildInternalDeviceControlIrp.DevObj [in]
Pointer to the device object created by the next lower TDI transport driver.FileObj [in]
Pointer to a file object representing a connection endpoint. The client previously made a successful request, set up with TdiBuildAssociateAddress, to the transport to set up an association between this connection and a local-node address. When the association was established, the client also issued a listen request, set up with TdiBuildListen, to the transport.CompRoutine [in]
Specifies the entry point of a client-supplied IoCompletion routine or NULL. The I/O manager calls this routine when the given IRP is completed, unless the client sets this parameter to NULL.Contxt [in]
Pointer to a client-determined context. This client-supplied pointer is passed in to the IoCompletion routine when it is called with the completed IRP. Contxt is NULL if CompRoutine is NULL.RequestConnectionInfo [in]
Pointer to a caller-supplied buffer containing a TDI_CONNECTION_INFORMATION structure, set up to specify a valid remote-node client address from which the caller, a local-node client, can accept a connection. The local-node client also can provide buffered accept data, specified at UserData in this structure, that the underlying transport should send to the remote node when it transmits acceptance of the offered connection (see TdiBuildListen for details).ReturnConnectionInfo [out]
Pointer to a caller-supplied buffer in which the transport returns the remote-node client's address with which it has established an endpoint-to-endpoint connection for the local-node client. This buffer is also formatted as a TDI_CONNECTION_INFORMATION structure. If the underlying transport does not provide this information, this parameter should be NULL.
Return value
None
Remarks
TdiBuildAccept sets IRP_MJ_INTERNAL_DEVICE_CONTROL as the MajorFunction and TDI_ACCEPT as the MinorFunction codes in the transport's I/O stack location of the given IRP.
When a kernel-mode client issues a TDI_ACCEPT request, it asks the underlying transport to accept an incoming request to connect from a remote-node client and, thereby, to enable network data reception on an established endpoint-to-endpoint connection.
Usually, a client sends an accept request in response to a return from its preceding listen request, set up with TdiBuildListen with the TDI_QUERY_ACCEPT option selected. If a client did not set this value in the Flags for its listen request, its accept request fails because the underlying transport has already established an endpoint-to-endpoint connection when the listen request completes.
Most TDI transports have a time-out feature that prevents attempts to establish endpoint-to-endpoint connections from hanging when a remote node does not respond. Therefore, a client must either accept or reject a connection as soon as possible after completion of its listen request. The interval between client notification of a remote-node peer connection offer and that local client's connection acceptance or rejection is subject to a transport-determined time-out limit, usually something less than one second.
A client indicates its acceptances of a connection to the remote-node peer by submitting a request set up by TdiBuildAccept to the underlying transport. It indicates its rejection of a connection offer by submitting an IRP set up with TdiBuildDisconnect.
The local client's registered ClientEvent(Chained)Receive(Expedited) handler(s) can be called before the I/O manager formally completes its processing of the accept IRP. That is, the remote-node peer can start sending data to the local client as soon as the remote node receives an acceptance of the offered connection.
Note The TDI feature is deprecated and will be removed in future versions of Microsoft Windows. Depending on how you use TDI, use either the Winsock Kernel (WSK) or Windows Filtering Platform (WFP). For more information about WFP and WSK, see Windows Filtering Platform and Winsock Kernel. For a Windows Core Networking blog entry about WSK and TDI, see Introduction to Winsock Kernel (WSK).
Requirements
Target platform |
Desktop |
Header |
Tdikrnl.h (include TdiKrnl.h) |
See also
ClientEventChainedReceiveExpedited
TdiBuildInternalDeviceControlIrp