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

📄 mtetriggerthresholdtable.c

📁 开发snmp的开发包有两个开放的SNMP开发库
💻 C
📖 第 1 页 / 共 4 页
字号:
         */        tmpvar = StorageTmp->mteTriggerThresholdFallingEvent;        tmplen = StorageTmp->mteTriggerThresholdFallingEventLen;        memdup((u_char **) & StorageTmp->mteTriggerThresholdFallingEvent,               var_val, var_val_len);        StorageTmp->mteTriggerThresholdFallingEventLen = var_val_len;        break;    case UNDO:        /*         * Back out any changes made in the ACTION case          */        SNMP_FREE(StorageTmp->mteTriggerThresholdFallingEvent);        StorageTmp->mteTriggerThresholdFallingEvent = tmpvar;        StorageTmp->mteTriggerThresholdFallingEventLen = tmplen;        break;    case COMMIT:        /*         * Things are working well, so it's now safe to make the change         * permanently.  Make sure that anything done here can't fail!          */        SNMP_FREE(tmpvar);        break;    }    return SNMP_ERR_NOERROR;}intwrite_mteTriggerThresholdDeltaRisingEventOwner(int action,                                               u_char * var_val,                                               u_char var_val_type,                                               size_t var_val_len,                                               u_char * statP,                                               oid * name, size_t name_len){    static char    *tmpvar;    struct mteTriggerTable_data *StorageTmp = NULL;    static size_t   tmplen;    size_t          newlen =        name_len -        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -         1);    DEBUGMSGTL(("mteTriggerThresholdTable",                "write_mteTriggerThresholdDeltaRisingEventOwner entering action=%d...  \n",                action));    if ((StorageTmp =         header_complex(mteTriggerTableStorage, NULL,                        &name[sizeof                              (mteTriggerThresholdTable_variables_oid) /                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,                        NULL)) == NULL)        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */    switch (action) {    case RESERVE1:        if (var_val_type != ASN_OCTET_STR) {            fprintf(stderr,                    "write to mteTriggerThresholdDeltaRisingEventOwner not ASN_OCTET_STR\n");            return SNMP_ERR_WRONGTYPE;        }        if (StorageTmp->storageType != ST_NONVOLATILE)            return SNMP_ERR_NOTWRITABLE;        break;    case RESERVE2:        /*         * memory reseveration, final preparation...          */        break;    case FREE:        /*         * Release any resources that have been allocated          */        break;    case ACTION:        /*         * The variable has been stored in string for         * you to use, and you have just been asked to do something with         * it.  Note that anything done here must be reversable in the UNDO case          */        tmpvar = StorageTmp->mteTriggerThresholdDeltaRisingEventOwner;        tmplen = StorageTmp->mteTriggerThresholdDeltaRisingEventOwnerLen;        memdup((u_char **) & StorageTmp->               mteTriggerThresholdDeltaRisingEventOwner, var_val,               var_val_len);        StorageTmp->mteTriggerThresholdDeltaRisingEventOwnerLen =            var_val_len;        break;    case UNDO:        /*         * Back out any changes made in the ACTION case          */        SNMP_FREE(StorageTmp->mteTriggerThresholdDeltaRisingEventOwner);        StorageTmp->mteTriggerThresholdDeltaRisingEventOwner = tmpvar;        StorageTmp->mteTriggerThresholdDeltaRisingEventOwnerLen = tmplen;        break;    case COMMIT:        /*         * Things are working well, so it's now safe to make the change         * permanently.  Make sure that anything done here can't fail!          */        SNMP_FREE(tmpvar);        break;    }    return SNMP_ERR_NOERROR;}intwrite_mteTriggerThresholdDeltaRisingEvent(int action,                                          u_char * var_val,                                          u_char var_val_type,                                          size_t var_val_len,                                          u_char * statP,                                          oid * name, size_t name_len){    static char    *tmpvar;    struct mteTriggerTable_data *StorageTmp = NULL;    static size_t   tmplen;    size_t          newlen =        name_len -        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -         1);    DEBUGMSGTL(("mteTriggerThresholdTable",                "write_mteTriggerThresholdDeltaRisingEvent entering action=%d...  \n",                action));    if ((StorageTmp =         header_complex(mteTriggerTableStorage, NULL,                        &name[sizeof                              (mteTriggerThresholdTable_variables_oid) /                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,                        NULL)) == NULL)        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */    switch (action) {    case RESERVE1:        if (var_val_type != ASN_OCTET_STR) {            fprintf(stderr,                    "write to mteTriggerThresholdDeltaRisingEvent not ASN_OCTET_STR\n");            return SNMP_ERR_WRONGTYPE;        }        if (StorageTmp->storageType != ST_NONVOLATILE)            return SNMP_ERR_NOTWRITABLE;        break;    case RESERVE2:        /*         * memory reseveration, final preparation...          */        break;    case FREE:        /*         * Release any resources that have been allocated          */        break;    case ACTION:        /*         * The variable has been stored in string for         * you to use, and you have just been asked to do something with         * it.  Note that anything done here must be reversable in the UNDO case          */        tmpvar = StorageTmp->mteTriggerThresholdDeltaRisingEvent;        tmplen = StorageTmp->mteTriggerThresholdDeltaRisingEventLen;        memdup((u_char **) & StorageTmp->               mteTriggerThresholdDeltaRisingEvent, var_val, var_val_len);        StorageTmp->mteTriggerThresholdDeltaRisingEventLen = var_val_len;        break;    case UNDO:        /*         * Back out any changes made in the ACTION case          */        SNMP_FREE(StorageTmp->mteTriggerThresholdDeltaRisingEvent);        StorageTmp->mteTriggerThresholdDeltaRisingEvent = tmpvar;        StorageTmp->mteTriggerThresholdDeltaRisingEventLen = tmplen;        break;    case COMMIT:        /*         * Things are working well, so it's now safe to make the change         * permanently.  Make sure that anything done here can't fail!          */        SNMP_FREE(tmpvar);        break;    }    return SNMP_ERR_NOERROR;}intwrite_mteTriggerThresholdDeltaFallingEventOwner(int action,                                                u_char * var_val,                                                u_char var_val_type,                                                size_t var_val_len,                                                u_char * statP,                                                oid * name,                                                size_t name_len){    static char    *tmpvar;    struct mteTriggerTable_data *StorageTmp = NULL;    static size_t   tmplen;    size_t          newlen =        name_len -        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -         1);    DEBUGMSGTL(("mteTriggerThresholdTable",                "write_mteTriggerThresholdDeltaFallingEventOwner entering action=%d...  \n",                action));    if ((StorageTmp =         header_complex(mteTriggerTableStorage, NULL,                        &name[sizeof                              (mteTriggerThresholdTable_variables_oid) /                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,                        NULL)) == NULL)        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */    switch (action) {    case RESERVE1:        if (var_val_type != ASN_OCTET_STR) {            fprintf(stderr,                    "write to mteTriggerThresholdDeltaFallingEventOwner not ASN_OCTET_STR\n");            return SNMP_ERR_WRONGTYPE;        }        if (StorageTmp->storageType != ST_NONVOLATILE)            return SNMP_ERR_NOTWRITABLE;        break;    case RESERVE2:        /*         * memory reseveration, final preparation...          */        break;    case FREE:        /*         * Release any resources that have been allocated          */        break;    case ACTION:        /*         * The variable has been stored in string for         * you to use, and you have just been asked to do something with         * it.  Note that anything done here must be reversable in the UNDO case          */        tmpvar = StorageTmp->mteTriggerThresholdDeltaFallingEventOwner;        tmplen = StorageTmp->mteTriggerThresholdDeltaFallingEventOwnerLen;        memdup((u_char **) & StorageTmp->               mteTriggerThresholdDeltaFallingEventOwner, var_val,               var_val_len);        StorageTmp->mteTriggerThresholdDeltaFallingEventOwnerLen =            var_val_len;        break;    case UNDO:        /*         * Back out any changes made in the ACTION case          */        SNMP_FREE(StorageTmp->mteTriggerThresholdDeltaFallingEventOwner);        StorageTmp->mteTriggerThresholdDeltaFallingEventOwner = tmpvar;        StorageTmp->mteTriggerThresholdDeltaFallingEventOwnerLen = tmplen;        break;    case COMMIT:        /*         * Things are working well, so it's now safe to make the change         * permanently.  Make sure that anything done here can't fail!          */        SNMP_FREE(tmpvar);        break;    }    return SNMP_ERR_NOERROR;}intwrite_mteTriggerThresholdDeltaFallingEvent(int action,                                           u_char * var_val,                                           u_char var_val_type,                                           size_t var_val_len,                                           u_char * statP,                                           oid * name, size_t name_len){    static char    *tmpvar;    struct mteTriggerTable_data *StorageTmp = NULL;    static size_t   tmplen;    size_t          newlen =        name_len -        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -         1);    DEBUGMSGTL(("mteTriggerThresholdTable",                "write_mteTriggerThresholdDeltaFallingEvent entering action=%d...  \n",                action));    if ((StorageTmp =         header_complex(mteTriggerTableStorage, NULL,                        &name[sizeof                              (mteTriggerThresholdTable_variables_oid) /                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,                        NULL)) == NULL)        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */    switch (action) {    case RESERVE1:        if (var_val_type != ASN_OCTET_STR) {            fprintf(stderr,                    "write to mteTriggerThresholdDeltaFallingEvent not ASN_OCTET_STR\n");            return SNMP_ERR_WRONGTYPE;        }        if (StorageTmp->storageType != ST_NONVOLATILE)            return SNMP_ERR_NOTWRITABLE;        break;    case RESERVE2:        /*         * memory reseveration, final preparation...          */        break;    case FREE:        /*         * Release any resources that have been allocated          */        break;    case ACTION:        /*         * The variable has been stored in string for         * you to use, and you have just been asked to do something with         * it.  Note that anything done here must be reversable in the UNDO case          */        tmpvar = StorageTmp->mteTriggerThresholdDeltaFallingEvent;        tmplen = StorageTmp->mteTriggerThresholdDeltaFallingEventLen;        memdup((u_char **) & StorageTmp->               mteTriggerThresholdDeltaFallingEvent, var_val, var_val_len);        StorageTmp->mteTriggerThresholdDeltaFallingEventLen = var_val_len;        break;    case UNDO:        /*         * Back out any changes made in the ACTION case          */        SNMP_FREE(StorageTmp->mteTriggerThresholdDeltaFallingEvent);        StorageTmp->mteTriggerThresholdDeltaFallingEvent = tmpvar;        StorageTmp->mteTriggerThresholdDeltaFallingEventLen = tmplen;        break;    case COMMIT:        /*         * Things are working well, so it's now safe to make the change         * permanently.  Make sure that anything done here can't fail!          */        SNMP_FREE(tmpvar);        break;    }    return SNMP_ERR_NOERROR;}

⌨️ 快捷键说明

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