[doc] moved doxygen parts from core/net/simple-udp.c to corresponding

header file
This commit is contained in:
Enrico Joerns 2013-10-16 02:38:28 +02:00
parent ee80be83d9
commit 548321e66d
2 changed files with 70 additions and 64 deletions

View File

@ -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 <adam@sics.se>
*
@ -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,

View File

@ -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);