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.
Defines | |
#define | ASTCHANACCOUNTCODE 18 |
#define | ASTCHANADSI 36 |
#define | ASTCHANAMAFLAGS 35 |
#define | ASTCHANAPP 10 |
#define | ASTCHANBRIDGE 6 |
#define | ASTCHANBRIDGECOUNT 1 |
#define | ASTCHANCALLGROUP 21 |
#define | ASTCHANCIDANI 29 |
#define | ASTCHANCIDANI2 32 |
#define | ASTCHANCIDDNID 26 |
#define | ASTCHANCIDNAME 28 |
#define | ASTCHANCIDNUM 27 |
#define | ASTCHANCIDPRES 31 |
#define | ASTCHANCIDRDNIS 30 |
#define | ASTCHANCIDTNS 34 |
#define | ASTCHANCIDTON 33 |
#define | ASTCHANCONTEXT 12 |
#define | ASTCHANCOUNT 1 |
#define | ASTCHANDATA 11 |
#define | ASTCHANEXTEN 16 |
#define | ASTCHANFLAGS 40 |
#define | ASTCHANFORWARDTO 19 |
#define | ASTCHANHANGUPCAUSE 38 |
#define | ASTCHANINDEX 1 |
#define | ASTCHANLANGUAGE 3 |
#define | ASTCHANMACROCONTEXT 13 |
#define | ASTCHANMACROEXTEN 14 |
#define | ASTCHANMACROPRI 15 |
#define | ASTCHANMASQ 7 |
#define | ASTCHANMASQR 8 |
#define | ASTCHANMUSICCLASS 5 |
#define | ASTCHANMUTED 24 |
#define | ASTCHANNAME 2 |
#define | ASTCHANNELS 5 |
#define | ASTCHANPICKUPGROUP 22 |
#define | ASTCHANPRI 17 |
#define | ASTCHANRINGS 25 |
#define | ASTCHANSCALARS 5 |
#define | ASTCHANSTATE 23 |
#define | ASTCHANTABLE 2 |
#define | ASTCHANTONEZONE 37 |
#define | ASTCHANTRANSFERCAP 41 |
#define | ASTCHANTYPE 4 |
#define | ASTCHANTYPECHANNELS 7 |
#define | ASTCHANTYPECOUNT 3 |
#define | ASTCHANTYPEDESC 3 |
#define | ASTCHANTYPEDEVSTATE 4 |
#define | ASTCHANTYPEINDEX 1 |
#define | ASTCHANTYPEINDICATIONS 5 |
#define | ASTCHANTYPENAME 2 |
#define | ASTCHANTYPETABLE 4 |
#define | ASTCHANTYPETRANSFER 6 |
#define | ASTCHANUNIQUEID 20 |
#define | ASTCHANVARIABLES 39 |
#define | ASTCHANWHENHANGUP 9 |
#define | ASTCONFACTIVECALLS 5 |
#define | ASTCONFIGURATION 2 |
#define | ASTCONFPID 3 |
#define | ASTCONFPROCESSEDCALLS 6 |
#define | ASTCONFRELOADTIME 2 |
#define | ASTCONFSOCKET 4 |
#define | ASTCONFUPTIME 1 |
#define | ASTINDALIAS 3 |
#define | ASTINDCOUNT 1 |
#define | ASTINDCOUNTRY 2 |
#define | ASTINDCURRENT 2 |
#define | ASTINDDESCRIPTION 4 |
#define | ASTINDICATIONS 4 |
#define | ASTINDINDEX 1 |
#define | ASTINDTABLE 3 |
#define | ASTMODCOUNT 1 |
#define | ASTMODULES 3 |
#define | ASTVERSION 1 |
#define | ASTVERSTRING 1 |
#define | ASTVERTAG 2 |
#define | HAVE_DMALLOC_H 0 |
#define | unload_module ast_unload_module |
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 *like) |
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 146 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANADSI 36 |
Definition at line 164 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANAMAFLAGS 35 |
Definition at line 163 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANAPP 10 |
Definition at line 138 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANBRIDGE 6 |
Definition at line 134 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANBRIDGECOUNT 1 |
Definition at line 183 of file agent.c.
Referenced by ast_var_channel_bridge(), and init_asterisk_mib().
#define ASTCHANCALLGROUP 21 |
Definition at line 149 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDANI 29 |
Definition at line 157 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDANI2 32 |
Definition at line 160 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDDNID 26 |
Definition at line 154 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDNAME 28 |
Definition at line 156 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDNUM 27 |
Definition at line 155 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDPRES 31 |
Definition at line 159 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDRDNIS 30 |
Definition at line 158 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDTNS 34 |
Definition at line 162 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCIDTON 33 |
Definition at line 161 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCONTEXT 12 |
Definition at line 140 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANCOUNT 1 |
Definition at line 126 of file agent.c.
Referenced by ast_var_channels(), and init_asterisk_mib().
#define ASTCHANDATA 11 |
Definition at line 139 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANEXTEN 16 |
Definition at line 144 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANFLAGS 40 |
Definition at line 168 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANFORWARDTO 19 |
Definition at line 147 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANHANGUPCAUSE 38 |
Definition at line 166 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANINDEX 1 |
Definition at line 129 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANLANGUAGE 3 |
Definition at line 131 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANMACROCONTEXT 13 |
Definition at line 141 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANMACROEXTEN 14 |
Definition at line 142 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANMACROPRI 15 |
Definition at line 143 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANMASQ 7 |
Definition at line 135 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANMASQR 8 |
Definition at line 136 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANMUSICCLASS 5 |
Definition at line 133 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANMUTED 24 |
Definition at line 152 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANNAME 2 |
Definition at line 130 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANNELS 5 |
Definition at line 125 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTCHANPICKUPGROUP 22 |
Definition at line 150 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANPRI 17 |
Definition at line 145 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANRINGS 25 |
Definition at line 153 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANSCALARS 5 |
Definition at line 182 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTCHANSTATE 23 |
Definition at line 151 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANTABLE 2 |
Definition at line 128 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTCHANTONEZONE 37 |
Definition at line 165 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANTRANSFERCAP 41 |
Definition at line 169 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANTYPE 4 |
Definition at line 132 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANTYPECHANNELS 7 |
Definition at line 180 of file agent.c.
Referenced by ast_var_channel_types_table(), and init_asterisk_mib().
#define ASTCHANTYPECOUNT 3 |
Definition at line 171 of file agent.c.
Referenced by ast_var_channel_types(), and init_asterisk_mib().
#define ASTCHANTYPEDESC 3 |
Definition at line 176 of file agent.c.
Referenced by ast_var_channel_types_table(), and init_asterisk_mib().
#define ASTCHANTYPEDEVSTATE 4 |
Definition at line 177 of file agent.c.
Referenced by ast_var_channel_types_table(), and init_asterisk_mib().
#define ASTCHANTYPEINDEX 1 |
Definition at line 174 of file agent.c.
Referenced by ast_var_channel_types_table(), and init_asterisk_mib().
#define ASTCHANTYPEINDICATIONS 5 |
Definition at line 178 of file agent.c.
Referenced by ast_var_channel_types_table(), and init_asterisk_mib().
#define ASTCHANTYPENAME 2 |
Definition at line 175 of file agent.c.
Referenced by ast_var_channel_types_table(), and init_asterisk_mib().
#define ASTCHANTYPETABLE 4 |
Definition at line 173 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTCHANTYPETRANSFER 6 |
Definition at line 179 of file agent.c.
Referenced by ast_var_channel_types_table(), and init_asterisk_mib().
#define ASTCHANUNIQUEID 20 |
Definition at line 148 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANVARIABLES 39 |
Definition at line 167 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCHANWHENHANGUP 9 |
Definition at line 137 of file agent.c.
Referenced by ast_var_channels_table(), and init_asterisk_mib().
#define ASTCONFACTIVECALLS 5 |
Definition at line 109 of file agent.c.
Referenced by ast_var_Config(), and init_asterisk_mib().
#define ASTCONFIGURATION 2 |
Definition at line 104 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTCONFPID 3 |
Definition at line 107 of file agent.c.
Referenced by ast_var_Config(), and init_asterisk_mib().
#define ASTCONFPROCESSEDCALLS 6 |
Definition at line 110 of file agent.c.
Referenced by ast_var_Config(), and init_asterisk_mib().
#define ASTCONFRELOADTIME 2 |
Definition at line 106 of file agent.c.
Referenced by ast_var_Config(), and init_asterisk_mib().
#define ASTCONFSOCKET 4 |
Definition at line 108 of file agent.c.
Referenced by ast_var_Config(), and init_asterisk_mib().
#define ASTCONFUPTIME 1 |
Definition at line 105 of file agent.c.
Referenced by ast_var_Config(), and init_asterisk_mib().
#define ASTINDALIAS 3 |
Definition at line 122 of file agent.c.
Referenced by ast_var_indications_table(), and init_asterisk_mib().
#define ASTINDCOUNT 1 |
Definition at line 116 of file agent.c.
Referenced by ast_var_indications(), and init_asterisk_mib().
#define ASTINDCOUNTRY 2 |
Definition at line 121 of file agent.c.
Referenced by ast_var_indications_table(), and init_asterisk_mib().
#define ASTINDCURRENT 2 |
Definition at line 117 of file agent.c.
Referenced by ast_var_indications(), and init_asterisk_mib().
#define ASTINDDESCRIPTION 4 |
Definition at line 123 of file agent.c.
Referenced by ast_var_indications_table(), and init_asterisk_mib().
#define ASTINDICATIONS 4 |
Definition at line 115 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTINDINDEX 1 |
Definition at line 120 of file agent.c.
Referenced by ast_var_indications_table(), and init_asterisk_mib().
#define ASTINDTABLE 3 |
Definition at line 119 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTMODCOUNT 1 |
Definition at line 113 of file agent.c.
Referenced by ast_var_Modules(), and init_asterisk_mib().
#define ASTMODULES 3 |
Definition at line 112 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTVERSION 1 |
Definition at line 100 of file agent.c.
Referenced by init_asterisk_mib().
#define ASTVERSTRING 1 |
Definition at line 101 of file agent.c.
Referenced by ast_var_Version(), and init_asterisk_mib().
#define ASTVERTAG 2 |
Definition at line 102 of file agent.c.
Referenced by ast_var_Version(), and init_asterisk_mib().
#define unload_module ast_unload_module |
Definition at line 75 of file agent.c.
Referenced by config_module(), and load_module().
void* agent_thread | ( | void * | arg | ) |
Definition at line 185 of file agent.c.
References ast_verb, init_asterisk_mib(), res_snmp_agentx_subagent, and res_snmp_dont_stop.
Referenced by load_module().
00186 { 00187 ast_verb(2, "Starting %sAgent\n", res_snmp_agentx_subagent ? "Sub" : ""); 00188 00189 snmp_enable_stderrlog(); 00190 00191 if (res_snmp_agentx_subagent) 00192 netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 00193 NETSNMP_DS_AGENT_ROLE, 00194 1); 00195 00196 init_agent("asterisk"); 00197 00198 init_asterisk_mib(); 00199 00200 init_snmp("asterisk"); 00201 00202 if (!res_snmp_agentx_subagent) 00203 init_master_agent(); 00204 00205 while (res_snmp_dont_stop) 00206 agent_check_and_process(1); 00207 00208 snmp_shutdown("asterisk"); 00209 00210 ast_verb(2, "Terminating %sAgent\n", res_snmp_agentx_subagent ? "Sub" : ""); 00211 00212 return NULL; 00213 }
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] |
Definition at line 616 of file agent.c.
References ast_bridged_channel(), ast_channel_iterator_all_new(), ast_channel_iterator_destroy(), ast_channel_iterator_next(), ast_channel_lock, ast_channel_unlock, ast_channel_unref, ASTCHANBRIDGECOUNT, and header_generic().
Referenced by init_asterisk_mib().
00618 { 00619 static unsigned long long_ret; 00620 struct ast_channel *chan = NULL; 00621 struct ast_channel_iterator *iter; 00622 00623 long_ret = 0; 00624 00625 if (header_generic(vp, name, length, exact, var_len, write_method)) { 00626 return NULL; 00627 } 00628 00629 if (!(iter = ast_channel_iterator_all_new())) { 00630 return NULL; 00631 } 00632 00633 while ((chan = ast_channel_iterator_next(iter))) { 00634 ast_channel_lock(chan); 00635 if (ast_bridged_channel(chan)) { 00636 long_ret++; 00637 } 00638 ast_channel_unlock(chan); 00639 chan = ast_channel_unref(chan); 00640 } 00641 00642 ast_channel_iterator_destroy(iter); 00643 00644 *var_len = sizeof(long_ret); 00645 00646 return (vp->magic == ASTCHANBRIDGECOUNT) ? (u_char *) &long_ret : NULL; 00647 }
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] |
Definition at line 530 of file agent.c.
References ast_channeltype_list(), ast_variables_destroy(), ASTCHANTYPECOUNT, header_generic(), and ast_variable::next.
Referenced by init_asterisk_mib().
00532 { 00533 static unsigned long long_ret; 00534 struct ast_variable *channel_types, *next; 00535 00536 if (header_generic(vp, name, length, exact, var_len, write_method)) 00537 return NULL; 00538 00539 if (vp->magic != ASTCHANTYPECOUNT) 00540 return NULL; 00541 00542 for (long_ret = 0, channel_types = next = ast_channeltype_list(); next; next = next->next) 00543 long_ret++; 00544 ast_variables_destroy(channel_types); 00545 00546 return (u_char *)&long_ret; 00547 }
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] |
Definition at line 549 of file agent.c.
References ast_channel_iterator_all_new(), ast_channel_iterator_destroy(), ast_channel_iterator_next(), 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, ast_channel::tech, ast_channel_tech::transfer, and ast_channel_tech::type.
Referenced by init_asterisk_mib().
00551 { 00552 const struct ast_channel_tech *tech = NULL; 00553 struct ast_variable *channel_types, *next; 00554 static unsigned long long_ret; 00555 struct ast_channel *chan; 00556 u_long i; 00557 00558 if (header_simple_table(vp, name, length, exact, var_len, write_method, -1)) 00559 return NULL; 00560 00561 channel_types = ast_channeltype_list(); 00562 for (i = 1, next = channel_types; next && i != name[*length - 1]; next = next->next, i++) 00563 ; 00564 if (next != NULL) 00565 tech = ast_get_channel_tech(next->name); 00566 ast_variables_destroy(channel_types); 00567 if (next == NULL || tech == NULL) 00568 return NULL; 00569 00570 switch (vp->magic) { 00571 case ASTCHANTYPEINDEX: 00572 long_ret = name[*length - 1]; 00573 return (u_char *)&long_ret; 00574 case ASTCHANTYPENAME: 00575 *var_len = strlen(tech->type); 00576 return (u_char *)tech->type; 00577 case ASTCHANTYPEDESC: 00578 *var_len = strlen(tech->description); 00579 return (u_char *)tech->description; 00580 case ASTCHANTYPEDEVSTATE: 00581 long_ret = tech->devicestate ? 1 : 2; 00582 return (u_char *)&long_ret; 00583 case ASTCHANTYPEINDICATIONS: 00584 long_ret = tech->indicate ? 1 : 2; 00585 return (u_char *)&long_ret; 00586 case ASTCHANTYPETRANSFER: 00587 long_ret = tech->transfer ? 1 : 2; 00588 return (u_char *)&long_ret; 00589 case ASTCHANTYPECHANNELS: 00590 { 00591 struct ast_channel_iterator *iter; 00592 00593 long_ret = 0; 00594 00595 if (!(iter = ast_channel_iterator_all_new())) { 00596 return NULL; 00597 } 00598 00599 while ((chan = ast_channel_iterator_next(iter))) { 00600 if (chan->tech == tech) { 00601 long_ret++; 00602 } 00603 chan = ast_channel_unref(chan); 00604 } 00605 00606 ast_channel_iterator_destroy(iter); 00607 00608 return (u_char *)&long_ret; 00609 } 00610 default: 00611 break; 00612 } 00613 return NULL; 00614 }
static u_char* ast_var_channels | ( | struct variable * | vp, | |
oid * | name, | |||
size_t * | length, | |||
int | exact, | |||
size_t * | var_len, | |||
WriteMethod ** | write_method | |||
) | [static] |
Definition at line 216 of file agent.c.
References ast_active_channels(), ASTCHANCOUNT, and header_generic().
Referenced by init_asterisk_mib().
00218 { 00219 static unsigned long long_ret; 00220 00221 if (header_generic(vp, name, length, exact, var_len, write_method)) 00222 return NULL; 00223 00224 if (vp->magic != ASTCHANCOUNT) 00225 return NULL; 00226 00227 long_ret = ast_active_channels(); 00228 00229 return (u_char *)&long_ret; 00230 }
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] |
Definition at line 232 of file agent.c.
References ast_channel::_state, ast_channel::adsicpe, ast_channel::amaflags, ast_party_caller::ani, ast_party_caller::ani2, ast_channel::appl, ast_active_channels(), ast_bridged_channel(), ast_channel_iterator_all_new(), ast_channel_iterator_destroy(), ast_channel_iterator_next(), ast_channel_lock, ast_channel_unlock, ast_channel_unref, 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, ast_channel::bridge, ast_channel::caller, ast_channel::callgroup, ast_channel::context, ast_tone_zone::country, ast_channel::data, ast_channel::dialed, ast_channel::exten, ast_channel::flags, ast_party_redirecting::from, ast_channel::hangupcause, header_simple_table(), ast_party_caller::id, ast_channel::macrocontext, ast_channel::macroexten, ast_channel::macropriority, ast_channel::masq, ast_channel::masqr, ast_party_id::name, ast_party_id::number, ast_party_dialed::number, pbx_builtin_serialize_variables(), ast_channel::pickupgroup, ast_party_number::plan, ast_channel::priority, ast_channel::redirecting, ast_channel::rings, ast_party_name::str, ast_party_number::str, ast_party_dialed::str, ast_channel::tech, ast_channel::transfercapability, ast_party_dialed::transit_network_select, ast_channel_tech::type, ast_party_name::valid, ast_party_number::valid, ast_channel::whentohangup, and ast_channel::zone.
Referenced by init_asterisk_mib().
00234 { 00235 static unsigned long long_ret; 00236 static u_char bits_ret[2]; 00237 static char string_ret[256]; 00238 struct ast_channel *chan, *bridge; 00239 struct timeval tval; 00240 u_char *ret = NULL; 00241 int i, bit; 00242 struct ast_str *out = ast_str_alloca(2048); 00243 struct ast_channel_iterator *iter; 00244 00245 if (header_simple_table(vp, name, length, exact, var_len, write_method, ast_active_channels())) 00246 return NULL; 00247 00248 i = name[*length - 1] - 1; 00249 00250 if (!(iter = ast_channel_iterator_all_new())) { 00251 return NULL; 00252 } 00253 00254 while ((chan = ast_channel_iterator_next(iter)) && i) { 00255 ast_channel_unref(chan); 00256 i--; 00257 } 00258 00259 iter = ast_channel_iterator_destroy(iter); 00260 00261 if (chan == NULL) { 00262 return NULL; 00263 } 00264 00265 *var_len = sizeof(long_ret); 00266 00267 ast_channel_lock(chan); 00268 00269 switch (vp->magic) { 00270 case ASTCHANINDEX: 00271 long_ret = name[*length - 1]; 00272 ret = (u_char *)&long_ret; 00273 break; 00274 case ASTCHANNAME: 00275 if (!ast_strlen_zero(chan->name)) { 00276 strncpy(string_ret, chan->name, sizeof(string_ret)); 00277 string_ret[sizeof(string_ret) - 1] = '\0'; 00278 *var_len = strlen(string_ret); 00279 ret = (u_char *)string_ret; 00280 } 00281 break; 00282 case ASTCHANLANGUAGE: 00283 if (!ast_strlen_zero(chan->language)) { 00284 strncpy(string_ret, chan->language, sizeof(string_ret)); 00285 string_ret[sizeof(string_ret) - 1] = '\0'; 00286 *var_len = strlen(string_ret); 00287 ret = (u_char *)string_ret; 00288 } 00289 break; 00290 case ASTCHANTYPE: 00291 strncpy(string_ret, chan->tech->type, sizeof(string_ret)); 00292 string_ret[sizeof(string_ret) - 1] = '\0'; 00293 *var_len = strlen(string_ret); 00294 ret = (u_char *)string_ret; 00295 break; 00296 case ASTCHANMUSICCLASS: 00297 if (!ast_strlen_zero(chan->musicclass)) { 00298 strncpy(string_ret, chan->musicclass, sizeof(string_ret)); 00299 string_ret[sizeof(string_ret) - 1] = '\0'; 00300 *var_len = strlen(string_ret); 00301 ret = (u_char *)string_ret; 00302 } 00303 break; 00304 case ASTCHANBRIDGE: 00305 if ((bridge = ast_bridged_channel(chan)) != NULL) { 00306 strncpy(string_ret, bridge->name, sizeof(string_ret)); 00307 string_ret[sizeof(string_ret) - 1] = '\0'; 00308 *var_len = strlen(string_ret); 00309 ret = (u_char *)string_ret; 00310 } 00311 break; 00312 case ASTCHANMASQ: 00313 if (chan->masq && !ast_strlen_zero(chan->masq->name)) { 00314 strncpy(string_ret, chan->masq->name, sizeof(string_ret)); 00315 string_ret[sizeof(string_ret) - 1] = '\0'; 00316 *var_len = strlen(string_ret); 00317 ret = (u_char *)string_ret; 00318 } 00319 break; 00320 case ASTCHANMASQR: 00321 if (chan->masqr && !ast_strlen_zero(chan->masqr->name)) { 00322 strncpy(string_ret, chan->masqr->name, sizeof(string_ret)); 00323 string_ret[sizeof(string_ret) - 1] = '\0'; 00324 *var_len = strlen(string_ret); 00325 ret = (u_char *)string_ret; 00326 } 00327 break; 00328 case ASTCHANWHENHANGUP: 00329 if (!ast_tvzero(chan->whentohangup)) { 00330 gettimeofday(&tval, NULL); 00331 long_ret = difftime(chan->whentohangup.tv_sec, tval.tv_sec) * 100 - tval.tv_usec / 10000; 00332 ret= (u_char *)&long_ret; 00333 } 00334 break; 00335 case ASTCHANAPP: 00336 if (chan->appl) { 00337 strncpy(string_ret, chan->appl, sizeof(string_ret)); 00338 string_ret[sizeof(string_ret) - 1] = '\0'; 00339 *var_len = strlen(string_ret); 00340 ret = (u_char *)string_ret; 00341 } 00342 break; 00343 case ASTCHANDATA: 00344 if (chan->data) { 00345 strncpy(string_ret, chan->data, sizeof(string_ret)); 00346 string_ret[sizeof(string_ret) - 1] = '\0'; 00347 *var_len = strlen(string_ret); 00348 ret = (u_char *)string_ret; 00349 } 00350 break; 00351 case ASTCHANCONTEXT: 00352 strncpy(string_ret, chan->context, sizeof(string_ret)); 00353 string_ret[sizeof(string_ret) - 1] = '\0'; 00354 *var_len = strlen(string_ret); 00355 ret = (u_char *)string_ret; 00356 break; 00357 case ASTCHANMACROCONTEXT: 00358 strncpy(string_ret, chan->macrocontext, sizeof(string_ret)); 00359 string_ret[sizeof(string_ret) - 1] = '\0'; 00360 *var_len = strlen(string_ret); 00361 ret = (u_char *)string_ret; 00362 break; 00363 case ASTCHANMACROEXTEN: 00364 strncpy(string_ret, chan->macroexten, sizeof(string_ret)); 00365 string_ret[sizeof(string_ret) - 1] = '\0'; 00366 *var_len = strlen(string_ret); 00367 ret = (u_char *)string_ret; 00368 break; 00369 case ASTCHANMACROPRI: 00370 long_ret = chan->macropriority; 00371 ret = (u_char *)&long_ret; 00372 break; 00373 case ASTCHANEXTEN: 00374 strncpy(string_ret, chan->exten, sizeof(string_ret)); 00375 string_ret[sizeof(string_ret) - 1] = '\0'; 00376 *var_len = strlen(string_ret); 00377 ret = (u_char *)string_ret; 00378 break; 00379 case ASTCHANPRI: 00380 long_ret = chan->priority; 00381 ret = (u_char *)&long_ret; 00382 break; 00383 case ASTCHANACCOUNTCODE: 00384 if (!ast_strlen_zero(chan->accountcode)) { 00385 strncpy(string_ret, chan->accountcode, sizeof(string_ret)); 00386 string_ret[sizeof(string_ret) - 1] = '\0'; 00387 *var_len = strlen(string_ret); 00388 ret = (u_char *)string_ret; 00389 } 00390 break; 00391 case ASTCHANFORWARDTO: 00392 if (!ast_strlen_zero(chan->call_forward)) { 00393 strncpy(string_ret, chan->call_forward, sizeof(string_ret)); 00394 string_ret[sizeof(string_ret) - 1] = '\0'; 00395 *var_len = strlen(string_ret); 00396 ret = (u_char *)string_ret; 00397 } 00398 break; 00399 case ASTCHANUNIQUEID: 00400 strncpy(string_ret, chan->uniqueid, sizeof(string_ret)); 00401 string_ret[sizeof(string_ret) - 1] = '\0'; 00402 *var_len = strlen(string_ret); 00403 ret = (u_char *)string_ret; 00404 break; 00405 case ASTCHANCALLGROUP: 00406 long_ret = chan->callgroup; 00407 ret = (u_char *)&long_ret; 00408 break; 00409 case ASTCHANPICKUPGROUP: 00410 long_ret = chan->pickupgroup; 00411 ret = (u_char *)&long_ret; 00412 break; 00413 case ASTCHANSTATE: 00414 long_ret = chan->_state & 0xffff; 00415 ret = (u_char *)&long_ret; 00416 break; 00417 case ASTCHANMUTED: 00418 long_ret = chan->_state & AST_STATE_MUTE ? 1 : 2; 00419 ret = (u_char *)&long_ret; 00420 break; 00421 case ASTCHANRINGS: 00422 long_ret = chan->rings; 00423 ret = (u_char *)&long_ret; 00424 break; 00425 case ASTCHANCIDDNID: 00426 if (chan->dialed.number.str) { 00427 strncpy(string_ret, chan->dialed.number.str, sizeof(string_ret)); 00428 string_ret[sizeof(string_ret) - 1] = '\0'; 00429 *var_len = strlen(string_ret); 00430 ret = (u_char *)string_ret; 00431 } 00432 break; 00433 case ASTCHANCIDNUM: 00434 if (chan->caller.id.number.valid && chan->caller.id.number.str) { 00435 strncpy(string_ret, chan->caller.id.number.str, sizeof(string_ret)); 00436 string_ret[sizeof(string_ret) - 1] = '\0'; 00437 *var_len = strlen(string_ret); 00438 ret = (u_char *)string_ret; 00439 } 00440 break; 00441 case ASTCHANCIDNAME: 00442 if (chan->caller.id.name.valid && chan->caller.id.name.str) { 00443 strncpy(string_ret, chan->caller.id.name.str, sizeof(string_ret)); 00444 string_ret[sizeof(string_ret) - 1] = '\0'; 00445 *var_len = strlen(string_ret); 00446 ret = (u_char *)string_ret; 00447 } 00448 break; 00449 case ASTCHANCIDANI: 00450 if (chan->caller.ani.number.valid && chan->caller.ani.number.str) { 00451 strncpy(string_ret, chan->caller.ani.number.str, sizeof(string_ret)); 00452 string_ret[sizeof(string_ret) - 1] = '\0'; 00453 *var_len = strlen(string_ret); 00454 ret = (u_char *)string_ret; 00455 } 00456 break; 00457 case ASTCHANCIDRDNIS: 00458 if (chan->redirecting.from.number.valid && chan->redirecting.from.number.str) { 00459 strncpy(string_ret, chan->redirecting.from.number.str, sizeof(string_ret)); 00460 string_ret[sizeof(string_ret) - 1] = '\0'; 00461 *var_len = strlen(string_ret); 00462 ret = (u_char *)string_ret; 00463 } 00464 break; 00465 case ASTCHANCIDPRES: 00466 long_ret = ast_party_id_presentation(&chan->caller.id); 00467 ret = (u_char *)&long_ret; 00468 break; 00469 case ASTCHANCIDANI2: 00470 long_ret = chan->caller.ani2; 00471 ret = (u_char *)&long_ret; 00472 break; 00473 case ASTCHANCIDTON: 00474 long_ret = chan->caller.id.number.plan; 00475 ret = (u_char *)&long_ret; 00476 break; 00477 case ASTCHANCIDTNS: 00478 long_ret = chan->dialed.transit_network_select; 00479 ret = (u_char *)&long_ret; 00480 break; 00481 case ASTCHANAMAFLAGS: 00482 long_ret = chan->amaflags; 00483 ret = (u_char *)&long_ret; 00484 break; 00485 case ASTCHANADSI: 00486 long_ret = chan->adsicpe; 00487 ret = (u_char *)&long_ret; 00488 break; 00489 case ASTCHANTONEZONE: 00490 if (chan->zone) { 00491 strncpy(string_ret, chan->zone->country, sizeof(string_ret)); 00492 string_ret[sizeof(string_ret) - 1] = '\0'; 00493 *var_len = strlen(string_ret); 00494 ret = (u_char *)string_ret; 00495 } 00496 break; 00497 case ASTCHANHANGUPCAUSE: 00498 long_ret = chan->hangupcause; 00499 ret = (u_char *)&long_ret; 00500 break; 00501 case ASTCHANVARIABLES: 00502 if (pbx_builtin_serialize_variables(chan, &out)) { 00503 *var_len = ast_str_strlen(out); 00504 ret = (u_char *)ast_str_buffer(out); 00505 } 00506 break; 00507 case ASTCHANFLAGS: 00508 bits_ret[0] = 0; 00509 for (bit = 0; bit < 8; bit++) 00510 bits_ret[0] |= ((chan->flags & (1 << bit)) >> bit) << (7 - bit); 00511 bits_ret[1] = 0; 00512 for (bit = 0; bit < 8; bit++) 00513 bits_ret[1] |= (((chan->flags >> 8) & (1 << bit)) >> bit) << (7 - bit); 00514 *var_len = 2; 00515 ret = bits_ret; 00516 break; 00517 case ASTCHANTRANSFERCAP: 00518 long_ret = chan->transfercapability; 00519 ret = (u_char *)&long_ret; 00520 default: 00521 break; 00522 } 00523 00524 ast_channel_unlock(chan); 00525 chan = ast_channel_unref(chan); 00526 00527 return ret; 00528 }
static u_char* ast_var_Config | ( | struct variable * | vp, | |
oid * | name, | |||
size_t * | length, | |||
int | exact, | |||
size_t * | var_len, | |||
WriteMethod ** | write_method | |||
) | [static] |
Definition at line 649 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, and header_generic().
Referenced by init_asterisk_mib().
00651 { 00652 static unsigned long long_ret; 00653 struct timeval tval; 00654 00655 if (header_generic(vp, name, length, exact, var_len, write_method)) 00656 return NULL; 00657 00658 switch (vp->magic) { 00659 case ASTCONFUPTIME: 00660 gettimeofday(&tval, NULL); 00661 long_ret = difftime(tval.tv_sec, ast_startuptime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_startuptime.tv_usec / 10000; 00662 return (u_char *)&long_ret; 00663 case ASTCONFRELOADTIME: 00664 gettimeofday(&tval, NULL); 00665 if (ast_lastreloadtime.tv_sec) 00666 long_ret = difftime(tval.tv_sec, ast_lastreloadtime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_lastreloadtime.tv_usec / 10000; 00667 else 00668 long_ret = difftime(tval.tv_sec, ast_startuptime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_startuptime.tv_usec / 10000; 00669 return (u_char *)&long_ret; 00670 case ASTCONFPID: 00671 long_ret = getpid(); 00672 return (u_char *)&long_ret; 00673 case ASTCONFSOCKET: 00674 *var_len = strlen(ast_config_AST_SOCKET); 00675 return (u_char *)ast_config_AST_SOCKET; 00676 case ASTCONFACTIVECALLS: 00677 long_ret = ast_active_calls(); 00678 return (u_char *)&long_ret; 00679 case ASTCONFPROCESSEDCALLS: 00680 long_ret = ast_processed_calls(); 00681 return (u_char *)&long_ret; 00682 default: 00683 break; 00684 } 00685 return NULL; 00686 }
static u_char* ast_var_indications | ( | struct variable * | vp, | |
oid * | name, | |||
size_t * | length, | |||
int | exact, | |||
size_t * | var_len, | |||
WriteMethod ** | write_method | |||
) | [static] |
Definition at line 688 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(), and tz.
Referenced by init_asterisk_mib().
00690 { 00691 static unsigned long long_ret; 00692 static char ret_buf[128]; 00693 struct ast_tone_zone *tz = NULL; 00694 00695 if (header_generic(vp, name, length, exact, var_len, write_method)) 00696 return NULL; 00697 00698 switch (vp->magic) { 00699 case ASTINDCOUNT: 00700 { 00701 struct ao2_iterator i; 00702 00703 long_ret = 0; 00704 00705 i = ast_tone_zone_iterator_init(); 00706 while ((tz = ao2_iterator_next(&i))) { 00707 tz = ast_tone_zone_unref(tz); 00708 long_ret++; 00709 } 00710 ao2_iterator_destroy(&i); 00711 00712 return (u_char *) &long_ret; 00713 } 00714 case ASTINDCURRENT: 00715 tz = ast_get_indication_zone(NULL); 00716 if (tz) { 00717 ast_copy_string(ret_buf, tz->country, sizeof(ret_buf)); 00718 *var_len = strlen(ret_buf); 00719 tz = ast_tone_zone_unref(tz); 00720 return (u_char *) ret_buf; 00721 } 00722 *var_len = 0; 00723 return NULL; 00724 default: 00725 break; 00726 } 00727 return NULL; 00728 }
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] |
Definition at line 730 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(), and tz.
Referenced by init_asterisk_mib().
00732 { 00733 static unsigned long long_ret; 00734 static char ret_buf[256]; 00735 struct ast_tone_zone *tz = NULL; 00736 int i; 00737 struct ao2_iterator iter; 00738 00739 if (header_simple_table(vp, name, length, exact, var_len, write_method, -1)) { 00740 return NULL; 00741 } 00742 00743 i = name[*length - 1] - 1; 00744 00745 iter = ast_tone_zone_iterator_init(); 00746 00747 while ((tz = ao2_iterator_next(&iter)) && i) { 00748 tz = ast_tone_zone_unref(tz); 00749 i--; 00750 } 00751 ao2_iterator_destroy(&iter); 00752 00753 if (tz == NULL) { 00754 return NULL; 00755 } 00756 00757 switch (vp->magic) { 00758 case ASTINDINDEX: 00759 ast_tone_zone_unref(tz); 00760 long_ret = name[*length - 1]; 00761 return (u_char *)&long_ret; 00762 case ASTINDCOUNTRY: 00763 ast_copy_string(ret_buf, tz->country, sizeof(ret_buf)); 00764 ast_tone_zone_unref(tz); 00765 *var_len = strlen(ret_buf); 00766 return (u_char *) ret_buf; 00767 case ASTINDALIAS: 00768 /* No longer exists */ 00769 ast_tone_zone_unref(tz); 00770 return NULL; 00771 case ASTINDDESCRIPTION: 00772 ast_tone_zone_lock(tz); 00773 ast_copy_string(ret_buf, tz->description, sizeof(ret_buf)); 00774 ast_tone_zone_unlock(tz); 00775 ast_tone_zone_unref(tz); 00776 *var_len = strlen(ret_buf); 00777 return (u_char *) ret_buf; 00778 default: 00779 ast_tone_zone_unref(tz); 00780 break; 00781 } 00782 return NULL; 00783 }
static u_char* ast_var_Modules | ( | struct variable * | vp, | |
oid * | name, | |||
size_t * | length, | |||
int | exact, | |||
size_t * | var_len, | |||
WriteMethod ** | write_method | |||
) | [static] |
Definition at line 790 of file agent.c.
References ast_update_module_list(), ASTMODCOUNT, countmodule(), and header_generic().
Referenced by init_asterisk_mib().
00792 { 00793 static unsigned long long_ret; 00794 00795 if (header_generic(vp, name, length, exact, var_len, write_method)) 00796 return NULL; 00797 00798 if (vp->magic != ASTMODCOUNT) 00799 return NULL; 00800 00801 long_ret = ast_update_module_list(countmodule, NULL); 00802 00803 return (u_char *)&long_ret; 00804 }
static u_char* ast_var_Version | ( | struct variable * | vp, | |
oid * | name, | |||
size_t * | length, | |||
int | exact, | |||
size_t * | var_len, | |||
WriteMethod ** | write_method | |||
) | [static] |
Definition at line 806 of file agent.c.
References ast_get_version(), ast_get_version_num(), ASTVERSTRING, ASTVERTAG, header_generic(), and version.
Referenced by init_asterisk_mib().
00808 { 00809 static unsigned long long_ret; 00810 00811 if (header_generic(vp, name, length, exact, var_len, write_method)) 00812 return NULL; 00813 00814 switch (vp->magic) { 00815 case ASTVERSTRING: 00816 { 00817 const char *version = ast_get_version(); 00818 *var_len = strlen(version); 00819 return (u_char *)version; 00820 } 00821 case ASTVERTAG: 00822 sscanf(ast_get_version_num(), "%30lu", &long_ret); 00823 return (u_char *)&long_ret; 00824 default: 00825 break; 00826 } 00827 return NULL; 00828 }
static int countmodule | ( | const char * | mod, | |
const char * | desc, | |||
int | use, | |||
const char * | like | |||
) | [static] |
Definition at line 785 of file agent.c.
Referenced by ast_var_Modules().
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 void init_asterisk_mib | ( | void | ) | [static] |
Definition at line 836 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, ASTINDALIAS, ASTINDCOUNT, ASTINDCOUNTRY, ASTINDCURRENT, ASTINDDESCRIPTION, ASTINDICATIONS, ASTINDINDEX, ASTINDTABLE, ASTMODCOUNT, ASTMODULES, ASTVERSION, ASTVERSTRING, ASTVERTAG, register_sysORTable(), and term_asterisk_mib().
Referenced by agent_thread().
00837 { 00838 static struct variable4 asterisk_vars[] = { 00839 {ASTVERSTRING, ASN_OCTET_STR, RONLY, ast_var_Version, 2, {ASTVERSION, ASTVERSTRING}}, 00840 {ASTVERTAG, ASN_UNSIGNED, RONLY, ast_var_Version, 2, {ASTVERSION, ASTVERTAG}}, 00841 {ASTCONFUPTIME, ASN_TIMETICKS, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFUPTIME}}, 00842 {ASTCONFRELOADTIME, ASN_TIMETICKS, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFRELOADTIME}}, 00843 {ASTCONFPID, ASN_INTEGER, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFPID}}, 00844 {ASTCONFSOCKET, ASN_OCTET_STR, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFSOCKET}}, 00845 {ASTCONFACTIVECALLS, ASN_GAUGE, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFACTIVECALLS}}, 00846 {ASTCONFPROCESSEDCALLS, ASN_COUNTER, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFPROCESSEDCALLS}}, 00847 {ASTMODCOUNT, ASN_INTEGER, RONLY, ast_var_Modules , 2, {ASTMODULES, ASTMODCOUNT}}, 00848 {ASTINDCOUNT, ASN_INTEGER, RONLY, ast_var_indications, 2, {ASTINDICATIONS, ASTINDCOUNT}}, 00849 {ASTINDCURRENT, ASN_OCTET_STR, RONLY, ast_var_indications, 2, {ASTINDICATIONS, ASTINDCURRENT}}, 00850 {ASTINDINDEX, ASN_INTEGER, RONLY, ast_var_indications_table, 4, {ASTINDICATIONS, ASTINDTABLE, 1, ASTINDINDEX}}, 00851 {ASTINDCOUNTRY, ASN_OCTET_STR, RONLY, ast_var_indications_table, 4, {ASTINDICATIONS, ASTINDTABLE, 1, ASTINDCOUNTRY}}, 00852 {ASTINDALIAS, ASN_OCTET_STR, RONLY, ast_var_indications_table, 4, {ASTINDICATIONS, ASTINDTABLE, 1, ASTINDALIAS}}, 00853 {ASTINDDESCRIPTION, ASN_OCTET_STR, RONLY, ast_var_indications_table, 4, {ASTINDICATIONS, ASTINDTABLE, 1, ASTINDDESCRIPTION}}, 00854 {ASTCHANCOUNT, ASN_GAUGE, RONLY, ast_var_channels, 2, {ASTCHANNELS, ASTCHANCOUNT}}, 00855 {ASTCHANINDEX, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANINDEX}}, 00856 {ASTCHANNAME, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANNAME}}, 00857 {ASTCHANLANGUAGE, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANLANGUAGE}}, 00858 {ASTCHANTYPE, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANTYPE}}, 00859 {ASTCHANMUSICCLASS, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMUSICCLASS}}, 00860 {ASTCHANBRIDGE, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANBRIDGE}}, 00861 {ASTCHANMASQ, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMASQ}}, 00862 {ASTCHANMASQR, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMASQR}}, 00863 {ASTCHANWHENHANGUP, ASN_TIMETICKS, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANWHENHANGUP}}, 00864 {ASTCHANAPP, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANAPP}}, 00865 {ASTCHANDATA, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANDATA}}, 00866 {ASTCHANCONTEXT, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCONTEXT}}, 00867 {ASTCHANMACROCONTEXT, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMACROCONTEXT}}, 00868 {ASTCHANMACROEXTEN, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMACROEXTEN}}, 00869 {ASTCHANMACROPRI, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMACROPRI}}, 00870 {ASTCHANEXTEN, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANEXTEN}}, 00871 {ASTCHANPRI, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANPRI}}, 00872 {ASTCHANACCOUNTCODE, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANACCOUNTCODE}}, 00873 {ASTCHANFORWARDTO, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANFORWARDTO}}, 00874 {ASTCHANUNIQUEID, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANUNIQUEID}}, 00875 {ASTCHANCALLGROUP, ASN_UNSIGNED, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCALLGROUP}}, 00876 {ASTCHANPICKUPGROUP, ASN_UNSIGNED, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANPICKUPGROUP}}, 00877 {ASTCHANSTATE, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANSTATE}}, 00878 {ASTCHANMUTED, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMUTED}}, 00879 {ASTCHANRINGS, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANRINGS}}, 00880 {ASTCHANCIDDNID, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDDNID}}, 00881 {ASTCHANCIDNUM, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDNUM}}, 00882 {ASTCHANCIDNAME, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDNAME}}, 00883 {ASTCHANCIDANI, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDANI}}, 00884 {ASTCHANCIDRDNIS, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDRDNIS}}, 00885 {ASTCHANCIDPRES, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDPRES}}, 00886 {ASTCHANCIDANI2, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDANI2}}, 00887 {ASTCHANCIDTON, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDTON}}, 00888 {ASTCHANCIDTNS, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDTNS}}, 00889 {ASTCHANAMAFLAGS, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANAMAFLAGS}}, 00890 {ASTCHANADSI, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANADSI}}, 00891 {ASTCHANTONEZONE, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANTONEZONE}}, 00892 {ASTCHANHANGUPCAUSE, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANHANGUPCAUSE}}, 00893 {ASTCHANVARIABLES, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANVARIABLES}}, 00894 {ASTCHANFLAGS, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANFLAGS}}, 00895 {ASTCHANTRANSFERCAP, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANTRANSFERCAP}}, 00896 {ASTCHANTYPECOUNT, ASN_INTEGER, RONLY, ast_var_channel_types, 2, {ASTCHANNELS, ASTCHANTYPECOUNT}}, 00897 {ASTCHANTYPEINDEX, ASN_INTEGER, RONLY, ast_var_channel_types_table, 4, {ASTCHANNELS, ASTCHANTYPETABLE, 1, ASTCHANTYPEINDEX}}, 00898 {ASTCHANTYPENAME, ASN_OCTET_STR, RONLY, ast_var_channel_types_table, 4, {ASTCHANNELS, ASTCHANTYPETABLE, 1, ASTCHANTYPENAME}}, 00899 {ASTCHANTYPEDESC, ASN_OCTET_STR, RONLY, ast_var_channel_types_table, 4, {ASTCHANNELS, ASTCHANTYPETABLE, 1, ASTCHANTYPEDESC}}, 00900 {ASTCHANTYPEDEVSTATE, ASN_INTEGER, RONLY, ast_var_channel_types_table, 4, {ASTCHANNELS, ASTCHANTYPETABLE, 1, ASTCHANTYPEDEVSTATE}}, 00901 {ASTCHANTYPEINDICATIONS, ASN_INTEGER, RONLY, ast_var_channel_types_table, 4, {ASTCHANNELS, ASTCHANTYPETABLE, 1, ASTCHANTYPEINDICATIONS}}, 00902 {ASTCHANTYPETRANSFER, ASN_INTEGER, RONLY, ast_var_channel_types_table, 4, {ASTCHANNELS, ASTCHANTYPETABLE, 1, ASTCHANTYPETRANSFER}}, 00903 {ASTCHANTYPECHANNELS, ASN_GAUGE, RONLY, ast_var_channel_types_table, 4, {ASTCHANNELS, ASTCHANTYPETABLE, 1, ASTCHANTYPECHANNELS}}, 00904 {ASTCHANBRIDGECOUNT, ASN_GAUGE, RONLY, ast_var_channel_bridge, 3, {ASTCHANNELS, ASTCHANSCALARS, ASTCHANBRIDGECOUNT}}, 00905 }; 00906 00907 register_sysORTable(asterisk_oid, OID_LENGTH(asterisk_oid), 00908 "ASTERISK-MIB implementation for Asterisk."); 00909 00910 REGISTER_MIB("res_snmp", asterisk_vars, variable4, asterisk_oid); 00911 00912 snmp_register_callback(SNMP_CALLBACK_LIBRARY, 00913 SNMP_CALLBACK_SHUTDOWN, 00914 term_asterisk_mib, NULL); 00915 }
int register_sysORTable | ( | oid * | , | |
size_t | , | |||
const char * | ||||
) |
Referenced by init_asterisk_mib().
static int term_asterisk_mib | ( | int | majorID, | |
int | minorID, | |||
void * | serverarg, | |||
void * | clientarg | |||
) | [static] |
Definition at line 830 of file agent.c.
References unregister_sysORTable().
Referenced by init_asterisk_mib().
00831 { 00832 unregister_sysORTable(asterisk_oid, OID_LENGTH(asterisk_oid)); 00833 return 0; 00834 }
int unregister_sysORTable | ( | oid * | , | |
size_t | ||||
) |
Referenced by term_asterisk_mib().
oid asterisk_oid[] = { 1, 3, 6, 1, 4, 1, 22736, 1 } [static] |