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

📄 proxy_v1.c

📁 wm PNE 3.3 source code, running at more than vxworks6.x version.
💻 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: proxy_v1.c,v $ * Revision 1.2  2001/11/06 21:20:19  josh * revised new path hacking * * Revision 1.1.1.1  2001/11/05 17:47:40  tneale * Tornado shuffle * * Revision 9.2  2001/01/19 22:21:57  paul * Update copyright. * * Revision 9.1  2000/03/17 00:17:41  meister * Update copyright message * * Revision 9.0  1998/10/16 22:09:35  sar * Update version stamp to match release * * Revision 8.3  1998/06/05 18:52:56  sra * "#include <foo.h>" => "#include <envoy/h/foo.h>". * * Revision 8.2  1998/02/25 04:49:55  sra * Update copyrights. * * Revision 8.1  1998/02/05 18:36:09  sar * Corrected a switch statement, we were using snmp_version instead * of pdu_type. * * Revision 8.0  1997/11/18 00:56:12  sar * Updated revision to 8.0 * * Revision 7.2  1997/03/20 06:50:18  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.1  1995/11/14  22:40:40  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/asn1.h>#include <wrn/wm/snmp/engine/snmpdefs.h>#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/buffer.h>#include <wrn/wm/snmp/engine/proxy_tr.h>#if INSTALL_ENVOY_SNMP_VERSION_1/****************************************************************************NAME:  SNMP_Proxy_V1_TranslationPURPOSE:  Translate packets to v1 format then encode the packet and	  call the transport routine to send the byte string.	  Gets, nexts, sets and traps aren't changed, bulks	  are mapped to a next, trap2s are changed to traps	  reports and informs are dropped.PARAMETERS:	SNMP_PKT_T *	Packet we're working onRETURNS: INT_32_T	< 0 means failure, otherwise a time out period is			returned indicating how long the transport routine			thinks it should take for a response.  Not all			options will generate a response.	 ****************************************************************************/INT_32_T  SNMP_Proxy_V1_Translation(SNMP_PKT_T *pktp){EBUFFER_T ebuf, cbuf;INT_32_T eflag, version;PROXY_BLOCK_T *pblockp;/* Get a copy of the proxy block structure for ease of use */pblockp = (PROXY_BLOCK_T *)(pktp->user_private);/* Make sure we have a transport routine */if (pblockp->transport_routine == 0)    return(-1);switch(pktp->pdu_type) {    case GET_REQUEST_PDU:    case GET_NEXT_REQUEST_PDU:    case SET_REQUEST_PDU:    case TRAP_PDU:	break;#if (INSTALL_ENVOY_SNMP_VERSION_2)    case GET_BULK_REQUEST_PDU:	pktp->pdu_type = GET_NEXT_REQUEST_PDU;	pktp->pdu.std_pdu.error_status = 0;	pktp->pdu.std_pdu.error_index = 0;	break;#endif /* #if (INSTALL_ENVOY_SNMP_VERSION_2) */    case TRAP2_PDU:    case INFORM_REQUEST_PDU:    case REPORT_PDU:    default:	/* There is no V1 equivalent to these cases so we drop the packet */	return(-1);    }/* Save the version stamp and community string so we can restore   them after we encode the packet, then replace them with version 1   and the new community string */version = pktp->snmp_version;pktp->snmp_version = SNMP_VERSION_1;/* save the current community */EBufferPreLoad(pktp->community.bflags, &cbuf,	       EBufferStart(&pktp->community),	       EBufferUsed(&pktp->community));/* install the new community */EBufferPreLoad(pblockp->community.bflags, &pktp->community,	       EBufferStart(&pblockp->community),	       EBufferUsed(&pblockp->community));EBufferInitialize(&ebuf);eflag = (INT_32_T)SNMP_Encode_Packet(pktp, &ebuf);/* Switch the packet back to the original version and community string */pktp->snmp_version = version;/* restore the community */EBufferPreLoad(cbuf.bflags, &pktp->community, EBufferStart(&cbuf),	       EBufferUsed(&cbuf));/* init the saved one for safety */EBufferInitialize(&cbuf);if (eflag)    return(-1);eflag = pblockp->transport_routine(&ebuf, pblockp->transport_block);EBufferClean(&ebuf);return(eflag);}#endif /* #if INSTALL_ENVOY_SNMP_VERSION_1 */

⌨️ 快捷键说明

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