I used the mib2c.mfd to create template files for a MIB table. But when I 
initialized the mib in the subagent code, the table oid was not registered. 

I tried the debug mode, found out that only the following routines were called:
verbose:xxxTable:xxxTable_init_data called
verbose:xxxTable:xxxTable_container_init called

Since I used the template file, and didn't cache the data, I only changed the 
function call xxxTable_container_load to read in the MIB values from the 
memory. 
Here is the code that I modified:

int xxxTable_container_load(netsnmp_container * container)
{
    xxxTable_rowreq_ctx *rowreq_ctx;
    size_t          count = 0;

    /*
     * channelIndex(1)/INTEGER32/ASN_INTEGER/long(long)//l/a/w/e/r/d/h
     */
    long            channelIndex;

    while (1) {
        /*
         * TODO:352:M: |   |-> set indexes in new xxxTable rowreq context.
         */
    
        if (count >= chan_stats.total_channels) 
            break;

        channelIndex = chan_tbl[count].index;

        rowreq_ctx = xxxTable_allocate_rowreq_ctx(NULL);
        if (NULL == rowreq_ctx) {
            snmp_log(LOG_ERR, "memory allocation failed\n");
            return MFD_RESOURCE_UNAVAILABLE;
        }
        if (MFD_SUCCESS !=
            xxxTable_indexes_set(rowreq_ctx, channelIndex)) {
            snmp_log(LOG_ERR,
                     "error setting index while loading "
                     "xxxTable data.\n");
            xxxTable_release_rowreq_ctx(rowreq_ctx);
            continue;
        }

        /*
         * TODO:352:r: |   |-> populate xxxTable data context.
         */
      
        if ((NULL == rowreq_ctx->data.channelName) ||
            (rowreq_ctx->data.channelName_len <
             strlen(chan_tbl[count].chan_name) + 1 )) {
            snmp_log(LOG_ERR, "not enough space for value\n");
            return MFD_ERROR;
        }
        rowreq_ctx->data.channelName_len =  strlen(chan_tbl[count].chan_name) + 
1;
        memcpy(rowreq_ctx->data.channelName, chan_tbl[count].chan_name,
rowreq_ctx->data.channelName_len );
      
        /*
         * insert into table container
         */
        
        CONTAINER_INSERT(container, rowreq_ctx);
        ++count;
    }

    return MFD_SUCCESS;
}                       


Inside the subagent code, I initialized two MIBs:
init_xxxScalars();
init_xxxTable();

I can get all scalars using snmpwalk, but I got the following output using 
"snmpwalk -v2c -c public localhost xxxTable"

xxxTable = No Such Object available on this agent at this OID

Did I miss anything? Why was the MIB table not loaded?   


Thanks
Cindy



_________________________________________________________________
Hotmail® has ever-growing storage! Don’t worry about storage limits. 
http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to