I wanted to register my handler for incoming requests in case they have a
context. For that i put some code in the netsnmp_agent_check_parse (as
suggested by dave).

This is what i did

if(pdu->contextName)
            {
                snmp_log(LOG_DEBUG,"received request directed to %s
contextlen=%d\n",
                 pdu->contextName,pdu->contextNameLen);
                dhandler= netsnmp_create_handler_registration(c_oid,
                      d_process_request,var_ptr->name,
                    var_ptr->name_length,HANDLER_CAN_RWRITE);
                dhandler->contextName=strdup(pdu->contextName);
                netsnmp_register_handler(dhandler);
            }

Now the problem is with some contexts i do not get the context name which i
had supplied in snmp log file. Moreover my handler is never called for these
cases. But for other contexts it does get registered and shows up properly
in snmp log.
For example if the context name is localhost or localhost1, i do see
localhost( or localhost1) in the log and my handler is called whereas when i
supply "main" as a context i see an entry like main*&!@ (some special
characters) in the log file and my handler is also not called for that
request.
I cannot figure out the reason for this behaviour. Why arent some contexts
not being displayed properly in snmpd log.

regards

Devvrat
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to