Browse code

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).

Andrei Pelinescu-Onciul authored on 09/08/2010 17:05:46
Showing 1 changed files
... ...
@@ -348,12 +348,12 @@ openserSIPStatusCodesTable_create_row( netsnmp_index* hdr)
348 348
 
349 349
 	if (in_status_code != NULL) 
350 350
 	{
351
-		ctx->startingInStatusCodeValue  = *(long *)in_status_code->u.val;
351
+		ctx->startingInStatusCodeValue  = get_stat_val(in_status_code);
352 352
 	}
353 353
 
354 354
 	if (out_status_code != NULL) 
355 355
 	{
356
-		ctx->startingOutStatusCodeValue = *(long *)out_status_code->u.val;
356
+		ctx->startingOutStatusCodeValue = get_stat_val(out_status_code);
357 357
 	}
358 358
 
359 359
 	return ctx;
... ...
@@ -796,9 +796,8 @@ int openserSIPStatusCodesTable_get_value(
796 796
 			if (the_stat != NULL)  
797 797
 			{
798 798
 				/* Calculate the Delta */
799
-				context->openserSIPStatusCodeIns =
800
-				*(long *)the_stat->u.val - 
801
-				context->startingInStatusCodeValue;
799
+				context->openserSIPStatusCodeIns = get_stat_val(the_stat) -
800
+					context->startingInStatusCodeValue;
802 801
 			}
803 802
 
804 803
 			snmp_set_var_typed_value(var, ASN_COUNTER,
... ...
@@ -817,7 +816,7 @@ int openserSIPStatusCodesTable_get_value(
817 816
 			{
818 817
 				/* Calculate the Delta */
819 818
 				context->openserSIPStatusCodeOuts =
820
-					*(long *)the_stat->u.val - 
819
+					get_stat_val(the_stat) -
821 820
 					context->startingOutStatusCodeValue;
822 821
 			}
823 822
 			snmp_set_var_typed_value(var, ASN_COUNTER,