Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
TCP/IP Defines

The following list of macros are used to define constants used throughout the socket layer.

Macros

#define AF_INET   2
 
#define HOSTNAME_MAX_SIZE   64
 
#define IP_ADD_MEMBERSHIP   0x01
 
#define IP_DROP_MEMBERSHIP   0x02
 
#define MAX_SOCKET   (TCP_SOCK_MAX + UDP_SOCK_MAX)
 
#define SO_SET_UDP_SEND_CALLBACK   0x00
 
#define SO_TCP_KEEPALIVE   0x04
 
#define SO_TCP_KEEPCNT   0x07
 
#define SO_TCP_KEEPIDLE   0x05
 
#define SO_TCP_KEEPINTVL   0x06
 
#define SOCK_DGRAM   2
 
#define SOCK_STREAM   1
 
#define SOCKET_BUFFER_MAX_LENGTH   1400
 
#define SOCKET_CONFIG_SSL_DELAY   2
 
#define SOCKET_CONFIG_SSL_OFF   0
 
#define SOCKET_CONFIG_SSL_ON   1
 
#define SOCKET_FLAGS_SSL   0x01
 
#define SOL_SOCKET   1
 
#define SOL_SSL_SOCKET   2
 
#define TCP_SOCK_MAX   (7)
 
#define UDP_SOCK_MAX   4
 

#define AF_INET   2

The AF_INET is the address family used for IPv4. An IPv4 transport address is specified with the sockaddr_in structure. (It is the only supported type for the current implementation.)

Referenced by AppServerCb(), connect_cmd_handler(), ConnectNetwork(), http_client_send_request(), http_client_socket_resolve_handler(), m2m_ip_cb(), main(), NMI_GrowlSendNotification(), smtpConnect(), socket(), sslConnect(), and wifi_ap_provision().

#define HOSTNAME_MAX_SIZE   64

Maximum allowed size for a host domain name passed to the function gethostbyname gethostbyname. command value. Used with the setsockopt function.

Referenced by gethostbyname(), and sslSetSockOpt().

#define IP_ADD_MEMBERSHIP   0x01

Set Socket Option Add Membership command value (to join a multicast group). Used with the setsockopt function.

#define IP_DROP_MEMBERSHIP   0x02

Set Socket Option Drop Membership command value (to leave a multicast group). Used with the setsockopt function.

#define MAX_SOCKET   (TCP_SOCK_MAX + UDP_SOCK_MAX)

Maximum number of simultaneous sockets.

Referenced by accept(), bind(), close(), connect(), listen(), m2m_ip_cb(), recv(), recvfrom(), secure(), send(), sendto(), setsockopt(), socketDeinit(), and socketInit().

#define SO_SET_UDP_SEND_CALLBACK   0x00

Socket option used by the application to enable/disable the use of UDP send callbacks.
Used with the setsockopt function.
The option value should be cast to int type.
0: disable UDP send callbacks.
1: enable UDP send callbacks.
Default setting is enable.

Warning
connect and bind cause this setting to be lost, so the application should only set this option after calling connect or bind.
#define SO_TCP_KEEPALIVE   0x04

Socket option to enable or disable TCP keep-alive.
Used with the setsockopt function.
The option value should be cast to int type.
0: disable TCP keep-alive.
1: enable TCP keep-alive.
Default setting is disable.

Warning
connect and bind cause this setting to be lost, so the application should only set this option after calling connect or bind.
#define SO_TCP_KEEPCNT   0x07

Socket option to set the number of keep-alive retransmissions to be carried out before declaring that the remote end is not available.
Used with the setsockopt function.
The option value should be cast to int type.
Maximum 255. Default setting is 20.

Warning
connect and bind cause this setting to be lost, so the application should only set this option after calling connect or bind.
#define SO_TCP_KEEPIDLE   0x05

Socket option to set the time period after which the socket will trigger keep-alive transmissions.
Used with the setsockopt function.
The option value should be cast to int type.
Option value is the time period in units of 500ms. Maximum 2^32 - 1. Default setting is 120 (60 seconds).

Warning
connect and bind cause this setting to be lost, so the application should only set this option after calling connect or bind.
#define SO_TCP_KEEPINTVL   0x06

Socket option to set the time period between keep-alive retransmissions.
Used with the setsockopt function.
The option value should be cast to int type.
Option value is the time period in units of 500ms. Maximum 255. Default setting is 1 (0.5 seconds).

Warning
connect and bind cause this setting to be lost, so the application should only set this option after calling connect or bind.
#define SOCK_DGRAM   2

One of the IPv4 supported socket types for unreliable connectionless datagram connection. Passed to the socket function for the socket creation operation.

Referenced by main(), and socket().

#define SOCK_STREAM   1

One of the IPv4 supported socket types for reliable connection-oriented stream connection. Passed to the socket function for the socket creation operation.

Referenced by connect_cmd_handler(), ConnectNetwork(), http_client_send_request(), main(), NMI_GrowlSendNotification(), smtpConnect(), socket(), sslConnect(), and wifi_ap_provision().

#define SOCKET_BUFFER_MAX_LENGTH   1400

Maximum allowed size for a socket data buffer. Used with send socket function to ensure that the buffer sent is within the allowed range.

Referenced by html_handler(), send(), and sendto().

#define SOCKET_CONFIG_SSL_DELAY   2

This value may be passed in the u8Config parameter of socket, to create a TCP socket which has the potential to upgrade to a TLS socket later (by calling secure).
Note that the total number of TLS sockets and potential TLS sockets is limited to 4.

Referenced by socket().

#define SOCKET_CONFIG_SSL_OFF   0

This value may be passed in the u8Config parameter of socket, to create a socket not capable of TLS.

Referenced by socket().

#define SOCKET_CONFIG_SSL_ON   1

This value may be passed in the u8Config parameter of socket, to create a TLS socket.
Note that the number of TLS sockets is limited to 4.

#define SOCKET_FLAGS_SSL   0x01

This flag may be set in the u8Config parameter of socket, to create a TLS socket.
Note that the number of TLS sockets is limited to 4.
This flag is kept for legacy purposes. It is recommended that applications use SOCKET_CONFIG_SSL_ON instead.

Referenced by http_client_send_request(), NMI_GrowlSendNotification(), smtpConnect(), sslConnect(), and wifi_ap_provision().

#define SOL_SOCKET   1

Socket option. Used with the setsockopt function

Referenced by setsockopt().

#define SOL_SSL_SOCKET   2

SSL Socket option level. Used with the setsockopt function

Referenced by set_alpn_list(), and setsockopt().

#define TCP_SOCK_MAX   (7)

Maximum number of simultaneous TCP sockets.

Referenced by get_alpn_index(), get_error_detail(), http_client_socket_resolve_handler(), send(), set_alpn_list(), socket(), and sslSetSockOpt().

#define UDP_SOCK_MAX   4

Maximum number of simultaneous UDP sockets.

Referenced by socket().