22#define ASTMM_LIBC ASTMM_IGNORE
38#ifdef PACKAGE_BUGREPORT
39#undef PACKAGE_BUGREPORT
51#define HAVE_DMALLOC_H 0
54#if defined(__OpenBSD__)
59#define __NetBSD_Version__ 0
62#include <net-snmp/net-snmp-config.h>
63#include <net-snmp/net-snmp-includes.h>
64#include <net-snmp/agent/net-snmp-agent-includes.h>
66#if !defined(RONLY) && defined(NETSNMP_OLDAPI_RONLY)
67#define RONLY NETSNMP_OLDAPI_RONLY
79#define unload_module ast_unload_module
86int header_generic(
struct variable *, oid *,
size_t *,
int,
size_t *, WriteMethod **);
105#define ASTVERSTRING 1
108#define ASTCONFIGURATION 2
109#define ASTCONFUPTIME 1
110#define ASTCONFRELOADTIME 2
112#define ASTCONFSOCKET 4
113#define ASTCONFACTIVECALLS 5
114#define ASTCONFPROCESSEDCALLS 6
119#define ASTINDICATIONS 4
121#define ASTINDCURRENT 2
125#define ASTINDCOUNTRY 2
127#define ASTINDDESCRIPTION 4
130#define ASTCHANCOUNT 1
132#define ASTCHANTABLE 2
133#define ASTCHANINDEX 1
135#define ASTCHANLANGUAGE 3
137#define ASTCHANMUSICCLASS 5
138#define ASTCHANBRIDGE 6
140#define ASTCHANMASQR 8
141#define ASTCHANWHENHANGUP 9
143#define ASTCHANDATA 11
144#define ASTCHANCONTEXT 12
145#define ASTCHANEXTEN 16
147#define ASTCHANACCOUNTCODE 18
148#define ASTCHANFORWARDTO 19
149#define ASTCHANUNIQUEID 20
150#define ASTCHANCALLGROUP 21
151#define ASTCHANPICKUPGROUP 22
152#define ASTCHANSTATE 23
153#define ASTCHANMUTED 24
154#define ASTCHANRINGS 25
155#define ASTCHANCIDDNID 26
156#define ASTCHANCIDNUM 27
157#define ASTCHANCIDNAME 28
158#define ASTCHANCIDANI 29
159#define ASTCHANCIDRDNIS 30
160#define ASTCHANCIDPRES 31
161#define ASTCHANCIDANI2 32
162#define ASTCHANCIDTON 33
163#define ASTCHANCIDTNS 34
164#define ASTCHANAMAFLAGS 35
165#define ASTCHANADSI 36
166#define ASTCHANTONEZONE 37
167#define ASTCHANHANGUPCAUSE 38
168#define ASTCHANVARIABLES 39
169#define ASTCHANFLAGS 40
170#define ASTCHANTRANSFERCAP 41
172#define ASTCHANTYPECOUNT 3
174#define ASTCHANTYPETABLE 4
175#define ASTCHANTYPEINDEX 1
176#define ASTCHANTYPENAME 2
177#define ASTCHANTYPEDESC 3
178#define ASTCHANTYPEDEVSTATE 4
179#define ASTCHANTYPEINDICATIONS 5
180#define ASTCHANTYPETRANSFER 6
181#define ASTCHANTYPECHANNELS 7
183#define ASTCHANSCALARS 5
184#define ASTCHANBRIDGECOUNT 1
190 snmp_enable_stderrlog();
193 netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
194 NETSNMP_DS_AGENT_ROLE,
197 init_agent(
"asterisk");
201 init_snmp(
"asterisk");
207 agent_check_and_process(1);
209 snmp_shutdown(
"asterisk");
218 int exact,
size_t *var_len, WriteMethod **write_method)
220 static unsigned long long_ret;
230 return (u_char *)&long_ret;
234 int exact,
size_t *var_len, WriteMethod **write_method)
236 static unsigned long long_ret;
237 static u_char bits_ret[2];
238 static char string_ret[256];
249 i =
name[*length - 1] - 1;
266 *var_len =
sizeof(long_ret);
272 long_ret =
name[*length - 1];
273 ret = (u_char *)&long_ret;
278 *var_len = strlen(string_ret);
279 ret = (u_char *)string_ret;
285 *var_len = strlen(string_ret);
286 ret = (u_char *)string_ret;
291 *var_len = strlen(string_ret);
292 ret = (u_char *)string_ret;
297 *var_len = strlen(string_ret);
298 ret = (u_char *)string_ret;
310 *var_len = strlen(string_ret);
311 ret = (u_char *)string_ret;
318 *var_len = strlen(string_ret);
319 ret = (u_char *)string_ret;
325 *var_len = strlen(string_ret);
326 ret = (u_char *)string_ret;
331 gettimeofday(&tval,
NULL);
333 ret= (u_char *)&long_ret;
339 *var_len = strlen(string_ret);
340 ret = (u_char *)string_ret;
346 *var_len = strlen(string_ret);
347 ret = (u_char *)string_ret;
352 *var_len = strlen(string_ret);
353 ret = (u_char *)string_ret;
357 *var_len = strlen(string_ret);
358 ret = (u_char *)string_ret;
362 ret = (u_char *)&long_ret;
367 *var_len = strlen(string_ret);
368 ret = (u_char *)string_ret;
374 *var_len = strlen(string_ret);
375 ret = (u_char *)string_ret;
380 *var_len = strlen(string_ret);
381 ret = (u_char *)string_ret;
385 ret = (u_char *)&long_ret;
389 ret = (u_char *)&long_ret;
393 ret = (u_char *)&long_ret;
397 ret = (u_char *)&long_ret;
401 ret = (u_char *)&long_ret;
406 *var_len = strlen(string_ret);
407 ret = (u_char *)string_ret;
413 *var_len = strlen(string_ret);
414 ret = (u_char *)string_ret;
420 *var_len = strlen(string_ret);
421 ret = (u_char *)string_ret;
427 *var_len = strlen(string_ret);
428 ret = (u_char *)string_ret;
434 *var_len = strlen(string_ret);
435 ret = (u_char *)string_ret;
440 ret = (u_char *)&long_ret;
444 ret = (u_char *)&long_ret;
448 ret = (u_char *)&long_ret;
452 ret = (u_char *)&long_ret;
456 ret = (u_char *)&long_ret;
460 ret = (u_char *)&long_ret;
465 *var_len = strlen(string_ret);
466 ret = (u_char *)string_ret;
471 ret = (u_char *)&long_ret;
481 for (bit = 0; bit < 8; bit++)
482 bits_ret[0] |= ((
ast_channel_flags(chan)->flags & (1 << bit)) >> bit) << (7 - bit);
484 for (bit = 0; bit < 8; bit++)
485 bits_ret[1] |= (((
ast_channel_flags(chan)->flags >> 8) & (1 << bit)) >> bit) << (7 - bit);
491 ret = (u_char *)&long_ret;
503 int exact,
size_t *var_len, WriteMethod **write_method)
505 static unsigned long long_ret;
518 return (u_char *)&long_ret;
522 int exact,
size_t *var_len, WriteMethod **write_method)
526 static unsigned long long_ret;
534 for (i = 1, next = channel_types; next && i !=
name[*length - 1]; next = next->
next, i++)
544 long_ret =
name[*length - 1];
545 return (u_char *)&long_ret;
554 return (u_char *)&long_ret;
557 return (u_char *)&long_ret;
560 return (u_char *)&long_ret;
580 return (u_char *)&long_ret;
589 int exact,
size_t *var_len, WriteMethod **write_method)
591 static unsigned long long_ret;
616 *var_len =
sizeof(long_ret);
622 int exact,
size_t *var_len, WriteMethod **write_method)
624 static unsigned long long_ret;
632 gettimeofday(&tval,
NULL);
634 return (u_char *)&long_ret;
636 gettimeofday(&tval,
NULL);
641 return (u_char *)&long_ret;
644 return (u_char *)&long_ret;
650 return (u_char *)&long_ret;
653 return (u_char *)&long_ret;
661 int exact,
size_t *var_len, WriteMethod **write_method)
663 static unsigned long long_ret;
664 static char ret_buf[128];
684 return (u_char *) &long_ret;
690 *var_len = strlen(ret_buf);
692 return (u_char *) ret_buf;
703 int exact,
size_t *var_len, WriteMethod **write_method)
705 static unsigned long long_ret;
706 static char ret_buf[256];
715 i =
name[*length - 1] - 1;
732 long_ret =
name[*length - 1];
733 return (u_char *)&long_ret;
737 *var_len = strlen(ret_buf);
738 return (u_char *) ret_buf;
748 *var_len = strlen(ret_buf);
749 return (u_char *) ret_buf;
764 int exact,
size_t *var_len, WriteMethod **write_method)
766 static unsigned long long_ret;
776 return (u_char *)&long_ret;
780 int exact,
size_t *var_len, WriteMethod **write_method)
782 static unsigned long long_ret;
796 return (u_char *)&long_ret;
811 static struct variable4 asterisk_vars[] = {
878 "ASTERISK-MIB implementation for Asterisk.");
880 REGISTER_MIB(
"res_snmp", asterisk_vars, variable4,
asterisk_oid);
882 snmp_register_callback(SNMP_CALLBACK_LIBRARY,
883 SNMP_CALLBACK_SHUTDOWN,
static u_char * ast_var_indications_table(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
#define ASTCHANMUSICCLASS
int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
static u_char * ast_var_indications(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
#define ASTINDDESCRIPTION
#define ASTCONFACTIVECALLS
#define ASTCONFPROCESSEDCALLS
#define ASTCHANBRIDGECOUNT
static u_char * ast_var_Modules(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
#define ASTCHANTRANSFERCAP
static u_char * ast_var_channels(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
#define ASTCHANTYPEDEVSTATE
#define ASTCHANTYPEINDICATIONS
int header_simple_table(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **, int)
static u_char * ast_var_Version(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
#define ASTCHANWHENHANGUP
#define ASTCHANPICKUPGROUP
static int countmodule(const char *mod, const char *desc, int use, const char *status, const char *like, enum ast_module_support_level support_level)
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_channel_types(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
static oid asterisk_oid[]
#define ASTCHANACCOUNTCODE
static u_char * ast_var_channel_bridge(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
#define ASTCHANTYPECHANNELS
int register_sysORTable(oid *, size_t, const char *)
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 void init_asterisk_mib(void)
void * agent_thread(void *arg)
static int term_asterisk_mib(int majorID, int minorID, void *serverarg, void *clientarg)
#define ASTCONFRELOADTIME
static u_char * ast_var_channels_table(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
#define ASTCHANHANGUPCAUSE
int unregister_sysORTable(oid *, size_t)
#define ASTCHANTYPETRANSFER
SNMP Agent / SubAgent support for Asterisk.
Asterisk version information.
const char * ast_get_version(void)
Retrieve the Asterisk version string.
const char * ast_get_version_num(void)
Retrieve the numeric Asterisk version.
Asterisk main include file. File version handling, generic pbx functions.
#define ao2_iterator_next(iter)
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
static char version[AST_MAX_EXTENSION]
General Asterisk PBX channel definitions.
const char * ast_channel_name(const struct ast_channel *chan)
struct ast_channel * ast_channel_masq(const struct ast_channel *chan)
const char * ast_channel_data(const struct ast_channel *chan)
int ast_channel_rings(const struct ast_channel *chan)
struct ast_channel_iterator * ast_channel_iterator_destroy(struct ast_channel_iterator *i)
Destroy a channel iterator.
struct ast_channel * ast_channel_bridge_peer(struct ast_channel *chan)
Get the channel's bridge peer only if the bridge is two-party.
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
const char * ast_channel_musicclass(const struct ast_channel *chan)
#define ast_channel_lock(chan)
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
ast_group_t ast_channel_pickupgroup(const struct ast_channel *chan)
struct ast_channel * ast_channel_iterator_next(struct ast_channel_iterator *i)
Get the next channel for a channel iterator.
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
int ast_channel_priority(const struct ast_channel *chan)
const char * ast_channel_uniqueid(const struct ast_channel *chan)
const char * ast_channel_accountcode(const struct ast_channel *chan)
const char * ast_channel_context(const struct ast_channel *chan)
const char * ast_channel_appl(const struct ast_channel *chan)
enum ama_flags ast_channel_amaflags(const struct ast_channel *chan)
int ast_active_channels(void)
returns number of active/allocated channels
int ast_channel_hangupcause(const struct ast_channel *chan)
int ast_channel_is_bridged(const struct ast_channel *chan)
Determine if a channel is in a bridge.
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
struct ast_tone_zone * ast_channel_zone(const struct ast_channel *chan)
struct timeval * ast_channel_whentohangup(struct ast_channel *chan)
#define ast_channel_unref(c)
Decrease channel reference count.
ast_group_t ast_channel_callgroup(const struct ast_channel *chan)
struct ast_variable * ast_channeltype_list(void)
return an ast_variable list of channeltypes
const char * ast_channel_language(const struct ast_channel *chan)
const char * ast_channel_call_forward(const struct ast_channel *chan)
const struct ast_channel_tech * ast_channel_tech(const struct ast_channel *chan)
struct ast_channel * ast_channel_masqr(const struct ast_channel *chan)
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
const struct ast_channel_tech * ast_get_channel_tech(const char *name)
Get a channel technology structure by name.
struct ast_channel_iterator * ast_channel_iterator_all_new(void)
Create a new channel iterator.
const char * ast_channel_exten(const struct ast_channel *chan)
#define ast_channel_unlock(chan)
ast_channel_state
ast_channel states
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
Support for logging to various files, console and syslog Configuration in file logger....
#define ast_verb(level,...)
#define ast_tone_zone_unlock(tz)
Unlock an ast_tone_zone.
struct ao2_iterator ast_tone_zone_iterator_init(void)
Get an iterator for the available tone zones.
static struct ast_tone_zone * ast_tone_zone_unref(struct ast_tone_zone *tz)
Release a reference to an ast_tone_zone.
struct ast_tone_zone * ast_get_indication_zone(const char *country)
locate ast_tone_zone
#define ast_tone_zone_lock(tz)
Lock an ast_tone_zone.
Asterisk module definitions.
int ast_update_module_list(int(*modentry)(const char *module, const char *description, int usecnt, const char *status, const char *like, enum ast_module_support_level support_level), const char *like)
Ask for a list of modules, descriptions, use counts and status.
Options provided by main asterisk program.
struct timeval ast_lastreloadtime
struct timeval ast_startuptime
Asterisk file paths, configured in asterisk.conf.
const char * ast_config_AST_SOCKET
Core PBX routines and definitions.
int ast_active_calls(void)
Retrieve the number of active calls.
int ast_processed_calls(void)
Retrieve the total number of calls processed through the PBX since last restart.
int pbx_builtin_serialize_variables(struct ast_channel *chan, struct ast_str **buf)
Create a human-readable string, specifying all variables and their corresponding values.
int res_snmp_agentx_subagent
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define ast_str_alloca(init_len)
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Structure to describe a channel "technology", ie a channel driver See for examples:
int(*const indicate)(struct ast_channel *c, int condition, const void *data, size_t datalen)
Indicate a particular condition (e.g. AST_CONTROL_BUSY or AST_CONTROL_RINGING or AST_CONTROL_CONGESTI...
const char *const description
int(*const transfer)(struct ast_channel *chan, const char *newdest)
Blind transfer other side (see app_transfer.c and ast_transfer()
int(*const devicestate)(const char *device_number)
Main Channel structure associated with a channel.
struct ast_bridge * bridge
const struct ast_channel_tech * tech
struct ast_party_id id
Caller party ID.
int ani2
Automatic Number Identification 2 (Info Digits)
struct ast_party_id ani
Automatic Number Identification (ANI)
struct ast_party_dialed::@208 number
Dialed/Called number.
char * str
Subscriber phone number (Malloced)
int transit_network_select
Transit Network Select.
struct ast_party_name name
Subscriber name.
struct ast_party_number number
Subscriber phone number.
unsigned char valid
TRUE if the name information is valid/present.
char * str
Subscriber name (Malloced)
unsigned char valid
TRUE if the number information is valid/present.
char * str
Subscriber phone number (Malloced)
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
struct ast_party_id from
Who is redirecting the call (Sent to the party the call is redirected toward)
Support for dynamic strings.
A set of tones for a given locale.
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.