Пример #1
0
/** Initializes the schedConf module */
void
init_schedConf(void)
{
    DEBUGMSGTL(("disman:schedule:init", "Initializing config module\n"));
    init_schedule_container();

    /*
     * Register public configuration directives
     */
    snmpd_register_config_handler("repeat", parse_sched_periodic, NULL,
                                  "repeat period  OID = value");
    snmpd_register_config_handler("cron",   parse_sched_timed,    NULL,
                                  "cron * * * * * OID = value");
    snmpd_register_config_handler("at",     parse_sched_timed,    NULL,
                                  "at   * * * * * OID = value");

    /*
     * Register internal configuration directive,
     *   and arrange for dynamically configured entries to be saved
     */
    snmpd_register_config_handler("_schedTable", parse_schedTable, NULL, NULL);
    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
                                     store_schedTable, NULL);
    schedEntries = 0;
}
Пример #2
0
/** Initializes the schedTable module */
void
init_schedTable(void)
{
    static oid      schedTable_oid[] = { 1, 3, 6, 1, 2, 1, 63, 1, 2 };
    size_t          schedTable_oid_len = OID_LENGTH(schedTable_oid);
    netsnmp_handler_registration    *reg;
    netsnmp_table_registration_info *table_info;

    DEBUGMSGTL(("disman:schedule:init", "Initializing table\n"));
    /*
     * Ensure the schedule table container is available...
     */
    init_schedule_container();

    /*
     * ... then set up the MIB interface.
     */
    reg = netsnmp_create_handler_registration("schedTable",
                                            schedTable_handler,
                                            schedTable_oid,
                                            schedTable_oid_len,
                                            HANDLER_CAN_RWRITE);

    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
    netsnmp_table_helper_add_indexes(table_info,
                                     ASN_OCTET_STR,  /* index: schedOwner */
                                     ASN_OCTET_STR,  /* index: schedName  */
                                     0);
    table_info->min_column = COLUMN_SCHEDDESCR;
    table_info->max_column = COLUMN_SCHEDTRIGGERS;

    netsnmp_tdata_register(reg, schedule_table, table_info);
}