aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-06-17 18:29:42 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-17 18:29:42 +0800
commit8330c1c386b5a2ec78124316508c3a94bdf763d3 (patch)
treed93cd77332a9d9b8e939707394c63161c1c6e303
parentb2c38ebb1f2e9f670b3a59caca9e6195277b62be (diff)
nat: Count the number of dropped SCCP and MGCP calls as well.
Count the number of dropped calls and lost SCCP connections due the loss of a connection to the BSC...
-rw-r--r--openbsc/include/openbsc/bsc_nat.h2
-rw-r--r--openbsc/src/nat/bsc_mgcp_utils.c8
-rw-r--r--openbsc/src/nat/bsc_nat.c6
-rw-r--r--openbsc/src/nat/bsc_nat_utils.c2
4 files changed, 18 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index bb2d5df95..50be1dfec 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -150,6 +150,8 @@ enum bsc_cfg_ctr {
BCFG_CTR_SCCP_CONN,
BCFG_CTR_SCCP_CALLS,
BCFG_CTR_NET_RECONN,
+ BCFG_CTR_DROPPED_SCCP,
+ BCFG_CTR_DROPPED_CALLS,
};
/**
diff --git a/openbsc/src/nat/bsc_mgcp_utils.c b/openbsc/src/nat/bsc_mgcp_utils.c
index 5d24acfe3..ef55f8a3f 100644
--- a/openbsc/src/nat/bsc_mgcp_utils.c
+++ b/openbsc/src/nat/bsc_mgcp_utils.c
@@ -546,13 +546,21 @@ int bsc_mgcp_nat_init(struct bsc_nat *nat)
void bsc_mgcp_clear_endpoints_for(struct bsc_connection *bsc)
{
+ struct rate_ctr *ctr = NULL;
int i;
+
+ if (bsc->cfg)
+ ctr = &bsc->cfg->stats.ctrg->ctr[BCFG_CTR_DROPPED_CALLS];
+
for (i = 1; i < bsc->nat->mgcp_cfg->number_endpoints; ++i) {
struct bsc_endpoint *bsc_endp = &bsc->nat->bsc_endpoints[i];
if (bsc_endp->bsc != bsc)
continue;
+ if (ctr)
+ rate_ctr_inc(ctr);
+
bsc_mgcp_free_endpoint(bsc->nat, i);
mgcp_free_endp(&bsc->nat->mgcp_cfg->endpoints[i]);
}
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c
index 0f50a2b83..356025c98 100644
--- a/openbsc/src/nat/bsc_nat.c
+++ b/openbsc/src/nat/bsc_nat.c
@@ -588,17 +588,23 @@ static int ipaccess_msc_write_cb(struct bsc_fd *bfd, struct msgb *msg)
void bsc_close_connection(struct bsc_connection *connection)
{
struct sccp_connections *sccp_patch, *tmp;
+ struct rate_ctr *ctr = NULL;
/* stop the timeout timer */
bsc_del_timer(&connection->id_timeout);
bsc_del_timer(&connection->ping_timeout);
bsc_del_timer(&connection->pong_timeout);
+ if (connection->cfg)
+ ctr = &connection->cfg->stats.ctrg->ctr[BCFG_CTR_DROPPED_SCCP];
+
/* remove all SCCP connections */
llist_for_each_entry_safe(sccp_patch, tmp, &nat->sccp_connections, list_entry) {
if (sccp_patch->bsc != connection)
continue;
+ if (ctr)
+ rate_ctr_inc(ctr);
if (sccp_patch->has_remote_ref)
nat_send_rlsd(sccp_patch);
sccp_connection_destroy(sccp_patch);
diff --git a/openbsc/src/nat/bsc_nat_utils.c b/openbsc/src/nat/bsc_nat_utils.c
index d21185361..ca235bfbc 100644
--- a/openbsc/src/nat/bsc_nat_utils.c
+++ b/openbsc/src/nat/bsc_nat_utils.c
@@ -43,6 +43,8 @@ static const struct rate_ctr_desc bsc_cfg_ctr_description[] = {
[BCFG_CTR_SCCP_CONN] = { "sccp.conn", "SCCP Connections" },
[BCFG_CTR_SCCP_CALLS] = { "sccp.calls", "SCCP Assignment Commands"},
[BCFG_CTR_NET_RECONN] = { "net.reconnects", "Network reconnects"},
+ [BCFG_CTR_DROPPED_SCCP] = { "dropped.sccp", "Dropped SCCP connections."},
+ [BCFG_CTR_DROPPED_CALLS] = { "dropped.calls", "Dropped active calls."},
};
static const struct rate_ctr_group_desc bsc_cfg_ctrg_desc = {