Hi Deve,
Thank you so much for your help.
Yes, These are two methods which are envolved for dynamic row
creation/Deletion.
spiConnTable_create_data_context (...)
and
spiConnTable_commit_row(...)
Kindly find attached file for the code reference.
When I try to create(commit) row using MGSOFT browser,It says
no row creation.
Steps which I followed:
=======================
1. Select Rowstatus col as cretaeAndGo
2. Addrow
3. Commit
Message : commit Failed. OID failed during set operation(No
creation)
During this operation control never goes to the respective
method(spiConnTable_create_data_context
(),spiConnTable_commit_row() ) etc.
QUES :Is it require to write code for "RowStatus" states
handling?.
Please do let me know if anything is wrong in that.
(Please see the reference file )
Any help from anybody would be really appreciated.
---Regards
Devendra
Data Structure ::
==================
typedef struct spiConnEntry_s {
int dataSpiConnectionId;
int dataSpiInputInterface;
int dataSpiInputPortNumber;
int dataSpiOutputInterface;
int dataSpiOutputPortNumber;
int dataSpiRowStatus;
long iatca910xSpiConnectionId;
long refIndex;
struct spiConnEntry_s * pNext;
}spiConnEntry ;
spiConnEntry *head=NULL;
================================================
struct spiConnEntry *
spiConnTable_addEntry(long atca910xSpiConnectionId )
{
spiConnEntry *entry;
entry = (spiConnEntry *)malloc(sizeof(spiConnEntry));
printf("I am in spiConnTable_addEntry*******************\n");
//entry = SNMP_TYPEDEF_MALLOC(struct spiConnEntry);
if (!entry)
return NULL;
entry->iatca910xSpiConnectionId = atca910xSpiConnectionId;
entry->pNext = head;
head = entry;
return head;
}
=============================================================
/*
* remove a row from the table
*/
void
spiConnTable_deleteEntry(struct spiConnEntry *entry)
{
spiConnEntry *ptr, *prev;
printf("I am in spiConnTable_DeleteEntry*******************\n");
if (!entry)
return; /* Nothing to remove */
for (ptr = head, prev = NULL;
ptr != NULL; prev = ptr, ptr = ptr->pNext) {
if (ptr == entry)
break;
}
if (!ptr)
return; /* Can't find it */
if (prev == NULL)
head = ptr->pNext;
else
prev->pNext = ptr->pNext;
SNMP_FREE(entry); /* XXX - release any other internal resources */
}
==========================================================
void *
spiConnTable_create_data_context(netsnmp_variable_list * index_data)
{
spiConnEntry *dataCtx = SNMP_MALLOC_TYPEDEF(spiConnEntry);
if (!dataCtx)
return NULL;
strncpy(dataCtx->dataSpiConnectionId, index_data->val.string,
strlen(index_data->val.string));
printf("\nspiConnTable_create_data_context\n");
printf("\n ************ I am in dreate data context\n***************");
return dataCtx;
}
=============================================================
int
spiConnTable_commit_row(void **my_data_context, int new_or_del)
{
printf(" I am in Commit ************************\n");
/** Add any necessary commit code here */
/*
*/
switch ( new_or_del ) {
case 1:
spiConnTable_addEntry( *my_data_context );
break;
case -1:
spiConnTable_deleteEntry( *my_data_context );
*my_data_context = NULL;
break;
}
return SNMP_ERR_NOERROR;
}
=========================================================
netsnmp_variable_list *
spiConnTable_get_first_data_point(void **my_loop_context,
void **my_data_context,
netsnmp_variable_list * put_index_data,
netsnmp_iterator_info *mydata)
{
spiConnEntry* firstEntry = head;
if( firstEntry == 0)
{
printf("\n FirstEntry is NULL \n");
return NULL;
}
*my_loop_context = (void*)firstEntry;
*my_data_context = (void*)firstEntry;
return
spiConnTable_get_next_data_point(my_loop_context,my_data_context,put_index_data,mydata);
}
==========================================================
netsnmp_variable_list *
spiConnTable_get_next_data_point(void **my_loop_context,
void **my_data_context,
netsnmp_variable_list * put_index_data,
netsnmp_iterator_info *mydata)
{
spiConnEntry *nextEntry = (spiConnEntry*) *my_loop_context;
if( !nextEntry)
{
printf("\n No more rows present\n");
return NULL;
}
snmp_set_var_value(put_index_data,
(u_char*)&nextEntry->iatca910xSpiConnectionId, sizeof(long) );
*my_data_context = (void*)nextEntry;
*my_loop_context = (void*)nextEntry->pNext;
return put_index_data;
}
When I try to create(commit) row using MGSOFT browser,It says no row creation.
Steps which I followed:
=======================
1. Select Rowstatus col as cretaeAndGo
2. Addrow
3. Commit
Message : commit Failed. OID failed during set operation(No
creation)
During this operation control never goes to the respective
method(spiConnTable_create_data_context(),spiConnTable_commit_row() ) etc.
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]