implementing dynamic variable
Mauro Restante
restante____cefriel.it
Sat Apr 7 16:43:01 CEST 2001
thanks very much Frank. It's ok the Manager recive the correct value
Best Regards
Mauro
-----Original Message-----
From: Frank Fock [mailto:Frank.Fock____t-online.de]
Sent: sabato 7 aprile 2001 13.03
To: Mauro Restante
Cc: agentpp-dl____fock.de
Subject: Re: implementing dynamic variable
Hi Mauro,
The problem is that your object is of type OctetString, but
you are trying to assign a TimeTicks value to it. I wonder
why the agent does not crash?
You should convert the TimeTicks value to a string with
*((OctetStr*)value) = TimeTicks(get()).get_printable();
Regards,
Frank
Mauro Restante wrote:
> Hi frank, and hi to all mailing list,
>
> In order to implement a Mib with Agent++, I first try to implement a
dynamic
> variable, only a mib leaf.
> I used AgentGen to compile a Disman-Schedule-Mib.
> Now I try to implement SchedLocalTime variable, and I look the
> implementation of sysUpTime system-group leaf.
> It should be the same!!??!?!?
> When I interrogate the agent I receive a "zero length" answer!!!! The SNMP
> PDU is empty!!!!! Why?
> Should someone help me??
>
> This is my code.......it is the same of sysUpTime....
>
> >>> schedLocalTime::schedLocalTime()
> MibLeaf(oidSchedLocalTime, READONLY, new
OctetStr())
> >>> {
> >>> // This leaf object is a singleton. In order to access it
use
> >>> // the static pointer schedLocalTime::instance.
> >>> instance = this;
> >>> start=get();
> >>> //--AgentGen BEGIN=schedLocalTime::schedLocalTime
> >>> //--AgentGen END
> >>>
> >>> }
>
> >>> schedLocalTime::~schedLocalTime()
> >>> {
> >>>
> >>> //--AgentGen BEGIN=schedLocalTime::~schedLocalTime
> >>> //--AgentGen END
> >>> }
>
> >>> //§§ MR
>
> >>> time_t schedLocalTime::get_currentTime()
> >>> {
> >>> time_t now;
> >>> time (&now);
> >>>
> >>> return now;
> >>> }
>
> >>> u_int schedLocalTime::get()
> >>> {
>
> >>> return get_currentTime();
> >>> }
> >>> //§§ MR finish
>
> >>> void schedLocalTime::get_request(Request* req, int index)
> >>> {
> >>>
> >>> //--AgentGen BEGIN=schedLocalTime::get_request
> >>> //--AgentGen END
> >>> //§§ MR
> >>>
> >>> *((TimeTicks*)value) = (unsigned long)get(); /*This is the
right
> assignament to retrive the value????*/
> >>>
> >>> //§§ MR finish
> >>>
> >>> MibLeaf::get_request(req, index);
> >>>
> >>> }
>
> Thanks to ALL and forgive my bad english
>
> Mauro Restante
More information about the AGENTPP
mailing list