From 4f5b8237ec2182861fbe075f4cce56a9c7caf904 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 5 May 2015 22:25:48 +0200 Subject: sgsn: Create an initial and limited CDR module This is consuming the new signals and allows to install several different CDR/observing/event/audit modules in the future. For getting the bytes in/out the code would have had to undo what the rate counter is doing and at the same time adding a "total" to the ratecounter didn't look like a good idea, the same went for making it a plain counter. Begin writing the values one by one and open/closing a new FILE for every log messages. This is not efficient but easily deals with external truncation/rotation of the file (no fstat for and checking the links and size). As usual we will wait and see if this is an issue. Add some new members to our PDP context structure to see what it is about. --- openbsc/src/gprs/sgsn_libgtp.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'openbsc/src/gprs/sgsn_libgtp.c') diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c index af5c93de3..9972cddf3 100644 --- a/openbsc/src/gprs/sgsn_libgtp.c +++ b/openbsc/src/gprs/sgsn_libgtp.c @@ -534,6 +534,9 @@ static int cb_data_ind(struct pdp_t *lib, void *packet, unsigned int len) rate_ctr_inc(&mm->ctrg->ctr[GMM_CTR_PKTS_UDATA_OUT]); rate_ctr_add(&mm->ctrg->ctr[GMM_CTR_BYTES_UDATA_OUT], len); + /* It is easier to have a global count */ + pdp->cdr_bytes_out += len; + return sndcp_unitdata_req(msg, &mm->llme->lle[pdp->sapi], pdp->nsapi, mm); } @@ -569,6 +572,9 @@ int sgsn_rx_sndcp_ud_ind(struct gprs_ra_id *ra_id, int32_t tlli, uint8_t nsapi, rate_ctr_inc(&mmctx->ctrg->ctr[GMM_CTR_PKTS_UDATA_IN]); rate_ctr_add(&mmctx->ctrg->ctr[GMM_CTR_BYTES_UDATA_IN], npdu_len); + /* It is easier to have a global count */ + pdp->cdr_bytes_in += npdu_len; + return gtp_data_req(pdp->ggsn->gsn, pdp->lib, npdu, npdu_len); } -- cgit v1.2.3