TdiBuildAccept

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
);

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.

Parameters

Irp

Points to a client-supplied IRP, either originating in a higher level network component or allocated with TdiBuildInternalDeviceControlIrp.

DevObj

Points to the device object created by the next lower TDI transport driver.

FileObj

Points 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

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

Points 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 should be NULL if CompRoutine is NULL.

RequestConnectionInfo

Points 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

Points 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.

Comments

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.

See Also

ClientEventChainedReceive, ClientEventChainedReceiveExpedited, ClientEventConnect, ClientEventReceive, ClientEventReceiveExpedited, TDI_ACCEPT, TdiBuildDisconnect, TdiBuildInternalDeviceControlIrp, TdiBuildListen, TDI_CONNECTION_INFORMATION