From 548321e66d049e78d1a03f5f57cd12b7b4a3ef95 Mon Sep 17 00:00:00 2001 From: Enrico Joerns Date: Wed, 16 Oct 2013 02:38:28 +0200 Subject: [PATCH] [doc] moved doxygen parts from core/net/simple-udp.c to corresponding header file --- core/net/ip/simple-udp.c | 67 +++------------------------------------- core/net/ip/simple-udp.h | 67 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 70 insertions(+), 64 deletions(-) diff --git a/core/net/ip/simple-udp.c b/core/net/ip/simple-udp.c index 7c847bf5c..d375b96f1 100644 --- a/core/net/ip/simple-udp.c +++ b/core/net/ip/simple-udp.c @@ -33,9 +33,11 @@ * SUCH DAMAGE. * * This file is part of the Contiki operating system. - * + */ + +/** * \file - * Header file for the simple-udp module. + * Code for the simple-udp module. * \author * Adam Dunkels * @@ -63,19 +65,6 @@ init_simple_udp(void) } } /*---------------------------------------------------------------------------*/ -/** - * \brief Send a UDP packet - * \param c A pointer to a struct simple_udp_connection - * \param data A pointer to the data to be sent - * \param datalen The length of the data - * - * This function sends a UDP packet. The packet will be - * sent to the IP address and with the UDP ports that were - * specified when the connection wa registered with - * simple_udp_register(). - * - * \sa simple_udp_sendto() - */ int simple_udp_send(struct simple_udp_connection *c, const void *data, uint16_t datalen) @@ -87,20 +76,6 @@ simple_udp_send(struct simple_udp_connection *c, return 0; } /*---------------------------------------------------------------------------*/ -/** - * \brief Send a UDP packet to a specified IP address - * \param c A pointer to a struct simple_udp_connection - * \param data A pointer to the data to be sent - * \param datalen The length of the data - * \param to The IP address of the receiver - * - * This function sends a UDP packet to a specified IP - * address. The packet will be sent with the UDP ports - * that were specified when the connection wa registered - * with simple_udp_register(). - * - * \sa simple_udp_send() - */ int simple_udp_sendto(struct simple_udp_connection *c, const void *data, uint16_t datalen, @@ -113,21 +88,6 @@ simple_udp_sendto(struct simple_udp_connection *c, return 0; } /*---------------------------------------------------------------------------*/ -/** - * \brief Send a UDP packet to a specified IP address and UDP port - * \param c A pointer to a struct simple_udp_connection - * \param data A pointer to the data to be sent - * \param datalen The length of the data - * \param to The IP address of the receiver - * \param port The UDP port of the receiver, in host byte order - * - * This function sends a UDP packet to a specified IP - * address and UDP port. The packet will be sent with the - * UDP ports that were specified when the connection wa - * registered with simple_udp_register(). - * - * \sa simple_udp_sendto() - */ int simple_udp_sendto_port(struct simple_udp_connection *c, const void *data, uint16_t datalen, @@ -141,25 +101,6 @@ simple_udp_sendto_port(struct simple_udp_connection *c, return 0; } /*---------------------------------------------------------------------------*/ -/** - * \brief Register a UDP connection - * \param c A pointer to a struct simple_udp_connection - * \param local_port The local UDP port in host byte order - * \param remote_addr The remote IP address - * \param remote_port The remote UDP port in host byte order - * \param receive_callback A pointer to a function to be called for incoming packets - * \retval 0 If no UDP connection could be allocated - * \retval 1 If the connection was successfully allocated - * - * This function registers a UDP connection and attaches a - * callback function to it. The callback function will be - * called for incoming packets. The local UDP port can be - * set to 0 to indicate that an ephemeral UDP port should - * be allocated. The remote IP address can be NULL, to - * indicate that packets from any IP address should be - * accepted. - * - */ int simple_udp_register(struct simple_udp_connection *c, uint16_t local_port, diff --git a/core/net/ip/simple-udp.h b/core/net/ip/simple-udp.h index e5a9439d7..89ef91ef5 100644 --- a/core/net/ip/simple-udp.h +++ b/core/net/ip/simple-udp.h @@ -42,7 +42,9 @@ * SUCH DAMAGE. * * This file is part of the Contiki operating system. - * + */ + +/** * \file * Header file for the simple-udp module. * \author @@ -57,6 +59,7 @@ struct simple_udp_connection; +/** Simple UDP Callback function type. */ typedef void (* simple_udp_callback)(struct simple_udp_connection *c, const uip_ipaddr_t *source_addr, uint16_t source_port, @@ -64,6 +67,7 @@ typedef void (* simple_udp_callback)(struct simple_udp_connection *c, uint16_t dest_port, const uint8_t *data, uint16_t datalen); +/** Simple UDP connection */ struct simple_udp_connection { struct simple_udp_connection *next; uip_ipaddr_t remote_addr; @@ -73,19 +77,80 @@ struct simple_udp_connection { struct process *client_process; }; +/** + * \brief Register a UDP connection + * \param c A pointer to a struct simple_udp_connection + * \param local_port The local UDP port in host byte order + * \param remote_addr The remote IP address + * \param remote_port The remote UDP port in host byte order + * \param receive_callback A pointer to a function of to be called for incoming packets + * \retval 0 If no UDP connection could be allocated + * \retval 1 If the connection was successfully allocated + * + * This function registers a UDP connection and attaches a + * callback function to it. The callback function will be + * called for incoming packets. The local UDP port can be + * set to 0 to indicate that an ephemeral UDP port should + * be allocated. The remote IP address can be NULL, to + * indicate that packets from any IP address should be + * accepted. + * + */ int simple_udp_register(struct simple_udp_connection *c, uint16_t local_port, uip_ipaddr_t *remote_addr, uint16_t remote_port, simple_udp_callback receive_callback); +/** + * \brief Send a UDP packet + * \param c A pointer to a struct simple_udp_connection + * \param data A pointer to the data to be sent + * \param datalen The length of the data + * + * This function sends a UDP packet. The packet will be + * sent to the IP address and with the UDP ports that were + * specified when the connection was registered with + * simple_udp_register(). + * + * \sa simple_udp_sendto() + */ int simple_udp_send(struct simple_udp_connection *c, const void *data, uint16_t datalen); +/** + * \brief Send a UDP packet to a specified IP address + * \param c A pointer to a struct simple_udp_connection + * \param data A pointer to the data to be sent + * \param datalen The length of the data + * \param to The IP address of the receiver + * + * This function sends a UDP packet to a specified IP + * address. The packet will be sent with the UDP ports + * that were specified when the connection was registered + * with simple_udp_register(). + * + * \sa simple_udp_send() + */ int simple_udp_sendto(struct simple_udp_connection *c, const void *data, uint16_t datalen, const uip_ipaddr_t *to); +/** + * \brief Send a UDP packet to a specified IP address and UDP port + * \param c A pointer to a struct simple_udp_connection + * \param data A pointer to the data to be sent + * \param datalen The length of the data + * \param to The IP address of the receiver + * \param port The UDP port of the receiver, in host byte order + * + * This function sends a UDP packet to a specified IP + * address and UDP port. The packet will be sent with the + * UDP ports that were specified when the connection was + * registered with simple_udp_register(). + * + * \sa simple_udp_sendto() + */ int simple_udp_sendto_port(struct simple_udp_connection *c, const void *data, uint16_t datalen, const uip_ipaddr_t *to, uint16_t to_port);