Hi,all
I create netSnmpIETFWGTable.c, netSnmpIETFWGTable.h using NET-SNMP-EXAMPLES-MIB by
running mib2c mib2c.iterate.conf
I initialize table data in netSnmpIETFWGTable_get_first_data_point(),
I create netSnmpIETFWGTable.c, netSnmpIETFWGTable.h using NET-SNMP-EXAMPLES-MIB by
running mib2c mib2c.iterate.conf
I initialize table data in netSnmpIETFWGTable_get_first_data_point(),
////code
struct netSnmpIETFWGTable_entry *tmp;
while (netSnmpIETFWGTable_head)/*clean link list begin*/
{
struct netSnmpIETFWGTable_entry *tmp;
while (netSnmpIETFWGTable_head)/*clean link list begin*/
{
tmp=netSnmpIETFWGTable_head->next;
netSnmpIETFWGTable_removeEntry(netSnmpIETFWGTable_head);
netSnmpIETFWGTable_head=tmp;
}/*clean link list end*/
tmp=SNMP_MALLOC_TYPEDEF(struct netSnmpIETFWGTable_entry);
tmp->next=NULL;
tmp->next=NULL;
// add values to link
memset(tmp->nsIETFWGName, 0, 64);
memcpy(tmp->nsIETFWGName, "snmpv3", 6);
memset(tmp->nsIETFWGChair1, 0, 64);
memcpy(tmp->nsIETFWGChair1, "Russ Mundy", 10);
memset(tmp->nsIETFWGChair2, 0, 64);
memcpy(tmp->nsIETFWGChair2, "David", 5);
netSnmpIETFWGTable_createEntry(tmp->nsIETFWGName,
memset(tmp->nsIETFWGName, 0, 64);
memcpy(tmp->nsIETFWGName, "snmpv3", 6);
memset(tmp->nsIETFWGChair1, 0, 64);
memcpy(tmp->nsIETFWGChair1, "Russ Mundy", 10);
memset(tmp->nsIETFWGChair2, 0, 64);
memcpy(tmp->nsIETFWGChair2, "David", 5);
netSnmpIETFWGTable_createEntry(tmp->nsIETFWGName,
tmp->nsIETFWGChair1,
tmp->nsIETFWGChair2);
SNMP_FREE(tmp);
////
tmp->nsIETFWGChair2);
SNMP_FREE(tmp);
////
but when I want to get infoes by snmpwalk, but the value of
table_info->colnum is 0 in the netSnmpIETFWGTable_handler(), and the return of snm
pwalk is
" NET-SNMP-EXAMPLES-MIB::netSnmpIETFWGTable = No Such Object available on this agent at this OID"
////code
netsnmp_request_info *request;
netsnmp_table_request_info *table_info;
struct netSnmpIETFWGTable_entry *table_entry;
netsnmp_request_info *request;
netsnmp_table_request_info *table_info;
struct netSnmpIETFWGTable_entry *table_entry;
switch (reqinfo->mode) {
/*
* Read-support (also covers GetNext requests)
*/
case MODE_GET:
for (request = requests; request; request = request->next) {
table_entry = (struct netSnmpIETFWGTable_entry *)
netsnmp_extract_iterator_context(request);
table_info = netsnmp_extract_table_info(request);
/*
* Read-support (also covers GetNext requests)
*/
case MODE_GET:
for (request = requests; request; request = request->next) {
table_entry = (struct netSnmpIETFWGTable_entry *)
netsnmp_extract_iterator_context(request);
table_info = netsnmp_extract_table_info(request);
/////here the value of table_info->colnum is 0
switch (table_info->colnum) {
case COLUMN_NSIETFWGCHAIR1:
snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
table_entry->nsIETFWGChair1,
sizeof(table_entry->
nsIETFWGChair1));
snmp_log(LOG_ERR, "%s\r\n", table_entry->nsIETFWGChair1);
break;
case COLUMN_NSIETFWGCHAIR2:
snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
table_entry->nsIETFWGChair2,
sizeof(table_entry->
nsIETFWGChair2));
snmp_log(LOG_ERR, "%s\r\n", table_entry->nsIETFWGChair2);
break;
}
}
break;
////
How can I do?
Thanks for any comments and suggestions!
switch (table_info->colnum) {
case COLUMN_NSIETFWGCHAIR1:
snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
table_entry->nsIETFWGChair1,
sizeof(table_entry->
nsIETFWGChair1));
snmp_log(LOG_ERR, "%s\r\n", table_entry->nsIETFWGChair1);
break;
case COLUMN_NSIETFWGCHAIR2:
snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
table_entry->nsIETFWGChair2,
sizeof(table_entry->
nsIETFWGChair2));
snmp_log(LOG_ERR, "%s\r\n", table_entry->nsIETFWGChair2);
break;
}
}
break;
////
How can I do?
Thanks for any comments and suggestions!
__________________________________________________
赶快注册雅虎超大容量免费邮箱?
http://cn.mail.yahoo.com