Agent API

AgentAPI.*xx is the base class for any application agents. It can be found in the vocal/util directory. An example of an agent is vocal-1.3.0/hb/hbs/HbsAgent.*xx. If you add a new server to the network, add a SIP stack and make an agent for that server.

Let’s have a quick look at some of the code from vocal-1.3.0/util/snmp/AgentApi.hxx:

    typedef enum
    {
        Get = 1,
        Set,
        Trap,
        Response,
        Register,
        Register_Req
    } actionT;

    #define PARM1SIZE 128
    #define PARM2SIZE 1024
    typedef struct
    {
        actionT action;
        AgentApiMibVarT mibVariable;
        unsigned long transactionNumber;
        char parm1[PARM1SIZE];
        char parm2[PARM2SIZE];
    }
    ipcMessage 
;

This is a very simple protocol: there is only one message type, ipcMessage, sent back and forth and a limited number of fields contained within the message. When an SNMPd starts up, it broadcasts an ipcMessage as a Register_Req request. Any servers or SIP stacks that respond also use the same message type with a Register response. When an SNMPd requests system status information, it sends out the ipcMessage with a get command, which is responded to with an ipcMessage containing either a set, trap, or response value.

The parameter parm1[PARM1SIZE] contains the get value. Any received set values are written to the parm2[PARM2SIZE] variable.

Implemented MIBs

The Network Manager application uses the SNMPd and the HBS to manage the VOCAL applications. As stated at the beginning of this chapter, the basic SNMP framework used in VOCAL is taken from the UC Davis SNMP ...

Get Practical VoIP Using VOCAL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.