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   100
 
#define IP_ADD_MEMBERSHIP   0x01
 
#define IP_DROP_MEMBERSHIP   0x02
 
#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_TCP_KEEPALIVE   0x04
 
#define SO_TCP_KEEPCNT   0x07
 
#define SO_TCP_KEEPIDLE   0x05
 
#define SO_TCP_KEEPINTVL   0x06
 
#define SOCK_DGRAM   2
 
#define SOCK_RAW   3
 
#define SOCK_STREAM   1
 
#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_OFF   0
 
#define SOCKET_CONFIG_SSL_ON   1
 
#define SOCKET_FLAGS_IPPROTO_RAW   0x02
 
#define SOCKET_FLAGS_SSL   0x01
 
#define SOL_RAW   255
 
#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 m2m_ip_cb(), socket(), and wifi_ap_provision().

#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 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. Used with the setsockopt function.

#define MAX_SOCKET   (TCP_SOCK_MAX + UDP_SOCK_MAX + RAW_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 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_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 socket().

#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 socket(), 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_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 (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 (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 (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 (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.

#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

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(), send(), set_alpn_list(), socket(), and sslSetSockOpt().

#define UDP_SOCK_MAX   4

Maximum number of simultaneous UDP sockets.

Referenced by socket().