Base: LCDproc 0.5.2
[lcdproc-de200c.git] / contrib / interface-demo2 / interface.h
blob0c37b5c4f46e645fd0149d6e57fcf0c8d76e347e
1 struct user_net_device_stats {
2 unsigned long long rx_packets; /* total packets received */
3 unsigned long long tx_packets; /* total packets transmitted */
4 unsigned long long rx_bytes; /* total bytes received */
5 unsigned long long tx_bytes; /* total bytes transmitted */
6 unsigned long rx_errors; /* bad packets received */
7 unsigned long tx_errors; /* packet transmit problems */
8 unsigned long rx_dropped; /* no space in linux buffers */
9 unsigned long tx_dropped; /* no space available in linux */
10 unsigned long rx_multicast; /* multicast packets received */
11 unsigned long rx_compressed;
12 unsigned long tx_compressed;
13 unsigned long collisions;
15 /* detailed rx_errors: */
16 unsigned long rx_length_errors;
17 unsigned long rx_over_errors; /* receiver ring buff overflow */
18 unsigned long rx_crc_errors; /* recved pkt with crc error */
19 unsigned long rx_frame_errors; /* recv'd frame alignment error */
20 unsigned long rx_fifo_errors; /* recv'r fifo overrun */
21 unsigned long rx_missed_errors; /* receiver missed packet */
22 /* detailed tx_errors */
23 unsigned long tx_aborted_errors;
24 unsigned long tx_carrier_errors;
25 unsigned long tx_fifo_errors;
26 unsigned long tx_heartbeat_errors;
27 unsigned long tx_window_errors;
30 struct interface {
31 struct interface *next, *prev;
32 char name[IFNAMSIZ]; /* interface name */
33 short type; /* if type */
34 short flags; /* various flags */
35 int metric; /* routing metric */
36 int mtu; /* MTU value */
37 int tx_queue_len; /* transmit queue length */
38 struct ifmap map; /* hardware setup */
39 struct sockaddr addr; /* IP address */
40 struct sockaddr dstaddr; /* P-P IP address */
41 struct sockaddr broadaddr; /* IP broadcast address */
42 struct sockaddr netmask; /* IP network mask */
43 struct sockaddr ipxaddr_bb; /* IPX network address */
44 struct sockaddr ipxaddr_sn; /* IPX network address */
45 struct sockaddr ipxaddr_e3; /* IPX network address */
46 struct sockaddr ipxaddr_e2; /* IPX network address */
47 struct sockaddr ddpaddr; /* Appletalk DDP address */
48 struct sockaddr ecaddr; /* Econet address */
49 int has_ip;
50 int has_ipx_bb;
51 int has_ipx_sn;
52 int has_ipx_e3;
53 int has_ipx_e2;
54 int has_ax25;
55 int has_ddp;
56 int has_econet;
57 char hwaddr[32]; /* HW address */
58 int statistics_valid;
59 struct user_net_device_stats stats; /* statistics */
60 int keepalive; /* keepalive value for SLIP */
61 int outfill; /* outfill value for SLIP */
64 extern int if_fetch(struct interface *ife);
66 extern int for_all_interfaces(int, int (*)(int, struct interface *, void *), void *);
67 extern int if_cache_free(void);
68 extern struct interface *lookup_interface(char *name);
69 extern int if_readlist(void);
71 extern int do_if_fetch(struct interface *ife);
72 extern int do_if_print(struct interface *ife, void *cookie);
74 extern int procnetdev_version(char *buf);
75 extern int get_dev_fields(char *bp, struct interface *ife);
76 extern char * get_name(char *name, char *p);
78 extern void ife_print(struct interface *ptr);
80 extern int ife_short;
82 extern const char *if_port_text[][4];
84 /* Defines for poor glibc2.0 users, the feature check is done at runtime */
85 #if !defined(SIOCSIFTXQLEN)
86 #define SIOCSIFTXQLEN 0x8943
87 #define SIOCGIFTXQLEN 0x8942
88 #endif
90 #if !defined(ifr_qlen)
91 /* Actually it is ifru_ivalue, but that is not present in 2.0 kernel headers */
92 #define ifr_qlen ifr_ifru.ifru_mtu
93 #endif
95 #define HAVE_TXQUEUELEN
97 #define HAVE_DYNAMIC
98 #ifndef IFF_DYNAMIC
99 #define IFF_DYNAMIC 0x8000 /* dialup device with changing addresses */
100 #endif