⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mtetriggerconf.c

📁 开发snmp的开发包有两个开放的SNMP开发库
💻 C
📖 第 1 页 / 共 4 页
字号:
     *       definitions in IF-MIB, but will do for now.     */    if (strncmp( line, "yes", 3) == 0) {        DEBUGMSGTL(("disman:event:conf", "Registering linkUpDown traps\n"));        parse_mteMonitor("monitor",            "-r 60 -S -e _linkUp   \"linkUp\"   ifOperStatus != 2");        parse_mteMonitor("monitor",            "-r 60 -S -e _linkDown \"linkDown\" ifOperStatus == 2");    }}voidparse_default_mteMonitors(const char *token, char *line){    if (strncmp( line, "yes", 3) == 0) {        DEBUGMSGTL(("disman:event:conf", "Registering default monitors\n"));        parse_mteMonitor("monitor",            "-o prNames -o prErrMessage   \"process table\" prErrorFlag  != 0");        parse_mteMonitor("monitor",            "-o memErrorName -o memSwapErrorMsg \"memory\"  memSwapError != 0");        parse_mteMonitor("monitor",            "-o extNames -o extOutput     \"extTable\"      extResult    != 0");        parse_mteMonitor("monitor",            "-o dskPath -o dskErrorMsg    \"dskTable\"      dskErrorFlag != 0");        parse_mteMonitor("monitor",            "-o laNames -o laErrMessage   \"laTable\"       laErrorFlag  != 0");        parse_mteMonitor("monitor",            "-o fileName -o fileErrorMsg  \"fileTable\" fileErrorFlag    != 0");        parse_mteMonitor("monitor",            "-o snmperrErrMessage         \"snmperrs\"  snmperrErrorFlag != 0");    }    return;}/* ================================================ * *  Handlers for loading persistent trigger entries * * ================================================ *//*  *  Entries for the main mteTriggerTable */char *_parse_mteTCols( char *line, struct mteTrigger *entry, int bcomp ){    void  *vp;    size_t tmp;    size_t len;    len  = MTE_STR2_LEN; vp = entry->mteTriggerComment;    line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);    if ( bcomp ) {        /*         * The newer style of config directive skips the         *   mteTriggerTest and mteTriggerSampleType values,         *   as these are set implicitly from the relevant         *   config directives.         * Backwards compatability with the previous (combined)          *   style reads these in explicitly.         */        len  = 1;        vp   = &entry->mteTriggerTest;        line = read_config_read_data(ASN_OCTET_STR, line, &vp,  &len);        line = read_config_read_data(ASN_UNSIGNED,  line, &tmp, NULL);        if (tmp == 2)            entry->flags |= MTE_TRIGGER_FLAG_DELTA;    }    vp   = entry->mteTriggerValueID;    entry->mteTriggerValueID_len = MAX_OID_LEN;    line = read_config_read_data(ASN_OBJECT_ID, line, &vp,                                &entry->mteTriggerValueID_len);    if (bcomp) {        /*         * The newer style combines the various boolean values         *   into a single field (which comes later).         * Backwards compatability means reading these individually.          */        line = read_config_read_data(ASN_UNSIGNED,  line, &tmp, NULL);        if (tmp == TV_TRUE)            entry->flags |= MTE_TRIGGER_FLAG_VWILD;    }    len  = MTE_STR2_LEN; vp = entry->mteTriggerTarget;    line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);    len  = MTE_STR2_LEN; vp = entry->mteTriggerContext;    line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);    if (bcomp) {        line = read_config_read_data(ASN_UNSIGNED,  line, &tmp, NULL);        if (tmp == TV_TRUE)            entry->flags |= MTE_TRIGGER_FLAG_CWILD;    }    line = read_config_read_data(ASN_UNSIGNED,  line,                                &entry->mteTriggerFrequency, NULL);    len  = MTE_STR1_LEN; vp = entry->mteTriggerOOwner;    line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);    len  = MTE_STR1_LEN; vp = entry->mteTriggerObjects;    line = read_config_read_data(ASN_OCTET_STR, line, &vp,  &len);    /*     * Assorted boolean flag values, combined into a single field     */    if (bcomp) {        /*         * Backwards compatability stores the mteTriggerEnabled         *   and mteTriggerEntryStatus values separately...         */        line = read_config_read_data(ASN_UNSIGNED,  line, &tmp, NULL);        if (tmp == TV_TRUE)            entry->flags |= MTE_TRIGGER_FLAG_ENABLED;        line = read_config_read_data(ASN_UNSIGNED,  line, &tmp, NULL);        if (tmp == RS_ACTIVE)            entry->flags |= MTE_TRIGGER_FLAG_ACTIVE;    } else {        /*         * ... while the newer style combines all the assorted         *       boolean values into this single field.         */        line = read_config_read_data(ASN_UNSIGNED,  line, &tmp, NULL);        entry->flags |= ( tmp &            (MTE_TRIGGER_FLAG_VWILD  |MTE_TRIGGER_FLAG_CWILD|             MTE_TRIGGER_FLAG_ENABLED|MTE_TRIGGER_FLAG_ACTIVE));    }    return line;}voidparse_mteTTable(const char *token, char *line){    char   owner[MTE_STR1_LEN+1];    char   tname[MTE_STR1_LEN+1];    void  *vp;    size_t len;    struct mteTrigger *entry;    DEBUGMSGTL(("disman:event:conf", "Parsing mteTriggerTable config...\n"));    /*     * Read in the index information for this entry     *  and create a (non-fixed) data structure for it.     */    memset( owner, 0, sizeof(owner));    memset( tname, 0, sizeof(tname));    len   = MTE_STR1_LEN; vp = owner;    line  = read_config_read_data(ASN_OCTET_STR, line, &vp,  &len);    len   = MTE_STR1_LEN; vp = tname;    line  = read_config_read_data(ASN_OCTET_STR, line, &vp,  &len);    entry = _find_mteTrigger_entry( owner, tname );    DEBUGMSG(("disman:event:conf", "(%s, %s) ", owner, tname));        /*     * Read in the accessible (trigger-independent) column values.     */    line = _parse_mteTCols( line, entry, 0 );    /*     * XXX - Will need to read in the 'iquery' access information     */    entry->flags |= MTE_TRIGGER_FLAG_VALID;    DEBUGMSG(("disman:event:conf", "\n"));}/*  *  Entries from the mteTriggerDeltaTable */char *_parse_mteTDCols( char *line, struct mteTrigger *entry, int bcomp ){    void  *vp;    size_t tmp;    entry->mteDeltaDiscontID_len = MAX_OID_LEN;    vp   = entry->mteDeltaDiscontID;    line = read_config_read_data(ASN_OBJECT_ID, line, &vp,                                &entry->mteDeltaDiscontID_len);    line = read_config_read_data(ASN_UNSIGNED,  line, &tmp, NULL);    if (bcomp) {        if ( tmp == TV_TRUE )            entry->flags |= MTE_TRIGGER_FLAG_DWILD;    } else {        if ( tmp & MTE_TRIGGER_FLAG_DWILD )            entry->flags |= MTE_TRIGGER_FLAG_DWILD;    }    line = read_config_read_data(ASN_UNSIGNED,  line,                                &entry->mteDeltaDiscontIDType, NULL);    return line;}voidparse_mteTDTable(const char *token, char *line){    char   owner[MTE_STR1_LEN+1];    char   tname[MTE_STR1_LEN+1];    void  *vp;    size_t len;    struct mteTrigger *entry;    DEBUGMSGTL(("disman:event:conf", "Parsing mteTriggerDeltaTable config... "));    /*     * Read in the index information for this entry     *  and create a (non-fixed) data structure for it.     */    memset( owner, 0, sizeof(owner));    memset( tname, 0, sizeof(tname));    len   = MTE_STR1_LEN; vp = owner;    line  = read_config_read_data(ASN_OCTET_STR, line, &vp,  &len);    len   = MTE_STR1_LEN; vp = tname;    line  = read_config_read_data(ASN_OCTET_STR, line, &vp,  &len);    entry = _find_mteTrigger_entry( owner, tname );    DEBUGMSG(("disman:event:conf", "(%s, %s) ", owner, tname));        /*     * Read in the accessible column values.     */    line = _parse_mteTDCols( line, entry, 0 );    entry->flags |= (MTE_TRIGGER_FLAG_DELTA|                     MTE_TRIGGER_FLAG_VALID);    DEBUGMSG(("disman:event:conf", "\n"));}/*  *  Entries from the mteTriggerExistenceTable */char *_parse_mteTExCols( char *line, struct mteTrigger *entry, int bcomp ){    void  *vp;    size_t tmp;    size_t len;    if (bcomp) {        len  = 1;        vp   = &entry->mteTExTest;        line = read_config_read_data(ASN_OCTET_STR,  line, &vp, &len);        len  = 1;        vp   = &entry->mteTExStartup;        line = read_config_read_data(ASN_OCTET_STR,  line, &vp, &len);    } else {        line  = read_config_read_data(ASN_UNSIGNED,  line, &tmp, NULL);        entry->mteTExStartup = ( tmp & 0xff ); tmp >>= 8;        entry->mteTExTest    = ( tmp & 0xff );    }    len  = MTE_STR1_LEN; vp = entry->mteTExObjOwner;    line = read_config_read_data(ASN_OCTET_STR, line, &vp,  &len);    len  = MTE_STR1_LEN; vp = entry->mteTExObjects;    line = read_config_read_data(ASN_OCTET_STR, line, &vp,  &len);    len  = MTE_STR1_LEN; vp = entry->mteTExEvOwner;    line = read_config_read_data(ASN_OCTET_STR, line, &vp,  &len);    len  = MTE_STR1_LEN; vp = entry->mteTExEvent;    line = read_config_read_data(ASN_OCTET_STR, line, &vp,  &len);    return line;}voidparse_mteTExTable(const char *token, char *line){    char   owner[MTE_STR1_LEN+1];    char   tname[MTE_STR1_LEN+1];    void  *vp;    size_t len;    struct mteTrigger *entry;    DEBUGMSGTL(("disman:event:conf", "Parsing mteTriggerExistenceTable config...  "));    /*     * Read in the index information for this entry     *  and create a (non-fixed) data structure for it.     */    memset( owner, 0, sizeof(owner));    memset( tname, 0, sizeof(tname));    len   = MTE_STR1_LEN; vp = owner;    line  = read_config_read_data(ASN_OCTET_STR, line, &vp,  &len);    len   = MTE_STR1_LEN; vp = tname;    line  = read_config_read_data(ASN_OCTET_STR, line, &vp,  &len);    entry = _find_mteTrigger_entry( owner, tname );    DEBUGMSG(("disman:event:conf", "(%s, %s) ", owner, tname));        /*     * Read in the accessible column values.     *  (Note that the first two are combined into a single field)     */    line = _parse_mteTExCols( line, entry, 0 );    entry->mteTriggerTest |= MTE_TRIGGER_EXISTENCE;    entry->flags          |= MTE_TRIGGER_FLAG_VALID;    DEBUGMSG(("disman:event:conf", "\n"));}/*  *  Entries from the mteTriggerBooleanTable */char *_parse_mteTBlCols( char *line, struct mteTrigger *entry, int bcomp ){    void  *vp;    size_t tmp;    size_t len;    if (bcomp) {        line = read_config_read_data(ASN_UNSIGNED,  line,                                    &entry->mteTBoolComparison, NULL);        line = read_config_read_data(ASN_INTEGER,   line,                                    &entry->mteTBoolValue, NULL);        line = read_config_read_data(ASN_UNSIGNED,  line, &tmp, NULL);        if (tmp == TV_TRUE)            entry->flags |= MTE_TRIGGER_FLAG_BSTART;    } else {        line = read_config_read_data(ASN_UNSIGNED,  line, &tmp, NULL);        entry->mteTBoolComparison = ( tmp & 0x0f );        entry->flags             |= ( tmp & MTE_TRIGGER_FLAG_BSTART );        line = read_config_read_data(ASN_INTEGER,   line,                                    &entry->mteTBoolValue, NULL);    }    len  = MTE_STR1_LEN; vp = entry->mteTBoolObjOwner;    line = read_config_read_data(ASN_OCTET_STR, line, &vp,  &len);    len  = MTE_STR1_LEN; vp = entry->mteTBoolObjects;    line = read_config_read_data(ASN_OCTET_STR, line, &vp,  &len);    len  = MTE_STR1_LEN; vp = entry->mteTBoolEvOwner;    line = read_config_read_data(ASN_OCTET_STR, line, &vp,  &len);    len  = MTE_STR1_LEN; vp = entry->mteTBoolEvent;    line = read_config_read_data(ASN_OCTET_STR, line, &vp,  &len);    return line;}voidparse_mteTBlTable(const char *token, char *line){    char   owner[MTE_STR1_LEN+1];    char   tname[MTE_STR1_LEN+1];    void  *vp;    size_t len;    struct mteTrigger *entry;    DEBUGMSGTL(("disman:event:conf", "Parsing mteTriggerBooleanTable config...  "));    /*     * Read in the index information for this entry     *  and create a (non-fixed) data structure for it.     */    memset( owner, 0, sizeof(owner));    memset( tname, 0, sizeof(tname));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -