+/*
+ * Various people have reported problems with `getifaddrs' and varying versions
+ * of `glibc'. That's why it's disabled by default. Since more statistics are
+ * available this way one may enable it using the `--enable-getifaddrs' option
+ * of the configure script. -octo
+ */
+#if KERNEL_LINUX
+# if !COLLECT_GETIFADDRS
+# undef HAVE_GETIFADDRS
+# endif /* !COLLECT_GETIFADDRS */
+#endif /* KERNEL_LINUX */
+
+#if HAVE_GETIFADDRS || KERNEL_LINUX || HAVE_LIBKSTAT || HAVE_LIBSTATGRAB
+# define TRAFFIC_HAVE_READ 1
+#else
+# define TRAFFIC_HAVE_READ 0
+#endif
+
+#define BUFSIZE 512
+
+/*
+ * (Module-)Global variables
+ */
+/* TODO: Move this to `interface-%s/<blah>.rrd' in version 4. */
+static char *bytes_file = "traffic-%s.rrd";
+static char *packets_file = "interface-%s/if_packets.rrd";
+static char *errors_file = "interface-%s/if_errors.rrd";
+/* TODO: Maybe implement multicast and broadcast counters */
+
+static char *config_keys[] =
+{
+ "Interface",
+ "IgnoreSelected",
+ NULL
+};
+static int config_keys_num = 2;
+
+static char *bytes_ds_def[] =
+{
+ "DS:incoming:COUNTER:"COLLECTD_HEARTBEAT":0:U",
+ "DS:outgoing:COUNTER:"COLLECTD_HEARTBEAT":0:U",
+ NULL
+};
+static int bytes_ds_num = 2;
+
+static char *packets_ds_def[] =
+{
+ "DS:rx:COUNTER:"COLLECTD_HEARTBEAT":0:U",
+ "DS:tx:COUNTER:"COLLECTD_HEARTBEAT":0:U",
+ NULL
+};
+static int packets_ds_num = 2;
+
+static char *errors_ds_def[] =
+{
+ "DS:rx:COUNTER:"COLLECTD_HEARTBEAT":0:U",
+ "DS:tx:COUNTER:"COLLECTD_HEARTBEAT":0:U",
+ NULL
+};
+static int errors_ds_num = 2;
+
+static char **if_list = NULL;
+static int if_list_num = 0;
+/*
+ * if_list_action:
+ * 0 => default is to collect selected interface
+ * 1 => ignore selcted interfaces
+ */
+static int if_list_action = 0;