Asterisk - The Open Source Telephony Project
18.5.0
|
SNMP Agent / SubAgent support for Asterisk. More...
#include "asterisk.h"
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "asterisk/paths.h"
#include "asterisk/channel.h"
#include "asterisk/logger.h"
#include "asterisk/options.h"
#include "asterisk/indications.h"
#include "asterisk/ast_version.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "agent.h"
Go to the source code of this file.
Functions | |
void * | agent_thread (void *arg) |
static u_char * | ast_var_channel_bridge (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method) |
static u_char * | ast_var_channel_types (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method) |
static u_char * | ast_var_channel_types_table (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method) |
static u_char * | ast_var_channels (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method) |
static u_char * | ast_var_channels_table (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method) |
static u_char * | ast_var_Config (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method) |
static u_char * | ast_var_indications (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method) |
static u_char * | ast_var_indications_table (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method) |
static u_char * | ast_var_Modules (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method) |
static u_char * | ast_var_Version (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method) |
static int | countmodule (const char *mod, const char *desc, int use, const char *status, const char *like, enum ast_module_support_level support_level) |
int | header_generic (struct variable *, oid *, size_t *, int, size_t *, WriteMethod **) |
int | header_simple_table (struct variable *, oid *, size_t *, int, size_t *, WriteMethod **, int) |
static void | init_asterisk_mib (void) |
int | register_sysORTable (oid *, size_t, const char *) |
static int | term_asterisk_mib (int majorID, int minorID, void *serverarg, void *clientarg) |
int | unregister_sysORTable (oid *, size_t) |
Variables | |
static oid | asterisk_oid [] = { 1, 3, 6, 1, 4, 1, 22736, 1 } |
SNMP Agent / SubAgent support for Asterisk.
Definition in file agent.c.
#define ASTCHANACCOUNTCODE 18 |
Definition at line 150 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANADSI 36 |
Definition at line 168 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANAMAFLAGS 35 |
Definition at line 167 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANAPP 10 |
Definition at line 142 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANBRIDGE 6 |
Definition at line 138 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANBRIDGECOUNT 1 |
Definition at line 187 of file agent.c.
Referenced by ast_var_channel_bridge(), and init_asterisk_mib().
#define ASTCHANCALLGROUP 21 |
Definition at line 153 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDANI 29 |
Definition at line 161 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDANI2 32 |
Definition at line 164 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDDNID 26 |
Definition at line 158 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDNAME 28 |
Definition at line 160 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDNUM 27 |
Definition at line 159 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDPRES 31 |
Definition at line 163 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDRDNIS 30 |
Definition at line 162 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDTNS 34 |
Definition at line 166 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDTON 33 |
Definition at line 165 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCONTEXT 12 |
Definition at line 144 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCOUNT 1 |
Definition at line 130 of file agent.c.
Referenced by ast_var_channels(), and init_asterisk_mib().
#define ASTCHANDATA 11 |
Definition at line 143 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANEXTEN 16 |
Definition at line 148 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANFLAGS 40 |
Definition at line 172 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANFORWARDTO 19 |
Definition at line 151 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANHANGUPCAUSE 38 |
Definition at line 170 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANINDEX 1 |
Definition at line 133 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANLANGUAGE 3 |
Definition at line 135 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANMACROCONTEXT 13 |
Definition at line 145 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANMACROEXTEN 14 |
Definition at line 146 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANMACROPRI 15 |
Definition at line 147 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANMASQ 7 |
Definition at line 139 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANMASQR 8 |
Definition at line 140 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANMUSICCLASS 5 |
Definition at line 137 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANMUTED 24 |
Definition at line 156 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANNAME 2 |
Definition at line 134 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANNELS 5 |
Definition at line 129 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTCHANPICKUPGROUP 22 |
Definition at line 154 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANPRI 17 |
Definition at line 149 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANRINGS 25 |
Definition at line 157 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANSCALARS 5 |
Definition at line 186 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTCHANSTATE 23 |
Definition at line 155 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANTABLE 2 |
Definition at line 132 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTCHANTONEZONE 37 |
Definition at line 169 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANTRANSFERCAP 41 |
Definition at line 173 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANTYPE 4 |
Definition at line 136 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANTYPECHANNELS 7 |
Definition at line 184 of file agent.c.
Referenced by ast_var_channel_types_table(), and init_asterisk_mib().
#define ASTCHANTYPECOUNT 3 |
Definition at line 175 of file agent.c.
Referenced by ast_var_channel_types(), and init_asterisk_mib().
#define ASTCHANTYPEDESC 3 |
Definition at line 180 of file agent.c.
Referenced by ast_var_channel_types_table(), and init_asterisk_mib().
#define ASTCHANTYPEDEVSTATE 4 |
Definition at line 181 of file agent.c.
Referenced by ast_var_channel_types_table(), and init_asterisk_mib().
#define ASTCHANTYPEINDEX 1 |
Definition at line 178 of file agent.c.
Referenced by ast_var_channel_types_table(), and init_asterisk_mib().
#define ASTCHANTYPEINDICATIONS 5 |
Definition at line 182 of file agent.c.
Referenced by ast_var_channel_types_table(), and init_asterisk_mib().
#define ASTCHANTYPENAME 2 |
Definition at line 179 of file agent.c.
Referenced by ast_var_channel_types_table(), and init_asterisk_mib().
#define ASTCHANTYPETABLE 4 |
Definition at line 177 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTCHANTYPETRANSFER 6 |
Definition at line 183 of file agent.c.
Referenced by ast_var_channel_types_table(), and init_asterisk_mib().
#define ASTCHANUNIQUEID 20 |
Definition at line 152 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANVARIABLES 39 |
Definition at line 171 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANWHENHANGUP 9 |
Definition at line 141 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCONFACTIVECALLS 5 |
Definition at line 113 of file agent.c.
Referenced by ast_var_Config(), and init_asterisk_mib().
#define ASTCONFIGURATION 2 |
Definition at line 108 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTCONFPID 3 |
Definition at line 111 of file agent.c.
Referenced by ast_var_Config(), and init_asterisk_mib().
#define ASTCONFPROCESSEDCALLS 6 |
Definition at line 114 of file agent.c.
Referenced by ast_var_Config(), and init_asterisk_mib().
#define ASTCONFRELOADTIME 2 |
Definition at line 110 of file agent.c.
Referenced by ast_var_Config(), and init_asterisk_mib().
#define ASTCONFSOCKET 4 |
Definition at line 112 of file agent.c.
Referenced by ast_var_Config(), and init_asterisk_mib().
#define ASTCONFUPTIME 1 |
Definition at line 109 of file agent.c.
Referenced by ast_var_Config(), and init_asterisk_mib().
#define ASTINDALIAS 3 |
Definition at line 126 of file agent.c.
Referenced by ast_var_indications_table(), and init_asterisk_mib().
#define ASTINDCOUNT 1 |
Definition at line 120 of file agent.c.
Referenced by ast_var_indications(), and init_asterisk_mib().
#define ASTINDCOUNTRY 2 |
Definition at line 125 of file agent.c.
Referenced by ast_var_indications_table(), and init_asterisk_mib().
#define ASTINDCURRENT 2 |
Definition at line 121 of file agent.c.
Referenced by ast_var_indications(), and init_asterisk_mib().
#define ASTINDDESCRIPTION 4 |
Definition at line 127 of file agent.c.
Referenced by ast_var_indications_table(), and init_asterisk_mib().
#define ASTINDICATIONS 4 |
Definition at line 119 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTINDINDEX 1 |
Definition at line 124 of file agent.c.
Referenced by ast_var_indications_table(), and init_asterisk_mib().
#define ASTINDTABLE 3 |
Definition at line 123 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTMM_LIBC ASTMM_IGNORE |
#define ASTMODCOUNT 1 |
Definition at line 117 of file agent.c.
Referenced by ast_var_Modules(), and init_asterisk_mib().
#define ASTMODULES 3 |
Definition at line 116 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTVERSION 1 |
Definition at line 104 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTVERSTRING 1 |
Definition at line 105 of file agent.c.
Referenced by ast_var_Version(), and init_asterisk_mib().
#define ASTVERTAG 2 |
Definition at line 106 of file agent.c.
Referenced by ast_var_Version(), and init_asterisk_mib().
#define unload_module ast_unload_module |
Definition at line 79 of file agent.c.
Referenced by load_values_config().
void* agent_thread | ( | void * | arg | ) |
Definition at line 189 of file agent.c.
References ast_verb, init_asterisk_mib(), NULL, res_snmp_agentx_subagent, and res_snmp_dont_stop.
Referenced by load_module().
|
static |
Definition at line 605 of file agent.c.
References ast_channel_is_bridged(), ast_channel_iterator_all_new(), ast_channel_iterator_destroy(), ast_channel_iterator_next(), ast_channel_lock, ast_channel_unlock, ast_channel_unref, ASTCHANBRIDGECOUNT, header_generic(), and NULL.
Referenced by init_asterisk_mib().
|
static |
Definition at line 519 of file agent.c.
References ast_channeltype_list(), ast_variables_destroy(), ASTCHANTYPECOUNT, header_generic(), ast_variable::next, and NULL.
Referenced by init_asterisk_mib().
|
static |
Definition at line 538 of file agent.c.
References ast_channel_iterator_all_new(), ast_channel_iterator_destroy(), ast_channel_iterator_next(), ast_channel_tech(), ast_channel_unref, ast_channeltype_list(), ast_get_channel_tech(), ast_variables_destroy(), ASTCHANTYPECHANNELS, ASTCHANTYPEDESC, ASTCHANTYPEDEVSTATE, ASTCHANTYPEINDEX, ASTCHANTYPEINDICATIONS, ASTCHANTYPENAME, ASTCHANTYPETRANSFER, ast_channel_tech::description, ast_channel_tech::devicestate, header_simple_table(), ast_channel_tech::indicate, ast_variable::name, ast_variable::next, NULL, ast_channel_tech::transfer, and ast_channel_tech::type.
Referenced by init_asterisk_mib().
|
static |
Definition at line 220 of file agent.c.
References ast_active_channels(), ASTCHANCOUNT, header_generic(), and NULL.
Referenced by init_asterisk_mib().
|
static |
Definition at line 236 of file agent.c.
References ast_party_caller::ani, ast_party_caller::ani2, ast_active_channels(), ast_channel_accountcode(), ast_channel_amaflags(), ast_channel_appl(), ast_channel_bridge_peer(), ast_channel_call_forward(), ast_channel_caller(), ast_channel_callgroup(), ast_channel_context(), ast_channel_data(), ast_channel_dialed(), ast_channel_exten(), ast_channel_flags(), ast_channel_hangupcause(), ast_channel_iterator_all_new(), ast_channel_iterator_destroy(), ast_channel_iterator_next(), ast_channel_language(), ast_channel_lock, ast_channel_macrocontext(), ast_channel_macroexten(), ast_channel_macropriority(), ast_channel_masq(), ast_channel_masqr(), ast_channel_musicclass(), ast_channel_name(), ast_channel_pickupgroup(), ast_channel_priority(), ast_channel_redirecting(), ast_channel_rings(), ast_channel_tech(), ast_channel_transfercapability(), ast_channel_uniqueid(), ast_channel_unlock, ast_channel_unref, ast_channel_whentohangup(), ast_channel_zone(), ast_copy_string(), ast_party_id_presentation(), AST_STATE_MUTE, ast_str_alloca, ast_str_buffer(), ast_str_strlen(), ast_strlen_zero, ast_tvzero(), ASTCHANACCOUNTCODE, ASTCHANADSI, ASTCHANAMAFLAGS, ASTCHANAPP, ASTCHANBRIDGE, ASTCHANCALLGROUP, ASTCHANCIDANI, ASTCHANCIDANI2, ASTCHANCIDDNID, ASTCHANCIDNAME, ASTCHANCIDNUM, ASTCHANCIDPRES, ASTCHANCIDRDNIS, ASTCHANCIDTNS, ASTCHANCIDTON, ASTCHANCONTEXT, ASTCHANDATA, ASTCHANEXTEN, ASTCHANFLAGS, ASTCHANFORWARDTO, ASTCHANHANGUPCAUSE, ASTCHANINDEX, ASTCHANLANGUAGE, ASTCHANMACROCONTEXT, ASTCHANMACROEXTEN, ASTCHANMACROPRI, ASTCHANMASQ, ASTCHANMASQR, ASTCHANMUSICCLASS, ASTCHANMUTED, ASTCHANNAME, ASTCHANPICKUPGROUP, ASTCHANPRI, ASTCHANRINGS, ASTCHANSTATE, ASTCHANTONEZONE, ASTCHANTRANSFERCAP, ASTCHANTYPE, ASTCHANUNIQUEID, ASTCHANVARIABLES, ASTCHANWHENHANGUP, country, ast_party_redirecting::from, header_simple_table(), ast_party_caller::id, ast_party_id::name, NULL, ast_party_id::number, ast_party_dialed::number, out, pbx_builtin_serialize_variables(), ast_party_number::plan, ast_party_name::str, ast_party_number::str, ast_party_dialed::str, ast_party_dialed::transit_network_select, type, ast_party_name::valid, and ast_party_number::valid.
Referenced by init_asterisk_mib().
|
static |
Definition at line 638 of file agent.c.
References ast_active_calls(), ast_config_AST_SOCKET, ast_lastreloadtime, ast_processed_calls(), ast_startuptime, ASTCONFACTIVECALLS, ASTCONFPID, ASTCONFPROCESSEDCALLS, ASTCONFRELOADTIME, ASTCONFSOCKET, ASTCONFUPTIME, header_generic(), and NULL.
Referenced by init_asterisk_mib().
|
static |
Definition at line 677 of file agent.c.
References ao2_iterator_destroy(), ao2_iterator_next, ast_copy_string(), ast_get_indication_zone(), ast_tone_zone_iterator_init(), ast_tone_zone_unref(), ASTINDCOUNT, ASTINDCURRENT, ast_tone_zone::country, header_generic(), NULL, and tz.
Referenced by init_asterisk_mib().
|
static |
Definition at line 719 of file agent.c.
References ao2_iterator_destroy(), ao2_iterator_next, ast_copy_string(), ast_tone_zone_iterator_init(), ast_tone_zone_lock, ast_tone_zone_unlock, ast_tone_zone_unref(), ASTINDALIAS, ASTINDCOUNTRY, ASTINDDESCRIPTION, ASTINDINDEX, ast_tone_zone::country, ast_tone_zone::description, header_simple_table(), NULL, and tz.
Referenced by init_asterisk_mib().
|
static |
Definition at line 780 of file agent.c.
References ast_update_module_list(), ASTMODCOUNT, countmodule(), header_generic(), and NULL.
Referenced by init_asterisk_mib().
|
static |
Definition at line 796 of file agent.c.
References ast_get_version(), ast_get_version_num(), ASTVERSTRING, ASTVERTAG, header_generic(), NULL, and version.
Referenced by init_asterisk_mib().
|
static |
int header_generic | ( | struct variable * | , |
oid * | , | ||
size_t * | , | ||
int | , | ||
size_t * | , | ||
WriteMethod ** | |||
) |
int header_simple_table | ( | struct variable * | , |
oid * | , | ||
size_t * | , | ||
int | , | ||
size_t * | , | ||
WriteMethod ** | , | ||
int | |||
) |
Referenced by ast_var_channel_types_table(), ast_var_channels_table(), and ast_var_indications_table().
|
static |
Definition at line 826 of file agent.c.
References ast_var_channel_bridge(), ast_var_channel_types(), ast_var_channel_types_table(), ast_var_channels(), ast_var_channels_table(), ast_var_Config(), ast_var_indications(), ast_var_indications_table(), ast_var_Modules(), ast_var_Version(), ASTCHANACCOUNTCODE, ASTCHANADSI, ASTCHANAMAFLAGS, ASTCHANAPP, ASTCHANBRIDGE, ASTCHANBRIDGECOUNT, ASTCHANCALLGROUP, ASTCHANCIDANI, ASTCHANCIDANI2, ASTCHANCIDDNID, ASTCHANCIDNAME, ASTCHANCIDNUM, ASTCHANCIDPRES, ASTCHANCIDRDNIS, ASTCHANCIDTNS, ASTCHANCIDTON, ASTCHANCONTEXT, ASTCHANCOUNT, ASTCHANDATA, ASTCHANEXTEN, ASTCHANFLAGS, ASTCHANFORWARDTO, ASTCHANHANGUPCAUSE, ASTCHANINDEX, ASTCHANLANGUAGE, ASTCHANMACROCONTEXT, ASTCHANMACROEXTEN, ASTCHANMACROPRI, ASTCHANMASQ, ASTCHANMASQR, ASTCHANMUSICCLASS, ASTCHANMUTED, ASTCHANNAME, ASTCHANNELS, ASTCHANPICKUPGROUP, ASTCHANPRI, ASTCHANRINGS, ASTCHANSCALARS, ASTCHANSTATE, ASTCHANTABLE, ASTCHANTONEZONE, ASTCHANTRANSFERCAP, ASTCHANTYPE, ASTCHANTYPECHANNELS, ASTCHANTYPECOUNT, ASTCHANTYPEDESC, ASTCHANTYPEDEVSTATE, ASTCHANTYPEINDEX, ASTCHANTYPEINDICATIONS, ASTCHANTYPENAME, ASTCHANTYPETABLE, ASTCHANTYPETRANSFER, ASTCHANUNIQUEID, ASTCHANVARIABLES, ASTCHANWHENHANGUP, ASTCONFACTIVECALLS, ASTCONFIGURATION, ASTCONFPID, ASTCONFPROCESSEDCALLS, ASTCONFRELOADTIME, ASTCONFSOCKET, ASTCONFUPTIME, asterisk_oid, ASTINDALIAS, ASTINDCOUNT, ASTINDCOUNTRY, ASTINDCURRENT, ASTINDDESCRIPTION, ASTINDICATIONS, ASTINDINDEX, ASTINDTABLE, ASTMODCOUNT, ASTMODULES, ASTVERSION, ASTVERSTRING, ASTVERTAG, NULL, register_sysORTable(), and term_asterisk_mib().
Referenced by agent_thread().
int register_sysORTable | ( | oid * | , |
size_t | , | ||
const char * | |||
) |
Referenced by init_asterisk_mib().
|
static |
Definition at line 820 of file agent.c.
References asterisk_oid, and unregister_sysORTable().
Referenced by init_asterisk_mib().
int unregister_sysORTable | ( | oid * | , |
size_t | |||
) |
Referenced by term_asterisk_mib().
|
static |
Definition at line 97 of file agent.c.
Referenced by init_asterisk_mib(), and term_asterisk_mib().