Merge pull request #15366 from YannCharbon/icmp_sockets

Add support of NSAPI_ICMP sockets in Nanostack
pull/15369/head
Martin Kojtal 2023-01-05 16:40:52 +00:00 committed by GitHub
commit 06566fc569
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -122,7 +122,7 @@ protected:
* NSAPI_ERROR_NO_SOCKET is returned if no socket is available. * NSAPI_ERROR_NO_SOCKET is returned if no socket is available.
* *
* @param handle Destination for the handle to a newly created socket * @param handle Destination for the handle to a newly created socket
* @param proto Protocol of socket to open, NSAPI_TCP or NSAPI_UDP * @param proto Protocol of socket to open, NSAPI_TCP, NSAPI_UDP or NSAPI_ICMP
* @return 0 on success, negative error code on failure * @return 0 on success, negative error code on failure
*/ */
nsapi_error_t socket_open(void **handle, nsapi_protocol_t proto) override; nsapi_error_t socket_open(void **handle, nsapi_protocol_t proto) override;

View File

@ -678,6 +678,8 @@ nsapi_error_t Nanostack::socket_open(void **handle, nsapi_protocol_t protocol)
ns_proto = SOCKET_UDP; ns_proto = SOCKET_UDP;
} else if (NSAPI_TCP == protocol) { } else if (NSAPI_TCP == protocol) {
ns_proto = SOCKET_TCP; ns_proto = SOCKET_TCP;
} else if (NSAPI_ICMP == protocol) {
ns_proto = SOCKET_ICMP;
} else { } else {
MBED_ASSERT(false); MBED_ASSERT(false);
return NSAPI_ERROR_UNSUPPORTED; return NSAPI_ERROR_UNSUPPORTED;