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

📄 setpdu.c

📁 wm PNE 3.3 source code, running at more than vxworks6.x version.
💻 C
📖 第 1 页 / 共 2 页
字号:
/* *  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 1988-1997 Epilogue Technology Corporation. *  Copyright 1998 Integrated Systems, Inc. *  All rights reserved. *//* * $Log: setpdu.c,v $ * Revision 1.4  2003/01/15 14:05:08  josh * directory structure shifting * * Revision 1.3  2001/11/06 21:50:50  josh * second (and hopefully final) pass of new path hacking * * Revision 1.2  2001/11/06 21:20:28  josh * revised new path hacking * * Revision 1.1.1.1  2001/11/05 17:47:43  tneale * Tornado shuffle * * Revision 9.3.4.2  2001/08/07 21:53:34  meister * reworked to use dynamic component configuration macros, to allow * separate vxworks agentx components * * Revision 9.3.4.1  2001/08/06 20:05:39  meister * Added dynamic component configuration macros to V3 conditional code * * Revision 9.3  2001/04/19 20:54:52  josh * make sure the error index gets set if we set the * UNDO_FAILED error status in the case where a varbind * doesn't have an undoproc associated with it * * Revision 9.2  2001/01/19 22:22:27  paul * Update copyright. * * Revision 9.1  2000/03/17 00:19:23  meister * Update copyright message * * Revision 9.0  1998/10/16 22:12:14  sar * Update version stamp to match release * * Revision 8.8  1998/06/16 05:25:01  sar * clean up some type stuff, some calls to send error * * Revision 8.7  1998/06/08 22:05:26  sar * Tidied up some v3 error returns, notably authorization error * * Revision 8.6  1998/06/05 18:53:21  sra * "#include <foo.h>" => "#include <envoy/h/foo.h>". * * Revision 8.5  1998/06/01 20:45:08  sar * Modified the size calculations for too bigs to cover the v3 case. * * Revision 8.4  1998/05/29 04:31:15  sar * Add and use defines for v2 types and v2 protocol pieces.  This allows * us to include the types and pieces for other versions, such as v3, * without having to touch all of the seperate files that use the * types or pieces. * * Revision 8.3  1998/05/24 04:44:05  sar * Added a call to find the view family, in nextpdu also modified the view_check * call to be view_family_check * * Revision 8.2  1998/02/25 15:21:35  sra * Finish moving types.h, bug.h, and bugdef.h to common/h/. * * Revision 8.1  1998/02/25 04:52:36  sra * Update copyrights. * * Revision 8.0  1997/11/18 00:57:02  sar * Updated revision to 8.0 * * Revision 7.6  1997/11/01 01:25:38  sar * In the packet we are processing save a pointer to the coarse lock we * are using so that we can free it later without needing to know which * lock it was. * * Revision 7.5  1997/10/23 06:19:47  sar * changed an error status code to allow us to get the snmp error index * correct if the first vbp has an error * * Revision 7.4  1997/10/22 03:10:26  sar * Modified the installation options for agentx and the older sub agent scheme * * Also moved the allocation of the locks into envoy_init (env_init.c), * so they can be initialized if necessary. * * Revision 7.3  1997/10/16 00:46:05  sar * Updated for agentx support, with most of the work in mibutils.c to deal * with interior leaves and the pdu processors to deal with agentx leaves, * especially their reference counts. * * Add a bug macro into the get_{read write}_lock calls to give the user * a chance if things start going wrong. * * Fixed a potential problem int the proxy code where we were trying to * stuff a 32 bit quantity into a pointer which may or may not work depending * on the platform. * * Revision 7.2  1997/03/20 06:49:17  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/18 20:01:11  sar * Updated revision to 7.0 and copyright to 96 * * Revision 6.3  1995/11/11  00:07:30  sar * added SNMP_user_set_failed as a user exit that will be called if, * after all the tests return, some of the tests have failed or after * all the undos return if a set fails. * * Revision 6.2  1995/11/01  00:46:48  sar * changed LOCCK to LOCK * modified the version test to process unknown versions as v2, allowing * new versions such as usec to be added without modifing setpdu * * Revision 6.1  1995/10/20  23:02:48  sar * removed reacquiring the parties * tiddied up the error tests * * Revision 6.0  1995/05/31  21:48:07  sra * Release 6.0. * * Revision 5.4  1995/05/02  23:34:50  sar * Removed the no_creation code as the new v2 error sequence doesn't need it. * * Revision 5.3  1995/04/18  21:13:44  sar * use {for loc}_party_oid instead of {for loc}_oid. * * Revision 5.2  1995/03/21  00:30:26  sar * Basically rewritten to use the new async apis. * * Revision 5.1  1994/09/29  18:37:21  sar * If we aren't using the v2 types remove the code to handle them mostly * this means ifdef the code.  In mibutils.c and snmp_d.c we need to * examine the version of the packet in some cases to reject v2 types for * a v1 packet when both v1 and v2 are installed. * * Revision 5.0  1994/05/16  15:42:42  sar * Updated revision to 5.0 and copyright to include 1994 * * Revision 4.6  1994/05/11  00:21:12  sar * Added a test to see if the object is writable in the v1 test sequence. * * Revision 4.5  1994/05/04  22:45:43  sar * Added code to allow a failure during the setproc, this shouldn't be * used in general.  Required changing the calling sequence to call_the_set * _routine. The only error returned is undo_failed. * * Revision 4.4  1994/04/29  21:15:53  sar * Added ifdefs for use with sub agent scheme, as well as updating find_object * _node to have another argument.  Modifed the view check system and * added code to reacquire parties after sets. * * Revision 4.3  1994/03/08  18:00:52  dab * Clear error_status and error_index in response packet. * * Revision 4.2  1993/10/06  19:50:40  sar * Upgraded error_response, it now handles incrementing counters and choosing * which error code to return.  It is called with a TPROC style error and * it checks for v1 or v2 and sends the appropriate error. * * Revision 4.1  1993/09/30  20:19:13  sar * Added code to test the size of the potential outgoing packet and to drop * the packet if necessary. * Rearranged the error tests and added some code to get the proper set * of errors for v2. * This includes a potential change to the testproc routines to understand * the TEST_CREATE flag and be able to test even if other errors may exist. * * Revision 4.0  1993/06/24  15:45:46  sar * Updated revision to 4.0 and copyright to 93 * * Revision 3.11  1993/06/17  23:33:44  sar * removed the ENVOY_ from the UI64 routines. * * Revision 3.10  1993/06/02  23:09:24  dab * Changed #ifdef's to #if's for things from install.h * * Revision 3.9  1993/04/30  22:57:32  sar * made the definition of call_the_set_routine use __() macro. * * Revision 3.8  1993/04/28  22:02:29  sar * moved the def of UINT_64_T and added some new types to the routines. * * Revision 3.7  1993/04/22  20:06:36  sar * Much updating of macros and install options, mostly we now use * ISNTALL_ENVOY_SNMP_VERSION_1 or _2, VERSION_RFCXXXX is now SNMP_VERSION_2 * and other similiar items. * * Revision 3.6  1993/04/20  19:53:27  sar * I had removed the read-only check during sets (for v2) so I put it back * and cleaned up the code around it, also gave mibuitls another error return * so we can coose between no access and no such. * * Revision 3.5  1993/04/17  01:08:43  sar * added a new type of error to the error response, this allows another routine * to have set the error index and status fields. * * Revision 3.4  1993/03/20  00:25:43  sar * Updated some types for version two party type stuff (indicies, local * storage, status, mtu and privileges). * Also removed some unused break statements. * * Revision 3.3  1993/03/17  23:02:47  sar * added the view structure and the routines to use and manipulate it. * in mibutils and setpdu started using views. * * Revision 3.2  1993/02/26  22:37:51  sar * Added check for new return codes from the test procs. * * Revision 3.1  1993/02/17  21:09:52  sar * Removed the #define then and use of it. * Updated stats to deal with v1 and v2 (or both or neither). * Added data type for VT_UINTEGER32 * * Revision 3.0  92/04/03  19:52:37  dab * Release 3.0 *  * Revision 2.107  91/11/07  17:15:28  dab * Return from testproc is 1 based not 0 based. *  * Revision 2.106  91/11/07  09:33:00  dab * Testproc can now return with a positive result which means report a * badValue error with an index of the returned result (1 based). *  * Revision 2.105  91/10/30  20:42:09  dab * Directly include asn1conf.h, snmpdefs.h, and snmpstat.h (if needed). *  * Revision 2.104  91/09/18  12:32:34  dab * Updated to use new macros from <asn1conf.h> and <snmpconf.h>. *  * Revision 2.103  91/08/15  12:31:09  dab * Removed <libfuncs.h>. *  * Revision 2.102  91/08/14  10:47:28  dab * Added trace functions that Karl put in as macros. *  * Revision 2.101  91/08/12  12:31:57  dab * Changed local variables index to vb_index to avoid shadowing * common library routine index(). *  * Revision 2.100  91/08/09  14:08:25  dab * Update version. *  * Revision 1.1  91/07/30  02:23:50  romkey * Initial revision *  *  *    Rev 2.4   09 Aug 1990 13:40:36 * Added -3 as a new potential return from testproc.  This allows a badValue * error to be returned. * Also fixed a misleading comment on an endif. *  *    Rev 2.3   22 Jun 1990 22:04:36 * Removed a call to LEAVE_CRITICAL_SECTION which was misplaced during * a recent reorganization of the code. *  *    Rev 2.2   06 Jun 1990 23:58:36 * Corrected a misleading comment. *  *    Rev 2.1   30 May 1990 11:32:52 * Fixed a comment to properly describe the range of error return values * from testproc(). *  *    Rev 2.0   31 Mar 1990 15:06:54 * Release 2.00 *  *    Rev 1.8   27 Apr 1989 15:56:06 * Removed unused variables *  *    Rev 1.7   17 Mar 1989 21:41:30 * Calls to memcpy/memset protected against zero lengths *  *    Rev 1.6   11 Jan 1989 12:41:06 * Added critical section macros. *  *    Rev 1.5   20 Sep 1988 18:35:32 * Made note of the fact that under RFC1067, an attempt to set a read-only * variable should cause a noSuchName error rather than a readOnly error. *  *    Rev 1.4   19 Sep 1988 17:26:48 * Made changes to make the Sun C compiler happy. *  *    Rev 1.3   19 Sep 1988  9:24:00 * Reversed change made in revision 1.2 *  *    Rev 1.2   15 Sep 1988 20:04:08 * Recalculated size of outgoing packet before transmission. *  *    Rev 1.1   14 Sep 1988 17:57:20 * Moved includes of system include files into libfuncs.h. *  *    Rev 1.0   12 Sep 1988 10:47:06 * 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/asn1.h>#include <wrn/wm/snmp/engine/snmpdefs.h>#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/mib.h>#include <wrn/wm/snmp/engine/view.h>#include <wrn/wm/common/bug.h>#include <wrn/wm/common/dyncfg.h>DYNCFG_VBL_DECLARE_EXTERN(envoy_use_v2_protos)DYNCFG_VBL_DECLARE_EXTERN(agentx_master_component)/****************************************************************************NAME:  SNMP_Process_Test_PDUPURPOSE:  Process a set type pdu in an async fashion.  First we find objects          for all the var binds (checking that the objects are in the view).          If any var binds don't point to a valid object we flag a no such          error.  After we have found all the objects we call the testproc          routines to determine if the var binds may be set.PARAMETERS:        SNMP_PKT_T *    The decoded SET PDURETURNS:  int   0 all of the tests have been started successfully                1 error of some sort, any error packet has been sent.****************************************************************************/int  SNMP_Process_Test_PDU(SNMP_PKT_T *pktp){VB_T *vbp;int   count, indx, eret;sbits32_t *err_stat;#if INSTALL_ENVOY_SNMP_LOCK/* if locks are installed we need to return the read lock and get   a write lock */if (pktp->lockflags != LOCK_READ) {    pktp->error_complete(&pktp->pkt_src, &pktp->pkt_dst, 1,                         pktp->async_cookie);    return(1);    }ENVOY_SNMP_RELEASE_READ_LOCK((*pktp->coarse_lock));pktp->lockflags = LOCK_NOLOCK;if (ENVOY_SNMP_GET_WRITE_LOCK((*pktp->coarse_lock))) {    BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,	(BUG_OUT, "SNMP_Process_Test_PDU: coarse lock is broken", 0));    pktp->error_complete(&pktp->pkt_src, &pktp->pkt_dst, 1,                         pktp->async_cookie);    return(1);    }pktp->lockflags = LOCK_WRITE;#endif /* INSTALL_ENVOY_SNMP_LOCK *//* There is no need to really do much work on the PDU because   *//* the returned form is almost exactly the received form.       *//* get some initial information */vbp = pktp->pdu.std_pdu.std_vbl.vblist;count = pktp->pdu.std_pdu.std_vbl.vbl_count;

⌨️ 快捷键说明

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