issues with dynamic row creation of table.
gautam borad <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I'm using net-snmp v 5.3.0.1 mib2c to generate the .c files. I want to
implement a table
with RowStatus and that allows dynamic creation of rows. Now the problem is
that i have
a column in the table that needs to have unique value (apart from the
index) across the entire table.
So when a createandgo request comes with all the variable bindings I want to
go through the
entire resuests ie each variable bind and extract out the myID ( the one
that i want unique)
and check whether it is assigned to any other row of myTable. If it is the
agent should
return an error and not set other values. ie not create the row.
Similarly with createandwait.
Here is what i tried but it did not work.
I created the .c file using "mib2c -c mib2c.create-dataset.conf vac"
when i do
snmpset -c xxxx -v2c x.x.x.x myTable.1.5.1 i 4 myTable.1.2.1 i 10
myTable.1.3.1 i 2 myTable.1.4.1 i 1
I can go through the request using somethig like this in myTable_handler :
for ( request = requests ; request ; request = request->next){
requestvb = requests->requestvb;
table_info = netsnmp_extract_table_info(request);
.....
if(table_info->colnum !=COLUMN_V5INTERFACEID){
.....
if(tmpTable[index] == *(request->requestvb->val.integer)
){
// the myID is already assigned to
some other row
return SNMP_ERR_GENERR; // Is it
OK to return here??
else
// the myID doesnot exist so update
local table n continue
tmpTable[index] =
*(request->requestvb->val.integer);
}
The tmpTable[] is my array where i store the already assigned myID values.
The problem is that before the request comes to myTable_handler it is
already
processed by the master table_dataset handler in helpers/table_dataset.c
My queries:
1: Which conf file is best suitable for my case (going through all rows and
comparing for unique column) :
create-dataset.conf or table_data.conf or container.conf or
mfd.conf
2: how and where do i need to put the code for the check?
default_handler or my_handler or somewhere else..
3: how do i handle the createandwait case?
4: When some request comes how do i check other rows , so i dont need to
implement my own array and go through it to see whether the myID is
already
assigned ( or is this the best way? )
Also i did not find much documentation on the agent implementation.(and
hence this post )
Can anyone plz point me to some good documentation/example code?
Thanks in advance.
--
---------------------------------------
We would change the world....
but GOD wont give the source!!
---------------------------------------