📄 sas_incr.c
字号:
/* * Copyright 2000-2005 Wind River Systems, Inc. * All rights reserved. Provided under license only. * Distribution or other use of this software is only * permitted pursuant to the terms of a license agreement * from Wind River Systems (and is otherwise prohibited). * Refer to that license agreement for terms of use. *//* * Copyright 1995-1997 Epilogue Technology Corporation. * Copyright 1998 Integrated Systems, Inc. * All rights reserved. *//* * $Log: sas_incr.c,v $ * Revision 1.3 2002/11/22 18:54:44 josh * testproc for testAndIncr objects now returns wrongValue error if * value set is out of range for a testAndIncr object * * Revision 1.2 2001/11/06 21:20:26 josh * revised new path hacking * * Revision 1.1.1.1 2001/11/05 17:47:40 tneale * Tornado shuffle * * Revision 9.3 2001/01/19 22:21:58 paul * Update copyright. * * Revision 9.2 2000/03/17 00:17:43 meister * Update copyright message * * Revision 9.1 1999/05/24 20:12:07 josh * 'compc' and 'compl' have been replaced by 'tcount' and 'tlist' * to avoid C++ compiler errors. * * Revision 9.0 1998/10/16 22:09:42 sar * Update version stamp to match release * * Revision 8.3 1998/06/19 20:18:52 sar * Make all files include asn1conf.h and snmp.h to make sure we get the * common code * * Revision 8.2 1998/06/05 18:52:58 sra * "#include <foo.h>" => "#include <envoy/h/foo.h>". * * Revision 8.1 1998/02/25 04:50:02 sra * Update copyrights. * * Revision 8.0 1997/11/18 00:56:14 sar * Updated revision to 8.0 * * Revision 7.2 1997/03/20 06:50:22 sra * DFARS-safe copyright text. Zap! * * Revision 7.1 1997/02/25 10:49:26 sra * Update copyright notice, dust under the bed. * * Revision 7.0 1996/03/15 22:21:24 sar * Updated revision to 7.0 and copyright to 96 * * Revision 1.3 1996/01/05 18:58:29 sar * added a scalar check - a single subid of 0 * * Revision 1.2 1995/11/11 00:00:48 sar * modified the functions names to be *_TestAndIncr_async to match * the mib compiler %t option. * * Revision 1.1 1995/11/01 00:55:20 sar * Initial revision * * *//* [clearcase]modification history-------------------01b,18apr05,job update copyright notices01a,24nov03,job update copyright information*/#include <wrn/wm/snmp/engine/asn1conf.h>#include <wrn/wm/snmp/engine/snmpdefs.h>#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/auxfuncs.h>/* restore the value that we saved in the set proc */void undo_TestAndIncr_async(OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp){*(INT_32_T *)(VB_TO_COOKIE(vbp)) = (INT_32_T)vbp->vb_priv;undoproc_good(pktp, vbp);return;}/* Perform a test operation on a test and increment variable. The value being set must match the current value or we return with an inconsistent value error. */void test_TestAndIncr_async(OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp){if ((tcount != 1) || (*tlist != 0)) testproc_error(pktp, vbp, NO_CREATION); if (*(INT_32_T *)(VB_TO_COOKIE(vbp)) == VB_GET_INT32(vbp)) testproc_good(pktp, vbp);else if ((VB_GET_INT32(vbp) < 0) || (VB_GET_INT32(vbp) > 0x7fffffff)) testproc_error(pktp, vbp, WRONG_VALUE);else testproc_error(pktp, vbp, INCONSISTENT_VALUE);return;}/* Perform a set operation on a test and increment variable. We increment the value and wrap it if we get to 2^32, we also save the old value in case we need to undo the set */void set_TestAndIncr_async(OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp){/* save the current information in case we need to undo the set */vbp->vb_priv = (PTR_T)(*(INT_32_T *)(VB_TO_COOKIE(vbp)));if ((*(INT_32_T *)(VB_TO_COOKIE(vbp)) = (VB_GET_INT32(vbp) + 1)) < 0) *(INT_32_T *)(VB_TO_COOKIE(vbp)) = 0; undoproc_set(pktp, vbp, undo_TestAndIncr_async);setproc_good(pktp, vbp);return;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -