| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#ifndef _NETINFO_H |
| 18 |
#define _NETINFO_H |
| 19 |
|
| 20 |
#include <stdint.h> |
| 21 |
#include <sys/types.h> |
| 22 |
|
| 23 |
#include "netinfo-private.h" |
| 24 |
#include "system.h" |
| 25 |
|
| 26 |
#ifdef __cplusplus |
| 27 |
extern "C" |
| 28 |
{ |
| 29 |
#endif |
| 30 |
|
| 31 |
enum |
| 32 |
{ |
| 33 |
|
| 34 |
IF_AF_PACKET = (1 << 0), |
| 35 |
IF_AF_INET = (1 << 1), |
| 36 |
IF_AF_INET6 = (1 << 2), |
| 37 |
|
| 38 |
CHECK_LINK = (1 << 0), |
| 39 |
NO_LOOPBACK = (1 << 1), |
| 40 |
NO_WIRELESS = (1 << 2), |
| 41 |
NO_BYTES = (1 << 3), |
| 42 |
NO_COLLISIONS = (1 << 4), |
| 43 |
NO_DROPS = (1 << 4), |
| 44 |
NO_ERRORS = (1 << 5), |
| 45 |
NO_MULTICAST = (1 << 6), |
| 46 |
NO_PACKETS = (1 << 7), |
| 47 |
RX_ONLY = (1 << 8), |
| 48 |
TX_ONLY = (1 << 9) |
| 49 |
}; |
| 50 |
|
| 51 |
enum duplex |
| 52 |
{ |
| 53 |
DUP_HALF = DUPLEX_HALF, |
| 54 |
DUP_FULL = DUPLEX_FULL, |
| 55 |
_DUP_MAX, |
| 56 |
_DUP_UNKNOWN = DUPLEX_UNKNOWN |
| 57 |
}; |
| 58 |
|
| 59 |
struct iflist *netinfo (unsigned int options, const char *ifname_regex, |
| 60 |
unsigned int seconds, unsigned int *ninterfaces); |
| 61 |
struct iflist *iflist_get_next (struct iflist *ifentry); |
| 62 |
#define iflist_foreach(list_entry, list) \ |
| 63 |
for (list_entry = list; list_entry != NULL; \ |
| 64 |
list_entry = iflist_get_next(list_entry)) |
| 65 |
|
| 66 |
|
| 67 |
const char *iflist_get_ifname (struct iflist *ifentry); |
| 68 |
uint8_t iflist_get_duplex (struct iflist *ifentry); |
| 69 |
uint32_t iflist_get_speed (struct iflist *ifentry); |
| 70 |
unsigned int iflist_get_tx_packets (struct iflist *ifentry); |
| 71 |
unsigned int iflist_get_rx_packets (struct iflist *ifentry); |
| 72 |
unsigned int iflist_get_tx_bytes (struct iflist *ifentry); |
| 73 |
unsigned int iflist_get_rx_bytes (struct iflist *ifentry); |
| 74 |
unsigned int iflist_get_tx_errors (struct iflist *ifentry); |
| 75 |
unsigned int iflist_get_rx_errors (struct iflist *ifentry); |
| 76 |
unsigned int iflist_get_tx_dropped (struct iflist *ifentry); |
| 77 |
unsigned int iflist_get_rx_dropped (struct iflist *ifentry); |
| 78 |
unsigned int iflist_get_collisions (struct iflist *ifentry); |
| 79 |
unsigned int iflist_get_flags (struct iflist *ifentry); |
| 80 |
unsigned int iflist_get_multicast (struct iflist *ifentry); |
| 81 |
|
| 82 |
void print_ifname_debug (struct iflist *iflhead, unsigned int options); |
| 83 |
void freeiflist (struct iflist *iflhead); |
| 84 |
|
| 85 |
|
| 86 |
bool if_flags_LOOPBACK (unsigned int flags); |
| 87 |
bool if_flags_RUNNING (unsigned int flags); |
| 88 |
bool if_flags_UP (unsigned int flags); |
| 89 |
|
| 90 |
#ifdef __cplusplus |
| 91 |
} |
| 92 |
#endif |
| 93 |
|
| 94 |
#endif |