41 #define MODULE_DESCRIPTION "SNMP [Sub]Agent for Asterisk"
43 int res_snmp_agentx_subagent;
44 int res_snmp_dont_stop;
45 static int res_snmp_enabled;
47 static pthread_t
thread = AST_PTHREADT_NULL;
61 res_snmp_agentx_subagent = 1;
63 if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEINVALID) {
64 ast_log(LOG_WARNING,
"Could not load res_snmp.conf\n");
69 var = ast_variable_browse(cfg, cat);
71 if (strcasecmp(cat,
"general") == 0) {
73 if (strcasecmp(var->
name,
"subagent") == 0) {
75 res_snmp_agentx_subagent = 1;
77 res_snmp_agentx_subagent = 0;
79 ast_log(LOG_ERROR,
"Value '%s' does not evaluate to true or false.\n", var->
value);
83 }
else if (strcasecmp(var->
name,
"enabled") == 0) {
86 ast_log(LOG_ERROR,
"Unrecognized variable '%s' in category '%s'\n", var->
name, cat);
93 ast_log(LOG_ERROR,
"Unrecognized category '%s'\n", cat);
119 ast_verb(1,
"Loading [Sub]Agent Module\n");
121 res_snmp_dont_stop = 1;
122 if (res_snmp_enabled)
123 return ast_pthread_create_background(&
thread, NULL, agent_thread, NULL);
128 static int unload_module(
void)
130 ast_verb(1,
"Unloading [Sub]Agent Module\n");
132 res_snmp_dont_stop = 0;
133 return ((thread != AST_PTHREADT_NULL) ? pthread_join(thread, NULL) : 0);
136 AST_MODULE_INFO(
ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT,
"SNMP [Sub]Agent for Asterisk",
137 .support_level = AST_MODULE_SUPPORT_EXTENDED,
139 .unload = unload_module,
struct ast_variable * next
Asterisk main include file. File version handling, generic pbx functions.
Structure for variables, used for configurations and for channel variables.
static int load_config(void)
Load res_snmp.conf config file.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
#define ast_config_load(filename, flags)
Load a config file.
General Asterisk PBX channel definitions.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
Module has failed to load, may be in an inconsistent state.
Structure used to handle boolean flags.
SNMP Agent / SubAgent support for Asterisk.
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"...
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
static int load_module(void)
Load the module.