get_request called twice

Guy.HINDELL____opentrade.co.uk Guy.HINDELL____opentrade.co.uk
Thu Nov 9 12:57:23 CET 2000


>> I've recently implemented a leaf derived from MibLeaf which overrides the
>> get_value() method with some code which performs rather more processing
than
> the simple return of a varbind. I noticed whilst debugging this code that
it
>> was being invoked twice for each get request I sent to the agent, which
is
>> an overhead I don't want.
>>

>Then you should not override get_value(), instead please override
>get_request(Request*, int).

>>
>> One problem with this is that get_request can't be overridden in derived
>> leaf classes (I don't do this anyway), but maybe another approach is an
>> additional get_reqest method which can take a varbind as an argument
rather
>> than call get_value.

>The get_request method can be overridden! The only thing
>you will have to make sure is that it looks like:


Sorry, that's not what I meant, I wasn't clear. Sure, the get_request method
can be overridden, but by removing the call to it in the
MibTable::get_request() it means it won't be used even if it is overridden.

>void MibLeaf::get_request(Request* req, int ind)
>{
> if (get_access() >= READONLY) {
>
>  Mib::requestList->done(req->get_transaction_id(), ind,
>           get_value());
> }
> else {
>  Mib::requestList->error(req->get_transaction_id(), ind,
>     SNMP_ERROR_NO_ACCESS);
> }
>}

I can't see that this will work. It still depends on a call to get_value(),
which, if it is not overridden in the derived leaf, will simply return the
value of the MibLeaf on which it is based. My derived leaf does not use the
'value' property of the MibLeaf - its get_value() method executes code to
dynamically yeild a varbind. If I switch that code to a derived
get_request() method then any other calls to get_value() (there are lots,
but in particular that in the MibTable::get_request()) will give meaningless
results.

If a varbind could be passed to to the MibLeaf::get_request method -
something like this...

MibLeaf::get_request(Resuest *req, int ind, Vbx *vb)

Then calls to it could either use the supplied varbind, or, if none were
supplied, make a call to get_value() as before.








Best regards,
Frank

--
Frank Fock - AGENT++
Email: frank____fock.de
Fax: +49 7195 177108



* ------------------------------------------------------------------------ *
 Privileged/Confidential Information may be contained in this 
 message. If you are not the addressee indicated in this      
 message (or responsible for delivery of the message to such  
 person), you may not copy or deliver this message to anyone. 
 In such case, you should destroy this message and kindly     
 notify the sender by reply e-mail. Please advise immediately 
 if you or your employer does not consent to Internet e-mail  
 for messages of this kind. Opinions, conclusions and other   
 information in this message that do not relate to the        
 official business of my Company shall be understood as       
 neither given or endorsed by it.                             
* ------------------------------------------------------------------------ *





More information about the AGENTPP mailing list