TdiBuildConnect

VOID
    TdiBuildConnect (
        IN PIRP  Irp,
        IN PDEVICE_OBJECT  DevObj,
        IN PFILE_OBJECT  FileObj,
        IN PVOID  CompRoutine,
        IN PVOID  Contxt,
        IN PLARGE_INTEGER  Time,
        IN PTDI_CONNECTION_INFORMATION  RequestConnectionInfo,
        OUT PTDI_CONNECTION_INFORMATION  ReturnConnectionInfo
        );

TdiBuildConnect sets up an internal device control IRP for a TDI_CONNECT request to the underlying transport in which a local-node client has already associated an address and a connection endpoint.

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 the connection endpoint.
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.
Time
Points to a variable specifying a system-relative time-out interval that the transport is to use for the connection attempt, or this parameter can be NULL.

An explicit time-out must be specified as the negative of the number of 100-nanosecond intervals, relative to the current system time, that its connection attempt is allowed to remain pending before the transport fails this connect request. If this pointer is NULL, the transport uses its own default time-out interval for establishing a connection with any remote node.

RequestConnectionInfo
Points to a caller-supplied buffer containing a TDI_CONNECTION_INFORMATION structure that specifies the remote-node client address to which the local-node client is requesting an endpoint-to-endpoint connection.
ReturnConnectionInfo
Points to a caller-supplied buffer in which the transport returns the remote-node client address with which it has established a connection. This buffer is also formatted as TDI_CONNECTION_INFORMATION structure. If a local-node client requires no output information or if the underlying transport does not return such information, this parameter should be NULL.

Comments

TdiBuildConnect sets IRP_MJ_INTERNAL_DEVICE_CONTROL as the MajorFunction and TDI_CONNECT as the MinorFunction codes in the transport's I/O stack location of the given IRP.

If the specified endpoint is inactive or nonexistent, the transport fails the connect request. If the specified endpoint has not been associated with a local-node address, the transport also fails the connect request.

For a local-node client to establish an endpoint-to-endpoint connection with a remote-node peer process, it must first associate an idle local connection endpoint with a local-node address. A client cannot initiate a connection attempt to a remote-node peer until it has made a successful TDI_ASSOCIATE_ADDRESS request, which it set up with TdiBuildAsociateAddress, to its underlying transport.

For a local-node client's connect request to succeed, the remote-node client must have an open listen request or a registered ClientEventConnect routine that can receive notification from its underlying transport of connection offers.

See Also

ClientEventConnect, TdiBuildAssociateAddress, TdiBuildInternalDeviceControlIrp, TdiBuildListen, TdiBuildSetEventHandler, TDI_CONNECT, TDI_CONNECTION_INFORMATION