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 AF_INET   2
 
#define HOSTNAME_MAX_SIZE   100
 
#define HOSTNAME_MAX_SIZE   64
 
#define IP_ADD_MEMBERSHIP   0x01
 
#define IP_ADD_MEMBERSHIP   0x01
 
#define IP_DROP_MEMBERSHIP   0x02
 
#define IP_DROP_MEMBERSHIP   0x02
 
#define MAX_SOCKET   (TCP_SOCK_MAX + UDP_SOCK_MAX)
 
#define MAX_SOCKET   (TCP_SOCK_MAX + UDP_SOCK_MAX + RAW_SOCK_MAX)
 
#define RAW_SOCK_ID   (TCP_SOCK_MAX + UDP_SOCK_MAX)
 
#define RAW_SOCK_MAX   1
 
#define SO_ICMP_FILTER   0x01
 
#define SO_SET_UDP_SEND_CALLBACK   0x00
 
#define SO_SET_UDP_SEND_CALLBACK   0x00
 
#define SO_TCP_KEEPALIVE   0x04
 
#define SO_TCP_KEEPALIVE   0x04
 
#define SO_TCP_KEEPCNT   0x07
 
#define SO_TCP_KEEPCNT   0x07
 
#define SO_TCP_KEEPIDLE   0x05
 
#define SO_TCP_KEEPIDLE   0x05
 
#define SO_TCP_KEEPINTVL   0x06
 
#define SO_TCP_KEEPINTVL   0x06
 
#define SOCK_DGRAM   2
 
#define SOCK_DGRAM   2
 
#define SOCK_RAW   3
 
#define SOCK_STREAM   1
 
#define SOCK_STREAM   1
 
#define SOCKET_BUFFER_MAX_LENGTH   1400
 
#define SOCKET_BUFFER_MAX_LENGTH   1400
 
#define SOCKET_CONFIG_DEFAULT   0
 
#define SOCKET_CONFIG_IPPROTO_RAW   2
 
#define SOCKET_CONFIG_SSL_DELAY   2
 
#define SOCKET_CONFIG_SSL_DELAY   2
 
#define SOCKET_CONFIG_SSL_OFF   0
 
#define SOCKET_CONFIG_SSL_OFF   0
 
#define SOCKET_CONFIG_SSL_ON   1
 
#define SOCKET_CONFIG_SSL_ON   1
 
#define SOCKET_FLAGS_IPPROTO_RAW   0x02
 
#define SOCKET_FLAGS_SSL   0x01
 
#define SOCKET_FLAGS_SSL   0x01
 
#define SOL_RAW   255
 
#define SOL_SOCKET   1
 
#define SOL_SOCKET   1
 
#define SOL_SSL_SOCKET   2
 
#define SOL_SSL_SOCKET   2
 
#define TCP_SOCK_MAX   (7)
 
#define TCP_SOCK_MAX   (7)
 
#define UDP_SOCK_MAX   4
 
#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.)

#define HOSTNAME_MAX_SIZE   100

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

Referenced by gethostbyname(), and sslSetSockOpt().

#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.

#define IP_ADD_MEMBERSHIP   0x01

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

#define IP_ADD_MEMBERSHIP   0x01

Set Socket Option Add Membership command value. 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 IP_DROP_MEMBERSHIP   0x02

Set Socket Option Drop Membership command value. Used with the setsockopt function.

#define MAX_SOCKET   (TCP_SOCK_MAX + UDP_SOCK_MAX)

Maximum number of simultaneous sockets.

#define RAW_SOCK_ID   (TCP_SOCK_MAX + UDP_SOCK_MAX)

Socket number to be used for RAW socket.

Referenced by rawSetSockOpt(), sendto(), and socket().

#define RAW_SOCK_MAX   1

Maximum number of simultaneous RAW sockets.

#define SO_ICMP_FILTER   0x01

Socket option to set the ICMP filter for raw sockets when receiving.
Current implementation allows for a filter none (0) or filter all (anything else). Filter none means that all ICMP frames will be delivered to the host via raw socket. Filter all means that all ICMP frames will NOT be delivered to host and handled internally by the WINC (please note that fragmentation is not supported by the WINC). Used with the setsockopt function.
The option value should be cast to int type.
Default setting is 0 (filter none).

Warning
bind and close will cause this setting to be lost, so the application should only set this option after bind.
#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_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.

Referenced by demo_start().

#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_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_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_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 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 demo_start(), IperfUDP_ClientStart(), IperfUDP_ServerStart(), main(), run_udp_client(), run_udp_server(), setup_android_sockets(), and socket().

#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.

#define SOCK_RAW   3

Socket type used for sending and receiving raw frames. Raw socket expects and returns IP header. Please note that SO_BROADCAST socket option is not currently supported when using RAW socket. Similarly to SOCK_DGRAM it is oriented towards unreliable connectionless communication. Passed to the socket function for the socket creation operation.

Referenced by 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(), connect_to_server(), ConnectNetwork(), handle_start_connect(), http_client_send_request(), iot_tls_connect(), IperfTCP_ClientStart(), IperfTCP_ServerStart(), main(), NMI_GrowlSendNotification(), smtpConnect(), socket(), sslConnect(), and wifi_ap_provision().

#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.

#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_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.

#define SOCKET_CONFIG_DEFAULT   0

This value may be passed in the u8Config parameter of socket to create a socket with default configuration.

#define SOCKET_CONFIG_IPPROTO_RAW   2

This value may be passed in the u8Config parameter of socket (when the u8Type parameter is SOCK_RAW), to allow the Application to use a socket of type raw to send/receive frames. This assumes that the application will fill the IP and protocol (UDP, TCP, ICMP) headers. Typically, when sending ICMP frames via RAW socket, there are two options that can be used:

  • IPPROTO_RAW - Raw IP packets, implies that IP_HDRINCL is enabled and therefore the host application should fill in the corresponding protocol header checksum.
  • IPPROTO_ICMP - ICMP packets, the WINC would fill in the ICMP header checksum (not supported).
    Warning
    Please note that only SOCKET_CONFIG_IPPROTO_RAW is currently supported. Raw sockets can be used to send TCP/UDP/ICMP packets, however, the current implementation only supports receiving Raw ICMP frames, which also requires SO_ICMP_FILTER to be set appropriately.

Referenced by socket().

#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.

#define SOCKET_CONFIG_SSL_DELAY   2

This value may be passed in the u8Config parameter of socket (when the u8Type parameter is SOCK_STREAM), 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 2.

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.

#define SOCKET_CONFIG_SSL_OFF   0

This value may be passed in the u8Config parameter of socket (when the u8Type parameter is SOCK_STREAM), 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_CONFIG_SSL_ON   1

This value may be passed in the u8Config parameter of socket (when the u8Type parameter is SOCK_STREAM), to create a TLS socket.
Note that the number of TLS sockets is limited to 2.

#define SOCKET_FLAGS_IPPROTO_RAW   0x02

This flag may be set in the u8Config parameter of socket (when the u8Type parameter is SOCK_RAW), to allow the Application to use a socket of type raw to send/receive frames.
This flag is kept for legacy purposes. It is recommended that applications use SOCKET_CONFIG_IPPROTO_RAW instead.

#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.

#define SOCKET_FLAGS_SSL   0x01

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

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

#define SOL_RAW   255

Raw Socket option level. Used with the setsockopt function

Referenced by setsockopt().

#define SOL_SOCKET   1

Socket option. Used with the setsockopt function

#define SOL_SOCKET   1

Socket option. Used with the setsockopt function

Referenced by demo_start(), and setsockopt().

#define SOL_SSL_SOCKET   2

SSL Socket option level. Used with the setsockopt function

#define SOL_SSL_SOCKET   2

SSL Socket option level. Used with the setsockopt function

Referenced by set_alpn_list(), setsockopt(), and sslConnect().

#define TCP_SOCK_MAX   (7)

Maximum number of simultaneous TCP sockets.

#define TCP_SOCK_MAX   (7)
#define UDP_SOCK_MAX   4

Maximum number of simultaneous UDP sockets.

#define UDP_SOCK_MAX   4

Maximum number of simultaneous UDP sockets.

Referenced by socket().