The function sends ping request to the given IP Address.
Functions | |
sint8 | get_alpn_index (SOCKET sock) |
sint8 | get_error_detail (SOCKET sock, tstrSockErr *pstrErr) |
NMI_API sint8 | m2m_ping_req (uint32 u32DstIP, uint8 u8TTL, tpfPingCb fpPingCb) |
The function request to send ping request to the given IP Address. More... | |
sint8 | set_alpn_list (SOCKET sock, const char *pcProtocolList) |
This function gets the index of the protocol negotiated via ALPN. It should be called when a SSL socket connection succeeds, in order to determine which application-layer protocol must be used.
[in] | sock | Socket ID obtained by a call to socket. This is the SSL socket to which the ALPN applies. |
References SOCK_ERR_INVALID_ARG, SSL_FLAGS_ACTIVE, TCP_SOCK_MAX, and tstrSocket::u8AlpnStatus.
Referenced by socket_cb().
sint8 get_error_detail | ( | SOCKET | sock, |
tstrSockErr * | pstrErr | ||
) |
This function gets detail about a socket failure. The application can call this when notified of a socket failure via SOCKET_MSG_CONNECT or SOCKET_MSG_RECV. If used, it must be called before close.
[in] | sock | Socket ID obtained by a call to socket. |
[out] | pstrErr | Pointer to structure to be populated with the details of the socket failure. |
References tstrSockErr::enuErrSource, NULL, SOCK_ERR_INVALID_ARG, SOCK_ERR_NO_ERROR, TCP_SOCK_MAX, tstrSocket::u8ErrCode, tstrSockErr::u8ErrCode, and tstrSocket::u8ErrSource.
Referenced by socket_cb().
The function request to send ping request to the given IP Address.
[in] | u32DstIP | Target Destination IP Address for the ping request. It must be represented in Network byte order. The function nmi_inet_addr could be used to translate the dotted decimal notation IP to its Network bytes order integer representative. |
[in] | u8TTL | IP TTL value for the ping request. If set to ZERO, the default value SHALL be used. |
[in] | fpPingCb | Callback will be called to deliver the ping statistics. |
[in] | u32DstIP | Target Destination IP Address for the ping request. It must be represented in Network byte order. The function nmi_inet_addr could be used to translate the dotted decimal notation IP to its Network bytes order integer representative. |
[in] | u8TTL | IP TTL value for the ping request. If set to ZERO, the default value SHALL be used. |
[in] | fpPingCb | Callback will be called to deliver the ping statistics. |
References gfpPingCb, gu32PingId, M2M_ERR_INVALID_ARG, NULL, SOCKET_CMD_PING, SOCKET_REQUEST, tstrPingCmd::u16PingCount, tstrPingCmd::u32CmdPrivate, tstrPingCmd::u32DestIPAddr, and tstrPingCmd::u8TTL.
This function sets the protocol list used for application-layer protocol negotiation (ALPN). If used, it must be called after creating a SSL socket (using socket) and before connecting/binding (using connect or bind) or securing (using secure).
[in] | sock | Socket ID obtained by a call to socket. This is the SSL socket to which the ALPN list applies. |
[in] | pcProtocolList | Pointer to the list of protocols available in the application. The entries in the list must:
|
The example demonstrates an application using set_alpn_list and get_alpn_index to negotiate secure HTTP/2 (with fallback option of HTTP/1.1).
References ALPN_LIST_MAX_APP_LENGTH, ALPN_LIST_MAX_SIZE, m2m_memcpy(), m2m_strlen(), NULL, setsockopt(), SO_SSL_ALPN, SOCK_ERR_INVALID_ARG, SOL_SSL_SOCKET, and TCP_SOCK_MAX.
Referenced by iot_tls_connect(), and sslConnect().