[lib] create*socket(): return standard error code
This commit is contained in:
parent
c52321a52b
commit
31bea165c5
|
@ -137,7 +137,7 @@ uint_fast8_t owl_frequency_to_channel(const uint_fast16_t channel)
|
||||||
* 'time_ms' is an unsigned value, so please be careful: passing a
|
* 'time_ms' is an unsigned value, so please be careful: passing a
|
||||||
* negative value may not do what you think.
|
* negative value may not do what you think.
|
||||||
* In case of error, a message is displayed and a non-zero error code
|
* In case of error, a message is displayed and a non-zero error code
|
||||||
* is returned.
|
* is returned (if positive, it is the number of non-sleeped seconds).
|
||||||
*/
|
*/
|
||||||
int owl_msleep(uint32_t time_ms)
|
int owl_msleep(uint32_t time_ms)
|
||||||
{
|
{
|
||||||
|
@ -331,6 +331,7 @@ float owl_swap_float(const float f)
|
||||||
* description will be saved.
|
* description will be saved.
|
||||||
* - client_description (in/out): the structure in which the client
|
* - client_description (in/out): the structure in which the client
|
||||||
* description will be saved.
|
* description will be saved.
|
||||||
|
* Returns a negative error code in case of error.
|
||||||
*/
|
*/
|
||||||
int owl_create_udp_trx_socket(const char *const server_address,
|
int owl_create_udp_trx_socket(const char *const server_address,
|
||||||
const uint_fast16_t server_port,
|
const uint_fast16_t server_port,
|
||||||
|
@ -344,7 +345,7 @@ int owl_create_udp_trx_socket(const char *const server_address,
|
||||||
if (sockfd < 0)
|
if (sockfd < 0)
|
||||||
{
|
{
|
||||||
perror("UDP socket creation failed") ;
|
perror("UDP socket creation failed") ;
|
||||||
return sockfd ;
|
return -OWL_ERR_SOCKET_CREATE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialise the client structure */
|
/* Initialise the client structure */
|
||||||
|
@ -368,6 +369,7 @@ int owl_create_udp_trx_socket(const char *const server_address,
|
||||||
* Creates a UDP reception socket and returns its descriptor.
|
* Creates a UDP reception socket and returns its descriptor.
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* - port: port on which the socket listens.
|
* - port: port on which the socket listens.
|
||||||
|
* Returns a negative error code in case of error.
|
||||||
*/
|
*/
|
||||||
int owl_create_udp_listening_socket(const uint_fast16_t port)
|
int owl_create_udp_listening_socket(const uint_fast16_t port)
|
||||||
{
|
{
|
||||||
|
@ -380,7 +382,7 @@ int owl_create_udp_listening_socket(const uint_fast16_t port)
|
||||||
if (sockfd < 0)
|
if (sockfd < 0)
|
||||||
{
|
{
|
||||||
perror("UDP socket creation failed") ;
|
perror("UDP socket creation failed") ;
|
||||||
return sockfd ;
|
return -OWL_ERR_SOCKET_CREATE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialise the server structure */
|
/* Initialise the server structure */
|
||||||
|
@ -397,7 +399,7 @@ int owl_create_udp_listening_socket(const uint_fast16_t port)
|
||||||
{
|
{
|
||||||
perror("Cannot bind the UDP socket") ;
|
perror("Cannot bind the UDP socket") ;
|
||||||
close(sockfd) ;
|
close(sockfd) ;
|
||||||
return ret ;
|
return -OWL_ERR_SOCKET_CREATE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sockfd ;
|
return sockfd ;
|
||||||
|
|
Loading…
Reference in New Issue