Browse Source

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 15 năm trước cách đây
mục cha
commit
5cac9a1836
1 tập tin đã thay đổi với 5 bổ sung6 xóa
  1. 5 6
      modules_k/snmpstats/snmpSIPStatusCodesTable.c

+ 5 - 6
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,