[sr-dev] git:andrei/counters: snmp(k): fix direct access to stat vars

Andrei Pelinescu-Onciul andrei at iptel.org
Mon Aug 9 19:09:12 CEST 2010


Module: sip-router
Branch: andrei/counters
Commit: 5cac9a1836ff097fe5ff4bc0478cf1ff0e1a7cd3
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5cac9a1836ff097fe5ff4bc0478cf1ff0e1a7cd3

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Mon Aug  9 19:05:46 2010 +0200

snmp(k): fix direct access to stat vars

The snmp modules used to access directly some stat vars values,
instead of using get_stat_val() (because the kamailio stats are
now a wrapper over sr counters, the stats var definition changed
and it's not possible to access its value directly).

---

 modules_k/snmpstats/snmpSIPStatusCodesTable.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/modules_k/snmpstats/snmpSIPStatusCodesTable.c b/modules_k/snmpstats/snmpSIPStatusCodesTable.c
index cac6a33..eda8fbc 100644
--- a/modules_k/snmpstats/snmpSIPStatusCodesTable.c
+++ b/modules_k/snmpstats/snmpSIPStatusCodesTable.c
@@ -348,12 +348,12 @@ openserSIPStatusCodesTable_create_row( netsnmp_index* hdr)
 
 	if (in_status_code != NULL) 
 	{
-		ctx->startingInStatusCodeValue  = *(long *)in_status_code->u.val;
+		ctx->startingInStatusCodeValue  = get_stat_val(in_status_code);
 	}
 
 	if (out_status_code != NULL) 
 	{
-		ctx->startingOutStatusCodeValue = *(long *)out_status_code->u.val;
+		ctx->startingOutStatusCodeValue = get_stat_val(out_status_code);
 	}
 
 	return ctx;
@@ -796,9 +796,8 @@ int openserSIPStatusCodesTable_get_value(
 			if (the_stat != NULL)  
 			{
 				/* Calculate the Delta */
-				context->openserSIPStatusCodeIns =
-				*(long *)the_stat->u.val - 
-				context->startingInStatusCodeValue;
+				context->openserSIPStatusCodeIns = get_stat_val(the_stat) -
+					context->startingInStatusCodeValue;
 			}
 
 			snmp_set_var_typed_value(var, ASN_COUNTER,
@@ -817,7 +816,7 @@ int openserSIPStatusCodesTable_get_value(
 			{
 				/* Calculate the Delta */
 				context->openserSIPStatusCodeOuts =
-					*(long *)the_stat->u.val - 
+					get_stat_val(the_stat) -
 					context->startingOutStatusCodeValue;
 			}
 			snmp_set_var_typed_value(var, ASN_COUNTER,




More information about the sr-dev mailing list