Q:Table prepare set

manjunath ramaiah manjunath.ramaiah____wipro.com
Sat Jun 17 10:35:09 CEST 2000


Hi ,

I am getting this error if i do not overide the function for new instance.

"snmpset: Agent reported error with variable #1.
.iso.org.dod.internet.mgmt.mib-2.ip.ipRouteTable.ipRouteEntry.ipRouteDest.192.16

8.204.60:  SNMPv2: Creation not allowed."

Thanks,
Manju

Frank Fock wrote:

> manjunath ramaiah wrote:
>
> > Hi ,
> >
> > I want to add a row if it is not present already . I have  overridden
> > the mibtable prepare_set function as follows
>
> Why do you override it? MibTable will handle it: if you make
> a SET request on a non existing instance, it will create the row.
> BTW, within the iprouteEntry you should use "this" instead of
> "iprouteEntr::instance". Also you do not need to use
> chTempIndex. Instead you may use
> Oidx ind(this->index(req->get_oid()));
>
> Best regards,
> Frank
>
> >
> > int iprouteEntry::prepare_set_request(Request* req, int& ind)
> > {
> >     //This class  is derived from mibtable
> >         char chTempIndex[50] ;
> >     int nRetValue ;
> >
> >         printf("entry called \n");
> >         nRetValue =   MibTable::prepare_set_request(req,ind);
> >
> >         if  ( nRetValue == SNMP_ERROR_NO_CREATION  )
> >         {
> >                 // Means this is new row , so add row.
> >
> >                 strcpy( chTempIndex, ( ( iprouteEntry::instance->index(
> > req->get_oid(ind
> >                                                 ))).get_printable()));
> >
> >                 Oidx x( (char * )chTempIndex);
> >                MibTable::start_synch();
> >                 iprouteEntry::instance->add_row( x );
> >                MibTable::end_synch();
> >                 printf("row added %s\n",chTempIndex);
> >                 return SNMP_ERROR_SUCCESS;
> >  }
> >         // else the row is already present
> >         return nRetValue ;
> > }
> >




More information about the AGENTPP mailing list