Hi All/
Thank in advance.
I am developing SNMP subagent using netsnmp library.
My requirement is the "creation/deletion" of row at runtime.
Please find following details for the reference::
- To generate the code I have used -
"mib2c.access_functions.conf" scripts.
- My Table contains 6 col including "StatusRow" which is below
typedef struct spiConnEntry_s {
long refIndex; /* For index */
/**** No of Col******* */
int dataSpiConnectionId;
int dataSpiInputInterface;
int dataSpiInputPortNumber;
int dataSpiOutputInterface;
int dataSpiOutputPortNumber;
int dataSpiRowStatus;
int valid;
struct spiConnEntry_s * pNext;
}spiConnEntry;
Ques1. The method " spiConnTable_create_data_context" is
envolved for row creation(According to documentaion).I
tried to write some code in this method which is below:
**********************************************************
spiConnTable_create_data_context(netsnmp_variable_list *
index_data,
int column)
{
spiConnEntry *newRow = SNMP_MALLOC_TYPEDEF(spiConnEntry);
printf("\n In spiConnTable_create_data_context
method...");
printf("\n spiConnTable_create_data_context() :: column =
%d",column);
if( !newRow )
{
printf("\n Malloc failed \n");
return NULL;
}
printf("\n spiConnTable_create_data_context() ::
index_data->val.integer=%d",index_data->val.integer);
memcpy( &newRow->dataSpiInputInterface, index_data-
>val.integer , sizeof(int) );
return newRow;
}
*******************************************************
QUES2: What should I write in the below method?
*******************************************************
spiConnTable_commit_row(void **my_data_context, int
new_or_del)
{
/** Add any necessary commit code here */
/*
*/
/*
* return no errors. And there shouldn't be any!!!
Ever!!! You
* should have checked the values long before this.
*/
return SNMP_ERR_NOERROR;
}
*********************************************************
QUES3 : Also in the below methods.
long *
get_atca910xSpiRowStatus(void *data_context, size_t *ret_len)
{
static long ret = RS_ACTIVE; // I just tried to write
*ret_len = sizeof(ret);
return &ret;
}
/** XXX: Set the value of the atca910xSpiRowStatus column and
return
SNMP_ERR_NOERROR on success
SNMP_ERR_XXX for SNMP deterministic error codes
SNMP_ERR_GENERR on generic failures (a last result
response). */
int
set_atca910xSpiRowStatus(void *data_context, long *val,
size_t val_len)
{
return SNMP_ERR_NOERROR; /** XXX: change if an error
occurs */
}
QUES4: What about "RowStatus" col.
How do I handle the following states?
1. Active
2. notinService
3. notReady
4 CreateAndGo
5. createAndGo
6, Destroy.
QUES5. Also please do let me know what I need to Change/Add
in the following section "Mode" [ Since maximum part of the
code mib2c already generate]?
1. SET
2. RESERVE1
3. RESERVE2
4. ACTION
5. COMMIT
NOTE : I would be very happy if you can refer some sample
application for the same.
QUES6. Also , I want to handle trap for my own mib.
Any help would be greatly appreciated.
Regards/
Devendra
The information contained in this electronic message and any attachments to
this message are intended for the exclusive use of the addressee(s)and may
contain confidential or privileged information. If you are not the intended
recipient, please notify the sender or [EMAIL PROTECTED]
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders