Code generated for trap types.

Paresh Borkar paresh____pspl.co.in
Fri Oct 18 18:12:21 CEST 2002


Hi,

I have two trap types defined in my MIB file. I used AgentGen Standard
to generate the code files for this MIB. There were two classes
generated, one for each trap type defined in the MIB. The generated
classes look something like below:

class mytrap: public NotificationOriginator {
public:
  // constructor and destructor
  //...
  virtual void generate(Vbx*, int, const OctetStr&);  // this is not
virtual in base class.
};

I wanted to write a single wrapper TrapDispatcher class, which would:
- take a reference to an object of type NotificationOriginator and would
compose the list of trap destinations (from some configuration file) and
add it to the notification originator object.
- Expose a SendTrap message (parameters similar to the above generate
method), which would call the generate method.

However, I noticed that the generate method is not virtual in the
NotificationOriginator class. As a result, I cannot use the base class
reference technique. I was wondering if it makes sense to provide a
similar generate method in NotificationOriginator class as virtual, thus
allowing for passing of  NotificationOriginator derived objects across
using base class references/pointers and being able to operate (for
example: generate traps) on them.

Regards,
Paresh.




More information about the AGENTPP mailing list