TDI_SEND

Operation

TDI_SEND is a request message a client issues to indicate a send request to enable transmission of data from its connection endpoint to a remote node connection endpoint over an established connection.

Note TdiBuildSend is the macro a client uses to fill in the IRP.

Each local node client send request is associated with exactly one receive request from the remote node client to its TDI driver or one driver call to ClientEventReceive in the remote node client. The local node TDI driver queues several send requests and processes them in the order received. The internal driver send function does not include a time-out parameter. It must complete the send in a timely manner, with a success or error status code. The driver should determine a reasonable time-out based on its knowledge of underlying network conditions.

A client can send a stream-oriented or message-oriented TSDU with one or more send requests. A stream-oriented client does not delimit messages and ignores the TDI_SEND_PARTIAL bit flag. A message-oriented client, however, can send a TSDU using numerous requests, each specifying the TDI_SEND_PARTIAL bit flag. If the client does not specify this bit flag, the TDI driver considers the data to be a complete TSDU. The remote node TDI driver notifies the receiving client of partial TSDUs through receive indicators passed in the corresponding receive request.

In its send request, the sending client provides a buffer containing the TSDU. The client can send a buffer of any size, up to the maximum size the TDI driver allows. If necessary, the client can make a query information request to obtain this size. It must not use or modify the send buffer until it is certain (through an I/O completion callback or through protocol semantics) that its send request has finished.

The client can request a nonblocking send when its TDI driver supports internal buffering. A nonblocking send does not block if the driver has insufficient buffer space. Instead, the internal driver send function returns STATUS_DEVICE_NOT_READY. The send function can return a success status code if only a part of the TSDU is buffered. In this case, the client must check the BytesTransferred member of the status parameter structure to determine how many bytes are being sent.

The client can also request a zero-length send, if the TDI driver supports it. A nonpartial zero-length send actually forces protocol flow, and the client can treat it as a zero-length message that satisfies a receive request. If the driver does not support zero-length sends, the client send request returns an error code.

Along with the request message, the TDI client must provide input and output buffers for the IRP, as well as a status block structure the driver uses to write information about the request. These items are described below. For more information about the members of the IRP related to a send request, see TdiBuildSend.

In preparing the IRP, the client can also specify a bit flag providing additional information about the send request. The following bit flags are available:

Bit Flag Meaning
TDI_SEND_EXPEDITED Specifies that the TDI driver should expedite the TSDU over normal data. Not all TDI drivers support expedited data. To determine whether the driver does support it, the client can make a query information request.
TDI_SEND_NON_BLOCKING Specifies a nonblocking send. This flag is valid only for a driver that supports internal buffering.
TDI_SEND_NO_RESPONSE_EXPECTED Specifies that the TSDU is unlikely to generate reverse traffic. A TDI client can use this bit flag to disable piggybacking of the TSDU acknowledgment.
TDI_SEND_PARTIAL Specifies that a message-mode TSDU is incomplete and that the client will send additional data later. If the TDI driver receives a send request without this flag being set, the driver inserts an end-of-record mark in the line flow after sending all data in the buffer. Stream-mode TDI drivers can ignore this flag.

Input

None

Output

None

I/O Status Block

The driver fills in the Status member of the IRP with one of the following TDI status codes:

STATUS_INVALID_CONNECTION
STATUS_PENDING

For more information about status codes, see Part II, Chapter 10.

The Information member of the IRP contains the number of data bytes that the internal driver send function writes.

Comments

A TDI client has the option of sending data on a connection by using the write functions of the I/O subsystem, with a major function code of IRP_MJ_WRITE. Because these functions have no mechanism for passing send flags, the I/O subsystem considers data the client submits as a write to be normal data and (for message-mode drivers) a single message. In other words, data submitted as a write has an implicit flag word with both TDI_SEND_PARTIAL and TDI_SEND_EXPEDITED clear.

Because a TDI driver uses direct I/O, data that a client submits as a write is an MDL chain. The MDL length parameter contains the total length of data to send, and the TDI driver ignores the key and byte offset parameters.

See Also

ClientEventReceive, TdiBuildSend