Data Structures | Functions

Network interface

Data Structures

struct  sa_network_interface

Functions

SA_EXPORT int sa_open_network (void)
SA_EXPORT int sa_close_network (void)
SA_EXPORT int sa_count_network_interfaces (uint16_t *number)
SA_EXPORT int sa_get_network_interface (char *name, struct sa_network_interface *dst)
SA_EXPORT int sa_get_network_interfaces (struct sa_network_interface *dst, uint16_t dst_size, uint16_t *written)

Function Documentation

SA_EXPORT int sa_open_network ( void   ) 

Prepares the resources needed for retrieving network statistics. This function exists (and is needed) only when SA_OPEN_NETWORK is defined.

Returns:
If successful 0 is returned, otherwise an error code is returned. If the operative system is not supported the return value will be ENOTSUP.
See also:
sa_close_network()
SA_EXPORT int sa_close_network ( void   ) 

This function closes the resources used for retrieving network statistics. You should call it even when there was a previous error in another function of this API. This function exists (and is needed) only when SA_CLOSE_NETWORK is defined.

Returns:
If successful 0 is returned, otherwise an error code is returned.
See also:
sa_open_network()
SA_EXPORT int sa_count_network_interfaces ( uint16_t *  number  ) 

Gives the total number of network interfaces.

Parameters:
number The number will be stored here
Returns:
If successful 0 is returned, otherwise an error code is returned.
SA_EXPORT int sa_get_network_interface ( char *  name,
struct sa_network_interface dst 
)

Retrieves statistics from a network interface identified by its name.

Parameters:
name The name of the network interface.
dst Where the statistics will be stored.
Returns:
If successful 0 is returned, otherwise an error code is returned. ENODEV is returned when the requested device was not found.
SA_EXPORT int sa_get_network_interfaces ( struct sa_network_interface dst,
uint16_t  dst_size,
uint16_t *  written 
)

Retrieves statistics about all the network interfaces' activity.

Parameters:
dst A buffer where the statistics will be stored.
dst_size The number of interfaces that fits in the dst buffer. If it's not big enough dst will be filled but ENOMEM will be returned.
written The amount of interface statistics written.
Returns:
If successful 0 is returned, otherwise an error code is returned.
 All Data Structures Variables