ped_snmp.c File Reference

Routines related to SNMP. More...

#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include <net-snmp/agent/agent_trap.h>
#include <net-snmp/library/snmp_jnx_ext.h>
#include <jnx/netsnmp_trap.h>
#include <agent/snmpd.h>
#include <isc/eventlib.h>
#include <snmp/snmp_pathnames.h>
#include <sync/common.h>
#include "ped_snmp.h"
#include "ped_daemon_name.h"
#include "ped_policy_table.h"
#include "ped_services.h"
#include "ped_kcom.h"

Go to the source code of this file.

Functions

static void init_netsnmp_ds (void)
static int get_route_count (ped_policy_route_t *route)
static netsnmp_variable_list * table_get_next_data_point (void **loop_context, void **data_context, netsnmp_variable_list *put_index_data, netsnmp_iterator_info *data __unused)
static netsnmp_variable_list * table_get_first_data_point (void **loop_context, void **data_context, netsnmp_variable_list *put_index_data, netsnmp_iterator_info *data)
static int handler_if_table (netsnmp_mib_handler *handler __unused, netsnmp_handler_registration *reginfo __unused, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)
static int handler_snmp_ver (netsnmp_mib_handler *handler __unused, netsnmp_handler_registration *reginfo __unused, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)
static int handler_if_count (netsnmp_mib_handler *handler __unused, netsnmp_handler_registration *reginfo __unused, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)
static int handler_if_total (netsnmp_mib_handler *handler __unused, netsnmp_handler_registration *reginfo __unused, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)
static int handler_psd_state (netsnmp_mib_handler *handler __unused, netsnmp_handler_registration *reginfo __unused, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)
static int handler_psd_time (netsnmp_mib_handler *handler __unused, netsnmp_handler_registration *reginfo __unused, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)
static void init_mib_policy_table (void)
static void ped_init_mib (void)
void netsnmp_subagent_init (void)
void ped_notify_psd_state (boolean state)

Variables

evContext ped_ctx
 event context for ped
static oid if_total_oid [] = {PE_MIB_IF_TOTAL_OID}
 OID of the number of total interfaces.
static oid if_table_oid [] = {PE_MIB_IF_TABLE_OID}
 OID of the policy table.
static oid if_count_oid [] = {PE_MIB_IF_COUNT_OID}
 OID of the number of interfaces under management.
static oid snmp_ver_oid [] = {PE_MIB_SNMP_VER_OID}
 OID of the net-snmp version.
static oid psd_state_oid [] = {PE_MIB_PSD_STATE_OID}
 OID of the state of PSD connection.
static oid psd_time_oid [] = {PE_MIB_PSD_TIME_OID}
 OID of the up time of PSD connection.
static oid notify_psd_state_oid [] = {PE_MIB_NOTIFY_PSD_STATE_OID}
 OID of notification of the state of PSD connection.


Detailed Description

Routines related to SNMP.

Functions to intialize snmp sub-agent and process snmp requests.

Definition in file ped_snmp.c.


Function Documentation

static int get_route_count ( ped_policy_route_t route  )  [static]

Get the number of routes.

Parameters:
[in] route Pointer to route data in policy table.
Returns:
The number of routes.

Definition at line 87 of file ped_snmp.c.

References ped_policy_route_s::next.

Referenced by handler_if_table().

static int handler_if_count ( netsnmp_mib_handler *handler  __unused,
netsnmp_handler_registration *reginfo  __unused,
netsnmp_agent_request_info *  reqinfo,
netsnmp_request_info *  requests 
) [static]

Handler to process the requests of the number of managed interfaces.

Parameters:
[in] handler Pointer to mib handler.
[in] reginfo Pointer to handler registration info.
[in] reqinfo Pointer to agent request info.
[in,out] requests Pointer to requests.
Returns:
SNMP_ERR_NOERROR.

Definition at line 341 of file ped_snmp.c.

References policy_table_entry_count().

Referenced by ped_init_mib().

static int handler_if_table ( netsnmp_mib_handler *handler  __unused,
netsnmp_handler_registration *reginfo  __unused,
netsnmp_agent_request_info *  reqinfo,
netsnmp_request_info *  requests 
) [static]

Handler to process interface table requests.

Parameters:
[in] handler Pointer to mib handler.
[in] reginfo Pointer to handler registration info.
[in] reqinfo Pointer to agent request info.
[in,out] requests Pointer to requests.
Returns:
SNMP_ERR_NOERROR.

Definition at line 198 of file ped_snmp.c.

References policy_table_entry_s::af, policy_table_entry_s::filter, ped_policy_filter_s::filter_data, get_route_count(), policy_table_entry_s::ifname, policy_filter_msg_s::input_filter, policy_filter_msg_s::output_filter, and policy_table_entry_s::route.

Referenced by init_mib_policy_table().

static int handler_if_total ( netsnmp_mib_handler *handler  __unused,
netsnmp_handler_registration *reginfo  __unused,
netsnmp_agent_request_info *  reqinfo,
netsnmp_request_info *  requests 
) [static]

Handler to process the request of total number of interfaces.

Parameters:
[in] handler Pointer to mib handler.
[in] reginfo Pointer to handler registration info.
[in] reqinfo Pointer to agent request info.
[in,out] requests Pointer to requests.
Returns:
SNMP_ERR_NOERROR.

Definition at line 384 of file ped_snmp.c.

References get_interface_total().

Referenced by ped_init_mib().

static int handler_psd_state ( netsnmp_mib_handler *handler  __unused,
netsnmp_handler_registration *reginfo  __unused,
netsnmp_agent_request_info *  reqinfo,
netsnmp_request_info *  requests 
) [static]

Handler to process the request of PSD connection status.

Parameters:
[in] handler Pointer to mib handler.
[in] reginfo Pointer to handler registration info.
[in] reqinfo Pointer to agent request info.
[in,out] requests Pointer to requests.
Returns:
SNMP_ERR_NOERROR.

Definition at line 427 of file ped_snmp.c.

References psd_conn_state().

Referenced by ped_init_mib().

static int handler_psd_time ( netsnmp_mib_handler *handler  __unused,
netsnmp_handler_registration *reginfo  __unused,
netsnmp_agent_request_info *  reqinfo,
netsnmp_request_info *  requests 
) [static]

Handler to process the request of PSD connection time.

Parameters:
[in] handler Pointer to mib handler.
[in] reginfo Pointer to handler registration info.
[in] reqinfo Pointer to agent request info.
[in,out] requests Pointer to requests.
Returns:
SNMP_ERR_NOERROR.

Definition at line 470 of file ped_snmp.c.

References get_psd_conn_time().

Referenced by ped_init_mib().

static int handler_snmp_ver ( netsnmp_mib_handler *handler  __unused,
netsnmp_handler_registration *reginfo  __unused,
netsnmp_agent_request_info *  reqinfo,
netsnmp_request_info *  requests 
) [static]

Handler to process snmp version requests.

Parameters:
[in] handler Pointer to mib handler.
[in] reginfo Pointer to handler registration info.
[in] reqinfo Pointer to agent request info.
[in,out] requests Pointer to requests.
Returns:
SNMP_ERR_NOERROR.

Definition at line 298 of file ped_snmp.c.

Referenced by ped_init_mib().

static void init_mib_policy_table ( void   )  [static]

Initialize MIB policy table.

Definition at line 501 of file ped_snmp.c.

References handler_if_table(), if_table_oid, table_get_first_data_point(), and table_get_next_data_point().

Referenced by ped_init_mib().

static void init_netsnmp_ds ( void   )  [static]

Set SNMP default storage (configuration).

Definition at line 63 of file ped_snmp.c.

References DNAME_PED.

Referenced by netsnmp_subagent_init().

void netsnmp_subagent_init ( void   ) 

Initialze snmp sub-agent.

Definition at line 573 of file ped_snmp.c.

References DNAME_PED, init_netsnmp_ds(), ped_ctx, and ped_init_mib().

Referenced by ped_init().

static void ped_init_mib ( void   )  [static]

Initialize mib varables and register handlers.

Definition at line 533 of file ped_snmp.c.

References handler_if_count(), handler_if_total(), handler_psd_state(), handler_psd_time(), handler_snmp_ver(), if_count_oid, if_total_oid, init_mib_policy_table(), psd_state_oid, psd_time_oid, and snmp_ver_oid.

Referenced by netsnmp_subagent_init().

void ped_notify_psd_state ( boolean  state  ) 

Send notification of PSD connection status.

Parameters:
[in] state The state of PSD connection.

Definition at line 599 of file ped_snmp.c.

References notify_psd_state_oid, and psd_state_oid.

Referenced by disconnect_psd(), and psd_ipc_read().

static netsnmp_variable_list* table_get_first_data_point ( void **  loop_context,
void **  data_context,
netsnmp_variable_list *  put_index_data,
netsnmp_iterator_info *  data 
) [static]

Get the first entry in the interface table.

Parameters:
[in] loop_context Pointer to loop context pointer.
[in] data_context Pointer to data context pointer.
[out] put_index_data Pointer to index data.
[in] data Pointer to iterator info.
Returns:
Pointer to index data if found valid entry, otherwise NULL.

Definition at line 165 of file ped_snmp.c.

References policy_table_iterator_reset(), and table_get_next_data_point().

Referenced by init_mib_policy_table().

static netsnmp_variable_list* table_get_next_data_point ( void **  loop_context,
void **  data_context,
netsnmp_variable_list *  put_index_data,
netsnmp_iterator_info *data  __unused 
) [static]

Get next entry in the interface table.

Parameters:
[in] loop_context Pointer to loop context pointer.
[in] data_context Pointer to data context pointer.
[out] put_index_data Pointer to index data.
[in] data Pointer to iterator info.
Returns:
Pointer to index data if found valid entry, otherwise NULL.

Definition at line 119 of file ped_snmp.c.

References policy_table_entry_s::ifname, and policy_table_next().

Referenced by init_mib_policy_table(), and table_get_first_data_point().


2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:27:06 2010 for SDK Your Net Corporation Policy Manager Example: Policy Enforcement Daemon 1.0 by Doxygen 1.5.1