📄 asy_back.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: asy_back.c,v $ * Revision 1.4 2003/01/15 14:05:01 josh * directory structure shifting * * Revision 1.3 2001/11/06 21:50:42 josh * second (and hopefully final) pass of new path hacking * * Revision 1.2 2001/11/06 21:20:00 josh * revised new path hacking * * Revision 1.1.1.1 2001/11/05 17:47:41 tneale * Tornado shuffle * * Revision 9.4.4.1 2001/08/06 20:05:36 meister * Added dynamic component configuration macros to V3 conditional code * * Revision 9.4 2001/01/19 22:22:15 paul * Update copyright. * * Revision 9.3 2000/03/17 00:18:49 meister * Update copyright message * * Revision 9.2 2000/02/04 21:56:14 josh * functions which are clearly static have been declared as such. * this makes the vxWorks compiler happy. * * Revision 9.1 1999/05/24 20:12:13 josh * 'compc' and 'compl' have been replaced by 'tcount' and 'tlist' * to avoid C++ compiler errors. * * Revision 9.0 1998/10/16 22:10:41 sar * Update version stamp to match release * * Revision 8.6 1998/06/05 18:53:04 sra * "#include <foo.h>" => "#include <envoy/h/foo.h>". * * Revision 8.5 1998/05/29 17:01:24 josh * cleaning up the allocation code a bit * * Revision 8.4 1998/05/29 04:50:04 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/04/22 20:53:28 josh * Some modifications for allocating large variables off of the heap * instead of the stack. * * Revision 8.2 1998/04/16 15:48:11 josh * certain large variables are now allocated from the heap. * * Revision 8.1 1998/02/25 04:51:03 sra * Update copyrights. * * Revision 8.0 1997/11/18 00:56:35 sar * Updated revision to 8.0 * * Revision 7.2 1997/03/20 06:48:32 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.1 1995/10/20 22:59:09 sar * nextpdu.c removed bitstring, uinteger32, nsapaddress * * Revision 6.0 1995/05/31 21:47:00 sra * Release 6.0. * * Revision 1.6 1995/05/09 22:35:29 sar * Corrected the call to the get routine in async_compat_next to use * the newly discovered oid rather than whatever was passed in. * * Revision 1.5 1995/05/08 20:52:42 sar * deleted some code that was commented out. * * Revision 1.4 1995/05/08 20:32:04 sar * cast the routines when calling the old setprocs to make sure compilers * do the right thing with the args. * * Revision 1.3 1995/05/02 23:34:50 sar * Moved the declarations of the v2 object types into the v2 type block. * * Revision 1.2 1995/04/28 23:12:28 sar * Dropped the static/dynamice flag in the call to nextproc_next_instance * * Revision 1.1 1995/03/21 00:09:23 sar * Initial revision * * 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/buffer.h>#include <wrn/wm/snmp/engine/snmpdefs.h>#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/objectid.h>#include <wrn/wm/common/bug.h>#include <wrn/wm/common/dyncfg.h>DYNCFG_VBL_DECLARE_EXTERN(envoy_use_v2_types)/****************************************************************************NAME: async_back_compat_testPURPOSE: This is a glue routine to translate from the async method routine api to the older sync method routine api. This will allow older method routines to be used with the async engine code. For tests we simply call the old test routine with the appropriate arguments.PARAMETERS: OIDC_T Last component of the object id leading to the leaf node in the MIB. This is usually the identifier for the particular attribute in the table. int Number of components in the unused part of the object identifier OIDC_T * Unused part of the object identifier SNMP_PKT_T * SNMP packet currently being processsed. VB_T * Variable being processed.RETURNS: void****************************************************************************//*ARGSUSED*/void async_compat_test(OIDC_T last_match, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp){COMPAT_ROUTINES_T *crts;int rcode;crts = (COMPAT_ROUTINES_T *)vbp->vb_ml.ml_leaf->user_cookie;rcode = (crts->testproc)(1, last_match, tcount, tlist, crts->cookie, pktp, vbp_to_index(pktp, vbp));if (rcode == 0) testproc_good(pktp, vbp);else testproc_tproc_error(pktp, vbp, rcode);return;}/****************************************************************************NAME: async_get_routinesPURPOSE: Routine to handle calling the old type get routines, used by both async_compat_{get next}.PARAMETERS: OIDC_T Last component of the object id leading to the leaf node in the MIB. This is usually the identifier for the particular attribute in the table. int Number of components in the unused part of the object identifier OIDC_T * Unused part of the object identifier SNMP_PKT_T * SNMP packet currently being processsed. VB_T * Variable being processed.RETURNS: void****************************************************************************//*ARGSUSED*/static void async_get_routines(OIDC_T last_match, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp){COMPAT_ROUTINES_T *crts;OCTET_T data_type, *cp;INT_32_T int_value;UINT_32_T uint_value;OBJ_ID_T *objp;int length, dynamic = 0;crts = (COMPAT_ROUTINES_T *)vbp->vb_ml.ml_leaf->user_cookie;data_type = vbp->vb_ml.ml_leaf->expected_tag;switch (data_type) { case VT_NUMBER: int_value = (*((INT_32_T (*) __((OIDC_T, int, OIDC_T *, char *, SNMP_PKT_T *))) (crts->getproc))) (last_match, tcount, tlist, crts->cookie, pktp); getproc_got_int32(pktp, vbp, int_value); break; case VT_COUNTER: case VT_GAUGE: case VT_TIMETICKS: uint_value = (*((UINT_32_T (*) __((OIDC_T, int, OIDC_T *, char *, SNMP_PKT_T *))) (crts->getproc))) (last_match, tcount, tlist, crts->cookie, pktp); getproc_got_uint32(pktp, vbp, uint_value, data_type); break; case VT_STRING: case VT_OPAQUE: cp = (*((OCTET_T * (*) __((OIDC_T, int, OIDC_T *, char *, int *, SNMP_PKT_T *, int *))) (crts->getproc))) (last_match, tcount, tlist, crts->cookie, &length, pktp, &dynamic); getproc_got_string(pktp, vbp, length, cp, dynamic, data_type); break; case VT_OBJECT: objp = (*((OBJ_ID_T * (*) __((OIDC_T, int, OIDC_T *, char *, SNMP_PKT_T *, int *))) (crts->getproc))) (last_match, tcount, tlist, crts->cookie, pktp, &dynamic); if (objp == 0) /* no object id was returned */ getproc_got_object_id(pktp, vbp, 0, 0, 0); else { getproc_got_object_id(pktp, vbp, objp->num_components, objp->component_list, dynamic); if (dynamic) SNMP_memory_free(objp); } break; case VT_EMPTY: getproc_got_empty(pktp, vbp);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -