nf_tcpSetSockOpt

Sets socket options for TCP connections.
NF_STATUS nf_tcpSetSockOpt(ENDPOINT_ID id, int optname, const char* optval, int optlen)

Parameters

id
Connection identifier
optname
Option code
optval
Pointer to option value
optlen
Option value length

Return Values

NF_STATUS_SUCCESS on success, or other NF_STATUS error code on fail.

Remarks

It is possible to change TCP/IP options for the specified active TCP connection. This is analogue of setsockopt() function from WinSock API. The following options are supported:

optname WinSock equivalent optval type Description
TCP_SOCKET_NODELAY=1 TCP_NODELAY DWORD
(boolean)
Enables or disables the Nagle algorithm for TCP sockets. This option is disabled (set to FALSE) by default.
TCP_SOCKET_KEEPALIVE=2 SO_KEEPALIVE DWORD
(boolean)
Enables sending keep-alive packets for a socket connection.
TCP_SOCKET_OOBINLINE=3 SO_OOBINLINE DWORD
(boolean)
Indicates that out-of-bound data should be returned in-line with regular data.
TCP_SOCKET_BSDURGENT=4 TCP_BSDURGENT DWORD
(boolean)
If TRUE, the service provider implements the Berkeley Software Distribution (BSD) style (default) for handling expedited data. This option is the inverse of the TCP_EXPEDITED_1122 option. This option can be set on the connection only once. Once this option is set on, this option cannot be turned off. This option is not required to be implemented by service providers. The option is enabled (set to TRUE) by default.
TCP_SOCKET_ATMARK=5 struct TCPSocketAMInfo optval must point to the following structure:

typedef struct TCPSocketAMInfo {
ulong tsa_size; // Size of urgent data returned
long tsa_offset; // Offset of urgent data returned.
} TCPSocketAMInfo;

The tsa_offset field indicate how far back or forward in the data stream urgent data was or will be returned. A negative value means inline urgent data has already been given to the client, -tsa_offset bytes ago. A positive value means that inline urgent data is available tsa_offset bytes down the data stream. The tsa_size field is the size in bytes of the urgent data. This call when always return a 0 size and offset if the connection is not in the urgent inline mode.
TCP_SOCKET_WINDOW=6 DWORD Socket window size

Requirements

Driver type WFP, TDI
Header nfapi.h
Library nfapi.lib