ClientEventDisconnect

NTSTATUS
    ClientEventDisconnect (
        IN PVOID  TdiEventContext,
        IN CONNECTION_CONTEXT  ConnectionContext,
        IN LONG  DisconnectDataLength,
        IN PVOID  DisconnectData,
        IN LONG  DisconnectInformationLength,
        IN PVOID  DisconnectInformation,
        IN ULONG  DisconnectFlags
        );

ClientEventDisconnect is an event handler that the underlying TDI transport calls in response to an incoming disconnection notification from a remote node.

Parameters

TdiEventContext
Points to the client-supplied context provided in the IRP that was set up with TdiBuildSetEventHandler when ClientEventDisconnect was registered with the underlying transport.
ConnectionContext
Points to the client's context area for this connection endpoint. The client previously supplied this value to its underlying transport when its ClientEventConnect handler accepted a connection offer from the remote-node peer and/or when it opened the connection endpoint with ZwCreateFile.
DisconnectDataLength
Specifies the size in bytes of the buffer at DisconnectData. Zero indicates that no disconnect data was transmitted from the remote node.
DisconnectData
Points to a buffer containing disconnect data received from the remote node by the underlying transport. This pointer is NULL if DisconnectDataLength is zero.
DisconnectInformationLength
Specifies the size in bytes of the buffer at DisconnectInformation. Zero indicates that no additional disconnect information was transmitted from the remote node.
DisconnectInformation
Points to a buffer containing any additional transport-specific disconnect information. This pointer is NULL if DisconnectInformationLength is zero.
DisconnectFlags
Specifies the nature of the disconnection operation as zero or as one of the following flags:
TDI_DISCONNECT_ABORT
The transport is closing the endpoint-to-endpoint connection immediately without completing any pending operations on the connection. In effect, this flag is equivalent to a DisconnectFlags of zero.
TDI_DISCONNECT_RELEASE
The transport is engaged in a controlled disconnect operation with the remote node.

Return Value

ClientEventDisconnect can return STATUS_SUCCESS.

Comments

A call to ClientEventDisconnect notifies the local-node client that its remote-node peer is closing their established endpoint-to-endpoint connection. Depending on the input DisconnectFlags, the disconnect can be either controlled or uncontrolled. ClientEventDisconnect is the last event handler the TDI driver calls on an endpoint-to-endpoint connection.

If TDI_DISCONNECT_RELEASE is set in the DisconnectFlags, both transports are coordinating a controlled disconnection. (See TDI_DISCONNECT for details.)

A call to ClientEventDisconnect notifies the local-node client that endpoint-to-endpoint activity has ceased or is ceasing on the connection endpoint opened by that client. However, the connection endpoint is still valid after the endpoint-to-endpoint connection has been broken. The local-node client can reuse its open connection endpoint in a subsequent operation after ClientEventDisconnect returns control.

ClientEventDisconnect can be called at IRQL DISPATCH_LEVEL.

See Also

TdiBuildDisconnect, TdiBuildSetEventHandler, TDI_DISCONNECT