[asterisk-commits] jeffg: branch jeffg/jeffg-moresnmp-branch r180678 - in /team/jeffg/jeffg-more...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Mar 7 14:59:39 CST 2009


Author: jeffg
Date: Sat Mar  7 14:59:35 2009
New Revision: 180678

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=180678
Log:
res_snmp rework: all scalars from existing ASTERISK-MIB now coded in new style

Added:
    team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskChannels/
    team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskChannels/asteriskChannels.c   (with props)
    team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskChannels/asteriskChannels.h   (with props)
    team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskConfiguration/
    team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskConfiguration/asteriskConfiguration.c   (with props)
    team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskConfiguration/asteriskConfiguration.h   (with props)
    team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskIndications/
    team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskIndications/asteriskIndications.c   (with props)
    team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskIndications/asteriskIndications.h   (with props)
    team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskModules/
    team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskModules/asteriskModules.c   (with props)
    team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskModules/asteriskModules.h   (with props)
Modified:
    team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskVersion/asteriskVersion.c

Added: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskChannels/asteriskChannels.c
URL: http://svn.digium.com/svn-view/asterisk/team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskChannels/asteriskChannels.c?view=auto&rev=180678
==============================================================================
--- team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskChannels/asteriskChannels.c (added)
+++ team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskChannels/asteriskChannels.c Sat Mar  7 14:59:35 2009
@@ -1,0 +1,163 @@
+/*
+ * Copyright (C) 2009 The OpenNMS Group, Inc.
+ * Jeff Gehlbach <jeffg at opennms.org>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief SNMP for Asterisk: implementation of asteriskChannel scalars
+ *
+ * \author Jeff Gehlbach <jeffg at opennms.org>
+ */
+
+#include "asterisk.h"
+ASTERISK_FILE_VERSION(__FILE__, "$Revision: 180676 $")
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $
+ */
+
+/* Asterisk includes */
+#include "asterisk/channel.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 "asteriskChannels.h"
+
+/** Initializes the asteriskChannels module */
+void
+init_asteriskChannels(void)
+{
+    static oid astNumChannels_oid[] = { 1,3,6,1,4,1,22736,1,5,1 };
+    static oid astNumChanTypes_oid[] = { 1,3,6,1,4,1,22736,1,5,3 };
+    static oid astNumChanBridge_oid[] = { 1,3,6,1,4,1,22736,1,5,5,1 };
+
+  DEBUGMSGTL(("asteriskChannels", "Initializing\n"));
+
+    netsnmp_register_scalar(
+        netsnmp_create_handler_registration("astNumChannels", handle_astNumChannels,
+                               astNumChannels_oid, OID_LENGTH(astNumChannels_oid),
+                               HANDLER_CAN_RONLY
+        ));
+    netsnmp_register_scalar(
+        netsnmp_create_handler_registration("astNumChanTypes", handle_astNumChanTypes,
+                               astNumChanTypes_oid, OID_LENGTH(astNumChanTypes_oid),
+                               HANDLER_CAN_RONLY
+        ));
+    netsnmp_register_scalar(
+        netsnmp_create_handler_registration("astNumChanBridge", handle_astNumChanBridge,
+                               astNumChanBridge_oid, OID_LENGTH(astNumChanBridge_oid),
+                               HANDLER_CAN_RONLY
+        ));
+}
+
+int
+handle_astNumChannels(netsnmp_mib_handler *handler,
+                          netsnmp_handler_registration *reginfo,
+                          netsnmp_agent_request_info   *reqinfo,
+                          netsnmp_request_info         *requests)
+{
+    static unsigned long asterisk_num_channels;
+
+    /* We are never called for a GETNEXT if it's registered as a
+       "instance", as it's "magically" handled for us.  */
+
+    /* a instance handler also only hands us one request at a time, so
+       we don't need to loop over a list of requests; we'll only get one. */
+    
+    switch(reqinfo->mode) {
+
+        case MODE_GET:
+            asterisk_num_channels = ast_active_channels();
+            snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE,
+                                     (u_char *)&asterisk_num_channels,
+                                     sizeof(unsigned long));
+            break;
+
+
+        default:
+            /* we should never get here, so this is a really bad error */
+            snmp_log(LOG_ERR, "unknown mode (%d) in handle_astNumChannels\n", reqinfo->mode );
+            return SNMP_ERR_GENERR;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+int
+handle_astNumChanTypes(netsnmp_mib_handler *handler,
+                          netsnmp_handler_registration *reginfo,
+                          netsnmp_agent_request_info   *reqinfo,
+                          netsnmp_request_info         *requests)
+{
+    static unsigned long asterisk_num_channel_types;
+    struct ast_variable *channel_types, *next;
+
+    /* We are never called for a GETNEXT if it's registered as a
+       "instance", as it's "magically" handled for us.  */
+
+    /* a instance handler also only hands us one request at a time, so
+       we don't need to loop over a list of requests; we'll only get one. */
+    
+    switch(reqinfo->mode) {
+
+        case MODE_GET:
+            for (asterisk_num_channel_types = 0; (channel_types = next = ast_channeltype_list()); next = next->next)
+                asterisk_num_channel_types++;
+            ast_variables_destroy(channel_types);
+            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
+                                     (u_char *)&asterisk_num_channel_types,
+                                     sizeof(unsigned long));
+            break;
+
+
+        default:
+            /* we should never get here, so this is a really bad error */
+            snmp_log(LOG_ERR, "unknown mode (%d) in handle_astNumChanTypes\n", reqinfo->mode );
+            return SNMP_ERR_GENERR;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+int
+handle_astNumChanBridge(netsnmp_mib_handler *handler,
+                          netsnmp_handler_registration *reginfo,
+                          netsnmp_agent_request_info   *reqinfo,
+                          netsnmp_request_info         *requests)
+{
+    static unsigned long asterisk_num_channels_bridged;
+    struct ast_channel *chan = NULL;
+
+    /* We are never called for a GETNEXT if it's registered as a
+       "instance", as it's "magically" handled for us.  */
+
+    /* a instance handler also only hands us one request at a time, so
+       we don't need to loop over a list of requests; we'll only get one. */
+    
+    switch(reqinfo->mode) {
+
+        case MODE_GET:
+            while ((chan = ast_channel_walk_locked(chan))) {
+                if (ast_bridged_channel(chan))
+                    asterisk_num_channels_bridged++;
+                ast_channel_unlock(chan);
+            }
+            snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE,
+                                     (u_char *)&asterisk_num_channels_bridged,
+                                     sizeof(unsigned long));
+            break;
+
+
+        default:
+            /* we should never get here, so this is a really bad error */
+            snmp_log(LOG_ERR, "unknown mode (%d) in handle_astNumChanBridge\n", reqinfo->mode );
+            return SNMP_ERR_GENERR;
+    }
+
+    return SNMP_ERR_NOERROR;
+}

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskChannels/asteriskChannels.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskChannels/asteriskChannels.c
------------------------------------------------------------------------------
    svn:keywords = 'Author Date Id Revision'

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskChannels/asteriskChannels.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskChannels/asteriskChannels.h
URL: http://svn.digium.com/svn-view/asterisk/team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskChannels/asteriskChannels.h?view=auto&rev=180678
==============================================================================
--- team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskChannels/asteriskChannels.h (added)
+++ team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskChannels/asteriskChannels.h Sat Mar  7 14:59:35 2009
@@ -1,0 +1,30 @@
+/*
+ * Copyright (C) 2009 The OpenNMS Group, Inc.
+ * Jeff Gehlbach <jeffg at opennms.org>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief SNMP for Asterisk: implementation of asteriskChannel scalars
+ *
+ * \author Jeff Gehlbach <jeffg at opennms.org>
+ */
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $
+ */
+#ifndef ASTERISKCHANNELS_H
+#define ASTERISKCHANNELS_H
+
+/* function declarations */
+void init_asteriskChannels(void);
+Netsnmp_Node_Handler handle_astNumChannels;
+Netsnmp_Node_Handler handle_astNumChanTypes;
+Netsnmp_Node_Handler handle_astNumChanBridge;
+
+#endif /* ASTERISKCHANNELS_H */

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskChannels/asteriskChannels.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskChannels/asteriskChannels.h
------------------------------------------------------------------------------
    svn:keywords = 'Author Date Id Revision'

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskChannels/asteriskChannels.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskConfiguration/asteriskConfiguration.c
URL: http://svn.digium.com/svn-view/asterisk/team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskConfiguration/asteriskConfiguration.c?view=auto&rev=180678
==============================================================================
--- team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskConfiguration/asteriskConfiguration.c (added)
+++ team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskConfiguration/asteriskConfiguration.c Sat Mar  7 14:59:35 2009
@@ -1,0 +1,277 @@
+/*
+ * Copyright (C) 2009 The OpenNMS Group, Inc.
+ * Jeff Gehlbach <jeffg at opennms.org>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief SNMP for Asterisk: implementation of asteriskConfiguration scalars
+ *
+ * \author Jeff Gehlbach <jeffg at opennms.org>
+ */
+
+#include "asterisk.h"
+ASTERISK_FILE_VERSION(__FILE__, "$Revision: 180676 $")
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $
+ */
+
+/* Asterisk includes */
+#include "asterisk/options.h"
+#include "asterisk/paths.h"
+#include "asterisk/pbx.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 "asteriskConfiguration.h"
+
+/** Initializes the asteriskConfiguration module */
+void
+init_asteriskConfiguration(void)
+{
+    static oid astConfigUpTime_oid[] = { 1,3,6,1,4,1,22736,1,2,1 };
+    static oid astConfigReloadTime_oid[] = { 1,3,6,1,4,1,22736,1,2,2 };
+    static oid astConfigPid_oid[] = { 1,3,6,1,4,1,22736,1,2,3 };
+    static oid astConfigSocket_oid[] = { 1,3,6,1,4,1,22736,1,2,4 };
+    static oid astConfigCallsActive_oid[] = { 1,3,6,1,4,1,22736,1,2,5 };
+    static oid astConfigCallsProcessed_oid[] = { 1,3,6,1,4,1,22736,1,2,6 };
+
+  DEBUGMSGTL(("asteriskConfiguration", "Initializing\n"));
+
+    netsnmp_register_scalar(
+        netsnmp_create_handler_registration("astConfigUpTime", handle_astConfigUpTime,
+                               astConfigUpTime_oid, OID_LENGTH(astConfigUpTime_oid),
+                               HANDLER_CAN_RONLY
+        ));
+    netsnmp_register_scalar(
+        netsnmp_create_handler_registration("astConfigReloadTime", handle_astConfigReloadTime,
+                               astConfigReloadTime_oid, OID_LENGTH(astConfigReloadTime_oid),
+                               HANDLER_CAN_RONLY
+        ));
+    netsnmp_register_scalar(
+        netsnmp_create_handler_registration("astConfigPid", handle_astConfigPid,
+                               astConfigPid_oid, OID_LENGTH(astConfigPid_oid),
+                               HANDLER_CAN_RONLY
+        ));
+    netsnmp_register_scalar(
+        netsnmp_create_handler_registration("astConfigSocket", handle_astConfigSocket,
+                               astConfigSocket_oid, OID_LENGTH(astConfigSocket_oid),
+                               HANDLER_CAN_RONLY
+        ));
+    netsnmp_register_scalar(
+        netsnmp_create_handler_registration("astConfigCallsActive", handle_astConfigCallsActive,
+                               astConfigCallsActive_oid, OID_LENGTH(astConfigCallsActive_oid),
+                               HANDLER_CAN_RONLY
+        ));
+    netsnmp_register_scalar(
+        netsnmp_create_handler_registration("astConfigCallsProcessed", handle_astConfigCallsProcessed,
+                               astConfigCallsProcessed_oid, OID_LENGTH(astConfigCallsProcessed_oid),
+                               HANDLER_CAN_RONLY
+        ));
+}
+
+int
+handle_astConfigUpTime(netsnmp_mib_handler *handler,
+                          netsnmp_handler_registration *reginfo,
+                          netsnmp_agent_request_info   *reqinfo,
+                          netsnmp_request_info         *requests)
+{
+    static unsigned long asterisk_uptime;
+    struct timeval tval;
+
+    /* We are never called for a GETNEXT if it's registered as a
+       "instance", as it's "magically" handled for us.  */
+
+    /* a instance handler also only hands us one request at a time, so
+       we don't need to loop over a list of requests; we'll only get one. */
+    
+    switch(reqinfo->mode) {
+
+        case MODE_GET:
+            gettimeofday(&tval, NULL);
+            /* This value is expressed in TimeTicks or centiseconds */
+            asterisk_uptime = difftime(tval.tv_sec, ast_startuptime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_startuptime.tv_usec / 10000;
+            snmp_set_var_typed_value(requests->requestvb, ASN_TIMETICKS,
+                                     (u_char *)&asterisk_uptime,
+                                     sizeof(unsigned long));
+            break;
+
+
+        default:
+            /* we should never get here, so this is a really bad error */
+            snmp_log(LOG_ERR, "unknown mode (%d) in handle_astConfigUpTime\n", reqinfo->mode );
+            return SNMP_ERR_GENERR;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+int
+handle_astConfigReloadTime(netsnmp_mib_handler *handler,
+                          netsnmp_handler_registration *reginfo,
+                          netsnmp_agent_request_info   *reqinfo,
+                          netsnmp_request_info         *requests)
+{
+    static unsigned long asterisk_reloadtime;
+    struct timeval tval;
+
+    /* We are never called for a GETNEXT if it's registered as a
+       "instance", as it's "magically" handled for us.  */
+
+    /* a instance handler also only hands us one request at a time, so
+       we don't need to loop over a list of requests; we'll only get one. */
+    
+    switch(reqinfo->mode) {
+
+        case MODE_GET:
+            gettimeofday(&tval, NULL);
+            /* This value is expressed in TimeTicks or centiseconds */
+            if (ast_lastreloadtime.tv_sec)
+                asterisk_reloadtime = difftime(tval.tv_sec, ast_lastreloadtime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_lastreloadtime.tv_usec / 10000;
+            else
+                asterisk_reloadtime = difftime(tval.tv_sec, ast_startuptime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_startuptime.tv_usec / 10000;
+            snmp_set_var_typed_value(requests->requestvb, ASN_TIMETICKS,
+                                     (u_char *)&asterisk_reloadtime,
+                                     sizeof(unsigned long));
+            break;
+
+
+        default:
+            /* we should never get here, so this is a really bad error */
+            snmp_log(LOG_ERR, "unknown mode (%d) in handle_astConfigReloadTime\n", reqinfo->mode );
+            return SNMP_ERR_GENERR;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+int
+handle_astConfigPid(netsnmp_mib_handler *handler,
+                          netsnmp_handler_registration *reginfo,
+                          netsnmp_agent_request_info   *reqinfo,
+                          netsnmp_request_info         *requests)
+{
+    static unsigned long asterisk_pid;
+
+    /* We are never called for a GETNEXT if it's registered as a
+       "instance", as it's "magically" handled for us.  */
+
+    /* a instance handler also only hands us one request at a time, so
+       we don't need to loop over a list of requests; we'll only get one. */
+    
+    switch(reqinfo->mode) {
+
+        case MODE_GET:
+            asterisk_pid = getpid();
+            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
+                                     (u_char *)asterisk_pid,
+                                     sizeof(unsigned long));
+            break;
+
+
+        default:
+            /* we should never get here, so this is a really bad error */
+            snmp_log(LOG_ERR, "unknown mode (%d) in handle_astConfigPid\n", reqinfo->mode );
+            return SNMP_ERR_GENERR;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+int
+handle_astConfigSocket(netsnmp_mib_handler *handler,
+                          netsnmp_handler_registration *reginfo,
+                          netsnmp_agent_request_info   *reqinfo,
+                          netsnmp_request_info         *requests)
+{
+    /* We are never called for a GETNEXT if it's registered as a
+       "instance", as it's "magically" handled for us.  */
+
+    /* a instance handler also only hands us one request at a time, so
+       we don't need to loop over a list of requests; we'll only get one. */
+    
+    switch(reqinfo->mode) {
+
+        case MODE_GET:
+            snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
+                                     (u_char *)ast_config_AST_SOCKET,
+                                     strlen(ast_config_AST_SOCKET));
+            break;
+
+
+        default:
+            /* we should never get here, so this is a really bad error */
+            snmp_log(LOG_ERR, "unknown mode (%d) in handle_astConfigSocket\n", reqinfo->mode );
+            return SNMP_ERR_GENERR;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+int
+handle_astConfigCallsActive(netsnmp_mib_handler *handler,
+                          netsnmp_handler_registration *reginfo,
+                          netsnmp_agent_request_info   *reqinfo,
+                          netsnmp_request_info         *requests)
+{
+    static unsigned long asterisk_calls_active;
+
+    /* We are never called for a GETNEXT if it's registered as a
+       "instance", as it's "magically" handled for us.  */
+
+    /* a instance handler also only hands us one request at a time, so
+       we don't need to loop over a list of requests; we'll only get one. */
+    
+    switch(reqinfo->mode) {
+
+        case MODE_GET:
+            asterisk_calls_active = ast_active_calls();
+            snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE,
+                                     (u_char *)asterisk_calls_active,
+                                     sizeof(unsigned long));
+            break;
+
+
+        default:
+            /* we should never get here, so this is a really bad error */
+            snmp_log(LOG_ERR, "unknown mode (%d) in handle_astConfigCallsActive\n", reqinfo->mode );
+            return SNMP_ERR_GENERR;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+int
+handle_astConfigCallsProcessed(netsnmp_mib_handler *handler,
+                          netsnmp_handler_registration *reginfo,
+                          netsnmp_agent_request_info   *reqinfo,
+                          netsnmp_request_info         *requests)
+{
+    static unsigned long asterisk_calls_processed;
+
+    /* We are never called for a GETNEXT if it's registered as a
+       "instance", as it's "magically" handled for us.  */
+
+    /* a instance handler also only hands us one request at a time, so
+       we don't need to loop over a list of requests; we'll only get one. */
+    
+    switch(reqinfo->mode) {
+
+        case MODE_GET:
+            asterisk_calls_processed = ast_processed_calls();
+            snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+                                     (u_char *)asterisk_calls_processed,
+                                     sizeof(unsigned long));
+            break;
+
+
+        default:
+            /* we should never get here, so this is a really bad error */
+            snmp_log(LOG_ERR, "unknown mode (%d) in handle_astConfigCallsProcessed\n", reqinfo->mode );
+            return SNMP_ERR_GENERR;
+    }
+
+    return SNMP_ERR_NOERROR;
+}

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskConfiguration/asteriskConfiguration.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskConfiguration/asteriskConfiguration.c
------------------------------------------------------------------------------
    svn:keywords = 'Author Date Id Revision'

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskConfiguration/asteriskConfiguration.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskConfiguration/asteriskConfiguration.h
URL: http://svn.digium.com/svn-view/asterisk/team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskConfiguration/asteriskConfiguration.h?view=auto&rev=180678
==============================================================================
--- team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskConfiguration/asteriskConfiguration.h (added)
+++ team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskConfiguration/asteriskConfiguration.h Sat Mar  7 14:59:35 2009
@@ -1,0 +1,33 @@
+/*
+ * Copyright (C) 2009 The OpenNMS Group, Inc.
+ * Jeff Gehlbach <jeffg at opennms.org>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief SNMP for Asterisk: implementation of asteriskConfiguration scalars
+ *
+ * \author Jeff Gehlbach <jeffg at opennms.org>
+ */
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $
+ */
+#ifndef ASTERISKCONFIGURATION_H
+#define ASTERISKCONFIGURATION_H
+
+/* function declarations */
+void init_asteriskConfiguration(void);
+Netsnmp_Node_Handler handle_astConfigUpTime;
+Netsnmp_Node_Handler handle_astConfigReloadTime;
+Netsnmp_Node_Handler handle_astConfigPid;
+Netsnmp_Node_Handler handle_astConfigSocket;
+Netsnmp_Node_Handler handle_astConfigCallsActive;
+Netsnmp_Node_Handler handle_astConfigCallsProcessed;
+
+#endif /* ASTERISKCONFIGURATION_H */

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskConfiguration/asteriskConfiguration.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskConfiguration/asteriskConfiguration.h
------------------------------------------------------------------------------
    svn:keywords = 'Author Date Id Revision'

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskConfiguration/asteriskConfiguration.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskIndications/asteriskIndications.c
URL: http://svn.digium.com/svn-view/asterisk/team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskIndications/asteriskIndications.c?view=auto&rev=180678
==============================================================================
--- team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskIndications/asteriskIndications.c (added)
+++ team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskIndications/asteriskIndications.c Sat Mar  7 14:59:35 2009
@@ -1,0 +1,126 @@
+/*
+ * Copyright (C) 2009 The OpenNMS Group, Inc.
+ * Jeff Gehlbach <jeffg at opennms.org>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief SNMP for Asterisk: implementation of asteriskIndications scalars
+ *
+ * \author Jeff Gehlbach <jeffg at opennms.org>
+ */
+
+#include "asterisk.h"
+ASTERISK_FILE_VERSION(__FILE__, "$Revision: 180676 $")
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $
+ */
+
+/* Asterisk includes */
+#include "asterisk/linkedlists.h"
+#include "asterisk/indications.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 "asteriskIndications.h"
+
+/** Initializes the asteriskIndications module */
+void
+init_asteriskIndications(void)
+{
+    static oid astNumIndications_oid[] = { 1,3,6,1,4,1,22736,1,4,1 };
+    static oid astCurrentIndication_oid[] = { 1,3,6,1,4,1,22736,1,4,2 };
+
+  DEBUGMSGTL(("asteriskIndications", "Initializing\n"));
+
+    netsnmp_register_scalar(
+        netsnmp_create_handler_registration("astNumIndications", handle_astNumIndications,
+                               astNumIndications_oid, OID_LENGTH(astNumIndications_oid),
+                               HANDLER_CAN_RONLY
+        ));
+    netsnmp_register_scalar(
+        netsnmp_create_handler_registration("astCurrentIndication", handle_astCurrentIndication,
+                               astCurrentIndication_oid, OID_LENGTH(astCurrentIndication_oid),
+                               HANDLER_CAN_RONLY
+        ));
+}
+
+int
+handle_astNumIndications(netsnmp_mib_handler *handler,
+                          netsnmp_handler_registration *reginfo,
+                          netsnmp_agent_request_info   *reqinfo,
+                          netsnmp_request_info         *requests)
+{
+    static unsigned long asterisk_num_indications;
+    struct ind_tone_zone *tz = NULL;
+
+    /* We are never called for a GETNEXT if it's registered as a
+       "instance", as it's "magically" handled for us.  */
+
+    /* a instance handler also only hands us one request at a time, so
+       we don't need to loop over a list of requests; we'll only get one. */
+    
+    switch(reqinfo->mode) {
+
+        case MODE_GET:
+            asterisk_num_indications = 0;
+            while ((tz = ast_walk_indications(tz)))
+                asterisk_num_indications++;
+            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
+                                     (u_char *)&asterisk_num_indications,
+                                     sizeof(unsigned long));
+            break;
+
+
+        default:
+            /* we should never get here, so this is a really bad error */
+            snmp_log(LOG_ERR, "unknown mode (%d) in handle_astNumIndications\n", reqinfo->mode );
+            return SNMP_ERR_GENERR;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+int
+handle_astCurrentIndication(netsnmp_mib_handler *handler,
+                          netsnmp_handler_registration *reginfo,
+                          netsnmp_agent_request_info   *reqinfo,
+                          netsnmp_request_info         *requests)
+{
+    struct ind_tone_zone *tz = NULL;
+
+    /* We are never called for a GETNEXT if it's registered as a
+       "instance", as it's "magically" handled for us.  */
+
+    /* a instance handler also only hands us one request at a time, so
+       we don't need to loop over a list of requests; we'll only get one. */
+    
+    switch(reqinfo->mode) {
+
+        case MODE_GET:
+            tz = ast_get_indication_zone(NULL);
+            if(tz) {
+                snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
+                                         (u_char *)tz->country,
+                                         strlen(tz->country));
+            } else {
+                snmp_log(LOG_ERR, "Could not determine current indication zone in handle_astCurrentIndication\n");
+                return SNMP_ERR_GENERR;
+            }
+            break;
+
+
+        default:
+            /* we should never get here, so this is a really bad error */
+            snmp_log(LOG_ERR, "unknown mode (%d) in handle_astCurrentIndication\n", reqinfo->mode );
+            return SNMP_ERR_GENERR;
+    }
+
+    return SNMP_ERR_NOERROR;
+}

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskIndications/asteriskIndications.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskIndications/asteriskIndications.c
------------------------------------------------------------------------------
    svn:keywords = 'Author Date Id Revision'

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskIndications/asteriskIndications.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskIndications/asteriskIndications.h
URL: http://svn.digium.com/svn-view/asterisk/team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskIndications/asteriskIndications.h?view=auto&rev=180678
==============================================================================
--- team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskIndications/asteriskIndications.h (added)
+++ team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskIndications/asteriskIndications.h Sat Mar  7 14:59:35 2009
@@ -1,0 +1,29 @@
+/*
+ * Copyright (C) 2009 The OpenNMS Group, Inc.
+ * Jeff Gehlbach <jeffg at opennms.org>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief SNMP for Asterisk: implementation of asteriskIndications scalars
+ *
+ * \author Jeff Gehlbach <jeffg at opennms.org>
+ */
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $
+ */
+#ifndef ASTERISKINDICATIONS_H
+#define ASTERISKINDICATIONS_H
+
+/* function declarations */
+void init_asteriskIndications(void);
+Netsnmp_Node_Handler handle_astNumIndications;
+Netsnmp_Node_Handler handle_astCurrentIndication;
+
+#endif /* ASTERISKINDICATIONS_H */

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskIndications/asteriskIndications.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskIndications/asteriskIndications.h
------------------------------------------------------------------------------
    svn:keywords = 'Author Date Id Revision'

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskIndications/asteriskIndications.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskModules/asteriskModules.c
URL: http://svn.digium.com/svn-view/asterisk/team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskModules/asteriskModules.c?view=auto&rev=180678
==============================================================================
--- team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskModules/asteriskModules.c (added)
+++ team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskModules/asteriskModules.c Sat Mar  7 14:59:35 2009
@@ -1,0 +1,84 @@
+/*
+ * Copyright (C) 2009 The OpenNMS Group, Inc.
+ * Jeff Gehlbach <jeffg at opennms.org>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief SNMP for Asterisk: implementation of asteriskModules scalars
+ *
+ * \author Jeff Gehlbach <jeffg at opennms.org>
+ */
+
+#include "asterisk.h"
+ASTERISK_FILE_VERSION(__FILE__, "$Revision: 180676 $")
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $
+ */
+
+/* Asterisk includes */
+#include "asterisk/module.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 "asteriskModules.h"
+
+/** Initializes the asteriskModules module */
+void
+init_asteriskModules(void)
+{
+    static oid astNumModules_oid[] = { 1,3,6,1,4,1,22736,1,3,1 };
+
+  DEBUGMSGTL(("asteriskModules", "Initializing\n"));
+
+    netsnmp_register_scalar(
+        netsnmp_create_handler_registration("astNumModules", handle_astNumModules,
+                               astNumModules_oid, OID_LENGTH(astNumModules_oid),
+                               HANDLER_CAN_RONLY
+        ));
+}
+
+static int countmodule(const char *mod, const char *desc, int use, const char *like)
+{
+	return 1;
+}
+
+int
+handle_astNumModules(netsnmp_mib_handler *handler,
+                          netsnmp_handler_registration *reginfo,
+                          netsnmp_agent_request_info   *reqinfo,
+                          netsnmp_request_info         *requests)
+{
+    static unsigned long asterisk_num_modules;
+
+    /* We are never called for a GETNEXT if it's registered as a
+       "instance", as it's "magically" handled for us.  */
+
+    /* a instance handler also only hands us one request at a time, so
+       we don't need to loop over a list of requests; we'll only get one. */
+    
+    switch(reqinfo->mode) {
+
+        case MODE_GET:
+            asterisk_num_modules = ast_update_module_list(countmodule, NULL);
+            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
+                                     (u_char *)asterisk_num_modules,
+                                     sizeof(unsigned long));
+            break;
+
+
+        default:
+            /* we should never get here, so this is a really bad error */
+            snmp_log(LOG_ERR, "unknown mode (%d) in handle_astNumModules\n", reqinfo->mode );
+            return SNMP_ERR_GENERR;
+    }
+
+    return SNMP_ERR_NOERROR;
+}

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskModules/asteriskModules.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskModules/asteriskModules.c
------------------------------------------------------------------------------
    svn:keywords = 'Author Date Id Revision'

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskModules/asteriskModules.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskModules/asteriskModules.h
URL: http://svn.digium.com/svn-view/asterisk/team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskModules/asteriskModules.h?view=auto&rev=180678
==============================================================================
--- team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskModules/asteriskModules.h (added)
+++ team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskModules/asteriskModules.h Sat Mar  7 14:59:35 2009
@@ -1,0 +1,28 @@
+/*
+ * Copyright (C) 2009 The OpenNMS Group, Inc.
+ * Jeff Gehlbach <jeffg at opennms.org>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief SNMP for Asterisk: implementation of asteriskModules scalars
+ *
+ * \author Jeff Gehlbach <jeffg at opennms.org>
+ */
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $
+ */
+#ifndef ASTERISKMODULES_H
+#define ASTERISKMODULES_H
+
+/* function declarations */
+void init_asteriskModules(void);
+Netsnmp_Node_Handler handle_astNumModules;
+
+#endif /* ASTERISKMODULES_H */

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskModules/asteriskModules.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskModules/asteriskModules.h
------------------------------------------------------------------------------
    svn:keywords = 'Author Date Id Revision'

Propchange: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskModules/asteriskModules.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskVersion/asteriskVersion.c
URL: http://svn.digium.com/svn-view/asterisk/team/jeffg/jeffg-moresnmp-branch/res/snmp/mib_scalar_groups/asteriskVersion/asteriskVersion.c?view=diff&rev=180678&r1=180677&r2=180678
==============================================================================

[... 11 lines stripped ...]



More information about the asterisk-commits mailing list