hi,
 
I have a MIB table, i use mib2c to create the c file. I want to customise the processing of the MIB table. Therefore, i have to compare the OID of eacg incoming request and take action respectively.
 
How should i compare the OID in callback handler??
 
i can't figure out.
 
if (requests->requestvb->name == .......)  /*??? what should be here*/
 
int
dot11PhyTable_handler(netsnmp_mib_handler *handler,
                                netsnmp_handler_registration *reginfo,
                                netsnmp_agent_request_info *reqinfo,
                                netsnmp_request_info *requests)
{
    u_long * curChannel_cache = NULL;
    int channel;
 
printf("[cb handler] channel %d\n",channel);
    /*
     * perform anything here that you need to do.  The requests have
     * already been processed by the master table_dataset handler, but
     * this gives you chance to act on the request in some other way
     * if need be.
     */
 
printf("Oid is %s\n", requests->requestvb->name);
printf("Oid length is %d\n", (requests->requestvb->name_length));
 
    switch (reqinfo->mode) {
        /*
         * registering as an instance means we don't need to deal with
         * getnext processing, so we don't handle it here at all.
         *
         * However, since the instance handler already reset the mode
         * back to GETNEXT from the faked GET mode, we need to do the
         * same thing in both cases.  This should be fixed in future
         * versions of net-snmp hopefully.
         */
    case MODE_GET:
    case MODE_GETNEXT:
        /*
         * return the curren value
         */
        snmp_set_var_typed_value(requests->requestvb,
                                 ASN_INTEGER,
                                 (u_char *) &channel,
                                 sizeof(channel));
        break;
 
    case MODE_SET_ACTION:
        /*
         * update current value
         */
        channel = *(requests->requestvb->val.integer);
printf("[cb handler] updated channel is %d\n", channel);
        break;
 
    default:
        break;
    }
    return SNMP_ERR_NOERROR;
}

Reply via email to