+ /* status file is generated by openvpn/sig.c:print_status()
+ * http://svn.openvpn.net/projects/openvpn/trunk/openvpn/sig.c
+ *
+ * The line we're expecting has 2 fields. We ignore all lines
+ * with more or less fields.
+ */
+ if (fields_num != 2)
+ {
+ continue;
+ }
+
+ if (strcmp (fields[0], "TUN/TAP read bytes") == 0)
+ {
+ /* read from the system and sent over the tunnel */
+ tun_tx = atoll (fields[1]);
+ }
+ else if (strcmp (fields[0], "TUN/TAP write bytes") == 0)
+ {
+ /* read from the tunnel and written in the system */
+ tun_rx = atoll (fields[1]);
+ }
+ else if (strcmp (fields[0], "TCP/UDP read bytes") == 0)
+ {
+ link_rx = atoll (fields[1]);
+ }
+ else if (strcmp (fields[0], "TCP/UDP write bytes") == 0)
+ {
+ link_tx = atoll (fields[1]);
+ }
+ else if (strcmp (fields[0], "pre-compress bytes") == 0)
+ {
+ pre_compress = atoll (fields[1]);
+ }
+ else if (strcmp (fields[0], "post-compress bytes") == 0)
+ {
+ post_compress = atoll (fields[1]);
+ }
+ else if (strcmp (fields[0], "pre-decompress bytes") == 0)
+ {
+ pre_decompress = atoll (fields[1]);
+ }
+ else if (strcmp (fields[0], "post-decompress bytes") == 0)
+ {
+ post_decompress = atoll (fields[1]);
+ }
+ }
+
+ iostats_submit (name, "traffic", link_rx, link_tx);
+
+ /* we need to force this order to avoid negative values with these unsigned */
+ overhead_rx = (((link_rx - pre_decompress) + post_decompress) - tun_rx);
+ overhead_tx = (((link_tx - post_compress) + pre_compress) - tun_tx);
+
+ iostats_submit (name, "overhead", overhead_rx, overhead_tx);
+
+ if (store_compression)
+ {
+ compression_submit (name, "data_in", post_decompress, pre_decompress);
+ compression_submit (name, "data_out", pre_compress, post_compress);
+ }
+
+ read = 1;
+
+ return (read);
+} /* int single_read */
+
+/* for reading status version 1 */
+static int multi1_read (char *name, FILE *fh)
+{
+ char buffer[1024];
+ char *fields[10];
+ int fields_num, read = 0, found_header = 0;
+
+ /* read the file until the "ROUTING TABLE" line is found (no more info after) */