Refactor getTetherStats in preparation for IPv6 tether counters.

Bug: 9580643
Change-Id: I11565cafbefbc06a7992d1ff18c707165d5b31ed
diff --git a/server/BandwidthController.h b/server/BandwidthController.h
index 5da4fe1..53385d1 100644
--- a/server/BandwidthController.h
+++ b/server/BandwidthController.h
@@ -52,6 +52,17 @@
          * The caller is responsible for free()'ing the returned ptr.
          */
         char *getStatsLine(void) const;
+
+        bool addStatsIfMatch(const TetherStats& other) {
+            if (intIface == other.intIface && extIface == other.extIface) {
+                rxBytes   += other.rxBytes;
+                rxPackets += other.rxPackets;
+                txBytes   += other.txBytes;
+                txPackets += other.txPackets;
+                return true;
+            }
+            return false;
+        }
     };
 
     BandwidthController();
@@ -156,6 +167,15 @@
     int setCostlyAlert(const char *costName, int64_t bytes, int64_t *alertBytes);
     int removeCostlyAlert(const char *costName, int64_t *alertBytes);
 
+    typedef std::vector<TetherStats> TetherStatsList;
+
+    static void addStats(TetherStatsList& statsList, const TetherStats& stats);
+
+    static int addForwardChainStats(const TetherStats& filter,
+                                    TetherStatsList& statsList, FILE *fp,
+                                    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.