[AGENT++] Branch Handler

Frank Fock fock at agentpp.com
Thu Jan 15 20:54:43 CET 2004


Hi Marcus,

Please find my answers inline:

Fehde, Marcus wrote:

>I'm currently concernd with the evaluation of SNMP agents for our next project. 
>One requirement is to handle MIB objects on a branch basis. 
>  
>
May I ask why this is a requirement?

>This means that I do not have one single C++ class for every MIB object, but I've a 
>branch handler that covers all leafs of a branch.
>  
>
To implement such a "branch handler" class with AGENT++, you can subclass
the MibComplexEntry class.

>Example: The branch "sysInformation" has the objects "infDeviceName", "infDeviceType" and "infDeviceID".
> 
>void SysInformationHandler( int lastmatch, int instance, Response& response )
>{
>  switch( lastmatch )
>  {
>    case InfDeviceName:
>      response = ...;
>      break;
> 
>    case InfDeviceType:
>      response = ...;
>      break;
> 
>    case InfDeviceID:
>      response = ...;
>      break;
>  }
>}
> 
>I think this is enough to explain the idea. 
> 
>Since I've to model every class with a modelling tool it is not very convenient to do this for several hundred MIB objects.
>  
>
Yes, it is not very convenient ;-) That's why there is AgenPro 2 which 
can be used
to generate the code that can be automatically derived from MIB 
specifications.
The default code generation templates generate one class per MIB object.
In some cases, where a lot of MIB objects are needed, the overhead of this
approach may be to high.

In order to reduce code size, as a first step one can enable to property 
"lightTables"
which avoids the generation of classes for read-only columns.

For the next step of code size reduction one need to change the AgenPro
code generation templates. With the upcoming version 2.1 this task is much
easier, because the new code generation job type "By selection" allows to
write a small template that selects which MIB object should be generated 
into
what source files.

Then it is relatively easy to write a template to generate a "branch 
handler"
class for a group of MIB objects.

>Is it possible to do this with the Agent++ framework?
> 
>  
>
Yes, of course.

Best regards,
Frank Fock







More information about the AGENTPP mailing list