You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Motivation

The standard and easy way of instrumenting a MibLeaf object is synchronous value update which is outlined below:

void myMibObject::get_request(Request* req, int ind)
{
        //--AgentGen BEGIN=myMibObject::get_request

        // Call my function here, return s, and put it into value by calling set_state(s)
        // Then continue the get request which calls the SnmpDisplayString::get_request(req, ind) below...

        //--AgentGen END
        SnmpDisplayString::get_request(req, ind);
}

Some people might want to asynchronously retrieve requested values. An intuitial approach could read as followS:

void myMibObject::get_request(Request* req, int ind)
{
        //--AgentGen BEGIN=myMibObject::get_request

        // Callback ptr = &SnmpDisplayString::get_request(req, ind);
        // Put req, pdu and callback_ptr into a message structure and send that in a message to the queue of another task.
        // do not return any value now (won't be up-to-date)
        if (FALSE)
        //--AgentGen END
        SnmpDisplayString::get_request(req, ind);
}

The problem with the above approach is: It will not work with AGENT++ (at least not without additional coding)!

Solution

  • No labels