[AGENT++] Handling result of missing object?
dominik.vogt at external.thalesgroup.com
dominik.vogt at external.thalesgroup.com
Wed Jan 26 08:48:32 CET 2011
On Tue, Jan 25, 2011 at 10:00:34PM +0100, Jochen Katz wrote:
> Am 25.01.2011 08:30, schrieb dominik.vogt at external.thalesgroup.com:
> > On Tue, Jan 25, 2011 at 07:35:26AM +0100, Dominik Vogt wrote:
> >> For the records: With the patch, Vb::get_value() returns
> >> SNMP_CLASS_INVALID, so it's not necessary to add an additional
> >> get_syntax() or get_exception_status().
> >
> > *rolleyes* I should have tested that instead of just reading the
> > source code. get_value() does *not* return ...INVALID. However,
> > I think it should. This can be done by calling get_syntax()
> > indirectly through Vb::get_syntax() instead of directly through
> > SnmpSyntax->get_syntax(). See attached patch.
>
> > if (iv_vb_value &&
> > iv_vb_value->valid() &&
> > - (iv_vb_value->get_syntax() == sNMP_SYNTAX_INT32 ))
> > + (get_syntax() == sNMP_SYNTAX_INT32 ))
>
> Like you, reading the source code, I don't see any possibility for
> get_value() returning anything different than INVALID after the
> exception status has been set, as iv_vb_value is freed and set to 0. So
> my guess would be, that something with the rebuild after the change to
> vb.h failed.
Note that *iv_vb_value is of type *SnmpSyntax* and does not know
anything about the exception status of the *Vb* where it is
stored. iv_vb_value->get_syntax() always returns
sNMP_SYNTAX_INT32 because that is its syntax type. On the other
hand, Vb::get_value() does roughly the same but looks at the
exception_status before calling iv_vb_value->get_syntax().
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
More information about the AGENTPP
mailing list