📄 expobjecttable.c
字号:
intwrite_expObjectID(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 oid *tmpvar; struct expObjectTable_data *StorageTmp = NULL; static size_t tmplen; size_t newlen = name_len - (sizeof(expObjectTable_variables_oid) / sizeof(oid) + 3 - 1); DEBUGMSGTL(("expObjectTable", "write_expObjectID entering action=%d... \n", action)); if ((StorageTmp = header_complex(expObjectTableStorage, NULL, &name[sizeof(expObjectTable_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_OBJECT_ID) { snmp_log(LOG_ERR, "write to expObjectID not ASN_OBJECT_ID\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 objid 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->expObjectID; tmplen = StorageTmp->expObjectIDLen; memdup((u_char **) & StorageTmp->expObjectID, var_val, var_val_len); StorageTmp->expObjectIDLen = var_val_len / sizeof(oid); break; case UNDO: /* * Back out any changes made in the ACTION case */ SNMP_FREE(StorageTmp->expObjectID); StorageTmp->expObjectID = tmpvar; StorageTmp->expObjectIDLen = 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! */ /* * XXX: if the valueID has actually changed, shouldn't we dump any * previous values, as these are from a different object? */ SNMP_FREE(tmpvar); break; } return SNMP_ERR_NOERROR;}intwrite_expObjectIDWildcard(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 int tmpvar; struct expObjectTable_data *StorageTmp = NULL; size_t newlen = name_len - (sizeof(expObjectTable_variables_oid) / sizeof(oid) + 3 - 1); DEBUGMSGTL(("expObjectTable", "write_expObjectIDWildcard entering action=%d... \n", action)); if ((StorageTmp = header_complex(expObjectTableStorage, NULL, &name[sizeof(expObjectTable_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_INTEGER) { snmp_log(LOG_ERR, "write to expObjectIDWildcard not ASN_INTEGER\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 long_ret 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->expObjectIDWildcard; StorageTmp->expObjectIDWildcard = *((long *) var_val); break; case UNDO: /* * Back out any changes made in the ACTION case */ StorageTmp->expObjectIDWildcard = tmpvar; 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! */ break; } return SNMP_ERR_NOERROR;}intwrite_expObjectSampleType(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 int tmpvar; struct expObjectTable_data *StorageTmp = NULL; size_t newlen = name_len - (sizeof(expObjectTable_variables_oid) / sizeof(oid) + 3 - 1); DEBUGMSGTL(("expObjectTable", "write_expObjectSampleType entering action=%d... \n", action)); if ((StorageTmp = header_complex(expObjectTableStorage, NULL, &name[sizeof(expObjectTable_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_INTEGER) { snmp_log(LOG_ERR, "write to expObjectSampleTypenot ASN_INTEGER\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 long_ret 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->expObjectSampleType; StorageTmp->expObjectSampleType = *((long *) var_val); break; case UNDO: /* * Back out any changes made in the ACTION case */ StorageTmp->expObjectSampleType = tmpvar; 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! */ break; } return SNMP_ERR_NOERROR;}intwrite_expObjectDeltaDiscontinuityID(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 oid *tmpvar; struct expObjectTable_data *StorageTmp = NULL; static size_t tmplen; size_t newlen = name_len - (sizeof(expObjectTable_variables_oid) / sizeof(oid) + 3 - 1); DEBUGMSGTL(("expObjectTable", "write_expObjectDeltaDiscontinuityID entering action=%d... \n", action)); if ((StorageTmp = header_complex(expObjectTableStorage, NULL, &name[sizeof(expObjectTable_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_OBJECT_ID) { snmp_log(LOG_ERR, "write to expObjectDeltaDiscontinuityID not ASN_OBJECT_ID\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 objid 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->expObjectDeltaDiscontinuityID; tmplen = StorageTmp->expObjectDeltaDiscontinuityIDLen; memdup((u_char **) & StorageTmp->expObjectDeltaDiscontinuityID, var_val, var_val_len); StorageTmp->expObjectDeltaDiscontinuityIDLen = var_val_len / sizeof(oid); break; case UNDO: /* * Back out any changes made in the ACTION case */ SNMP_FREE(StorageTmp->expObjectDeltaDiscontinuityID); StorageTmp->expObjectDeltaDiscontinuityID = tmpvar; StorageTmp->expObjectDeltaDiscontinuityIDLen = 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! */ /* * XXX: if the valueID has actually changed, shouldn't we dump any * previous values, as these are from a different object? */ SNMP_FREE(tmpvar); break; } return SNMP_ERR_NOERROR;}intwrite_expObjectDiscontinuityIDWildcard(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 int tmpvar; struct expObjectTable_data *StorageTmp = NULL; size_t newlen = name_len - (sizeof(expObjectTable_variables_oid) / sizeof(oid) + 3 - 1); DEBUGMSGTL(("expObjectTable", "write_expObjectDiscontinuityIDWildcard entering action=%d... \n", action)); if ((StorageTmp = header_complex(expObjectTableStorage, NULL, &name[sizeof(expObjectTable_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_INTEGER) { snmp_log(LOG_ERR, "write to expObjectDiscontinuityIDWildcard not ASN_INTEGER\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 long_ret 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->expObjectDiscontinuityIDWildcard; StorageTmp->expObjectDiscontinuityIDWildcard = *((long *) var_val); break; case UNDO: /* * Back out any changes made in the ACTION case */ StorageTmp->expObjectDiscontinuityIDWildcard = tmpvar; 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! */ break; } return SNMP_ERR_NOERROR;}intwrite_expObjectDiscontinuityIDType(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 int tmpvar; struct expObjectTable_data *StorageTmp = NULL; size_t newlen = name_len - (sizeof(expObjectTable_variables_oid) / sizeof(oid) + 3 - 1); DEBUGMSGTL(("expObjectTable", "write_expObjectDiscontinuityIDWildcard entering action=%d... \n", action)); if ((StorageTmp = header_complex(expObjectTableStorage, NULL, &name[sizeof(expObjectTable_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_INTEGER) { snmp_log(LOG_ERR, "write to expObjectDiscontinuityIDType not ASN_INTEGER\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 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -