Module: sip-router Branch: master Commit: 17e94fd7535f541438e09d9536c8b2767e397f13 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=17e94fd7...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Sun Apr 10 12:41:11 2011 +0200
snmpstats(k): enable cfg framework for module's extra process
---
modules_k/snmpstats/snmpstats.c | 7 +++++++ modules_k/snmpstats/sub_agent.c | 4 ++++ 2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/modules_k/snmpstats/snmpstats.c b/modules_k/snmpstats/snmpstats.c index 1994876..37dc829 100644 --- a/modules_k/snmpstats/snmpstats.c +++ b/modules_k/snmpstats/snmpstats.c @@ -79,6 +79,7 @@ #include "snmpstats.h" #include "snmpstats_globals.h" #include "../../timer.h" +#include "../../cfg/cfg_struct.h"
#include <net-snmp/net-snmp-config.h> #include <net-snmp/net-snmp-includes.h> @@ -340,6 +341,8 @@ static int mod_init(void)
/* add space for one extra process */ register_procs(1); + /* add child to update local config framework structures */ + cfg_register_child(1);
return 0; } @@ -363,6 +366,10 @@ static int mod_child_init(int rank) return -1; /* error */ if(pid==0){ /* child */ + /* initialize the config framework */ + if (cfg_child_init()) + return -1; + agentx_child(1); return 0; } diff --git a/modules_k/snmpstats/sub_agent.c b/modules_k/snmpstats/sub_agent.c index 24273ec..d35a3de 100644 --- a/modules_k/snmpstats/sub_agent.c +++ b/modules_k/snmpstats/sub_agent.c @@ -65,6 +65,7 @@ #include "snmpMIBNotifications.h"
#include "../../dprint.h" +#include "../../cfg/cfg_struct.h"
static int keep_running;
@@ -110,6 +111,9 @@ static int initialize_agentx(void) keep_running = 1;
while(keep_running) { + /* update the local config framework structures */ + cfg_update(); + agent_check_and_process(1); /* 0 == don't block */ }