aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-07 09:37:17 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-04-07 09:37:17 +0200
commitcb1937a4c53c723c8757117d074c3be29936b872 (patch)
treece1683ce5cb18312b2dc55a56849b6c362a27657
parent3cfd5d6a022da3e33cec282bed1a3b653743e488 (diff)
[mgcp] Count incoming RTP packets from the BTS and remote
-rw-r--r--openbsc/include/openbsc/mgcp_internal.h4
-rw-r--r--openbsc/src/mgcp/mgcp_network.c6
-rw-r--r--openbsc/src/mgcp/mgcp_protocol.c1
-rw-r--r--openbsc/src/mgcp/mgcp_vty.c5
4 files changed, 14 insertions, 2 deletions
diff --git a/openbsc/include/openbsc/mgcp_internal.h b/openbsc/include/openbsc/mgcp_internal.h
index 7ce1732f9..3a2832436 100644
--- a/openbsc/include/openbsc/mgcp_internal.h
+++ b/openbsc/include/openbsc/mgcp_internal.h
@@ -57,6 +57,10 @@ struct mgcp_endpoint {
/* backpointer */
struct mgcp_config *cfg;
+
+ /* statistics */
+ unsigned int in_bts;
+ unsigned int in_remote;
};
#define ENDPOINT_NUMBER(endp) abs(endp - endp->cfg->endpoints)
diff --git a/openbsc/src/mgcp/mgcp_network.c b/openbsc/src/mgcp/mgcp_network.c
index 6cc6e9d70..95325e948 100644
--- a/openbsc/src/mgcp/mgcp_network.c
+++ b/openbsc/src/mgcp/mgcp_network.c
@@ -164,6 +164,12 @@ static int rtp_data_cb(struct bsc_fd *fd, unsigned int what)
}
}
+ /* do this before the loop handling */
+ if (dest == DEST_NETWORK)
+ ++endp->in_bts;
+ else
+ ++endp->in_remote;
+
/* dispatch */
if (cfg->audio_loop)
dest = !dest;
diff --git a/openbsc/src/mgcp/mgcp_protocol.c b/openbsc/src/mgcp/mgcp_protocol.c
index bbdc43e05..7c8b460fa 100644
--- a/openbsc/src/mgcp/mgcp_protocol.c
+++ b/openbsc/src/mgcp/mgcp_protocol.c
@@ -728,6 +728,7 @@ void mgcp_free_endp(struct mgcp_endpoint *endp)
endp->net_rtp = endp->net_rtcp = endp->bts_rtp = endp->bts_rtcp = 0;
endp->net_payload_type = endp->bts_payload_type = -1;
+ endp->in_bts = endp->in_remote = 0;
memset(&endp->remote, 0, sizeof(endp->remote));
memset(&endp->bts, 0, sizeof(endp->bts));
}
diff --git a/openbsc/src/mgcp/mgcp_vty.c b/openbsc/src/mgcp/mgcp_vty.c
index c8d4b7fe6..af762c57e 100644
--- a/openbsc/src/mgcp/mgcp_vty.c
+++ b/openbsc/src/mgcp/mgcp_vty.c
@@ -77,11 +77,12 @@ DEFUN(show_mcgp, show_mgcp_cmd, "show mgcp",
vty_out(vty, "MGCP is up and running with %u endpoints:%s", g_cfg->number_endpoints - 1, VTY_NEWLINE);
for (i = 1; i < g_cfg->number_endpoints; ++i) {
struct mgcp_endpoint *endp = &g_cfg->endpoints[i];
- vty_out(vty, " Endpoint 0x%.2x: CI: %d net: %u/%u bts: %u/%u on %s%s",
+ vty_out(vty, " Endpoint 0x%.2x: CI: %d net: %u/%u bts: %u/%u on %s traffic in :%u/%u%s",
i, endp->ci,
ntohs(endp->net_rtp), ntohs(endp->net_rtcp),
ntohs(endp->bts_rtp), ntohs(endp->bts_rtcp),
- inet_ntoa(endp->bts), VTY_NEWLINE);
+ inet_ntoa(endp->bts), endp->in_bts, endp->in_remote,
+ VTY_NEWLINE);
}
return CMD_SUCCESS;