36 lines
794 B
C
36 lines
794 B
C
|
|
/* retoor <retoor@molodetz.nl> */
|
||
|
|
#ifndef NETWORK_H
|
||
|
|
#define NETWORK_H
|
||
|
|
|
||
|
|
#define MAX_INTERFACES 32
|
||
|
|
#define MAX_IF_NAME 32
|
||
|
|
#define MAX_IP_LEN 46
|
||
|
|
|
||
|
|
typedef struct {
|
||
|
|
char name[MAX_IF_NAME];
|
||
|
|
char ip[MAX_IP_LEN];
|
||
|
|
int up;
|
||
|
|
unsigned long rx_bytes;
|
||
|
|
unsigned long tx_bytes;
|
||
|
|
unsigned long rx_packets;
|
||
|
|
unsigned long tx_packets;
|
||
|
|
unsigned long rx_errors;
|
||
|
|
unsigned long tx_errors;
|
||
|
|
unsigned long rx_dropped;
|
||
|
|
unsigned long tx_dropped;
|
||
|
|
unsigned long prev_rx_bytes;
|
||
|
|
unsigned long prev_tx_bytes;
|
||
|
|
double rx_rate;
|
||
|
|
double tx_rate;
|
||
|
|
} NetworkInterface;
|
||
|
|
|
||
|
|
typedef struct {
|
||
|
|
int count;
|
||
|
|
NetworkInterface interfaces[MAX_INTERFACES];
|
||
|
|
} NetworkInfo;
|
||
|
|
|
||
|
|
int network_info_init(NetworkInfo *info);
|
||
|
|
int network_info_update(NetworkInfo *info, double interval);
|
||
|
|
|
||
|
|
#endif
|