Beispiel #1
0
/**********************************************************************
 **********************************************************************
 *                                                                    *
 *                                                                    *
 * netsnmp_table_array_helper_handler()                               *
 *                                                                    *
 *                                                                    *
 **********************************************************************
 **********************************************************************/
int
netsnmp_table_array_helper_handler (netsnmp_mib_handler * handler,
                                    netsnmp_handler_registration * reginfo,
                                    netsnmp_agent_request_info * agtreq_info, netsnmp_request_info * requests)
{

    /*
     * First off, get our pointer from the handler. This
     * lets us get to the table registration information we
     * saved in get_table_array_handler(), as well as the
     * container where the actual table data is stored.
     */
    int rc = SNMP_ERR_NOERROR;

    table_container_data *tad = (table_container_data *) handler->myvoid;

    if (agtreq_info->mode < 0 || agtreq_info->mode > 5)
    {
        DEBUGMSGTL (("table_array", "Mode %d, Got request:\n", agtreq_info->mode));
    }
    else
    {
        DEBUGMSGTL (("table_array", "Mode %s, Got request:\n", mode_name[agtreq_info->mode]));
    }

#ifndef NETSNMP_NO_WRITE_SUPPORT
    if (MODE_IS_SET (agtreq_info->mode))
    {
        /*
         * netsnmp_mutex_lock(&tad->lock);
         */
        rc = process_set_requests (agtreq_info, requests, tad, handler->handler_name);
        /*
         * netsnmp_mutex_unlock(&tad->lock);
         */
    }
    else
#endif                            /* NETSNMP_NO_WRITE_SUPPORT */
        rc = process_get_requests (reginfo, agtreq_info, requests, tad);

    if (rc != SNMP_ERR_NOERROR)
    {
        DEBUGMSGTL (("table_array", "processing returned rc %d\n", rc));
    }

    /*
     * Now we've done our processing. If there is another handler below us,
     * call them.
     */
    if (handler->next)
    {
        rc = netsnmp_call_next_handler (handler, reginfo, agtreq_info, requests);
        if (rc != SNMP_ERR_NOERROR)
        {
            DEBUGMSGTL (("table_array", "next handler returned rc %d\n", rc));
        }
    }

    return rc;
}
#ifndef NETSNMP_NO_WRITE_SUPPORT
if (MODE_IS_SET(agtreq_info->mode)) {
        /*
         * netsnmp_mutex_lock(&tad->lock);
         */
        rc = process_set_requests(agtreq_info, requests,
                                  tad, handler->handler_name);
        /*
         * netsnmp_mutex_unlock(&tad->lock);
         */
    } else
#endif /* NETSNMP_NO_WRITE_SUPPORT */
        rc = process_get_requests(reginfo, agtreq_info, requests, tad);