stats: replace packet statistic counters with libosmocore rate counters

In struct mgcp_rtp_end one finds unsigned int counters. Those should
be replaced with libosmocore rate counters

- replace packets_rx, octets_rx, packets_tx, octets_tx and
  dropped_packets with libosmocore rate counters.

Change-Id: I47c5c9006df5044e59ddebb895e62adb849d72d5
Related: OS#2517
diff --git a/include/osmocom/mgcp/mgcp_conn.h b/include/osmocom/mgcp/mgcp_conn.h
index e2a423f..3da7334 100644
--- a/include/osmocom/mgcp/mgcp_conn.h
+++ b/include/osmocom/mgcp/mgcp_conn.h
@@ -27,6 +27,17 @@
 #include <osmocom/core/linuxlist.h>
 #include <inttypes.h>
 
+/* RTP connection related counters */
+enum {
+	IN_STREAM_ERR_TSTMP_CTR,
+	OUT_STREAM_ERR_TSTMP_CTR,
+        RTP_PACKETS_RX_CTR,
+        RTP_OCTETS_RX_CTR,
+        RTP_PACKETS_TX_CTR,
+        RTP_OCTETS_TX_CTR,
+        RTP_DROPPED_PACKETS_CTR
+};
+
 struct mgcp_conn *mgcp_conn_alloc(void *ctx, struct mgcp_endpoint *endp,
 				  enum mgcp_conn_type type, char *name);
 struct mgcp_conn *mgcp_conn_get(struct mgcp_endpoint *endp, const char *id);
diff --git a/include/osmocom/mgcp/mgcp_internal.h b/include/osmocom/mgcp/mgcp_internal.h
index 1b9749d..38b687c 100644
--- a/include/osmocom/mgcp/mgcp_internal.h
+++ b/include/osmocom/mgcp/mgcp_internal.h
@@ -99,15 +99,6 @@
 
 /* 'mgcp_rtp_end': basically a wrapper around the RTP+RTCP ports */
 struct mgcp_rtp_end {
-	/* statistics */
-	struct {
-		unsigned int packets_rx;
-		unsigned int octets_rx;
-		unsigned int packets_tx;
-		unsigned int octets_tx;
-		unsigned int dropped_packets;
-	} stats;
-
 	/* local IP address of the RTP socket */
 	struct in_addr addr;
 
diff --git a/include/osmocom/mgcp/mgcp_stat.h b/include/osmocom/mgcp/mgcp_stat.h
index b6c73fa..0bde8cf 100644
--- a/include/osmocom/mgcp/mgcp_stat.h
+++ b/include/osmocom/mgcp/mgcp_stat.h
@@ -30,8 +30,7 @@
 void mgcp_format_stats(char *str, size_t str_len,  struct mgcp_conn *conn);
 
 /* Exposed for test purposes only, do not use actively */
-void calc_loss(struct mgcp_rtp_state *s, struct mgcp_rtp_end *,
-			uint32_t *expected, int *loss);
+void calc_loss(struct mgcp_conn_rtp *conn, uint32_t *expected, int *loss);
 
 /* Exposed for test purposes only, do not use actively */
 uint32_t calc_jitter(struct mgcp_rtp_state *);