add MGCP CRCX command statistics to osmo-mgw

Add a counter group for CRCX commands. The group contains counters for
successful connection processing as well as various error conditions.
This provides a quick overview of CRCX failures on each trunk throughout
the lifetime of the osmo-mgw process.

For example, after running the TTCN3 mgw test suite, the counters show
the following values:

OsmoMGW> show rate-counters
crxc statistics:
             crcx:success:         88 (0/s 88/m 0/h 0/d) CRCX command processed successfully.
          crcx:bad_action:          0 (0/s 0/m 0/h 0/d) bad action in CRCX command.
     crcx:unhandled_param:          1 (0/s 1/m 0/h 0/d) unhandled parameter in CRCX command.
      crcx:missing_callid:          1 (0/s 1/m 0/h 0/d) missing CallId in CRCX command.
        crcx:invalid_mode:          1 (0/s 1/m 0/h 0/d) connection invalid mode in CRCX command.
      crcx:limit_exceeded:          0 (0/s 0/m 0/h 0/d) limit of concurrent connections was reached.
       crcx:unkown_callid:          0 (0/s 0/m 0/h 0/d) unknown CallId in CRCX command.
     crcx:alloc_conn_fail:          0 (0/s 0/m 0/h 0/d) connection allocation failure.
 crcx:no_remote_conn_desc:          1 (0/s 1/m 0/h 0/d) no opposite end specified for connection.
   crcx:start_rtp_failure:          0 (0/s 0/m 0/h 0/d) failure to start RTP processing.
       crcx:conn_rejected:          0 (0/s 0/m 0/h 0/d) connection rejected by policy.
OsmoMGW>

These same counters are now also shown by 'show mgcp stats'
in the context of the trunk which they belong to.

With input from Philipp Maier.

Change-Id: Ida82fc340d5c66180e5fe9a0d195e9be6dc64c61
Related: OS#2660
diff --git a/include/osmocom/mgcp/mgcp.h b/include/osmocom/mgcp/mgcp.h
index bdc86fc..f9f0ac7 100644
--- a/include/osmocom/mgcp/mgcp.h
+++ b/include/osmocom/mgcp/mgcp.h
@@ -118,6 +118,21 @@
 #define MGCP_KEEPALIVE_ONCE (-1)
 #define MGCP_KEEPALIVE_NEVER 0
 
+/* Global MCGP CRCX related rate counters */
+enum {
+	MGCP_CRCX_SUCCESS,
+	MGCP_CRCX_FAIL_BAD_ACTION,
+	MGCP_CRCX_FAIL_UNHANDLED_PARAM,
+	MGCP_CRCX_FAIL_MISSING_CALLID,
+	MGCP_CRCX_FAIL_INVALID_MODE,
+	MGCP_CRCX_FAIL_LIMIT_EXCEEDED,
+	MGCP_CRCX_FAIL_UNKNOWN_CALLID,
+	MGCP_CRCX_FAIL_ALLOC_CONN,
+	MGCP_CRCX_FAIL_NO_REMOTE_CONN_DESC,
+	MGCP_CRCX_FAIL_START_RTP,
+	MGCP_CRCX_FAIL_REJECTED_BY_POLICY,
+};
+
 struct mgcp_trunk_config {
 	struct llist_head entry;
 
@@ -155,6 +170,9 @@
 	unsigned int number_endpoints;
 	int vty_number_endpoints;
 	struct mgcp_endpoint *endpoints;
+
+	/* rate counters */
+	struct rate_ctr_group *mgcp_crcx_ctr_group;
 };
 
 enum mgcp_role {