add new node into table
胡斌 <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Hi
I have a table SNMP OID,need add a node into my linkage.
e.g. my table have 3 node,OID is:
.1.3.6.1.4.1.17409.2.4.5.1.6.1.8.1
.1.3.6.1.4.1.17409.2.4.5.1.6.1.8.2
.1.3.6.1.4.1.17409.2.4.5.1.6.1.8.3
"Set" this OID
0: Add new line
1:modify the line
3:delete the line
I set .1.3.6.1.4.1.17409.2.4.5.1.6.1.8.4 is 0 error.
I add a function which is uesed add new node in linkage at the head of eocCNUWhiteListTable_handler function.
netsnmp_request_info *request;
netsnmp_table_request_info *table_info;
netsnmp_variable_list *var;
struct commitInfo *ci = NULL;
void *data_context = NULL;
oid *suffix;
size_t suffix_len;
/** column and row index encoded portion */
suffix = requests->requestvb->name + reginfo->rootoid_len + 1;
suffix_len = requests->requestvb->name_length -
(reginfo->rootoid_len + 1);
printf("eocCNUWhiteListTable_handler\n");
// int mmm=0;
// for(mmm;mmm<suffix_len;mmm++)
// printf("suffix[%d] = %d\n",mmm,suffix[mmm]);
CNUWhiteListEntry *tempp = CNUWhiteListEntry_Head;
int flag = 0;
char te[1];
memcpy(te,&suffix[1],1);
while(tempp)
{
if(tempp->node.WriteListIndex == (int)suffix[1])
{
flag = 1;
break;
}
tempp = tempp->next;
}
if(flag == 0)
{
tempp = SNMP_MALLOC_TYPEDEF(struct CNUWhiteListEntry);
memset(tempp,0,sizeof(CNUWhiteListEntry));
tempp->node.WriteListIndex = (int)suffix[1];
tempp->node.AccStatus = 0;
tempp->node.AutoUpgradeEN = 0;
tempp->node.OutRfLevel = 10;
tempp->node.PortConfigInfoIndex = 0;
tempp->node.RowStatus = 4;
printf("suffix[1] = %d\n",atoi(te));
printf("tempp->node.WriteListIndex = %d\n",tempp->node.WriteListIndex);
Add_CNUWhiteListEntry_List_Entry(tempp,false);
}
for(tempp = CNUWhiteListEntry_Head;tempp!=NULL;tempp=tempp->next)
printf("3333tempp->node.WriteListIndex = %d\n",tempp->node.WriteListIndex);
but at
case MODE_SET_RESERVE1:
printf("_2_data_context = %d\n",data_context);
data_context = netsnmp_extract_iterator_context(request);
printf("_22_data_context = %d\n",data_context);
break;
the data_context is null.what can I do?
thinks
------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
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