NTSTATUS
ClientEventChainedReceiveDatagram(
IN PVOID TdiEventContext,
IN LONG SourceAddressLength,
IN PVOID SourceAddress,
IN LONG OptionsLength,
IN PVOID Options,
IN ULONG ReceiveDatagramFlags,
IN ULONG ReceiveDatagramLength,
IN ULONG StartingOffset,
IN PMDL Tsdu,
IN PVOID TsduDescriptor
);
ClientEventChainedReceiveDatagram is an event handler that the underlying TDI transport calls in response to an incoming receive from a remote node that was directed to a local-node transport address opened by the client.
The transport calls this handler, rather than ClientEventReceiveDatagram, when it is indicating a full TSDU and the client can be given direct read-only access to the buffered TSDU until the client has consumed the data.
ClientEventChainedReceiveDatagram can return one of the following:
When a datagram arrives from a remote node, the transport calls the registered ClientEvent(Chained)ReceiveDatagram handlers for each client with an open file object representing an address that matches the destination address of the datagram. Because a datagram is not associated with an established connection, the TDI driver passes the transport address of the remote-node sender at SourceAddress to the receiving client along with the datagram.
A call to ClientEventChainedReceiveDatagram gives the client read-only access to the indicated TSDU for the range within the buffer specified by the input StartingOffset and ReceiveLength. If the indicated data is of interest to the client, ClientEventChainedReceiveDatagram either copies the indicated range of TSDU data into a client-allocated internal buffer and returns STATUS_SUCCESS immediately or retains control of the buffer by returning STATUS_PENDING. If it returns STATUS_PENDING, the client must call TdiReturnChainedReceives subsequently with the input TsduDescriptor to relinquish control of the buffer after the client has consumed the data.
In general, such a call to TdiReturnChainedReceives should occur as quickly as possible. Holding on to a buffer passed to ClientEventChainedReceiveDatagram for any extended period constrains I/O throughput in underlying driver(s), because the driver that allocated the buffer cannot reuse this resource for subsequent receive indications until TdiReturnChainedReceives is called.
Because calls to ClientEventChainedReceiveDatagram always indicate the availability of a full TSDU, the client never has to set up TDI_RECEIVE_DATAGRAM requests for such an indication, as the corresponding ClientEventReceiveDatagram handler sometimes must to obtain a full TSDU. Consequently, receive indications made to ClientEventChainedReceiveDatagram increase network I/O throughput and performance by decreasing call overhead for the client, for its underlying transport, and for the system overall. A transport never calls the corresponding ClientEventReceiveDatagram handler with the same indication it makes to ClientEventChainedReceiveDatagram.
When ClientEventChainedReceiveDatagram returns control with either STATUS_SUCCESS or STATUS_DATA_NOT_ACCEPTED, the underlying transport assumes the client is done with this receive indication.
The underlying TDI transport does not call ClientEventChainedReceiveDatagram if the client has an outstanding receive or receive-datagram request on the local transport address that is the target of an incoming datagram.
To receive indications for broadcast datagrams that the TDI driver receives on the network, the client must open the broadcast address of its underlying transport and register its ClientEvent(Chained)ReceiveDatagram handler(s).
By default, ClientEventChainedReceiveDatagram runs at IRQL DISPATCH_LEVEL.
ClientEventReceiveDatagram, TdiBuildSetEventHandler, TdiReturnChainedReceives, TA_ADDRESS