@@ -289,6 +289,20 @@ typedef struct _sock_tl_ep sock_udp_ep_t; /**< An end point for a UDP sock obj
289289 */
290290typedef struct sock_udp sock_udp_t ;
291291
292+ #if SOCK_HAS_ASYNC
293+ /**
294+ * @brief Event callback for @ref sock_udp_t
295+ *
296+ * @pre `(sock != NULL)`
297+ *
298+ * @note Only applicable with @ref SOCK_HAS_ASYNC defined.
299+ *
300+ * @param[in] sock The sock the event happened on
301+ * @param[in] event The event
302+ */
303+ typedef void (* sock_udp_cb_t )(sock_udp_t * sock , sock_event_type_t type );
304+ #endif
305+
292306/**
293307 * @brief Creates a new UDP sock object
294308 *
@@ -343,6 +357,38 @@ int sock_udp_create(sock_udp_t *sock, const sock_udp_ep_t *local,
343357 */
344358void sock_udp_close (sock_udp_t * sock );
345359
360+ #if SOCK_HAS_ASYNC || defined(DOXYGEN )
361+ /**
362+ * @brief Gets the asynchronous event context from sock object
363+ *
364+ * @pre `(sock != NULL)`
365+ *
366+ * @note Only available with @ref SOCK_HAS_ASYNC defined.
367+ *
368+ * @param[in] sock A UDP sock object.
369+ * @param[in] cb An event callback. May be NULL to unset event callback.
370+ */
371+ void sock_udp_set_cb (sock_udp_t * sock , sock_udp_cb_t cb );
372+
373+ #if SOCK_HAS_ASYNC_CTX || defined(DOXYGEN )
374+ /**
375+ * @brief Gets the asynchronous
376+ *
377+ * @pre `(sock != NULL)`
378+ *
379+ * @note Only available with @ref SOCK_HAS_ASYNC and @ref SOCK_HAS_ASYNC_CTX
380+ * defined.
381+ *
382+ * @see @ref SOCK_HAS_ASYNC_CTX
383+ *
384+ * @param[in] sock A UDP sock object.
385+ *
386+ * @return The asynchronous event context
387+ */
388+ sock_async_ctx_t * sock_udp_get_async_ctx (sock_udp_t * sock );
389+ #endif /* SOCK_HAS_ASYNC_CTX */
390+ #endif /* SOCK_HAS_ASYNC */
391+
346392/**
347393 * @brief Gets the local end point of a UDP sock object
348394 *
0 commit comments