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

📄 bindip.c

📁 wm PNE 3.3 source code, running at more than vxworks6.x version.
💻 C
字号:
/* bindip.c - bindip.c routines *//* *  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: bindip.c,v $ * Revision 1.2  2001/11/06 21:20:04  josh * revised new path hacking * * Revision 1.1.1.1  2001/11/05 17:47:41  tneale * Tornado shuffle * * Revision 9.4  2001/01/19 22:22:17  paul * Update copyright. * * Revision 9.3  2000/03/17 00:18:57  meister * Update copyright message * * Revision 9.2  1999/09/14 19:10:27  josh * SNMP_Bind_*() functions are now just shells that call newly-written * VBL_Bind_*() functions -- they allow you to use a VarBindList (VBL_T) * instead of an SNMP Packet (SNMP_PKT_T) * * Revision 9.1  1999/05/24 20:12:15  josh * 'compc' and 'compl' have been replaced by 'tcount' and 'tlist' * to avoid C++ compiler errors. * * Revision 9.0  1998/10/16 22:11:01  sar * Update version stamp to match release * * Revision 8.2  1998/06/05 18:53:05  sra * "#include <foo.h>" => "#include <envoy/h/foo.h>". * * Revision 8.1  1998/02/25 04:51:22  sra * Update copyrights. * * Revision 8.0  1997/11/18 00:56:41  sar * Updated revision to 8.0 * * Revision 7.2  1997/03/20 06:48:37  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 * removed no_pp stuff & casts of 0 * modified memcpy to MEMCPY * * Revision 6.0  1995/05/31  21:47:09  sra * Release 6.0. * * Revision 5.0  1994/05/16  15:42:42  sar * Updated revision to 5.0 and copyright to include 1994 * * Revision 4.0  1993/06/24  15:45:46  sar * Updated revision to 4.0 and copyright to 93 * * Revision 3.1  1993/04/27  21:10:00  sar * Replace locate_vb with index_to_vbp, so we can have only one copy of them. * * Revision 3.0  1992/04/03  19:52:37  dab * Release 3.0 * * Revision 2.103  91/10/30  20:41:37  dab * Directly include asn1conf.h, snmpdefs.h, and snmpstat.h (if needed). *  * Revision 2.102  91/08/15  12:30:43  dab * Removed <libfuncs.h>. *  * Revision 2.101  91/08/12  12:47:06  dab * Cast arguments to memcpy() and memset() to PTR_T. *  * Revision 2.100  91/08/09  14:08:14  dab * Update version. *  * Revision 1.1  91/07/30  02:23:23  romkey * Initial revision *  *  *    Rev 2.0   31 Mar 1990 15:06:36 * Release 2.00 *  *    Rev 1.1   17 Mar 1989 21:41:54 * Calls to memcpy/memset protected against zero lengths *  *    Rev 1.0   11 Jan 1989 12:11:54 * Initial revision. * * Separated from buildpkt.c on January 11, 1989.*//* [clearcase]modification history-------------------01d,12may05,job  fix apigen comments01c,18apr05,job  update copyright notices01b,16feb05,job  apigen for documented APIs01a,24nov03,job  update copyright information*//*DESCRIPTIONThis library contains bindip.c routines.INCLUDE FILES: snmp.h*/#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/objectid.h>#include <wrn/wm/snmp/engine/buildpkt.h>/********************************************************************************* SNMP_Bind_IP_Address - bind an IP address value into a 'VarBind'* SYNOPSIS** \cs* int SNMP_Bind_IP_Address*     ( *     SNMP_PKT_T  *  pktp, *     int            index, *     int            tcount, *     OIDC_T      *  tlist, *     OCTET_T     *  ipp *     )* \ce** DESCRIPTION** This routine binds an IP address value into a 'VarBind' in the 'VarBindList' * of an SNMP packet structure created by either SNMP_Create_Request2(), * SNMP_Create_Request_V3(), or SNMP_Create_Trap().** PARAMETERS* \is* \i <*pktp>* Reference the packet being constructed.* \i <index>* Specify the zero-based index that indicates which 'VarBind' entry to use.* \i <tcount>* Specify the component count of the object identifier of the 'VarBind' being * bound.* \i <*tlist>* Specify the components of the object identifier of the 'VarBind' being bound.* \i <*ipp>* Specify a pointer to a four-byte area containing the address (in network-byte * order) to be bound.* \ie** RETURNS: If successful, this routine returns 0. Otherwise, it returns -1.** ERRNO: N/A** SEE ALSO: SNMP_Bind_Unsigned_Integer(), SNMP_Create_Request2(), * SNMP_Create_Request_V3(), SNMP_Create_Trap()*/int  SNMP_Bind_IP_Address(SNMP_PKT_T *pktp,		       int	   indx,		       int	   tcount,		       OIDC_T	  *tlist,		       OCTET_T	  *ipp){VBL_T	*vblp;#if INSTALL_ENVOY_SNMP_VERSION_1if (pktp->pdu_type == TRAP_PDU)    vblp = &(pktp->pdu.trap_pdu.trap_vbl);  else#endif    vblp = &(pktp->pdu.std_pdu.std_vbl);return (VBL_Bind_IP_Address(vblp, indx, tcount, tlist, ipp));}/********************************************************************************* VBL_Bind_IP_Address - bind an IP address value into a 'VarBind'* SYNOPSIS** \cs* int VBL_Bind_IP_Address *     ( *     VBL_T     *  vblp, *     int          index, *     int          tcount, *     OIDC_T    *  tlist, *     OCTET_T   *  ipp *     )* \ce** DESCRIPTION** This routine binds an IP address value into a 'VarBind' in the 'VBL_T' * structure (<vblp>) created by VBList_Allocate().** PARAMETERS* \is* \i <*vblp>* Reference the 'VBL_T' structure.* \i <index>* Specify the zero-based index that indicates which 'VarBind' entry to use.* \i <tcount>* Specify the component count of the object identifier of the 'VarBind' being * bound.* \i <*tlist>* Specify the components of the object identifier of the 'VarBind' being bound* \i <*ipp>* Specify a pointer to a four-byte area containing the address (in network-byte * order) to be bound.* \ie** RETURNS: If successful, this routine returns 0. Otherwise, it returns -1.** ERRNO: N/A** SEE ALSO: VBL_Bind_Counter(), VBL_Bind_Gauge(), VBL_Bind_Integer(), * VBL_Bind_Null(), VBL_Bind_Object_ID(), VBL_Bind_Opaque(), VBL_Bind_String(), * VBL_Bind_64_Unsigned_Integer(), VBL_Bind_Timeticks(), * VBL_Bind_Unsigned_Integer(), VBList_Allocate()*/int  VBL_Bind_IP_Address(VBL_T   *vblp,		      int      indx,		      int      tcount,		      OIDC_T  *tlist,		      OCTET_T *ipp){VB_T	*vbp;if ((vbp = vblp_index_to_vbp(vblp, indx)) == 0)    return -1;if (build_object_id(tcount, tlist, &(vbp->vb_obj_id)) == -1)    return -1;vbp->vb_data_flags_n_type = VT_IPADDRESS;(void) MEMCPY((PTR_T)vbp->value_u.v_network_address, (PTR_T)ipp, 4);return 0;}

⌨️ 快捷键说明

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