HI,

  I could successfully register the context in snmpd with prefix and "" as
context.
I could register one context this way, but failing for the other, below is
the code snippet

    DEBUGMSGTL(("dot1qBase",
                "Initializing dot1qVlanVersionNumber scalar integer.
Default value = %d\n",
                dot1qVlanVersionNumber));
dot1qVlanVersionNumber = 2;
    reg = netsnmp_create_handler_registration(
             "dot1qVlanVersionNumber", NULL,
              dot1qVlanVersionNumber_oid,
OID_LENGTH(dot1qVlanVersionNumber_oid),
             HANDLER_CAN_RONLY);
    reg->contextName = strdup("cec");
    DEBUGMSGTL(("dot1qBase","/reg->contextName %s\n",reg->contextName));
/*    //reg->contextName = strdup("cec*");*/
    winfo = netsnmp_create_watcher_info(
                &dot1qVlanVersionNumber, sizeof(long),
                 ASN_INTEGER, WATCHER_FIXED_SIZE);
    if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
        snmp_log( LOG_ERR, "Failed to register watched
dot1qVlanVersionNumber" );
    }

This worked successfully.
snmpget -v 3 -n 'cec' -l authPriv -u myuser -A my_password localhost  -l
authNoPriv Q-BRIDGE-MIB::dot1qVlanVersionNumber.0
Q-BRIDGE-MIB::dot1qVlanVersionNumber.0 = INTEGER: 3

Below registration fails.

    reg1 = netsnmp_create_handler_registration(
             "dot1qVlanVersionNumber", NULL,
              dot1qVlanVersionNumber_oid,
OID_LENGTH(dot1qVlanVersionNumber_oid),
             HANDLER_CAN_RONLY);
    reg1->contextName = strdup("cec1");
    dot1qVlanVersionNumber = 3;

    winfo = netsnmp_create_watcher_info(
                &dot1qVlanVersionNumber, sizeof(long),
                 ASN_INTEGER, WATCHER_FIXED_SIZE);
    if (netsnmp_register_watched_scalar( reg1, winfo1 ) < 0 ) {
        snmp_log( LOG_ERR, "Failed to register watched
dot1qVlanVersionNumber" );
    }

Am I missing something?
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to