libsysactivity
0.6.4
|
Data Structures | |
struct | sa_net_interface |
Functions | |
int | sa_open_net (void) SA_EXPORT |
int | sa_close_net (void) SA_EXPORT |
int | sa_count_net_interfaces (uint16_t *number) SA_EXPORT SA_NONNULL |
int | sa_reset_net_interfaces () SA_EXPORT |
int | sa_get_net_interfaces_ids (char *dst, uint16_t dst_size, uint16_t *written) SA_EXPORT SA_NONNULL |
int | sa_get_net_interface (char *name, struct sa_net_interface *dst) SA_EXPORT SA_NONNULL |
int | sa_get_net_interfaces (struct sa_net_interface *dst, uint16_t dst_size, uint16_t *written) SA_EXPORT SA_NONNULL |
int sa_open_net | ( | void | ) |
Prepares the resources needed for retrieving network statistics. This function exists (and is needed) only when SA_OPEN_NET is defined.
int sa_close_net | ( | 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_NET is defined.
int sa_count_net_interfaces | ( | uint16_t * | number | ) |
Gives the total number of network interfaces. You don't need to call sa_reset_net_interfaces() before this function.
number | The number will be stored here |
int sa_reset_net_interfaces | ( | ) |
Refreshes the underlying operating system cache.
int sa_get_net_interfaces_ids | ( | char * | dst, |
uint16_t | dst_size, | ||
uint16_t * | written | ||
) |
Returns a list of the existing the network interfaces ids. The array will be fully populated even if it's not big enough (but ENOMEM is returned). sa_reset_net_interfaces() should be called at least once before this function and everytime you need fresh values.
dst | Where the statistics will be stored. |
dst_size | The number of ids that fits on the dst pointer. |
written | The number of network interfaces ids written. |
int sa_get_net_interface | ( | char * | name, |
struct sa_net_interface * | dst | ||
) |
Retrieves statistics from a network interface identified by its name. sa_reset_net_interfaces() should be called at least once before this function and everytime you need fresh values.
name | The name of the network interface. |
dst | Where the statistics will be stored. |
int sa_get_net_interfaces | ( | struct sa_net_interface * | dst, |
uint16_t | dst_size, | ||
uint16_t * | written | ||
) |
Retrieves statistics about all the network interfaces' activity. sa_reset_net_interfaces() should be called at least once before this function and everytime you need fresh values.
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. |