Bewerken

Delen via


NDK_FN_CONNECT callback function (ndkpi.h)

The NdkConnect (NDK_FN_CONNECT) function initiates an NDK connect request.

Syntax

NDK_FN_CONNECT NdkFnConnect;

NTSTATUS NdkFnConnect(
  [in]                                      NDK_CONNECTOR *pNdkConnector,
  [in]                                      NDK_QP *pNdkQp,
                                            const PSOCKADDR pSrcAddress,
  [in]                                      ULONG SrcAddressLength,
  [in]                                      const PSOCKADDR pDestAddress,
  [in]                                      ULONG DestAddressLength,
  [in]                                      ULONG InboundReadLimit,
  [in]                                      ULONG OutboundReadLimit,
  [_In_reads_bytes_opt_(PrivateDataLength)] const PVOID pPrivateData,
  [in]                                      ULONG PrivateDataLength,
  [in]                                      NDK_FN_REQUEST_COMPLETION RequestCompletion,
  [in, optional]                            PVOID RequestContext
)
{...}

Parameters

[in] pNdkConnector

A pointer to an NDK connector object (NDK_CONNECTOR).

[in] pNdkQp

A pointer to an NDK queue pair (QP) object (NDK_QP) to associate with the connection.

pSrcAddress

A source address. For AF_INET or AF_INET6 pSrcAddress is the source IP address and the source ND port.

[in] SrcAddressLength

The size, in bytes, of source address data at the pSrcAddress parameter.

[in] pDestAddress

A destination address. For AF_INET or AF_INET6 pDestAddress is the destination IP address and the source ND port .

[in] DestAddressLength

The size, in bytes, of destination address data at the pDestAddress parameter.

[in] InboundReadLimit

The consumer-supplied maximum number of incoming in-progress read operations to allow on the QP. If the underlying provider has a lower MaxInboundReadLimit value in the NDK_ADAPTER_INFO structure, then the provider will cap the consumer-supplied value to the provider maximum. If the peer has a lower OutboundReadLimit value, then the provider will use that value as the effective InboundReadLimit. The consumer can retrieve the effective InboundReadLimit by calling the NdkGetConnectionData function (NDK_FN_GET_CONNECTION_DATA).

[in] OutboundReadLimit

The consumer-supplied maximum number of outgoing in-progress read operations to allow on the QP. If the underlying provider has a lower MaxOutboundReadLimit value in the NDK_ADAPTER_INFO structure, then the provider will cap the consumer supplied value to the provider maximum. If the peer has a lower InboundReadLimit, then the provider will use that value as the effective OutboundReadLimit. The consumer can retrieve the effective OutboundReadLimit by calling the NdkGetConnectionData function (NDK_FN_GET_CONNECTION_DATA).

[_In_reads_bytes_opt_(PrivateDataLength)] pPrivateData

A pointer to private data that is sent with the connect request.

[in] PrivateDataLength

The length, in bytes, of the private data that is provided in the pPrivateData parameter.

[in] RequestCompletion

A pointer to a request completion callback routine NdkRequestCompletion (NDK_FN_REQUEST_COMPLETION).

[in, optional] RequestContext

A context value to pass to the Context parameter of the callback function that is specified in the RequestCompletion parameter.

Return value

The NdkConnect function returns one of the following NTSTATUS codes.

Return code Description
STATUS_SUCCESS
The connect request was completed successfully.
STATUS_PENDING
The operation is pending and will be completed later. The driver will call the specified RequestCompletion (NDK_FN_REQUEST_COMPLETION) function to complete the pending operation.
STATUS_INSUFFICIENT_RESOURCES
The request failed due to insufficient resources.
Important  The request can fail inline as well as asynchronously with this status code.
 
STATUS_NETWORK_UNREACHABLE
The request failed because the remote network was not reachable. The connection attempt can be retried.
Important  The request can fail inline as well as asynchronously with this status code.
 
STATUS_HOST_UNREACHABLE
The request failed because the remote host system was not reachable. The connection attempt can be retried.
Important  The request can fail inline as well as asynchronously with this status code.
 
STATUS_CONNECTION_REFUSED
The request failed because the remote system refused the connection request. This can be due to lack of listener, backlog limits, or the peer actively rejecting the connection request. The connection attempt can be retried.
Important  The request can fail inline as well as asynchronously with this status code.
 
STATUS_IO_TIMEOUT
The request failed because the connection request timed out. The connection attempt may be retried. Timeout values are selected by Network Direct providers to match their respective network characteristics.
Important  The request can fail inline as well as asynchronously with this status code.
 
STATUS_SHARING_VIOLATION
The request failed because the specified local address is already in use.
Important  The request can fail inline as well as asynchronously with this status code.
 
STATUS_INVALID_ADDRESS
The request failed because the specified local address is not a valid address for the adapter.
Important  The request can fail inline as well as asynchronously with this status code.
 
STATUS_TOO_MANY_ADDRESSES
The request failed because the consumer specified a local port number of zero, and the Network Direct provider was unable to allocate a port from the ephemeral port space (ports 49152-65535).
Important  The request can fail inline as well as asynchronously with this status code.
 
STATUS_ADDRESS_ALREADY_EXISTS
The request failed because a connection with the combination of local address, local port, remote address, and remote port already exists.
Important  The request can fail inline as well as asynchronously with this status code.
 
Other status codes
An error occurred.

Remarks

NdkConnect initiates a connect request from a local address to a remote address.

Requirements

Requirement Value
Minimum supported client None supported,Supported in NDIS 6.30 and later.
Minimum supported server Windows Server 2012
Target Platform Windows
Header ndkpi.h (include Ndkpi.h)
IRQL <=DISPATCH_LEVEL

See also

NDKPI Object Lifetime Requirements

NDK_ADAPTER_INFO

NDK_CONNECTOR

NDK_CONNECTOR_DISPATCH

NDK_FN_DISCONNECT

NDK_FN_GET_CONNECTION_DATA

NDK_FN_REQUEST_COMPLETION

NDK_QP