/** Initialize the dot11WtpWirelessCapStatTable table by defining its contents and how it's structured */
void
initialize_table_dot11WtpWirelessCapStatTable(void)
{
    static oid dot11WtpWirelessCapStatTable_oid[128] = {0};
    size_t dot11WtpWirelessCapStatTable_oid_len   = 0;	
	mad_dev_oid(dot11WtpWirelessCapStatTable_oid,WTPCAPSTATTABLE,&dot11WtpWirelessCapStatTable_oid_len,enterprise_pvivate_oid);
    netsnmp_handler_registration    *reg;
    netsnmp_iterator_info           *iinfo;
    netsnmp_table_registration_info *table_info;

    reg = netsnmp_create_handler_registration(
              "dot11WtpWirelessCapStatTable",     dot11WtpWirelessCapStatTable_handler,
              dot11WtpWirelessCapStatTable_oid, dot11WtpWirelessCapStatTable_oid_len,
              HANDLER_CAN_RONLY
              );

    table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
    netsnmp_table_helper_add_indexes(table_info,
                           ASN_OCTET_STR,  /* index: wtpMacAddr */
                           ASN_INTEGER,  /* index: wtpWirelessIfIndex */
                           0);
    table_info->min_column = WTPCAPSTATTABLE_MIN_COLUMN;
    table_info->max_column = WTPCAPSTATTABLE_MAX_COLUMN;
    
    iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
    iinfo->get_first_data_point = dot11WtpWirelessCapStatTable_get_first_data_point;
    iinfo->get_next_data_point  = dot11WtpWirelessCapStatTable_get_next_data_point;
    iinfo->table_reginfo        = table_info;
    
    netsnmp_register_table_iterator( reg, iinfo );
	netsnmp_inject_handler(reg,netsnmp_get_cache_handler(DOT1DTPFDBTABLE_CACHE_TIMEOUT,dot11WtpWirelessCapStatTable_load, dot11WtpWirelessCapStatTable_removeEntry,dot11WtpWirelessCapStatTable_oid, dot11WtpWirelessCapStatTable_oid_len));
    /* Initialise the contents of the table here */
}
Ejemplo n.º 2
0
/*******************************************************************************
 函数名称  : mib_initialize_table_historyControlTable
 功能描述  : 表historyControlTable的初始化函数
 输入参数  : 无
 输出参数  : 无
 返 回 值  : 无
 --------------------------------------------------------------------------------
 最近一次修改记录 :
 修改作者   :
 修改目的   :
 修改日期   :
*******************************************************************************/
void mib_initialize_table_historyControlTable(void)
{
    oid historyControlTable_oid[] = {1,3,6,1,2,1,16,2,1};
    const size_t historyControlTable_oid_len   = OID_LENGTH(historyControlTable_oid);
    netsnmp_handler_registration    *reg;
    netsnmp_iterator_info           *iinfo;
    netsnmp_table_registration_info *table_info;

    reg = netsnmp_create_handler_registration(
              "historyControlTable",     mib_historyControlTable_handler,
              historyControlTable_oid, historyControlTable_oid_len,
              HANDLER_CAN_RWRITE
              );

    table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
    netsnmp_table_helper_add_indexes(table_info,
                           ASN_INTEGER,  /* index: historyControlIndex */
                           0);
    table_info->min_column = COLUMN_HISTORYCONTROLINDEX;
    table_info->max_column = COLUMN_HISTORYCONTROLSTATUS;

    iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
    iinfo->get_first_data_point = mib_historyControlTable_get_first;
    iinfo->get_next_data_point  = mib_historyControlTable_get_next;
    iinfo->table_reginfo        = table_info;

    netsnmp_register_table_iterator( reg, iinfo );
    /* Conplat TODO: Initialise the contents of the table here */
}
Ejemplo n.º 3
0
/** Initialize the vmCpuTable table by defining its contents and how it's structured */
void
initialize_table_vmCpuTable(void)
{
    const oid vmCpuTable_oid[] = {1,3,6,1,2,1,VM_MIB_OID,1,5};
    const size_t vmCpuTable_oid_len   = OID_LENGTH(vmCpuTable_oid);
    netsnmp_handler_registration    *reg;
    netsnmp_iterator_info           *iinfo;
    netsnmp_table_registration_info *table_info;

    DEBUGMSGTL(("vmCpuTable:init", "initializing table vmCpuTable\n"));

    reg = netsnmp_create_handler_registration(
              "vmCpuTable",     vmCpuTable_handler,
              vmCpuTable_oid, vmCpuTable_oid_len,
              HANDLER_CAN_RONLY
              );

    table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
    netsnmp_table_helper_add_indexes(table_info,
                           ASN_INTEGER,  /* index: vmIndex */
                           ASN_INTEGER,  /* index: vmCpuIndex */
                           0);
    table_info->min_column = COLUMN_VMCPUINDEX;
    table_info->max_column = COLUMN_VMCPUCORETIME;
    
    iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
    iinfo->get_first_data_point = vmCpuTable_get_first_data_point;
    iinfo->get_next_data_point  = vmCpuTable_get_next_data_point;
    iinfo->table_reginfo        = table_info;
    
    netsnmp_register_table_iterator( reg, iinfo );

    /* Initialise the contents of the table here */
}
Ejemplo n.º 4
0
void mib_initialize_table_dot1dBasePortTable(void)
{
    oid dot1dBasePortTable_oid[] = {1,3,6,1,2,1,17,1,4};
    const size_t dot1dBasePortTable_oid_len   = OID_LENGTH(dot1dBasePortTable_oid);
    netsnmp_handler_registration    *reg;
    netsnmp_iterator_info           *iinfo;
    netsnmp_table_registration_info *table_info;

    reg = netsnmp_create_handler_registration(
              "dot1dBasePortTable",     mib_dot1dBasePortTable_handler,
              dot1dBasePortTable_oid, dot1dBasePortTable_oid_len,
              HANDLER_CAN_RONLY
              );

    table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
    netsnmp_table_helper_add_indexes(table_info,
                           ASN_INTEGER,
                           0);
    table_info->min_column = COLUMN_DOT1DBASEPORT;
    table_info->max_column = COLUMN_DOT1DBASEPORTMTUEXCEEDEDDISCARDS;

    iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
    iinfo->get_first_data_point = mib_dot1dBasePortTable_get_first;
    iinfo->get_next_data_point  = mib_dot1dBasePortTable_get_next;
    iinfo->table_reginfo        = table_info;

    netsnmp_register_table_iterator( reg, iinfo );
}
Ejemplo n.º 5
0
/** Initialize the dot118021xSecurityTable table by defining its contents and how it's structured */
void
initialize_table_dot118021xSecurityTable(void)
{
    static oid dot118021xSecurityTable_oid[128] = {0};
    size_t dot118021xSecurityTable_oid_len   = 0;
	
	mad_dev_oid(dot118021xSecurityTable_oid,DOT118021XTABLE,&dot118021xSecurityTable_oid_len,enterprise_pvivate_oid);
    netsnmp_handler_registration    *reg;
    netsnmp_iterator_info           *iinfo;
    netsnmp_table_registration_info *table_info;

    reg = netsnmp_create_handler_registration(
              "dot118021xSecurityTable",     dot118021xSecurityTable_handler,
              dot118021xSecurityTable_oid, dot118021xSecurityTable_oid_len,
              HANDLER_CAN_RWRITE
              );

    table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
    netsnmp_table_helper_add_indexes(table_info,
                           ASN_INTEGER,  /* index: security8021xIndex */
                           0);
    table_info->min_column = SECURITY802MIN;
    table_info->max_column = SECURITY802MAX;
    
    iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
    iinfo->get_first_data_point = dot118021xSecurityTable_get_first_data_point;
    iinfo->get_next_data_point  = dot118021xSecurityTable_get_next_data_point;
    iinfo->table_reginfo        = table_info;
    
    netsnmp_register_table_iterator( reg, iinfo );

    /* Initialise the contents of the table here */
}
Ejemplo n.º 6
0
void mib_initialize_table_ipRouteTable(void)
{
    oid ipRouteTable_oid[] = {1,3,6,1,2,1,4,21};
    const size_t ipRouteTable_oid_len   = OID_LENGTH(ipRouteTable_oid);
    netsnmp_handler_registration    *reg;
    netsnmp_iterator_info           *iinfo;
    netsnmp_table_registration_info *table_info;

    reg = netsnmp_create_handler_registration(
              "ipRouteTable",     mib_ipRouteTable_handler,
              ipRouteTable_oid, ipRouteTable_oid_len,
              HANDLER_CAN_RWRITE
              );

    table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
    netsnmp_table_helper_add_indexes(table_info,
                           ASN_IPADDRESS,
                           0);
    table_info->min_column = COLUMN_IPROUTEDEST;
    table_info->max_column = COLUMN_IPROUTEINFO;

    iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
    iinfo->get_first_data_point = mib_ipRouteTable_get_first;
    iinfo->get_next_data_point  = mib_ipRouteTable_get_next;
    iinfo->table_reginfo        = table_info;

    netsnmp_register_table_iterator( reg, iinfo );
}
Ejemplo n.º 7
0
/** initialize neIeee8021BridgeBaseTable table mapper **/
void
neIeee8021BridgeBaseTable_init (void)
{
	extern oid neIeee8021BridgeBaseTable_oid[];
	netsnmp_handler_registration *reg;
	netsnmp_iterator_info *iinfo;
	netsnmp_table_registration_info *table_info;
	
	reg = netsnmp_create_handler_registration (
		"neIeee8021BridgeBaseTable", &neIeee8021BridgeBaseTable_mapper,
		neIeee8021BridgeBaseTable_oid, OID_LENGTH (neIeee8021BridgeBaseTable_oid),
		HANDLER_CAN_RWRITE
		);
		
	table_info = xBuffer_cAlloc (sizeof (netsnmp_table_registration_info));
	netsnmp_table_helper_add_indexes (table_info,
		ASN_UNSIGNED /* index: ieee8021BridgeBaseComponentId */,
		0);
	table_info->min_column = NEIEEE8021BRIDGEBASECHASSISID;
	table_info->max_column = NEIEEE8021BRIDGEBASEOPERSTATE;
	
	iinfo = xBuffer_cAlloc (sizeof (netsnmp_iterator_info));
	iinfo->get_first_data_point = &neIeee8021BridgeBaseTable_getFirst;
	iinfo->get_next_data_point = &neIeee8021BridgeBaseTable_getNext;
	iinfo->get_data_point = &neIeee8021BridgeBaseTable_get;
	iinfo->table_reginfo = table_info;
	iinfo->flags |= NETSNMP_ITERATOR_FLAG_SORTED;
	
	netsnmp_register_table_iterator (reg, iinfo);
	
	/* Initialise the contents of the table here */
}
Ejemplo n.º 8
0
/** Initialize the xsanNodeTable table by defining its contents and how it's structured */
void
initialize_table_xsanNodeTable(void)
{
  static oid xsanNodeTable_oid[] = {1,3,6,1,4,1,20038,2,1,1,3};
  size_t xsanNodeTable_oid_len   = OID_LENGTH(xsanNodeTable_oid);
  netsnmp_handler_registration    *reg;
  netsnmp_iterator_info           *iinfo;
  netsnmp_table_registration_info *table_info;

  reg = netsnmp_create_handler_registration(
            "xsanNodeTable",     xsanNodeTable_handler,
            xsanNodeTable_oid, xsanNodeTable_oid_len,
            HANDLER_CAN_RONLY
            );

  table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
  netsnmp_table_helper_add_indexes(table_info,
                         ASN_INTEGER,  /* index: xsanVolumeIndex */
                         ASN_INTEGER,  /* index: xsanStripeGroupIndex */
                         ASN_INTEGER,  /* index: xsanNodeIndex */
                         0);
  table_info->min_column = COLUMN_XSANNODEINDEX;
  table_info->max_column = COLUMN_XSANNODESIZE;
  
  iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
  iinfo->get_first_data_point = xsanNodeTable_get_first_data_point;
  iinfo->get_next_data_point  = xsanNodeTable_get_next_data_point;
  iinfo->table_reginfo        = table_info;
  
  netsnmp_register_table_iterator( reg, iinfo );
  
  update_node_list();
  update_node_list_detail();
}
Ejemplo n.º 9
0
void
init_vacm_context(void)
{
    /*
     * table vacm_context
     */
    netsnmp_handler_registration *my_handler;
    netsnmp_table_registration_info *table_info;
    netsnmp_iterator_info *iinfo;

    my_handler = netsnmp_create_handler_registration("vacm_context",
                                                     vacm_context_handler,
                                                     vacm_context_oid,
                                                     sizeof
                                                     (vacm_context_oid) /
                                                     sizeof(oid),
                                                     HANDLER_CAN_RONLY);

    if (!my_handler)
        return;

    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
    iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);

    if (!table_info || !iinfo)
        return;

    netsnmp_table_helper_add_index(table_info, ASN_OCTET_STR)
        table_info->min_column = 1;
    table_info->max_column = 1;
    iinfo->get_first_data_point = get_first_context;
    iinfo->get_next_data_point = get_next_context;
    iinfo->table_reginfo = table_info;
    netsnmp_register_table_iterator(my_handler, iinfo);
}
Ejemplo n.º 10
0
/** initialize neIeee8021QBridgeVlanCurrentTable table mapper **/
void
neIeee8021QBridgeVlanCurrentTable_init (void)
{
	extern oid neIeee8021QBridgeVlanCurrentTable_oid[];
	netsnmp_handler_registration *reg;
	netsnmp_iterator_info *iinfo;
	netsnmp_table_registration_info *table_info;
	
	reg = netsnmp_create_handler_registration (
		"neIeee8021QBridgeVlanCurrentTable", &neIeee8021QBridgeVlanCurrentTable_mapper,
		neIeee8021QBridgeVlanCurrentTable_oid, OID_LENGTH (neIeee8021QBridgeVlanCurrentTable_oid),
		HANDLER_CAN_RWRITE
		);
		
	table_info = xBuffer_cAlloc (sizeof (netsnmp_table_registration_info));
	netsnmp_table_helper_add_indexes (table_info,
		ASN_TIMETICKS /* index: ieee8021QBridgeVlanTimeMark */,
		ASN_UNSIGNED /* index: ieee8021QBridgeVlanCurrentComponentId */,
		ASN_UNSIGNED /* index: ieee8021QBridgeVlanIndex */,
		0);
	table_info->min_column = NEIEEE8021QBRIDGEVLANCURRENTADMINFLAGS;
	table_info->max_column = NEIEEE8021QBRIDGEVLANCURRENTIFINDEX;
	
	iinfo = xBuffer_cAlloc (sizeof (netsnmp_iterator_info));
	iinfo->get_first_data_point = &neIeee8021QBridgeVlanCurrentTable_getFirst;
	iinfo->get_next_data_point = &neIeee8021QBridgeVlanCurrentTable_getNext;
	iinfo->get_data_point = &neIeee8021QBridgeVlanCurrentTable_get;
	iinfo->table_reginfo = table_info;
	iinfo->flags |= NETSNMP_ITERATOR_FLAG_SORTED;
	
	netsnmp_register_table_iterator (reg, iinfo);
	
	/* Initialise the contents of the table here */
}
Ejemplo n.º 11
0
Archivo: qos.c Proyecto: AllardJ/Tomato
/** Initialize the qosObjectTable table by defining its contents and how it's structured */
void
initialize_table_qosObjectTable(void)
{
    static oid      qosObjectTable_oid[] = { 1, 3, 6, 1, 4, 1, 18756, 1 };
    netsnmp_table_registration_info *table_info;
    netsnmp_handler_registration *my_handler;
    netsnmp_iterator_info *iinfo;

    /** create the table registration information structures */
    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
    iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);

    /** if your table is read only, it's easiest to change the
        HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */
    my_handler = netsnmp_create_handler_registration("qosObjectTable",
                                                     qosObjectTable_handler,
                                                     qosObjectTable_oid,
                                                     OID_LENGTH
                                                     (qosObjectTable_oid),
                                                     HANDLER_CAN_RWRITE);

    if (!my_handler || !table_info || !iinfo) {
        snmp_log(LOG_ERR,
                 "malloc failed in initialize_table_qosObjectTable");
        return; /** Serious error. */
    }

    /***************************************************
     * Setting up the table's definition
     */
    netsnmp_table_helper_add_indexes(table_info, 
				     ASN_INTEGER,
				    		/** index: qosDeviceType */
				     ASN_INTEGER,
                                               /** index: qosDeviceIndex */
                                     ASN_UNSIGNED,
                                               /** index: qosMajorHandle */
				     ASN_UNSIGNED,
						/* index: qosMinorHandle */
                                     0);

    /** Define the minimum and maximum accessible columns.  This
        optimizes retrival. */
    table_info->min_column = 1;
    table_info->max_column = 35;

    /** iterator access routines */
    iinfo->get_first_data_point = qosObjectTable_get_first_data_point;
    iinfo->get_next_data_point = qosObjectTable_get_next_data_point;

    /** tie the two structures together */
    iinfo->table_reginfo = table_info;

    /***************************************************
     * registering the table with the master agent
     */
    DEBUGMSGTL(("initialize_table_qosObjectTable",
                "Registering table qosObjectTable as a table iterator\n"));
    netsnmp_register_table_iterator(my_handler, iinfo);
}
Ejemplo n.º 12
0
/** Initialize the xsanAffinityTable table by defining its contents and how it's structured */
void
initialize_table_xsanAffinityTable(void)
{
    static oid xsanAffinityTable_oid[] = {1,3,6,1,4,1,20038,2,1,1,4};
    size_t xsanAffinityTable_oid_len   = OID_LENGTH(xsanAffinityTable_oid);
    netsnmp_handler_registration    *reg;
    netsnmp_iterator_info           *iinfo;
    netsnmp_table_registration_info *table_info;

    reg = netsnmp_create_handler_registration(
              "xsanAffinityTable",     xsanAffinityTable_handler,
              xsanAffinityTable_oid, xsanAffinityTable_oid_len,
              HANDLER_CAN_RONLY
              );

    table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
    netsnmp_table_helper_add_indexes(table_info,
                           ASN_INTEGER,  /* index: xsanVolumeIndex */
                           ASN_INTEGER,  /* index: xsanAffinityIndex */
                           0);
    table_info->min_column = COLUMN_XSANAFFINITYINDEX;
    table_info->max_column = COLUMN_XSANAFFINITYUSEDMBYTES;
    
    iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
    iinfo->get_first_data_point = xsanAffinityTable_get_first_data_point;
    iinfo->get_next_data_point  = xsanAffinityTable_get_next_data_point;
    iinfo->table_reginfo        = table_info;
    
    netsnmp_register_table_iterator( reg, iinfo );

    /* Initialise the contents of the table here */
    update_affinities();
}
Ejemplo n.º 13
0
/*******************************************************************************
 函数名称  : mib_initialize_table_dot1qPortVlanTable
 功能描述  : 表dot1qPortVlanTable的初始化函数
 输入参数  : 无
 输出参数  : 无
 返 回 值  : 无
 --------------------------------------------------------------------------------
 最近一次修改记录 :
 修改作者   :
 修改目的   :
 修改日期   :
*******************************************************************************/
void mib_initialize_table_dot1qPortVlanTable(void)
{
    oid dot1qPortVlanTable_oid[] = {1,3,6,1,2,1,17,7,1,4,5};
    const size_t dot1qPortVlanTable_oid_len   = OID_LENGTH(dot1qPortVlanTable_oid);
    netsnmp_handler_registration    *reg;
    netsnmp_iterator_info           *iinfo;
    netsnmp_table_registration_info *table_info;

    reg = netsnmp_create_handler_registration(
              "dot1qPortVlanTable",     mib_dot1qPortVlanTable_handler,
              dot1qPortVlanTable_oid, dot1qPortVlanTable_oid_len,
              HANDLER_CAN_RWRITE
              );

    table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
    netsnmp_table_helper_add_indexes(table_info,
                           ASN_INTEGER,  /* index: ifIndex */
                           0);
    table_info->min_column = COLUMN_DOT1QPVID;
    table_info->max_column = COLUMN_DOT1QPORTGVRPLASTPDUORIGIN;

    iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
    iinfo->get_first_data_point = mib_dot1qPortVlanTable_get_first;
    iinfo->get_next_data_point  = mib_dot1qPortVlanTable_get_next;
    iinfo->table_reginfo        = table_info;

    netsnmp_register_table_iterator( reg, iinfo );
    /* Conplat TODO: Initialise the contents of the table here */
}
Ejemplo n.º 14
0
/** Initialize the dot11QosWirelessTable table by defining its contents and how it's structured */
void
initialize_table_dot11QosWirelessTable(void)
{
    static oid dot11QosWirelessTable_oid[128] = {0};
    size_t dot11QosWirelessTable_oid_len   = 0;	
	mad_dev_oid(dot11QosWirelessTable_oid,QOSWIRELESSTABLE,&dot11QosWirelessTable_oid_len,enterprise_pvivate_oid);
    netsnmp_handler_registration    *reg;
    netsnmp_iterator_info           *iinfo;
    netsnmp_table_registration_info *table_info;

    reg = netsnmp_create_handler_registration(
              "dot11QosWirelessTable",     dot11QosWirelessTable_handler,
              dot11QosWirelessTable_oid, dot11QosWirelessTable_oid_len,
              HANDLER_CAN_RWRITE
              );

    table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
    netsnmp_table_helper_add_indexes(table_info,
                           ASN_INTEGER,  /* index: globalWtpID */
                           ASN_INTEGER,  /* index: RadioLocalID */
                           ASN_INTEGER,  /* index: QosType */
                           0);
    table_info->min_column = QOSWIRELESSMIN;
    table_info->max_column = QOSWIRELESSMAX;
    
    iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
    iinfo->get_first_data_point = dot11QosWirelessTable_get_first_data_point;
    iinfo->get_next_data_point  = dot11QosWirelessTable_get_next_data_point;
    iinfo->table_reginfo        = table_info;
    
    netsnmp_register_table_iterator( reg, iinfo );
    
	netsnmp_inject_handler(reg,netsnmp_get_cache_handler(DOT1DTPFDBTABLE_CACHE_TIMEOUT,dot11QosWirelessTable_load, dot11QosWirelessTable_removeEntry,dot11QosWirelessTable_oid, dot11QosWirelessTable_oid_len));
    /* Initialise the contents of the table here */
}
Ejemplo n.º 15
0
/** Initialize the pcapFilterTable table by defining its contents and how it's structured */
void	initialize_table_pcapFilterTable(void)
{
	static oid pcapFilterTable_oid[] = {1,3,6,1,4,1,8072,2,3000,2,1};
	netsnmp_handler_registration    *my_handler = NULL;
	netsnmp_table_registration_info *table_info = NULL;
	netsnmp_iterator_info *iinfo = NULL;

	table_info = SNMP_MALLOC_TYPEDEF (netsnmp_table_registration_info);
	iinfo = SNMP_MALLOC_TYPEDEF (netsnmp_iterator_info);

	my_handler = netsnmp_create_handler_registration (
		"pcapFilterTable",
		pcapFilterTable_handler,
		pcapFilterTable_oid,
		OID_LENGTH (pcapFilterTable_oid),
		HANDLER_CAN_RONLY );

	if (!my_handler || !table_info || !iinfo) return;

	netsnmp_table_helper_add_indexes (table_info, ASN_INTEGER, 0);

	table_info->min_column = COLUMN_IFDESCR;
	table_info->max_column = COLUMN_FLTTERMINAL;

	iinfo->get_first_data_point = pcapFilterTable_getFirst;
	iinfo->get_next_data_point = pcapFilterTable_getNext;
	iinfo->table_reginfo = table_info;

	netsnmp_register_table_iterator (my_handler, iinfo);
}
Ejemplo n.º 16
0
/** Initialize the dot11WtpKeyConfigTable table by defining its contents and how it's structured */
void
initialize_table_dot11WtpKeyConfigTable(void)
{
    static oid dot11WtpKeyConfigTable_oid[128] = {0};
    size_t dot11WtpKeyConfigTable_oid_len   = 0;
	mad_dev_oid(dot11WtpKeyConfigTable_oid,WTPKEYCONFIGTABLE,&dot11WtpKeyConfigTable_oid_len,enterprise_pvivate_oid);
    netsnmp_handler_registration    *reg;
    netsnmp_iterator_info           *iinfo;
    netsnmp_table_registration_info *table_info;

    reg = netsnmp_create_handler_registration(
              "dot11WtpKeyConfigTable",     dot11WtpKeyConfigTable_handler,
              dot11WtpKeyConfigTable_oid, dot11WtpKeyConfigTable_oid_len,
              HANDLER_CAN_RWRITE
              );

    table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
    netsnmp_table_helper_add_indexes(table_info,
                           ASN_INTEGER,  /* index: CipherKeyIndex */
                           0);
    table_info->min_column = WTPKEYCONFMIN;
    table_info->max_column = WTPKEYCONFMAX;
    
    iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
    iinfo->get_first_data_point = dot11WtpKeyConfigTable_get_first_data_point;
    iinfo->get_next_data_point  = dot11WtpKeyConfigTable_get_next_data_point;
    iinfo->table_reginfo        = table_info;
    
    netsnmp_register_table_iterator( reg, iinfo );
	netsnmp_inject_handler(reg,netsnmp_get_cache_handler(DOT1DTPFDBTABLE_CACHE_TIMEOUT,dot11WtpKeyConfigTable_load, dot11WtpKeyConfigTable_removeEntry,
							dot11WtpKeyConfigTable_oid, dot11WtpKeyConfigTable_oid_len));

    /* Initialise the contents of the table here */
}
Ejemplo n.º 17
0
/** Initialize the raidSetTable table by defining its contents and how it's structured */
void
initialize_table_raidSetTable(void)
{
    static oid raidSetTable_oid[] = {1,3,6,1,4,1,20038,2,1,6,2};
    size_t raidSetTable_oid_len   = OID_LENGTH(raidSetTable_oid);
    netsnmp_handler_registration    *reg;
    netsnmp_iterator_info           *iinfo;
    netsnmp_table_registration_info *table_info;

    reg = netsnmp_create_handler_registration(
              "raidSetTable",     raidSetTable_handler,
              raidSetTable_oid, raidSetTable_oid_len,
              HANDLER_CAN_RONLY
              );

    table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
    netsnmp_table_helper_add_indexes(table_info,
                           ASN_INTEGER,  /* index: raidSetIndex */
                           0);
    table_info->min_column = COLUMN_RAIDSETNAME;
    table_info->max_column = COLUMN_RAIDSETCOMMENTS;
    
    iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
    iinfo->get_first_data_point = raidSetTable_get_first_data_point;
    iinfo->get_next_data_point  = raidSetTable_get_next_data_point;
    iinfo->table_reginfo        = table_info;
    
    netsnmp_register_table_iterator( reg, iinfo );

    /* Initialise the contents of the table here */
    update_setlist();
}
Ejemplo n.º 18
0
void
init_nsCache(void)
{
    netsnmp_table_registration_info *table_info;
    netsnmp_iterator_info           *iinfo;

    /*
     * Register the scalar objects...
     */
    DEBUGMSGTL(("nsCacheScalars", "Initializing\n"));
    netsnmp_register_scalar(
        netsnmp_create_handler_registration(
            "nsCacheTimeout", handle_nsCacheTimeout,
            nsCacheTimeout_oid, OID_LENGTH(nsCacheTimeout_oid),
            HANDLER_CAN_RWRITE)
        );
    netsnmp_register_scalar(
        netsnmp_create_handler_registration(
            "nsCacheEnabled", handle_nsCacheEnabled,
            nsCacheEnabled_oid, OID_LENGTH(nsCacheEnabled_oid),
            HANDLER_CAN_RWRITE)
        );

    /*
     * ... and the table.
     * We need to define the column structure and indexing....
     */

    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
    if (!table_info) {
        return;
    }
    netsnmp_table_helper_add_indexes(table_info, ASN_PRIV_IMPLIED_OBJECT_ID, 0);
    table_info->min_column = NSCACHE_TIMEOUT;
    table_info->max_column = NSCACHE_STATUS;


    /*
     * .... and the iteration information ....
     */
    iinfo      = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
    if (!iinfo) {
        return;
    }
    iinfo->get_first_data_point = get_first_cache_entry;
    iinfo->get_next_data_point  = get_next_cache_entry;
    iinfo->table_reginfo        = table_info;


    /*
     * .... and register the table with the agent.
     */
    netsnmp_register_table_iterator(
        netsnmp_create_handler_registration(
            "tzCacheTable", handle_nsCacheTable,
            nsCacheTable_oid, OID_LENGTH(nsCacheTable_oid),
            HANDLER_CAN_RWRITE),
        iinfo);
}
Ejemplo n.º 19
0
/** Initialize the nsModuleTable table by defining it's contents and how it's structured */
void
initialize_table_nsModuleTable(void)
{
    const oid nsModuleTable_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 1, 2, 1 };
    netsnmp_table_registration_info *table_info;
    netsnmp_handler_registration *my_handler;
    netsnmp_iterator_info *iinfo;

    /*
     * create the table structure itself 
     */
    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
    iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);

    /*
     * if your table is read only, it's easiest to change the
     * HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY 
     */
    my_handler = netsnmp_create_handler_registration("nsModuleTable",
                                                     nsModuleTable_handler,
                                                     nsModuleTable_oid,
                                                     OID_LENGTH
                                                     (nsModuleTable_oid),
                                                     HANDLER_CAN_RWRITE);

    if (!my_handler || !table_info || !iinfo) {
        if (my_handler)
            netsnmp_handler_registration_free(my_handler);
        SNMP_FREE(table_info);
        SNMP_FREE(iinfo);
        return;                 /* mallocs failed */
    }

    /***************************************************
     * Setting up the table's definition
     */
    netsnmp_table_helper_add_indexes(table_info, ASN_OCTET_STR, /* context name */
                                     ASN_OBJECT_ID,     /* reg point */
                                     ASN_INTEGER,       /* priority */
                                     0);

    table_info->min_column = 4;
    table_info->max_column = 6;

    /*
     * iterator access routines 
     */
    iinfo->get_first_data_point = nsModuleTable_get_first_data_point;
    iinfo->get_next_data_point = nsModuleTable_get_next_data_point;
    iinfo->free_loop_context_at_end = nsModuleTable_free;
    iinfo->table_reginfo = table_info;

    /***************************************************
     * registering the table with the master agent
     */
    DEBUGMSGTL(("initialize_table_nsModuleTable",
                "Registering table nsModuleTable as a table iterator\n"));
    netsnmp_register_table_iterator(my_handler, iinfo);
}
Ejemplo n.º 20
0
void
init_tcpTable(void)
{
    netsnmp_table_registration_info *table_info;
    netsnmp_iterator_info           *iinfo;
    netsnmp_handler_registration    *reginfo;

    DEBUGMSGTL(("mibII/tcpTable", "Initialising TCP Table\n"));
    /*
     * Create the table data structure, and define the indexing....
     */
    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
    if (!table_info) {
        return;
    }
    netsnmp_table_helper_add_indexes(table_info, ASN_IPADDRESS,
                                                 ASN_INTEGER,
                                                 ASN_IPADDRESS,
                                                 ASN_INTEGER, 0);
    table_info->min_column = TCPCONNSTATE;
    table_info->max_column = TCPCONNREMOTEPORT;


    /*
     * .... and iteration information ....
     */
    iinfo      = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
    if (!iinfo) {
        return;
    }
    iinfo->get_first_data_point = tcpTable_first_entry;
    iinfo->get_next_data_point  = tcpTable_next_entry;
    iinfo->table_reginfo        = table_info;
#if defined(WIN32) || defined(solaris2)
    iinfo->flags               |= NETSNMP_ITERATOR_FLAG_SORTED;
#endif /* WIN32 || solaris2 */


    /*
     * .... and register the table with the agent.
     */
    reginfo = netsnmp_create_handler_registration("tcpTable",
            tcpTable_handler,
            tcpTable_oid, OID_LENGTH(tcpTable_oid),
            HANDLER_CAN_RONLY),
    netsnmp_register_table_iterator(reginfo, iinfo);

    /*
     * .... with a local cache
     *    (except for Solaris, which uses a different approach)
     */
    netsnmp_inject_handler( reginfo,
		    netsnmp_get_cache_handler(TCP_STATS_CACHE_TIMEOUT,
			   		tcpTable_load, tcpTable_free,
					tcpTable_oid, OID_LENGTH(tcpTable_oid)));
}
/** Initialize the nsTransactionTable table by defining it's contents
   and how it's structured */
void
initialize_table_nsTransactionTable(void)
{
    static oid      nsTransactionTable_oid[] =
        { 1, 3, 6, 1, 4, 1, 8072, 1, 8, 1 };
    size_t          nsTransactionTable_oid_len =
        OID_LENGTH(nsTransactionTable_oid);
    netsnmp_table_registration_info *table_info;
    netsnmp_handler_registration *my_handler;
    netsnmp_iterator_info *iinfo;

    /*
     * create the table structure itself 
     */
    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
    iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);

    /*
     * if your table is read only, it's easiest to change the
     * HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY 
     */
    my_handler = netsnmp_create_handler_registration("nsTransactionTable",
                                                     nsTransactionTable_handler,
                                                     nsTransactionTable_oid,
                                                     nsTransactionTable_oid_len,
                                                     HANDLER_CAN_RONLY);

    if (!my_handler || !table_info || !iinfo) {
        if (my_handler)
            netsnmp_handler_registration_free(my_handler);
        SNMP_FREE(table_info);
        SNMP_FREE(iinfo);
        return;                 /* mallocs failed */
    }

    /***************************************************
     * Setting up the table's definition
     */
    netsnmp_table_helper_add_index(table_info, ASN_INTEGER);    /* index:
                                                                 * * nsTransactionID 
                                                                 */

    table_info->min_column = 2;
    table_info->max_column = 2;
    iinfo->get_first_data_point = nsTransactionTable_get_first_data_point;
    iinfo->get_next_data_point = nsTransactionTable_get_next_data_point;
    iinfo->table_reginfo = table_info;

    /***************************************************
     * registering the table with the master agent
     */
    DEBUGMSGTL(("initialize_table_nsTransactionTable",
                "Registering table nsTransactionTable as a table iterator\n"));
    netsnmp_register_table_iterator(my_handler, iinfo);
}
Ejemplo n.º 22
0
void
init_udpTable(void)
{
    netsnmp_table_registration_info *table_info;
    netsnmp_iterator_info           *iinfo;
    netsnmp_handler_registration    *reginfo;

    DEBUGMSGTL(("mibII/udpTable", "Initialising UDP Table\n"));
    /*
     * Create the table data structure, and define the indexing....
     */
    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
    if (!table_info) {
        return;
    }
    netsnmp_table_helper_add_indexes(table_info, ASN_IPADDRESS,
                                     ASN_INTEGER, 0);
    table_info->min_column = UDPLOCALADDRESS;
    table_info->max_column = UDPLOCALPORT;


    /*
     * .... and iteration information ....
     */
    iinfo      = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
    if (!iinfo) {
        return;
    }
    iinfo->get_first_data_point = udpTable_first_entry;
    iinfo->get_next_data_point  = udpTable_next_entry;
    iinfo->table_reginfo        = table_info;
#if defined (WIN32) || defined (cygwin)
    iinfo->flags               |= NETSNMP_ITERATOR_FLAG_SORTED;
#endif /* WIN32 || cygwin */


    /*
     * .... and register the table with the agent.
     */
    reginfo = netsnmp_create_handler_registration("udpTable",
              udpTable_handler,
              udpTable_oid, OID_LENGTH(udpTable_oid),
              HANDLER_CAN_RONLY),
              netsnmp_register_table_iterator(reginfo, iinfo);

    /*
     * .... with a local cache
     */
    netsnmp_inject_handler( reginfo,
                            netsnmp_get_cache_handler(UDP_STATS_CACHE_TIMEOUT,
                                    udpTable_load, udpTable_free,
                                    udpTable_oid, OID_LENGTH(udpTable_oid)));
}
Ejemplo n.º 23
0
/*
 * Initialize the swRaidTable table by defining its contents and how it's structured
 */
void initialize_table_swRaidTable(void)
{
  static oid swRaidTable_oid[] = { SWRAIDTABLE_OID };
  netsnmp_table_registration_info *table_info;
  netsnmp_handler_registration *my_handler;
  netsnmp_iterator_info *iinfo;

  /*
   * create the table registration information structures
   */
  table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
  iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);

  my_handler = netsnmp_create_handler_registration("swRaidTable",
                                                   swRaidTable_handler,
                                                   swRaidTable_oid,
                                                   OID_LENGTH
                                                   (swRaidTable_oid),
                                                   HANDLER_CAN_RONLY);

  if (!my_handler || !table_info || !iinfo) {
	snmp_log(LOG_ERR, "malloc failed in initialize_table_swRaidTable");
	return;
  }

  /*
   * setup the table's definition
   */
  netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER, 0);

  /*
   * Define the minimum and maximum accessible columns.  This
   * optimizes retrival.
   */
  table_info->min_column = SWRAIDTABLE_MIN_COL;
  table_info->max_column = SWRAIDTABLE_MAX_COL;

  /*
   * iterator access routines
   */
  iinfo->get_first_data_point = swRaidTable_get_first_data_point;
  iinfo->get_next_data_point = swRaidTable_get_next_data_point;

  /*
   * tie the two structures together
   */
  iinfo->table_reginfo = table_info;

  /*
   * registering the table with the master agent
   */
  netsnmp_register_table_iterator(my_handler, iinfo);
}
Ejemplo n.º 24
0
void
init_nsLogging(void)
{
    netsnmp_table_registration_info *table_info;
    netsnmp_iterator_info           *iinfo;

    const oid nsLoggingTable_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 1, 7, 2, 1};

    /*
     * Register the table.
     * We need to define the column structure and indexing....
     */

    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
    if (!table_info) {
        return;
    }
    netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER,
                                                 ASN_PRIV_IMPLIED_OCTET_STR, 0);
    table_info->min_column = NSLOGGING_TYPE;
    table_info->max_column = NSLOGGING_STATUS;


    /*
     * .... and the iteration information ....
     */
    iinfo      = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
    if (!iinfo) {
        return;
    }
    iinfo->get_first_data_point = get_first_logging_entry;
    iinfo->get_next_data_point  = get_next_logging_entry;
    iinfo->table_reginfo        = table_info;


    /*
     * .... and register the table with the agent.
     */
    netsnmp_register_table_iterator(
        netsnmp_create_handler_registration(
            "tzLoggingTable", handle_nsLoggingTable,
            nsLoggingTable_oid, OID_LENGTH(nsLoggingTable_oid),
            HANDLER_CAN_RWRITE),
        iinfo);
}
Ejemplo n.º 25
0
/** Initialize the pgsqlPgAmopTable table by defining its contents and how it's structured */
void
initialize_table_pgsqlPgAmopTable(void)
{
    static oid pgsqlPgAmopTable_oid[] = {1,3,6,1,4,1,27645,1,2,3};
    size_t pgsqlPgAmopTable_oid_len   = OID_LENGTH(pgsqlPgAmopTable_oid);
    netsnmp_handler_registration    *reg;
    netsnmp_iterator_info           *iinfo;
    netsnmp_table_registration_info *table_info;
    struct pgsqlPgAmopTable_entry *entry;
    char *connID = "Default conn ID\0";
    int conn_len = strlen(connID);

    reg = netsnmp_create_handler_registration(
              "pgsqlPgAmopTable",     pgsqlPgAmopTable_handler,
              pgsqlPgAmopTable_oid, pgsqlPgAmopTable_oid_len,
              HANDLER_CAN_RONLY
              );

    table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
    netsnmp_table_helper_add_indexes(table_info,
                           ASN_OCTET_STR,  /* index: pgsnmpdConnID */
                           ASN_INTEGER,  /* index: rdbmsDbIndex */
                           ASN_INTEGER,  /* index: pgsqlPgAmopEntryOID */
                           0);
    table_info->min_column = COLUMN_PGSQLPGAMOPENTRYOID;
    table_info->max_column = COLUMN_PGSQLPGAMOPAMOPMETHOD;
    
    iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
    iinfo->get_first_data_point = pgsqlPgAmopTable_get_first_data_point;
    iinfo->get_next_data_point  = pgsqlPgAmopTable_get_next_data_point;
    iinfo->table_reginfo        = table_info;
    
    netsnmp_register_table_iterator( reg, iinfo );

    /* Initialise the contents of the table here */
    fill_pgsqlPgAmopTable();
}
Ejemplo n.º 26
0
/*******************************************************************************
 函数名称  : mib_initialize_table_etherHistoryTable
 功能描述  : 表etherHistoryTable的初始化函数
 输入参数  : 无
 输出参数  : 无
 返 回 值  : 无
 --------------------------------------------------------------------------------
 最近一次修改记录 :
 修改作者   :
 修改目的   :
 修改日期   :
*******************************************************************************/
void
mib_initialize_table_etherHistoryTable(void)
{
    oid             etherHistoryTable_oid[] =
        { 1, 3, 6, 1, 2, 1, 16, 2, 2 };
    const size_t    etherHistoryTable_oid_len =
        OID_LENGTH(etherHistoryTable_oid);
    netsnmp_handler_registration *reg;
    netsnmp_iterator_info *iinfo;
    netsnmp_table_registration_info *table_info;

    reg =
        netsnmp_create_handler_registration("etherHistoryTable",
                                            mib_etherHistoryTable_handler,
                                            etherHistoryTable_oid,
                                            etherHistoryTable_oid_len,
                                            HANDLER_CAN_RONLY);

    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
    netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER,   /* index: etherHistoryIndex */
                                     ASN_INTEGER,       /* index: etherHistorySampleIndex */
                                     0);
    table_info->min_column = COLUMN_ETHERHISTORYINDEX;
    table_info->max_column = COLUMN_ETHERHISTORYUTILIZATION;

    iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
    iinfo->get_first_data_point = mib_etherHistoryTable_get_first;
    iinfo->get_next_data_point = mib_etherHistoryTable_get_next;
    iinfo->table_reginfo = table_info;
    iinfo->flags |= CONPLAT_ITERATOR_FLAG_SORTED;
    iinfo->free_data_context = mib_etherHistoryTable_removeEntry;

    netsnmp_register_table_iterator(reg, iinfo);
    /*
     * Conplat TODO: Initialise the contents of the table here 
     */
}
Ejemplo n.º 27
0
/** Initialize the dot11VlanAbilityTable table by defining its contents and how it's structured */
void
initialize_table_dot11VlanAbilityTable(void)
{
    static oid dot11VlanAbilityTable_oid[128] = {0};
	size_t dot11VlanAbilityTable_oid_len   = 0;
	mad_dev_oid(dot11VlanAbilityTable_oid,VLANABILITYTABLE,&dot11VlanAbilityTable_oid_len,enterprise_pvivate_oid);
    
    netsnmp_handler_registration    *reg;
    netsnmp_iterator_info           *iinfo;
    netsnmp_table_registration_info *table_info;

    reg = netsnmp_create_handler_registration(
              "dot11VlanAbilityTable",     dot11VlanAbilityTable_handler,
              dot11VlanAbilityTable_oid, dot11VlanAbilityTable_oid_len,
              HANDLER_CAN_RWRITE
              );

    table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
    netsnmp_table_helper_add_indexes(table_info,
                           ASN_OCTET_STR,  /* index: wtpCurrID */
                           ASN_INTEGER,  /* index: wlanCurrID */
                           0);
    table_info->min_column = VLANABILITITY_MIN;
    table_info->max_column = VLANABITLITY_MAX;
    
    iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
    iinfo->get_first_data_point = dot11VlanAbilityTable_get_first_data_point;
    iinfo->get_next_data_point  = dot11VlanAbilityTable_get_next_data_point;
    iinfo->table_reginfo        = table_info;
    
    netsnmp_register_table_iterator( reg, iinfo );
	netsnmp_inject_handler(reg,netsnmp_get_cache_handler(DOT1DTPFDBTABLE_CACHE_TIMEOUT,dot11VlanAbilityTable_load, dot11VlanAbilityTable_removeEntry,
							dot11VlanAbilityTable_oid, dot11VlanAbilityTable_oid_len));

    /* Initialise the contents of the table here */
}
Ejemplo n.º 28
0
/** Initialize the dot1dBasePortTable table by defining its contents and how it's structured */
void
initialize_table_dot1dBasePortTable(void) {
  static oid dot1dBasePortTable_oid[] = {1,3,6,1,2,1,17,1,4};
  netsnmp_table_registration_info *table_info;
  netsnmp_handler_registration *my_handler;
  netsnmp_iterator_info *iinfo;

  /** create the table registration information structures */
  table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
  iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);

  my_handler = netsnmp_create_handler_registration("dot1dBasePortTable",
               dot1dBasePortTable_handler,
               dot1dBasePortTable_oid,
               OID_LENGTH(dot1dBasePortTable_oid),
               HANDLER_CAN_RONLY
                                                  );

  if (!my_handler || !table_info || !iinfo) {
    snmp_log(LOG_ERR, "malloc failed in initialize_table_dot1dBasePortTable");
    if (my_handler != NULL) {
      SNMP_FREE(my_handler);
    }
    if (table_info != NULL) {
      SNMP_FREE(table_info);
    }
    if (iinfo != NULL) {
      SNMP_FREE(iinfo);
    }
    return; /** Serious error. */
  }

  /***************************************************
   * Setting up the table's definition
   */
  netsnmp_table_helper_add_indexes(table_info,
                                   ASN_INTEGER, /** index: dot1dBasePort */
                                   0);

  /** Define the minimum and maximum accessible columns.  This
      optimizes retrival. */
  table_info->min_column = 1;
  table_info->max_column = 5;

  /** iterator access routines */
  iinfo->get_first_data_point = dot1dBasePortTable_get_first_data_point;
  iinfo->get_next_data_point = dot1dBasePortTable_get_next_data_point;

  /* iinfo->make_data_context = dot1dBasePortTable_context_convert_function; */
  iinfo->free_data_context = dot1dBasePortTable_data_free;

  /** pick *only* one of these if you use them */
  /* iinfo->free_loop_context = dot1dBasePortTable_loop_free; */
  iinfo->free_loop_context_at_end = dot1dBasePortTable_loop_free;

  /** tie the two structures together */
  iinfo->table_reginfo = table_info;

  /***************************************************
   * registering the table with the master agent
   */
  DEBUGMSGTL(("initialize_table_dot1dBasePortTable",
              "Registering table dot1dBasePortTable as a table iterator\n"));
  netsnmp_register_table_iterator(my_handler, iinfo);
}
Ejemplo n.º 29
0
/** Initialize the LHANodeTable table by defining its contents and how it's structured */
void
initialize_table_LHANodeTable(void)
{
    static oid LHANodeTable_oid[] = {1,3,6,1,4,1,4682,2};
    netsnmp_table_registration_info *table_info;
    netsnmp_handler_registration *my_handler;
    netsnmp_iterator_info *iinfo;

    /** create the table registration information structures */
    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
    iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);

    /** if your table is read only, it's easiest to change the
        HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */
    my_handler = netsnmp_create_handler_registration("LHANodeTable",
                                             LHANodeTable_handler,
                                             LHANodeTable_oid,
                                             OID_LENGTH(LHANodeTable_oid),
                                             HANDLER_CAN_RONLY);
            
    if (!my_handler || !table_info || !iinfo) {
        snmp_log(LOG_ERR, "malloc failed in initialize_table_LHANodeTable");
	SNMP_FREE(iinfo);
	SNMP_FREE(table_info);
        return; /* Serious error. */
    }

    /***************************************************
     * Setting up the table's definition
     */
    netsnmp_table_helper_add_indexes(table_info,
                                  ASN_INTEGER, /* index: LHANodeIndex */
                             0);

    /** Define the minimum and maximum accessible columns.  This
        optimizes retrival. */
    table_info->min_column = 2;
    table_info->max_column = 6;

    /* iterator access routines */
    iinfo->get_first_data_point = LHANodeTable_get_first_data_point;
    iinfo->get_next_data_point = LHANodeTable_get_next_data_point;

    /** tie the two structures together */
    iinfo->table_reginfo = table_info;

    /***************************************************
     * registering the table with the master agent
     */
    DEBUGMSGTL(("initialize_table_LHANodeTable",
                "Registering table LHANodeTable as a table iterator\n"));		 
    netsnmp_register_table_iterator(my_handler, iinfo);

    /*
     * .... with a local cache
     */
    netsnmp_inject_handler(my_handler,
	 netsnmp_get_cache_handler(snmp_cache_time_out, 
				   LHANodeTable_load,
				   LHANodeTable_free,
				   LHANodeTable_oid,
				   OID_LENGTH(LHANodeTable_oid)));
}
Ejemplo n.º 30
0
/** Initialize the ipCidrRouteTable table by defining its contents and how it's structured */
void
initialize_table_ipCidrRouteTable(void)
{
    static oid      ipCidrRouteTable_oid[] =
        { 1, 3, 6, 1, 2, 1, 4, 24, 4 };
    netsnmp_table_registration_info *table_info;
    netsnmp_handler_registration *my_handler;
    netsnmp_iterator_info *iinfo;

    /** create the table registration information structures */
    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
    iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);

    /** if your table is read only, it's easiest to change the
        HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */
    my_handler = netsnmp_create_handler_registration("ipCidrRouteTable",
                                                     ipCidrRouteTable_handler,
                                                     ipCidrRouteTable_oid,
                                                     OID_LENGTH
                                                     (ipCidrRouteTable_oid),
                                                     HANDLER_CAN_RWRITE);

    if (!my_handler || !table_info || !iinfo) {
        snmp_log(LOG_ERR,
                 "malloc failed in initialize_table_ipCidrRouteTable");
        return; /** Serious error. */
    }

    /***************************************************
     * Setting up the table's definition
     */
    netsnmp_table_helper_add_indexes(table_info, ASN_IPADDRESS,
                                                 /** index: ipCidrRouteDest */
                                     ASN_IPADDRESS,
                                                 /** index: ipCidrRouteMask */
                                     ASN_INTEGER,
                                               /** index: ipCidrRouteTos */
                                     ASN_IPADDRESS,
                                                 /** index: ipCidrRouteNextHop */
                                     0);

    /** Define the minimum and maximum accessible columns.  This
        optimizes retrival. */
    table_info->min_column = 1;
    table_info->max_column = 16;

    /** iterator access routines */
    iinfo->get_first_data_point = ipCidrRouteTable_get_first_data_point;
    iinfo->get_next_data_point = ipCidrRouteTable_get_next_data_point;

    /** you may wish to set these as well */
#ifdef MAYBE_USE_THESE
    iinfo->make_data_context = ipCidrRouteTable_context_convert_function;
    iinfo->free_data_context = ipCidrRouteTable_data_free;

    /** pick *only* one of these if you use them */
    iinfo->free_loop_context = ipCidrRouteTable_loop_free;
    iinfo->free_loop_context_at_end = ipCidrRouteTable_loop_free;
#endif

    /** tie the two structures together */
    iinfo->table_reginfo = table_info;

    /***************************************************
     * registering the table with the master agent
     */
    DEBUGMSGTL(("initialize_table_ipCidrRouteTable",
                "Registering table ipCidrRouteTable as a table iterator\n"));
    netsnmp_register_table_iterator(my_handler, iinfo);
}