Embedded TCP/IP stack
4.1.0
|
fnet_socket.h
162 #define AF_SUPPORTED ((fnet_address_family_t)((fnet_address_family_t)(AF_INET6*(fnet_address_family_t)FNET_CFG_IP6) | (fnet_address_family_t)(AF_INET*(fnet_address_family_t)FNET_CFG_IP4)))
735 fnet_socket_t fnet_socket( fnet_address_family_t family, fnet_socket_type_t type, fnet_uint32_t protocol );
771 fnet_return_t fnet_socket_bind( fnet_socket_t s, const struct fnet_sockaddr *name, fnet_size_t namelen );
849 fnet_socket_t fnet_socket_accept( fnet_socket_t s, struct fnet_sockaddr *addr, fnet_size_t *addrlen );
903 fnet_return_t fnet_socket_connect( fnet_socket_t s, struct fnet_sockaddr *name, fnet_size_t namelen );
947 fnet_ssize_t fnet_socket_recv( fnet_socket_t s, void *buf, fnet_size_t len, fnet_flag_t flags );
1004 fnet_ssize_t fnet_socket_recvfrom( fnet_socket_t s, void *buf, fnet_size_t len, fnet_flag_t flags, struct fnet_sockaddr *from, fnet_size_t *fromlen );
1051 fnet_ssize_t fnet_socket_send( fnet_socket_t s, const void *buf, fnet_size_t len, fnet_flag_t flags );
1110 fnet_ssize_t fnet_socket_sendto( fnet_socket_t s, const void *buf, fnet_size_t len, fnet_flag_t flags, const struct fnet_sockaddr *to, fnet_size_t tolen );
1218 fnet_return_t fnet_socket_setopt( fnet_socket_t s, fnet_protocol_t level, fnet_socket_options_t optname, const void *optval, fnet_size_t optvallen );
1253 fnet_return_t fnet_socket_getopt( fnet_socket_t s, fnet_protocol_t level, fnet_socket_options_t optname, void *optval, fnet_size_t *optvallen );
1284 fnet_return_t fnet_socket_getpeername( fnet_socket_t s, struct fnet_sockaddr *name, fnet_size_t *namelen );
1313 fnet_return_t fnet_socket_getname( fnet_socket_t s, struct fnet_sockaddr *name, fnet_size_t *namelen );
1333 fnet_bool_t fnet_socket_addr_are_equal(const struct fnet_sockaddr *addr1, const struct fnet_sockaddr *addr2);
fnet_return_t fnet_socket_getname(fnet_socket_t s, struct fnet_sockaddr *name, fnet_size_t *namelen)
Retrieves the current name for the specified socket.
fnet_ssize_t fnet_socket_sendto(fnet_socket_t s, const void *buf, fnet_size_t len, fnet_flag_t flags, const struct fnet_sockaddr *to, fnet_size_t tolen)
Sends the data to a specific destination.
Socket options level number for fnet_socket_getopt() and fnet_socket_setopt().
Definition: fnet_socket.h:368
This option defines the IPv4 TTL (time-to-live) vlaue for outgoing datagrams.
Definition: fnet_socket.h:595
When the SO_KEEPALIVE option is enabled, TCP probes a connection that has been idle for some amount o...
Definition: fnet_socket.h:571
fnet_uint16_t sin6_port
16-bit port number used to demultiplex the transport-level messages (in network byte order)...
Definition: fnet_socket.h:254
Join the socket to the IPv4 multicast group on the specified interface. It tells the system to receiv...
Definition: fnet_socket.h:602
fnet_uint32_t fnet_scope_id_t
cope zone index type, defining network interface.
Definition: fnet_socket.h:144
fnet_scope_id_t imr_interface
Interface index. It equals to the scope zone index, defining network interface. If this member is zer...
Definition: fnet_socket.h:296
fnet_address_family_t sa_family
Address family. Specifies the address family, to which the address belongs. It is defined by fnet_ad...
Definition: fnet_socket.h:272
fnet_return_t fnet_socket_shutdown(fnet_socket_t s, fnet_sd_flags_t how)
Terminates the connection in one or both directions.
fnet_bool_t fnet_socket_addr_are_equal(const struct fnet_sockaddr *addr1, const struct fnet_sockaddr *addr2)
Compares socket addresses.
This option is used to determine the amount of data pending in the socket-input buffer. This is a read-only option.
Definition: fnet_socket.h:510
This option defines hop limit used for outgoing unicast IPv6 packets. Its value can be from 0 till ...
Definition: fnet_socket.h:611
unsigned int fnet_flag_t
Unsigned integer type representing the bit flag.
Definition: fnet_stdlib.h:66
Set the hop limit to use for outgoing multicast IPv6 packets. If IPV6_MULTICAST_HOPS is not set...
Definition: fnet_socket.h:616
Stream socket. Provides reliable, two-way, connection-based byte stream. It corresponds to the TCP p...
Definition: fnet_socket.h:323
fnet_return_t fnet_socket_connect(fnet_socket_t s, struct fnet_sockaddr *name, fnet_size_t namelen)
Establishes a connection with the specified socket.
Drops membership to a IPv4 multicast group and interface. This option is available only if FNET_CFG_...
Definition: fnet_socket.h:607
If this option is set to 1, the Nagle algorithm is disabled (and vice versa). The Nagle algorithm i...
Definition: fnet_socket.h:553
Returns 1 if a socket is in listening mode and returns 0 when vice versa. This is the read-only optio...
Definition: fnet_socket.h:475
fnet_socket_options_t
Socket options for the fnet_socket_setopt() and the fnet_socket_getopt().
Definition: fnet_socket.h:473
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.
Definition: fnet_socket.h:565
fnet_scope_id_t sa_scope_id
Scope zone index, defining network interface.
Definition: fnet_socket.h:278
Process out-of-band data instead of regular data. This option is avalable only if FNET_CFG_TCP_URGE...
Definition: fnet_socket.h:654
fnet_ssize_t fnet_socket_recv(fnet_socket_t s, void *buf, fnet_size_t len, fnet_flag_t flags)
Receives the data from a connected socket.
This option enables bypassing of a routing algorithm. It means that the network interface tries to se...
Definition: fnet_socket.h:485
fnet_scope_id_t sin6_scope_id
Scope zone index, defining network interface.
Definition: fnet_socket.h:257
This option is used to determine the amount of data in the socket output buffer. This is a read-onl...
Definition: fnet_socket.h:513
This option enables keep-alive probes for a socket connection. These probes are used to maintain a TC...
Definition: fnet_socket.h:479
This option defines the maximum size of the input segments (MSS). The TCP Maximum Segment Size (MSS...
Definition: fnet_socket.h:518
This option is set when the final (FIN) segment arrives. This option indicates that another side wi...
Definition: fnet_socket.h:561
fnet_scope_id_t ipv6imr_interface
Interface index. It equals to the scope zone index, defining network interface. If this member is zer...
Definition: fnet_socket.h:312
IPv6 options level number for fnet_socket_getopt() and fnet_socket_setopt().
Definition: fnet_socket.h:365
fnet_uint16_t sa_port
16-bit port number used to demultiplex the transport-level messages (in network byte order)...
Definition: fnet_socket.h:275
(RFC3493) Join a multicast group on a specified local interface. It is valid only for the SOCK_DGRAM...
Definition: fnet_socket.h:618
fnet_bool_t l_onoff
Determines, whether the option will be turned on FNET_TRUE, or off FNET_FALSE.
Definition: fnet_socket.h:629
unsigned long fnet_size_t
Unsigned integer type representing the size in bytes.
Definition: fnet_stdlib.h:56
fnet_return_t fnet_socket_getopt(fnet_socket_t s, fnet_protocol_t level, fnet_socket_options_t optname, void *optval, fnet_size_t *optvallen)
Gets a socket option.
fnet_ssize_t fnet_socket_send(fnet_socket_t s, const void *buf, fnet_size_t len, fnet_flag_t flags)
Sends the data on a connected socket.
IPv4 options level number for fnet_socket_getopt() and fnet_socket_setopt().
Definition: fnet_socket.h:358
fnet_protocol_t
Protocol numbers and Level numbers for the fnet_socket_setopt() and the fnet_socket_getopt().
Definition: fnet_socket.h:356
This option allows to change IPv4 "time to live" (TTL) value for outgoing multicast datagrams...
Definition: fnet_socket.h:597
fnet_return_t fnet_socket_bind(fnet_socket_t s, const struct fnet_sockaddr *name, fnet_size_t namelen)
Assigns a local address to a socket.
This option defines the maximum per-socket buffer size for output data.
Definition: fnet_socket.h:497
#define FNET_SA_DATA_SIZE
Size of sa_data[] field of fnet_sockaddr structure. It used to cover fnet_sockaddr_in and fnet_socka...
Definition: fnet_socket.h:172
This option returns a per-socket-based error code. The error code is defined by the fnet_error_t typ...
Definition: fnet_socket.h:503
fnet_address_family_t sin_family
Specifies the address family. It must ne set to AF_INET.
Definition: fnet_socket.h:214
fnet_return_t fnet_socket_setopt(fnet_socket_t s, fnet_protocol_t level, fnet_socket_options_t optname, const void *optval, fnet_size_t optvallen)
Sets a socket option.
fnet_socket_t fnet_socket(fnet_address_family_t family, fnet_socket_type_t type, fnet_uint32_t protocol)
Creates a socket.
TCP protocol number; TCP options level number for fnet_socket_getopt() and fnet_socket_setopt().
Definition: fnet_socket.h:362
Datagram socket. Provides unreliable, connectionless datagrams. It corresponds to the UDP protocol...
Definition: fnet_socket.h:327
This option defines the type of the socket. This is a read-only option and it is defined by the fnet_...
Definition: fnet_socket.h:508
fnet_msg_flags_t
The flags parameters for receiving and sending functions fnet_socket_recv(), fnet_socket_recvfrom(), fnet_socket_send(), and fnet_socket_sendto().
Definition: fnet_socket.h:652
When the SO_KEEPALIVE option is enabled, TCP probes a connection that has been idle for some amount o...
Definition: fnet_socket.h:583
fnet_ssize_t fnet_socket_recvfrom(fnet_socket_t s, void *buf, fnet_size_t len, fnet_flag_t flags, struct fnet_sockaddr *from, fnet_size_t *fromlen)
Receives the data and captures the address, from which the data was sent.
This option defines the current state of the socket. This is the read-only option and it is defined ...
Definition: fnet_socket.h:501
fnet_bool_t fnet_socket_addr_is_unspecified(const struct fnet_sockaddr *addr)
Determines, if socket address is unspecified.
This option defines the maximum per-socket buffer size for input data.
Definition: fnet_socket.h:499
This option specifies that out-of-band (OOB) data will be received in line with regular data...
Definition: fnet_socket.h:492
fnet_bool_t fnet_socket_addr_is_multicast(const struct fnet_sockaddr *addr)
Determines, if socket address is multicast.
If this option is set to 1, the BSD interpretation of the urgent pointer is used. In this case the ur...
Definition: fnet_socket.h:541
This option controls the action taken when unsent data is present, and fnet_socket_close() is called...
Definition: fnet_socket.h:488
void fnet_socket_set_callback_on_rx(void(*callback)(void))
Registers the "Socket Rx" event handler callback.
This option defines the IPv4 TOS (type-of-service) field for outgoing datagrams.
Definition: fnet_socket.h:593
fnet_address_family_t sin6_family
Specifies the address family. It must ne set to AF_INET6.
Definition: fnet_socket.h:252
When the SO_KEEPALIVE option is enabled, TCP probes a connection that has been idle for some amount o...
Definition: fnet_socket.h:576
fnet_uint16_t l_linger
Specifies the amount of time (in seconds) to wait when the connection is closed and unsent data is di...
Definition: fnet_socket.h:632
Raw socket. Raw sockets allow an application to have direct access to lower-level communication prot...
Definition: fnet_socket.h:331
fnet_return_t fnet_socket_getpeername(fnet_socket_t s, struct fnet_sockaddr *name, fnet_size_t *namelen)
Retrieves the name of a peer connected to a socket.
fnet_socket_t fnet_socket_accept(fnet_socket_t s, struct fnet_sockaddr *addr, fnet_size_t *addrlen)
Accepts a connection on the specified socket.
(RFC3493) Leave a multicast group on a specified interface. It is valid only for the SOCK_DGRAM (UDP...
Definition: fnet_socket.h:620
fnet_return_t fnet_socket_listen(fnet_socket_t s, fnet_size_t backlog)
Places the socket into a state, where it is listening for an incoming connection. ...
fnet_scope_id_t sin_scope_id
Scope zone index, defining network interface.
Definition: fnet_socket.h:219
fnet_uint16_t sin_port
16-bit port number used to demultiplex the transport-level messages (in network byte order)...
Definition: fnet_socket.h:216
© 2005-2018 by Andrey Butok. http://fnet.sourceforge.net