@@ -163,6 +163,9 @@ class LWIP : public OnboardNetworkStack, private mbed::NonCopyable<LWIP> {
163163 static void netif_status_irq (struct netif *netif);
164164 static Interface *our_if_from_netif (struct netif *netif);
165165 static void delete_interface (OnboardNetworkStack::Interface **interface_out);
166+ NetworkInterface *network_if_from_netif_id (int id);
167+ int netif_id_from_network_if (NetworkInterface *userInterface);
168+
166169
167170#if LWIP_ETHERNET
168171 static err_t emac_low_level_output (struct netif *netif, struct pbuf *p);
@@ -222,6 +225,8 @@ class LWIP : public OnboardNetworkStack, private mbed::NonCopyable<LWIP> {
222225 void *hw; /* *< alternative implementation pointer - used for PPP */
223226 };
224227
228+ NetworkInterface *user_network_interface;
229+
225230 mbed_rtos_storage_semaphore_t remove_interface_sem;
226231 osSemaphoreId_t remove_interface;
227232 mbed_rtos_storage_semaphore_t linked_sem;
@@ -265,7 +270,7 @@ class LWIP : public OnboardNetworkStack, private mbed::NonCopyable<LWIP> {
265270 * @param[out] interface_out pointer to stack interface object controlling the EMAC
266271 * @return NSAPI_ERROR_OK on success, or error code
267272 */
268- nsapi_error_t add_ethernet_interface (EMAC &emac, bool default_if, OnboardNetworkStack::Interface **interface_out) override ;
273+ nsapi_error_t add_ethernet_interface (EMAC &emac, bool default_if, OnboardNetworkStack::Interface **interface_out, NetworkInterface *user_network_interface = NULL ) override ;
269274
270275 /* * Register a network interface with the IP stack
271276 *
@@ -450,6 +455,27 @@ class LWIP : public OnboardNetworkStack, private mbed::NonCopyable<LWIP> {
450455 nsapi_size_or_error_t socket_send (nsapi_socket_t handle,
451456 const void *data, nsapi_size_t size) override ;
452457
458+ /* * Send a packet with ancillary data over a UDP socket
459+ *
460+ * Sends data to the specified address. Returns the number of bytes
461+ * sent from the buffer.
462+ *
463+ * This call is non-blocking. If sendto would block,
464+ * NSAPI_ERROR_WOULD_BLOCK is returned immediately.
465+ *
466+ * @param handle Socket handle
467+ * @param address The SocketAddress of the remote host
468+ * @param data Buffer of data to send to the host
469+ * @param size Size of the buffer in bytes
470+ * @param control Ancillary data storage
471+ * @param control_size Size of the Ancillary data in bytes
472+ * @return Number of sent bytes on success, negative error
473+ * code on failure
474+ */
475+ nsapi_size_or_error_t socket_sendmsg (nsapi_socket_t handle, const SocketAddress &address,
476+ const void *data, nsapi_size_t size,
477+ nsapi_msghdr_t *control, nsapi_size_t control_size) override ;
478+
453479 /* * Receive data over a TCP socket
454480 *
455481 * The socket must be connected to a remote host. Returns the number of
@@ -493,6 +519,7 @@ class LWIP : public OnboardNetworkStack, private mbed::NonCopyable<LWIP> {
493519 * This call is non-blocking. If recvfrom would block,
494520 * NSAPI_ERROR_WOULD_BLOCK is returned immediately.
495521 *
522+ * It uses socket_recvmsg with zero ancillary data.
496523 * @param handle Socket handle
497524 * @param address Destination for the source address or NULL
498525 * @param buffer Destination buffer for data received from the host
@@ -503,6 +530,27 @@ class LWIP : public OnboardNetworkStack, private mbed::NonCopyable<LWIP> {
503530 nsapi_size_or_error_t socket_recvfrom (nsapi_socket_t handle, SocketAddress *address,
504531 void *buffer, nsapi_size_t size) override ;
505532
533+ /* * Receive a packet with ancillary data over a UDP socket
534+ *
535+ * Receives data and stores the source address in address if address
536+ * is not NULL. Returns the number of bytes received into the buffer.
537+ *
538+ * This call is non-blocking. If recvfrom would block,
539+ * NSAPI_ERROR_WOULD_BLOCK is returned immediately.
540+ *
541+ * @param handle Socket handle
542+ * @param address Destination for the source address or NULL
543+ * @param buffer Destination buffer for data received from the host
544+ * @param size Size of the buffer in bytes
545+ * @param control Ancillary data storage
546+ * @param control_size Size of the Ancillary data in bytes
547+ * @return Number of received bytes on success, negative error
548+ * code on failure
549+ */
550+ nsapi_size_or_error_t socket_recvmsg (nsapi_socket_t handle, SocketAddress *address,
551+ void *data, nsapi_size_t size,
552+ nsapi_msghdr_t *control, nsapi_size_t control_size) override ;
553+
506554 /* * Register a callback on state change of the socket
507555 *
508556 * The specified callback will be called on state changes such as when
0 commit comments