mrtc...@gmail.com
unread,Oct 3, 2012, 8:02:10 PM10/3/12You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hope someone can help :-) please...
I have a table:-
struct adslLineConfProfileTable_entry
{
// Index values.
//-------------
long adslLineConfProfileName_len;
char adslLineConfProfileName[32];
// Column values.
//--------------
...
}
I have set up a table and registered an iterator during initialisation:-
void init_adslLineConfProfileTable(void)
{
static oid adslLineConfProfileTable_oid[] = {1,3,6,1,2,1,10,94,1,1,14};
size_t adslLineConfProfileTable_oid_len = OID_LENGTH(adslLineConfProfileTable_oid);
netsnmp_handler_registration* handlerRegistrationPtr =
netsnmp_create_handler_registration(
"adslLineConfProfileTable",
adslLineConfProfileTable_handler,
adslLineConfProfileTable_oid,
adslLineConfProfileTable_oid_len,
HANDLER_CAN_RWRITE);
cout << __FUNCTION__ << ":handlerRegistrationPtr = " << handlerRegistrationPtr << endl;
if (handlerRegistrationPtr == NULL)
{
cout << __FUNCTION__ << ":ERROR: handlerRegistrationPtr is NULL" << endl;
return;
}
// Allocate some memory for the netsnmp_table_registration_info.
netsnmp_table_registration_info* tableRegistrationInfoPtr = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
cout << __FUNCTION__ << ":tableRegistrationInfoPtr = " << tableRegistrationInfoPtr << endl;
if (tableRegistrationInfoPtr == NULL)
{
// Not good.
cout << __FUNCTION__ << ":ERROR: tableRegistrationInfoPtr is NULL" << endl;
return;
}
// Add the indexes.
netsnmp_table_helper_add_indexes(
tableRegistrationInfoPtr,
ASN_OCTET_STR, /* index: adslLineConfProfileName */
0);
// Indicate the first and last column.
tableRegistrationInfoPtr->min_column = COLUMN_ADSLATUCCONFRATEMODE;
tableRegistrationInfoPtr->max_column = COLUMN_ADSLLINECONFPROFILEROWSTATUS;
netsnmp_iterator_info *iinfo;
iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
iinfo->get_first_data_point = adslLineConfProfileTable_get_first_data_point;
iinfo->get_next_data_point = adslLineConfProfileTable_get_next_data_point;
iinfo->table_reginfo = tableRegistrationInfoPtr;
int registerIteratorReturnVal = netsnmp_register_table_iterator(handlerRegistrationPtr, iinfo );
cout << __FUNCTION__ << ":registerIteratorReturnVal = " << registerIteratorReturnVal << endl;
if (registerIteratorReturnVal != SNMPERR_SUCCESS)
{
cout << __FUNCTION__ << ":ERROR: registerIteratorReturnVal is " << registerIteratorReturnVal << endl;
return;
}
}
The handler:- (the interesting bit at least...)
int
adslLineConfProfileTable_handler(
netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
netsnmp_request_info* request = 0;
netsnmp_table_request_info* netsnmpTableRequestInfoPtr = 0;
struct adslLineConfProfileTable_entry* table_entry = 0;
cout << endl << endl << __FUNCTION__ << ":Start:-" << endl;
switch (reqinfo->mode) {
/*
* Read-support (also covers GetNext requests)
*/
case MODE_GET:
{
for (request=requests; request; request=request->next) {
netsnmpTableRequestInfoPtr = netsnmp_extract_table_info(request);
table_entry = (struct adslLineConfProfileTable_entry *)netsnmp_extract_iterator_context(request);
if (table_entry != NULL)
{
switch (netsnmpTableRequestInfoPtr->colnum) {
case COLUMN_ADSLATUCCONFRATEMODE:
... etc
}
Sadly table entry is always null :-(
What am I doing wrong?
To create a rows:-
snmpset -v2c -Os -r0 -c public <ipAddress> "adslLineConfProfileRowStatus.'abc'" i createAndGo
snmpset -v2c -Os -r0 -c public <ipAddress> "adslLineConfProfileRowStatus.'abd'" i createAndGo
snmpset -v2c -Os -r0 -c public <ipAddress> "adslLineConfProfileRowStatus.'abe'" i createAndGo
snmpset -v2c -Os -r0 -c public <ipAddress> "adslLineConfProfileRowStatus.'abf'" i createAndGo
The snmpget I am doing is:-
snmpget -v2c -Os -r0 -c public <ipAddress> "adslLineConfProfileRowStatus.'abc'"
The result of a get:-
snmpget -v2c -Os -r0 -c public 192.168.204.137 "adslLineConfProfileRowStatus.'abc'"
adslLineConfProfileRowStatus.'abc' = No Such Instance currently exists at this OID
But if I do a walk:-
snmpbulkget -Cr5 -Os -v2c -c public 192.168.204.137 adslLineConfProfileRowStatus
adslLineConfProfileRowStatus.'.abc' = INTEGER: active(1)
adslLineConfProfileRowStatus.'.abd' = INTEGER: active(1)
adslLineConfProfileRowStatus.'.abe' = INTEGER: active(1)
adslLineConfProfileRowStatus.'.abf' = INTEGER: active(1)
adslLineDMTEOC.1005001 = INTEGER: unknown(1)
(The last entry looks like some rubbish returned back)
If you can help me figure this out, you are officially the coolest person in the world (in my opinion)
Thanks in advance
TC