[AGENT++] callback problem

Manuel Werlberger m.werlberger at avibit.com
Thu Jun 8 09:57:03 CEST 2006


Hi!

I just wrote a first test class in c++ to experiment with snmp++. Simple 
bulk-get and set works just fine out of the box. But with asynchronous 
calls i have my problems:

My compiler (g++ 3.4.5) says that
snmpsession.cpp:187: error: no matching function for call to 
`Snmp::get(Pdu&, SnmpTarget&, <unresolved overloaded function type>, int)'
.

What i've done:
*) In the header i did a typedef:
typedef void (*snmp_callback)( int, Snmp*, Pdu&, SnmpTarget&, void*);

*) and the declaration
bool getAsyncVariable(const QString &oidNumber, QVariant &retvar,
                                          QString &displayedVar, int 
&status);

*) In the cpp file i did the programming almost like the bulk get but with
int state = m_snmp->get( pdu, *target, getCallback, 0);

*) and of course the definition of my callback:
void SNMPSession::getCallback(int reason, Snmp* session, Pdu &pdu,
                              SnmpTarget &target, void* callback_data)
 {
     if (reason == SNMP_CLASS_ASYNC_RESPONSE)
     {
         Vb vb;
         pdu.get_vb(vb,0);
         AVLogger->Write(LOG_INFO, "getCallback: just returned: %s - %s",
                         vb.get_printable_oid(),  vb.get_printable_value());
//         retvar = vb.get_printable_value();
//         displayedVar = vb.get_printable_value();

         if ((vb.get_syntax() == sNMP_SYNTAX_ENDOFMIBVIEW) ||
             (vb.get_syntax() == sNMP_SYNTAX_NOSUCHINSTANCE) ||
             (vb.get_syntax() == sNMP_SYNTAX_NOSUCHOBJECT))
             AVLogger->Write(LOG_WARNING, "SNMPSession: SNMP++ 
Exception: %s occured",
                             vb.get_syntax());
     }
 }


As i can interpret from the error msg << error: no matching function for 
call to `Snmp::get(Pdu&, SnmpTarget&, <unresolved overloaded function 
type>, int)' >> i made a mistake with the typedef or definition?

Hope sb can help me. It's very important for me to fix that.

Thx in advance.
Rgds,
 Manuel



More information about the AGENTPP mailing list