Embedded TCP/IP stack: fnet_socket_options_t

FNET

Embedded TCP/IP stack  4.1.0

Socket options for the fnet_socket_setopt() and the fnet_socket_getopt().

Socket SOL_SOCKET, IPPROTO_TCP, IPPROTO_IP and IPPROTO_IPV6 level options
OptionOption TypeDefault ValueRead/Write
SO_ACCEPTCONNfnet_uint32_t0R
SO_KEEPALIVEfnet_uint32_t1RW
SO_DONTROUTEfnet_uint32_t0RW
SO_LINGERstruct fnet_linger{0,0}RW
SO_OOBINLINEfnet_uint32_t0RW
SO_SNDBUFfnet_uint32_t FNET_CFG_SOCKET_UDP_TX_BUF_SIZE for UDP
FNET_CFG_SOCKET_TCP_TX_BUF_SIZE for TCP
RW
SO_RCVBUFfnet_uint32_t FNET_CFG_SOCKET_UDP_RX_BUF_SIZE for UDP
FNET_CFG_SOCKET_TCP_RX_BUF_SIZE for TCP
RW
SO_STATEfnet_socket_state_tSS_UNCONNECTEDR
SO_ERRORfnet_error_tFNET_ERR_OKR
SO_TYPEfnet_socket_type_tSOCK_DGRAM for UDP
SOCK_STREAM for TCP
R
SO_RCVNUMfnet_uint32_t0R
SO_SNDNUMfnet_uint32_t0R
TCP_MSSfnet_uint32_t536RW
TCP_BSDfnet_uint32_t1RW
TCP_NODELAYfnet_uint32_t1RW
TCP_FINRCVDfnet_uint32_t0R
TCP_URGRCVDfnet_uint32_t0R
TCP_KEEPIDLEfnet_uint32_t7200RW
TCP_KEEPINTVLfnet_uint32_t75RW
TCP_KEEPCNTfnet_uint32_t8RW
IP_TOSfnet_uint32_t0RW
IP_TTLfnet_uint32_t64RW
IP_MULTICAST_TTLfnet_uint32_t1RW
IP_ADD_MEMBERSHIPfnet_ip_mreqN/AW
IP_DROP_MEMBERSHIPfnet_ip_mreqN/AW
IPV6_UNICAST_HOPSfnet_uint32_t0 (64)RW
IPV6_MULTICAST_HOPSfnet_uint32_t1RW
IPV6_JOIN_GROUPfnet_ipv6_mreqN/AW
IPV6_LEAVE_GROUPfnet_ipv6_mreqN/AW
Enumerator
SO_ACCEPTCONN 

Returns 1 if a socket is in listening mode and returns 0 when vice versa. This is the read-only option and it is valid only for connection-oriented protocols (TCP).

SO_KEEPALIVE 

This option enables keep-alive probes for a socket connection. These probes are used to maintain a TCP connection and regularly test the connection to ensure that it's still available. It is only valid for connection-oriented protocols (TCP).

SO_DONTROUTE 

This option enables bypassing of a routing algorithm. It means that the network interface tries to send a datagram without a gateway.

SO_LINGER 

This option controls the action taken when unsent data is present, and fnet_socket_close() is called. This option is defined by the fnet_linger structure.

SO_OOBINLINE 

This option specifies that out-of-band (OOB) data will be received in line with regular data. It is valid only for the TCP protocol.
This option is avalable only if FNET_CFG_TCP_URGENT is set to 1.

SO_SNDBUF 

This option defines the maximum per-socket buffer size for output data.

SO_RCVBUF 

This option defines the maximum per-socket buffer size for input data.

SO_STATE 

This option defines the current state of the socket.
This is the read-only option and it is defined by the fnet_socket_state_t type.

SO_ERROR 

This option returns a per-socket-based error code.
The error code is defined by the fnet_error_t type.
After the error value has been read in the fnet_socket_getopt function, it is cleared. But a successful call using the socket routines does not clear the socket-based error.

SO_TYPE 

This option defines the type of the socket. This is a read-only option and it is defined by the fnet_socket_type_t type.

SO_RCVNUM 

This option is used to determine the amount of data pending in the socket-input buffer.
This is a read-only option.

SO_SNDNUM 

This option is used to determine the amount of data in the socket output buffer.
This is a read-only option.

TCP_MSS 

This option defines the maximum size of the input segments (MSS).
The TCP Maximum Segment Size (MSS) defines the maximum amount of data that a host is willing to accept in a single TCP segment.
This Maximum Segment Size (MSS) announcement is sent from the data receiver to the data sender and says "I can accept TCP segments up to size X". The size (X) may be larger or smaller than the default.
The MSS counts only data octets in the segment, it does not count the TCP header or the IP header.
The default value is defined by the FNET_CFG_SOCKET_TCP_MSS user-configuration option.
This option can be set to:

  • 0 = The selection of the MSS is automatic and is based on the MTU of the outgoing interface minus 40 (does not include the 20 byte IP header and the 20 byte TCP header).
    It is done to assist in avoiding of IP fragmentation at the endpoints of the TCP connection.
  • Non-zero value (up to 64K) = The TCP segment could be as large as 64K (the maximum IP datagram size), but it could be fragmented at the IP layer in order to be transmitted across the network to the receiving host.
TCP_BSD 

If this option is set to 1, the BSD interpretation of the urgent pointer is used. In this case the urgent pointer of the TCP segment points to the next byte following after the urgent byte. Most of the TCP implementations use this interpretation by default.
If this option is set to 0, the interpretation of the TCP specification is used. In this case the urgent pointer of the TCP segment points to the urgent byte.
This option is avalable only if FNET_CFG_TCP_URGENT is set to 1.

TCP_NODELAY 

If this option is set to 1, the Nagle algorithm is disabled (and vice versa).
The Nagle algorithm is effective in reducing the number of small packets sent by the host by essentially buffering send data, if there is unacknowledged data already "in flight", or until a full-size packet can be sent.
But for some applications this algorithm can impede performance, especially for a bulky data transfer.

TCP_FINRCVD 

This option is set when the final (FIN) segment arrives.
This option indicates that another side will not send any data in the current connection.
This is the read-only option.

TCP_URGRCVD 

This option is set when the urgent byte arrives, and reset when this byte is read.
This option can be set only if the SO_OOBINLINE option is set to 0.
This is the read-only option.
This option is avalable only if FNET_CFG_TCP_URGENT is set to 1.

TCP_KEEPIDLE 

When the SO_KEEPALIVE option is enabled, TCP probes a connection that has been idle for some amount of time. The default value for this idle period is 7200 seconds (2 hours). The TCP_KEEPIDLE option can be used to affect this value for a given socket, and specifies the number of seconds of idle time between keepalive probes.

TCP_KEEPINTVL 

When the SO_KEEPALIVE option is enabled, TCP probes a connection that has been idle for some amount of time. If the remote system does not respond to a keepalive probe, TCP retransmits the probe after some amount of time. The default value for this retransmit interval is 75 seconds. The TCP_KEEPINTVL option can be used to affect this value for a given socket, and specifies the number of seconds to wait before retransmitting a keepalive probe.

TCP_KEEPCNT 

When the SO_KEEPALIVE option is enabled, TCP probes a connection that has been idle for some amount of time. If the remote system does not respond to a keepalive probe, TCP retransmits the probe a certain number of times before a connection is considered to be broken. The default value for this keepalive probe retransmit limit is 8. The TCP_KEEPCNT option can be used to affect this value for a given socket, and specifies the maximum number of keepalive probes to be sent.

IP_TOS 

This option defines the IPv4 TOS (type-of-service) field for outgoing datagrams.

IP_TTL 

This option defines the IPv4 TTL (time-to-live) vlaue for outgoing datagrams.

IP_MULTICAST_TTL 

This option allows to change IPv4 "time to live" (TTL) value for outgoing multicast datagrams. Otherwise, multicast datagrams are sent with a default value of 1, to prevent them to be forwarded beyond the local network.
This option is available only if FNET_CFG_MULTICAST is set to 1.

IP_ADD_MEMBERSHIP 

Join the socket to the IPv4 multicast group on the specified interface. It tells the system to receive packets on the network whose destination is the group address (but not its own). It is valid only for the SOCK_DGRAM (UDP) sockets.
This option is available only if FNET_CFG_MULTICAST is set to 1.

IP_DROP_MEMBERSHIP 

Drops membership to a IPv4 multicast group and interface.
This option is available only if FNET_CFG_MULTICAST is set to 1.

IPV6_UNICAST_HOPS 

This option defines hop limit used for outgoing unicast IPv6 packets.
Its value can be from 0 till 255.
By default the option is set to 0. It means that the hop limit is defined by local IPv6 router, otherwise it equals to 64.

IPV6_MULTICAST_HOPS 

Set the hop limit to use for outgoing multicast IPv6 packets.
If IPV6_MULTICAST_HOPS is not set, the default is 1.

IPV6_JOIN_GROUP 

(RFC3493) Join a multicast group on a specified local interface.
It is valid only for the SOCK_DGRAM (UDP) sockets.

IPV6_LEAVE_GROUP 

(RFC3493) Leave a multicast group on a specified interface.
It is valid only for the SOCK_DGRAM (UDP) sockets.

Definition at line 473 of file fnet_socket.h.


© 2005-2018 by Andrey Butok. http://fnet.sourceforge.net