Remove support for filtering tether stats.
The framework does not use this filtering, so it's just
dead code. It also requires that NatController publicly
expose its list of interface pairs.
Also make the parsing code a bit stricter - for example, return
an error if any of the lines (except the headers) fail to parse.
Bug: 32163131
Bug: 64995262
Test: bullhead builds and boots
Test: netd_{unit,integration}_test pass
Test: output of "adb shell ndc bandwidth gettetherstats" looks correct
Change-Id: Ib7440f935809c59d8b48396764cc63eb95f509b4
diff --git a/server/TetherController.h b/server/TetherController.h
index 4ed94ee..b0da5bf 100644
--- a/server/TetherController.h
+++ b/server/TetherController.h
@@ -104,13 +104,10 @@
};
/*
- * For single pair of ifaces, stats should have ifaceIn and ifaceOut initialized.
- * For all pairs, stats should have ifaceIn=ifaceOut="".
- * Sends out to the cli the single stat (TetheringStatsReluts) or a list of stats
- * (TetheringStatsListResult+CommandOkay).
+ * Sends out to the cli a list of stats TetheringStatsListResult+CommandOkay).
* Error is to be handled on the outside.
- * It results in an error if invoked and no tethering counter rules exist.
*/
+ int getTetherStats(SocketClient *cli, std::string &extraProcessingInfo);
int getTetherStats(SocketClient *cli, TetherStats &stats, std::string &extraProcessingInfo);
typedef std::vector<TetherStats> TetherStatsList;
@@ -118,6 +115,17 @@
static void addStats(TetherStatsList& statsList, const TetherStats& stats);
/*
+ * output should be a file to the apropriate FORWARD chain of iptables rules.
+ * extraProcessingInfo: contains raw parsed data, and error info.
+ * This strongly requires that setup of the rules is in a specific order:
+ * in:intIface out:extIface
+ * in:extIface out:intIface
+ * and the rules are grouped in pairs when more that one tethering was setup.
+ */
+ static int addForwardChainStats(TetherStatsList& statsList, const std::string& iptOutput,
+ std::string &extraProcessingInfo);
+
+ /*
* stats should never have only intIface initialized. Other 3 combos are ok.
* fp should be a file to the apropriate FORWARD chain of iptables rules.
* extraProcessingInfo: contains raw parsed data, and error info.