531e2be0e2aa84c0484f71e1a5adcf30c971a5cb
[collectd.git] / src / ethstat.h
1 /**
2  * collectd - src/ethstat.h
3  * Copyright (C) 2011       Cyril Feraudet
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  *
19  * Authors:
20  *   Cyril Feraudet <cyril at feraudet.com>
21  **/
22
23 #define ETHTOOL_BUSINFO_LEN     32
24 #define ETHTOOL_GDRVINFO        0x00000003 /* Get driver info. */
25 #define ETH_GSTRING_LEN         32
26 #define ETHTOOL_GSTRINGS        0x0000001b /* get specified string set */
27 #define ETHTOOL_GSTATS          0x0000001d /* get NIC-specific statistics */
28
29 enum ethtool_stringset {
30         ETH_SS_TEST             = 0,
31         ETH_SS_STATS,
32 };
33
34 typedef unsigned long long u64;
35 typedef unsigned char __u8;
36 typedef unsigned short __u16;
37 typedef unsigned int __u32;
38 typedef unsigned long long  __u64;
39
40
41 static const char *config_keys[] =
42 {
43         "Iface"
44 };
45 static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
46
47 static char **ifacelist = NULL;
48 static int ifacenumber = 0;
49 struct ethtool_drvinfo {
50         __u32   cmd;
51         char    driver[32];     /* driver short name, "tulip", "eepro100" */
52         char    version[32];    /* driver version string */
53         char    fw_version[32]; /* firmware version string, if applicable */
54         char    bus_info[ETHTOOL_BUSINFO_LEN];  /* Bus info for this IF. */
55                                 /* For PCI devices, use pci_name(pci_dev). */
56         char    reserved1[32];
57         char    reserved2[16];
58         __u32   n_stats;        /* number of u64's from ETHTOOL_GSTATS */
59         __u32   testinfo_len;
60         __u32   eedump_len;     /* Size of data from ETHTOOL_GEEPROM (bytes) */
61         __u32   regdump_len;    /* Size of data from ETHTOOL_GREGS (bytes) */
62 };
63
64 struct ethtool_gstrings {
65         __u32   cmd;            /* ETHTOOL_GSTRINGS */
66         __u32   string_set;     /* string set id e.c. ETH_SS_TEST, etc*/
67         __u32   len;            /* number of strings in the string set */
68         __u8    data[0];
69 };
70
71 struct ethtool_stats {
72         __u32   cmd;            /* ETHTOOL_GSTATS */
73         __u32   n_stats;        /* number of u64's being returned */
74         __u64   data[0];
75 };
76
77
78