diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-04-12 12:17:09 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-04-13 09:47:22 +0200 |
commit | 1aa2798919f7d517cebf6d211e78e9271b2ee07f (patch) | |
tree | 6a64d4cecbb71602e3adc15c716cf34afaf7190e /openbsc/src/nat/bsc_nat.c | |
parent | b829eac9bc6c6dddcc0814d85ac560c6c48c36e1 (diff) |
[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.
Diffstat (limited to 'openbsc/src/nat/bsc_nat.c')
-rw-r--r-- | openbsc/src/nat/bsc_nat.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c index 8897cc39f..e679a9185 100644 --- a/openbsc/src/nat/bsc_nat.c +++ b/openbsc/src/nat/bsc_nat.c @@ -258,7 +258,10 @@ static int forward_sccp_to_bts(struct msgb *msg) case SCCP_MSG_TYPE_IT: con = patch_sccp_src_ref_to_bsc(msg, parsed, nat); if (parsed->gsm_type == BSS_MAP_MSG_ASSIGMENT_RQST) { + counter_inc(nat->stats.sccp.calls); + if (con) { + counter_inc(con->bsc->cfg->stats.sccp.conn); if (bsc_mgcp_assign(con, msg) != 0) LOGP(DNAT, LOGL_ERROR, "Failed to assign...\n"); } else @@ -466,6 +469,7 @@ static void ipaccess_auth_bsc(struct tlv_parsed *tvp, struct bsc_connection *bsc llist_for_each_entry(conf, &bsc->nat->bsc_configs, entry) { if (strcmp(conf->token, token) == 0) { + counter_inc(conf->stats.net.reconn); bsc->authenticated = 1; bsc->cfg = conf; bsc_del_timer(&bsc->id_timeout); @@ -632,6 +636,9 @@ static int ipaccess_listen_bsc_cb(struct bsc_fd *bfd, unsigned int what) return ret; } + /* count the reconnect */ + counter_inc(nat->stats.bsc.reconn); + /* * if we are not connected to a msc... just close the socket */ |