[statistics] Provide basic statistics for the NAT

Count number of SCCP connections, number of BSC reconnects,
number of calls. For most of them we have a per BSC and a
global count.

Right now all structs using the counters survive until the
end of the application so we do not need to free them.
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index 62e3c52..df64723 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -31,6 +31,7 @@
 #include <osmocore/msgb.h>
 #include <osmocore/timer.h>
 #include <osmocore/write_queue.h>
+#include <osmocore/statistics.h>
 
 #define DIR_BSC 1
 #define DIR_MSC 2
@@ -114,6 +115,20 @@
 };
 
 /**
+ * Stats per BSC
+ */
+struct bsc_config_stats {
+	struct {
+		struct counter *conn;
+		struct counter *calls;
+	} sccp;
+
+	struct {
+		struct counter *reconn;
+	} net;
+};
+
+/**
  * One BSC entry in the config
  */
 struct bsc_config {
@@ -124,6 +139,8 @@
 	int nr;
 
 	struct bsc_nat *nat;
+
+	struct bsc_config_stats stats;
 };
 
 /**
@@ -139,6 +156,25 @@
 };
 
 /**
+ * Statistic for the nat.
+ */
+struct bsc_nat_statistics {
+	struct {
+		struct counter *conn;
+		struct counter *calls;
+	} sccp;
+
+	struct {
+		struct counter *reconn;
+                struct counter *auth_fail;
+	} bsc;
+
+	struct {
+		struct counter *reconn;
+	} msc;
+};
+
+/**
  * the structure of the "nat" network
  */
 struct bsc_nat {
@@ -162,6 +198,9 @@
 	int first_contact;
 
 	struct bsc_endpoint *bsc_endpoints;
+
+	/* statistics */
+	struct bsc_nat_statistics stats;
 };
 
 /* create and init the structures */