Add per-channel statistics to message bridge ServerStatistics

When trying to debug issues with message bridge, we wanted to be able to
tell which channels were having issues. This will help with it (although
like the timing reports, it will help to have a utility to transform
from channel indices to channel names).

Change-Id: Ief2a11c7b45e32cc8bc4ab6861e05b7f57aaeb9c
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/network/message_bridge_server.fbs b/aos/network/message_bridge_server.fbs
index 30017c4..e936828 100644
--- a/aos/network/message_bridge_server.fbs
+++ b/aos/network/message_bridge_server.fbs
@@ -2,6 +2,19 @@
 
 namespace aos.message_bridge;
 
+// Per-channel statistics for any channels being forwarded to other nodes by the
+// message bridge server.
+table ServerChannelStatistics {
+  // Index into the configuration channels list for this channel.
+  channel_index:uint64 (id: 0);
+  // Total number of messages that were sent (this does not necessarily
+  // mean that the message made it to the client).
+  sent_packets:uint (id: 1);
+  // Total number of messages that were dropped while sending (e.g.,
+  // those dropped by the kernel).
+  dropped_packets:uint (id: 2);
+}
+
 // State of the connection.
 enum State: ubyte {
   CONNECTED,
@@ -45,6 +58,10 @@
   // Number of times we've had an invalid connection with something wrong in
   // the connection message, but we were able to match which node it was.
   invalid_connection_count:uint (id: 9);
+
+  // Statistics for every channel being forwarded to this node. Ordering is arbitrary;
+  // the channels are identified by an index in the ServerChannelStatistics.
+  channels:[ServerChannelStatistics] (id: 10);
 }
 
 // Statistics for all connections to all the clients.