set mib leaf function

Frank Fock Frank.Fock____t-online.de
Tue Apr 17 19:01:13 CEST 2001


Hi Noam,

The code seems to be OK, but you did not check whether 'entry'
is returned successfully and whether it is a MibLeaf instance.
May be there is the problem...

Regards,
Frank

Noam Wolf wrote:

> Hi All
>
> I'm trying to make an API to set a Mib Leaf's value (so it could be used
> from C modules also).
> When I get to the function leaf->set_value(vb), I get an error of User
> Breakpoint called from...
> The error is actually generated when the MibLeaf is trying to execute the
> function void MibLeaf::free_value()
>
> Is my API the right way to set a MibLeaf ? (of integer type)
>
> int fAgent_SetMibVar (int value,                        //      IN:     The
> new value of the mib leaf
>                                            char* pszOid)                //
> IN: The oid of the variable to be set
> {
> //------------------[local declerations]---------------------------------
>
>         int ret = AGENT_FAIL;   //int the return value of the function
>         Vbx vb;                                         //the Vb that will
> be set into the mib leaf
>         MibEntryPtr entry;                      //entry to the mib - pointer
> to the mib leaf
>         MibLeaf* leaf;                          //a pointer to the mib leaf
> to be set
>
> //------------------[function flow]--------------------------------------
>
>         vb.set_oid(pszOid);
>         vb.set_value(value);
>         Oidx tmpoid(pszOid);
>         entry = mib->get(tmpoid);
>         leaf =((MibLeaf*)entry);
>         mib->lock_mib();
>         if(leaf->set_value(vb)==SNMP_ERROR_SUCCESS)
>                 ret = AGENT_SUCCESS;
>         mib->unlock_mib();
>         return ret;
> }
>
> thanks,
>                 Noam Wolf




More information about the AGENTPP mailing list