RE: How to delete/add line from raw table?
"Naama Bar Menachem" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Dave I am sorry! I accidently sent you one of my experiments... Here is the correct command and files: env MIBS="ALL" MIBDIRS="/home/naamab/snmp/snmp_no_mips_no_perl____mv/share/snmp/mibs/" mib2c -c mib2c.raw-table.conf nsCommonConfigDataForwardPolicyRoute Thank you. Naama -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Dave Shield Sent: Thursday, July 26, 2012 11:21 AM To: Naama Bar Menachem Cc: [email protected] Subject: Re: How to delete/add line from raw table? On 26 July 2012 09:05, Naama Bar Menachem <[email protected]> wrote: > mib2c -c mib2c.iterate.conf nsCommonConfigDataForwardPolicyRoute You said that you were working with "raw tables", but this command uses the iteration helper. Please explain? Dave ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
NOVELSAT-COMMON.mib
(application/octet-stream, 70.5 KB) - not displayed
nsCommonConfigDataForwardPolicyRoute.c
(application/octet-stream, 19.3 KB)
/*
* Note: this file originally auto-generated by mib2c using
* : mib2c.raw-table.conf 17436 2009-03-31 15:12:19Z dts12 $
*/
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "nsCommonConfigDataForwardPolicyRoute.h"
/*
* column number definitions for table nsCommonConfigDataForwardPolicyRouteTable
*/
#define COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTEINDEX 1
#define COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTEINPUTINTERFACEID 2
#define COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTEROUTINGTABLEID 3
#define COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTENOTIFYROWSTATUS 4
/*
* Typical data structure for a row entry
*/
struct nsCommonConfigDataForwardPolicyRouteTable_entry {
/*
* Index values
*/
u_long nsCommonConfigDataForwardPolicyRouteIndex;
/*
* Column values
*/
u_long nsCommonConfigDataForwardPolicyRouteInputInterfaceId;
u_long
old_nsCommonConfigDataForwardPolicyRouteInputInterfaceId;
u_long nsCommonConfigDataForwardPolicyRouteRoutingTableId;
u_long old_nsCommonConfigDataForwardPolicyRouteRoutingTableId;
nsCommonConfigDataForwardPolicyRouteNotifyRowStatus;
old_nsCommonConfigDataForwardPolicyRouteNotifyRowStatus;
int valid;
};
/*
* create a new row in the table
*/
static struct nsCommonConfigDataForwardPolicyRouteTable_entry *
nsCommonConfigDataForwardPolicyRouteTable_createEntry(int dummy,
u_long
nsCommonConfigDataForwardPolicyRouteIndex)
{
struct nsCommonConfigDataForwardPolicyRouteTable_entry *entry;
entry =
SNMP_MALLOC_TYPEDEF(struct
nsCommonConfigDataForwardPolicyRouteTable_entry);
if (!entry)
return NULL;
/*
* XXX - insert entry into local data structure
*/
return entry;
}
/*
* remove a row from the table
*/
static void
nsCommonConfigDataForwardPolicyRouteTable_removeEntry(struct
nsCommonConfigDataForwardPolicyRouteTable_entry
*entry)
{
if (!entry)
return; /* Nothing to remove */
/*
* XXX - remove entry from local data structure
*/
if (entry)
SNMP_FREE(entry); /* XXX - release any other internal resources */
}
/** determine the appropriate row for an exact request */
static struct nsCommonConfigDataForwardPolicyRouteTable_entry *
nsCommonConfigDataForwardPolicyRouteTable_get_entry(netsnmp_variable_list *
indexes)
{
struct nsCommonConfigDataForwardPolicyRouteTable_entry *row = NULL;
/*
* XXX - Use the 'indexes' parameter to retrieve the data
* structure for the requested row, and return this.
*/
return row;
}
/** determine the appropriate row for an fuzzy request */
static struct nsCommonConfigDataForwardPolicyRouteTable_entry *
nsCommonConfigDataForwardPolicyRouteTable_get_next_entry
(netsnmp_handler_registration *reginfo, netsnmp_request_info *request,
int column, netsnmp_variable_list * indexes)
{
struct nsCommonConfigDataForwardPolicyRouteTable_entry *row = NULL;
oid build_space[MAX_OID_LEN];
size_t build_space_len = 0;
size_t index_oid_len = 0;
/*
* XXX - Use the 'indexes' parameter to identify the
* next row in the table....
*/
/*
* XXX .... update the 'indexes' parameter with the
* appropriate index values ...
*/
/*
* ... and update the requested OID to match this instance
*/
memcpy(build_space, reginfo->rootoid, /* registered oid */
reginfo->rootoid_len * sizeof(oid));
build_space_len = reginfo->rootoid_len;
build_space[build_space_len++] = 1; /* entry */
build_space[build_space_len++] = column; /* column */
build_oid_noalloc(build_space + build_space_len,
MAX_OID_LEN - build_space_len, &index_oid_len,
NULL, 0, indexes);
snmp_set_var_objid(request->requestvb, build_space,
build_space_len + index_oid_len);
/*
* Finally, return the data structure for this row
*/
return row;
}
/** handles requests for the nsCommonConfigDataForwardPolicyRouteTable table */
static int
nsCommonConfigDataForwardPolicyRouteTable_handler(netsnmp_mib_handler
*handler,
netsnmp_handler_registration
*reginfo,
netsnmp_agent_request_info
*reqinfo,
netsnmp_request_info
*requests)
{
netsnmp_request_info *request;
netsnmp_table_request_info *table_info;
struct nsCommonConfigDataForwardPolicyRouteTable_entry *table_entry;
int ret;
switch (reqinfo->mode) {
/*
* Read-support
*/
case MODE_GET:
for (request = requests; request; request = request->next) {
table_info = netsnmp_extract_table_info(request);
table_entry =
nsCommonConfigDataForwardPolicyRouteTable_get_entry
(table_info->indexes);
switch (table_info->colnum) {
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTEINPUTINTERFACEID:
if (!table_entry)
{
netsnmp_set_request_error(reqinfo, request,
SNMP_NOSUCHINSTANCE);
continue;
}
snmp_set_var_typed_integer(request->requestvb,
ASN_UNSIGNED,
table_entry->
nsCommonConfigDataForwardPolicyRouteInputInterfaceId);
break;
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTEROUTINGTABLEID:
if (!table_entry)
{
netsnmp_set_request_error(reqinfo, request,
SNMP_NOSUCHINSTANCE);
continue;
}
snmp_set_var_typed_integer(request->requestvb,
ASN_UNSIGNED,
table_entry->
nsCommonConfigDataForwardPolicyRouteRoutingTableId);
break;
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTENOTIFYROWSTATUS:
if (!table_entry)
{
netsnmp_set_request_error(reqinfo, request,
SNMP_NOSUCHINSTANCE);
continue;
}
snmp_set_var_typed_integer(request->requestvb,,
table_entry->
nsCommonConfigDataForwardPolicyRouteNotifyRowStatus);
break;
default:
netsnmp_set_request_error(reqinfo, request,
SNMP_NOSUCHOBJECT);
break;
}
}
break;
case MODE_GETNEXT:
for (request = requests; request; request = request->next) {
table_info = netsnmp_extract_table_info(request);
table_entry =
nsCommonConfigDataForwardPolicyRouteTable_get_next_entry
(reginfo, request, table_info->colnum,
table_info->indexes);
switch (table_info->colnum) {
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTEINPUTINTERFACEID:
if (!table_entry)
{
netsnmp_set_request_error(reqinfo, request,
SNMP_NOSUCHINSTANCE);
continue;
}
snmp_set_var_typed_integer(request->requestvb,
ASN_UNSIGNED,
table_entry->
nsCommonConfigDataForwardPolicyRouteInputInterfaceId);
break;
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTEROUTINGTABLEID:
if (!table_entry)
{
netsnmp_set_request_error(reqinfo, request,
SNMP_NOSUCHINSTANCE);
continue;
}
snmp_set_var_typed_integer(request->requestvb,
ASN_UNSIGNED,
table_entry->
nsCommonConfigDataForwardPolicyRouteRoutingTableId);
break;
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTENOTIFYROWSTATUS:
if (!table_entry)
{
netsnmp_set_request_error(reqinfo, request,
SNMP_NOSUCHINSTANCE);
continue;
}
snmp_set_var_typed_integer(request->requestvb,,
table_entry->
nsCommonConfigDataForwardPolicyRouteNotifyRowStatus);
break;
default:
netsnmp_set_request_error(reqinfo, request,
SNMP_NOSUCHOBJECT);
break;
}
}
break;
/*
* Write-support
*/
case MODE_SET_RESERVE1:
for (request = requests; request; request = request->next) {
table_info = netsnmp_extract_table_info(request);
table_entry =
nsCommonConfigDataForwardPolicyRouteTable_get_entry
(table_info->indexes);
switch (table_info->colnum) {
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTEINPUTINTERFACEID:
/*
* or possibly 'netsnmp_check_vb_int_range'
*/
ret =
netsnmp_check_vb_int(request->requestvb);
if (ret != SNMP_ERR_NOERROR) {
netsnmp_set_request_error(reqinfo, request, ret);
return SNMP_ERR_NOERROR;
}
break;
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTEROUTINGTABLEID:
/*
* or possibly 'netsnmp_check_vb_int_range'
*/
ret =
netsnmp_check_vb_int(request->requestvb);
if (ret != SNMP_ERR_NOERROR) {
netsnmp_set_request_error(reqinfo, request, ret);
return SNMP_ERR_NOERROR;
}
break;
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTENOTIFYROWSTATUS:
/*
* or possibly 'netsnmp_check_vb_int_range'
*/
ret =
netsnmp_check_vb_int(request->requestvb);
if (ret != SNMP_ERR_NOERROR) {
netsnmp_set_request_error(reqinfo, request, ret);
return SNMP_ERR_NOERROR;
}
break;
default:
netsnmp_set_request_error(reqinfo, request,
SNMP_ERR_NOTWRITABLE);
return SNMP_ERR_NOERROR;
}
}
break;
case MODE_SET_RESERVE2:
for (request = requests; request; request = request->next) {
table_info = netsnmp_extract_table_info(request);
table_entry =
nsCommonConfigDataForwardPolicyRouteTable_get_entry
(table_info->indexes);
switch (table_info->colnum) {
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTENOTIFYROWSTATUS:
if (!table_entry)
{
table_entry =
nsCommonConfigDataForwardPolicyRouteTable_createEntry
(0, *table_info->indexes->val.integer);
if (!table_entry) {
netsnmp_set_request_error(reqinfo, request,
SNMP_ERR_RESOURCEUNAVAILABLE);
return SNMP_ERR_NOERROR;
}
}
break;
}
}
break;
case MODE_SET_FREE:
for (request = requests; request; request = request->next) {
table_info = netsnmp_extract_table_info(request);
table_entry =
nsCommonConfigDataForwardPolicyRouteTable_get_entry
(table_info->indexes);
switch (table_info->colnum) {
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTENOTIFYROWSTATUS:
if (table_entry
&& !table_entry->valid) {
nsCommonConfigDataForwardPolicyRouteTable_removeEntry
(table_entry);
}
break;
}
}
break;
case MODE_SET_ACTION:
for (request = requests; request; request = request->next) {
table_info = netsnmp_extract_table_info(request);
table_entry =
nsCommonConfigDataForwardPolicyRouteTable_get_entry
(table_info->indexes);
switch (table_info->colnum) {
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTEINPUTINTERFACEID:
table_entry->
old_nsCommonConfigDataForwardPolicyRouteInputInterfaceId
=
table_entry->
nsCommonConfigDataForwardPolicyRouteInputInterfaceId;
table_entry->
nsCommonConfigDataForwardPolicyRouteInputInterfaceId =
*request->requestvb->val.integer;
break;
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTEROUTINGTABLEID:
table_entry->
old_nsCommonConfigDataForwardPolicyRouteRoutingTableId
=
table_entry->
nsCommonConfigDataForwardPolicyRouteRoutingTableId;
table_entry->
nsCommonConfigDataForwardPolicyRouteRoutingTableId =
*request->requestvb->val.integer;
break;
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTENOTIFYROWSTATUS:
table_entry->
old_nsCommonConfigDataForwardPolicyRouteNotifyRowStatus
=
table_entry->
nsCommonConfigDataForwardPolicyRouteNotifyRowStatus;
table_entry->
nsCommonConfigDataForwardPolicyRouteNotifyRowStatus =
*request->requestvb->val.integer;
break;
}
}
break;
case MODE_SET_UNDO:
for (request = requests; request; request = request->next) {
table_info = netsnmp_extract_table_info(request);
table_entry =
nsCommonConfigDataForwardPolicyRouteTable_get_entry
(table_info->indexes);
switch (table_info->colnum) {
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTEINPUTINTERFACEID:
table_entry->
nsCommonConfigDataForwardPolicyRouteInputInterfaceId =
table_entry->
old_nsCommonConfigDataForwardPolicyRouteInputInterfaceId;
table_entry->
old_nsCommonConfigDataForwardPolicyRouteInputInterfaceId
= 0;
break;
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTEROUTINGTABLEID:
table_entry->
nsCommonConfigDataForwardPolicyRouteRoutingTableId =
table_entry->
old_nsCommonConfigDataForwardPolicyRouteRoutingTableId;
table_entry->
old_nsCommonConfigDataForwardPolicyRouteRoutingTableId
= 0;
break;
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTENOTIFYROWSTATUS:
if (table_entry
&& !table_entry->valid) {
nsCommonConfigDataForwardPolicyRouteTable_removeEntry
(table_entry);
} else {
table_entry->
nsCommonConfigDataForwardPolicyRouteNotifyRowStatus
=
table_entry->
old_nsCommonConfigDataForwardPolicyRouteNotifyRowStatus;
table_entry->
old_nsCommonConfigDataForwardPolicyRouteNotifyRowStatus
= 0;
}
break;
}
}
break;
case MODE_SET_COMMIT:
for (request = requests; request; request = request->next) {
table_info = netsnmp_extract_table_info(request);
table_entry =
nsCommonConfigDataForwardPolicyRouteTable_get_entry
(table_info->indexes);
switch (table_info->colnum) {
case COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTENOTIFYROWSTATUS:
if (table_entry
&& !table_entry->valid) {
table_entry->valid = 1;
}
}
}
break;
}
return SNMP_ERR_NOERROR;
}
/** Initialize the nsCommonConfigDataForwardPolicyRouteTable table by defining its contents and how it's structured */
static void
initialize_table_nsCommonConfigDataForwardPolicyRouteTable(void)
{
const oid nsCommonConfigDataForwardPolicyRouteTable_oid[] =
{ 1, 3, 6, 1, 4, 1, 37576, 2, 1, 7, 4, 1, 1 };
netsnmp_handler_registration *reg;
netsnmp_table_registration_info *table_info;
reg =
netsnmp_create_handler_registration
("nsCommonConfigDataForwardPolicyRouteTable",
nsCommonConfigDataForwardPolicyRouteTable_handler,
nsCommonConfigDataForwardPolicyRouteTable_oid,
OID_LENGTH(nsCommonConfigDataForwardPolicyRouteTable_oid),
HANDLER_CAN_RWRITE);
table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
netsnmp_table_helper_add_indexes(table_info, ASN_UNSIGNED, /* index: nsCommonConfigDataForwardPolicyRouteIndex */
0);
table_info->min_column =
COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTEINPUTINTERFACEID;
table_info->max_column =
COLUMN_NSCOMMONCONFIGDATAFORWARDPOLICYROUTENOTIFYROWSTATUS;
netsnmp_register_table(reg, table_info);
/*
* Initialise the contents of the table here
*/
}
/** Initializes the nsCommonConfigDataForwardPolicyRoute module */
void
init_nsCommonConfigDataForwardPolicyRoute(void)
{
/*
* here we initialize all the tables we're planning on supporting
*/
initialize_table_nsCommonConfigDataForwardPolicyRouteTable();
}
nsCommonConfigDataForwardPolicyRoute.h
(application/octet-stream, 367 B)
/* * Note: this file originally auto-generated by mib2c using * : mib2c.raw-table.conf 17436 2009-03-31 15:12:19Z dts12 $ */ #ifndef NSCOMMONCONFIGDATAFORWARDPOLICYROUTE_H #define NSCOMMONCONFIGDATAFORWARDPOLICYROUTE_H void init_nsCommonConfigDataForwardPolicyRoute(void); #endif /* NSCOMMONCONFIGDATAFORWARDPOLICYROUTE_H */