[AGENT++] Need help with certain design

Reetesh Ranjan reeteshr at gmail.com
Wed Aug 18 11:30:57 CEST 2010


I played around with the agent++ source and examples, and I could get
the flow to enter my derived get_next_request() by changing my derived
find_succ() method to return some non-null Oidx. I can take it from
here.

Thanks for such a brilliant s/w that provides more control and
manipulating interfaces.

- Reetesh

On Wed, Aug 18, 2010 at 1:38 PM, Reetesh Ranjan <reeteshr at gmail.com> wrote:
> Frank,
>
> I derived and implemented pure virtual functions of MibComplextEntry.
> I constructed it with OID x.y.z.1.
>
> SET Works!
>
> I am able to get the flow into the derived commit_set_request (I don't
> know which other function to use to handle SET once we derive a class
> for MibComplexEntry). I did a SET for x.y.z.1.100 and x.y.z.1.101.
> Both work fine (enter my derived function).
>
> GETNEXT does not work!
>
> What I need to do is to have a class that I construct for x.y.z.1
> which should serve me getnext request for x.y.z.1.100 to x.y.z.1.<max
> uint32>.
>
> However, I am not able to get the flow for getnext into my class at all.
>
> I am trying to construct the upperBound [max_key()] in different ways
> and I get to a different issue with each of them:
> upperBound = x.y.z.1.100. GETNEXT on x.y.z.1.100. I get this error on
> client side:  No more variables left in this MIB View (It is past the
> end of the MIB tree)
> upperBound = x.y.z.1.101. GETNEXT on x.y.z.1.100. I get a timeout on
> client side, and my get_next_request() function never gets called.
> upperBound = x.y.z.1.101.0. GETNEXT on x.y.z.1.100. Same as above
> (timeout on client)
> upperBound = x.y.z.1.100.0. GETNEXT on x.y.z.1.100. Same as above
> (timeout on client)
> upperBound = x.y.z.1. GETNEXT on x.y.z.1.100. Same as above (timeout on client).
>
> I have a doubt / lack of understanding on how to implement the
> max_key()/find_succ() function for this case, and I am suspecting the
> issue to be there.
>
> Could you please help me with this issue?
>
> This is my derived class:
>
> class SDCFsMibHandler : public MibComplexEntry
> {
> public:
>    // constructor
>    SDCFsMibHandler();
>
>    // destructor
>    virtual
>    ~SDCFsMibHandler() { }
>
>    // Needed to implement pure virtual functions
>  virtual MibEntry * clone() { return NULL; }
>  virtual Oidx find_succ(const Oidx & a, Request * req=NULL) { return Oidx(); }
>  virtual void get_request(Request *, int) { /* no-op */ }
>
>  virtual int commit_set_request(Request*, int);
>
>  virtual int prepare_set_request(Request*, int&) { return SNMP_ERROR_SUCCESS; }
>
>  virtual int undo_set_request(Request*, int&) { return SNMP_ERROR_SUCCESS; }
>
>  virtual void cleanup_set_request(Request*, int&) { }
>
>  // get handler
>  virtual void
>  get_next_request(Request*, int);
>
>  virtual OidxPtr max_key(void) { return (&max); }
>
> private:
>
>    Oidx                    max;
> };
>
> SDCFsMibHandler::SDCFsMibHandler()
>    : MibComplexEntry("1.3.6.1.4.1.108.1.200.1", READWRITE),
>      max("1.3.6.1.4.1.108.1.200.1.100.0")
> {
> }
>
> void SDCFsMibHandler::get_next_request(Request * request, int ind)
> {
>     // for now just print a message
> }
>
> int SDCFsMibHandler::commit_set_request(Request * request, int ind)
> {
>    // for now just print a message and return 0
> }
>
> Thanks,
> Reetesh
>
> On Wed, Aug 18, 2010 at 2:32 AM, Frank Fock <fock at agentpp.com> wrote:
>> Hi Reetesh,
>>
>> You can use MibComplexEntry for that.
>>
>> Best regards,
>> Frank
>>
>> On 17.08.2010 22:17, Reetesh Ranjan wrote:
>>> -   I need to register for a subtree OID e.g. x.y.1 such that I can
>>> receive and process SET and GETNEXT request for OIDs like x.y.1.100,
>>> x.y.1.135 etc.
>>> -   I need to modify the OID in the GETNEXT response e.g. if GETNEXT
>>> REQ had a VB for x.y.1.135, I want to change the VB in the GETNEXT REP
>>> to x.y.1.136.
>>>
>>> I am not able to achieve above with MibLeaf and MibTable. I used
>>> examples/search on forum emails; but can't seem to get the direct
>>> answer. I don't want to go AgentX or any solution that involves
>>> multiple processes. Could you please help me with this?
>>>
>>> I have done a working example earlier for SET and GET with a scalar
>>> OID x.y.1 earlier, so that SET/GET with the OID x.y.1.0 work fine.
>>> This was using a derivation of MibLeaf and standard loop in a thread
>>> to listen and process SNMP requests following the agent++ examples to
>>> do the same.
>>>
>>> Thanks,
>>> Reetesh
>>> _______________________________________________
>>> AGENTPP mailing list
>>> AGENTPP at agentpp.org
>>> http://lists.agentpp.org/mailman/listinfo/agentpp
>>
>> --
>> AGENT++
>> http://www.agentpp.com
>> http://www.snmp4j.com
>> http://www.mibexplorer.com
>> http://www.mibdesigner.com
>>
>> _______________________________________________
>> AGENTPP mailing list
>> AGENTPP at agentpp.org
>> http://lists.agentpp.org/mailman/listinfo/agentpp
>>
>



More information about the AGENTPP mailing list