Wed Jan 8 2020 09:49:52

Asterisk developer's documentation


agent.c File Reference

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.

Macros

#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 /* XXX we shouldn't do this */
 
#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 }
 

Detailed Description

SNMP Agent / SubAgent support for Asterisk.

Author
Thorsten Lockert tholo.nosp@m.@voo.nosp@m.p.as

Definition in file agent.c.

Macro Definition Documentation

#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 HAVE_DMALLOC_H   0 /* XXX we shouldn't do this */

Definition at line 51 of file agent.c.

#define unload_module   ast_unload_module

Definition at line 75 of file agent.c.

Function Documentation

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().

186 {
187  ast_verb(2, "Starting %sAgent\n", res_snmp_agentx_subagent ? "Sub" : "");
188 
189  snmp_enable_stderrlog();
190 
192  netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
193  NETSNMP_DS_AGENT_ROLE,
194  1);
195 
196  init_agent("asterisk");
197 
199 
200  init_snmp("asterisk");
201 
203  init_master_agent();
204 
205  while (res_snmp_dont_stop)
206  agent_check_and_process(1);
207 
208  snmp_shutdown("asterisk");
209 
210  ast_verb(2, "Terminating %sAgent\n", res_snmp_agentx_subagent ? "Sub" : "");
211 
212  return NULL;
213 }
#define ast_verb(level,...)
Definition: logger.h:243
int res_snmp_dont_stop
Definition: res_snmp.c:37
int res_snmp_agentx_subagent
Definition: res_snmp.c:36
static void init_asterisk_mib(void)
Definition: agent.c:836
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().

618 {
619  static unsigned long long_ret;
620  struct ast_channel *chan = NULL;
621  struct ast_channel_iterator *iter;
622 
623  long_ret = 0;
624 
625  if (header_generic(vp, name, length, exact, var_len, write_method)) {
626  return NULL;
627  }
628 
629  if (!(iter = ast_channel_iterator_all_new())) {
630  return NULL;
631  }
632 
633  while ((chan = ast_channel_iterator_next(iter))) {
634  ast_channel_lock(chan);
635  if (ast_bridged_channel(chan)) {
636  long_ret++;
637  }
638  ast_channel_unlock(chan);
639  chan = ast_channel_unref(chan);
640  }
641 
643 
644  *var_len = sizeof(long_ret);
645 
646  return (vp->magic == ASTCHANBRIDGECOUNT) ? (u_char *) &long_ret : NULL;
647 }
#define ast_channel_lock(chan)
Definition: channel.h:2466
Main Channel structure associated with a channel.
Definition: channel.h:742
struct ast_channel * ast_channel_iterator_next(struct ast_channel_iterator *i)
Get the next channel for a channel iterator.
Definition: channel.c:1715
#define ast_channel_unref(c)
Decrease channel reference count.
Definition: channel.h:2502
#define ASTCHANBRIDGECOUNT
Definition: agent.c:183
int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
struct ast_channel * ast_bridged_channel(struct ast_channel *chan)
Find bridged channel.
Definition: channel.c:7160
#define ast_channel_unlock(chan)
Definition: channel.h:2467
static const char name[]
struct ast_channel_iterator * ast_channel_iterator_destroy(struct ast_channel_iterator *i)
Destroy a channel iterator.
Definition: channel.c:1649
struct ast_channel_iterator * ast_channel_iterator_all_new(void)
Create a new channel iterator.
Definition: channel.c:1701
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().

532 {
533  static unsigned long long_ret;
534  struct ast_variable *channel_types, *next;
535 
536  if (header_generic(vp, name, length, exact, var_len, write_method))
537  return NULL;
538 
539  if (vp->magic != ASTCHANTYPECOUNT)
540  return NULL;
541 
542  for (long_ret = 0, channel_types = next = ast_channeltype_list(); next; next = next->next)
543  long_ret++;
544  ast_variables_destroy(channel_types);
545 
546  return (u_char *)&long_ret;
547 }
struct ast_variable * ast_channeltype_list(void)
return an ast_variable list of channeltypes
Definition: channel.c:261
Structure for variables, used for configurations and for channel variables.
Definition: config.h:75
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
Definition: config.c:586
#define ASTCHANTYPECOUNT
Definition: agent.c:171
int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
static const char name[]
struct ast_variable * next
Definition: config.h:82
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().

551 {
552  const struct ast_channel_tech *tech = NULL;
553  struct ast_variable *channel_types, *next;
554  static unsigned long long_ret;
555  struct ast_channel *chan;
556  u_long i;
557 
558  if (header_simple_table(vp, name, length, exact, var_len, write_method, -1))
559  return NULL;
560 
561  channel_types = ast_channeltype_list();
562  for (i = 1, next = channel_types; next && i != name[*length - 1]; next = next->next, i++)
563  ;
564  if (next != NULL)
565  tech = ast_get_channel_tech(next->name);
566  ast_variables_destroy(channel_types);
567  if (next == NULL || tech == NULL)
568  return NULL;
569 
570  switch (vp->magic) {
571  case ASTCHANTYPEINDEX:
572  long_ret = name[*length - 1];
573  return (u_char *)&long_ret;
574  case ASTCHANTYPENAME:
575  *var_len = strlen(tech->type);
576  return (u_char *)tech->type;
577  case ASTCHANTYPEDESC:
578  *var_len = strlen(tech->description);
579  return (u_char *)tech->description;
580  case ASTCHANTYPEDEVSTATE:
581  long_ret = tech->devicestate ? 1 : 2;
582  return (u_char *)&long_ret;
584  long_ret = tech->indicate ? 1 : 2;
585  return (u_char *)&long_ret;
586  case ASTCHANTYPETRANSFER:
587  long_ret = tech->transfer ? 1 : 2;
588  return (u_char *)&long_ret;
589  case ASTCHANTYPECHANNELS:
590  {
591  struct ast_channel_iterator *iter;
592 
593  long_ret = 0;
594 
595  if (!(iter = ast_channel_iterator_all_new())) {
596  return NULL;
597  }
598 
599  while ((chan = ast_channel_iterator_next(iter))) {
600  if (chan->tech == tech) {
601  long_ret++;
602  }
603  chan = ast_channel_unref(chan);
604  }
605 
607 
608  return (u_char *)&long_ret;
609  }
610  default:
611  break;
612  }
613  return NULL;
614 }
Main Channel structure associated with a channel.
Definition: channel.h:742
const char *const type
Definition: channel.h:508
struct ast_channel * ast_channel_iterator_next(struct ast_channel_iterator *i)
Get the next channel for a channel iterator.
Definition: channel.c:1715
struct ast_channel_tech * ast_get_channel_tech(const char *name)
Get a channel technology structure by name.
Definition: channel.c:960
#define ASTCHANTYPEINDEX
Definition: agent.c:174
#define ast_channel_unref(c)
Decrease channel reference count.
Definition: channel.h:2502
#define ASTCHANTYPENAME
Definition: agent.c:175
struct ast_variable * ast_channeltype_list(void)
return an ast_variable list of channeltypes
Definition: channel.c:261
Structure for variables, used for configurations and for channel variables.
Definition: config.h:75
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
Definition: config.c:586
const char * name
Definition: config.h:77
Structure to describe a channel &quot;technology&quot;, ie a channel driver See for examples: ...
Definition: channel.h:507
#define ASTCHANTYPECHANNELS
Definition: agent.c:180
#define ASTCHANTYPEDEVSTATE
Definition: agent.c:177
#define ASTCHANTYPEDESC
Definition: agent.c:176
#define ASTCHANTYPETRANSFER
Definition: agent.c:179
int(*const transfer)(struct ast_channel *chan, const char *newdest)
Blind transfer other side (see app_transfer.c and ast_transfer()
Definition: channel.h:588
static const char name[]
const char *const description
Definition: channel.h:509
int(*const devicestate)(void *data)
Definition: channel.h:521
struct ast_channel_iterator * ast_channel_iterator_destroy(struct ast_channel_iterator *i)
Destroy a channel iterator.
Definition: channel.c:1649
struct ast_variable * next
Definition: config.h:82
struct ast_channel_iterator * ast_channel_iterator_all_new(void)
Create a new channel iterator.
Definition: channel.c:1701
struct ast_channel_tech * tech
Definition: channel.h:743
int header_simple_table(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **, int)
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...
Definition: channel.h:576
#define ASTCHANTYPEINDICATIONS
Definition: agent.c:178
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().

218 {
219  static unsigned long long_ret;
220 
221  if (header_generic(vp, name, length, exact, var_len, write_method))
222  return NULL;
223 
224  if (vp->magic != ASTCHANCOUNT)
225  return NULL;
226 
227  long_ret = ast_active_channels();
228 
229  return (u_char *)&long_ret;
230 }
#define ASTCHANCOUNT
Definition: agent.c:126
int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
static const char name[]
int ast_active_channels(void)
returns number of active/allocated channels
Definition: channel.c:848
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::accountcode, 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::call_forward, 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::language, ast_channel::macrocontext, ast_channel::macroexten, ast_channel::macropriority, ast_channel::masq, ast_channel::masqr, ast_channel::musicclass, ast_party_id::name, ast_channel::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_channel::uniqueid, ast_party_name::valid, ast_party_number::valid, ast_channel::whentohangup, and ast_channel::zone.

Referenced by init_asterisk_mib().

234 {
235  static unsigned long long_ret;
236  static u_char bits_ret[2];
237  static char string_ret[256];
238  struct ast_channel *chan, *bridge;
239  struct timeval tval;
240  u_char *ret = NULL;
241  int i, bit;
242  struct ast_str *out = ast_str_alloca(2048);
243  struct ast_channel_iterator *iter;
244 
245  if (header_simple_table(vp, name, length, exact, var_len, write_method, ast_active_channels()))
246  return NULL;
247 
248  i = name[*length - 1] - 1;
249 
250  if (!(iter = ast_channel_iterator_all_new())) {
251  return NULL;
252  }
253 
254  while ((chan = ast_channel_iterator_next(iter)) && i) {
255  ast_channel_unref(chan);
256  i--;
257  }
258 
259  iter = ast_channel_iterator_destroy(iter);
260 
261  if (chan == NULL) {
262  return NULL;
263  }
264 
265  *var_len = sizeof(long_ret);
266 
267  ast_channel_lock(chan);
268 
269  switch (vp->magic) {
270  case ASTCHANINDEX:
271  long_ret = name[*length - 1];
272  ret = (u_char *)&long_ret;
273  break;
274  case ASTCHANNAME:
275  if (!ast_strlen_zero(chan->name)) {
276  strncpy(string_ret, chan->name, sizeof(string_ret));
277  string_ret[sizeof(string_ret) - 1] = '\0';
278  *var_len = strlen(string_ret);
279  ret = (u_char *)string_ret;
280  }
281  break;
282  case ASTCHANLANGUAGE:
283  if (!ast_strlen_zero(chan->language)) {
284  strncpy(string_ret, chan->language, sizeof(string_ret));
285  string_ret[sizeof(string_ret) - 1] = '\0';
286  *var_len = strlen(string_ret);
287  ret = (u_char *)string_ret;
288  }
289  break;
290  case ASTCHANTYPE:
291  strncpy(string_ret, chan->tech->type, sizeof(string_ret));
292  string_ret[sizeof(string_ret) - 1] = '\0';
293  *var_len = strlen(string_ret);
294  ret = (u_char *)string_ret;
295  break;
296  case ASTCHANMUSICCLASS:
297  if (!ast_strlen_zero(chan->musicclass)) {
298  strncpy(string_ret, chan->musicclass, sizeof(string_ret));
299  string_ret[sizeof(string_ret) - 1] = '\0';
300  *var_len = strlen(string_ret);
301  ret = (u_char *)string_ret;
302  }
303  break;
304  case ASTCHANBRIDGE:
305  if ((bridge = ast_bridged_channel(chan)) != NULL) {
306  strncpy(string_ret, bridge->name, sizeof(string_ret));
307  string_ret[sizeof(string_ret) - 1] = '\0';
308  *var_len = strlen(string_ret);
309  ret = (u_char *)string_ret;
310  }
311  break;
312  case ASTCHANMASQ:
313  if (chan->masq && !ast_strlen_zero(chan->masq->name)) {
314  strncpy(string_ret, chan->masq->name, sizeof(string_ret));
315  string_ret[sizeof(string_ret) - 1] = '\0';
316  *var_len = strlen(string_ret);
317  ret = (u_char *)string_ret;
318  }
319  break;
320  case ASTCHANMASQR:
321  if (chan->masqr && !ast_strlen_zero(chan->masqr->name)) {
322  strncpy(string_ret, chan->masqr->name, sizeof(string_ret));
323  string_ret[sizeof(string_ret) - 1] = '\0';
324  *var_len = strlen(string_ret);
325  ret = (u_char *)string_ret;
326  }
327  break;
328  case ASTCHANWHENHANGUP:
329  if (!ast_tvzero(chan->whentohangup)) {
330  gettimeofday(&tval, NULL);
331  long_ret = difftime(chan->whentohangup.tv_sec, tval.tv_sec) * 100 - tval.tv_usec / 10000;
332  ret= (u_char *)&long_ret;
333  }
334  break;
335  case ASTCHANAPP:
336  if (chan->appl) {
337  strncpy(string_ret, chan->appl, sizeof(string_ret));
338  string_ret[sizeof(string_ret) - 1] = '\0';
339  *var_len = strlen(string_ret);
340  ret = (u_char *)string_ret;
341  }
342  break;
343  case ASTCHANDATA:
344  if (chan->data) {
345  strncpy(string_ret, chan->data, sizeof(string_ret));
346  string_ret[sizeof(string_ret) - 1] = '\0';
347  *var_len = strlen(string_ret);
348  ret = (u_char *)string_ret;
349  }
350  break;
351  case ASTCHANCONTEXT:
352  strncpy(string_ret, chan->context, sizeof(string_ret));
353  string_ret[sizeof(string_ret) - 1] = '\0';
354  *var_len = strlen(string_ret);
355  ret = (u_char *)string_ret;
356  break;
357  case ASTCHANMACROCONTEXT:
358  strncpy(string_ret, chan->macrocontext, sizeof(string_ret));
359  string_ret[sizeof(string_ret) - 1] = '\0';
360  *var_len = strlen(string_ret);
361  ret = (u_char *)string_ret;
362  break;
363  case ASTCHANMACROEXTEN:
364  strncpy(string_ret, chan->macroexten, sizeof(string_ret));
365  string_ret[sizeof(string_ret) - 1] = '\0';
366  *var_len = strlen(string_ret);
367  ret = (u_char *)string_ret;
368  break;
369  case ASTCHANMACROPRI:
370  long_ret = chan->macropriority;
371  ret = (u_char *)&long_ret;
372  break;
373  case ASTCHANEXTEN:
374  strncpy(string_ret, chan->exten, sizeof(string_ret));
375  string_ret[sizeof(string_ret) - 1] = '\0';
376  *var_len = strlen(string_ret);
377  ret = (u_char *)string_ret;
378  break;
379  case ASTCHANPRI:
380  long_ret = chan->priority;
381  ret = (u_char *)&long_ret;
382  break;
383  case ASTCHANACCOUNTCODE:
384  if (!ast_strlen_zero(chan->accountcode)) {
385  strncpy(string_ret, chan->accountcode, sizeof(string_ret));
386  string_ret[sizeof(string_ret) - 1] = '\0';
387  *var_len = strlen(string_ret);
388  ret = (u_char *)string_ret;
389  }
390  break;
391  case ASTCHANFORWARDTO:
392  if (!ast_strlen_zero(chan->call_forward)) {
393  strncpy(string_ret, chan->call_forward, sizeof(string_ret));
394  string_ret[sizeof(string_ret) - 1] = '\0';
395  *var_len = strlen(string_ret);
396  ret = (u_char *)string_ret;
397  }
398  break;
399  case ASTCHANUNIQUEID:
400  strncpy(string_ret, chan->uniqueid, sizeof(string_ret));
401  string_ret[sizeof(string_ret) - 1] = '\0';
402  *var_len = strlen(string_ret);
403  ret = (u_char *)string_ret;
404  break;
405  case ASTCHANCALLGROUP:
406  long_ret = chan->callgroup;
407  ret = (u_char *)&long_ret;
408  break;
409  case ASTCHANPICKUPGROUP:
410  long_ret = chan->pickupgroup;
411  ret = (u_char *)&long_ret;
412  break;
413  case ASTCHANSTATE:
414  long_ret = chan->_state & 0xffff;
415  ret = (u_char *)&long_ret;
416  break;
417  case ASTCHANMUTED:
418  long_ret = chan->_state & AST_STATE_MUTE ? 1 : 2;
419  ret = (u_char *)&long_ret;
420  break;
421  case ASTCHANRINGS:
422  long_ret = chan->rings;
423  ret = (u_char *)&long_ret;
424  break;
425  case ASTCHANCIDDNID:
426  if (chan->dialed.number.str) {
427  strncpy(string_ret, chan->dialed.number.str, sizeof(string_ret));
428  string_ret[sizeof(string_ret) - 1] = '\0';
429  *var_len = strlen(string_ret);
430  ret = (u_char *)string_ret;
431  }
432  break;
433  case ASTCHANCIDNUM:
434  if (chan->caller.id.number.valid && chan->caller.id.number.str) {
435  strncpy(string_ret, chan->caller.id.number.str, sizeof(string_ret));
436  string_ret[sizeof(string_ret) - 1] = '\0';
437  *var_len = strlen(string_ret);
438  ret = (u_char *)string_ret;
439  }
440  break;
441  case ASTCHANCIDNAME:
442  if (chan->caller.id.name.valid && chan->caller.id.name.str) {
443  strncpy(string_ret, chan->caller.id.name.str, sizeof(string_ret));
444  string_ret[sizeof(string_ret) - 1] = '\0';
445  *var_len = strlen(string_ret);
446  ret = (u_char *)string_ret;
447  }
448  break;
449  case ASTCHANCIDANI:
450  if (chan->caller.ani.number.valid && chan->caller.ani.number.str) {
451  strncpy(string_ret, chan->caller.ani.number.str, sizeof(string_ret));
452  string_ret[sizeof(string_ret) - 1] = '\0';
453  *var_len = strlen(string_ret);
454  ret = (u_char *)string_ret;
455  }
456  break;
457  case ASTCHANCIDRDNIS:
458  if (chan->redirecting.from.number.valid && chan->redirecting.from.number.str) {
459  strncpy(string_ret, chan->redirecting.from.number.str, sizeof(string_ret));
460  string_ret[sizeof(string_ret) - 1] = '\0';
461  *var_len = strlen(string_ret);
462  ret = (u_char *)string_ret;
463  }
464  break;
465  case ASTCHANCIDPRES:
466  long_ret = ast_party_id_presentation(&chan->caller.id);
467  ret = (u_char *)&long_ret;
468  break;
469  case ASTCHANCIDANI2:
470  long_ret = chan->caller.ani2;
471  ret = (u_char *)&long_ret;
472  break;
473  case ASTCHANCIDTON:
474  long_ret = chan->caller.id.number.plan;
475  ret = (u_char *)&long_ret;
476  break;
477  case ASTCHANCIDTNS:
478  long_ret = chan->dialed.transit_network_select;
479  ret = (u_char *)&long_ret;
480  break;
481  case ASTCHANAMAFLAGS:
482  long_ret = chan->amaflags;
483  ret = (u_char *)&long_ret;
484  break;
485  case ASTCHANADSI:
486  long_ret = chan->adsicpe;
487  ret = (u_char *)&long_ret;
488  break;
489  case ASTCHANTONEZONE:
490  if (chan->zone) {
491  strncpy(string_ret, chan->zone->country, sizeof(string_ret));
492  string_ret[sizeof(string_ret) - 1] = '\0';
493  *var_len = strlen(string_ret);
494  ret = (u_char *)string_ret;
495  }
496  break;
497  case ASTCHANHANGUPCAUSE:
498  long_ret = chan->hangupcause;
499  ret = (u_char *)&long_ret;
500  break;
501  case ASTCHANVARIABLES:
502  if (pbx_builtin_serialize_variables(chan, &out)) {
503  *var_len = ast_str_strlen(out);
504  ret = (u_char *)ast_str_buffer(out);
505  }
506  break;
507  case ASTCHANFLAGS:
508  bits_ret[0] = 0;
509  for (bit = 0; bit < 8; bit++)
510  bits_ret[0] |= ((chan->flags & (1 << bit)) >> bit) << (7 - bit);
511  bits_ret[1] = 0;
512  for (bit = 0; bit < 8; bit++)
513  bits_ret[1] |= (((chan->flags >> 8) & (1 << bit)) >> bit) << (7 - bit);
514  *var_len = 2;
515  ret = bits_ret;
516  break;
517  case ASTCHANTRANSFERCAP:
518  long_ret = chan->transfercapability;
519  ret = (u_char *)&long_ret;
520  default:
521  break;
522  }
523 
524  ast_channel_unlock(chan);
525  chan = ast_channel_unref(chan);
526 
527  return ret;
528 }
#define ASTCHANCIDNUM
Definition: agent.c:155
struct ast_channel * masqr
Definition: channel.h:752
#define ast_channel_lock(chan)
Definition: channel.h:2466
Main Channel structure associated with a channel.
Definition: channel.h:742
char * str
Subscriber phone number (Malloced)
Definition: channel.h:241
struct ast_channel * masq
Definition: channel.h:751
const char *const type
Definition: channel.h:508
struct ast_channel * ast_channel_iterator_next(struct ast_channel_iterator *i)
Get the next channel for a channel iterator.
Definition: channel.c:1715
int rings
Definition: channel.h:840
char * str
Subscriber phone number (Malloced)
Definition: channel.h:336
struct ast_party_caller caller
Channel Caller ID information.
Definition: channel.h:804
struct ast_tone_zone * zone
Definition: channel.h:767
int priority
Definition: channel.h:841
const ast_string_field uniqueid
Definition: channel.h:787
#define ast_channel_unref(c)
Decrease channel reference count.
Definition: channel.h:2502
#define ASTCHANMUTED
Definition: agent.c:152
struct ast_party_name name
Subscriber name.
Definition: channel.h:290
struct ast_party_id from
Who is redirecting the call (Sent to the party the call is redirected toward)
Definition: channel.h:449
#define ASTCHANVARIABLES
Definition: agent.c:167
char context[AST_MAX_CONTEXT]
Definition: channel.h:868
#define ASTCHANCIDTON
Definition: agent.c:161
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Definition: strings.h:497
#define ASTCHANBRIDGE
Definition: agent.c:134
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
Definition: channel.c:2151
#define ASTCHANMASQ
Definition: agent.c:135
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
Definition: time.h:100
struct ast_party_redirecting redirecting
Redirecting/Diversion information.
Definition: channel.h:814
#define ASTCHANADSI
Definition: agent.c:164
#define ASTCHANCONTEXT
Definition: agent.c:140
char * str
Subscriber name (Malloced)
Definition: channel.h:214
#define ASTCHANINDEX
Definition: agent.c:129
#define ASTCHANWHENHANGUP
Definition: agent.c:137
#define ASTCHANCIDANI
Definition: agent.c:157
#define ASTCHANUNIQUEID
Definition: agent.c:148
#define ASTCHANDATA
Definition: agent.c:139
unsigned short transfercapability
Definition: channel.h:863
#define ast_str_alloca(init_len)
Definition: strings.h:608
#define ASTCHANMACROEXTEN
Definition: agent.c:142
#define ASTCHANCIDTNS
Definition: agent.c:162
const char * data
Definition: channel.h:755
#define ASTCHANHANGUPCAUSE
Definition: agent.c:166
#define ASTCHANCIDRDNIS
Definition: agent.c:158
enum ast_channel_adsicpe adsicpe
Definition: channel.h:844
ast_group_t pickupgroup
Definition: channel.h:819
const char * appl
Definition: channel.h:754
ast_group_t callgroup
Definition: channel.h:818
#define ASTCHANACCOUNTCODE
Definition: agent.c:146
#define ASTCHANRINGS
Definition: agent.c:153
unsigned int flags
Definition: channel.h:850
struct ast_party_id id
Caller party ID.
Definition: channel.h:370
#define ASTCHANAMAFLAGS
Definition: agent.c:163
#define ASTCHANEXTEN
Definition: agent.c:144
int macropriority
Definition: channel.h:842
struct ast_party_id ani
Automatic Number Identification (ANI)
Definition: channel.h:377
struct ast_party_dialed::@155 number
Dialed/Called number.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:63
#define ASTCHANLANGUAGE
Definition: agent.c:131
#define ASTCHANAPP
Definition: agent.c:138
#define ASTCHANCIDANI2
Definition: agent.c:160
#define ASTCHANCIDDNID
Definition: agent.c:154
#define ASTCHANMUSICCLASS
Definition: agent.c:133
#define ASTCHANTYPE
Definition: agent.c:132
struct ast_party_dialed dialed
Dialed/Called information.
Definition: channel.h:797
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
Definition: strings.h:364
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
Definition: channel.h:243
#define ASTCHANTRANSFERCAP
Definition: agent.c:169
const ast_string_field call_forward
Definition: channel.h:787
int ani2
Automatic Number Identification 2 (Info Digits)
Definition: channel.h:380
enum ast_channel_state _state
Definition: channel.h:839
struct ast_channel * ast_bridged_channel(struct ast_channel *chan)
Find bridged channel.
Definition: channel.c:7160
const ast_string_field name
Definition: channel.h:787
#define ASTCHANMACROPRI
Definition: agent.c:143
#define ASTCHANTONEZONE
Definition: agent.c:165
struct ast_bridge * bridge
Definition: channel.h:865
#define ast_channel_unlock(chan)
Definition: channel.h:2467
static const char name[]
#define ASTCHANCIDPRES
Definition: agent.c:159
char macrocontext[AST_MAX_CONTEXT]
Definition: channel.h:870
#define ASTCHANCALLGROUP
Definition: agent.c:149
#define ASTCHANFLAGS
Definition: agent.c:168
#define ASTCHANMACROCONTEXT
Definition: agent.c:141
char country[16]
Country code that this set of tones is for.
Definition: indications.h:75
#define ASTCHANCIDNAME
Definition: agent.c:156
#define ASTCHANMASQR
Definition: agent.c:136
char macroexten[AST_MAX_EXTENSION]
Definition: channel.h:871
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
Definition: strings.h:471
int transit_network_select
Transit Network Select.
Definition: channel.h:347
struct ast_channel_iterator * ast_channel_iterator_destroy(struct ast_channel_iterator *i)
Destroy a channel iterator.
Definition: channel.c:1649
const ast_string_field musicclass
Definition: channel.h:787
const ast_string_field accountcode
Definition: channel.h:787
int hangupcause
Definition: channel.h:849
#define ASTCHANSTATE
Definition: agent.c:151
#define ASTCHANPICKUPGROUP
Definition: agent.c:150
struct timeval whentohangup
Definition: channel.h:789
unsigned char valid
TRUE if the name information is valid/present.
Definition: channel.h:229
#define ASTCHANNAME
Definition: agent.c:130
struct ast_channel_iterator * ast_channel_iterator_all_new(void)
Create a new channel iterator.
Definition: channel.c:1701
int amaflags
Definition: channel.h:843
struct ast_channel_tech * tech
Definition: channel.h:743
int ast_active_channels(void)
returns number of active/allocated channels
Definition: channel.c:848
int header_simple_table(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **, int)
unsigned char valid
TRUE if the number information is valid/present.
Definition: channel.h:247
const ast_string_field language
Definition: channel.h:787
char exten[AST_MAX_EXTENSION]
Definition: channel.h:869
#define ASTCHANFORWARDTO
Definition: agent.c:147
#define ASTCHANPRI
Definition: agent.c:145
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.
Definition: pbx.c:10444
struct ast_party_number number
Subscriber phone number.
Definition: channel.h:292
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().

651 {
652  static unsigned long long_ret;
653  struct timeval tval;
654 
655  if (header_generic(vp, name, length, exact, var_len, write_method))
656  return NULL;
657 
658  switch (vp->magic) {
659  case ASTCONFUPTIME:
660  gettimeofday(&tval, NULL);
661  long_ret = difftime(tval.tv_sec, ast_startuptime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_startuptime.tv_usec / 10000;
662  return (u_char *)&long_ret;
663  case ASTCONFRELOADTIME:
664  gettimeofday(&tval, NULL);
665  if (ast_lastreloadtime.tv_sec)
666  long_ret = difftime(tval.tv_sec, ast_lastreloadtime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_lastreloadtime.tv_usec / 10000;
667  else
668  long_ret = difftime(tval.tv_sec, ast_startuptime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_startuptime.tv_usec / 10000;
669  return (u_char *)&long_ret;
670  case ASTCONFPID:
671  long_ret = getpid();
672  return (u_char *)&long_ret;
673  case ASTCONFSOCKET:
674  *var_len = strlen(ast_config_AST_SOCKET);
675  return (u_char *)ast_config_AST_SOCKET;
676  case ASTCONFACTIVECALLS:
677  long_ret = ast_active_calls();
678  return (u_char *)&long_ret;
680  long_ret = ast_processed_calls();
681  return (u_char *)&long_ret;
682  default:
683  break;
684  }
685  return NULL;
686 }
#define ASTCONFUPTIME
Definition: agent.c:105
int ast_active_calls(void)
Retrieve the number of active calls.
Definition: pbx.c:5931
#define ASTCONFSOCKET
Definition: agent.c:108
#define ASTCONFRELOADTIME
Definition: agent.c:106
struct timeval ast_lastreloadtime
Definition: asterisk.c:219
int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
int ast_processed_calls(void)
Retrieve the total number of calls processed through the PBX since last restart.
Definition: pbx.c:5936
#define ASTCONFACTIVECALLS
Definition: agent.c:109
static const char name[]
struct timeval ast_startuptime
Definition: asterisk.c:218
const char * ast_config_AST_SOCKET
Definition: asterisk.c:270
#define ASTCONFPID
Definition: agent.c:107
#define ASTCONFPROCESSEDCALLS
Definition: agent.c:110
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().

690 {
691  static unsigned long long_ret;
692  static char ret_buf[128];
693  struct ast_tone_zone *tz = NULL;
694 
695  if (header_generic(vp, name, length, exact, var_len, write_method))
696  return NULL;
697 
698  switch (vp->magic) {
699  case ASTINDCOUNT:
700  {
701  struct ao2_iterator i;
702 
703  long_ret = 0;
704 
706  while ((tz = ao2_iterator_next(&i))) {
707  tz = ast_tone_zone_unref(tz);
708  long_ret++;
709  }
711 
712  return (u_char *) &long_ret;
713  }
714  case ASTINDCURRENT:
715  tz = ast_get_indication_zone(NULL);
716  if (tz) {
717  ast_copy_string(ret_buf, tz->country, sizeof(ret_buf));
718  *var_len = strlen(ret_buf);
719  tz = ast_tone_zone_unref(tz);
720  return (u_char *) ret_buf;
721  }
722  *var_len = 0;
723  return NULL;
724  default:
725  break;
726  }
727  return NULL;
728 }
static struct ast_tone_zone * ast_tone_zone_unref(struct ast_tone_zone *tz)
Release a reference to an ast_tone_zone.
Definition: indications.h:204
#define ao2_iterator_next(arg1)
Definition: astobj2.h:1126
#define ASTINDCURRENT
Definition: agent.c:117
static char * tz
Definition: cdr_pgsql.c:56
A set of tones for a given locale.
Definition: indications.h:73
int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
#define ASTINDCOUNT
Definition: agent.c:116
struct ast_tone_zone * ast_get_indication_zone(const char *country)
locate ast_tone_zone
Definition: indications.c:451
static const char name[]
char country[16]
Country code that this set of tones is for.
Definition: indications.h:75
void ao2_iterator_destroy(struct ao2_iterator *i)
Destroy a container iterator.
Definition: astobj2.c:833
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Definition: astobj2.h:1053
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:223
struct ao2_iterator ast_tone_zone_iterator_init(void)
Get an iterator for the available tone zones.
Definition: indications.c:421
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().

732 {
733  static unsigned long long_ret;
734  static char ret_buf[256];
735  struct ast_tone_zone *tz = NULL;
736  int i;
737  struct ao2_iterator iter;
738 
739  if (header_simple_table(vp, name, length, exact, var_len, write_method, -1)) {
740  return NULL;
741  }
742 
743  i = name[*length - 1] - 1;
744 
746 
747  while ((tz = ao2_iterator_next(&iter)) && i) {
748  tz = ast_tone_zone_unref(tz);
749  i--;
750  }
751  ao2_iterator_destroy(&iter);
752 
753  if (tz == NULL) {
754  return NULL;
755  }
756 
757  switch (vp->magic) {
758  case ASTINDINDEX:
760  long_ret = name[*length - 1];
761  return (u_char *)&long_ret;
762  case ASTINDCOUNTRY:
763  ast_copy_string(ret_buf, tz->country, sizeof(ret_buf));
765  *var_len = strlen(ret_buf);
766  return (u_char *) ret_buf;
767  case ASTINDALIAS:
768  /* No longer exists */
770  return NULL;
771  case ASTINDDESCRIPTION:
772  ast_tone_zone_lock(tz);
773  ast_copy_string(ret_buf, tz->description, sizeof(ret_buf));
776  *var_len = strlen(ret_buf);
777  return (u_char *) ret_buf;
778  default:
780  break;
781  }
782  return NULL;
783 }
char description[40]
Text description of the given country.
Definition: indications.h:81
static struct ast_tone_zone * ast_tone_zone_unref(struct ast_tone_zone *tz)
Release a reference to an ast_tone_zone.
Definition: indications.h:204
#define ao2_iterator_next(arg1)
Definition: astobj2.h:1126
#define ast_tone_zone_unlock(tz)
Unlock an ast_tone_zone.
Definition: indications.h:192
#define ASTINDINDEX
Definition: agent.c:120
static char * tz
Definition: cdr_pgsql.c:56
A set of tones for a given locale.
Definition: indications.h:73
#define ASTINDDESCRIPTION
Definition: agent.c:123
#define ASTINDALIAS
Definition: agent.c:122
static const char name[]
char country[16]
Country code that this set of tones is for.
Definition: indications.h:75
void ao2_iterator_destroy(struct ao2_iterator *i)
Destroy a container iterator.
Definition: astobj2.c:833
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Definition: astobj2.h:1053
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:223
struct ao2_iterator ast_tone_zone_iterator_init(void)
Get an iterator for the available tone zones.
Definition: indications.c:421
#define ast_tone_zone_lock(tz)
Lock an ast_tone_zone.
Definition: indications.h:187
#define ASTINDCOUNTRY
Definition: agent.c:121
int header_simple_table(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **, int)
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().

792 {
793  static unsigned long long_ret;
794 
795  if (header_generic(vp, name, length, exact, var_len, write_method))
796  return NULL;
797 
798  if (vp->magic != ASTMODCOUNT)
799  return NULL;
800 
801  long_ret = ast_update_module_list(countmodule, NULL);
802 
803  return (u_char *)&long_ret;
804 }
static int countmodule(const char *mod, const char *desc, int use, const char *like)
Definition: agent.c:785
int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
static const char name[]
#define ASTMODCOUNT
Definition: agent.c:113
int ast_update_module_list(int(*modentry)(const char *module, const char *description, int usecnt, const char *like), const char *like)
Ask for a list of modules, descriptions, and use counts.
Definition: loader.c:1234
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().

808 {
809  static unsigned long long_ret;
810 
811  if (header_generic(vp, name, length, exact, var_len, write_method))
812  return NULL;
813 
814  switch (vp->magic) {
815  case ASTVERSTRING:
816  {
817  const char *version = ast_get_version();
818  *var_len = strlen(version);
819  return (u_char *)version;
820  }
821  case ASTVERTAG:
822  sscanf(ast_get_version_num(), "%30lu", &long_ret);
823  return (u_char *)&long_ret;
824  default:
825  break;
826  }
827  return NULL;
828 }
uint32_t version
const char * ast_get_version(void)
Retrieve the Asterisk version string.
Definition: version.c:14
#define ASTVERTAG
Definition: agent.c:102
int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
#define ASTVERSTRING
Definition: agent.c:101
static const char name[]
const char * ast_get_version_num(void)
Retrieve the numeric Asterisk version.
Definition: version.c:19
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().

786 {
787  return 1;
788 }
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  )
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().

837 {
838  static struct variable4 asterisk_vars[] = {
839  {ASTVERSTRING, ASN_OCTET_STR, RONLY, ast_var_Version, 2, {ASTVERSION, ASTVERSTRING}},
840  {ASTVERTAG, ASN_UNSIGNED, RONLY, ast_var_Version, 2, {ASTVERSION, ASTVERTAG}},
841  {ASTCONFUPTIME, ASN_TIMETICKS, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFUPTIME}},
842  {ASTCONFRELOADTIME, ASN_TIMETICKS, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFRELOADTIME}},
843  {ASTCONFPID, ASN_INTEGER, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFPID}},
844  {ASTCONFSOCKET, ASN_OCTET_STR, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFSOCKET}},
847  {ASTMODCOUNT, ASN_INTEGER, RONLY, ast_var_Modules , 2, {ASTMODULES, ASTMODCOUNT}},
848  {ASTINDCOUNT, ASN_INTEGER, RONLY, ast_var_indications, 2, {ASTINDICATIONS, ASTINDCOUNT}},
849  {ASTINDCURRENT, ASN_OCTET_STR, RONLY, ast_var_indications, 2, {ASTINDICATIONS, ASTINDCURRENT}},
852  {ASTINDALIAS, ASN_OCTET_STR, RONLY, ast_var_indications_table, 4, {ASTINDICATIONS, ASTINDTABLE, 1, ASTINDALIAS}},
854  {ASTCHANCOUNT, ASN_GAUGE, RONLY, ast_var_channels, 2, {ASTCHANNELS, ASTCHANCOUNT}},
855  {ASTCHANINDEX, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANINDEX}},
856  {ASTCHANNAME, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANNAME}},
858  {ASTCHANTYPE, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANTYPE}},
860  {ASTCHANBRIDGE, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANBRIDGE}},
861  {ASTCHANMASQ, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMASQ}},
862  {ASTCHANMASQR, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMASQR}},
864  {ASTCHANAPP, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANAPP}},
865  {ASTCHANDATA, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANDATA}},
870  {ASTCHANEXTEN, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANEXTEN}},
871  {ASTCHANPRI, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANPRI}},
877  {ASTCHANSTATE, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANSTATE}},
878  {ASTCHANMUTED, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMUTED}},
879  {ASTCHANRINGS, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANRINGS}},
881  {ASTCHANCIDNUM, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDNUM}},
883  {ASTCHANCIDANI, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDANI}},
890  {ASTCHANADSI, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANADSI}},
894  {ASTCHANFLAGS, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANFLAGS}},
905  };
906 
908  "ASTERISK-MIB implementation for Asterisk.");
909 
910  REGISTER_MIB("res_snmp", asterisk_vars, variable4, asterisk_oid);
911 
912  snmp_register_callback(SNMP_CALLBACK_LIBRARY,
913  SNMP_CALLBACK_SHUTDOWN,
914  term_asterisk_mib, NULL);
915 }
#define ASTINDTABLE
Definition: agent.c:119
static u_char * ast_var_indications(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:688
#define ASTCHANCIDNUM
Definition: agent.c:155
#define ASTCONFUPTIME
Definition: agent.c:105
static u_char * ast_var_Modules(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:790
#define ASTCHANTYPEINDEX
Definition: agent.c:174
#define ASTVERSION
Definition: agent.c:100
#define ASTCHANTYPENAME
Definition: agent.c:175
#define ASTCHANMUTED
Definition: agent.c:152
#define ASTCHANVARIABLES
Definition: agent.c:167
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)
Definition: agent.c:549
#define ASTCHANCIDTON
Definition: agent.c:161
#define ASTCHANBRIDGE
Definition: agent.c:134
#define ASTCHANMASQ
Definition: agent.c:135
#define ASTINDINDEX
Definition: agent.c:120
#define ASTCHANADSI
Definition: agent.c:164
#define ASTCHANCONTEXT
Definition: agent.c:140
#define ASTINDCURRENT
Definition: agent.c:117
#define ASTVERTAG
Definition: agent.c:102
#define ASTCHANINDEX
Definition: agent.c:129
#define ASTCHANWHENHANGUP
Definition: agent.c:137
#define ASTCHANCIDANI
Definition: agent.c:157
#define ASTCHANUNIQUEID
Definition: agent.c:148
static u_char * ast_var_indications_table(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:730
#define ASTCONFSOCKET
Definition: agent.c:108
#define ASTCHANDATA
Definition: agent.c:139
static int term_asterisk_mib(int majorID, int minorID, void *serverarg, void *clientarg)
Definition: agent.c:830
#define ASTCHANMACROEXTEN
Definition: agent.c:142
#define ASTCHANCIDTNS
Definition: agent.c:162
#define ASTCHANHANGUPCAUSE
Definition: agent.c:166
#define ASTCHANCIDRDNIS
Definition: agent.c:158
static oid asterisk_oid[]
Definition: agent.c:93
#define ASTCHANCOUNT
Definition: agent.c:126
#define ASTCHANACCOUNTCODE
Definition: agent.c:146
#define ASTCHANTYPECOUNT
Definition: agent.c:171
#define ASTCHANRINGS
Definition: agent.c:153
#define ASTCONFRELOADTIME
Definition: agent.c:106
#define ASTCHANAMAFLAGS
Definition: agent.c:163
#define ASTCHANEXTEN
Definition: agent.c:144
#define ASTCHANBRIDGECOUNT
Definition: agent.c:183
#define ASTCHANLANGUAGE
Definition: agent.c:131
#define ASTCHANAPP
Definition: agent.c:138
#define ASTCHANCIDANI2
Definition: agent.c:160
#define ASTCHANCIDDNID
Definition: agent.c:154
#define ASTCHANMUSICCLASS
Definition: agent.c:133
#define ASTINDCOUNT
Definition: agent.c:116
#define ASTCHANTYPE
Definition: agent.c:132
#define ASTCHANTYPETABLE
Definition: agent.c:173
static u_char * ast_var_Config(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:649
#define ASTCONFACTIVECALLS
Definition: agent.c:109
#define ASTINDDESCRIPTION
Definition: agent.c:123
#define ASTINDALIAS
Definition: agent.c:122
#define ASTCHANTRANSFERCAP
Definition: agent.c:169
#define ASTCONFIGURATION
Definition: agent.c:104
#define ASTCHANTYPECHANNELS
Definition: agent.c:180
#define ASTCHANTYPEDEVSTATE
Definition: agent.c:177
#define ASTCHANTABLE
Definition: agent.c:128
#define ASTVERSTRING
Definition: agent.c:101
#define ASTCHANMACROPRI
Definition: agent.c:143
static u_char * ast_var_channel_bridge(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:616
#define ASTCHANTONEZONE
Definition: agent.c:165
#define ASTCHANTYPEDESC
Definition: agent.c:176
static u_char * ast_var_channels_table(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:232
#define ASTCHANTYPETRANSFER
Definition: agent.c:179
static u_char * ast_var_channels(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:216
#define ASTCHANCIDPRES
Definition: agent.c:159
#define ASTCHANCALLGROUP
Definition: agent.c:149
static u_char * ast_var_channel_types(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:530
#define ASTCHANFLAGS
Definition: agent.c:168
#define ASTCHANMACROCONTEXT
Definition: agent.c:141
#define ASTCHANCIDNAME
Definition: agent.c:156
#define ASTMODCOUNT
Definition: agent.c:113
#define ASTCHANMASQR
Definition: agent.c:136
#define ASTCHANSCALARS
Definition: agent.c:182
#define ASTMODULES
Definition: agent.c:112
#define ASTCHANSTATE
Definition: agent.c:151
static u_char * ast_var_Version(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:806
#define ASTCHANPICKUPGROUP
Definition: agent.c:150
#define ASTCHANNAME
Definition: agent.c:130
#define ASTINDICATIONS
Definition: agent.c:115
#define ASTCHANNELS
Definition: agent.c:125
#define ASTCONFPID
Definition: agent.c:107
#define ASTINDCOUNTRY
Definition: agent.c:121
#define ASTCHANTYPEINDICATIONS
Definition: agent.c:178
#define ASTCHANFORWARDTO
Definition: agent.c:147
int register_sysORTable(oid *, size_t, const char *)
#define ASTCONFPROCESSEDCALLS
Definition: agent.c:110
#define ASTCHANPRI
Definition: agent.c:145
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().

831 {
833  return 0;
834 }
static oid asterisk_oid[]
Definition: agent.c:93
int unregister_sysORTable(oid *, size_t)
int unregister_sysORTable ( oid *  ,
size_t   
)

Referenced by term_asterisk_mib().

Variable Documentation

oid asterisk_oid[] = { 1, 3, 6, 1, 4, 1, 22736, 1 }
static

Definition at line 93 of file agent.c.