I am having a problem implementing a table with a settable column.  I have
the table handler and creation in the following code snippet:

int BaseTableHandler(
    netsnmp_mib_handler *handler,
    netsnmp_handler_registration *reginfo,
    netsnmp_agent_request_info *reqinfo,
    netsnmp_request_info *requests)
{
    int err_code = SNMP_ERR_NOERROR;
    netsnmp_request_info *request;
    netsnmp_variable_list *requestvb;
    int row, col;

    for (request = requests; request; request = request->next)
    {
        requestvb = request->requestvb;

        row = RowFromOid(requestvb->name, requestvb->name_length);
        col = ColFromOid(requestvb->name, requestvb->name_length);

        if (!request->processed)
        {
            char buf[256];
            int thresh;

            GetBaseColumnData(&ipmn_data->base[row], col, buf);
            switch (reqinfo->mode)
            {
                case MODE_GET:
                case MODE_GETNEXT:
                    if (col > E_BS_INDEX && col <= E_BS_TIME)
                    {
                        snmp_set_var_typed_value(requestvb, ASN_OCTET_STR,
(u_char *)buf, strlen(buf));
                    }
                    else
                    {
                        int i = atoi(buf);
                        snmp_set_var_typed_value(requestvb, ASN_INTEGER,
(u_char *)&i, sizeof(i));
                    }
                    break;

                case MODE_SET_RESERVE1:
                    thresh = *requestvb->val.integer;
                    SetBaseNoiseThreshhold(row, thresh, reqinfo->mode);
                    break;

                case MODE_SET_RESERVE2:
                    thresh = *requestvb->val.integer;
                    SetBaseNoiseThreshhold(row, thresh, reqinfo->mode);
                    break;

                case MODE_SET_ACTION:
                    thresh = *requestvb->val.integer;
                    SetBaseNoiseThreshhold(row, thresh, reqinfo->mode);
                    break;

                case MODE_SET_UNDO:
                    thresh = *requestvb->val.integer;
                    SetBaseNoiseThreshhold(row, thresh, reqinfo->mode);
                    break;

                case MODE_SET_COMMIT:
                    break;

                case MODE_SET_FREE:
                    break;

                default:
                    printf("MODE %d\n", reqinfo->mode);
                    netsnmp_set_request_error(reqinfo, requests,
SNMP_ERR_READONLY);
                    err_code = SNMP_ERR_READONLY;
                    break;
            }
        }
    }
    return err_code;
}


void init_base_mib()
{
    static oid BaseTableOid[] = {1, 3, 6, 1, 4, 1, 14055, 1, 1, 1, 3, 4};
    netsnmp_handler_registration *hReg;
    pthread_t tid;

    // create the table struct itself
    bsTableSet = netsnmp_create_table_data_set("basestationTable");

    // comment out or remove this line if no support for creation of rows
    bsTableSet->allow_creation = 1;

    // add the index
    netsnmp_table_set_add_indexes(bsTableSet, ASN_INTEGER, 0);

    // create the columns
    netsnmp_table_set_multi_add_default_row(
        bsTableSet,

        // column data....
        E_BS_INDEX,            ASN_INTEGER,   0, NULL, 0,
        E_BS_RFADDR,           ASN_OCTET_STR, 0, NULL, 0,
        E_BS_TUNADDR,          ASN_OCTET_STR, 0, NULL, 0,
        E_BS_IPADDR,           ASN_OCTET_STR, 0, NULL, 0,
        E_BS_IFNAME,           ASN_OCTET_STR, 0, NULL, 0,
        E_BS_DNFREQ,           ASN_OCTET_STR, 0, NULL, 0,
        E_BS_UPFREQ,           ASN_OCTET_STR, 0, NULL, 0,
        E_BS_TIME,             ASN_OCTET_STR, 0, NULL, 0,
        E_BS_UTIL,             ASN_INTEGER,   0, NULL, 0,
        E_BS_NOISE,            ASN_INTEGER,   0, NULL, 0,
        E_BS_NOISE_THRESHHOLD, ASN_INTEGER,   1, NULL, 0,

        // done!
        0
    );

    netsnmp_register_auto_data_table(bsTableSet, NULL);

    hReg = netsnmp_create_handler_registration("basestationhandler",
BaseTableHandler,
        BaseTableOid, OID_LENGTH(BaseTableOid), HANDLER_CAN_RWRITE);
    netsnmp_register_table_data_set(hReg, bsTableSet, NULL);
}

My SNMP management console is sending a set command for the OID
1.3.6.1.4.1.14055.1.1.1.3.4.11.1, to set the value to 99.  NetSNMP is
returning an error: "no such name".  If I understand correctly, this should
be the 11th column of the first row of my table.  The function
BaseTableHandler isn't even being called.  It does get called correctly for
the GET and GETNEXT requests.

Any help would be greatly appreciated

Russell Markus
Sr. Software Engineer
IPMobileNet, Inc.
(949)417-4590 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to