original files of m241
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
# Copyright 2000-2010Wind 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.
|
||||
#
|
||||
|
||||
# [clearcase]
|
||||
# modification history
|
||||
# -------------------
|
||||
# 01b,21apr10,y_t first create
|
||||
#
|
||||
|
||||
EPILOGUE_PRODUCTS=engine vxagent
|
||||
|
||||
TGT_DIR=$(WIND_BASE)/target
|
||||
BSP_BASE = $(WIND_BASE)/target/config
|
||||
|
||||
include $(TGT_DIR)/h/make/defs.default
|
||||
include $(TGT_DIR)/h/tool/$(TOOL_FAMILY)/make.$(CPU)$(TOOL)
|
||||
|
||||
|
||||
all:
|
||||
make -C engine
|
||||
make -C vxagent
|
||||
clean:
|
||||
make -C engine clean
|
||||
make -C vxagent clean
|
||||
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
# Makefile - Makefile for target/src/wrn/wm/snmp/engine
|
||||
#
|
||||
# Copyright 2001-2010 Wind River Systems, Inc.
|
||||
#
|
||||
# modification history
|
||||
# --------------------
|
||||
# 01a,21apr10,y_t create.
|
||||
#
|
||||
# DESCRIPTION
|
||||
# This file contains the makefile rules for building the Snmp engine library
|
||||
#
|
||||
|
||||
WIND_BASE := $(subst \,/,$(WIND_BASE))
|
||||
TGT_DIR=$(WIND_BASE)/target
|
||||
|
||||
LIB_BASE_NAME= snmp
|
||||
|
||||
ifneq (user,$(SPACE))
|
||||
include $(TGT_DIR)/h/make/defs.library
|
||||
endif
|
||||
|
||||
|
||||
ifeq (user,$(SPACE))
|
||||
CORE_OBJS=asy_back.o asy_util.o bindint.o bindip.o bindnull.o bindoid.o bindstr.o binduint.o snmpEBuffer.o buildpkt.o creatreq.o creatint.o snmpBerDecode.o snmpBerEncode.o env_init.o etimer.o etimerin.o exists.o exist_as.o gas_int.o gas_ip.o gas_oid.o gas_str.o gas_uint.o gas_ulng.o gas_incr.o get_int.o get_ip.o get_oid.o get_str.o get_uint.o get_ulng.o getpdu.o ip2rlist.o ip2llist.o llistcmp.o localio.o mibutils.o mib_fon.o mib_next.o nextpdu.o null_gas.o null_get.o null_nas.o null_nxt.o null_tas.o null_tst.o null_sas.o null_set.o objectid.o oid2ip.o oid2str.o oidcmp.o oidcmp2.o oidorder.o rcv_pkt.o row.o row_get.o rowloose.o rpktasy.o sas_int.o sas_uint.o sas_incr.o scan_loc.o set_int.o set_uint.o serial.o setpdu.o snmp_d.o snmp_e.o tree.o vb_rtns.o
|
||||
V1_TYPE_OBJS=creatrap.o
|
||||
V2_TYPE_OBJS=get_ui64.o set_ui64.o gas_ui64.o sas_ui64.o bindui64.o
|
||||
V3_TYPE_OBJS=
|
||||
VIEW_OBJS=view_chk.o view_rts.o vmth2275.o
|
||||
AX_OBJS=ax_sa_cr.o ax_core.o ax_chunk.o ax_ma.o ax_maini.o ax_index.o ax_mhlpf.o ax_mmutl.o axapi.o axmth.o ax_sa.o ax_saini.o
|
||||
DYN_OBJS=dyncfgam.o dyncfgas.o dyncfgax.o dyncfgvx.o
|
||||
LOCK_OBJS=snmplock.o
|
||||
OBJS=$(CORE_OBJS) $(VIEW_OBJS) $(V1_TYPE_OBJS) $(V2_TYPE_OBJS) $(V3_TYPE_OBJS) $(LOCK_OBJS) $(AX_OBJS) $(DYN_OBJS)
|
||||
else
|
||||
CORE_OBJS=asy_back.o asy_util.o bindint.o bindip.o bindnull.o bindoid.o bindstr.o binduint.o snmpEBuffer.o buildpkt.o creatreq.o creatint.o snmpBerDecode.o snmpBerEncode.o env_init.o etimer.o etimerin.o exists.o exist_as.o gas_int.o gas_ip.o gas_oid.o gas_str.o gas_uint.o gas_ulng.o gas_incr.o get_int.o get_ip.o get_oid.o get_str.o get_uint.o get_ulng.o getpdu.o ip2rlist.o ip2llist.o llistcmp.o localio.o mibutils.o mib_fon.o mib_next.o nextpdu.o null_gas.o null_get.o null_nas.o null_nxt.o null_tas.o null_tst.o null_sas.o null_set.o objectid.o oid2ip.o oid2str.o oidcmp.o oidcmp2.o oidorder.o rcv_pkt.o row.o row_get.o rowloose.o rpktasy.o sas_int.o sas_uint.o sas_incr.o scan_loc.o set_int.o set_uint.o serial.o setpdu.o snmp_d.o snmp_e.o tree.o vb_rtns.o dyncfgvx.o
|
||||
V1_TYPE_OBJS=creatrap.o
|
||||
V2_TYPE_OBJS=get_ui64.o set_ui64.o gas_ui64.o sas_ui64.o bindui64.o
|
||||
ifdef _WRS_CONFIG_FEATURE_SNMP_V3
|
||||
V3_TYPE_OBJS=v3_acc.o v3_auth.o v3_ber.o v3_con.o v3_creq.o v3_eng.o v3_ini.o v3_priv.o v3_user.o v3mt_con.o v3mt_acc.o v3mt_usr.o copyvb.o ntfy_chk.o v3_trgt.o v3mt_tgt.o pxy3_chk.o v3_proxy.o v3mt_pxy.o sendntfy.o v3_ntfy.o v3mt_nfy.o commlkup.o v3_comm.o v3mt_com.o dyncfgv3.o
|
||||
endif
|
||||
VIEW_OBJS=view_chk.o view_rts.o vmth2275.o
|
||||
ifdef _WRS_CONFIG_FEATURE_SNMP_AGENTX
|
||||
AX_OBJS=ax_sa_cr.o ax_core.o ax_chunk.o ax_ma.o ax_maini.o ax_index.o ax_mhlpf.o ax_mmutl.o axapi.o axmth.o ax_sa.o ax_saini.o dyncfgam.o dyncfgas.o dyncfgax.o
|
||||
endif
|
||||
LOCK_OBJS=snmplock.o
|
||||
OBJS=$(CORE_OBJS) $(VIEW_OBJS) $(V1_TYPE_OBJS) $(V2_TYPE_OBJS) $(V3_TYPE_OBJS) $(LOCK_OBJS) $(AX_OBJS)
|
||||
endif
|
||||
|
||||
ifeq (user,$(SPACE))
|
||||
include $(WIND_USR)/make/rules.library
|
||||
else
|
||||
include $(TGT_DIR)/h/make/rules.library
|
||||
endif
|
||||
|
||||
DOC_FILES=\
|
||||
ax_chunk.c \
|
||||
ax_core.c \
|
||||
ax_ma.c \
|
||||
ax_sa.c \
|
||||
ax_sa_cr.c \
|
||||
bindint.c \
|
||||
bindip.c \
|
||||
bindnull.c \
|
||||
bindoid.c \
|
||||
bindstr.c \
|
||||
bindui64.c \
|
||||
binduint.c \
|
||||
buildpkt.c \
|
||||
creatrap.c \
|
||||
creatreq.c \
|
||||
env_init.c \
|
||||
ip2llist.c \
|
||||
ip2rlist.c \
|
||||
llistcmp.c \
|
||||
mibutils.c \
|
||||
oid2ip.c \
|
||||
oid2str.c \
|
||||
oidcmp2.c \
|
||||
oidcmp.c \
|
||||
oidorder.c \
|
||||
row.c \
|
||||
row_get.c \
|
||||
rowloose.c \
|
||||
rpktasy.c \
|
||||
sendntfy.c \
|
||||
snmp_d.c \
|
||||
snmp_e.c \
|
||||
tree.c \
|
||||
v3_acc.c \
|
||||
v3_auth.c \
|
||||
v3_comm.c \
|
||||
v3_con.c \
|
||||
v3_creq.c \
|
||||
v3_dh.c \
|
||||
v3_eng.c \
|
||||
v3_ntfy.c \
|
||||
v3_priv.c \
|
||||
v3_proxy.c \
|
||||
v3_trgt.c \
|
||||
v3_user.c \
|
||||
vb_rtns.c \
|
||||
view_rts.c
|
||||
|
||||
include $(WIND_BASE)/vx_components/$(COMP_SNMP)/config/defs.docs
|
||||
|
||||
@@ -0,0 +1,504 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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
|
||||
-------------------
|
||||
01c,10jun10,y_t update for LP64
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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_test
|
||||
|
||||
PURPOSE: 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_routines
|
||||
|
||||
PURPOSE: 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, (ALENGTH_T)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);
|
||||
break;
|
||||
case VT_IPADDRESS:
|
||||
cp = (*((OCTET_T * (*) __((OIDC_T, int, OIDC_T *, char *,
|
||||
SNMP_PKT_T *, UINT_32_T *)))
|
||||
(crts->getproc)))(last_match, tcount, tlist, crts->cookie,
|
||||
pktp, &uint_value);
|
||||
if (cp != 0)
|
||||
MEMCPY(&uint_value, cp, 4);
|
||||
getproc_got_ip_address(pktp, vbp, uint_value);
|
||||
break;
|
||||
|
||||
/* We only include the following case if v2 types is installed */
|
||||
#if (ENVOY_USE_V2_TYPES)
|
||||
case VT_COUNTER64:
|
||||
DYNCFG_IFCFGVBL_BEGIN(envoy_use_v2_types)
|
||||
{
|
||||
UINT_64_T *uint64_value;
|
||||
uint64_value = (*((UINT_64_T * (*) __((OIDC_T, int, OIDC_T *,
|
||||
char *, SNMP_PKT_T *, int *)))
|
||||
(crts->getproc))) (last_match, tcount, tlist,
|
||||
crts->cookie, pktp, &dynamic);
|
||||
if (uint64_value == 0)
|
||||
/* no counter was returned */
|
||||
getproc_got_uint64_high_low(pktp, vbp, 0, 0);
|
||||
else {
|
||||
getproc_got_uint64(pktp, vbp, uint64_value);
|
||||
if (dynamic)
|
||||
SNMP_memory_free(uint64_value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(envoy_use_v2_types)
|
||||
#endif /* (ENVOY_USE_V2_TYPES) */
|
||||
|
||||
default:
|
||||
getproc_error(pktp, vbp, GEN_ERR);
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: async_compat_next
|
||||
|
||||
PURPOSE: 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 nexts we call the old next followed by an old get
|
||||
and then insert the information into the packet.
|
||||
|
||||
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_next(OIDC_T last_match,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
COMPAT_ROUTINES_T *crts;
|
||||
int rcount;
|
||||
#if INSTALL_ENVOY_HEAP_LARGE_VARS
|
||||
OIDC_T *rlist;
|
||||
#else
|
||||
OIDC_T rlist[MAX_OID_COUNT];
|
||||
#endif /* INSTALL_ENVOY_HEAP_LARGE_VARS */
|
||||
|
||||
#if INSTALL_ENVOY_HEAP_LARGE_VARS
|
||||
rlist = (OIDC_T *)SNMP_memory_alloc(MAX_OID_COUNT * sizeof(OIDC_T));
|
||||
if (rlist == 0) {
|
||||
nextproc_error(pktp, vbp, GEN_ERR);
|
||||
BUG(BUG_ENVOY_INSUFFICIENT_MEMORY, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT, "async_compat_next(): insufficient memory", 0));
|
||||
return;
|
||||
}
|
||||
#endif /* INSTALL_ENVOY_HEAP_LARGE_VARS */
|
||||
|
||||
crts = (COMPAT_ROUTINES_T *)vbp->vb_ml.ml_leaf->user_cookie;
|
||||
|
||||
rcount = crts->nextproc(last_match, tcount, tlist, rlist, crts->cookie, pktp);
|
||||
if (rcount == 0) {
|
||||
nextproc_no_next(pktp, vbp);
|
||||
}
|
||||
else {
|
||||
nextproc_next_instance(pktp, vbp, rcount, rlist);
|
||||
|
||||
async_get_routines(last_match, rcount, rlist, pktp, vbp);
|
||||
}
|
||||
|
||||
#if INSTALL_ENVOY_HEAP_LARGE_VARS
|
||||
SNMP_memory_free(rlist);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: async_compat_get
|
||||
|
||||
PURPOSE: 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 gets we do a test with the correct arguments followed
|
||||
by a get and then insert the information into the packet.
|
||||
|
||||
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_get(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)(0, last_match, tcount, tlist, crts->cookie,
|
||||
pktp, vbp_to_index(pktp, vbp));
|
||||
|
||||
if (rcode) {
|
||||
getproc_nosuchins(pktp, vbp);
|
||||
return;
|
||||
}
|
||||
|
||||
async_get_routines(last_match, tcount, tlist, pktp, vbp);
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: async_compat_set
|
||||
|
||||
PURPOSE: 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 sets all we can do is call the set routine, we would
|
||||
like to be able to use undos but they didn't exist so we
|
||||
can't.
|
||||
|
||||
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_set(OIDC_T last_match,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
COMPAT_ROUTINES_T *crts;
|
||||
|
||||
crts = (COMPAT_ROUTINES_T *)vbp->vb_ml.ml_leaf->user_cookie;
|
||||
|
||||
switch (vbp->vb_ml.ml_leaf->expected_tag) {
|
||||
case VT_NUMBER:
|
||||
case VT_COUNTER:
|
||||
case VT_GAUGE:
|
||||
case VT_TIMETICKS:
|
||||
(*((void (*) __((OIDC_T, int, OIDC_T *, char *,
|
||||
INT_32_T, SNMP_PKT_T *, int)))
|
||||
(crts->setproc)))(last_match, tcount, tlist, crts->cookie,
|
||||
vbp->value_u.v_number, pktp,
|
||||
vbp_to_index(pktp, vbp));
|
||||
break;
|
||||
case VT_STRING:
|
||||
case VT_OPAQUE:
|
||||
(*((void (*) __((OIDC_T, int, OIDC_T *, char *,
|
||||
char *, int, SNMP_PKT_T *, int)))
|
||||
(crts->setproc)))(last_match, tcount, tlist, crts->cookie,
|
||||
(char *)vbp->value_u.v_string.start_bp,
|
||||
(int)EBufferUsed(&vbp->value_u.v_string),
|
||||
pktp, vbp_to_index(pktp, vbp));
|
||||
break;
|
||||
case VT_OBJECT:
|
||||
(*((void (*) __((OIDC_T, int, OIDC_T *, char *,
|
||||
int, OIDC_T *, SNMP_PKT_T *, int)))
|
||||
(crts->setproc)))(last_match, tcount, tlist, crts->cookie,
|
||||
vbp->value_u.v_object.num_components,
|
||||
vbp->value_u.v_object.component_list,
|
||||
pktp, vbp_to_index(pktp, vbp));
|
||||
break;
|
||||
case VT_EMPTY:
|
||||
break;
|
||||
case VT_IPADDRESS:
|
||||
/* Calling sequence to set IP address is same as for strings */
|
||||
(*((void (*) __((OIDC_T, int, OIDC_T *, char *,
|
||||
char *, int, SNMP_PKT_T *, int)))
|
||||
(crts->setproc)))(last_match, tcount, tlist, crts->cookie,
|
||||
(char *)vbp->value_u.v_network_address, 4,
|
||||
pktp, vbp_to_index(pktp, vbp));
|
||||
break;
|
||||
/* We only include the following cases if v2 types are installed */
|
||||
#if (ENVOY_USE_V2_TYPES)
|
||||
case VT_COUNTER64:
|
||||
DYNCFG_IFCFGVBL_BEGIN(envoy_use_v2_types)
|
||||
(*((void (*) __((OIDC_T, int, OIDC_T *, char *,
|
||||
UINT_32_T, UINT_32_T, SNMP_PKT_T *, int)))
|
||||
(crts->setproc)))(last_match, tcount, tlist, crts->cookie,
|
||||
UI64_High(&vbp->value_u.v_counter64),
|
||||
UI64_Low(&vbp->value_u.v_counter64),
|
||||
pktp, vbp_to_index(pktp, vbp));
|
||||
DYNCFG_IFCFGVBL_END(envoy_use_v2_types)
|
||||
break;
|
||||
#endif /* (ENVOY_USE_V2_TYPES) */
|
||||
default:
|
||||
setproc_error(pktp, vbp, GEN_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
setproc_good(pktp, vbp);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,961 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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_util.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:01 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:41 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.5 2001/04/11 20:42:57 josh
|
||||
* merge from the kingfisher branch
|
||||
*
|
||||
* Revision 9.4 2001/01/19 22:22:15 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.3 2000/06/13 21:03:03 josh
|
||||
* minor patch to include lists
|
||||
*
|
||||
* Revision 9.2.2.3 2001/03/12 22:08:06 tneale
|
||||
* Updated copyright
|
||||
*
|
||||
* Revision 9.2.2.2 2001/02/21 21:27:10 josh
|
||||
* updating the error index in the function equivalents of *_error()
|
||||
*
|
||||
* Revision 9.2.2.1 2000/09/20 20:07:42 josh
|
||||
* adding an include file to make the build clean
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:18:50 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 2000/03/08 20:06:14 josh
|
||||
* adding functions to Envoy that replace getproc_got_*() macros.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:10:42 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.7 1998/09/04 14:33:12 sar
|
||||
* Added some casts to try and keep compilers happy
|
||||
*
|
||||
* Revision 8.6 1998/06/22 03:34:25 sar
|
||||
* Cast some things to unsigned ints to try and keep compilers happy
|
||||
*
|
||||
* Revision 8.5 1998/06/17 02:01:56 sar
|
||||
* Hnadle 0 length strings
|
||||
*
|
||||
* Revision 8.4 1998/06/09 21:46:35 sar
|
||||
* Cleaned up some code that might have called alloc or memcmp with
|
||||
* 0 lenght strings
|
||||
*
|
||||
* Revision 8.3 1998/06/05 18:53:05 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.2 1998/05/24 04:30:13 sar
|
||||
* added nextproc_next_instance_string to make putting strings into
|
||||
* oids more efficient
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:04 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:36 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.3 1997/10/16 23:49:22 sar
|
||||
* created testproc_error to allow for changing which error
|
||||
* to return depending on the type of the packet
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:48:35 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.0 1995/05/31 21:47:01 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.4 1995/05/08 20:32:04 sar
|
||||
* changed the args to nextproc_next_instance & getproc_got_object_id
|
||||
* to make compilers happier.
|
||||
*
|
||||
* Revision 1.3 1995/04/28 23:12:28 sar
|
||||
* Dropped the static/dynamice flag in the call to nextproc_next_instance
|
||||
*
|
||||
* Revision 1.2 1995/04/18 21:13:44 sar
|
||||
* Removed an unnecessary break.
|
||||
*
|
||||
* Revision 1.1 1995/03/21 00:09:23 sar
|
||||
* Initial revision
|
||||
*
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01e,13jul10,y_t fix for WIND00217556
|
||||
01d,26sep06,jbl getproc_got_octet_string() needs to use EBufferAllocateLoad()
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,02jul04,job add getproc_got_octet_string() function
|
||||
01a,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/vbdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/objectid.h>
|
||||
|
||||
|
||||
#if !(INSTALL_ENVOY_SNMP_UTIL_MACROS)
|
||||
/****************************************************************************
|
||||
NAME: getproc_started
|
||||
|
||||
PURPOSE: Indicate that getproc for the specified varbind
|
||||
has been started and should not be started again.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
getproc_started(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
vbp->vb_flags |= VFLAG_GET_STARTED;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: getproc_good
|
||||
|
||||
PURPOSE: Indicates successful completion of a getproc.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
getproc_good(SNMP_PKT_T * pktp,
|
||||
VB_T * vbp)
|
||||
{
|
||||
vbp->vb_flags |= VFLAG_GET_DONE;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: getproc_error
|
||||
|
||||
PURPOSE: Indicates that a getproc encountered an error.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
bits32_t the error code
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
getproc_error(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
INT_32_T error)
|
||||
{
|
||||
pktp->pdu.std_pdu.error_status = error;
|
||||
pktp->pdu.std_pdu.error_index = vbp_to_index_error(pktp, vbp, 1);
|
||||
vbp->vb_flags |= VFLAG_GET_DONE;
|
||||
}
|
||||
#endif /* INSTALL_ENVOY_SNMP_UTIL_MACROS */
|
||||
|
||||
/****************************************************************************
|
||||
NAME: getproc_nosuchins
|
||||
|
||||
PURPOSE: Routine to tag a variable as either a nosuchins exception in v2
|
||||
or a nosuchobject error in v1.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * The decoded NEXT/BULK PDU
|
||||
VB_T * The var bind to attach the string to
|
||||
|
||||
RETURNS: void
|
||||
****************************************************************************/
|
||||
void
|
||||
getproc_nosuchins(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
if (pktp->snmp_version == SNMP_VERSION_1) {
|
||||
pktp->pdu.std_pdu.error_status = NO_SUCH_NAME;
|
||||
pktp->pdu.std_pdu.error_index = vbp_to_index(pktp, vbp) + 1;
|
||||
}
|
||||
else
|
||||
vbp->vb_data_flags_n_type = VT_NOSUCHINS;
|
||||
|
||||
vbp->vb_flags |= VFLAG_GET_DONE;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: getproc_got_object_id
|
||||
|
||||
PURPOSE: Routine to attache an object id to a var bind.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * The decoded NEXT/BULK PDU
|
||||
VB_T * The var bind to attach the string to
|
||||
size_t The length of the string
|
||||
OIDC_T * The string to attach
|
||||
int The dynamic flag static (0), dynamic (1)
|
||||
|
||||
RETURNS: void
|
||||
****************************************************************************/
|
||||
void
|
||||
getproc_got_object_id(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
int sz,
|
||||
OIDC_T *oidc,
|
||||
int dynamic)
|
||||
{
|
||||
vbp->vb_flags |= VFLAG_GET_DONE;
|
||||
vbp->vb_data_flags_n_type = VT_OBJECT;
|
||||
if (dynamic) {
|
||||
vbp->value_u.v_object.num_components = sz;
|
||||
vbp->value_u.v_object.component_list = oidc;
|
||||
}
|
||||
else {
|
||||
if (build_object_id(sz, oidc, &(vbp->value_u.v_object)))
|
||||
/* An error occurred trying to copy the object id, probably
|
||||
we couldn't allocate memory, so we set up for an error return */
|
||||
pktp->pdu.std_pdu.error_status = GEN_ERR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if !(INSTALL_ENVOY_SNMP_UTIL_MACROS)
|
||||
/****************************************************************************
|
||||
NAME: nextproc_started
|
||||
|
||||
PURPOSE: Indicates nextproc has begun for the specified varbind.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
nextproc_started(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
vbp->vb_flags |= VFLAG_NEXT_STARTED;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: nextproc_good
|
||||
|
||||
PURPOSE: Indicates nextproc has successfully completed.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
nextproc_good(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
vbp->vb_flags |= VFLAG_NEXT_DONE;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: nextproc_no_next
|
||||
|
||||
PURPOSE: Indicates there exists no next instance.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
nextproc_no_next(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
vbp->vb_flags |= (VFLAG_NEXT_DONE | VFLAG_NEXT_REDO);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: nextproc_error
|
||||
|
||||
PURPOSE: Indicates nexproc encountered an error and cannot retrieve
|
||||
a next instance for the requested varbind.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
INT_32_T error
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
nextproc_error(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
INT_32_T error)
|
||||
{
|
||||
pktp->pdu.std_pdu.error_status = error;
|
||||
pktp->pdu.std_pdu.error_index = vbp_to_index_error(pktp, vbp, 1);
|
||||
vbp->vb_flags |= VFLAG_NEXT_DONE;
|
||||
}
|
||||
#endif /* INSTALL_ENVOY_SNMP_UTIL_MACROS */
|
||||
|
||||
/****************************************************************************
|
||||
NAME: nextproc_next_instance
|
||||
|
||||
PURPOSE: Routine to attache a string to a var bind.
|
||||
This routine assumes that the remaining object information
|
||||
in the mib_loc structure has been filled in (done by
|
||||
find_next_object). It further assumes that the oidc pointed
|
||||
to by the remaining block is a part of the oidc in the
|
||||
vb_obj_id block. So if the new id is shorter or equal to
|
||||
the remaining oid we don't need to allocate anything
|
||||
otherwise we need to allocate space and copy the old object
|
||||
and the new instance into that space then attache it correctly
|
||||
and clean up.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * The decoded NEXT/BULK PDU
|
||||
VB_T * The var bind to attach the string to
|
||||
size_t The length of the string
|
||||
OIDC_T * The string to attach
|
||||
|
||||
RETURNS: void
|
||||
****************************************************************************/
|
||||
|
||||
void
|
||||
nextproc_next_instance(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
int sz,
|
||||
OIDC_T *oidc)
|
||||
{
|
||||
int nlen, olen;
|
||||
OIDC_T *noidc;
|
||||
OBJ_ID_T *robj;
|
||||
|
||||
if (sz == 0)
|
||||
return;
|
||||
robj = &vbp->vb_ml.ml_remaining_objid;
|
||||
olen = vbp->vb_obj_id.num_components - robj->num_components;
|
||||
nlen = olen + sz;
|
||||
if (sz > robj->num_components) {
|
||||
if ((noidc = (OIDC_T *)SNMP_memory_alloc((unsigned int)
|
||||
(nlen * sizeof(OIDC_T)))) == 0) {
|
||||
pktp->pdu.std_pdu.error_status = GEN_ERR;
|
||||
vbp->vb_flags |= VFLAG_NEXT_DONE;
|
||||
return;
|
||||
}
|
||||
MEMCPY(noidc, vbp->vb_obj_id.component_list, olen * sizeof(OIDC_T));
|
||||
Clean_Obj_ID(&vbp->vb_obj_id);
|
||||
vbp->vb_obj_id.component_list = noidc;
|
||||
robj->component_list = noidc + olen;
|
||||
}
|
||||
|
||||
MEMCPY(robj->component_list, oidc, sz * sizeof(OIDC_T));
|
||||
robj->num_components = sz;
|
||||
|
||||
vbp->vb_obj_id.num_components = nlen;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: nextproc_next_instance_string
|
||||
|
||||
PURPOSE: Routine to attach instance info to an object id,
|
||||
the instance info is in the form of a string and
|
||||
is converted to an object id on the fly.
|
||||
This routine assumes that the remaining object information
|
||||
in the mib_loc structure has been filled in (done by
|
||||
find_next_object). It further assumes that the oidc pointed
|
||||
to by the remaining block is a part of the oidc in the
|
||||
vb_obj_id block. So if the new id is shorter or equal to
|
||||
the remaining oid we don't need to allocate anything
|
||||
otherwise we need to allocate space and copy the old object
|
||||
and the new instance into that space then attache it correctly
|
||||
and clean up.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * The decoded NEXT/BULK PDU
|
||||
VB_T * The var bind to attach the string to
|
||||
ALENGTH_T The length of the string
|
||||
bits8_T * The string to attach
|
||||
int implied flag - 0 means that the string length
|
||||
should be placed in the first element
|
||||
|
||||
RETURNS: void
|
||||
****************************************************************************/
|
||||
|
||||
void
|
||||
nextproc_next_instance_string(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
ALENGTH_T str_len,
|
||||
bits8_t *str_buf,
|
||||
int imp_flag)
|
||||
{
|
||||
int nlen, olen;
|
||||
OIDC_T *noidc;
|
||||
OBJ_ID_T *robj;
|
||||
|
||||
if ((str_len == 0) && imp_flag)
|
||||
return;
|
||||
/* if we have a non-implied instance bump the str_len by 1
|
||||
for the length, don't foget to reset it before we write
|
||||
the string itself */
|
||||
if (imp_flag == 0)
|
||||
str_len++;
|
||||
robj = &vbp->vb_ml.ml_remaining_objid;
|
||||
olen = vbp->vb_obj_id.num_components - robj->num_components;
|
||||
nlen = olen + str_len;
|
||||
if ((sbits32_t)str_len > (sbits32_t)robj->num_components) {
|
||||
if ((noidc = (OIDC_T *)SNMP_memory_alloc((unsigned int)
|
||||
(nlen * sizeof(OIDC_T)))) == 0) {
|
||||
pktp->pdu.std_pdu.error_status = GEN_ERR;
|
||||
vbp->vb_flags |= VFLAG_NEXT_DONE;
|
||||
return;
|
||||
}
|
||||
MEMCPY(noidc, vbp->vb_obj_id.component_list, olen * sizeof(OIDC_T));
|
||||
Clean_Obj_ID(&vbp->vb_obj_id);
|
||||
vbp->vb_obj_id.component_list = noidc;
|
||||
robj->component_list = noidc + olen;
|
||||
}
|
||||
|
||||
noidc = robj->component_list;
|
||||
robj->num_components = str_len;
|
||||
|
||||
/* if we have a non-implied instance we reset str_len and stash
|
||||
it into the first subid */
|
||||
if (imp_flag == 0) {
|
||||
str_len--;
|
||||
*noidc++ = str_len;
|
||||
}
|
||||
|
||||
for(; str_len; str_len--, noidc++, str_buf++)
|
||||
*noidc = *str_buf;
|
||||
|
||||
vbp->vb_obj_id.num_components = nlen;
|
||||
}
|
||||
|
||||
#if !(INSTALL_ENVOY_SNMP_UTIL_MACROS)
|
||||
/****************************************************************************
|
||||
NAME: testproc_started
|
||||
|
||||
PURPOSE: Indicates that the testproc has been started for this varbind.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
testproc_started(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
vbp->vb_flags |= VFLAG_TEST_STARTED;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: testproc_good
|
||||
|
||||
PURPOSE: Indicates that the testproc has completed successfully
|
||||
for this varbind.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
testproc_good(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
vbp->vb_flags |= VFLAG_TEST_DONE;
|
||||
}
|
||||
#endif /* INSTALL_ENVOY_SNMP_UTIL_MACROS */
|
||||
|
||||
/****************************************************************************
|
||||
NAME: testproc_error
|
||||
|
||||
PURPOSE: Install a test type error into the packet structure.
|
||||
|
||||
As there is a different ordering of some errors
|
||||
in version 1 vs version 2 we try to handle that
|
||||
here. The customer may try to overwrite the error
|
||||
status. We allow for the overwrite if:
|
||||
packet type current status new status
|
||||
version 1 any value no_such_name
|
||||
no_creation
|
||||
version 2 no_such_name bad_value
|
||||
no_creation wrong_length
|
||||
wrong_value
|
||||
|
||||
rfc1905 section 4.2.5
|
||||
step 6 is the check for WRONG_VALUE which maps to BAD_VALUE
|
||||
step 7 is the check for NO_CREATION which maps to NO_SUCH_NAME
|
||||
|
||||
rfc1157 section 4.1.5
|
||||
step 1 is the view check which results in NO_SUCH_NAME
|
||||
step 2 is the check for BAD_VALUE
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * The decoded PDU
|
||||
VB_T * A var bind
|
||||
sbits32_t the error code
|
||||
|
||||
RETURNS: void
|
||||
****************************************************************************/
|
||||
void
|
||||
testproc_error(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
sbits32_t err_code)
|
||||
{
|
||||
/* mark the varbind as done */
|
||||
vbp->vb_flags |= VFLAG_TEST_DONE;
|
||||
|
||||
if (pktp->pdu.std_pdu.error_status) {
|
||||
if (pktp->snmp_version == SNMP_VERSION_1) {
|
||||
if ((err_code != NO_CREATION) && (err_code != NO_SUCH_NAME))
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (((pktp->pdu.std_pdu.error_status != NO_SUCH_NAME) &&
|
||||
(pktp->pdu.std_pdu.error_status != NO_CREATION)) ||
|
||||
((err_code != BAD_VALUE) && (err_code != WRONG_LENGTH) &&
|
||||
(err_code != WRONG_VALUE)))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
pktp->pdu.std_pdu.error_status = err_code;
|
||||
pktp->pdu.std_pdu.error_index = vbp_to_index(pktp, vbp) + 1;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: testproc_tproc_error
|
||||
|
||||
PURPOSE: Routine to translate a tproc style error to a standard error
|
||||
and attach the result to the packet structure. If error is
|
||||
> 0, then we have a bad value error and we use error as the
|
||||
vbp index. Otherwise we work out what the correct error is
|
||||
and use the given vb_t for the index (if necessary).
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * The decoded NEXT/BULK PDU
|
||||
VB_T * A var bind
|
||||
int the tproc style error
|
||||
|
||||
RETURNS: void
|
||||
****************************************************************************/
|
||||
void
|
||||
testproc_tproc_error(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
int err_code)
|
||||
{
|
||||
INT_32_T ecode;
|
||||
|
||||
if (err_code > 0) {
|
||||
pktp->pdu.std_pdu.error_status = BAD_VALUE;
|
||||
pktp->pdu.std_pdu.error_index = (INT_32_T)err_code;
|
||||
vbp->vb_flags |= VFLAG_TEST_DONE;
|
||||
return;
|
||||
}
|
||||
|
||||
switch(err_code) {
|
||||
case TPROC_READ_ONLY:
|
||||
case TPROC_NOSUCH:
|
||||
ecode = NO_SUCH_NAME;
|
||||
break;
|
||||
default:
|
||||
case TPROC_GENERR:
|
||||
ecode = GEN_ERR;
|
||||
break;
|
||||
case TPROC_BADVALUE:
|
||||
ecode = BAD_VALUE;
|
||||
break;
|
||||
case TPROC_TOO_BIG:
|
||||
ecode = TOO_BIG;
|
||||
break;
|
||||
case TPROC_LAST_ERROR:
|
||||
/* don't need to do anything, they are already in the packet */
|
||||
vbp->vb_flags |= VFLAG_TEST_DONE;
|
||||
return;
|
||||
/* For the following cases the return code is the negative of the */
|
||||
/* true (snmp) error code so we set the status to be the */
|
||||
/* negative of the err_code. */
|
||||
case TPROC_NO_ACCESS:
|
||||
case TPROC_NO_CREATION:
|
||||
case TPROC_WRONG_TYPE:
|
||||
case TPROC_WRONG_LENGTH:
|
||||
case TPROC_WRONG_ENCODING:
|
||||
case TPROC_WRONG_VALUE:
|
||||
case TPROC_INCONSISTENT_VALUE:
|
||||
case TPROC_RESOURCE_UNAVAILABLE:
|
||||
case TPROC_COMMIT_FAILED:
|
||||
case TPROC_UNDO_FAILED:
|
||||
case TPROC_AUTHORIZATION_ERROR:
|
||||
case TPROC_NOT_WRITABLE:
|
||||
case TPROC_INCONSISTENT_NAME:
|
||||
ecode = (INT_32_T)(-err_code);
|
||||
break;
|
||||
}
|
||||
|
||||
pktp->pdu.std_pdu.error_status = ecode;
|
||||
pktp->pdu.std_pdu.error_index = vbp_to_index(pktp, vbp) + 1;
|
||||
vbp->vb_flags |= VFLAG_TEST_DONE;
|
||||
}
|
||||
|
||||
#if !(INSTALL_ENVOY_SNMP_UTIL_MACROS)
|
||||
/****************************************************************************
|
||||
NAME: setproc_started
|
||||
|
||||
PURPOSE: Indicates that the setproc has been started for this varbind.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
setproc_started(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
vbp->vb_flags |= VFLAG_SET_STARTED;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: setproc_good
|
||||
|
||||
PURPOSE: Indicates that the setproc has complete successfully
|
||||
for this varbind.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
setproc_good(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
vbp->vb_flags |= VFLAG_SET_DONE;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: setproc_error
|
||||
|
||||
PURPOSE: Indicates that the setproc has encountered an error.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
INT_32_T error code
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
setproc_error(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
INT_32_T error)
|
||||
{
|
||||
pktp->pdu.std_pdu.error_status = error;
|
||||
pktp->pdu.std_pdu.error_index = vbp_to_index_error(pktp, vbp, 1);
|
||||
vbp->vb_flags |= VFLAG_SET_DONE;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: undoproc_started
|
||||
|
||||
PURPOSE: Indicates that an undoproc operation has begun.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
undoproc_started(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
vbp->vb_flags |= VFLAG_UNDO_STARTED;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: undoproc_good
|
||||
|
||||
PURPOSE: Indicates successful completion of an undoproc operation.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
undoproc_good(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
vbp->vb_flags |= VFLAG_UNDO_DONE;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: undoproc_error
|
||||
|
||||
PURPOSE: Indicates that an undoproc operation encountered an error.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
INT_32_T error code
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
undoproc_error(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
INT_32_T error)
|
||||
{
|
||||
pktp->pdu.std_pdu.error_status = error;
|
||||
pktp->pdu.std_pdu.error_index = 0;
|
||||
vbp->vb_flags |= VFLAG_UNDO_DONE;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: getproc_got_int32
|
||||
|
||||
PURPOSE: Called from a getproc or nextproc when a 32-bit integer
|
||||
value is retrieved for a varbind.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
INT_32_T 32-bit integer value for varbind
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
getproc_got_int32(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
INT_32_T data)
|
||||
{
|
||||
vbp->vb_data_flags_n_type = VT_NUMBER;
|
||||
vbp->value_u.v_number = data;
|
||||
vbp->vb_flags |= VFLAG_GET_DONE;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: getproc_got_uint32
|
||||
|
||||
PURPOSE: Called from a getproc or nextproc when a 32-bit unsigned
|
||||
integer value is retrieved for a varbind.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
INT_32_T unsigned 32-bit integer value for varbind
|
||||
OCTET_T SNMP type of value
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
getproc_got_uint32(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
UINT_32_T data,
|
||||
OCTET_T type)
|
||||
{
|
||||
vbp->vb_data_flags_n_type = type;
|
||||
vbp->value_u.v_counter = data;
|
||||
vbp->vb_flags |= VFLAG_GET_DONE;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: getproc_got_ip_address
|
||||
|
||||
PURPOSE: Called from a getproc or nextproc when an IP address
|
||||
is retrieved for a varbind.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
UINT_32_T IP address value
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
getproc_got_ip_address(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
UINT_32_T data)
|
||||
{
|
||||
vbp->vb_data_flags_n_type = VT_IPADDRESS;
|
||||
MEMCPY(&(vbp->value_u.v_network_address), &data, 4);
|
||||
vbp->vb_flags |= VFLAG_GET_DONE;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: getproc_got_empty
|
||||
|
||||
PURPOSE: Called from a getproc or nextproc to indicate retrieval
|
||||
of a null value for a varbind.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
getproc_got_empty(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
vbp->vb_data_flags_n_type = VT_EMPTY;
|
||||
vbp->vb_flags |= VFLAG_GET_DONE;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: getproc_got_string
|
||||
|
||||
PURPOSE: Called from a getproc or nextproc when an octet string
|
||||
is retrieved for a varbind. The string data is stored in
|
||||
an EBuffer in the varbind. The parameter <dynamic> indicates
|
||||
the storage type. If non-zero, the buffer is assumed to
|
||||
have been allocated dynamically and will be freed later.
|
||||
Otherwise, the buffer is assumed to be static.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
ALENGTH_T size of string in octets
|
||||
OCTET_T * string data
|
||||
int storage type - dynamic or static
|
||||
OCTET_T SNMP type of string data
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
getproc_got_string(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
ALENGTH_T stringlen,
|
||||
OCTET_T *string,
|
||||
int dynamic,
|
||||
OCTET_T type)
|
||||
{
|
||||
vbp->vb_data_flags_n_type = type;
|
||||
vbp->vb_flags |= VFLAG_GET_DONE;
|
||||
EBufferPreLoad(dynamic ? BFL_IS_DYNAMIC : BFL_IS_STATIC,
|
||||
&(vbp->value_u.v_string), string, stringlen);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: getproc_got_octet_string
|
||||
|
||||
PURPOSE: Called from a getproc or nextproc when an octet string
|
||||
is retrieved for a varbind. The string data is stored in
|
||||
an EBuffer in the varbind.
|
||||
|
||||
NOTE: This function is intended as an alternative to
|
||||
getproc_got_string(). It will always allocate a buffer to
|
||||
store the data, which prevents problems such as static
|
||||
buffer reuse for getbulks.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
ALENGTH_T size of string in octets
|
||||
OCTET_T * string data
|
||||
OCTET_T SNMP type of string data
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
getproc_got_octet_string(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
ALENGTH_T stringlen,
|
||||
OCTET_T *string,
|
||||
OCTET_T type)
|
||||
{
|
||||
vbp->vb_data_flags_n_type = type;
|
||||
vbp->vb_flags |= VFLAG_GET_DONE;
|
||||
EBufferAllocateLoad(BFL_IS_ALLOC, &(vbp->value_u.v_string), string, stringlen);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: getproc_got_uint64
|
||||
|
||||
PURPOSE: Called from a getproc or nextproc when an 64-bit unsigned
|
||||
integer is retrieved for a varbind.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
UINT_64_T * 64-bit unsigned value
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
getproc_got_uint64(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
UINT_64_T *data)
|
||||
{
|
||||
vbp->vb_data_flags_n_type = VT_COUNTER64;
|
||||
vbp->value_u.v_counter64.high = data->high;
|
||||
vbp->value_u.v_counter64.low = data->low;
|
||||
vbp->vb_flags |= VFLAG_GET_DONE;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: getproc_got_uint64_high_low
|
||||
|
||||
PURPOSE: Called from a getproc or nextproc when an 64-bit unsigned
|
||||
integer with high and low halves is retrieved for a varbind.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * the SNMP packet
|
||||
VB_T * the varbind being processed
|
||||
UINT_32_T high half of data
|
||||
UINT_32_T low half of data
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
getproc_got_uint64_high_low(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
UINT_32_T high,
|
||||
UINT_32_T low)
|
||||
{
|
||||
vbp->vb_data_flags_n_type = VT_COUNTER64;
|
||||
vbp->value_u.v_counter64.high = high;
|
||||
vbp->value_u.v_counter64.low = low;
|
||||
vbp->vb_flags |= VFLAG_GET_DONE;
|
||||
}
|
||||
|
||||
#endif /* INSTALL_ENVOY_SNMP_UTIL_MACROS */
|
||||
@@ -0,0 +1,389 @@
|
||||
/* ax_chunk.c - ax_chunk.c routines */
|
||||
|
||||
/*
|
||||
* Copyright 2000-2010 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 1994-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: ax_chunk.c,v $
|
||||
* Revision 1.4 2001/11/06 21:50:42 josh
|
||||
* second (and hopefully final) pass of new path hacking
|
||||
*
|
||||
* Revision 1.3 2001/11/06 21:20:01 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.2 2001/11/06 20:11:12 josh
|
||||
* updating include paths to include proper path to layout directory
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:41 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:22:15 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:18:51 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:10:47 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/08/01 17:38:15 sar
|
||||
* When adding to an already started buffer use ebuffernext instead
|
||||
* of ebufferstart to get the pointer to the proper space.
|
||||
*
|
||||
* Revision 8.2 1998/06/19 20:13:46 sar
|
||||
* make sure all files include asn1conf.h and snmp.h to pick up all of
|
||||
* the common code
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:06 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:36 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 1.3 1997/10/30 04:21:30 sar
|
||||
* Clean up some type information, convert a number of bits16_ts to ALENGTH_Ts,
|
||||
* also add use of MAX_ALENGTH instead of using a number
|
||||
*
|
||||
* Revision 1.2 1997/10/29 04:11:44 sar
|
||||
* Cleaned up some type mismatches to keep compilers happy
|
||||
*
|
||||
* Revision 1.1 1997/10/16 00:32:32 sar
|
||||
* The base files for the agentx protocol.
|
||||
* ax_core.c - core encoding and decoding routines, both master and sub
|
||||
* ax_chunk.c - transform a byte stream into agentx packets, both
|
||||
* ax_index.c - support for the index reservation scheme, master
|
||||
* ax_ma.c - master side routines, master
|
||||
* ax_mth.c - method routines for the agentx mib, master
|
||||
* ax_sa.c - sub agent side routines, sub
|
||||
* ax_sa_cr.c - packet creation code, mostly will be used on sub
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01e,15jun10,y_t update for LP64
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains ax_chunk.c routines.
|
||||
|
||||
INCLUDE FILES: snmp.h, agentx.h
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1conf.h>
|
||||
#include <wrn/wm/snmp/engine/agentx.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/objectid.h>
|
||||
#include <wrn/wm/snmp/engine/tree.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
|
||||
#include <wrn/wm/util/layout/ldbglue.h>
|
||||
#include <wrn/wm/util/layout/agentx.h>
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* envoy_ax_chunk_init - initialize <chunk> to a known empty state
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* void envoy_ax_chunk_init
|
||||
* (
|
||||
* ENVOY_AX_CHUNK_T * chunk
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine initializes <chunk> to a known empty state. It is your
|
||||
* responsibility to allocate <chunk>.
|
||||
*
|
||||
* \&NOTE: If you run AgentX over a stream based transport layer, you can use
|
||||
* this routine to convert to packets for use with the Envoy AgentX API.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <*chunk>
|
||||
* Specify the structure that holds the incoming information. Envoy uses this
|
||||
* structure to hold data from a stream until a full packet has been collected.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: None.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: envoy_ax_chunk_clean(), envoy_ax_chunk_handler()
|
||||
*/
|
||||
void
|
||||
envoy_ax_chunk_init(ENVOY_AX_CHUNK_T *chunk)
|
||||
{
|
||||
EBufferInitialize(&chunk->chunk);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* envoy_ax_chunk_clean - free any resources associated with <chunk>
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int envoy_ax_chunk_clean
|
||||
* (
|
||||
* ENVOY_AX_CHUNK_T * chunk
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine frees any resources associated with <chunk>.
|
||||
*
|
||||
* \&NOTE: If you run AgentX over a stream based transport layer, you can use
|
||||
* this routine to convert to packets for use with the Envoy AgentX API.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <*chunk>
|
||||
* Specify the structure that holds the incoming information. Envoy uses this
|
||||
* structure to hold data from a stream until a full packet has been collected.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If the packet did not need to be cleaned, this routine returns 0. If
|
||||
* this routine actually freed some memory, it returns 1.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: envoy_ax_chunk_handler(), envoy_ax_chunk_init()
|
||||
*/
|
||||
int
|
||||
envoy_ax_chunk_clean(ENVOY_AX_CHUNK_T *chunk)
|
||||
{
|
||||
if (EBufferStart(&chunk->chunk)) {
|
||||
EBufferClean(&chunk->chunk);
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* envoy_ax_chunk_handler - assemble bytes from a byte stream into a packet buffer
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int envoy_ax_chunk_handler
|
||||
* (
|
||||
* bits8_t * pkt_str,
|
||||
* ALENGTH_T pkt_len,
|
||||
* ENVOY_AX_HANDLER_T * handler,
|
||||
* ENVOY_AX_CHUNK_T * chunk,
|
||||
* ENVOY_AX_SA_SB_T * sasb,
|
||||
* ENVOY_AX_ADMIN_T * admin_rtn,
|
||||
* ENVOY_AX_SEND_T * send_rtn,
|
||||
* ENVOY_AX_ERROR_T * error_rtn,
|
||||
* ENVOY_AX_ADD_T * add_rtn,
|
||||
* ptr_t send_cookie
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine assembles bytes from a byte stream into a packet buffer and
|
||||
* calls the AgentX packet handler. This routine passes <sasb>, <admin_rtn>,
|
||||
* <send_rtn>, <error_rtn>, and <send_cookie> directly to the handler.
|
||||
*
|
||||
* \&NOTE: If you run AgentX over a stream based transport layer, you can use
|
||||
* this routine to convert to packets for use with the Envoy AgentX API.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <*pkt_str>
|
||||
* Specify an incoming message buffer to add to the contents of <chunk> and
|
||||
* process.
|
||||
* \i <pkt_len>
|
||||
* Specify the length in bytes of <pkt_str>.
|
||||
* \i <*handler>
|
||||
* Specify either the subagent handler, envoy_ax_sa_handler(), or the master
|
||||
* agent handler, envoy_ax_ma_handler().
|
||||
* \i <*chunk>
|
||||
* Specify the structure that holds the incoming information. Envoy uses this
|
||||
* structure to hold data from a stream until a full packet has been collected.
|
||||
* \i <*sasb>
|
||||
* Specify the subagent state block associated with this subagent. This value
|
||||
* should be 0 for master agents.
|
||||
* \i <*admin_rtn>
|
||||
* Specify a customer-provided routine that is called when an 'OPEN' PDU
|
||||
* establishes that the session is open or when an AgentX 'TRAP' PDU is
|
||||
* received.
|
||||
* \i <*send_rtn>
|
||||
* Specify a customer-provided routine that is called to send packets.
|
||||
* \i <*error_rtn>
|
||||
* Specify a customer-provided routine that is called to handle errors.
|
||||
* \i <*add_rtn>
|
||||
* Specify a customer-provided routine that is called to update the reference
|
||||
* counter. <add_rtn> is called once for each call to the handler.
|
||||
* \i <send_cookie>
|
||||
* Specify the cookie, which might contain an address for UDP or a pointer to a
|
||||
* TCP block.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If successful, this routine returns 0. Otherwise, it returns 1.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: envoy_ax_chunk_clean(), envoy_ax_chunk_init(),
|
||||
* envoy_ax_ma_handler(), envoy_ax_sa_handler(), ENVOY_AX_ADD_T(),
|
||||
* ENVOY_AX_ADMIN_T(), ENVOY_AX_ERROR_T(), ENVOY_AX_SEND_T()
|
||||
*/
|
||||
int
|
||||
envoy_ax_chunk_handler(bits8_t * pkt_str,
|
||||
ALENGTH_T pkt_len,
|
||||
ENVOY_AX_HANDLER_T * handler,
|
||||
ENVOY_AX_CHUNK_T * chunk,
|
||||
ENVOY_AX_SA_SB_T * sb,
|
||||
ENVOY_AX_ADMIN_T * admin_rtn,
|
||||
ENVOY_AX_SEND_T * send_rtn,
|
||||
ENVOY_AX_ERROR_T * error_rtn,
|
||||
ENVOY_AX_ADD_T * add_rtn,
|
||||
ptr_t send_cookie)
|
||||
{
|
||||
bits32_t tneed;
|
||||
ALENGTH_T eused, need;
|
||||
bits8_t *bufp;
|
||||
EBUFFER_T *ebp = &chunk->chunk;
|
||||
|
||||
while(pkt_len) {
|
||||
eused = EBufferUsed(ebp);
|
||||
|
||||
if (eused == 0) {
|
||||
/* no bytes from a previous call
|
||||
we default need to size of an agentx header then
|
||||
we check the size of the packet if its longer than
|
||||
the header we dig out the encoded size of the packet.
|
||||
if we have the entire packet we call the handler
|
||||
then adjust the packet info and continue in case
|
||||
we have another packet
|
||||
if not we allocate space for the packet - either
|
||||
for the header or for the entire packet if we
|
||||
know how long it is. */
|
||||
|
||||
tneed = need = SIZEOF_AGENTX_PDU;
|
||||
|
||||
if (pkt_len >= SIZEOF_AGENTX_PDU) {
|
||||
/* we have the entire header at least */
|
||||
if ((GET_AGENTX_PDU_FLAGS(pkt_str)) & ENVOY_AX_BIT_BYTE_ORDER)
|
||||
tneed += GET_AGENTX_PDU_PAYLOAD_LEN_B(pkt_str);
|
||||
else
|
||||
tneed += GET_AGENTX_PDU_PAYLOAD_LEN_L(pkt_str);
|
||||
|
||||
if (tneed > MAX_ALENGTH)
|
||||
return(1);
|
||||
need = (ALENGTH_T)(tneed & MAX_ALENGTH);
|
||||
|
||||
if (need <= pkt_len) {
|
||||
add_rtn(send_cookie);
|
||||
handler(pkt_str, pkt_len, sb, admin_rtn,
|
||||
send_rtn, error_rtn, send_cookie);
|
||||
pkt_len = (ALENGTH_T)(pkt_len - need);
|
||||
pkt_str += need;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
bufp = (bits8_t *)SNMP_memory_alloc(need);
|
||||
if (bufp == 0)
|
||||
return(1);
|
||||
add_rtn(send_cookie);
|
||||
EBufferSetup(BFL_IS_DYNAMIC, ebp, bufp, need);
|
||||
MEMCPY(bufp, pkt_str, pkt_len);
|
||||
EBufferSeek(ebp, pkt_len, 1);
|
||||
return(0);
|
||||
}
|
||||
else {
|
||||
/* we have bytes from some previous call.
|
||||
we first figure out what we previously allocated
|
||||
if it was just space for the header we try to fill
|
||||
it up, if we can do so we work out the full packet
|
||||
size and allocate space for it.
|
||||
if we already know the full packet size we copy
|
||||
bytes until we fill up that size then call the handler
|
||||
routine */
|
||||
|
||||
if ((EBufferUsed(ebp) + EBufferRemaining(ebp)) == SIZEOF_AGENTX_PDU) {
|
||||
if ((eused + pkt_len) < SIZEOF_AGENTX_PDU) {
|
||||
MEMCPY(EBufferNext(ebp), pkt_str, pkt_len);
|
||||
EBufferSeek(ebp, pkt_len, 1);
|
||||
return(0);
|
||||
}
|
||||
else {
|
||||
need = EBufferRemaining(ebp);
|
||||
MEMCPY(EBufferNext(ebp), pkt_str, need);
|
||||
pkt_len = (ALENGTH_T)(pkt_len - need);
|
||||
pkt_str += need;
|
||||
bufp = EBufferStart(ebp);
|
||||
|
||||
tneed = SIZEOF_AGENTX_PDU;
|
||||
if ((GET_AGENTX_PDU_FLAGS(bufp)) & ENVOY_AX_BIT_BYTE_ORDER)
|
||||
tneed += GET_AGENTX_PDU_PAYLOAD_LEN_B(bufp);
|
||||
else
|
||||
tneed += GET_AGENTX_PDU_PAYLOAD_LEN_L(bufp);
|
||||
|
||||
if (tneed > MAX_ALENGTH) {
|
||||
EBufferClean(ebp);
|
||||
return(1);
|
||||
}
|
||||
need = (ALENGTH_T)(tneed & MAX_ALENGTH);
|
||||
|
||||
bufp = (bits8_t *)SNMP_memory_alloc(need);
|
||||
if (bufp == 0) {
|
||||
EBufferClean(ebp);
|
||||
return(1);
|
||||
}
|
||||
MEMCPY(bufp, EBufferStart(ebp), SIZEOF_AGENTX_PDU);
|
||||
EBufferClean(ebp);
|
||||
EBufferSetup(BFL_IS_DYNAMIC, ebp, bufp, need);
|
||||
EBufferSeek(ebp, SIZEOF_AGENTX_PDU, 1);
|
||||
}
|
||||
}
|
||||
|
||||
need = EBufferRemaining(ebp);
|
||||
if (pkt_len >= need) {
|
||||
MEMCPY(EBufferNext(ebp), pkt_str, need);
|
||||
pkt_len = (ALENGTH_T)(pkt_len - need);
|
||||
pkt_str += need;
|
||||
|
||||
add_rtn(send_cookie);
|
||||
handler(EBufferStart(ebp), (ALENGTH_T)(EBufferUsed(ebp) + need),
|
||||
sb, admin_rtn, send_rtn, error_rtn, send_cookie);
|
||||
|
||||
EBufferClean(ebp);
|
||||
error_rtn(send_cookie, 0);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
MEMCPY(EBufferNext(ebp), pkt_str, pkt_len);
|
||||
EBufferSeek(ebp, pkt_len, 1);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,806 @@
|
||||
/*
|
||||
* Copyright 2000-2010, 2013 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 1994-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: ax_index.c,v $
|
||||
* Revision 1.4 2001/11/06 21:50:43 josh
|
||||
* second (and hopefully final) pass of new path hacking
|
||||
*
|
||||
* Revision 1.3 2001/11/06 21:20:02 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.2 2001/11/06 20:11:13 josh
|
||||
* updating include paths to include proper path to layout directory
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:41 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/04/11 20:12:01 josh
|
||||
* merging changes from the kingfisher branch back onto
|
||||
* the trunk
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:22:16 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1.2.2 2001/03/12 22:08:07 tneale
|
||||
* Updated copyright
|
||||
*
|
||||
* Revision 9.1.2.1 2000/10/13 21:17:34 josh
|
||||
* function prototypes and static declarations to eliminate warnings
|
||||
* from the Tornado compiler
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:18:52 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:10:50 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:07:06 sar
|
||||
* Save a pointer to the index data when building an entry
|
||||
* Add incudes for asn1conf and snmp to make sure we get all
|
||||
* of the common stuff.
|
||||
*
|
||||
* Revision 8.2 1998/06/09 21:46:40 sar
|
||||
* Cleaned up some code that might have called alloc or memcmp with
|
||||
* 0 lenght strings
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:12 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:37 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 1.5 1997/10/31 03:48:04 sar
|
||||
* cleanup index comparisons and allocation of unused indexes
|
||||
*
|
||||
* Revision 1.4 1997/10/22 23:46:55 sar
|
||||
* initialize the right stat variable
|
||||
*
|
||||
* Revision 1.3 1997/10/22 17:12:37 sar
|
||||
* initialize a variable (stat) to keep compilers happy
|
||||
*
|
||||
* Revision 1.2 1997/10/18 01:51:38 sar
|
||||
* several changes, moslty dealing with getting the comparisons to
|
||||
* be correct, also getting the linked list correct and making sure
|
||||
* we always set the session id for new entries.
|
||||
*
|
||||
* Revision 1.1 1997/10/16 00:32:32 sar
|
||||
* The base files for the agentx protocol.
|
||||
* ax_core.c - core encoding and decoding routines, both master and sub
|
||||
* ax_chunk.c - transform a byte stream into agentx packets, both
|
||||
* ax_index.c - support for the index reservation scheme, master
|
||||
* ax_ma.c - master side routines, master
|
||||
* ax_mth.c - method routines for the agentx mib, master
|
||||
* ax_sa.c - sub agent side routines, sub
|
||||
* ax_sa_cr.c - packet creation code, mostly will be used on sub
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01g,06aug13,bbz clear the med impact warning from prevent.pl(WIND00429583)
|
||||
01f,18jun13,bbz clear the high impact warning from prevent.pl(WIND00421415)
|
||||
01e,08may13,bbz clear the high impact warning from prevent.pl(WIND00416598)
|
||||
01d,15jun10,y_t update for LP64
|
||||
01c,03aug09,y_t fix for coverity
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1conf.h>
|
||||
#include <wrn/wm/snmp/engine/agentx.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/objectid.h>
|
||||
#include <wrn/wm/snmp/engine/tree.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
|
||||
#include <wrn/wm/util/layout/ldbglue.h>
|
||||
#include <wrn/wm/util/layout/agentx.h>
|
||||
|
||||
/****************************************************************************
|
||||
NAME: ax_ma_compare_indexes
|
||||
|
||||
PURPOSE: compare an the value from a vbp with the value from
|
||||
an index structure, this returns -1, 0 or 1 as the
|
||||
vbp is less than, equal to or greater than the index.
|
||||
notice that we don't use the standard lexicographical
|
||||
order instead we order all strings or object ids of
|
||||
length n as less than strings or objects ids of length n+1
|
||||
we do this to allow the ordering of the list to make it
|
||||
easy to find a short next index for "new" requests.
|
||||
|
||||
PARAMETERS: int if 0 use the vbp as first index,
|
||||
otherwise use the first ax_index
|
||||
VB_T * if flag is 0 the first index
|
||||
ENVOY_AX_INDEX_DATA_T * if flag is !0 the first index
|
||||
ENVOY_AX_INDEX_DATA_T * the second index
|
||||
|
||||
RETURNS: int -1 first index less than second, 0 = equal, 1 greater than
|
||||
****************************************************************************/
|
||||
static int
|
||||
ax_ma_compare_indexes(int first_flag,
|
||||
VB_T *vbp,
|
||||
ENVOY_AX_INDEX_DATA_T *first_idata,
|
||||
ENVOY_AX_INDEX_DATA_T *second_idata)
|
||||
{
|
||||
bits32_t bits32_value;
|
||||
ALENGTH_T vlen;
|
||||
bits8_t *vbuf, *ibuf;
|
||||
int vlen2;
|
||||
OIDC_T *voidc, *ioidc;
|
||||
|
||||
switch(vbp->vb_data_flags_n_type) {
|
||||
case VT_NUMBER:
|
||||
if (first_flag == 0)
|
||||
bits32_value = vbp->value_u.v_number;
|
||||
else
|
||||
bits32_value = first_idata->data.bits32;
|
||||
|
||||
if (bits32_value < second_idata->data.bits32)
|
||||
return(-1);
|
||||
if (bits32_value == second_idata->data.bits32)
|
||||
return(0);
|
||||
return(1);
|
||||
|
||||
case VT_STRING:
|
||||
if (first_flag == 0) {
|
||||
vlen = EBufferUsed(&vbp->value_u.v_string);
|
||||
vbuf = EBufferStart(&vbp->value_u.v_string);
|
||||
}
|
||||
else {
|
||||
vlen = first_idata->data.string.length;
|
||||
vbuf = first_idata->data.string.buffer;
|
||||
}
|
||||
|
||||
if (vlen < second_idata->data.string.length)
|
||||
return(-1);
|
||||
if (vlen > second_idata->data.string.length)
|
||||
return(1);
|
||||
ibuf = second_idata->data.string.buffer;
|
||||
for(; vlen; vlen--, vbuf++, ibuf++) {
|
||||
if (*vbuf < *ibuf)
|
||||
return(-1);
|
||||
if (*vbuf > *ibuf)
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
|
||||
case VT_OBJECT:
|
||||
if (first_flag == 0) {
|
||||
vlen2 = vbp->value_u.v_object.num_components;
|
||||
voidc = vbp->value_u.v_object.component_list;
|
||||
}
|
||||
else {
|
||||
vlen2 = first_idata->data.objid.num_components;
|
||||
voidc = first_idata->data.objid.component_list;
|
||||
}
|
||||
|
||||
if (vlen2 < second_idata->data.objid.num_components)
|
||||
return(-1);
|
||||
if (vlen2 > second_idata->data.objid.num_components)
|
||||
return(1);
|
||||
ioidc = second_idata->data.objid.component_list;
|
||||
for(; vlen2; vlen2--, voidc++, ioidc++) {
|
||||
if (*voidc < *ioidc)
|
||||
return(-1);
|
||||
if (*voidc > *ioidc)
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
|
||||
case VT_IPADDRESS:
|
||||
vlen = 4;
|
||||
if (first_flag == 0)
|
||||
vbuf = (bits8_t *)&vbp->value_u.v_network_address;
|
||||
else
|
||||
vbuf = first_idata->data.ipaddr;
|
||||
|
||||
ibuf = second_idata->data.ipaddr;
|
||||
for(; vlen; vlen--, vbuf++, ibuf++) {
|
||||
if (*vbuf < *ibuf)
|
||||
return(-1);
|
||||
if (*vbuf > *ibuf)
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*should never get here */
|
||||
return(1);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: ax_ma_build_new_index
|
||||
|
||||
PURPOSE: determine that the next new instance is and try to build
|
||||
an index entry using that instance.
|
||||
|
||||
PARAMETERS: ENVOY_AX_INDEX_HDR_T * header for the list
|
||||
VB_T * var bind with the information on the index
|
||||
|
||||
RETURNS: ENVOY_AX_INDEX_DATA_T *
|
||||
****************************************************************************/
|
||||
static ENVOY_AX_INDEX_DATA_T *
|
||||
ax_ma_build_new_index(ENVOY_AX_INDEX_HDR_T *ihdr,
|
||||
VB_T *vbp)
|
||||
{
|
||||
ENVOY_AX_INDEX_DATA_T *idata = 0, **idatap = 0;
|
||||
int stat;
|
||||
OIDC_T *oidc, *oidc2;
|
||||
bits8_t *buf;
|
||||
|
||||
idata = (ENVOY_AX_INDEX_DATA_T *)
|
||||
SNMP_memory_alloc(sizeof(ENVOY_AX_INDEX_DATA_T));
|
||||
if (idata == 0)
|
||||
return(0);
|
||||
switch(vbp->vb_data_flags_n_type) {
|
||||
case VT_NUMBER:
|
||||
for (idata->data.bits32 = 1, idatap = &ihdr->data;
|
||||
*idatap;
|
||||
idatap = &(*idatap)->next) {
|
||||
stat = ax_ma_compare_indexes(1, vbp, idata, *idatap);
|
||||
if (stat == -1)
|
||||
break;
|
||||
if (stat == 1)
|
||||
continue;
|
||||
if (++idata->data.bits32)
|
||||
continue;
|
||||
|
||||
SNMP_memory_free(idata);
|
||||
return(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case VT_IPADDRESS:
|
||||
buf = idata->data.ipaddr;
|
||||
buf[0] = buf[1] = buf[2] = 0;
|
||||
for (buf[3] = 1, idatap = &ihdr->data;
|
||||
*idatap;
|
||||
idatap = &(*idatap)->next) {
|
||||
stat = ax_ma_compare_indexes(1, vbp, idata, *idatap);
|
||||
if (stat == -1)
|
||||
break;
|
||||
if (stat == 1)
|
||||
continue;
|
||||
if (++buf[3] != 0) continue;
|
||||
if (++buf[2] != 0) continue;
|
||||
if (++buf[1] != 0) continue;
|
||||
if (++buf[0] != 0) continue;
|
||||
|
||||
SNMP_memory_free(idata);
|
||||
return(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case VT_STRING:
|
||||
buf = SNMP_memory_alloc(4);
|
||||
if (buf == 0) {
|
||||
SNMP_memory_free(idata);
|
||||
return(0);
|
||||
}
|
||||
idata->data.string.length = 4;
|
||||
idata->data.string.buffer = buf;
|
||||
buf[0] = buf[1] = buf[2] = 0;
|
||||
for (buf[3] = 1, idatap = &ihdr->data;
|
||||
*idatap;
|
||||
idatap = &(*idatap)->next) {
|
||||
stat = ax_ma_compare_indexes(1, vbp, idata, *idatap);
|
||||
if (stat == -1)
|
||||
break;
|
||||
if (stat == 1)
|
||||
continue;
|
||||
if (++buf[3] != 0) continue;
|
||||
if (++buf[2] != 0) continue;
|
||||
if (++buf[1] != 0) continue;
|
||||
if (++buf[0] != 0) continue;
|
||||
|
||||
SNMP_memory_free(buf);
|
||||
SNMP_memory_free(idata);
|
||||
return(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case VT_OBJECT:
|
||||
oidc = (OIDC_T *)SNMP_memory_alloc(sizeof(OIDC_T) * 2);
|
||||
if (oidc == 0) {
|
||||
SNMP_memory_free(idata);
|
||||
return(0);
|
||||
}
|
||||
|
||||
idata->data.objid.num_components = 2;
|
||||
idata->data.objid.component_list = oidc;
|
||||
*oidc = 1;
|
||||
oidc2 = oidc+1;
|
||||
|
||||
for (*oidc2 = 1, idatap = &ihdr->data;
|
||||
*idatap;
|
||||
idatap = &(*idatap)->next) {
|
||||
stat = ax_ma_compare_indexes(1, vbp, idata, *idatap);
|
||||
if (stat == -1)
|
||||
break;
|
||||
if (stat == 1)
|
||||
continue;
|
||||
(*oidc2)++;
|
||||
if (*oidc2)
|
||||
continue;
|
||||
|
||||
SNMP_memory_free(oidc);
|
||||
SNMP_memory_free(idata);
|
||||
return(0);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (idatap != 0) {
|
||||
idata->next = *idatap;
|
||||
*idatap = idata;
|
||||
} else {
|
||||
SNMP_memory_free(idata);
|
||||
return(0);
|
||||
}
|
||||
return(idata);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: ax_ma_find_index
|
||||
|
||||
PURPOSE: find an index in the list
|
||||
|
||||
PARAMETERS: ENVOY_AX_INDEX_DATA_T * first entry in the list
|
||||
VB_T * var bind with the information on the index
|
||||
|
||||
RETURNS: ENVOY_AX_INDEX_DATA_T *
|
||||
****************************************************************************/
|
||||
static ENVOY_AX_INDEX_DATA_T *
|
||||
ax_ma_find_index(ENVOY_AX_INDEX_DATA_T *first,
|
||||
VB_T *vbp,
|
||||
bits32_t session_id)
|
||||
{
|
||||
ENVOY_AX_INDEX_DATA_T *idata;
|
||||
|
||||
for (idata = first; idata; idata = idata->next) {
|
||||
if (idata->session_id != session_id)
|
||||
continue;
|
||||
switch(ax_ma_compare_indexes(0, vbp, 0, idata)) {
|
||||
case -1:
|
||||
return(0);
|
||||
case 0:
|
||||
return(idata);
|
||||
case 1:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: ax_ma_cleanup_indexes
|
||||
|
||||
PURPOSE: Routine to cleanup any indexes that have been registered
|
||||
by a sub agent when it decided to close the session
|
||||
|
||||
PARAMETERS: bits32_t id of the session to close
|
||||
|
||||
RETURNS: void
|
||||
****************************************************************************/
|
||||
void
|
||||
ax_ma_cleanup_indexes(bits32_t session_id)
|
||||
{
|
||||
TREENODE_T *tnode;
|
||||
ENVOY_AX_CONTEXT_T *context;
|
||||
ENVOY_AX_INDEX_HDR_T *ihdr;
|
||||
ENVOY_AX_INDEX_DATA_T *idata;
|
||||
|
||||
for(context = ax_context_next(0); context; context = ax_context_next(context)){
|
||||
for(tnode = TREE_GetNext(context->indexroot, 0);
|
||||
tnode;
|
||||
tnode = TREE_GetNext(context->indexroot, tnode)) {
|
||||
if (TREE_Extract(tnode, (ptr_t *)&ihdr))
|
||||
continue;
|
||||
for (idata = ihdr->data; idata; idata = idata->next)
|
||||
if (idata->session_id == session_id)
|
||||
idata->session_id = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: ax_ma_index_deallocate
|
||||
|
||||
PURPOSE: mark any indexes owned by this session as available for reuse
|
||||
|
||||
We copy the pointers for the varbind list from the decoded packet
|
||||
to the reply packet and don't zero them in the decoded packet.
|
||||
We can do this because the calling routine will free the decoded
|
||||
packet but not the reply packet.
|
||||
|
||||
PARAMETERS: ENVOY_AX_PKT_T * decoded packet to process
|
||||
ENVOY_AX_PKT_T * reply packet
|
||||
ENVOY_AX_CONTEXT_T * context structure, contains the index root
|
||||
|
||||
RETURNS: void
|
||||
****************************************************************************/
|
||||
void
|
||||
ax_ma_index_deallocate(ENVOY_AX_PKT_T *ax_pkt,
|
||||
ENVOY_AX_PKT_T *reply_pkt,
|
||||
ENVOY_AX_CONTEXT_T *context)
|
||||
{
|
||||
TREENODE_T *tnode;
|
||||
ENVOY_AX_INDEX_HDR_T *ihdr;
|
||||
ENVOY_AX_INDEX_DATA_T *idata;
|
||||
VB_T *vbp;
|
||||
int count, length;
|
||||
|
||||
reply_pkt->data.proc_data.vbl_str.vbl_count =
|
||||
ax_pkt->data.proc_data.vbl_str.vbl_count;
|
||||
reply_pkt->data.proc_data.vbl_str.vblist =
|
||||
ax_pkt->data.proc_data.vbl_str.vblist;
|
||||
|
||||
/* do the lookup twice to avoid chaging things if there are any errors */
|
||||
for(vbp = ax_pkt->data.proc_data.vbl_str.vblist, count = 0;
|
||||
count < ax_pkt->data.proc_data.vbl_str.vbl_count;
|
||||
vbp++, count++) {
|
||||
tnode = TREE_Get(context->indexroot, vbp->vb_obj_id.component_list,
|
||||
vbp->vb_obj_id.num_components, &length);
|
||||
if (tnode &&
|
||||
(length == vbp->vb_obj_id.num_components) &&
|
||||
(TREE_Extract(tnode, (ptr_t *)&ihdr) == 0) &&
|
||||
(ihdr->type == vbp->vb_data_flags_n_type) &&
|
||||
((idata = ax_ma_find_index(ihdr->data, vbp,
|
||||
ax_pkt->session_id)) != 0)) {
|
||||
vbp->vb_priv = idata;
|
||||
continue;
|
||||
}
|
||||
|
||||
reply_pkt->error_stat = (bits16_t)ENVOY_AX_INDEX_NOT_ALLOCATED;
|
||||
reply_pkt->error_index = (bits16_t)(count + 1);
|
||||
return;
|
||||
}
|
||||
|
||||
for(vbp = ax_pkt->data.proc_data.vbl_str.vblist,
|
||||
count = ax_pkt->data.proc_data.vbl_str.vbl_count;
|
||||
count;
|
||||
vbp++, count--) {
|
||||
((ENVOY_AX_INDEX_DATA_T *)(vbp->vb_priv))->session_id = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: ax_ma_index_allocate
|
||||
|
||||
PURPOSE: try to add the indexes from the var bind list into the
|
||||
index tree.
|
||||
|
||||
We copy the pointers for the varbind list from the decoded packet
|
||||
to the reply packet and don't zero them in the decoded packet.
|
||||
We can do this because the calling routine will free the decoded
|
||||
packet but not the reply packet.
|
||||
|
||||
We can also use static pointers to any indexes we create as
|
||||
the packet will be sent before we release any locks we hold.
|
||||
|
||||
PARAMETERS: ENVOY_AX_PKT_T * decoded packet to process
|
||||
ENVOY_AX_PKT_T * reply packet
|
||||
ENVOY_AX_CONTEXT_T * context structure, contains the index root
|
||||
|
||||
RETURNS: void
|
||||
****************************************************************************/
|
||||
void
|
||||
ax_ma_index_allocate(ENVOY_AX_PKT_T *ax_pkt,
|
||||
ENVOY_AX_PKT_T *reply_pkt,
|
||||
ENVOY_AX_CONTEXT_T *context)
|
||||
{
|
||||
VB_T *vbp;
|
||||
int count, stat = 0, length;
|
||||
TREENODE_T *tnode, *bptr;
|
||||
ENVOY_AX_INDEX_HDR_T *ihdr;
|
||||
ENVOY_AX_INDEX_DATA_T *idata, **idatap;
|
||||
bits8_t any_flag;
|
||||
|
||||
any_flag = (bits8_t)(ax_pkt->flags & (ENVOY_AX_BIT_NEW_INDEX | ENVOY_AX_BIT_ANY_INDEX));
|
||||
/*sar protocol violation if both bits on?*/
|
||||
|
||||
reply_pkt->data.proc_data.vbl_str.vbl_count =
|
||||
ax_pkt->data.proc_data.vbl_str.vbl_count;
|
||||
reply_pkt->data.proc_data.vbl_str.vblist =
|
||||
ax_pkt->data.proc_data.vbl_str.vblist;
|
||||
|
||||
if (ax_pkt->data.proc_data.vbl_str.vbl_count == 0)
|
||||
return;
|
||||
|
||||
/* walk through the var bind list and try to add the requested indexes
|
||||
when we finish the loop we check and see if there were any errors
|
||||
if so we clean up any work that we did otherwise just return.
|
||||
|
||||
1) check the type for legality
|
||||
2) find the leaf in the tree
|
||||
if it exists check the new type against the old type
|
||||
if it doesn't exist try to build it
|
||||
3) deal with the index itself
|
||||
a) specified index - try to find a matching entry
|
||||
if we have one check to see if it's already in use
|
||||
if we don't have one try to build one
|
||||
b) any index - look through the list for an entry that isn't in use
|
||||
if we can't find one proceed to c - a new entry
|
||||
c) new index - look through the list for the first index that isn't named
|
||||
*/
|
||||
|
||||
for(vbp = ax_pkt->data.proc_data.vbl_str.vblist, count = 0;
|
||||
count < ax_pkt->data.proc_data.vbl_str.vbl_count;
|
||||
vbp++, count++) {
|
||||
|
||||
switch (vbp->vb_data_flags_n_type) {
|
||||
case VT_NUMBER:
|
||||
case VT_STRING:
|
||||
case VT_OBJECT:
|
||||
case VT_IPADDRESS:
|
||||
break;
|
||||
default:
|
||||
reply_pkt->error_stat = (bits16_t)ENVOY_AX_INDEX_WRONG_TYPE;
|
||||
reply_pkt->error_index = (bits16_t)(count + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
tnode = TREE_Get(context->indexroot, vbp->vb_obj_id.component_list,
|
||||
vbp->vb_obj_id.num_components, &length);
|
||||
|
||||
/* we want the named leaf, not an ancestor */
|
||||
if (tnode && (length != vbp->vb_obj_id.num_components))
|
||||
tnode = 0;
|
||||
|
||||
if (tnode) {
|
||||
if (TREE_Extract(tnode, (ptr_t *)&ihdr)) {
|
||||
reply_pkt->error_stat = GEN_ERR;
|
||||
break;
|
||||
}
|
||||
if (ihdr->type != vbp->vb_data_flags_n_type) {
|
||||
reply_pkt->error_stat = (bits16_t)ENVOY_AX_INDEX_WRONG_TYPE;
|
||||
reply_pkt->error_index = (bits16_t)(count + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
/* no leaf, so we need to build one */
|
||||
ihdr = (ENVOY_AX_INDEX_HDR_T *)
|
||||
SNMP_memory_alloc(sizeof(ENVOY_AX_INDEX_HDR_T));
|
||||
if (ihdr == 0) {
|
||||
reply_pkt->error_stat = GEN_ERR;
|
||||
break;
|
||||
}
|
||||
|
||||
ihdr->type = vbp->vb_data_flags_n_type;
|
||||
ihdr->data = 0;
|
||||
|
||||
if (TREE_Add(&context->indexroot, vbp->vb_obj_id.component_list,
|
||||
vbp->vb_obj_id.num_components, (ptr_t)ihdr, &bptr)) {
|
||||
SNMP_memory_free(ihdr);
|
||||
ihdr = 0;
|
||||
reply_pkt->error_stat = GEN_ERR;
|
||||
break;
|
||||
}
|
||||
|
||||
vbp->ax_flags |= ENVOY_AX_FLAGS_CLEAN_LEAF;
|
||||
}
|
||||
|
||||
|
||||
/* find or build the entry */
|
||||
if (any_flag == 0) {
|
||||
/* Use the specified index */
|
||||
for (idatap = &ihdr->data; *idatap; idatap = &(*idatap)->next) {
|
||||
stat = ax_ma_compare_indexes(0, vbp, 0, *idatap);
|
||||
if (stat != 1)
|
||||
break;
|
||||
}
|
||||
if (*idatap && (stat == 0)) {
|
||||
if ((*idatap)->session_id) {
|
||||
reply_pkt->error_stat = (bits16_t)ENVOY_AX_INDEX_ALREADY_ALLOCATED;
|
||||
reply_pkt->error_index = (bits16_t)(count + 1);
|
||||
break;
|
||||
}
|
||||
(*idatap)->session_id = ax_pkt->session_id;
|
||||
vbp->vb_priv = (*idatap);
|
||||
}
|
||||
else {
|
||||
idata = (ENVOY_AX_INDEX_DATA_T *)
|
||||
SNMP_memory_alloc(sizeof(ENVOY_AX_INDEX_DATA_T));
|
||||
if (idata == 0) {
|
||||
reply_pkt->error_stat = (bits16_t)GEN_ERR;
|
||||
reply_pkt->error_index = (bits16_t)(count + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
switch(vbp->vb_data_flags_n_type) {
|
||||
case VT_NUMBER:
|
||||
idata->data.bits32 = vbp->value_u.v_number;
|
||||
break;
|
||||
case VT_STRING:
|
||||
idata->data.string.length =
|
||||
EBufferUsed(&vbp->value_u.v_string);
|
||||
if (idata->data.string.length) {
|
||||
idata->data.string.buffer =
|
||||
SNMP_memory_alloc(idata->data.string.length);
|
||||
if (idata->data.string.buffer == 0) {
|
||||
SNMP_memory_free(idata);
|
||||
idata = 0;
|
||||
reply_pkt->error_stat = (bits16_t)GEN_ERR;
|
||||
reply_pkt->error_index = (bits16_t)(count + 1);
|
||||
}
|
||||
else {
|
||||
MEMCPY(idata->data.string.buffer,
|
||||
EBufferStart(&vbp->value_u.v_string),
|
||||
idata->data.string.length);
|
||||
}
|
||||
}
|
||||
else
|
||||
idata->data.string.buffer = 0;
|
||||
break;
|
||||
case VT_OBJECT:
|
||||
if (clone_object_id(&vbp->value_u.v_object,
|
||||
&idata->data.objid)) {
|
||||
SNMP_memory_free(idata);
|
||||
idata = 0;
|
||||
reply_pkt->error_stat = (bits16_t)GEN_ERR;
|
||||
reply_pkt->error_index = (bits16_t)(count + 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case VT_IPADDRESS:
|
||||
MEMCPY(&idata->data.ipaddr,
|
||||
&vbp->value_u.v_network_address, 4);
|
||||
break;
|
||||
}
|
||||
|
||||
if (idata) {
|
||||
idata->session_id = ax_pkt->session_id;
|
||||
idata->next = *idatap;
|
||||
*idatap = idata;
|
||||
vbp->vb_priv = idata;
|
||||
vbp->ax_flags |= ENVOY_AX_FLAGS_CLEAN_INDEX;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
idata = 0;
|
||||
if (any_flag == ENVOY_AX_BIT_ANY_INDEX) {
|
||||
for(idata = ihdr->data;
|
||||
idata && idata->session_id;
|
||||
idata = idata->next)
|
||||
; /* no body to the for loop */
|
||||
|
||||
if (idata) {
|
||||
idata->session_id = ax_pkt->session_id;
|
||||
vbp->vb_priv = idata;
|
||||
}
|
||||
}
|
||||
|
||||
if (idata == 0) {
|
||||
/* find new index and build entry
|
||||
if it's an object id we stash a copy of the index
|
||||
in the search end area to move into the vbp value
|
||||
area if we succeed. */
|
||||
idata = ax_ma_build_new_index(ihdr, vbp);
|
||||
if (idata == 0) {
|
||||
reply_pkt->error_stat = (bits16_t)ENVOY_AX_INDEX_NONE_AVAILABLE;
|
||||
reply_pkt->error_index = (bits16_t)(count + 1);
|
||||
break;
|
||||
}
|
||||
idata->session_id = ax_pkt->session_id;
|
||||
vbp->vb_priv = idata;
|
||||
vbp->ax_flags |= ENVOY_AX_FLAGS_CLEAN_INDEX;
|
||||
}
|
||||
if ((vbp->vb_data_flags_n_type == VT_OBJECT) &&
|
||||
(clone_object_id(&idata->data.objid, &vbp->ax_search_end))) {
|
||||
reply_pkt->error_stat = (bits16_t)GEN_ERR;
|
||||
reply_pkt->error_index = (bits16_t)(count + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* we have finished processing the requests, see if we succeeded or not,
|
||||
if we did we need to set the indexes in the vbps for any & new requests
|
||||
if we didn't we need to clean up any thing we built */
|
||||
|
||||
if (reply_pkt->error_stat) {
|
||||
/* First remove any entries that we created and reset the
|
||||
session ids for previously existing entries */
|
||||
for(vbp = ax_pkt->data.proc_data.vbl_str.vblist, count = 0;
|
||||
count < ax_pkt->data.proc_data.vbl_str.vbl_count;
|
||||
vbp++, count++) {
|
||||
if (vbp->vb_priv == 0)
|
||||
continue;
|
||||
idata = (ENVOY_AX_INDEX_DATA_T *)vbp->vb_priv;
|
||||
if (vbp->ax_flags & ENVOY_AX_FLAGS_CLEAN_INDEX) {
|
||||
tnode = TREE_Get(context->indexroot, vbp->vb_obj_id.component_list,
|
||||
vbp->vb_obj_id.num_components, &length);
|
||||
(void) TREE_Extract(tnode, (ptr_t *)&ihdr);
|
||||
for (idatap = &ihdr->data; *idatap; idatap = &(*idatap)->next) {
|
||||
if (*idatap == idata) {
|
||||
*idatap = idata->next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch(ihdr->type) {
|
||||
case VT_OBJECT:
|
||||
Clean_Obj_ID(&idata->data.objid);
|
||||
break;
|
||||
case VT_STRING:
|
||||
SNMP_memory_free(idata->data.string.buffer);
|
||||
break;
|
||||
}
|
||||
SNMP_memory_free(idata);
|
||||
}
|
||||
else
|
||||
idata->session_id = 0;
|
||||
}
|
||||
|
||||
for(vbp = ax_pkt->data.proc_data.vbl_str.vblist, count = 0;
|
||||
count < ax_pkt->data.proc_data.vbl_str.vbl_count;
|
||||
vbp++, count++) {
|
||||
if (vbp->ax_flags & ENVOY_AX_FLAGS_CLEAN_LEAF) {
|
||||
tnode = TREE_Get(context->indexroot, vbp->vb_obj_id.component_list,
|
||||
vbp->vb_obj_id.num_components, &length);
|
||||
(void) TREE_Extract(tnode, (ptr_t *)&ihdr);
|
||||
TREE_Delete(&context->indexroot, tnode);
|
||||
if (ihdr != 0)
|
||||
SNMP_memory_free(ihdr);
|
||||
ihdr = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (any_flag) {
|
||||
/* update the index value in the vbp */
|
||||
for(vbp = ax_pkt->data.proc_data.vbl_str.vblist, count = 0;
|
||||
count < ax_pkt->data.proc_data.vbl_str.vbl_count;
|
||||
vbp++, count++) {
|
||||
idata = (ENVOY_AX_INDEX_DATA_T *)vbp->vb_priv;
|
||||
switch(vbp->vb_data_flags_n_type) {
|
||||
case VT_NUMBER:
|
||||
vbp->value_u.v_number = (INT_32_T)idata->data.bits32;
|
||||
break;
|
||||
case VT_STRING:
|
||||
EBufferClean(&vbp->value_u.v_string);
|
||||
EBufferPreLoad(BFL_IS_STATIC, &vbp->value_u.v_string,
|
||||
idata->data.string.buffer,
|
||||
idata->data.string.length);
|
||||
break;
|
||||
case VT_OBJECT:
|
||||
Clean_Obj_ID(&vbp->value_u.v_object);
|
||||
copy_object_id(&vbp->ax_search_end,
|
||||
&vbp->value_u.v_object);
|
||||
init_object_id(&vbp->ax_search_end);
|
||||
break;
|
||||
case VT_IPADDRESS:
|
||||
MEMCPY(&vbp->value_u.v_network_address,
|
||||
&idata->data.ipaddr, 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* 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 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: ax_maini.c,v $
|
||||
* Revision 1.7 2002/04/02 14:49:09 andre
|
||||
* Added tblLastChg globals
|
||||
*
|
||||
* Revision 1.6 2002/03/22 17:59:40 josh
|
||||
* moved declaration of axConnTblLastChg, axSessTblLastChg, and
|
||||
* axRegTblLastChg to ax_maini.c to prevent master agent code
|
||||
* from being sucked into subagent builds
|
||||
*
|
||||
* Revision 1.5 2002/03/18 16:27:43 tneale
|
||||
* Added support for Agentx Session table
|
||||
*
|
||||
* Revision 1.4 2002/03/12 15:50:32 tneale
|
||||
* Added the Registration table of the Agentx MIB
|
||||
*
|
||||
* Revision 1.3 2002/02/22 20:15:00 andre
|
||||
* Initial checkin for AgentX MIB changes
|
||||
*
|
||||
* Revision 1.2 2001/11/06 21:20:02 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:41 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:22:16 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:18:53 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:10:53 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.1 1998/08/12 04:43:58 sar
|
||||
* Move the initialization routines around some in order to minimize
|
||||
* the amount of code that gets pulled in for init purposes.
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1conf.h>
|
||||
#include <wrn/wm/snmp/engine/agentx.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
|
||||
bits32_t agentxDefaultTimeout = ENVOY_AX_DEFAULT_TIMEOUT;
|
||||
|
||||
AX_CB_T *first_axcb = 0;
|
||||
bits32_t ax_reqid = 1;
|
||||
|
||||
bits32_t ax_registration_id = 1;
|
||||
TREENODE_T *registration_root = 0;
|
||||
|
||||
bits32_t agentxRegisterDuplicate = 0;
|
||||
|
||||
bits32_t envoy_ax_session_id = 1;
|
||||
ENVOY_AX_SESSION_T *envoy_ax_session_list = 0;
|
||||
|
||||
bits32_t context_list_id = 1;
|
||||
ENVOY_AX_CONTEXT_T *context_list = 0;
|
||||
|
||||
sbits32_t agentxMasterAgentXVer = ENVOY_AX_VERSION_MAXIMUM;
|
||||
|
||||
bits32_t axConnTblLastChg;
|
||||
bits32_t axSessTblLastChg;
|
||||
bits32_t axRegTblLastChg;
|
||||
|
||||
ENVOY_AX_MA_REGLIST_T *envoy_ax_registration_list = 0;
|
||||
|
||||
void
|
||||
envoy_ax_ma_init (void)
|
||||
{
|
||||
agentxDefaultTimeout = ENVOY_AX_DEFAULT_TIMEOUT;
|
||||
first_axcb = 0;
|
||||
ax_reqid = 1;
|
||||
ax_registration_id = 1;
|
||||
registration_root = 0;
|
||||
agentxRegisterDuplicate = 0;
|
||||
envoy_ax_session_id = 1;
|
||||
envoy_ax_session_list = 0;
|
||||
context_list_id = 1;
|
||||
context_list = 0;
|
||||
agentxMasterAgentXVer = ENVOY_AX_VERSION_MAXIMUM;
|
||||
axConnTblLastChg = 0;
|
||||
axSessTblLastChg = 0;
|
||||
axRegTblLastChg = 0;
|
||||
envoy_ax_registration_list = 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,464 @@
|
||||
/*
|
||||
* Copyright 2001-2005, 2013 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* $Log: ax_mhlpf.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:02 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:41 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 1.1.2.4 2001/08/17 20:45:12 meister
|
||||
* Add function prototypes
|
||||
*
|
||||
* Revision 1.1.2.3 2001/08/16 19:45:59 josh
|
||||
* fix handling of nodes that aren't in the current view and
|
||||
* how AgentX skips over them.
|
||||
*
|
||||
* Revision 1.1.2.2 2001/08/07 21:53:30 meister
|
||||
* reworked to use dynamic component configuration macros, to allow
|
||||
* separate vxworks agentx components
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01e,17sep13,bbz fix for dead code warning
|
||||
01d,03aug09,y_t fix for coverity
|
||||
01c,28sep07,jbl guard against potential null pointer deref
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/* moved the ax helper routines for find next object here from mibnext.c
|
||||
* to separate out ax code into a separate ax component
|
||||
*/
|
||||
|
||||
#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/objectid.h>
|
||||
#include <wrn/wm/snmp/engine/view.h>
|
||||
#include <wrn/wm/snmp/engine/agentx.h>
|
||||
|
||||
/* in mib_next.c */
|
||||
extern int
|
||||
_snmp_leaf_check(SNMP_PKT_T *, VB_T *, MIBLEAF_T *, OBJ_ID_T *, int, int);
|
||||
|
||||
#if INSTALL_ENVOY_AGENTX_MASTER
|
||||
#define AX_HELP_ERROR -1
|
||||
#define AX_HELP_FOUND 0
|
||||
#define AX_HELP_SKIP 1
|
||||
#define AX_HELP_USE 2
|
||||
#define AX_HELP_LM 3
|
||||
|
||||
/* _snmp_find_next_helper_ax is used when find_next_helper encounters
|
||||
an interior leaf node. It determines if there are any useable
|
||||
leaf nodes under the interior leaf or the instance for use with
|
||||
the parent node.
|
||||
return codes: -1 error, 0 leaf found, 1 skip this branch,
|
||||
2 use leaf, 3 needs last match */
|
||||
|
||||
int
|
||||
_snmp_find_next_helper_ax(MIBNODE_T *np,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
OBJ_ID_T *robj,
|
||||
int rcount,
|
||||
VB_T *vbp,
|
||||
SNMP_PKT_T *pktp,
|
||||
int check_flag)
|
||||
{
|
||||
int eret;
|
||||
MIBLEAF_T *lp;
|
||||
|
||||
if (rcount > robj->num_components) {
|
||||
OIDC_T *nlist;
|
||||
nlist = (OIDC_T *)SNMP_memory_alloc((robj->num_components + 4) *
|
||||
sizeof(OIDC_T));
|
||||
if (nlist == 0)
|
||||
return(AX_HELP_ERROR);
|
||||
MEMCPY(nlist, robj->component_list, robj->num_components * sizeof(OIDC_T));
|
||||
SNMP_memory_free(robj->component_list);
|
||||
robj->component_list = nlist;
|
||||
robj->num_components = robj->num_components + 4;
|
||||
}
|
||||
|
||||
/* We have a leaf node, if it is in our view we set up the info we
|
||||
want to return. Finish building the object by attaching any
|
||||
remaining target information (this will be instance info).
|
||||
We don't worry about running out of space in the result buffer
|
||||
as the only way we have instance information is if we didn't
|
||||
modify the target oid and we allocated enough space to hold
|
||||
the entire target oid. */
|
||||
|
||||
if ((np->node_type & NODE_TYPE) == LEAF_NODE) {
|
||||
/* Cast the structure so it's easier to work with */
|
||||
lp = (MIBLEAF_T *)np;
|
||||
|
||||
switch(_snmp_leaf_check(pktp, vbp, lp, robj, rcount, check_flag)) {
|
||||
case VIEW_EXCLUDED:
|
||||
return(AX_HELP_SKIP);
|
||||
case VIEW_INDETERMINATE:
|
||||
vbp->vb_flags |= VFLAG_NEXT_VCREQ;
|
||||
break;
|
||||
}
|
||||
|
||||
if (tcount) {
|
||||
MEMCPY(robj->component_list + rcount, tlist, tcount * sizeof(OIDC_T));
|
||||
vbp->vb_ml.ml_remaining_objid.component_list = robj->component_list +
|
||||
rcount;
|
||||
}
|
||||
else {
|
||||
vbp->vb_ml.ml_remaining_objid.component_list = 0;
|
||||
}
|
||||
|
||||
vbp->vb_ml.ml_remaining_objid.num_components = tcount;
|
||||
robj->num_components = rcount + tcount;
|
||||
|
||||
vbp->vb_ml.ml_node = np;
|
||||
vbp->vb_ml.ml_flags = ML_IS_LEAF;
|
||||
return(AX_HELP_LM);
|
||||
}
|
||||
|
||||
else { /* inner node */
|
||||
MIBARC_T *ap = np->arcs;
|
||||
OIDC_T node_id, *temp_list;
|
||||
int temp_count, vc = 0;
|
||||
|
||||
if (np->leaf) {
|
||||
vc = _snmp_leaf_check(pktp, vbp, np->leaf, robj, rcount, check_flag);
|
||||
if (vc == VIEW_EXCLUDED)
|
||||
return(AX_HELP_SKIP);
|
||||
}
|
||||
|
||||
if (tcount > 0) {
|
||||
for(; ap->nodep && (ap->id < *tlist); ap++)
|
||||
;
|
||||
|
||||
node_id = *tlist;
|
||||
temp_count = tcount - 1;
|
||||
temp_list = tlist + 1;
|
||||
}
|
||||
else {
|
||||
node_id = 0;
|
||||
temp_count = 0;
|
||||
temp_list = 0;
|
||||
/* set the include flag so that we will get this item
|
||||
if its both an agentx and instance object */
|
||||
vbp->ax_flags |= ENVOY_AX_FLAGS_INCLUDE;
|
||||
}
|
||||
|
||||
if (ap->nodep && (node_id == ap->id)) {
|
||||
eret = 0;
|
||||
for(; ap->nodep && (ap->id == node_id); ap++) {
|
||||
robj->component_list[rcount] = node_id;
|
||||
|
||||
eret = _snmp_find_next_helper_ax((MIBNODE_T *)ap->nodep,
|
||||
temp_count,
|
||||
temp_list, robj, rcount + 1,
|
||||
vbp, pktp, check_flag);
|
||||
if ((eret == AX_HELP_ERROR) || (eret == AX_HELP_FOUND))
|
||||
return(eret);
|
||||
if (eret == AX_HELP_LM) {
|
||||
vbp->vb_ml.ml_last_match = node_id;
|
||||
return(AX_HELP_FOUND);
|
||||
}
|
||||
if (eret == AX_HELP_USE) {
|
||||
if (tcount || node_id ||
|
||||
vbp->vb_ml.ml_remaining_objid.num_components)
|
||||
vbp->vb_ml.ml_remaining_objid.num_components++;
|
||||
vbp->vb_ml.ml_remaining_objid.component_list--;
|
||||
break;
|
||||
}
|
||||
|
||||
node_id++;
|
||||
if (node_id == 0)
|
||||
return(AX_HELP_SKIP);
|
||||
|
||||
if (eret == AX_HELP_SKIP)
|
||||
robj->component_list[rcount] = node_id;
|
||||
|
||||
/* set the include flag so that we will get this item
|
||||
if its both an agentx and instance object */
|
||||
vbp->ax_flags |= ENVOY_AX_FLAGS_INCLUDE;
|
||||
temp_count = 0;
|
||||
temp_list = 0;
|
||||
eret = 0;
|
||||
}
|
||||
|
||||
if (eret == 0) {
|
||||
vbp->vb_ml.ml_remaining_objid.num_components = 1;
|
||||
vbp->vb_ml.ml_remaining_objid.component_list =
|
||||
robj->component_list + rcount;
|
||||
robj->num_components = rcount + 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (tcount) {
|
||||
MEMCPY(robj->component_list + rcount, tlist,
|
||||
tcount * sizeof(OIDC_T));
|
||||
}
|
||||
vbp->vb_ml.ml_remaining_objid.num_components = tcount;
|
||||
|
||||
/* The following line must be done even if we have no
|
||||
remaining objects to allow the routine to determine
|
||||
remaining objects by backing up on the list
|
||||
(comp_list--) */
|
||||
vbp->vb_ml.ml_remaining_objid.component_list =
|
||||
robj->component_list + rcount;
|
||||
robj->num_components = rcount + tcount;
|
||||
}
|
||||
|
||||
if (np->leaf) {
|
||||
if (vc == VIEW_INDETERMINATE)
|
||||
vbp->vb_flags |= VFLAG_NEXT_VCREQ;
|
||||
|
||||
vbp->vb_ml.ml_leaf = np->leaf;
|
||||
vbp->vb_ml.ml_flags = ML_IS_LEAF;
|
||||
return(AX_HELP_LM);
|
||||
}
|
||||
else {
|
||||
return(AX_HELP_USE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: find_bound_helper
|
||||
|
||||
PURPOSE: recursivly descend the tree looking for any bounds on
|
||||
the current object.
|
||||
|
||||
PARAMETERS: MIBNODE_T * node to process
|
||||
bits32_t id of session for the original leaf
|
||||
OBJ_ID_T * return object
|
||||
int how many levels down we are
|
||||
int number of target subids left
|
||||
OIDC_T * pointer to list of unused target subids
|
||||
|
||||
RETURNS: int -1 - error, 0 no bound found, 1 bound found
|
||||
****************************************************************************/
|
||||
#define AX_BOUND_HELP_ERROR -1
|
||||
#define AX_BOUND_HELP_NOBOUND 0
|
||||
#define AX_BOUND_HELP_BOUND 1
|
||||
|
||||
static int
|
||||
find_bound_helper(MIBNODE_T *mibnode,
|
||||
bits32_t session_id,
|
||||
OBJ_ID_T *robj,
|
||||
int num_comp,
|
||||
int tcount,
|
||||
OIDC_T *tlist)
|
||||
{
|
||||
MIBARC_T *ap;
|
||||
MIBLEAF_T *mibleaf;
|
||||
OIDC_T *clist;
|
||||
|
||||
/* Try to find a leaf */
|
||||
if ((mibnode->node_type & NODE_TYPE) == LEAF_NODE)
|
||||
mibleaf = (MIBLEAF_T *)mibnode;
|
||||
else
|
||||
mibleaf = mibnode->leaf;
|
||||
|
||||
/* If we have a leaf that isn't for the current session
|
||||
we build the return object id, which will be filled in
|
||||
by the calling routine(s). then return indicating a bound.
|
||||
|
||||
If we aren't bounded and this is a true leaf node we indicate
|
||||
no bound to our caller otherwise we fall through and test any
|
||||
children for bounding */
|
||||
|
||||
if (mibleaf) {
|
||||
if (mibleaf->session_id != session_id) {
|
||||
if (num_comp == 0)
|
||||
return(AX_BOUND_HELP_BOUND);
|
||||
clist = (OIDC_T *)SNMP_memory_alloc(num_comp * sizeof(OIDC_T));
|
||||
if (clist == 0)
|
||||
return(-1);
|
||||
robj->component_list = clist;
|
||||
robj->num_components = num_comp;
|
||||
return(AX_BOUND_HELP_BOUND);
|
||||
}
|
||||
if (mibleaf == (MIBLEAF_T *)mibnode)
|
||||
return(AX_BOUND_HELP_NOBOUND);
|
||||
}
|
||||
|
||||
/* If we have a target list skip all of the arcs before the desired node.
|
||||
If the desired nodes exists check it for a bounding node, if we have
|
||||
one add the current subid to the return object id */
|
||||
ap = mibnode->arcs;
|
||||
if (tcount) {
|
||||
for(; ap->nodep && (ap->id < *tlist); ap++)
|
||||
;
|
||||
if (ap->nodep && (*tlist == ap->id)) {
|
||||
switch(find_bound_helper((MIBNODE_T *)ap->nodep,
|
||||
session_id, robj,
|
||||
num_comp + 1, tcount - 1, tlist + 1)) {
|
||||
case AX_BOUND_HELP_ERROR:
|
||||
return(AX_BOUND_HELP_ERROR);
|
||||
case AX_BOUND_HELP_BOUND:
|
||||
robj->component_list[num_comp] = ap->id;
|
||||
return(AX_BOUND_HELP_BOUND);
|
||||
}
|
||||
ap++;
|
||||
}
|
||||
}
|
||||
|
||||
/* The target list didn't provide a boundary, try stepping through
|
||||
the rest of the arcs */
|
||||
for(; ap->nodep; ap++) {
|
||||
switch(find_bound_helper((MIBNODE_T *)ap->nodep, session_id, robj,
|
||||
num_comp + 1, 0, 0)) {
|
||||
case AX_BOUND_HELP_ERROR:
|
||||
return(AX_BOUND_HELP_ERROR);
|
||||
case AX_BOUND_HELP_BOUND:
|
||||
robj->component_list[num_comp] = ap->id;
|
||||
return(AX_BOUND_HELP_BOUND);
|
||||
}
|
||||
}
|
||||
|
||||
/* no boundary was found */
|
||||
return(AX_BOUND_HELP_NOBOUND);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: _snmp_find_next_bound
|
||||
|
||||
PURPOSE: Find the boundary object id for the given vbp. The vbp
|
||||
must have the mib leaf information correctly set, probably
|
||||
via find_next_object. The boundary id will be inserted
|
||||
into the vb, if no boundary is found we put nothing into
|
||||
the vb.
|
||||
|
||||
PARAMETERS: MIBNODE_T * root node to use
|
||||
VB_T * vb under discussion
|
||||
|
||||
RETURNS: int 0 on success
|
||||
****************************************************************************/
|
||||
int
|
||||
_snmp_find_next_bound(MIBNODE_T *mibroot,
|
||||
VB_T *vbp)
|
||||
{
|
||||
MIBNODE_T *mibnode = 0, *mibparent = 0;
|
||||
OBJ_ID_T objid;
|
||||
OIDC_T *clist, oldid;
|
||||
int num_comp;
|
||||
MIBARC_T *arcs = 0;
|
||||
|
||||
num_comp = vbp->vb_obj_id.num_components -
|
||||
vbp->vb_ml.ml_remaining_objid.num_components;
|
||||
|
||||
if (num_comp > 1) {
|
||||
objid.num_components = num_comp-1;
|
||||
objid.component_list = vbp->vb_obj_id.component_list;
|
||||
|
||||
(void) Find_Node_From_Root(mibroot, &objid, &mibparent);
|
||||
}
|
||||
else if (num_comp == 1) {
|
||||
objid.num_components = num_comp-1;
|
||||
objid.component_list = vbp->vb_obj_id.component_list;
|
||||
|
||||
mibparent = mibroot;
|
||||
}
|
||||
|
||||
/* It would be nice to make sure that our parent is actually a
|
||||
MIBNODE_T and not a MIBLEAF_T. */
|
||||
if ((mibparent == (MIBNODE_T *)0) ||
|
||||
((mibparent->node_type & NODE_TYPE) == LEAF_NODE))
|
||||
return(-1);
|
||||
|
||||
if (num_comp) {
|
||||
for (arcs = mibparent->arcs; arcs->nodep; arcs++) {
|
||||
if (arcs->id == objid.component_list[num_comp-1]) {
|
||||
mibnode = (MIBNODE_T *) arcs->nodep;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!mibnode)
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if ((mibnode->node_type & NODE_TYPE) == INNER_NODE) {
|
||||
switch(find_bound_helper(mibnode, vbp->vb_ml.ml_leaf->session_id,
|
||||
&vbp->ax_search_end, num_comp,
|
||||
vbp->vb_ml.ml_remaining_objid.num_components,
|
||||
vbp->vb_ml.ml_remaining_objid.component_list)) {
|
||||
case AX_BOUND_HELP_ERROR:
|
||||
return(-1);
|
||||
case AX_BOUND_HELP_BOUND:
|
||||
if (num_comp)
|
||||
MEMCPY(vbp->ax_search_end.component_list, objid.component_list,
|
||||
num_comp * sizeof(OIDC_T));
|
||||
return(0);
|
||||
case AX_BOUND_HELP_NOBOUND:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (oldid = arcs->id, arcs += 1;
|
||||
(arcs->nodep && (arcs->id == (oldid + 1)));
|
||||
arcs++, oldid++) {
|
||||
if ((((MIBNODE_T *)(arcs->nodep))->node_type & NODE_TYPE) == LEAF_NODE) {
|
||||
if (((MIBLEAF_T*)(arcs->nodep))->session_id != vbp->vb_ml.ml_leaf->session_id)
|
||||
break;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
if ((((MIBNODE_T *)(arcs->nodep))->leaf == 0) ||
|
||||
(((MIBNODE_T *)(arcs->nodep))->leaf->session_id != vbp->vb_ml.ml_leaf->session_id)) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch(find_bound_helper((MIBNODE_T *)arcs->nodep,
|
||||
vbp->vb_ml.ml_leaf->session_id,
|
||||
&vbp->ax_search_end,
|
||||
num_comp,
|
||||
0, 0)) {
|
||||
|
||||
case AX_BOUND_HELP_ERROR:
|
||||
return(-1);
|
||||
case AX_BOUND_HELP_BOUND:
|
||||
if (num_comp > 1) {
|
||||
MEMCPY(vbp->ax_search_end.component_list, objid.component_list,
|
||||
(num_comp-1) * sizeof(OIDC_T));
|
||||
}
|
||||
vbp->ax_search_end.component_list[num_comp-1] = oldid + 1;
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
if ((clist = (OIDC_T *)SNMP_memory_alloc(num_comp * sizeof(OIDC_T))) == 0)
|
||||
return(-1);
|
||||
|
||||
if (num_comp > 1)
|
||||
MEMCPY(clist, objid.component_list, (num_comp - 1) * sizeof(OIDC_T));
|
||||
clist[num_comp-1] = oldid;
|
||||
while((++clist[num_comp - 1]) == 0) {
|
||||
num_comp--;
|
||||
if (num_comp == 0) {
|
||||
SNMP_memory_free(clist);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
vbp->ax_search_end.component_list = clist;
|
||||
vbp->ax_search_end.num_components = num_comp;
|
||||
return(0);
|
||||
}
|
||||
#endif /* #if INSTALL_ENVOY_AGENTX_MASTER */
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,299 @@
|
||||
/*
|
||||
* Copyright 2001-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: ax_mmutl.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:03 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:41 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 1.1.2.2 2001/08/07 21:53:30 meister
|
||||
* reworked to use dynamic component configuration macros, to allow
|
||||
* separate vxworks agentx components
|
||||
*
|
||||
* Revision 1.1.2.1 2001/08/07 21:43:44 meister
|
||||
* This file contains functions formerly in mib_utils.c
|
||||
* but were agentX specific: Find_Leaf_From_Root,
|
||||
* AX_Add_Leaf_From_Root, AX_Remove_Leaf_From_Root
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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/objectid.h>
|
||||
#include <wrn/wm/snmp/engine/view.h>
|
||||
|
||||
/* in mibutils.c */
|
||||
extern void branch_free(MIBNODE_T *startnode, MIBNODE_T *endnode);
|
||||
|
||||
/****************************************************************************
|
||||
NAME: Find_Leaf_From_Root
|
||||
|
||||
PURPOSE: find the leaf for the node returned from find_node_from_root
|
||||
if there isn't set the mibleaf pointer to 0.
|
||||
|
||||
|
||||
PARAMETERS: MIBNODE_T * the root node to use
|
||||
OBJ_ID_T * the object id that names the leaf
|
||||
MIBLEAF_T ** return area for mibleaf pointer, 0 if no leaf
|
||||
|
||||
RETURNS: 0 if we consumed all subids
|
||||
1 if a leaf node was found before all subids were consumed
|
||||
2 if no node was found
|
||||
****************************************************************************/
|
||||
sbits32_t
|
||||
Find_Leaf_From_Root(MIBNODE_T *mibroot,
|
||||
OBJ_ID_T *objid,
|
||||
MIBLEAF_T **mibleaf)
|
||||
{
|
||||
MIBNODE_T *mnode;
|
||||
sbits32_t err_ret;
|
||||
|
||||
err_ret = Find_Node_From_Root(mibroot, objid, &mnode);
|
||||
|
||||
if (mnode) {
|
||||
if ((mnode->node_type & NODE_TYPE) == INNER_NODE)
|
||||
*mibleaf = mnode->leaf;
|
||||
else
|
||||
*mibleaf = (MIBLEAF_T *)mnode;
|
||||
}
|
||||
else
|
||||
*mibleaf = 0;
|
||||
|
||||
return(err_ret);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: AX_Add_Leaf_From_Root
|
||||
|
||||
PURPOSE: Attempt to add a leaf to the tree at the given position
|
||||
If the leaf already exists and is replaceable we replace it
|
||||
If the node already exists and is replaceable we add the leaf
|
||||
Otherwise we try and insert the leaf and any necessary branches
|
||||
|
||||
PARAMETERS: MIBNODE_T * root of the mibtree
|
||||
OBJ_ID_T * name of the point where the leaf should go
|
||||
MIBLEAF_T * the leaf to add
|
||||
MIBLEAF_T ** the removed leaf (if any)
|
||||
|
||||
RETURNS: int 0 failure
|
||||
1 success, added to tree
|
||||
2 success, not added to tree, this might occur if the leaf
|
||||
we are trying to replace isn't an agentx leaf.
|
||||
****************************************************************************/
|
||||
int
|
||||
AX_Add_Leaf_From_Root(MIBNODE_T *mibroot,
|
||||
OBJ_ID_T *objp,
|
||||
MIBLEAF_T *add_leaf,
|
||||
MIBLEAF_T **rem_leaf)
|
||||
{
|
||||
MIBNODE_T *np, *newnode;
|
||||
MIBARC_T *ap = 0, *newarc, *savearc;
|
||||
OIDC_T *compp; /* Current object id component of interest */
|
||||
int comp_num; /* Index of current object id component */
|
||||
int num_arcs; /* number of arcs, for allocating more space */
|
||||
int comp_end; /* last comp to use when building new branch */
|
||||
|
||||
/* make sure we have a root node */
|
||||
if (mibroot == 0)
|
||||
return(0);
|
||||
np = mibroot;
|
||||
|
||||
/* Make sure the objid is acceptable */
|
||||
if (objp->num_components < 1)
|
||||
return(1);
|
||||
|
||||
/* Set the replaced leaf to be 0 in case we don't have a leaf to return */
|
||||
*rem_leaf = 0;
|
||||
|
||||
/* find the last matching node in the given object id */
|
||||
for(comp_num = objp->num_components, compp = objp->component_list;
|
||||
((np->node_type & NODE_TYPE) == INNER_NODE) && (comp_num > 0);
|
||||
comp_num--, compp++, np = (MIBNODE_T *)(ap->nodep))
|
||||
{
|
||||
for(ap = np->arcs; ap->nodep != 0; ap++) {
|
||||
if (ap->id == *compp)
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we are out of arcs we use the current node else we had a matching
|
||||
arc and we continue to the next level */
|
||||
if (ap->nodep == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
/* If the node is a non-agentx leaf we don't allow it to be replaced.
|
||||
This isn't classed as a failure */
|
||||
if ((np->node_type & (NODE_TYPE | AGENTX_LEAF)) == LEAF_NODE)
|
||||
return(2);
|
||||
|
||||
if (comp_num == 0) {
|
||||
if ((np->node_type & NODE_TYPE) == LEAF_NODE) {
|
||||
if ((np->node_type & REPLACEABLE) == 0)
|
||||
return(0);
|
||||
*rem_leaf = (MIBLEAF_T *)np;
|
||||
ap->nodep = (MIBARC_T *)add_leaf;
|
||||
return(1);
|
||||
}
|
||||
|
||||
if (np->leaf) {
|
||||
if ((np->leaf->node_type & REPLACEABLE) == 0)
|
||||
return(0);
|
||||
if ((np->leaf->node_type & AGENTX_LEAF) == 0)
|
||||
return(2);
|
||||
*rem_leaf = np->leaf;
|
||||
np->leaf = add_leaf;
|
||||
return(1);
|
||||
}
|
||||
|
||||
if ((np->node_type & REPLACEABLE) == 0) {
|
||||
np->leaf = add_leaf;
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* If we are here we have more sub ids left, start building the subtree.
|
||||
We work from the leaf back to the current tree, allocate the arc space
|
||||
fill it in (including the terminator), allocate the next level node,
|
||||
connect the arcs to it and repeat */
|
||||
|
||||
if ((np->node_type & NODE_TYPE) == LEAF_NODE)
|
||||
comp_end = 0;
|
||||
else
|
||||
comp_end = 1;
|
||||
|
||||
for (newnode = (MIBNODE_T *)add_leaf; comp_num > comp_end; comp_num--) {
|
||||
newarc = (MIBARC_T *)SNMP_memory_alloc(sizeof(MIBARC_T) * 2);
|
||||
if (newarc == 0) {
|
||||
/* free any memory allocated for this branch */
|
||||
branch_free(newnode, (MIBNODE_T *)add_leaf);
|
||||
return(0);
|
||||
}
|
||||
|
||||
newarc[0].id = compp[comp_num - 1];
|
||||
newarc[0].nodep = (MIBARC_T *)newnode;
|
||||
newarc[1].id = 0;
|
||||
newarc[1].nodep = 0;
|
||||
|
||||
if ((newnode = (MIBNODE_T *)SNMP_memory_alloc(sizeof(MIBNODE_T))) == 0) {
|
||||
/* free any memory allocated for this branch */
|
||||
newnode = (MIBNODE_T *)(newarc->nodep);
|
||||
SNMP_memory_free(newarc);
|
||||
branch_free(newnode, (MIBNODE_T *)add_leaf);
|
||||
return(0);
|
||||
}
|
||||
|
||||
MEMSET(newnode, 0, sizeof(MIBNODE_T));
|
||||
newnode->node_type = INNER_NODE | NODE_DYNAMIC | ARC_DYNAMIC |
|
||||
SYSTEM_OWNED;
|
||||
newnode->arcs = newarc;
|
||||
}
|
||||
|
||||
/* if we found a leaf node we attach the leaf to the start of the
|
||||
new branch and then attach the branch to the arc list in the same
|
||||
place the leaf was */
|
||||
if ((np->node_type & NODE_TYPE) == LEAF_NODE) {
|
||||
newnode->leaf = (MIBLEAF_T *)np;
|
||||
ap->nodep = (MIBARC_T *)newnode;
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* num_arcs is the number of arcs in the current list */
|
||||
for(num_arcs = 1, ap = np->arcs; (MIBNODE_T *)(ap->nodep) != 0; ap++)
|
||||
num_arcs++;
|
||||
|
||||
/* add one to num_arcs for the new arc we are adding */
|
||||
newarc = (MIBARC_T *)SNMP_memory_alloc(sizeof(MIBARC_T) * (num_arcs + 1));
|
||||
if (newarc == 0) {
|
||||
/* free the branch */
|
||||
branch_free(newnode, (MIBNODE_T *)add_leaf);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* copy all arcs less then the new arc, then add the new arc
|
||||
then copy all the arcs after the new arc, there will always
|
||||
be at least one, the terminator */
|
||||
savearc = newarc;
|
||||
for(ap = np->arcs;
|
||||
(ap->id < *compp) && ((MIBNODE_T *)(ap->nodep) != 0);
|
||||
ap++, newarc++, num_arcs--)
|
||||
MEMCPY(newarc, ap, sizeof(MIBARC_T));
|
||||
|
||||
newarc->id = *compp;
|
||||
newarc->nodep = (MIBARC_T *)newnode;
|
||||
newarc++;
|
||||
MEMCPY(newarc, ap, sizeof(MIBARC_T) * num_arcs);
|
||||
|
||||
/* now clean up, if necessary free the old arc list then tag the node so that
|
||||
the new arc list will be freed when released */
|
||||
ap = np->arcs;
|
||||
np->arcs = savearc;
|
||||
if (np->node_type & ARC_DYNAMIC)
|
||||
SNMP_memory_free(ap);
|
||||
np->node_type |= ARC_DYNAMIC;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: AX_Remove_Leaf_From_Root
|
||||
|
||||
PURPOSE: remove a leaf from the given mibtree removing any branches that
|
||||
are no longer needed
|
||||
|
||||
PARAMETERS: MIBNODE_T * the root of the mib tree
|
||||
OBJ_ID_T * the name of the node to remove the leaf from
|
||||
|
||||
RETURNS: MIBLEAF_T * the leaf that was removed 0 if there wasn't a
|
||||
a leaf to remove or the leaf wasn't an agentx leaf
|
||||
****************************************************************************/
|
||||
MIBLEAF_T *
|
||||
AX_Remove_Leaf_From_Root(MIBNODE_T *mibroot,
|
||||
OBJ_ID_T *objid)
|
||||
{
|
||||
MIBNODE_T *mnode;
|
||||
MIBLEAF_T *mleaf;
|
||||
|
||||
if ((mibroot == 0) || Find_Node_From_Root(mibroot, objid, &mnode))
|
||||
return(0);
|
||||
|
||||
if ((mnode->node_type & NODE_TYPE) == LEAF_NODE) {
|
||||
if (mnode->node_type & AGENTX_LEAF)
|
||||
return((MIBLEAF_T *)Remove_Node_From_Root(mibroot, objid));
|
||||
else
|
||||
return(0);
|
||||
}
|
||||
|
||||
mleaf = mnode->leaf;
|
||||
if ((mleaf == 0) ||
|
||||
((mleaf->node_type & (REMOVABLE | AGENTX_LEAF)) !=
|
||||
(REMOVABLE | AGENTX_LEAF)))
|
||||
return(0);
|
||||
|
||||
mnode->leaf = 0;
|
||||
if ((mnode->arcs == 0) || (mnode->arcs->nodep == 0)) {
|
||||
mnode = Remove_Node_From_Root(mibroot, objid);
|
||||
if (mnode && (mnode->node_type & NODE_DYNAMIC))
|
||||
SNMP_memory_free(mnode);
|
||||
}
|
||||
return(mleaf);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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 1994-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: ax_saini.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.2 2001/01/19 22:22:17 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:18:56 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:10:59 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.1 1998/08/12 04:44:00 sar
|
||||
* Move the initialization routines around some in order to minimize
|
||||
* the amount of code that gets pulled in for init purposes.
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1conf.h>
|
||||
#include <wrn/wm/snmp/engine/agentx.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
|
||||
bits32_t envoy_ax_sa_timeout = ENVOY_AX_SA_TIMEOUT;
|
||||
|
||||
void
|
||||
envoy_ax_sa_init (void)
|
||||
{
|
||||
envoy_ax_sa_timeout = ENVOY_AX_SA_TIMEOUT;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,627 @@
|
||||
/*
|
||||
* Copyright 2002-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: axapi.c,v $
|
||||
* Revision 1.12 2003/01/15 14:05:02 josh
|
||||
* directory structure shifting
|
||||
*
|
||||
* Revision 1.11 2002/07/11 21:54:32 josh
|
||||
* clean up a memory leak in AgentX method routines
|
||||
*
|
||||
* Revision 1.10 2002/05/16 21:00:21 tneale
|
||||
* Changed comment and removed wrongly placed "last changed" update
|
||||
*
|
||||
* Revision 1.9 2002/04/09 14:16:56 tneale
|
||||
* AgentX registration changed from tree to list to better store ranges
|
||||
*
|
||||
* Revision 1.8 2002/04/04 15:25:19 andre
|
||||
* Change ENVOY_AX_TRANSPORT to ENVOY_AX_CONN_ENTRY.
|
||||
*
|
||||
* Revision 1.6 2002/03/22 17:59:40 josh
|
||||
* moved declaration of axConnTblLastChg, axSessTblLastChg, and
|
||||
* axRegTblLastChg to ax_maini.c to prevent master agent code
|
||||
* from being sucked into subagent builds
|
||||
*
|
||||
* Revision 1.5 2002/03/18 20:18:52 tneale
|
||||
* Changed declarations to conform to correct tcount type
|
||||
*
|
||||
* Revision 1.4 2002/03/18 16:27:44 tneale
|
||||
* Added support for Agentx Session table
|
||||
*
|
||||
* Revision 1.3 2002/03/12 15:50:32 tneale
|
||||
* Added the Registration table of the Agentx MIB
|
||||
*
|
||||
* Revision 1.2 2002/02/26 18:38:58 josh
|
||||
* cleanup and nits
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/common/types.h>
|
||||
|
||||
#include <wrn/wm/snmp/engine/agentx.h>
|
||||
#include <wrn/wm/snmp/engine/asn1conf.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/objectid.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
|
||||
#include <wrn/wm/snmp/engine/axapi.h>
|
||||
#include <wrn/wm/common/bug.h>
|
||||
|
||||
/* Globals */
|
||||
|
||||
/* these globals are declared in ax_maini.c to keep down the number */
|
||||
/* of files that declare globals.*/
|
||||
extern bits32_t axConnTblLastChg;
|
||||
extern bits32_t axSessTblLastChg;
|
||||
extern bits32_t axRegTblLastChg;
|
||||
|
||||
/*****************/
|
||||
/*** SCALARS ***/
|
||||
/*****************/
|
||||
|
||||
boolean_t AxGetScalar (int scalarCode, bits32_t *value)
|
||||
|
||||
/*
|
||||
**
|
||||
** NAME
|
||||
**
|
||||
** AxGetScalar() - Retrieves the timeout value and protocol version.
|
||||
**
|
||||
** PARAMETERS
|
||||
**
|
||||
**
|
||||
** scalarCode -- An integer representing the code for the scalar to retrieve
|
||||
** value -- Pointer to a bits32_t that will hold the value
|
||||
**
|
||||
** DESCRIPTION
|
||||
**
|
||||
** This routine retrieves any one of five AgentX MIB scalar values.
|
||||
**
|
||||
** RETURNS
|
||||
**
|
||||
** TRUE -- Normal/Success
|
||||
** FALSE -- Error/Failure; also "scalar code not valid"
|
||||
*/
|
||||
|
||||
{
|
||||
/* Try to get the infrastructure lock */
|
||||
#if INSTALL_ENVOY_SNMP_LOCK
|
||||
if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_infrastructure_lock))
|
||||
{
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT, "AxGetScalar: infrastructure lock is broken", 0));
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (scalarCode)
|
||||
{
|
||||
case AX_GEN_DEFTO: /* agentxDefaultTimeout (0..255) */
|
||||
*value = ENVOY_AX_DEFAULT_TIMEOUT;
|
||||
break;
|
||||
|
||||
case AX_GEN_VER: /* agentxMasterAgentXVer (0..255) */
|
||||
*value = ENVOY_AX_VERSION_1;
|
||||
break;
|
||||
|
||||
case AX_CONN_LASTCHG: /* agentxConnTableLastChange (0..4294967295) */
|
||||
*value = axConnTblLastChg;
|
||||
break;
|
||||
|
||||
case AX_SESS_LASTCHG: /* agentxSessionTableLastChange (0..4294967295) */
|
||||
*value = axSessTblLastChg;
|
||||
break;
|
||||
|
||||
case AX_REG_LASTCHG: /* agentxRegistrationTableLastChange (0..4294967295) */
|
||||
*value = axRegTblLastChg;
|
||||
break;
|
||||
|
||||
default: /* Invalid scalar code */
|
||||
*value = 0;
|
||||
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**************************/
|
||||
/*** CONNECTION GROUP ***/
|
||||
/**************************/
|
||||
|
||||
AX_CONNENT_T *AxConnGetEntry (int tcount, OIDC_T *tlist)
|
||||
|
||||
/*
|
||||
** NAME
|
||||
**
|
||||
** AxConnGetEntry() - Retrieves information for a specific AgentX transport connection.
|
||||
**
|
||||
** PARAMETERS
|
||||
**
|
||||
** tcount -- Count of sub-ids
|
||||
** tlist -- Pointer to an array of bits32_ts representing an instance
|
||||
**
|
||||
** DESCRIPTION
|
||||
**
|
||||
** An agentxConnectionEntry describes a single AgentX transport connection.
|
||||
**
|
||||
** RETURNS
|
||||
**
|
||||
** Success -- Pointer to a Connection Entry structure
|
||||
** Failure -- Zero (0)
|
||||
*/
|
||||
|
||||
{
|
||||
AX_CONNENT_T *pConnEntry = 0;
|
||||
|
||||
if (tcount != 1) return 0;
|
||||
|
||||
/*
|
||||
** Allocate memory for the structure. Fetch the information
|
||||
** and return it via the connection structure.
|
||||
*/
|
||||
|
||||
if (!(pConnEntry = SNMP_memory_alloc (sizeof (AX_CONNENT_T)))) return 0;
|
||||
memset (pConnEntry, 0, sizeof (AX_CONNENT_T));
|
||||
if (!ENVOY_AX_CONN_ENTRY (tlist[0], AX_MATCH_GET, pConnEntry))
|
||||
{
|
||||
SNMP_memory_free (pConnEntry);
|
||||
return 0;
|
||||
}
|
||||
return pConnEntry;
|
||||
}
|
||||
|
||||
|
||||
AX_CONNENT_T *AxConnGetNext (int tcount, OIDC_T *tlist)
|
||||
|
||||
/*
|
||||
** NAME
|
||||
**
|
||||
** AxConnGetNext() - Retrieves the next connection table entry
|
||||
**
|
||||
** PARAMETERS
|
||||
**
|
||||
** tcount -- Count of sub-ids
|
||||
** tlist -- Pointer to an array of bits32_ts representing an instance
|
||||
**
|
||||
** DESCRIPTION
|
||||
**
|
||||
** An agentxConnectionEntry describes a single AgentX transport connection.
|
||||
**
|
||||
** RETURNS
|
||||
**
|
||||
** Success -- Pointer to a Connection Entry structure
|
||||
** Failure -- Zero (0)
|
||||
*/
|
||||
|
||||
{
|
||||
AX_CONNENT_T *pConnEntry = 0;
|
||||
|
||||
/*
|
||||
** Allocate memory for the structure. Fetch the information
|
||||
** and return it via the connection structure.
|
||||
*/
|
||||
|
||||
if (!(pConnEntry = SNMP_memory_alloc (sizeof (AX_CONNENT_T)))) return 0;
|
||||
memset (pConnEntry, 0, sizeof (AX_CONNENT_T));
|
||||
if (!ENVOY_AX_CONN_ENTRY (tlist ? tlist[0] : 0, AX_MATCH_NEXT, pConnEntry))
|
||||
{
|
||||
SNMP_memory_free (pConnEntry);
|
||||
return 0;
|
||||
}
|
||||
return pConnEntry;
|
||||
}
|
||||
|
||||
void setAxConnTblLastChg (bits32_t timeStamp)
|
||||
|
||||
/*
|
||||
** NAME
|
||||
**
|
||||
** setAxConnTblLastChg - Sets the global representing agentxConnTableLastChange.
|
||||
**
|
||||
** PARAMETERS
|
||||
**
|
||||
** timeStamp -- Integer value representing time as some number of centiseconds.
|
||||
**
|
||||
** DESCRIPTION
|
||||
**
|
||||
** Sets the global representing agentxConnTableLastChange.
|
||||
**
|
||||
** RETURNS
|
||||
**
|
||||
** <Nothing>
|
||||
*/
|
||||
|
||||
{
|
||||
axConnTblLastChg = timeStamp;
|
||||
}
|
||||
|
||||
|
||||
/***********************/
|
||||
/*** SESSION GROUP ***/
|
||||
/***********************/
|
||||
|
||||
static AX_SESSENT_T *create_sessentry (ENVOY_AX_SESSION_T *slptr)
|
||||
|
||||
/*
|
||||
** NAME
|
||||
**
|
||||
** create_sessentry() - Retrieves a session table entry
|
||||
**
|
||||
** PARAMETERS
|
||||
**
|
||||
** slptr -- Pointer to an element of the session list
|
||||
**
|
||||
** DESCRIPTION
|
||||
**
|
||||
** Copies information from a SESSION structure to a new SESSENT
|
||||
**
|
||||
** RETURNS
|
||||
**
|
||||
** Pointer to the new structure of type AX_SESSENT_T, or 0 if failure.
|
||||
*/
|
||||
|
||||
{
|
||||
AX_SESSENT_T *septr;
|
||||
|
||||
if (!(septr = SNMP_memory_alloc (sizeof (AX_SESSENT_T))))
|
||||
return 0;
|
||||
|
||||
septr->agentxConnIndex = (int)(slptr->connection_id);
|
||||
septr->agentxSessIndex = (int)(slptr->session_id);
|
||||
|
||||
/*
|
||||
* Check if there are any components before cloning -
|
||||
* it is OK for there to be none and this shouldn't cause an error.
|
||||
*/
|
||||
if (slptr->sub_id.num_components)
|
||||
{
|
||||
if (clone_object_id (&slptr->sub_id, &septr->agentxSessObjectID))
|
||||
{
|
||||
SNMP_memory_free (septr);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
septr->agentxSessObjectID.num_components = 0;
|
||||
septr->agentxSessObjectID.component_list = 0;
|
||||
}
|
||||
|
||||
if (EBufferClone(&slptr->descr, &septr->agentxSessDescr))
|
||||
{
|
||||
SNMP_memory_free (septr->agentxSessObjectID.component_list);
|
||||
SNMP_memory_free (septr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
septr->agentxSessAdminStatus = ENVOY_AX_SESSION_UP;
|
||||
septr->agentxSessOpenTime = slptr->timestamp;
|
||||
septr->agentxSessAgentXVer = (bits32_t)slptr->version;
|
||||
septr->agentxSessTimeout = (bits32_t)slptr->timeout;
|
||||
|
||||
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);
|
||||
return (septr);
|
||||
}
|
||||
|
||||
|
||||
AX_SESSENT_T *AxSessGetEntry (int tcount, OIDC_T *tlist)
|
||||
|
||||
/*
|
||||
** NAME
|
||||
**
|
||||
** AxSessGetEntry() - Retrieves a session table entry
|
||||
**
|
||||
** PARAMETERS
|
||||
**
|
||||
** tcount -- Count of sub-ids
|
||||
** tlist -- Pointer to an array of bits32_ts representing an instance
|
||||
**
|
||||
** DESCRIPTION
|
||||
**
|
||||
** Information about a single open session between the AgentX master agent and
|
||||
** a subagent is contained in this entry.
|
||||
**
|
||||
** RETURNS
|
||||
**
|
||||
** Success -- Pointer to a Session Entry structure
|
||||
** Failure -- Zero (0)
|
||||
*/
|
||||
|
||||
{
|
||||
ENVOY_AX_SESSION_T **tsp;
|
||||
|
||||
/* Check on the instance info */
|
||||
if (tcount != 2)
|
||||
return 0;
|
||||
|
||||
/* Try to get the infrastructure lock */
|
||||
#if INSTALL_ENVOY_SNMP_LOCK
|
||||
if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_infrastructure_lock))
|
||||
{
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT, "AxSessGetEntry: infrastructure lock is broken", 0));
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (tsp = &envoy_ax_session_list; *tsp != NULL; tsp = &((*tsp)->next))
|
||||
{
|
||||
if ((tlist[0] == (OIDC_T)((*tsp)->connection_id)) &&
|
||||
(tlist[1] == (OIDC_T)((*tsp)->session_id)))
|
||||
return (create_sessentry (*tsp));
|
||||
}
|
||||
|
||||
/* No match. */
|
||||
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
AX_SESSENT_T *AxSessGetNext (int tcount, OIDC_T *tlist)
|
||||
|
||||
/*
|
||||
** NAME
|
||||
**
|
||||
** AxSessGetNext() - Retrieves the next session table entry
|
||||
**
|
||||
** PARAMETERS
|
||||
**
|
||||
** tcount -- Count of sub-ids
|
||||
** tlist -- Pointer to an array of bits32_ts representing an instance
|
||||
**
|
||||
** DESCRIPTION
|
||||
**
|
||||
** An agentxSessionEntry describes a single AgentX transport connection.
|
||||
**
|
||||
** RETURNS
|
||||
**
|
||||
** Success -- Pointer to a Connection Entry structure
|
||||
** Failure -- Zero (0)
|
||||
*/
|
||||
|
||||
{
|
||||
ENVOY_AX_SESSION_T **tsp;
|
||||
OIDC_T listoid[2];
|
||||
OIDC_T bestcidx = 0xFFFF;
|
||||
OIDC_T bestsidx = 0xFFFF;
|
||||
|
||||
/* Try to get the infrastructure lock */
|
||||
#if INSTALL_ENVOY_SNMP_LOCK
|
||||
if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_infrastructure_lock))
|
||||
{
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT, "AxSessGetNext: infrastructure lock is broken", 0));
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (tsp = &envoy_ax_session_list; *tsp != NULL; tsp = &((*tsp)->next))
|
||||
{
|
||||
listoid[0] = (OIDC_T) ((*tsp)->connection_id);
|
||||
listoid[1] = (OIDC_T) ((*tsp)->session_id);
|
||||
|
||||
if (oidcmp2 (2, listoid, tcount, tlist) > 0)
|
||||
{
|
||||
if ((listoid[0] < bestcidx) ||
|
||||
((listoid[0] == bestcidx) && (listoid[1] < bestsidx)))
|
||||
{
|
||||
bestcidx = listoid[0];
|
||||
bestsidx = listoid[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (tsp = &envoy_ax_session_list; *tsp != NULL; tsp = &((*tsp)->next))
|
||||
{
|
||||
listoid[0] = (OIDC_T) ((*tsp)->connection_id);
|
||||
listoid[1] = (OIDC_T) ((*tsp)->session_id);
|
||||
|
||||
if ((listoid[0] == bestcidx) && (listoid[1] == bestsidx))
|
||||
return (create_sessentry (*tsp));
|
||||
}
|
||||
|
||||
/* No match. */
|
||||
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************/
|
||||
/*** REGISTRATION GROUP ***/
|
||||
/****************************/
|
||||
|
||||
static AX_REGENT_T *create_regentry (ENVOY_AX_MA_REGLIST_T *rlptr)
|
||||
|
||||
/*
|
||||
** NAME
|
||||
**
|
||||
* create_regentry() - Retrieves a registration table entry
|
||||
**
|
||||
** PARAMETERS
|
||||
**
|
||||
** rlptr -- Pointer to an element of the registration list
|
||||
**
|
||||
** DESCRIPTION
|
||||
**
|
||||
** Copies information from a REGLIST structure to a new REGENT
|
||||
**
|
||||
** RETURNS
|
||||
**
|
||||
** Pointer to the new structure of type AX_REGENT_T, or 0 if failure.
|
||||
*/
|
||||
|
||||
{
|
||||
AX_REGENT_T *reptr;
|
||||
ENVOY_AX_CONTEXT_T *ctxptr;
|
||||
|
||||
if (!rlptr)
|
||||
return 0;
|
||||
|
||||
if (!(reptr = SNMP_memory_alloc (sizeof (AX_REGENT_T))))
|
||||
return 0;
|
||||
|
||||
reptr->agentxConnIndex = (int)(rlptr->connection_id);
|
||||
reptr->agentxSessIndex = (int)(rlptr->session_id);
|
||||
reptr->agentxRegIndex = (int)(rlptr->reg_index);
|
||||
|
||||
/*
|
||||
* Get the context from the id stored in the regleaf
|
||||
* Then copy it into the REGENT structure
|
||||
*/
|
||||
if (!(ctxptr = ax_context_index (rlptr->context_id)))
|
||||
{
|
||||
SNMP_memory_free (reptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (EBufferClone(&ctxptr->context, &reptr->agentxRegContext))
|
||||
{
|
||||
SNMP_memory_free (reptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((build_object_id (rlptr->start_oid.num_components,
|
||||
rlptr->start_oid.component_list,
|
||||
&(reptr->agentxRegStart)) < 0))
|
||||
{
|
||||
SNMP_memory_free (reptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
reptr->agentxRegRangeSubId = (bits32_t)(rlptr->range_id);
|
||||
reptr->agentxRegUpperBound = (bits32_t)(rlptr->bound);
|
||||
reptr->agentxRegPriority = (bits32_t)(rlptr->priority);
|
||||
reptr->agentxRegTimeout = (bits32_t)(rlptr->mibleaf->timeout);
|
||||
if (rlptr->flags & ENVOY_AX_BIT_INSTANCE)
|
||||
reptr->agentxRegInstance = 1;
|
||||
else
|
||||
reptr->agentxRegInstance = 2;
|
||||
|
||||
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);
|
||||
return (reptr);
|
||||
}
|
||||
|
||||
|
||||
AX_REGENT_T *AxRegGetEntry (int tcount, OIDC_T *tlist)
|
||||
|
||||
/*
|
||||
** NAME
|
||||
**
|
||||
** AxRegGetEntry() - Retrieves a registration table entry
|
||||
**
|
||||
** PARAMETERS
|
||||
**
|
||||
** tcount -- Count of sub-ids
|
||||
** tlist -- Pointer to an array of bits32_ts representing an instance
|
||||
**
|
||||
** DESCRIPTION
|
||||
**
|
||||
** Information for a single registered region is contained in this entry.
|
||||
**
|
||||
** RETURNS
|
||||
**
|
||||
** Success -- Pointer to a Session Entry structure
|
||||
** Failure -- Zero (0)
|
||||
*/
|
||||
|
||||
{
|
||||
ENVOY_AX_MA_REGLIST_T **trp;
|
||||
|
||||
/* Check on instance info */
|
||||
if (tcount != 3)
|
||||
return 0;
|
||||
|
||||
/* Try to get the infrastructure lock */
|
||||
#if INSTALL_ENVOY_SNMP_LOCK
|
||||
if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_infrastructure_lock))
|
||||
{
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT, "AxRegGetEntry: infrastructure lock is broken", 0));
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (trp = &envoy_ax_registration_list; *trp != NULL; trp = &((*trp)->next))
|
||||
{
|
||||
if ((tlist[0] == (OIDC_T)((*trp)->connection_id)) &&
|
||||
(tlist[1] == (OIDC_T)((*trp)->session_id)) &&
|
||||
(tlist[2] == (OIDC_T)((*trp)->reg_index)))
|
||||
return (create_regentry (*trp));
|
||||
}
|
||||
|
||||
/* No match. */
|
||||
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
AX_REGENT_T *AxRegGetNext (int tcount, OIDC_T *tlist)
|
||||
|
||||
/*
|
||||
** NAME
|
||||
**
|
||||
** AxRegGetNext() - Retrieves the next registration table entry
|
||||
**
|
||||
** PARAMETERS
|
||||
**
|
||||
** tcount -- Count of sub-ids
|
||||
** tlist -- Pointer to an array of bits32_ts representing an instance
|
||||
**
|
||||
** DESCRIPTION
|
||||
**
|
||||
** An agentxRegistration Entry describes a single registered region.
|
||||
**
|
||||
** RETURNS
|
||||
**
|
||||
** Success -- Pointer to a Connection Entry structure
|
||||
** Failure -- Zero (0)
|
||||
*/
|
||||
|
||||
{
|
||||
ENVOY_AX_MA_REGLIST_T **trp;
|
||||
OIDC_T listoid[3];
|
||||
|
||||
/* Try to get the infrastructure lock */
|
||||
#if INSTALL_ENVOY_SNMP_LOCK
|
||||
if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_infrastructure_lock))
|
||||
{
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT, "AxRegGetNext: infrastructure lock is broken", 0));
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (trp = &envoy_ax_registration_list; *trp != NULL; trp = &((*trp)->next))
|
||||
{
|
||||
listoid[0] = (OIDC_T) ((*trp)->connection_id);
|
||||
listoid[1] = (OIDC_T) ((*trp)->session_id);
|
||||
listoid[2] = (OIDC_T) ((*trp)->reg_index);
|
||||
|
||||
if (oidcmp2 (3, listoid, tcount, tlist) > 0)
|
||||
return (create_regentry (*trp));
|
||||
}
|
||||
|
||||
/* No match. */
|
||||
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,257 @@
|
||||
|
||||
/* bindint.c - bindint.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: bindint.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:26 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:14 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:00 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:20 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:36 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
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:47:07 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.102 91/10/30 20:41:36 dab
|
||||
* Directly include asn1conf.h, snmpdefs.h, and snmpstat.h (if needed).
|
||||
*
|
||||
* Revision 2.101 91/08/15 12:30:42 dab
|
||||
* Removed <libfuncs.h>.
|
||||
*
|
||||
* Revision 2.100 91/08/09 14:08:14 dab
|
||||
* Update version.
|
||||
*
|
||||
* Revision 1.1 91/07/30 02:23:20 romkey
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
* Rev 2.0 31 Mar 1990 15:06:36
|
||||
* Release 2.00
|
||||
*
|
||||
* Rev 1.0 11 Jan 1989 12:11:52
|
||||
* Initial revision.
|
||||
*
|
||||
* Separated from buildpkt.c on January 11, 1989.
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,28jan05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains bindint.c routines.
|
||||
|
||||
INCLUDE FILES: auxfuncs.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_Integer - bind an integer value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int SNMP_Bind_Integer
|
||||
* (
|
||||
* SNMP_PKT_T * pktp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* INT_32_T value
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds an integer 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 <value>
|
||||
* Specify the integer value 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_Integer(SNMP_PKT_T *pktp,
|
||||
int indx,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
INT_32_T value)
|
||||
{
|
||||
VBL_T *vblp;
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
if (pktp->pdu_type == TRAP_PDU)
|
||||
vblp = &(pktp->pdu.trap_pdu.trap_vbl);
|
||||
else
|
||||
#endif
|
||||
vblp = &(pktp->pdu.std_pdu.std_vbl);
|
||||
|
||||
return (VBL_Bind_Integer(vblp, indx, tcount, tlist, value));
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* VBL_Bind_Integer - bind an integer value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int VBL_Bind_Integer
|
||||
* (
|
||||
* VBL_T * vblp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* INT_32_T value
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds an integer 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 <value>
|
||||
* Specify the integer value 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_IP_Address(),
|
||||
* 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_Integer(VBL_T *vblp,
|
||||
int indx,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
INT_32_T value)
|
||||
{
|
||||
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_NUMBER;
|
||||
vbp->value_u.v_number = value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
/* 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 comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This 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_1
|
||||
if (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;
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
/* bindnull.c - bindnull.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: bindnull.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:18 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.3 2000/03/17 00:18:58 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:03 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:53:06 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:23 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:42 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:48:38 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
|
||||
*
|
||||
* 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.102 91/10/30 20:41:38 dab
|
||||
* Directly include asn1conf.h, snmpdefs.h, and snmpstat.h (if needed).
|
||||
*
|
||||
* Revision 2.101 91/08/15 12:30:44 dab
|
||||
* Removed <libfuncs.h>.
|
||||
*
|
||||
* Revision 2.100 91/08/09 14:08:15 dab
|
||||
* Update version.
|
||||
*
|
||||
* Revision 1.1 91/07/30 02:23:24 romkey
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
* Rev 2.0 31 Mar 1990 15:06:36
|
||||
* Release 2.00
|
||||
*
|
||||
* Rev 1.0 11 Jan 1989 12:11:58
|
||||
* Initial revision.
|
||||
*
|
||||
* Separated from buildpkt.c on January 11, 1989.
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains bindnull.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_Null - bind a null value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int SNMP_Bind_Null
|
||||
* (
|
||||
* SNMP_PKT_T * pktp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds a null 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.
|
||||
* \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_Null(SNMP_PKT_T *pktp,
|
||||
int indx,
|
||||
int tcount,
|
||||
OIDC_T *tlist)
|
||||
{
|
||||
VBL_T *vblp;
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
if (pktp->pdu_type == TRAP_PDU)
|
||||
vblp = &(pktp->pdu.trap_pdu.trap_vbl);
|
||||
else
|
||||
#endif
|
||||
vblp = &(pktp->pdu.std_pdu.std_vbl);
|
||||
|
||||
return(VBL_Bind_Null(vblp, indx, tcount, tlist));
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* VBL_Bind_Null - bind a null value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int VBL_Bind_Null
|
||||
* (
|
||||
* VBL_T * vblp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds a null 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.
|
||||
* \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_IP_Address(), 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_Null(VBL_T *vblp,
|
||||
int indx,
|
||||
int tcount,
|
||||
OIDC_T *tlist)
|
||||
{
|
||||
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_EMPTY;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
/* bindoid.c - bindoid.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: bindoid.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:05 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:18 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.3 2000/03/17 00:18:58 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.2 1999/09/14 19:10:28 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:16 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:04 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:53:08 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:24 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:42 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:48:39 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
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:47:10 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.102 91/10/30 20:41:39 dab
|
||||
* Directly include asn1conf.h, snmpdefs.h, and snmpstat.h (if needed).
|
||||
*
|
||||
* Revision 2.101 91/08/15 12:30:45 dab
|
||||
* Removed <libfuncs.h>.
|
||||
*
|
||||
* Revision 2.100 91/08/09 14:08:15 dab
|
||||
* Update version.
|
||||
*
|
||||
* Revision 1.1 91/07/30 02:23:25 romkey
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
* Rev 2.0 31 Mar 1990 15:06:38
|
||||
* Release 2.00
|
||||
*
|
||||
* Rev 1.0 11 Jan 1989 12:11:56
|
||||
* Initial revision.
|
||||
*
|
||||
* Separated from buildpkt.c on January 11, 1989.
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains bindoid.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_Object_ID - bind an object identifier value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int SNMP_Bind_Object_ID
|
||||
* (
|
||||
* SNMP_PKT_T * pktp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* int valc,
|
||||
* OIDC_T * vall
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds an object identified 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().
|
||||
* The parameters <valc> and <vall> form the value portion of the 'VarBind' and
|
||||
* the parameters <tcount> and <tlist> define the object identifier naming the
|
||||
* 'VarBind'.
|
||||
*
|
||||
* 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 <valc>
|
||||
* Specify the count of components in the object identifier being bound.
|
||||
* \i <*vall>
|
||||
* Specify the components of the object identifier being 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_Object_ID(SNMP_PKT_T *pktp,
|
||||
int indx,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
int valc,
|
||||
OIDC_T *vall)
|
||||
{
|
||||
VBL_T *vblp;
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
if (pktp->pdu_type == TRAP_PDU)
|
||||
vblp = &(pktp->pdu.trap_pdu.trap_vbl);
|
||||
else
|
||||
#endif
|
||||
vblp = &(pktp->pdu.std_pdu.std_vbl);
|
||||
|
||||
return(VBL_Bind_Object_ID(vblp, indx, tcount, tlist, valc, vall));
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* VBL_Bind_Object_ID - bind an object identifier value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int VBL_Bind_Object_ID
|
||||
* (
|
||||
* VBL_T * vblp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* int valc,
|
||||
* OIDC_T * vall
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds an object identified value into a 'VarBind' in the 'VBL_T'
|
||||
* structure (<vblp>) created by VBList_Allocate().
|
||||
* The parameters <valc> and <vall> comprise the value portion of the 'VarBind'
|
||||
* and the parameters <tcount> and <tlist> define the object identifier naming
|
||||
* the 'VarBind'.
|
||||
*
|
||||
* 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 <valc>
|
||||
* Specify the count of components in the object identifier being bound.
|
||||
* \i <*vall>
|
||||
* Specify the components of the object identifier being 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_IP_Address(), VBL_Bind_Null(), VBL_Bind_Opaque(), VBL_Bind_String(),
|
||||
* VBL_Bind_64_Unsigned_Integer(), VBL_Bind_Timeticks(),
|
||||
* VBL_Bind_Unsigned_Integer(), VBList_Allocate()
|
||||
*/
|
||||
int
|
||||
VBL_Bind_Object_ID(VBL_T *vblp,
|
||||
int indx,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
int valc,
|
||||
OIDC_T *vall)
|
||||
{
|
||||
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;
|
||||
|
||||
if (build_object_id(valc, vall, &(vbp->value_u.v_object)) == -1) {
|
||||
Clean_Obj_ID(&(vbp->vb_obj_id));
|
||||
return -1;
|
||||
}
|
||||
|
||||
vbp->vb_data_flags_n_type = VT_OBJECT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,417 @@
|
||||
/* bindstr.c - bindstr.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: bindstr.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:05 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:18 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.3 2000/03/17 00:18:59 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.2 1999/09/14 19:10:28 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:16 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:05 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:53:08 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:25 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:43 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:48:41 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:11 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.104 91/10/30 20:41:39 dab
|
||||
* Directly include asn1conf.h, snmpdefs.h, and snmpstat.h (if needed).
|
||||
*
|
||||
* Revision 2.103 91/09/18 12:31:36 dab
|
||||
* Updated to use new macros from <asn1conf.h> and <snmpconf.h>.
|
||||
*
|
||||
* Revision 2.102 91/08/15 12:30:46 dab
|
||||
* Removed <libfuncs.h>.
|
||||
*
|
||||
* Revision 2.101 91/08/12 12:47:33 dab
|
||||
* Cast arguments to memcpy() and memset() to PTR_T.
|
||||
*
|
||||
* Revision 2.100 91/08/09 14:08:16 dab
|
||||
* Update version.
|
||||
*
|
||||
* Revision 1.1 91/07/30 02:23:26 romkey
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
* Rev 2.0 31 Mar 1990 15:06:38
|
||||
* Release 2.00
|
||||
*
|
||||
* Rev 1.2 17 Mar 1989 23:00:34
|
||||
* Handling of zero length strings was modified so that they are treated
|
||||
* as if they were statically allocated, but at address zero.
|
||||
*
|
||||
* 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:58
|
||||
* Initial revision.
|
||||
*
|
||||
* Separated from buildpkt.c on January 11, 1989.
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains bindstr.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/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/snmp/engine/buildpkt.h>
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* SNMP_Bind_Opaque - bind an opaque value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int SNMP_Bind_Opaque
|
||||
* (
|
||||
* SNMP_PKT_T * pktp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* int leng,
|
||||
* OCTET_T * strp,
|
||||
* int statflg
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds an opaque 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 <leng>
|
||||
* Specify the length of the string to be bound.
|
||||
* \i <*strp>
|
||||
* Specify the address of the string to be bound.
|
||||
* \i <statflg>
|
||||
* Indicate whether the string must be copied (0) or may be used as is in its
|
||||
* current location(1).
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If successful, this routine returns 0. Otherwise, it returns -1.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: SNMP_Bind_String(), SNMP_Bind_Unsigned_Integer(),
|
||||
* SNMP_Create_Request2(), SNMP_Create_Request_V3(), SNMP_Create_Trap()
|
||||
*/
|
||||
/*******************************************************************************
|
||||
*
|
||||
* SNMP_Bind_String - bind an octet string value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int SNMP_Bind_String
|
||||
* (
|
||||
* SNMP_PKT_T * pktp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* OCTET_T flags_n_type,
|
||||
* int leng,
|
||||
* OCTET_T * strp,
|
||||
* int statflg
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds an octet string 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().
|
||||
*
|
||||
* \&NOTE: It may be more convenient to use SNMP_Bind_Opaque().
|
||||
*
|
||||
* 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 <flags_n_type>
|
||||
* Specify one of the 'VarBindType' constants 'VT_STRING' or 'VT_OPAQUE', which
|
||||
* are defined in the file 'vbdefs.h'.
|
||||
* \i <leng>
|
||||
* Specify the length of the string to be bound.
|
||||
* \i <*strp>
|
||||
* Specify the address of the string to be bound.
|
||||
* \i <statflg>
|
||||
* Indicate whether the string must be copied (0) or may be used as is in its
|
||||
* current location(1).
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If successful, this routine returns 0. Otherwise, it returns -1.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: SNMP_Bind_Opaque(), SNMP_Create_Request2(),
|
||||
* SNMP_Create_Request_V3(), SNMP_Create_Trap()
|
||||
*/
|
||||
int
|
||||
SNMP_Bind_String(SNMP_PKT_T *pktp,
|
||||
int indx,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
OCTET_T flags_n_type,
|
||||
int leng,
|
||||
OCTET_T *strp,
|
||||
int statflg)
|
||||
{
|
||||
VBL_T *vblp;
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
if (pktp->pdu_type == TRAP_PDU)
|
||||
vblp = &(pktp->pdu.trap_pdu.trap_vbl);
|
||||
else
|
||||
#endif
|
||||
vblp = &(pktp->pdu.std_pdu.std_vbl);
|
||||
|
||||
return(VBL_Bind_String(vblp, indx, tcount, tlist, flags_n_type,
|
||||
leng, strp, statflg));
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* VBL_Bind_Opaque - bind an opaque value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int VBL_Bind_Opaque
|
||||
* (
|
||||
* VBL_T * vblp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* int leng,
|
||||
* OCTET_T * strp,
|
||||
* int statflg
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds an opaque 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 <leng>
|
||||
* Specify the length of the string to be bound.
|
||||
* \i <*strp>
|
||||
* Specify the address of the string to be bound.
|
||||
* \i <statflg>
|
||||
* Indicate whether the string must be copied (0) or may be used as is in its
|
||||
* current location (1).
|
||||
* \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_IP_Address(), VBL_Bind_Null(), VBL_Bind_Object_ID(),
|
||||
* VBL_Bind_String(), VBL_Bind_64_Unsigned_Integer(), VBL_Bind_Timeticks(),
|
||||
* VBL_Bind_Unsigned_Integer(), VBList_Allocate()
|
||||
*/
|
||||
/*******************************************************************************
|
||||
*
|
||||
* VBL_Bind_String - bind an octet string value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int VBL_Bind_String
|
||||
* (
|
||||
* VBL_T * vblp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* OCTET_T flags_n_type,
|
||||
* int leng,
|
||||
* OCTET_T * strp,
|
||||
* int statflg
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds an octet string value into a 'VarBind' in the 'VBL_T'
|
||||
* structure (<vblp>) created by VBList_Allocate().
|
||||
*
|
||||
* \&NOTE: It may be more convenient to use VBL_Bind_Opaque().
|
||||
*
|
||||
* 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 <flags_n_type>
|
||||
* Specify one of the 'VarBindType' constants 'VT_STRING' or 'VT_OPAQUE,' which
|
||||
* are defined in the file 'vbdefs.h'.
|
||||
* \i <leng>
|
||||
* Specify the length of the string to be bound.
|
||||
* \i <*strp>
|
||||
* Specify the address of the string to be bound.
|
||||
* \i <statflg>
|
||||
* Indicate whether the string must be copied (0) or may be used as is in its
|
||||
* current location (1).
|
||||
* \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_IP_Address(), 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_String(VBL_T *vblp,
|
||||
int indx,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
OCTET_T flags_n_type,
|
||||
int leng,
|
||||
OCTET_T *strp,
|
||||
int statflg)
|
||||
{
|
||||
VB_T *vbp;
|
||||
OCTET_T *buffp;
|
||||
|
||||
if ((vbp = vblp_index_to_vbp(vblp, indx)) == 0)
|
||||
return -1;
|
||||
|
||||
if (build_object_id(tcount, tlist, &(vbp->vb_obj_id)) == -1)
|
||||
return -1;
|
||||
|
||||
if ((statflg == 0) && (leng != 0)){
|
||||
if ((buffp = (OCTET_T *)SNMP_memory_alloc((unsigned int)leng)) == 0) {
|
||||
Clean_Obj_ID(&(vbp->vb_obj_id));
|
||||
return -1;
|
||||
}
|
||||
(void) MEMCPY((PTR_T)buffp, (PTR_T)strp,
|
||||
(unsigned int)leng); /* Length known to be != zero */
|
||||
EBufferPreLoad(BFL_IS_DYNAMIC, &(vbp->value_u.v_string), buffp, leng);
|
||||
}
|
||||
else { /* Buffer is either static or has zero length */
|
||||
EBufferPreLoad(BFL_IS_STATIC, &(vbp->value_u.v_string),
|
||||
leng != 0 ? strp : 0, leng);
|
||||
}
|
||||
|
||||
vbp->vb_data_flags_n_type = flags_n_type;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
/* bindui64.c - bindui64.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: bindui64.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:05 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.4 2001/01/19 22:22:18 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.3 2000/03/17 00:18:59 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.2 1999/09/14 19:10:28 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:16 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:06 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:53:09 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:26 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:43 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:48:41 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:12 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains bindui64.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>
|
||||
#include <wrn/wm/snmp/engine/ui64.h>
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* SNMP_Bind_64_Unsigned_Integer - bind a 64-bit unsigned integer value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int SNMP_Bind_64_Unsigned_Integer
|
||||
* (
|
||||
* SNMP_PKT_T * pktp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* OCTET_T flags_n_type,
|
||||
* UINT_32_T high,
|
||||
* UINT_32_T low
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds a 64-bit unsigned integer 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().
|
||||
*
|
||||
* \&NOTE: It may be more convenient to use SNMP_Bind_Counter().
|
||||
*
|
||||
* 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 <flags_n_type>
|
||||
* Specify the 'VarBindType' constant 'VT_COUNTER64', which is defined in the
|
||||
* file 'vbdefs.h'.
|
||||
* \i <high>
|
||||
* Specify the high 32-bit section of the 64-bit value to be bound.
|
||||
* \i <low>
|
||||
* Specify the low 32-bit section of the 64-bit value to be bound.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If successful, this routine returns 0. Otherwise, it returns -1.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: SNMP_Bind_Counter(), SNMP_Create_Request2(),
|
||||
* SNMP_Create_Request_V3(), SNMP_Create_Trap()
|
||||
*/
|
||||
int
|
||||
SNMP_Bind_64_Unsigned_Integer(SNMP_PKT_T *pktp,
|
||||
int indx,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
OCTET_T flags_n_type,
|
||||
UINT_32_T high,
|
||||
UINT_32_T low)
|
||||
{
|
||||
VBL_T *vblp;
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
if (pktp->pdu_type == TRAP_PDU)
|
||||
vblp = &(pktp->pdu.trap_pdu.trap_vbl);
|
||||
else
|
||||
#endif
|
||||
vblp = &(pktp->pdu.std_pdu.std_vbl);
|
||||
|
||||
return(VBL_Bind_64_Unsigned_Integer(vblp, indx, tcount, tlist,
|
||||
flags_n_type, high, low));
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* VBL_Bind_64_Unsigned_Integer - bind a 64-bit unsigned integer value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int VBL_Bind_64_Unsigned_Integer
|
||||
* (
|
||||
* VBL_T * vblp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* OCTET_T flags_n_type,
|
||||
* UINT_32_T high,
|
||||
* UINT_32_T low
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds a 64-bit unsigned integer value into a 'VarBind' in the
|
||||
* 'VBL_T' structure (<vblp>) created by VBList_Allocate().
|
||||
*
|
||||
* \&NOTE: It may be more convenient to use VBL_Bind_Counter().
|
||||
*
|
||||
* 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 <flags_n_type>
|
||||
* Specify the 'VarBindType' constant 'VT_COUNTER64', which is defined in the
|
||||
* file 'vbdefs.h'.
|
||||
* \i <high>
|
||||
* Specify the high 32-bit section of the 64-bit value to be bound.
|
||||
* \i <low>
|
||||
* Specify the low 32-bit section of the 64-bit value 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_IP_Address(), 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_64_Unsigned_Integer(VBL_T *vblp,
|
||||
int indx,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
OCTET_T flags_n_type,
|
||||
UINT_32_T high,
|
||||
UINT_32_T low)
|
||||
{
|
||||
VB_T *vbp;
|
||||
|
||||
if (flags_n_type != VT_COUNTER64)
|
||||
return (-1);
|
||||
|
||||
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 = flags_n_type;
|
||||
vbp->value_u.v_counter64.high = high;
|
||||
vbp->value_u.v_counter64.low = low;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,544 @@
|
||||
/* binduint.c - binduint.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: binduint.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:05 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.4 2001/01/19 22:22:19 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.3 2000/03/17 00:19:00 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.2 1999/09/14 19:10:29 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:17 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:07 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:53:09 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:27 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:44 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:48:43 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 uinteger32 & no_pp stuff
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:47:13 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.2 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.1 1993/02/17 21:00:51 sar
|
||||
* Added data type VT_UINTEGER32
|
||||
*
|
||||
* Revision 3.0 92/04/03 19:52:37 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 2.102 91/10/30 20:41:40 dab
|
||||
* Directly include asn1conf.h, snmpdefs.h, and snmpstat.h (if needed).
|
||||
*
|
||||
* Revision 2.101 91/08/15 12:30:46 dab
|
||||
* Removed <libfuncs.h>.
|
||||
*
|
||||
* Revision 2.100 91/08/09 14:08:16 dab
|
||||
* Update version.
|
||||
*
|
||||
* Revision 1.1 91/07/30 02:23:27 romkey
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
* Rev 2.0 31 Mar 1990 15:06:38
|
||||
* Release 2.00
|
||||
*
|
||||
* Rev 1.0 11 Jan 1989 12:11:52
|
||||
* Initial revision.
|
||||
*
|
||||
* Separated from buildpkt.c on January 11, 1989.
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains binduint.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_Counter - bind a counter value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int SNMP_Bind_Counter
|
||||
* (
|
||||
* SNMP_PKT_T * pktp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* UINT_32_T value
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds a counter value into a 'VarBind' in a '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 <value>
|
||||
* Specify the integer value 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()
|
||||
*/
|
||||
/*******************************************************************************
|
||||
*
|
||||
* SNMP_Bind_Gauge - bind a gauge value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int SNMP_Bind_Gauge
|
||||
* (
|
||||
* SNMP_PKT_T * pktp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* UINT_32_T value
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds a gauge 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 <value>
|
||||
* Specify the integer value 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()
|
||||
*/
|
||||
/*******************************************************************************
|
||||
*
|
||||
* SNMP_Bind_Timeticks - bind a timetick value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int SNMP_Bind_timeticks
|
||||
* (
|
||||
* SNMP_PKT_T * pktp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* UINT_32_T value
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds a timetick 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 <value>
|
||||
* Specify the integer value 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()
|
||||
*/
|
||||
/*******************************************************************************
|
||||
*
|
||||
* SNMP_Bind_Unsigned_Integer - bind an unsigned integer value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int SNMP_Bind_Unsigned_Integer
|
||||
* (
|
||||
* SNMP_PKT_T * pktp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* OCTET_T flags_n_type,
|
||||
* UINT_32_T value
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds an unsigned integer 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().
|
||||
*
|
||||
* \&NOTE: It may be more convenient to use one of the following:
|
||||
* SNMP_Bind_Gauge(), SNMP_Bind_Timeticks(), or SNMP_Bind_Counter().
|
||||
*
|
||||
* 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 <flags_n_type>
|
||||
* Specify of the 'VarBindType' constants 'VT_COUNTER', 'VT_GAUGE' or
|
||||
* 'VT_TIMETICKS', which are defined in the file 'vbdefs.h'.
|
||||
* \i <value>
|
||||
* Specify the integer value to be bound.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If successful, this routine returns 0. Otherwise, it returns -1.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: SNMP_Bind_Counter(). SNMP_Bind_Gauge(). SNMP_Bind_Gauge(),
|
||||
* SNMP_Create_Request2(), SNMP_Create_Request_V3(), SNMP_Create_Trap()
|
||||
*/
|
||||
int
|
||||
SNMP_Bind_Unsigned_Integer(SNMP_PKT_T *pktp,
|
||||
int indx,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
OCTET_T flags_n_type,
|
||||
UINT_32_T value)
|
||||
{
|
||||
VBL_T *vblp;
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
if (pktp->pdu_type == TRAP_PDU)
|
||||
vblp = &(pktp->pdu.trap_pdu.trap_vbl);
|
||||
else
|
||||
#endif
|
||||
vblp = &(pktp->pdu.std_pdu.std_vbl);
|
||||
|
||||
return(VBL_Bind_Unsigned_Integer(vblp, indx, tcount, tlist,
|
||||
flags_n_type, value));
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* VBL_Bind_Counter - bind a counter value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int VBL_Bind_Counter
|
||||
* (
|
||||
* VBL_T * pktp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* UINT_32_T value
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds a counter 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 <value>
|
||||
* Specify the integer value to be bound.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If successful, this routine returns 0. Otherwise, it returns -1.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: VBL_Bind_Gauge(), VBL_Bind_Integer(), VBL_Bind_IP_Address(),
|
||||
* 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()
|
||||
*/
|
||||
/*******************************************************************************
|
||||
*
|
||||
* VBL_Bind_Gauge - bind a gauge value into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int VBL_Bind_Gauge
|
||||
* (
|
||||
* VBL_T * pktp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* UINT_32_T value
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds a gauge 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 <value>
|
||||
* Specify the integer value 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_Integer(), VBL_Bind_IP_Address(),
|
||||
* 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()
|
||||
*/
|
||||
/*******************************************************************************
|
||||
*
|
||||
* VBL_Bind_Timeticks - bind a timetick <value> into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int VBL_Bind_Timeticks
|
||||
* (
|
||||
* VBL_T * pktp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* UINT_32_T value
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds a time ticks 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 <value>
|
||||
* Specify the integer value 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_IP_Address(), 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()
|
||||
*/
|
||||
/*******************************************************************************
|
||||
*
|
||||
* VBL_Bind_Unsigned_Integer - bind an unsigned integer <value> into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int VBL_Bind_Unsigned_Integer
|
||||
* (
|
||||
* VBL_T * vblp,
|
||||
* int index,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* OCTET_T flags_n_type,
|
||||
* UINT_32_T value
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine binds an unsigned integer value into a 'VarBind' in the 'VBL_T'
|
||||
* structure (<vblp>) created by VBList_Allocate().
|
||||
*
|
||||
* \&NOTE: It may be more convenient to use one of the following macros:
|
||||
* VBL_Bind_Gauge(), VBL_Bind_Timeticks(), or VBL_Bind_Counter().
|
||||
*
|
||||
* 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 <flags_n_type>
|
||||
* Specify of the 'VarBindType' constants 'VT_COUNTER', 'VT_GAUGE' or
|
||||
* 'VT_TIMETICKS', which are defined in the file 'vbdefs.h'.
|
||||
* \i <value>
|
||||
* Specify the integer <value> 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_IP_Address(), 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_Unsigned_Integer(VBL_T *vblp,
|
||||
int indx,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
OCTET_T flags_n_type,
|
||||
UINT_32_T value)
|
||||
{
|
||||
VB_T *vbp;
|
||||
|
||||
if (!((flags_n_type == VT_COUNTER) || (flags_n_type == VT_GAUGE) ||
|
||||
(flags_n_type == VT_TIMETICKS)))
|
||||
return -1;
|
||||
|
||||
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 = flags_n_type;
|
||||
vbp->value_u.v_counter = value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,328 @@
|
||||
/* buildpkt.c - buildpkt.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: buildpkt.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:06 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.6 2001/04/11 20:12:02 josh
|
||||
* merging changes from the kingfisher branch back onto
|
||||
* the trunk
|
||||
*
|
||||
* Revision 9.5 2001/01/19 22:22:19 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.4.2.2 2001/03/12 22:08:12 tneale
|
||||
* Updated copyright
|
||||
*
|
||||
* Revision 9.4.2.1 2001/02/09 18:38:38 josh
|
||||
* vblp_index_to_vbp() was updated to walk linked varbind lists
|
||||
*
|
||||
* Revision 9.4 2000/03/17 00:19:01 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.3 1999/10/02 01:37:27 sar
|
||||
* Update the vbp to index code to handle get bulk error conditions.
|
||||
*
|
||||
* Revision 9.2 1999/09/14 19:27:03 josh
|
||||
* New function: vblp_index_to_vbp()
|
||||
*
|
||||
* Revision 9.1 1998/11/30 20:28:16 sar
|
||||
* Fix vbp to index code to allow the multiple vblists to be allocated from
|
||||
* random pieces of memory, previously the vblists would need to have been
|
||||
* allocated from lower addresses to higher address in order.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:09 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:53:10 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:30 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:44 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:48:45 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.0 1995/05/31 21:47:16 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.2 1995/05/08 20:32:04 sar
|
||||
* Did some casting between pointer arithmetic, ints and ALENGTH_Ts to
|
||||
* keep compilers happy.
|
||||
*
|
||||
* Revision 5.1 1995/03/21 00:25:01 sar
|
||||
* Added vbp_to_index and updated index_to_vbp to understand var bind list
|
||||
* chains.
|
||||
*
|
||||
* 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.3 1993/06/02 23:09:24 dab
|
||||
* Changed #ifdef's to #if's for things from install.h
|
||||
*
|
||||
* Revision 3.2 1993/04/27 21:10:00 sar
|
||||
* Changed locate_vb to index_to_vbp
|
||||
*
|
||||
* Revision 3.1 1993/04/26 20:37:09 sar
|
||||
* Added ifdefs to allow clean makes of version 1 and 2, added bit strings,
|
||||
* arrange for deletion of acls with the party or context they refer to
|
||||
* is deleted.
|
||||
*
|
||||
* Revision 3.0 1992/04/03 19:52:37 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 2.102 91/10/30 20:41:50 dab
|
||||
* Directly include asn1conf.h, snmpdefs.h, and snmpstat.h (if needed).
|
||||
*
|
||||
* Revision 2.101 91/08/15 12:30:48 dab
|
||||
* Removed <libfuncs.h>.
|
||||
*
|
||||
* Revision 2.100 91/08/09 14:08:17 dab
|
||||
* Update version.
|
||||
*
|
||||
* Revision 1.1 91/07/30 02:23:29 romkey
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
* Rev 2.0 31 Mar 1990 15:06:40
|
||||
* Release 2.00
|
||||
*
|
||||
* Rev 1.7 27 Apr 1989 15:55:58
|
||||
* Removed unused variables
|
||||
*
|
||||
* Rev 1.6 11 Jan 1989 12:11:22
|
||||
* Split into multiple files to prevent linker from picking up unused files.
|
||||
*
|
||||
* Rev 1.5 20 Sep 1988 22:51:38
|
||||
* Corrected erroneous call to EBufferInitialize (should have been
|
||||
* EBufferPreLoad.
|
||||
*
|
||||
* Rev 1.4 20 Sep 1988 19:11:50
|
||||
* Added procedure to build a VB list element containing a null value.
|
||||
*
|
||||
* Rev 1.3 19 Sep 1988 17:26:56
|
||||
* Made changes to make the Sun C compiler happy.
|
||||
*
|
||||
* Rev 1.2 17 Sep 1988 18:57:14
|
||||
* Corrected miscalculation of whether a given var bind index was in-range.
|
||||
*
|
||||
* Rev 1.1 14 Sep 1988 17:57:14
|
||||
* Moved includes of system include files into libfuncs.h.
|
||||
*
|
||||
* Rev 1.0 12 Sep 1988 10:46:54
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains buildpkt.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>
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* index_to_vbp - translate an index into a 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* VB_T * index_to_vbp
|
||||
* (
|
||||
* SNMP_PKT_T * pktp,
|
||||
* int index
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine translates an index into a 'VarBind'.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <*pktp>
|
||||
* Specify an SNMP packet.
|
||||
* \i <index>
|
||||
* Specify the index to translate.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If successful, this routine returns a pointer to the 'VarBind'.
|
||||
* Otherwise, it returns 0.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: 'VB_TO_COOKIE(),' vbp_to_index()
|
||||
*/
|
||||
VB_T *
|
||||
index_to_vbp(SNMP_PKT_T *pktp,
|
||||
int indx)
|
||||
{
|
||||
VBL_T *vblp;
|
||||
|
||||
/* If this is version 1 where we get the vblp from depends on the pdu type
|
||||
in version 2 we always get it from the standard area.
|
||||
In version 2 we have the complication of multiple vblists chained
|
||||
together for the getbulk operation */
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
if (pktp->pdu_type == TRAP_PDU)
|
||||
vblp = &(pktp->pdu.trap_pdu.trap_vbl);
|
||||
else
|
||||
#endif
|
||||
vblp = &(pktp->pdu.std_pdu.std_vbl);
|
||||
|
||||
return(vblp_index_to_vbp(vblp, indx));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
\NOMANUAL
|
||||
NAME: vblp_index_to_vbp
|
||||
|
||||
PURPOSE: Given a VarBindList and the zero-based index of a varBind
|
||||
element in that list, return a pointer to that VB_T
|
||||
|
||||
PARAMETERS:
|
||||
VBL_T * The VarBindList.
|
||||
int The index of the VB_T desired.
|
||||
(0 is the index of the first VB_T).
|
||||
|
||||
RETURNS: VB_T * The address of the desired varBind element
|
||||
(VB_T *)0 returned if out of range.
|
||||
****************************************************************************/
|
||||
VB_T *
|
||||
vblp_index_to_vbp(VBL_T *vblp,
|
||||
int vb_index)
|
||||
{
|
||||
for (; vblp; vblp = vblp->vblp) {
|
||||
if (vb_index < vblp->vbl_count)
|
||||
return &(vblp->vblist[vb_index]);
|
||||
else
|
||||
vb_index -= vblp->vbl_count;
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* vbp_to_index - determine the index for a specific 'VarBind'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int vbp_to_index
|
||||
* (
|
||||
* SNMP_PKT_T * pktp,
|
||||
* VB_T * vbp
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine determines the index for a specific 'VarBind'.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <*pktp>
|
||||
* Specify an SNMP packet.
|
||||
* \i <*vbp>
|
||||
* Specify the root of a 'VarBindList'. The first 'VarBind' is index 0.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If successful, this routine returns the index. Otherwise, it returns
|
||||
* -1.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: index_to_vbp(), VB_TO_COOKIE()
|
||||
*/
|
||||
int
|
||||
vbp_to_index_error(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
int mode)
|
||||
{
|
||||
VBL_T *vblp;
|
||||
int count = 0;
|
||||
|
||||
/* If this is version 1 where we get the vblp from depends on the pdu type
|
||||
in version 2 we always get it from the standard area.
|
||||
In version 2 we have the complication of multiple vblists chained
|
||||
together for the getbulk operation */
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
if (pktp->pdu_type == TRAP_PDU)
|
||||
vblp = &(pktp->pdu.trap_pdu.trap_vbl);
|
||||
else
|
||||
vblp = &(pktp->pdu.std_pdu.std_vbl);
|
||||
#else
|
||||
vblp = &(pktp->pdu.std_pdu.std_vbl);
|
||||
#endif
|
||||
|
||||
/* Check whether the requested index is within the VarBindList */
|
||||
for (; vblp; vblp = vblp->vblp) {
|
||||
if ((vbp >= vblp->vblist) &&
|
||||
(vbp < (vblp->vblist + vblp->vbl_count))) {
|
||||
if (mode == 0)
|
||||
return(count + ((int)(vbp - vblp->vblist)));
|
||||
else {
|
||||
/* If count is zero we are processing the first vblp
|
||||
and we can get the index directly, otherise we need
|
||||
to adjust the count for the non repeaters which aren't
|
||||
in the othe vblps */
|
||||
if (count == 0)
|
||||
count = 1;
|
||||
else
|
||||
count = pktp->pdu.std_pdu.non_reps + 1;
|
||||
return(count + ((int)(vbp - vblp->vblist)));
|
||||
}
|
||||
}
|
||||
else
|
||||
count += vblp->vbl_count;
|
||||
}
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,336 @@
|
||||
/*
|
||||
* Copyright 2001-2010 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: commlkup.c,v $
|
||||
* Revision 1.6 2002/07/09 19:28:20 josh
|
||||
* make sure that we only use active entries from the community table
|
||||
*
|
||||
* Revision 1.5 2002/05/17 18:46:49 josh
|
||||
* improve use of MMS in PDU processing
|
||||
*
|
||||
* Revision 1.4 2002/05/13 16:14:49 josh
|
||||
* initialize src_tdomain to {0, 0}
|
||||
*
|
||||
* Revision 1.3 2002/04/08 19:57:43 josh
|
||||
* fix the way masks are used by find_target_by_community()
|
||||
* make sure that we pass the correct value to SNMP_V3_Access_Find()
|
||||
* make sure we return a badCommunityUse error when no view is found
|
||||
*
|
||||
* Revision 1.2 2001/11/06 21:20:06 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 1.1.2.3 2001/09/21 19:20:59 josh
|
||||
* make sure we don't reject unknown community strings out of hand
|
||||
* on incoming responses
|
||||
*
|
||||
* Revision 1.1.2.2 2001/08/07 18:33:58 josh
|
||||
* adding support for SNMPv1/v2c/v3 coexistence to SNMP Notify code
|
||||
*
|
||||
* Revision 1.1.2.1 2001/07/20 20:34:36 josh
|
||||
* a community table based validation routine that can
|
||||
* supercede existing community validation routines
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,15jun10,y_t update for LP64
|
||||
01c,07nov08,y_t fix for proxy engineID compare issue
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/objectid.h>
|
||||
#include <wrn/wm/snmp/engine/v3_eng.h>
|
||||
#include <wrn/wm/snmp/engine/v3_acc.h>
|
||||
#include <wrn/wm/snmp/engine/v3_proxy.h>
|
||||
#include <wrn/wm/snmp/engine/v3_comm.h>
|
||||
#include <wrn/wm/snmp/engine/v3_trgt.h>
|
||||
#include <wrn/wm/snmp/engine/ntfy_chk.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
#include <wrn/wm/snmp/engine/wkobj.h>
|
||||
|
||||
/**********************************************************************
|
||||
find_target_by_community -- Based on the value of
|
||||
snmpCommunityTransportTag, find a matching entry in the
|
||||
snmpTargetAddrTable.
|
||||
|
||||
The parameters to this procedure are:
|
||||
EBUFFER_T * transport tag
|
||||
OBJ_ID_T * TDomain
|
||||
EBUFFER_T * TAddress
|
||||
|
||||
Returns: A pointer to a target_addr object if a matching one exists,
|
||||
0 otherwise.
|
||||
|
||||
**********************************************************************/
|
||||
/*ARGSUSED*/
|
||||
|
||||
SNMP_TARGET_ADDR_T *
|
||||
find_target_by_community(EBUFFER_T *transport_tag,
|
||||
OBJ_ID_T *tdomain,
|
||||
EBUFFER_T *taddress)
|
||||
{
|
||||
SNMP_TARGET_ADDR_T *test_taddr;
|
||||
ALENGTH_T address_len;
|
||||
int i;
|
||||
bits8_t *taddr_chk, *comm_chk;
|
||||
|
||||
for (test_taddr = root_target_addr ; test_taddr ;
|
||||
test_taddr = test_taddr->next) {
|
||||
/* Is this an active entry with a matching tag? */
|
||||
if ((taglist_check(&(test_taddr->tag_list), transport_tag) != 0) ||
|
||||
(SNMP_Target_Addr_Get_Status(test_taddr) != ETC_RS_ACTIVE))
|
||||
continue;
|
||||
|
||||
/* Do the TDomains match? */
|
||||
if (oidcmp2(SNMP_Target_Addr_Get_TDomain(test_taddr)->num_components,
|
||||
SNMP_Target_Addr_Get_TDomain(test_taddr)->component_list,
|
||||
tdomain->num_components,
|
||||
tdomain->component_list) != 0)
|
||||
continue;
|
||||
|
||||
/* Compare TAddress lengths */
|
||||
address_len = SNMP_Target_Addr_Get_TAddress_Len(test_taddr);
|
||||
if (EBufferUsed(taddress) != address_len)
|
||||
continue;
|
||||
|
||||
/* Compare TAddress values (modulo TMask) */
|
||||
for (i = 0, taddr_chk = SNMP_Target_Addr_Get_TAddress(test_taddr),
|
||||
comm_chk = EBufferStart(taddress) ;
|
||||
i < address_len * 8 ;
|
||||
i++) {
|
||||
if (taddr_chk[i/8] != comm_chk[i/8]) {
|
||||
if (i < SNMP_Target_Addr_Get_TMask_Len(test_taddr) * 8) {
|
||||
if (SNMP_Target_Addr_Get_TMask(test_taddr)[i/8] &
|
||||
(0x80 >> (i%8)))
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
else
|
||||
i += 7; /* Go on to next byte. */
|
||||
}
|
||||
if (i == address_len * 8)
|
||||
break;
|
||||
}
|
||||
return(test_taddr);
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
lookup_SNMP_community -- Check an operation against the community name
|
||||
using the community table from RFC 2576.
|
||||
|
||||
The parameters to this procedure are:
|
||||
SNMP_PKT_T * The received packet (decoded format)
|
||||
SNMPADDR_T * Source of the packet
|
||||
SNMPADDR_T * Destination of the packet (most likely
|
||||
the address of the machine on which this
|
||||
code is running.)
|
||||
|
||||
This procedure should return 0 if a reasonable view can be assigned
|
||||
and 1 if not.
|
||||
|
||||
**********************************************************************/
|
||||
/*ARGSUSED*/
|
||||
|
||||
int lookup_SNMP_community(SNMP_PKT_T *rp,
|
||||
SNMPADDR_T *pktsrc,
|
||||
SNMPADDR_T *pktdst)
|
||||
{
|
||||
SNMP_COMMUNITY_T *comm;
|
||||
SNMP_TARGET_ADDR_T *taddr;
|
||||
SNMP_GROUP_T *group;
|
||||
SNMP_ACCESS_T *access = 0;
|
||||
bits8_t *com_str;
|
||||
ALENGTH_T com_len;
|
||||
OBJ_ID_T src_tdomain;
|
||||
EBUFFER_T src_taddress;
|
||||
int addr_converted = 0;
|
||||
ALENGTH_T id_len;
|
||||
|
||||
/* Step 1: Perform address validation. */
|
||||
if (SNMP_validate_address(rp, pktsrc, pktdst) != 0)
|
||||
return 1;
|
||||
|
||||
com_str = EBufferStart(&(rp->community));
|
||||
com_len = EBufferUsed(&(rp->community));
|
||||
|
||||
/* convert the source address into a TDomain/TAddress pair */
|
||||
EBufferInitialize(&src_taddress);
|
||||
src_tdomain.num_components = 0;
|
||||
src_tdomain.component_list = 0;
|
||||
if (ENVOY_SNMPADDR_TO_TADDRESS(pktsrc, &src_tdomain, &src_taddress) == 0)
|
||||
addr_converted = 1;
|
||||
|
||||
/* Step 2: Find a matching entry in the snmpCommunityTable */
|
||||
for (comm = root_community ; comm ; comm = comm->next) {
|
||||
/* Is this entry active? */
|
||||
if (SNMP_Community_Get_Status(comm) != ETC_RS_ACTIVE)
|
||||
continue;
|
||||
|
||||
/* Does the community string match snmpCommunityName? */
|
||||
if ((SNMP_Community_Get_Name_Len(comm) != com_len) ||
|
||||
(MEMCMP_NULLOK(SNMP_Community_Get_Name(comm),
|
||||
com_str, com_len) != 0))
|
||||
continue;
|
||||
|
||||
/* Is the tag field empty? OR Is this a response? */
|
||||
if ((SNMP_Community_Get_Tag_Len(comm) == 0) ||
|
||||
((rp->pdu_type & (GET_RESPONSE_PDU | REPORT_PDU)) != 0))
|
||||
break;
|
||||
|
||||
/*
|
||||
* If we can't convert the SNMPADDR_T to a TDomain/TAddress pair,
|
||||
* then we can't use any entry with a non-empty tag field.
|
||||
*/
|
||||
if (addr_converted == 0)
|
||||
continue;
|
||||
|
||||
/* We need to find a valid entry in the target addr table. */
|
||||
taddr = find_target_by_community(&(comm->comm_tag),
|
||||
&src_tdomain,
|
||||
&src_taddress);
|
||||
if (taddr) {
|
||||
rp->msg_max_size = (sbits32_t)SNMP_Target_Addr_Get_MMS(taddr);
|
||||
rp->maxpkt = (ALENGTH_T)(max(rp->maxpkt, rp->msg_max_size));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Did we find an entry? */
|
||||
EBufferClean (&src_taddress);
|
||||
Clean_Obj_ID (&src_tdomain);
|
||||
if (comm == 0) {
|
||||
/* No community match. Problem only if this is a request that we
|
||||
* might have to process or forward.
|
||||
*/
|
||||
switch (rp->pdu_type) {
|
||||
case GET_REQUEST_PDU:
|
||||
case GET_NEXT_REQUEST_PDU:
|
||||
case SET_REQUEST_PDU:
|
||||
case GET_BULK_REQUEST_PDU:
|
||||
return 2;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* We found an entry -- install its name into the packet */
|
||||
EBufferAllocateLoad(BFL_IS_ALLOC, &rp->comm_entry,
|
||||
SNMP_Community_Get_Index(comm),
|
||||
SNMP_Community_Get_Index_Len(comm));
|
||||
|
||||
/* Check the context engine id. If it's not our own, this may
|
||||
need to be forwarded. */
|
||||
id_len = (ALENGTH_T)(min(SNMP_Community_Get_Con_ID_Len(comm), v3_my_engine->id_len));
|
||||
if ((SNMP_Community_Get_Con_ID_Len(comm) != v3_my_engine->id_len) ||
|
||||
(MEMCMP(SNMP_Community_Get_Con_ID(comm), v3_my_engine->id,
|
||||
id_len) != 0)) {
|
||||
#if INSTALL_ENVOY_SNMP_V3_PROXY
|
||||
switch (rp->pdu_type) {
|
||||
case GET_REQUEST_PDU:
|
||||
case GET_NEXT_REQUEST_PDU:
|
||||
case SET_REQUEST_PDU:
|
||||
case GET_BULK_REQUEST_PDU:
|
||||
rp->proxy_routine = (PROXY_ROUTINE_T *) snmpProxyV3Request;
|
||||
break;
|
||||
case INFORM_REQUEST_PDU:
|
||||
case TRAP2_PDU:
|
||||
rp->proxy_routine = (PROXY_ROUTINE_T *) snmpProxyV3Notify;
|
||||
break;
|
||||
case GET_RESPONSE_PDU:
|
||||
case REPORT_PDU:
|
||||
rp->proxy_routine = (PROXY_ROUTINE_T *) snmpProxyV3Response;
|
||||
break;
|
||||
default:
|
||||
rp->proxy_routine = 0;
|
||||
return(2);
|
||||
}
|
||||
return(0);
|
||||
#else /* #if INSTALL_ENVOY_SNMP_V3_PROXY */
|
||||
/*
|
||||
* contextEngineID doesn't match and we're not doing proxy. If it's a
|
||||
* request, then we have a problem. Other PDU types can just pass
|
||||
* through, though.
|
||||
*/
|
||||
switch (rp->pdu_type)
|
||||
{
|
||||
case GET_REQUEST_PDU:
|
||||
case GET_NEXT_REQUEST_PDU:
|
||||
case SET_REQUEST_PDU:
|
||||
case GET_BULK_REQUEST_PDU:
|
||||
return 2;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
#endif /* #if INSTALL_ENVOY_SNMP_V3_PROXY */
|
||||
}
|
||||
|
||||
/* We have an appropriate community entry. Look up the corresponding
|
||||
group, if necessary. */
|
||||
|
||||
switch (rp->pdu_type) {
|
||||
case GET_REQUEST_PDU:
|
||||
case GET_NEXT_REQUEST_PDU:
|
||||
case SET_REQUEST_PDU:
|
||||
case GET_BULK_REQUEST_PDU:
|
||||
group = SNMP_Group_Lookup((rp->snmp_version == SNMP_VERSION_1) ?
|
||||
ETC_SEC_MODEL_V1 : ETC_SEC_MODEL_V2,
|
||||
SNMP_Community_Get_Sec_Name(comm),
|
||||
SNMP_Community_Get_Sec_Name_Len(comm));
|
||||
|
||||
if (group && (SNMP_Group_Get_Status(group) == ETC_RS_ACTIVE)) {
|
||||
/* We have a group -- look up the access entry */
|
||||
access = SNMP_V3_Access_Find(SNMP_Group_Get_Group(group),
|
||||
SNMP_Group_Get_Group_Len(group),
|
||||
SNMP_Community_Get_Con_Name(comm),
|
||||
SNMP_Community_Get_Con_Name_Len(comm),
|
||||
((rp->snmp_version == SNMP_VERSION_1) ?
|
||||
ETC_SEC_MODEL_V1 : ETC_SEC_MODEL_V2),
|
||||
ETC_SEC_LEVEL_NONE);
|
||||
}
|
||||
|
||||
if (access) {
|
||||
if (rp->pdu_type == SET_REQUEST_PDU) {
|
||||
EBufferAllocateLoad(BFL_IS_ALLOC, &rp->view_name,
|
||||
SNMP_V3_Access_Get_Write(access),
|
||||
SNMP_V3_Access_Get_Write_Len(access));
|
||||
if (SNMP_V3_Access_Get_Write_Len(access) == 0)
|
||||
/* No write view */
|
||||
return 3;
|
||||
}
|
||||
else {
|
||||
EBufferAllocateLoad(BFL_IS_ALLOC, &rp->view_name,
|
||||
SNMP_V3_Access_Get_Read(access),
|
||||
SNMP_V3_Access_Get_Read_Len(access));
|
||||
if (SNMP_V3_Access_Get_Read_Len(access) == 0)
|
||||
/* No read view */
|
||||
return 3;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
return(2);
|
||||
default:
|
||||
/* allow other pdu types through without checking */
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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 1986-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: copyrite.c,v $
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:22:19 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:19:01 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:12 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:33 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:45 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:48:47 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.0 1995/05/31 21:47:17 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/03/01 23:25:02 dab
|
||||
* More years added
|
||||
*
|
||||
* Revision 3.0 1992/04/03 19:52:37 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 2.101 91/10/30 20:44:10 dab
|
||||
* Added 1991 to list.
|
||||
*
|
||||
* Revision 2.100 91/08/09 14:08:18 dab
|
||||
* Update version.
|
||||
*
|
||||
* Revision 1.1 91/07/30 02:23:31 romkey
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
* Rev 2.1 17 Aug 1990 14:00:26
|
||||
* Added 1990 to the list of copyright years.
|
||||
*
|
||||
* Rev 2.0 31 Mar 1990 15:06:42
|
||||
* Release 2.00
|
||||
*
|
||||
* Rev 1.0 11 Jan 1989 13:24:24
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*lint -e14 */
|
||||
char etc_copyright[] =
|
||||
"@(#) Copyright 1986-1997 Epilogue Technology Corporation\012";
|
||||
char isi_copyright[] =
|
||||
"@(#) Copyright 1997-1998 Integrated Systems, Inc\012";
|
||||
char wind_copyright[] =
|
||||
"@(#) Copyright 2000-2005 Wind River Systems, Inc\012";
|
||||
/*lint +e14 */
|
||||
@@ -0,0 +1,615 @@
|
||||
/*
|
||||
* Copyright 2000-2010, 2013 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.
|
||||
*/
|
||||
|
||||
/* copyvb.c - code to handle copying of varbinds and varbind lists */
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01e,17sep13,bbz fix for MISS BREAK warning
|
||||
01d,06aug13,bbz clear the med impact warning from prevent.pl(WIND00429583)
|
||||
01c,10jun10,y_t update for LP64
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
$Log: copyvb.c,v $
|
||||
Revision 1.5 2003/01/15 14:05:02 josh
|
||||
directory structure shifting
|
||||
|
||||
Revision 1.4 2002/04/19 15:33:30 josh
|
||||
fixing OIDs that are being checked against in SNMP_Convert_VB()
|
||||
|
||||
Revision 1.3 2001/11/06 21:50:44 josh
|
||||
second (and hopefully final) pass of new path hacking
|
||||
|
||||
Revision 1.2 2001/11/06 21:20:06 josh
|
||||
revised new path hacking
|
||||
|
||||
Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
Tornado shuffle
|
||||
|
||||
Revision 1.1.2.3 2001/09/27 01:12:04 meister
|
||||
dynamic config rototill
|
||||
|
||||
Revision 1.1.2.2 2001/09/21 20:52:29 josh
|
||||
extra cleanup for various combinations of installation options
|
||||
|
||||
Revision 1.1.2.1 2001/09/21 19:21:40 josh
|
||||
move some functions out to their own source file to make building
|
||||
more modular
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This module contains the functions called by proxy and notify code to
|
||||
copy varbinds from one place to another.
|
||||
|
||||
INCLUDE FILES: asn1.h, snmp.h, buffer.h, etimer.h, objectid.h,
|
||||
v3_proxy.h, snmpdefs.h, ntfy_chk.h, bug.h
|
||||
*/
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/etimer.h>
|
||||
#include <wrn/wm/snmp/engine/objectid.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/v3_trgt.h>
|
||||
#include <wrn/wm/snmp/engine/wkobj.h>
|
||||
|
||||
#include <wrn/wm/common/dyncfg.h>
|
||||
#include <wrn/wm/common/bug.h>
|
||||
|
||||
DYNCFG_VBL_DECLARE_EXTERN(envoy_use_v2_types)
|
||||
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_COEXISTENCE
|
||||
/* Some well-known OIDs that will be necessary to deal with traps
|
||||
* and proxies
|
||||
*/
|
||||
static OIDC_T COEX_SNMPTRAPOID[] = {SNMP_SNMPTRAPOID, 0};
|
||||
static OIDC_T COEX_TRAPENTERPRISE[] = {SNMP_SNMPTRAPENTERPRISE};
|
||||
static OIDC_T COEX_SNMPTRAPS[] = {SNMP_SNMPTRAPS};
|
||||
static OIDC_T COEX_COLDSTART[] = {SNMP_COLDSTART};
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_V3_PROXY
|
||||
static OIDC_T COEX_SYSUPTIME[] = { 1, 3, 6, 1, 2, 1, 1, 3, 0 };
|
||||
static OIDC_T COEX_SNMPTRAPADDRESS[] = { 1, 3, 6, 1, 6, 3, 18, 1, 3, 0 };
|
||||
static OIDC_T COEX_SNMPTRAPCOMMUNITY[] = { 1, 3, 6, 1, 6, 3, 18, 1, 4, 0 };
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* copyVarBind - bind the contents of a varbind into a new packet
|
||||
*
|
||||
* This function will bind the contents of an existing varbind into
|
||||
* the appropriate place in a new SNMP_PKT_T
|
||||
*
|
||||
* RETURNS: ENVOY_ERR_NOERR if successful
|
||||
* ENVOY_ERR_INSUFFICIENT_MEMORY if a memory allocation error
|
||||
* occurred.
|
||||
*
|
||||
*/
|
||||
envoy_err_t copyVarBind
|
||||
(
|
||||
VB_T * pVb,
|
||||
int vbCount,
|
||||
SNMP_PKT_T * pNewPkt
|
||||
)
|
||||
{
|
||||
switch (pVb->vb_data_flags_n_type)
|
||||
{
|
||||
case VT_NUMBER:
|
||||
if (SNMP_Bind_Integer (pNewPkt,
|
||||
vbCount,
|
||||
pVb->vb_obj_id.num_components,
|
||||
pVb->vb_obj_id.component_list,
|
||||
VB_GET_INT32 (pVb)))
|
||||
return ENVOY_ERR_INSUFFICIENT_MEMORY;
|
||||
break;
|
||||
case VT_STRING:
|
||||
case VT_OPAQUE:
|
||||
if (SNMP_Bind_String (pNewPkt,
|
||||
vbCount,
|
||||
pVb->vb_obj_id.num_components,
|
||||
pVb->vb_obj_id.component_list,
|
||||
pVb->vb_data_flags_n_type,
|
||||
EBufferUsed (VB_GET_STRING (pVb)),
|
||||
EBufferStart (VB_GET_STRING (pVb)),
|
||||
0))
|
||||
return ENVOY_ERR_INSUFFICIENT_MEMORY;
|
||||
break;
|
||||
case VT_OBJECT:
|
||||
if (SNMP_Bind_Object_ID (pNewPkt,
|
||||
vbCount,
|
||||
pVb->vb_obj_id.num_components,
|
||||
pVb->vb_obj_id.component_list,
|
||||
(VB_GET_OBJECT_ID (pVb))->num_components,
|
||||
(VB_GET_OBJECT_ID (pVb))->component_list))
|
||||
return ENVOY_ERR_INSUFFICIENT_MEMORY;
|
||||
break;
|
||||
case VT_EMPTY:
|
||||
if (SNMP_Bind_Null (pNewPkt,
|
||||
vbCount,
|
||||
pVb->vb_obj_id.num_components,
|
||||
pVb->vb_obj_id.component_list))
|
||||
return ENVOY_ERR_INSUFFICIENT_MEMORY;
|
||||
break;
|
||||
case VT_IPADDRESS:
|
||||
if (SNMP_Bind_IP_Address (pNewPkt,
|
||||
vbCount,
|
||||
pVb->vb_obj_id.num_components,
|
||||
pVb->vb_obj_id.component_list,
|
||||
VB_GET_IP_ADDRESS (pVb)))
|
||||
return ENVOY_ERR_INSUFFICIENT_MEMORY;
|
||||
break;
|
||||
case VT_COUNTER:
|
||||
case VT_GAUGE:
|
||||
case VT_TIMETICKS:
|
||||
case VT_UINTEGER32:
|
||||
if (SNMP_Bind_Unsigned_Integer (pNewPkt,
|
||||
vbCount,
|
||||
pVb->vb_obj_id.num_components,
|
||||
pVb->vb_obj_id.component_list,
|
||||
pVb->vb_data_flags_n_type,
|
||||
VB_GET_UINT32 (pVb)))
|
||||
return ENVOY_ERR_INSUFFICIENT_MEMORY;
|
||||
break;
|
||||
default:
|
||||
return ENVOY_ERR_UNKNOWN;
|
||||
}
|
||||
return ENVOY_ERR_NOERR;
|
||||
}
|
||||
#endif /* #if INSTALL_ENVOY_SNMP_COEXISTENCE */
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_V3_PROXY
|
||||
/****************************************************************************
|
||||
* copyNotifyVarBindList - copy and convert a varbind list from an
|
||||
* incoming notification to an outgoing notification
|
||||
*
|
||||
* This function will examine the varbind list of the notify to be forwarded
|
||||
* and put the appropriate information in the outgoing varbind list. The
|
||||
* details of this will vary depending on the source and destination versions.
|
||||
* Specifically, translations between v1 and v2c/v3 hosts can get fairly
|
||||
* involved.
|
||||
*
|
||||
* RETURNS: ENVOY_ERR_NOERR if the copy was successful
|
||||
* ENVOY_ERR_INSUFFICIENT_MEMORY if an allocation error occurred
|
||||
*
|
||||
*/
|
||||
|
||||
envoy_err_t copyNotifyVarBindList
|
||||
(
|
||||
SNMP_PKT_T *pPkt,
|
||||
SNMP_PKT_T *pNewPkt
|
||||
)
|
||||
{
|
||||
#if INSTALL_ENVOY_SNMP_COEXISTENCE
|
||||
int vbCount;
|
||||
VBL_T pVbl;
|
||||
OBJ_ID_T snmpTrapOID;
|
||||
int need;
|
||||
#endif
|
||||
|
||||
switch (pPkt->snmp_version)
|
||||
{
|
||||
#if INSTALL_ENVOY_SNMP_COEXISTENCE
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
case SNMP_VERSION_1:
|
||||
switch (pNewPkt->snmp_version)
|
||||
{
|
||||
case SNMP_VERSION_1:
|
||||
/*
|
||||
* We don't actually want any translation here,
|
||||
* so we lie to the copy function.
|
||||
*/
|
||||
(void)copyVarBindList (&(pNewPkt->pdu.trap_pdu.trap_vbl),
|
||||
&(pPkt->pdu.trap_pdu.trap_vbl),
|
||||
SNMP_VERSION_MAX);
|
||||
break;
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_2
|
||||
case SNMP_VERSION_2:
|
||||
#endif
|
||||
case SNMP_VERSION_3:
|
||||
/* We need to derive the value of snmpTrapOID */
|
||||
if (pPkt->pdu.trap_pdu.generic_trap == ENTERPRISE_SPECIFIC)
|
||||
{
|
||||
snmpTrapOID.num_components =
|
||||
(pPkt->pdu.trap_pdu.enterprise_objid.num_components
|
||||
+ 2);
|
||||
need = (int)(sizeof (OIDC_T) * snmpTrapOID.num_components);
|
||||
if ((snmpTrapOID.component_list =
|
||||
(OIDC_T *) SNMP_memory_alloc (need)) == 0)
|
||||
return ENVOY_ERR_INSUFFICIENT_MEMORY;
|
||||
MEMCPY
|
||||
(snmpTrapOID.component_list,
|
||||
pPkt->pdu.trap_pdu.enterprise_objid.component_list,
|
||||
pPkt->pdu.trap_pdu.enterprise_objid.num_components);
|
||||
snmpTrapOID.component_list
|
||||
[snmpTrapOID.num_components - 2] = 0;
|
||||
snmpTrapOID.component_list
|
||||
[snmpTrapOID.num_components - 1] =
|
||||
pPkt->pdu.trap_pdu.specific_trap;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (build_object_id
|
||||
(sizeof (COEX_COLDSTART)/sizeof (OIDC_T),
|
||||
COEX_COLDSTART,
|
||||
&snmpTrapOID) != 0)
|
||||
return ENVOY_ERR_INSUFFICIENT_MEMORY;
|
||||
snmpTrapOID.component_list
|
||||
[snmpTrapOID.num_components - 1] =
|
||||
pPkt->pdu.trap_pdu.generic_trap + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* We have to bind in the sysUptime and
|
||||
* snmpTrapOID varbinds.
|
||||
*/
|
||||
(void)SNMP_Bind_Timeticks
|
||||
(pNewPkt, 0,
|
||||
sizeof (COEX_SYSUPTIME) /
|
||||
sizeof (OIDC_T),
|
||||
COEX_SYSUPTIME,
|
||||
pPkt->pdu.trap_pdu.trap_time_ticks);
|
||||
|
||||
(void)SNMP_Bind_Object_ID
|
||||
(pNewPkt, 1,
|
||||
sizeof (COEX_SNMPTRAPOID) /
|
||||
sizeof (OIDC_T),
|
||||
COEX_SNMPTRAPOID,
|
||||
snmpTrapOID.num_components,
|
||||
snmpTrapOID.component_list);
|
||||
|
||||
Clean_Obj_ID (&snmpTrapOID);
|
||||
|
||||
/*
|
||||
* Some clever manipulation to copy the entire
|
||||
* varbind list from the v1 trap to the appropriate
|
||||
* varbinds in the new varbind list. We need to skip
|
||||
* the first two varbinds, which already have
|
||||
* information in them...
|
||||
*/
|
||||
pVbl.vblist = &(pNewPkt->pdu.std_pdu.std_vbl.vblist[2]);
|
||||
pVbl.vbl_count = pNewPkt->pdu.std_pdu.std_vbl.vbl_count-2;
|
||||
if (copyVarBindList (&pVbl, &(pPkt->pdu.trap_pdu.trap_vbl),
|
||||
pNewPkt->snmp_version)==0)
|
||||
return ENVOY_ERR_UNKNOWN;
|
||||
|
||||
/*
|
||||
* Now we have to add three additional varbinds:
|
||||
* snmpTrapAddress.0, snmpTrapCommunity.0,
|
||||
* and snmpTrapEnterprise.0.
|
||||
*/
|
||||
vbCount = pNewPkt->pdu.std_pdu.std_vbl.vbl_count;
|
||||
(void)SNMP_Bind_IP_Address
|
||||
(pNewPkt, vbCount-3,
|
||||
sizeof (COEX_SNMPTRAPADDRESS) /
|
||||
sizeof (OIDC_T),
|
||||
COEX_SNMPTRAPADDRESS,
|
||||
pPkt->pdu.trap_pdu.net_address);
|
||||
SNMP_Bind_String
|
||||
(pNewPkt, vbCount-2,
|
||||
sizeof (COEX_SNMPTRAPCOMMUNITY) /
|
||||
sizeof (OIDC_T),
|
||||
COEX_SNMPTRAPCOMMUNITY,
|
||||
VT_STRING,
|
||||
EBufferUsed (&pPkt->community),
|
||||
EBufferStart (&pPkt->community), 1);
|
||||
(void)SNMP_Bind_Object_ID
|
||||
(pNewPkt, vbCount-1,
|
||||
sizeof (COEX_TRAPENTERPRISE) /
|
||||
sizeof (OIDC_T),
|
||||
COEX_TRAPENTERPRISE,
|
||||
pPkt->pdu.trap_pdu.enterprise_objid.num_components,
|
||||
pPkt->pdu.trap_pdu.enterprise_objid.component_list);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* We don't support translation into this version. */
|
||||
return ENVOY_ERR_UNKNOWN;
|
||||
}
|
||||
break;
|
||||
#endif /* #if INSTALL_ENVOY_SNMP_VERSION_1 */
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_2
|
||||
case SNMP_VERSION_2:
|
||||
#endif
|
||||
#endif /* #if INSTALL_ENVOY_SNMP_COEXISTENCE */
|
||||
case SNMP_VERSION_3:
|
||||
switch (pNewPkt->snmp_version)
|
||||
{
|
||||
#if INSTALL_ENVOY_SNMP_COEXISTENCE
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
case SNMP_VERSION_1:
|
||||
(void)copyVarBindList (&(pNewPkt->pdu.trap_pdu.trap_vbl),
|
||||
&(pPkt->pdu.std_pdu.std_vbl),
|
||||
SNMP_VERSION_1);
|
||||
/*
|
||||
* Now we have to add three additional varbinds:
|
||||
* snmpTrapAddress.0, snmpTrapCommunity.0,
|
||||
* and snmpTrapEnterprise.0.
|
||||
*/
|
||||
vbCount = pNewPkt->pdu.trap_pdu.trap_vbl.vbl_count;
|
||||
|
||||
break;
|
||||
#endif /* #if INSTALL_ENVOY_SNMP_VERSION_1 */
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_2
|
||||
case SNMP_VERSION_2:
|
||||
/* this is an intentional fall through to the next case */
|
||||
#endif
|
||||
#endif /* #if INSTALL_ENVOY_SNMP_COEXISTENCE */
|
||||
case SNMP_VERSION_3:
|
||||
(void)copyVarBindList (&(pNewPkt->pdu.std_pdu.std_vbl),
|
||||
&(pPkt->pdu.std_pdu.std_vbl),
|
||||
pNewPkt->snmp_version);
|
||||
break;
|
||||
default:
|
||||
/* We don't support translation into this version. */
|
||||
return ENVOY_ERR_UNKNOWN;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* We shouldn't ever get here -- we should have
|
||||
* already discarded the packet. But just in case...
|
||||
*/
|
||||
return ENVOY_ERR_UNKNOWN;
|
||||
}
|
||||
return ENVOY_ERR_NOERR;
|
||||
}
|
||||
#endif /* #if INSTALL_ENVOY_SNMP_V3_PROXY */
|
||||
|
||||
#if (INSTALL_ENVOY_SNMP_COEXISTENCE) && (INSTALL_ENVOY_SNMP_VERSION_1)
|
||||
/****************************************************************************
|
||||
NAME: SNMP_Convert_VB
|
||||
|
||||
PURPOSE: Take an SNMPv2-style varbindlist and extract enterprise information
|
||||
|
||||
PARAMETERS: VBL_T * the VarBindList
|
||||
OBJ_ID_T * enterprise OID
|
||||
int * generic parameter
|
||||
sbits32_t * specific parameter
|
||||
bits32_t * timestamp parameter
|
||||
|
||||
RETURNS: 1 if successful, 0 otherwise
|
||||
****************************************************************************/
|
||||
int
|
||||
SNMP_Convert_VB(VBL_T *vblp,
|
||||
OBJ_ID_T *enterprise,
|
||||
int *generic,
|
||||
sbits32_t *specific,
|
||||
bits32_t *timestamp)
|
||||
{
|
||||
VB_T *trap_vbp, *ent_vbp;
|
||||
OBJ_ID_T *trap_oid, *ent_oid;
|
||||
int i;
|
||||
|
||||
VB_T *vbp = vblp_index_to_vbp(vblp, 0);
|
||||
if (vbp == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*timestamp = VB_GET_UINT32(vbp);
|
||||
trap_vbp = vblp_index_to_vbp(vblp, 1);
|
||||
if ((trap_vbp == 0) ||
|
||||
(oidcmp(trap_vbp->vb_obj_id.num_components,
|
||||
trap_vbp->vb_obj_id.component_list,
|
||||
sizeof(COEX_SNMPTRAPOID)/sizeof(OIDC_T),
|
||||
COEX_SNMPTRAPOID) == 0))
|
||||
return (0);
|
||||
trap_oid = VB_GET_OBJECT_ID(trap_vbp);
|
||||
|
||||
/* Step 1: Is the value of snmpTrapOID one of the standard traps? */
|
||||
if ((trap_oid->num_components == (sizeof(COEX_COLDSTART)/sizeof(OIDC_T))) &&
|
||||
(oidcmp(sizeof(COEX_SNMPTRAPS)/sizeof(OIDC_T),
|
||||
trap_oid->component_list,
|
||||
sizeof(COEX_SNMPTRAPS)/sizeof(OIDC_T),
|
||||
COEX_SNMPTRAPS) == 1) &&
|
||||
(trap_oid->component_list[trap_oid->num_components - 1] <= 6)) {
|
||||
/* It matches one of the standard traps, now look for a varbind
|
||||
* with an OID of snmpTrapEnterprise.
|
||||
*/
|
||||
for (ent_vbp = vblp_index_to_vbp(vblp, 2), i = vblp->vbl_count - 2;
|
||||
i; ent_vbp++, i--) {
|
||||
ent_oid = &(ent_vbp->vb_obj_id);
|
||||
if ((oidcmp(ent_oid->num_components - 1,
|
||||
ent_oid->component_list,
|
||||
sizeof(COEX_TRAPENTERPRISE)/sizeof(OIDC_T),
|
||||
COEX_TRAPENTERPRISE) == 1) &&
|
||||
(ent_oid->component_list[ent_oid->num_components - 1] == 0))
|
||||
break;
|
||||
}
|
||||
if (i > 0) {
|
||||
/* We have an snmpTrapEnterprise varbind. */
|
||||
enterprise->num_components =
|
||||
(VB_GET_OBJECT_ID(ent_vbp))->num_components;
|
||||
enterprise->component_list =
|
||||
(VB_GET_OBJECT_ID(ent_vbp))->component_list;
|
||||
}
|
||||
else {
|
||||
/* No snmpTrapEnterprise varbind. Set enterprise OID
|
||||
* to snmpTraps.
|
||||
*/
|
||||
enterprise->num_components = sizeof(COEX_SNMPTRAPS)/sizeof(OIDC_T);
|
||||
enterprise->component_list = COEX_SNMPTRAPS;
|
||||
}
|
||||
*generic = (int)(trap_oid->component_list[trap_oid->num_components - 1] - 1);
|
||||
*specific = 0;
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* We are not dealing with one of the standard traps.
|
||||
* We derive the enterprise information from snmpTrapOID.
|
||||
*/
|
||||
enterprise->component_list = trap_oid->component_list;
|
||||
if (trap_oid->component_list[trap_oid->num_components - 2] == 0)
|
||||
enterprise->num_components = trap_oid->num_components - 2;
|
||||
else
|
||||
enterprise->num_components = trap_oid->num_components - 1;
|
||||
|
||||
*generic = 6;
|
||||
*specific = (sbits32_t)(trap_oid->component_list[trap_oid->num_components -1]);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_COEXISTENCE || INSTALL_ENVOY_SNMP_V3_NOTIFY
|
||||
/****************************************************************************
|
||||
NAME: copyVarBindList
|
||||
|
||||
PURPOSE: Copy a varbindlist.
|
||||
|
||||
PARAMETERS: VBL_T * the new VarBindList
|
||||
VBL_T * the VarBindList to be copied
|
||||
sbits32_t SNMP version (SNMPv1 is handled specially)
|
||||
|
||||
RETURNS: 1 if successful, 0 otherwise
|
||||
****************************************************************************/
|
||||
int copyVarBindList
|
||||
(
|
||||
VBL_T *new_vblp,
|
||||
VBL_T *vblp,
|
||||
sbits32_t version
|
||||
)
|
||||
{
|
||||
int bind_ok, vb_cnt, vb_mod;
|
||||
VB_T *vbp;
|
||||
|
||||
bind_ok = 1;
|
||||
|
||||
if (version == SNMP_VERSION_1)
|
||||
{
|
||||
vbp = &(vblp->vblist[2]);
|
||||
vb_cnt = 0;
|
||||
vb_mod = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
vbp = &(vblp->vblist[0]);
|
||||
vb_cnt = 0;
|
||||
vb_mod = 0;
|
||||
}
|
||||
|
||||
for ( ; (vb_cnt < (vblp->vbl_count - vb_mod)) && (bind_ok);
|
||||
vb_cnt++, vbp = &(vblp->vblist[vb_cnt + vb_mod]))
|
||||
{
|
||||
switch(vbp->vb_data_flags_n_type)
|
||||
{
|
||||
case VT_NUMBER:
|
||||
if (VBL_Bind_Integer(new_vblp,
|
||||
vb_cnt,
|
||||
vbp->vb_obj_id.num_components,
|
||||
vbp->vb_obj_id.component_list,
|
||||
VB_GET_INT32(vbp)))
|
||||
bind_ok = 0;
|
||||
break;
|
||||
case VT_STRING:
|
||||
case VT_OPAQUE:
|
||||
if (VBL_Bind_String(new_vblp,
|
||||
vb_cnt,
|
||||
vbp->vb_obj_id.num_components,
|
||||
vbp->vb_obj_id.component_list,
|
||||
vbp->vb_data_flags_n_type,
|
||||
EBufferUsed(VB_GET_STRING(vbp)),
|
||||
EBufferStart(VB_GET_STRING(vbp)),
|
||||
0))
|
||||
bind_ok = 0;
|
||||
break;
|
||||
case VT_OBJECT:
|
||||
if (VBL_Bind_Object_ID(new_vblp,
|
||||
vb_cnt,
|
||||
vbp->vb_obj_id.num_components,
|
||||
vbp->vb_obj_id.component_list,
|
||||
(VB_GET_OBJECT_ID(vbp))->num_components,
|
||||
(VB_GET_OBJECT_ID(vbp))->component_list))
|
||||
bind_ok = 0;
|
||||
break;
|
||||
case VT_EMPTY:
|
||||
if (VBL_Bind_Null(new_vblp,
|
||||
vb_cnt,
|
||||
vbp->vb_obj_id.num_components,
|
||||
vbp->vb_obj_id.component_list))
|
||||
bind_ok = 0;
|
||||
break;
|
||||
case VT_IPADDRESS:
|
||||
if (VBL_Bind_IP_Address(new_vblp,
|
||||
vb_cnt,
|
||||
vbp->vb_obj_id.num_components,
|
||||
vbp->vb_obj_id.component_list,
|
||||
VB_GET_IP_ADDRESS(vbp)))
|
||||
bind_ok = 0;
|
||||
break;
|
||||
case VT_COUNTER:
|
||||
case VT_GAUGE:
|
||||
case VT_TIMETICKS:
|
||||
case VT_UINTEGER32:
|
||||
if (VBL_Bind_Unsigned_Integer(new_vblp,
|
||||
vb_cnt,
|
||||
vbp->vb_obj_id.num_components,
|
||||
vbp->vb_obj_id.component_list,
|
||||
vbp->vb_data_flags_n_type,
|
||||
VB_GET_UINT32(vbp)))
|
||||
bind_ok = 0;
|
||||
break;
|
||||
|
||||
/* The logic below is to deal with Counter64 objects -- they
|
||||
can't go out in SNMPv1 traps, so the entire trap can't be
|
||||
sent. However, if ENVOY_SNMP_USE_V2_TYPES has been
|
||||
manually installed, then this is OK. Hence the kind of
|
||||
squirrely-looking code. */
|
||||
|
||||
#if ((INSTALL_ENVOY_SNMP_USE_V2_TYPES) || \
|
||||
((ENVOY_USE_V2_TYPES) && !(INSTALL_ENVOY_SNMP_VERSION_1)))
|
||||
case VT_COUNTER64:
|
||||
DYNCFG_IFCFGVBL_BEGIN(envoy_use_v2_types)
|
||||
if (VBL_Bind_64_Unsigned_Integer
|
||||
(new_vblp,
|
||||
vb_cnt,
|
||||
vbp->vb_obj_id.num_components,
|
||||
vbp->vb_obj_id.component_list,
|
||||
vbp->vb_data_flags_n_type,
|
||||
(VB_GET_UINT64(vbp))->high,
|
||||
(VB_GET_UINT64(vbp))->low))
|
||||
bind_ok = 0;
|
||||
break;
|
||||
DYNCFG_IFCFGVBL_END(envoy_use_v2_types)
|
||||
#else
|
||||
#if ((ENVOY_USE_V2_TYPES) && (INSTALL_ENVOY_SNMP_VERSION_1))
|
||||
case VT_COUNTER64:
|
||||
DYNCFG_IFCFGVBL_BEGIN(envoy_use_v2_types)
|
||||
if ((version == SNMP_VERSION_1) ||
|
||||
(VBL_Bind_64_Unsigned_Integer
|
||||
(new_vblp,
|
||||
vb_cnt,
|
||||
vbp->vb_obj_id.num_components,
|
||||
vbp->vb_obj_id.component_list,
|
||||
vbp->vb_data_flags_n_type,
|
||||
(VB_GET_UINT64(vbp))->high,
|
||||
(VB_GET_UINT64(vbp))->low)))
|
||||
bind_ok = 0;
|
||||
break;
|
||||
DYNCFG_IFCFGVBL_END(envoy_use_v2_types)
|
||||
#endif /* ((ENVOY_USE_V2_TYPES) && (INSTALL_ENVOY_SNMP_VERSION_1)) */
|
||||
#endif /* (INSTALL_ENVOY_SNMP_USE_V2_TYPES) */
|
||||
|
||||
default:
|
||||
bind_ok = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bind_ok)
|
||||
Clean_vb_list(new_vblp);
|
||||
return(bind_ok);
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,232 @@
|
||||
/*
|
||||
* 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 1996-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: creatint.c,v $
|
||||
* Revision 1.4 2003/01/15 14:05:02 josh
|
||||
* directory structure shifting
|
||||
*
|
||||
* Revision 1.3 2001/11/06 21:50:45 josh
|
||||
* second (and hopefully final) pass of new path hacking
|
||||
*
|
||||
* Revision 1.2 2001/11/06 21:20:07 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2.4.1 2001/10/12 18:02:58 josh
|
||||
* adding comments to attempt to dissuade customers from using
|
||||
* internal request API
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:22:19 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:19:02 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:13 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/05 18:53:11 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.2 1998/02/25 15:21:29 sra
|
||||
* Finish moving types.h, bug.h, and bugdef.h to common/h/.
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:35 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:46 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.5 1997/11/01 01:25:36 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.4 1997/10/16 00:45:49 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.3 1997/03/20 06:48:48 sra
|
||||
* DFARS-safe copyright text. Zap!
|
||||
*
|
||||
* Revision 7.2 1997/02/25 10:49:26 sra
|
||||
* Update copyright notice, dust under the bed.
|
||||
*
|
||||
* Revision 7.1 1996/10/18 21:33:02 sar
|
||||
* Free the packet if validate community fails
|
||||
*
|
||||
* Revision 7.0 1996/10/15 14:52:09 sar
|
||||
* Initial version
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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/buildpkt.h>
|
||||
#include <wrn/wm/snmp/engine/snmpstat.h>
|
||||
|
||||
#include <wrn/wm/common/bug.h>
|
||||
|
||||
/****************************************************************************
|
||||
NAME: SNMP_Create_Internal_Request
|
||||
|
||||
WARNING: This is an intentionally undocumented, internal API. It is not
|
||||
intended for customer use.
|
||||
|
||||
PURPOSE: Build a snmp request packet for use with
|
||||
Process_Internal_SNMP_Packet(). This routine will
|
||||
allocate a snmp_pkt_t structure and fill in the appropriate
|
||||
header pieces as if a byte string had been decoded. The
|
||||
caller is still responsible for attaching any desired varbinds
|
||||
via bind calls. Note that we call the validate_community
|
||||
routine to actually validate the community and gather the
|
||||
mib view type information.
|
||||
|
||||
PARAMETERS:
|
||||
int Packet type:
|
||||
For version 1 GET_REQUEST_PDU, GET_NEXT_REQUEST_PDU or
|
||||
SET_REQUEST_PDU
|
||||
For version 2 GET_REQUEST_PDU, GET_NEXT_REQUEST_PDU,
|
||||
SET_REQUEST_PDU, GET_BULK_REQUEST_PDU,
|
||||
as defined in snmpdefs.h
|
||||
int Protocol version -- SNMP_VERSION_1 or SNMP_VERSION_2
|
||||
as defined in snmpdefs.h
|
||||
int Community name length
|
||||
sbits8_t * Community name
|
||||
unsigned short int Dynamic or static flag for community name
|
||||
INT_32_T Request ID
|
||||
int Number of VarBindList elements needed (may be 0)
|
||||
int nonreps - for use with getbulk, number of non repeaters
|
||||
int maxreps - for use with getbulk, max repetitions
|
||||
|
||||
SNMPADDR_T * Source of the packet
|
||||
SNMPADDR_T * Destination of the packet (most likely
|
||||
the address of the machine on which this
|
||||
code is running.)
|
||||
ALENGTH_T the maximum size of the outgoing packet
|
||||
void (*)(SNMPADDR_T *, The io completion routine,
|
||||
SNMPADDR_T *, The args are dst, src and packet
|
||||
EBUFFER_T *)
|
||||
void (*)(SNMPADDR_T *, The io error routine,
|
||||
SNMPADDR_T *, The args are dst, src and error code
|
||||
int)
|
||||
PTR_T Cookie to be handed to the completion routines.
|
||||
|
||||
RETURNS: SNMP_PKT_T * SNMP Packet structure, 0 on failure
|
||||
****************************************************************************/
|
||||
|
||||
SNMP_PKT_T *
|
||||
SNMP_Create_Internal_Request(int ptype,
|
||||
int version,
|
||||
int commleng,
|
||||
sbits8_t *community,
|
||||
unsigned short int cflags,
|
||||
INT_32_T request_id,
|
||||
int num_vb,
|
||||
int nonreps,
|
||||
int maxreps,
|
||||
ALENGTH_T pktsize,
|
||||
IO_COMPLETE_T *io_complete,
|
||||
ERR_COMPLETE_T *error_complete,
|
||||
PTR_T complete_cookie)
|
||||
{
|
||||
SNMP_PKT_T *rp;
|
||||
SNMPADDR_T dummy_addr;
|
||||
|
||||
MEMSET(&dummy_addr, 0, sizeof(SNMPADDR_T));
|
||||
|
||||
/* check the pdu type, but only for options allowed
|
||||
by snmp_create_request2 but not by this routine.
|
||||
We leave most of the version and ptype checking to
|
||||
snmp_create_request2. */
|
||||
if ((ptype == INFORM_REQUEST_PDU) || (ptype == TRAP2_PDU))
|
||||
return(0);
|
||||
|
||||
/* create the packet structure */
|
||||
rp = SNMP_Create_Request2(ptype, version, commleng, (char *)community,
|
||||
request_id, num_vb, nonreps, maxreps);
|
||||
if (rp == 0)
|
||||
return(0);
|
||||
|
||||
/* If the lock code is installed acquire the generic read lock */
|
||||
#if INSTALL_ENVOY_SNMP_LOCK
|
||||
if (ENVOY_SNMP_GET_READ_LOCK(SNMP_CoarseLock)) {
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT, "SNMP_Create_Internal_Request: coarse lock broken", 0));
|
||||
SNMP_Free(rp);
|
||||
return(0);
|
||||
}
|
||||
|
||||
rp->lockflags = LOCK_READ;
|
||||
rp->coarse_lock = &SNMP_CoarseLock;
|
||||
#endif
|
||||
|
||||
switch(SNMP_validate_community(rp, &dummy_addr, &dummy_addr)) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
SNMP_Free(rp);
|
||||
return(0);
|
||||
case 2:
|
||||
SNMP_Free(rp);
|
||||
SGRPv1v2_INC_COUNTER(snmp_stats.snmpInBadCommunityNames);
|
||||
return(0);
|
||||
case 3:
|
||||
SNMP_Free(rp);
|
||||
SGRPv1v2_INC_COUNTER(snmp_stats.snmpInBadCommunityUses);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* If necessary reload the community string, create_req2 thinks it should
|
||||
always be static, we give people an option, we do this after the
|
||||
validate step so that the community string isn't freed if we return
|
||||
an empty packet */
|
||||
if (cflags != BFL_IS_STATIC)
|
||||
EBufferPreLoad(BFL_IS_DYNAMIC, &(rp->community), community, commleng);
|
||||
|
||||
/* reset the maximum packet size, note that we ignore the default
|
||||
so that the default can be used for wire based snmp while this
|
||||
is being used internally */
|
||||
rp->maxpkt = pktsize;
|
||||
|
||||
/* Attach the completion routines to the packet structure */
|
||||
rp->io_complete = io_complete;
|
||||
rp->error_complete = error_complete;
|
||||
rp->async_cookie = complete_cookie;
|
||||
return(rp);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,248 @@
|
||||
/* creatrap.c - creatrap.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: creatrap.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:07 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:22:20 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:19:02 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:14 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:53:11 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:36 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:46 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:48:49 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.2 1995/11/01 00:46:48 sar
|
||||
* Added a version check, create_trap_request is only useable for version 1
|
||||
*
|
||||
* 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:18 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.1 1994/10/12 20:20:28 sar
|
||||
* trap_time_ticks is now a uint so we don't have to cast timestamp to
|
||||
* an int.
|
||||
*
|
||||
* 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.3 1993/06/02 23:09:24 dab
|
||||
* Changed #ifdef's to #if's for things from install.h
|
||||
*
|
||||
* Revision 3.2 1993/04/26 20:37:09 sar
|
||||
* Added ifdefs to allow clean makes of version 1 and 2, added bit strings,
|
||||
* arrange for deletion of acls with the party or context they refer to
|
||||
* is deleted.
|
||||
*
|
||||
* Revision 3.1 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.0 1992/04/03 19:52:37 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 2.103 91/10/30 20:41:55 dab
|
||||
* Directly include asn1conf.h, snmpdefs.h, and snmpstat.h (if needed).
|
||||
*
|
||||
* Revision 2.102 91/08/15 12:30:57 dab
|
||||
* Removed <libfuncs.h>.
|
||||
*
|
||||
* Revision 2.101 91/08/12 12:47:37 dab
|
||||
* Cast arguments to memcpy() and memset() to PTR_T.
|
||||
*
|
||||
* Revision 2.100 91/08/09 14:08:18 dab
|
||||
* Update version.
|
||||
*
|
||||
* Revision 1.1 91/07/30 02:23:32 romkey
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
* Rev 2.0 31 Mar 1990 15:06:42
|
||||
* Release 2.00
|
||||
*
|
||||
* Rev 1.1 17 Mar 1989 21:41:50
|
||||
* Calls to memcpy/memset protected against zero lengths
|
||||
*
|
||||
* Rev 1.0 11 Jan 1989 12:11:22
|
||||
* Initial revision.
|
||||
*
|
||||
* Separated from buildpkt.c on January 11, 1989.
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains creatrap.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/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/snmp/engine/buildpkt.h>
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
/*******************************************************************************
|
||||
* SNMP_Create_Trap - allocate a packet structure for a SNMPv1 'TRAP' PDU
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* SNMP_PKT_T * SNMP_Create_Trap
|
||||
* (
|
||||
* int version,
|
||||
* int commleng,
|
||||
* char * community,
|
||||
* int enterprz_c,
|
||||
* OIDC_T * enterprz_l,
|
||||
* OCTET_T * agent_ip,
|
||||
* int generic,
|
||||
* INT_32_T specific,
|
||||
* UINT_32_T timestamp,
|
||||
* int num_vb
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine allocates and initializes a new packet structure of type 'SNMP_PKT_T' for a SNMPv1 'TRAP' PDU.
|
||||
* If you are building a multi-lingual agent, you may also need to call SNMP_Create_Request2() and SNMP_Create_Request_V3() to build appropriate SNMPv2 'TRAP' PDUs, or use SNMP_Send_Notify_Name().
|
||||
*
|
||||
* \&NOTE: After you have created this structure, call the appropriate bind procedures to bind specific entries into the 'VarBindList' before calling SNMP_Encode_Packet() to encode the packet for transmission.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <version>
|
||||
* Specify the SNMP protocol version as 'SNMP_VERSION_1'. The constants 'VERSION_RFC1067', 'VERSION_RFC1098' and 'VERSION_RFC1157' are equivalent to 'SNMP_VERSION_1'.
|
||||
* \i <commleng>
|
||||
* Specify the length in bytes of the SNMP community name.
|
||||
* \i <*community>
|
||||
* Specify the SNMP community name.
|
||||
* \i <enterprz_c>
|
||||
* Specify the number of components referenced by <enterprz_l>
|
||||
* \i <*enterprz_l>
|
||||
* Specify a list of values that comprise the enterprise object identifier to be incorporated into the 'TRAP' PDU.
|
||||
* \i <*agent_ip>
|
||||
* Specify the agent\’s IP address as a four-byte value in standard network order.
|
||||
* \i <generic>
|
||||
* Specify the generic 'TRAP' type value.
|
||||
* \i <specific>
|
||||
* Specify the specific 'TRAP' type value.
|
||||
* \i <timestamp>
|
||||
* Specify the time of the 'TRAP' in units of 1/100th of a second based on the time of the last system initialization.
|
||||
* \i <num_vb>
|
||||
* Indicate how many 'VarBind' entries to place in the 'VarBindList'.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If successful, this routine returns a pointer to the newly created packet. Otherwise, it returns 0.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: SNMP_Create_Request2(), SNMP_Create_Request_V3(), SNMP_Encode_Packet()
|
||||
*/
|
||||
SNMP_PKT_T *
|
||||
SNMP_Create_Trap(int version,
|
||||
int commleng,
|
||||
char *community,
|
||||
int enterprz_c,
|
||||
OIDC_T *enterprz_l,
|
||||
OCTET_T *agent_ip,
|
||||
int generic,
|
||||
INT_32_T specific,
|
||||
UINT_32_T timestamp,
|
||||
int num_vb)
|
||||
{
|
||||
SNMP_PKT_T *rp;
|
||||
|
||||
if (version != SNMP_VERSION_1)
|
||||
return 0;
|
||||
|
||||
if ((rp = SNMP_Allocate()) == 0)
|
||||
return 0;
|
||||
|
||||
rp->pdu_type = TRAP_PDU;
|
||||
|
||||
rp->snmp_version = SNMP_VERSION_1;
|
||||
if (build_object_id(enterprz_c, enterprz_l,
|
||||
&(rp->pdu.trap_pdu.enterprise_objid)) == -1) {
|
||||
SNMP_Free(rp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
MEMCPY((PTR_T)rp->pdu.trap_pdu.net_address, (PTR_T)agent_ip, 4);
|
||||
rp->pdu.trap_pdu.generic_trap = generic;
|
||||
rp->pdu.trap_pdu.specific_trap = specific;
|
||||
rp->pdu.trap_pdu.trap_time_ticks = timestamp;
|
||||
|
||||
EBufferPreLoad(BFL_IS_STATIC, &(rp->community), community, commleng);
|
||||
|
||||
if ((rp->pdu.trap_pdu.trap_vbl.vbl_count = num_vb) == 0) {
|
||||
/* Handle case where the VarBindList is empty */
|
||||
rp->pdu.trap_pdu.trap_vbl.vblist = 0;
|
||||
}
|
||||
else { /* The VarBindList has contents */
|
||||
if ((rp->pdu.trap_pdu.trap_vbl.vblist = VarBindList_Allocate(num_vb))
|
||||
== 0) {
|
||||
SNMP_Free(rp);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
#endif /* INSTALL_ENVOY_SNMP_VERSION_1 */
|
||||
@@ -0,0 +1,396 @@
|
||||
/* creatreq.c - creatreq.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: creatreq.c,v $
|
||||
* Revision 1.4 2003/01/15 14:05:03 josh
|
||||
* directory structure shifting
|
||||
*
|
||||
* Revision 1.3 2001/11/06 21:50:45 josh
|
||||
* second (and hopefully final) pass of new path hacking
|
||||
*
|
||||
* Revision 1.2 2001/11/06 21:20:07 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.5.4.2 2001/08/07 21:53:31 meister
|
||||
* reworked to use dynamic component configuration macros, to allow
|
||||
* separate vxworks agentx components
|
||||
*
|
||||
* Revision 9.5.4.1 2001/08/07 18:36:59 meister
|
||||
* Break out SNMP_Create_Request_V3{,_Lockable}() out of creatreq.c into
|
||||
* v3_creq.c. Change static create_request() into non-static _snmp_create_request()
|
||||
*
|
||||
* Revision 9.5 2001/01/19 22:22:20 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.4 2000/03/17 00:19:03 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.3 2000/03/09 13:51:32 josh
|
||||
* a shell function has been created to allow SNMPv3 requests
|
||||
* to be created while we're holding the coarse lock.
|
||||
*
|
||||
* 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/04/09 20:37:06 josh
|
||||
* Obsoleting ENVOY_SNMP_VERSON_USEC and ENVOY_40_VB_FREE_COMPAT
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:20 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.12 1998/08/01 17:35:03 sar
|
||||
* Removed the check_id flag from the user lookup call
|
||||
*
|
||||
* Revision 8.11 1998/07/20 02:01:23 sar
|
||||
* Removed dynamic/static tags from v3 packet creation routine
|
||||
*
|
||||
* Revision 8.10 1998/07/03 16:51:32 sar
|
||||
* Removed the many engine option and moved this engine's boots and time
|
||||
* informtaion into an engine entry
|
||||
*
|
||||
* Revision 8.9 1998/06/18 04:32:32 sar
|
||||
* Update the type info for bflags in an ebuffer and make
|
||||
* everybody match it.
|
||||
*
|
||||
* Revision 8.8 1998/06/01 20:41:52 sar
|
||||
* Removed the msg_con_name field from SNMP_PKT_T and used the community
|
||||
* field instead.
|
||||
*
|
||||
* Revision 8.7 1998/05/30 03:20:04 sar
|
||||
* Modified the names for the max string length macros for clarity
|
||||
* Update user_lookup
|
||||
*
|
||||
* Revision 8.6 1998/05/29 04:16:20 sar
|
||||
* Switch to using read locks instead of write locks.
|
||||
* Corrected spelling of the locks
|
||||
* Moved the use of coarse lock around to include the user list
|
||||
*
|
||||
* Revision 8.5 1998/05/29 04:13:42 sar
|
||||
* *** empty log message ***
|
||||
*
|
||||
* Revision 8.4 1998/05/28 04:01:51 sar
|
||||
* Get the coarse lock to protect the engine list
|
||||
* before getting the boots lock for the boot info
|
||||
*
|
||||
* Revision 8.3 1998/05/28 03:43:52 sar
|
||||
* Added a lock to protect the engine boots and time values
|
||||
*
|
||||
* Revision 8.2 1998/05/24 04:29:00 sar
|
||||
* Added create function for use with v3 packets
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:37 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:47 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:48:50 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.2 1996/01/10 16:34:47 sar
|
||||
* usec updates
|
||||
*
|
||||
* Revision 6.1 1995/10/20 23:02:48 sar
|
||||
* removed no_pp stuff
|
||||
* removed create_v2_request & create_half_trap
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:47:19 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.2 1995/03/21 00:25:01 sar
|
||||
* Use the new party names (for & loc instaead of src & dst)
|
||||
*
|
||||
* Revision 5.1 1994/10/03 21:22:28 sar
|
||||
* Added the function SNMP_Create_V2_Half_Trap. This routine
|
||||
* create a v2 type snmp_pkt_t set up for a v2 trap but without
|
||||
* any party or context information. This packet is for use with
|
||||
* the create_and_send_traps routines.
|
||||
*
|
||||
* 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.9 1993/06/02 23:09:24 dab
|
||||
* Changed #ifdef's to #if's for things from install.h
|
||||
*
|
||||
* Revision 3.8 1993/05/17 14:03:35 sar
|
||||
* changed SNMP_Create_Party_Request to be SNMP_Create_V2_Request
|
||||
*
|
||||
* Revision 3.7 1993/05/03 17:16:12 sar
|
||||
* Added routines for local time, removed {party context} oids from packet
|
||||
* structure, added asn1len to {party context} structures and
|
||||
* SNMP_{Party Context}_Name where needed to lookup the name for a given
|
||||
* {Party Context}.
|
||||
*
|
||||
* Revision 3.6 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.5 1993/04/19 18:28:34 sar
|
||||
* cleanup, mostly some correcting some non-ansi misspellings and adding
|
||||
* static defs.
|
||||
*
|
||||
* Revision 3.4 1993/03/03 03:17:00 sar
|
||||
* Updated to deal with shadow rows. I have defined a new enumeration for
|
||||
* row status (RS_RSNE = 0) which means that row status doesn't exist yet.
|
||||
* Most routines now check to see if the row is active before using it.
|
||||
* Also added SNMP_SILLY_MARKETING_MACRO as per Rob's request.
|
||||
*
|
||||
* Revision 3.3 1993/02/24 01:02:41 sar
|
||||
* Changed many call to use OIDC_T/lenght pairs instead of OBJ_ID_T as now
|
||||
* we don't need to specifically allocate the OBJ_ID_T.
|
||||
* Removed the name objid from the PARTYLEAF_T as the name may be determined from
|
||||
* the tree itself. For efficiency purposes put the dest/src party names into
|
||||
* the pkt so we don't have to look them up frequently.
|
||||
*
|
||||
* Revision 3.2 1993/02/17 21:02:06 sar
|
||||
* Added SNMP_Create_Party_Request to create and fill in packet structures
|
||||
* for v2. Moved some of the common code between v1 and v2 into a seperate
|
||||
* routine to shrink code size.
|
||||
*
|
||||
* Revision 3.1 92/04/28 10:37:08 dab
|
||||
* Fixed comments to reference snmpdefs.h instead of snmp.h
|
||||
*
|
||||
* Revision 3.0 92/04/03 19:52:37 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 2.102 91/10/30 20:41:56 dab
|
||||
* Directly include asn1conf.h, snmpdefs.h, and snmpstat.h (if needed).
|
||||
*
|
||||
* Revision 2.101 91/08/15 12:30:57 dab
|
||||
* Removed <libfuncs.h>.
|
||||
*
|
||||
* Revision 2.100 91/08/09 14:08:19 dab
|
||||
* Update version.
|
||||
*
|
||||
* Revision 1.1 91/07/30 02:23:33 romkey
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
* Rev 2.0 31 Mar 1990 15:06:42
|
||||
* Release 2.00
|
||||
*
|
||||
* Rev 1.0 11 Jan 1989 12:11:20
|
||||
* Initial revision.
|
||||
*
|
||||
* Separated from buildpkt.c on January 11, 1989.
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains creatreq.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/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/buildpkt.h>
|
||||
|
||||
#include <wrn/wm/common/bug.h>
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_3
|
||||
#include <wrn/wm/snmp/engine/v3_eng.h>
|
||||
#include <wrn/wm/snmp/engine/v3_user.h>
|
||||
#include <wrn/wm/snmp/engine/v3_auth.h>
|
||||
#include <wrn/wm/snmp/engine/v3_priv.h>
|
||||
#endif /* #if INSTALL_ENVOY_SNMP_VERSION_3 */
|
||||
|
||||
/****************************************************************************
|
||||
\NOMANUAL
|
||||
NAME: create_request
|
||||
|
||||
PURPOSE: Allocate an SNMP request packet and the vbl list for it.
|
||||
|
||||
PARAMETERS:
|
||||
int Number of VarBindList elements needed (may be 0)
|
||||
|
||||
RETURNS: SNMP_PKT_T * SNMP Packet structure, 0 on failure
|
||||
****************************************************************************/
|
||||
SNMP_PKT_T *
|
||||
_snmp_create_request(int num_vb)
|
||||
{
|
||||
SNMP_PKT_T *rp;
|
||||
|
||||
if ((rp = SNMP_Allocate()) == 0)
|
||||
return 0;
|
||||
|
||||
/* Is the VarBindList empty ? */
|
||||
if ((rp->pdu.std_pdu.std_vbl.vbl_count = num_vb) == 0) /* yes */
|
||||
rp->pdu.std_pdu.std_vbl.vblist = 0;
|
||||
|
||||
else { /* No, the VarBindList has contents */
|
||||
if ((rp->pdu.std_pdu.std_vbl.vblist = VarBindList_Allocate(num_vb)) == 0) {
|
||||
SNMP_Free(rp);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* SNMP_Create_Request2 - build SNMPv2c packets and SNMPv1 packets
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* SNMP_PKT_T * SNMP_Create_Request2
|
||||
* (
|
||||
* int ptype,
|
||||
* int version,
|
||||
* int commleng,
|
||||
* char * community,
|
||||
* INT_32_T request_id,
|
||||
* int num_vb,
|
||||
* int nonreps,
|
||||
* int maxreps
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine builds SNMPv2c packets and all SNMPv1 packets except SNMPv1
|
||||
* 'TRAP' PDUs. Use SNMP_Create_Request2() for SNMP managers. If you plan to
|
||||
* implement agents, use it for SMNPv2 'TRAP' and 'INFORM' PDUs instead.
|
||||
* SNMP_Create_Request2() allocates and initializes a new packet structure of
|
||||
* type 'SNMP_PKT_T' for a SNMP message.
|
||||
* If you are building a multi-lingual agent, you need to call
|
||||
* SNMP_Create_Request2() and SNMP_Create_Trap() to build appropriate SNMPv1 and
|
||||
* SNMPv2 'TRAP' PDUs.
|
||||
*
|
||||
* \&NOTE: After you have created this structure, call the appropriate bind
|
||||
* procedures to bind specific entries into the 'VarBindList' before calling
|
||||
* SNMP_Encode_Packet() to encode the packet for transmission.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <ptype>
|
||||
* Indicate the SNMP PDU type. The following types are available to both SNMPv1
|
||||
* and SNMPv2: 'GET_REQUEST_PDU', 'GET_NEXT_REQUEST_PDU' and 'SET_REQUEST_PDU'
|
||||
* types. The following PDU types are available only to SNMPv2: 'TRAP2_PDU',
|
||||
* 'INFORM_REQUEST_PDU', and 'GET_BULK_REQUEST_PDU' types.
|
||||
* \i <version>
|
||||
* Specify the SNMP protocol version as either 0 ('SNMP_VERSION_1') or 1
|
||||
* ('SNMP_VERSION_2.)' The constants 'VERSION_RFC1067', 'VERSION_RFC1098' and
|
||||
* 'VERSION_RFC1157' are equivalent to 'SNMP_VERSION_1'.
|
||||
* \i <commleng>
|
||||
* Specify the length in bytes of the SNMP community name.
|
||||
* \i <*community>
|
||||
* Specify the SNMP community name.
|
||||
* \i <request_id>
|
||||
* Contain the transaction identifier for the packet.
|
||||
* \i <num_vb>
|
||||
* Indicate how many 'VarBind' entries will be placed into the 'VarBindList'.
|
||||
* \i <nonreps>
|
||||
* Specify number to put into the non-repeaters field in PDUs of type 'GET BULK
|
||||
* REQUEST'.
|
||||
* \i <maxreps>
|
||||
* Specify number to put into the max-repetitions field in PDUs of type 'GET
|
||||
* BULK REQUEST'.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If successful, this routine returns a pointer to the newly created
|
||||
* packet. Otherwise, it returns 0.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: SNMP_Create_Request_V3(), SNMP_Create_Trap(), SNMP_Encode_Packet()
|
||||
*/
|
||||
SNMP_PKT_T *
|
||||
SNMP_Create_Request2(int ptype,
|
||||
int version,
|
||||
int commleng,
|
||||
char *community,
|
||||
sbits32_t request_id,
|
||||
int num_vb,
|
||||
int nonreps,
|
||||
int maxreps)
|
||||
|
||||
{
|
||||
SNMP_PKT_T *rp;
|
||||
|
||||
/* Deteremine if the pdu type is acceptable for the requested version */
|
||||
switch (version) {
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
case SNMP_VERSION_1:
|
||||
if ((ptype != GET_REQUEST_PDU) &&
|
||||
(ptype != GET_NEXT_REQUEST_PDU) &&
|
||||
(ptype != SET_REQUEST_PDU))
|
||||
return 0;
|
||||
break;
|
||||
#endif /* INSTALL_ENVOY_SNMP_VERSION_1 */
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_2
|
||||
case SNMP_VERSION_2:
|
||||
if ((ptype != GET_REQUEST_PDU) &&
|
||||
(ptype != GET_NEXT_REQUEST_PDU) &&
|
||||
(ptype != SET_REQUEST_PDU) &&
|
||||
(ptype != GET_BULK_REQUEST_PDU) &&
|
||||
(ptype != INFORM_REQUEST_PDU) &&
|
||||
(ptype != TRAP2_PDU))
|
||||
return 0;
|
||||
break;
|
||||
#endif /* INSTALL_ENVOY_SNMP_VERSION_2 */
|
||||
default: /* unknown version number */
|
||||
return(0);
|
||||
}
|
||||
|
||||
if ((rp = _snmp_create_request(num_vb)) == 0)
|
||||
return 0;
|
||||
|
||||
rp->snmp_version = version;
|
||||
rp->pdu_type = (ATVALUE_T)ptype;
|
||||
rp->pdu.std_pdu.request_id = request_id;
|
||||
if (ptype == GET_BULK_REQUEST_PDU) {
|
||||
rp->pdu.std_pdu.error_status = nonreps;
|
||||
rp->pdu.std_pdu.error_index = maxreps;
|
||||
}
|
||||
else {
|
||||
rp->pdu.std_pdu.error_status = 0;
|
||||
rp->pdu.std_pdu.error_index = 0;
|
||||
}
|
||||
|
||||
EBufferPreLoad(BFL_IS_STATIC, &(rp->community), community, commleng);
|
||||
|
||||
return rp;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2001-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: dyncfgam.c,v $
|
||||
* Revision 1.6 2003/01/15 14:05:03 josh
|
||||
* directory structure shifting
|
||||
*
|
||||
* Revision 1.5 2002/01/07 15:44:10 tneale
|
||||
* Fixed error in path to vxprotos.h
|
||||
*
|
||||
* Revision 1.4 2002/01/04 22:35:11 tneale
|
||||
* Added vxprotos.h include
|
||||
*
|
||||
* Revision 1.3 2001/11/06 21:50:45 josh
|
||||
* second (and hopefully final) pass of new path hacking
|
||||
*
|
||||
* Revision 1.2 2001/11/06 21:20:08 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 1.1.2.1 2001/10/23 23:09:01 meister
|
||||
* Core dyncfg related to the agentx master side
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/agentx.h>
|
||||
#include <wrn/wm/snmp/vxagent/vxprotos.h>
|
||||
#include <wrn/wm/common/dyncfg.h>
|
||||
|
||||
DYNCFG_EXTERN_FUNCPTR0(envoy_ax_ma_init,void)
|
||||
DYNCFG_EXTERN_FUNCPTR8(_snmp_find_next_helper_ax, int, MIBNODE_T *, int,
|
||||
OIDC_T*, OBJ_ID_T *, int, VB_T *, SNMP_PKT_T *, int)
|
||||
DYNCFG_EXTERN_FUNCPTR2(_snmp_find_next_bound, int, MIBNODE_T *, VB_T *)
|
||||
|
||||
|
||||
/*
|
||||
* set all dynamic configuration function pointers and variables for the
|
||||
* vxworks agentx master agent component here
|
||||
*/
|
||||
|
||||
void ax_master_dyncfg_init (void)
|
||||
{
|
||||
DYNCFG_FUNCPTR_SET_DEFAULT(envoy_ax_ma_init);
|
||||
DYNCFG_FUNCPTR_SET_DEFAULT(_snmp_find_next_helper_ax);
|
||||
DYNCFG_FUNCPTR_SET_DEFAULT(_snmp_find_next_bound);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2001-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: dyncfgas.c,v $
|
||||
* Revision 1.6 2003/01/15 14:05:03 josh
|
||||
* directory structure shifting
|
||||
*
|
||||
* Revision 1.5 2002/01/07 15:44:10 tneale
|
||||
* Fixed error in path to vxprotos.h
|
||||
*
|
||||
* Revision 1.4 2002/01/04 22:35:34 tneale
|
||||
* Added vxprotos.h include
|
||||
*
|
||||
* Revision 1.3 2001/11/06 21:50:45 josh
|
||||
* second (and hopefully final) pass of new path hacking
|
||||
*
|
||||
* Revision 1.2 2001/11/06 21:20:08 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 1.1.2.1 2001/09/20 17:11:38 meister
|
||||
* vxworks subaget component needs its own file for function initializations
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,26may04,job change a declaration to extern
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/agentx.h>
|
||||
#include <wrn/wm/snmp/vxagent/vxprotos.h>
|
||||
#include <wrn/wm/common/dyncfg.h>
|
||||
|
||||
/*
|
||||
* set all dynamic configuration function pointers and variables for the
|
||||
* vxworks agentx subagent component here.
|
||||
*/
|
||||
|
||||
DYNCFG_EXTERN_FUNCPTR0(envoy_ax_sa_init,void)
|
||||
|
||||
void ax_sub_dyncfg_init (void)
|
||||
{
|
||||
DYNCFG_FUNCPTR_SET_DEFAULT(envoy_ax_sa_init);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2001-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: dyncfgax.c,v $
|
||||
* Revision 1.4 2003/01/15 14:05:03 josh
|
||||
* directory structure shifting
|
||||
*
|
||||
* Revision 1.3 2001/11/06 21:50:46 josh
|
||||
* second (and hopefully final) pass of new path hacking
|
||||
*
|
||||
* Revision 1.2 2001/11/06 21:20:08 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 1.1.2.4 2001/10/23 23:10:03 meister
|
||||
* dyncfg for agentx core (common to both master and subagent builds)
|
||||
*
|
||||
* Revision 1.1.2.3 2001/09/27 01:11:33 meister
|
||||
* dynamic V3 config rototill
|
||||
*
|
||||
* Revision 1.1.2.2 2001/09/20 17:10:44 meister
|
||||
* added some missing dynamic component function pointer initializations
|
||||
*
|
||||
* Revision 1.1.2.1 2001/08/17 20:46:42 meister
|
||||
* These files will contain dynamic component config initialization
|
||||
* routines for agentX and V3 components
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/agentx.h>
|
||||
#include <wrn/wm/common/dyncfg.h>
|
||||
|
||||
/*
|
||||
* set all dynamic configuration function pointers and variables for the
|
||||
* envoy agentx core component here
|
||||
*/
|
||||
|
||||
void ax_dyncfg_init (void)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright 2001-2011 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: dyncfgv3.c,v $
|
||||
* Revision 1.6 2003/01/15 14:05:03 josh
|
||||
* directory structure shifting
|
||||
*
|
||||
* Revision 1.5 2001/12/11 18:19:58 meister
|
||||
* A_DecodeInteger64Data doesn't really need to be DYNCFG'd.
|
||||
*
|
||||
* Revision 1.4 2001/11/07 16:42:09 meister
|
||||
* vxprotos.h not needed here
|
||||
*
|
||||
* Revision 1.3 2001/11/06 21:50:46 josh
|
||||
* second (and hopefully final) pass of new path hacking
|
||||
*
|
||||
* Revision 1.2 2001/11/06 21:20:08 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 1.1.2.8 2001/11/02 17:13:10 meister
|
||||
* split out user and core dynamic config initialization
|
||||
*
|
||||
* Revision 1.1.2.7 2001/10/16 19:24:36 meister
|
||||
* add vxprotos.h include file
|
||||
*
|
||||
* Revision 1.1.2.6 2001/10/16 18:33:24 meister
|
||||
* split out v3 mibs
|
||||
*
|
||||
* Revision 1.1.2.5 2001/10/02 17:55:37 meister
|
||||
* Start splitting out the V3 mib subtrees, to be loaded at startup
|
||||
*
|
||||
* Revision 1.1.2.4 2001/09/27 13:45:14 meister
|
||||
* dynamic config rototill; missed SNMP_Check_Retrans_List()
|
||||
*
|
||||
* Revision 1.1.2.3 2001/09/27 01:11:34 meister
|
||||
* dynamic V3 config rototill
|
||||
*
|
||||
* Revision 1.1.2.2 2001/09/20 17:10:45 meister
|
||||
* added some missing dynamic component function pointer initializations
|
||||
*
|
||||
* Revision 1.1.2.1 2001/08/17 20:46:44 meister
|
||||
* These files will contain dynamic component config initialization
|
||||
* routines for agentX and V3 components
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,16jun11,y_t update for requirement WIND00242199
|
||||
01c,15sep09,y_t fix for WIND00181371
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/decode.h>
|
||||
#include <wrn/wm/snmp/engine/sendntfy.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/localio.h>
|
||||
#include <wrn/wm/snmp/engine/v3_ini.h>
|
||||
#include <wrn/wm/common/dyncfg.h>
|
||||
|
||||
/*
|
||||
* set all dynamic configuration function pointers and variables for the
|
||||
* vxworks snmpv3 component here
|
||||
*/
|
||||
|
||||
DYNCFG_EXTERN_FUNCPTR6(SNMP_Decode_V3_Packet,SNMP_PKT_T*,SNMP_PKT_T *,
|
||||
LCL_FILE *, SNMPADDR_T *, SNMPADDR_T *, ALENGTH_T,
|
||||
int *)
|
||||
DYNCFG_EXTERN_FUNCPTR1(SNMP_Check_Retrans_List,void,SNMP_PKT_T *)
|
||||
|
||||
DYNCFG_EXTERN_FUNCPTR0(envoy_v3_init,void)
|
||||
DYNCFG_EXTERN_FUNCPTR0(SNMP_Auth_Add_MD5,int)
|
||||
DYNCFG_EXTERN_FUNCPTR0(SNMP_Auth_Add_SHA,int)
|
||||
#ifndef OPENSSL_FIPS
|
||||
DYNCFG_EXTERN_FUNCPTR0(SNMP_Priv_Add_DES,int)
|
||||
#endif
|
||||
DYNCFG_EXTERN_FUNCPTR0(SNMP_Priv_Add_AESCFB128,int)
|
||||
DYNCFG_EXTERN_FUNCPTR1(bufsize_for_v3_pkt,ALENGTH_T,SNMP_PKT_T *)
|
||||
DYNCFG_EXTERN_FUNCPTR2(encode_snmp_v3,int,SNMP_PKT_T *,EBUFFER_T *)
|
||||
DYNCFG_EXTERN_FUNCPTR9(Send_Report_PDU,SNMP_PKT_T *,SNMP_PKT_T *,LCL_FILE *,
|
||||
bits8_t,OIDC_T *,int,bits32_t,int *,SNMPADDR_T *,
|
||||
SNMPADDR_T *)
|
||||
|
||||
void v3_dyncfg_init (void)
|
||||
{
|
||||
DYNCFG_FUNCPTR_SET_DEFAULT(SNMP_Decode_V3_Packet);
|
||||
#if INSTALL_ENVOY_SNMP_V3_NOTIFY
|
||||
DYNCFG_FUNCPTR_SET_DEFAULT(SNMP_Check_Retrans_List);
|
||||
#endif
|
||||
DYNCFG_FUNCPTR_SET_DEFAULT(envoy_v3_init);
|
||||
|
||||
DYNCFG_FUNCPTR_SET_DEFAULT(SNMP_Auth_Add_MD5);
|
||||
DYNCFG_FUNCPTR_SET_DEFAULT(SNMP_Auth_Add_SHA);
|
||||
#ifndef OPENSSL_FIPS
|
||||
DYNCFG_FUNCPTR_SET_DEFAULT(SNMP_Priv_Add_DES);
|
||||
#endif
|
||||
DYNCFG_FUNCPTR_SET_DEFAULT(SNMP_Priv_Add_AESCFB128);
|
||||
DYNCFG_FUNCPTR_SET_DEFAULT(bufsize_for_v3_pkt);
|
||||
DYNCFG_FUNCPTR_SET_DEFAULT(encode_snmp_v3);
|
||||
DYNCFG_FUNCPTR_SET_DEFAULT(Send_Report_PDU);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* Copyright 2001-2005, 2013 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: dyncfgvx.c,v $
|
||||
* Revision 1.5 2003/01/15 14:05:04 josh
|
||||
* directory structure shifting
|
||||
*
|
||||
* Revision 1.4 2001/12/11 18:19:58 meister
|
||||
* A_DecodeInteger64Data doesn't really need to be DYNCFG'd.
|
||||
*
|
||||
* Revision 1.3 2001/11/06 21:50:46 josh
|
||||
* second (and hopefully final) pass of new path hacking
|
||||
*
|
||||
* Revision 1.2 2001/11/06 21:20:08 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 1.1.2.10 2001/11/02 17:13:11 meister
|
||||
* split out user and core dynamic config initialization
|
||||
*
|
||||
* Revision 1.1.2.9 2001/10/19 21:09:33 meister
|
||||
* get rid of the message-queue method of communicating which components
|
||||
* are installed, in favor of a directly accessible bit-mask variable. We never
|
||||
* never used the message queue for anything the simple bit mask couldnt do.
|
||||
*
|
||||
* Revision 1.1.2.8 2001/10/16 18:32:03 meister
|
||||
* dynamic function pointers for snmpAxMonitorSpawn, axMasterIoInit
|
||||
*
|
||||
* Revision 1.1.2.7 2001/10/01 18:54:59 meister
|
||||
* dynamic config variable for envoy_use_v2_types should always be on when
|
||||
* is on.
|
||||
*
|
||||
* Revision 1.1.2.6 2001/09/27 13:45:15 meister
|
||||
* dynamic config rototill; missed SNMP_Check_Retrans_List()
|
||||
*
|
||||
* Revision 1.1.2.5 2001/09/27 13:26:09 meister
|
||||
* Use new dyncfg macro DYNCFG_FUNCPTR to set dynnamic version of
|
||||
* SNMP_community_lookup()
|
||||
*
|
||||
* Revision 1.1.2.4 2001/09/27 01:11:34 meister
|
||||
* dynamic V3 config rototill
|
||||
*
|
||||
* Revision 1.1.2.3 2001/09/20 17:10:45 meister
|
||||
* added some missing dynamic component function pointer initializations
|
||||
*
|
||||
* Revision 1.1.2.2 2001/09/18 21:22:15 meister
|
||||
* configMsgQ --> snmpdConfigMsgQ
|
||||
*
|
||||
* Revision 1.1.2.1 2001/09/13 17:35:24 meister
|
||||
* added some casts to deal with compiler warnings
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,17sep13,bbz fix for checked return warning
|
||||
01c,15sep09,y_t fix for WIND00181371
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <msgQLib.h>
|
||||
#include <semLib.h>
|
||||
#include <taskLib.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/localio.h>
|
||||
#include <wrn/wm/snmp/engine/agentx.h>
|
||||
#include <wrn/wm/snmp/engine/vxcmpnts.h>
|
||||
#include <wrn/wm/common/dyncfg.h>
|
||||
|
||||
extern unsigned int snmpdInstalledComponentsValue;
|
||||
extern SEM_ID snmpdConfigMutex;
|
||||
|
||||
DYNCFG_FUNCPTR8(_snmp_find_next_helper_ax, int, MIBNODE_T *, int,
|
||||
OIDC_T*, OBJ_ID_T *, int, VB_T *, SNMP_PKT_T *, int)
|
||||
DYNCFG_FUNCPTR2(_snmp_find_next_bound, int, MIBNODE_T *, VB_T *)
|
||||
DYNCFG_EXTERN_FUNCPTR0(envoy_ax_ma_init,void)
|
||||
|
||||
DYNCFG_FUNCPTR6(SNMP_Decode_V3_Packet,SNMP_PKT_T*,SNMP_PKT_T *,
|
||||
LCL_FILE *, SNMPADDR_T *, SNMPADDR_T *, ALENGTH_T,
|
||||
int *)
|
||||
DYNCFG_FUNCPTR1(SNMP_Check_Retrans_List,void,SNMP_PKT_T *)
|
||||
|
||||
DYNCFG_EXTERN_FUNCPTR0(envoy_v3_init,void)
|
||||
|
||||
DYNCFG_FUNCPTR0(SNMP_Auth_Add_MD5,int)
|
||||
DYNCFG_FUNCPTR0(SNMP_Auth_Add_SHA,int)
|
||||
DYNCFG_FUNCPTR0(SNMP_Priv_Add_DES,int)
|
||||
DYNCFG_FUNCPTR0(SNMP_Priv_Add_AESCFB128,int)
|
||||
DYNCFG_FUNCPTR1(bufsize_for_v3_pkt,ALENGTH_T,SNMP_PKT_T *)
|
||||
DYNCFG_FUNCPTR2(encode_snmp_v3,int,SNMP_PKT_T *,EBUFFER_T *)
|
||||
DYNCFG_FUNCPTR9(Send_Report_PDU,SNMP_PKT_T *,SNMP_PKT_T *,LCL_FILE *,
|
||||
bits8_t,OIDC_T *,int,bits32_t,int *,SNMPADDR_T *,
|
||||
SNMPADDR_T *)
|
||||
|
||||
/* from snmp core code */
|
||||
DYNCFG_VBL_DECLARE_EXTERN(envoy_use_v2_types)
|
||||
DYNCFG_VBL_DECLARE_EXTERN(envoy_use_v2_protos)
|
||||
DYNCFG_VBL_DECLARE_EXTERN(envoy_snmp_coexistence)
|
||||
DYNCFG_VBL_DECLARE_EXTERN(envoy_snmp_proxy)
|
||||
DYNCFG_VBL_DECLARE_EXTERN(envoy_snmp_target)
|
||||
DYNCFG_VBL_DECLARE_EXTERN(envoy_snmp_notify)
|
||||
DYNCFG_VBL_DECLARE_EXTERN(snmpv3_component)
|
||||
DYNCFG_VBL_DECLARE_EXTERN(agentx_master_component)
|
||||
DYNCFG_VBL_DECLARE_EXTERN(agentx_subagent_component)
|
||||
|
||||
void determineSnmpdComponents (void)
|
||||
{
|
||||
(void)semTake (snmpdConfigMutex, WAIT_FOREVER);
|
||||
|
||||
DYNCFG_VBL_SET(envoy_use_v2_types, 1);
|
||||
DYNCFG_VBL_SET(envoy_use_v2_protos, 1);
|
||||
|
||||
if (snmpdInstalledComponentsValue & SNMPD_AGENTX_MASTER_COMPONENT)
|
||||
DYNCFG_VBL_SET(agentx_master_component, 1);
|
||||
if (snmpdInstalledComponentsValue & SNMPD_AGENTX_SUBAGENT_COMPONENT)
|
||||
DYNCFG_VBL_SET(agentx_subagent_component, 1);
|
||||
if (snmpdInstalledComponentsValue & SNMPD_VERSION_3_COMPONENT)
|
||||
{ DYNCFG_VBL_SET(snmpv3_component, 1);
|
||||
DYNCFG_VBL_SET(envoy_snmp_coexistence, 1);
|
||||
DYNCFG_VBL_SET(envoy_snmp_proxy, 1);
|
||||
DYNCFG_VBL_SET(envoy_snmp_target, 1);
|
||||
DYNCFG_VBL_SET(envoy_snmp_notify, 1);
|
||||
}
|
||||
|
||||
semGive (snmpdConfigMutex);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,363 @@
|
||||
/*
|
||||
* Copyright 2002-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.
|
||||
*/
|
||||
|
||||
/* entitymt.c - method routines for the Entity MIB */
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
$Log: entitymt.c,v $
|
||||
Revision 1.1 2002/05/23 18:47:32 josh
|
||||
support for the entLogicalTable from RFC 2737
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This module contains the method routines for managing the
|
||||
Entity MIB via SNMP. Currently, only the entLogicalTable
|
||||
and the entityGeneral object entLastChangeTime are supported.
|
||||
|
||||
INCLUDE FILES: asn1conf.h, asn1.h, buffer.h, mib.h, localio.h,
|
||||
snmpdefs.h, snmp.h, auxfuncs.h, objectid.h,
|
||||
entlogic.h
|
||||
*/
|
||||
|
||||
#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/mib.h>
|
||||
#include <wrn/wm/snmp/engine/localio.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
#include <wrn/wm/snmp/engine/entlogic.h>
|
||||
|
||||
/*
|
||||
* Method routines for the entLogicalTable:
|
||||
*
|
||||
* entLogicalIndex -- not-accessible
|
||||
* The value of this object uniquely identifies the logical
|
||||
* entity. The value should be a small positive integer; index
|
||||
* values for different logical entities are are not
|
||||
* necessarily contiguous.
|
||||
*
|
||||
* entLogicalDescr -- read-only
|
||||
* A textual description of the logical entity. This object
|
||||
* should contain a string which identifies the manufacturer's
|
||||
* name for the logical entity, and should be set to a distinct
|
||||
* value for each version of the logical entity.
|
||||
*
|
||||
* entLogicalType -- read-only
|
||||
* An indication of the type of logical entity. This will
|
||||
* typically be the OBJECT IDENTIFIER name of the node in the
|
||||
* SMI's naming hierarchy which represents the major MIB
|
||||
* module, or the majority of the MIB modules, supported by the
|
||||
* logical entity. For example:
|
||||
* a logical entity of a regular host/router -> mib-2
|
||||
* a logical entity of a 802.1d bridge -> dot1dBridge
|
||||
* a logical entity of a 802.3 repeater -> snmpDot3RptrMgmt
|
||||
* If an appropriate node in the SMI's naming hierarchy cannot
|
||||
* be identified, the value 'mib-2' should be used.
|
||||
*
|
||||
* entLogicalCommunity -- read-only
|
||||
* An SNMPv1 or SNMPv2C community-string which can be used to
|
||||
* access detailed management information for this logical
|
||||
* entity. The agent should allow read access with this
|
||||
* community string (to an appropriate subset of all managed
|
||||
* objects) and may also return a community string based on the
|
||||
* privileges of the request used to read this object. Note
|
||||
* that an agent may return a community string with read-only
|
||||
* privileges, even if this object is accessed with a read-
|
||||
* write community string. However, the agent must take care
|
||||
* not to return a community string which allows more
|
||||
* privileges than the community string used to access this
|
||||
* object.
|
||||
*
|
||||
* A compliant SNMP agent may wish to conserve naming scopes by
|
||||
* representing multiple logical entities in a single 'default'
|
||||
* naming scope. This is possible when the logical entities
|
||||
* represented by the same value of entLogicalCommunity have no
|
||||
* object instances in common. For example, 'bridge1' and
|
||||
* 'repeater1' may be part of the main naming scope, but at
|
||||
* least one additional community string is needed to represent
|
||||
* 'bridge2' and 'repeater2'.
|
||||
*
|
||||
* Logical entities 'bridge1' and 'repeater1' would be
|
||||
* represented by sysOREntries associated with the 'default'
|
||||
* naming scope.
|
||||
*
|
||||
* For agents not accessible via SNMPv1 or SNMPv2C, the value
|
||||
* of this object is the empty string. This object may also
|
||||
* contain an empty string if a community string has not yet
|
||||
* been assigned by the agent, or no community string with
|
||||
* suitable access rights can be returned for a particular SNMP
|
||||
* request.
|
||||
*
|
||||
* Note that this object is deprecated. Agents which implement
|
||||
* SNMPv3 access should use the entLogicalContextEngineID and
|
||||
* entLogicalContextName objects to identify the context
|
||||
* associated with each logical entity. SNMPv3 agents may
|
||||
* return a zero-length string for this object, or may continue
|
||||
* to return a community string (e.g., tri-lingual agent
|
||||
* support).
|
||||
*
|
||||
* entLogicalTAddress -- read-only
|
||||
* The transport service address by which the logical entity
|
||||
* receives network management traffic, formatted according to
|
||||
* the corresponding value of entLogicalTDomain.
|
||||
*
|
||||
* For snmpUDPDomain, a TAddress is 6 octets long, the initial
|
||||
* 4 octets containing the IP-address in network-byte order and
|
||||
* the last 2 containing the UDP port in network-byte order.
|
||||
* Consult 'Transport Mappings for Version 2 of the Simple
|
||||
* Network Management Protocol' (RFC 1906 [RFC1906]) for
|
||||
* further information on snmpUDPDomain.
|
||||
*
|
||||
* entLogicalTDomain -- read-only
|
||||
* Indicates the kind of transport service by which the
|
||||
* logical entity receives network management traffic.
|
||||
* Possible values for this object are presently found in the
|
||||
* Transport Mappings for SNMPv2 document (RFC 1906
|
||||
* [RFC1906]).
|
||||
*
|
||||
* entLogicalContextEngineID -- read-only
|
||||
* The authoritative contextEngineID that can be used to send
|
||||
* an SNMP message concerning information held by this logical
|
||||
* entity, to the address specified by the associated
|
||||
* 'entLogicalTAddress/entLogicalTDomain' pair.
|
||||
*
|
||||
* This object, together with the associated
|
||||
* entLogicalContextName object, defines the context associated
|
||||
* with a particular logical entity, and allows access to SNMP
|
||||
* engines identified by a contextEngineId and contextName
|
||||
* pair.
|
||||
*
|
||||
* If no value has been configured by the agent, a zero-length
|
||||
* string is returned, or the agent may choose not to
|
||||
* instantiate this object at all.
|
||||
*
|
||||
* entLogicalContextName -- read-only
|
||||
* The contextName that can be used to send an SNMP message
|
||||
* concerning information held by this logical entity, to the
|
||||
* address specified by the associated
|
||||
* 'entLogicalTAddress/entLogicalTDomain' pair.
|
||||
*
|
||||
* This object, together with the associated
|
||||
* entLogicalContextEngineID object, defines the context
|
||||
* associated with a particular logical entity, and allows
|
||||
* access to SNMP engines identified by a contextEngineId and
|
||||
* contextName pair.
|
||||
*
|
||||
* If no value has been configured by the agent, a zero-length
|
||||
* string is returned, or the agent may choose not to
|
||||
* instantiate this object at all.
|
||||
*/
|
||||
|
||||
static int
|
||||
entLogicalEntry_get_value(OIDC_T lastmatch,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
ENT_LOGICAL_T *entLogical)
|
||||
{
|
||||
switch(lastmatch) {
|
||||
case LEAF_entLogicalDescr:
|
||||
getproc_got_string(pktp, vbp,
|
||||
Ent_Logical_Get_Descr_Len(entLogical),
|
||||
Ent_Logical_Get_Descr(entLogical),
|
||||
0, VT_STRING);
|
||||
break;
|
||||
case LEAF_entLogicalType:
|
||||
getproc_got_object_id(pktp, vbp,
|
||||
Ent_Logical_Get_Type(entLogical)->num_components,
|
||||
Ent_Logical_Get_Type(entLogical)->component_list,
|
||||
0);
|
||||
break;
|
||||
case LEAF_entLogicalCommunity:
|
||||
getproc_got_string(pktp, vbp,
|
||||
Ent_Logical_Get_Community_Len(entLogical),
|
||||
Ent_Logical_Get_Community(entLogical),
|
||||
0, VT_STRING);
|
||||
break;
|
||||
case LEAF_entLogicalTAddress:
|
||||
getproc_got_string(pktp, vbp,
|
||||
Ent_Logical_Get_TAddress_Len(entLogical),
|
||||
Ent_Logical_Get_TAddress(entLogical),
|
||||
0, VT_STRING);
|
||||
break;
|
||||
case LEAF_entLogicalTDomain:
|
||||
getproc_got_object_id(pktp, vbp,
|
||||
Ent_Logical_Get_TDomain(entLogical)->num_components,
|
||||
Ent_Logical_Get_TDomain(entLogical)->component_list,
|
||||
0);
|
||||
break;
|
||||
case LEAF_entLogicalContextEngineID:
|
||||
getproc_got_string(pktp, vbp,
|
||||
Ent_Logical_Get_Context_Engine_ID_Len(entLogical),
|
||||
Ent_Logical_Get_Context_Engine_ID(entLogical),
|
||||
0, VT_STRING);
|
||||
break;
|
||||
case LEAF_entLogicalContextName:
|
||||
getproc_got_string(pktp, vbp,
|
||||
Ent_Logical_Get_Context_Name_Len(entLogical),
|
||||
Ent_Logical_Get_Context_Name(entLogical),
|
||||
0, VT_STRING);
|
||||
break;
|
||||
default:
|
||||
return GEN_ERR;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
void
|
||||
entLogicalEntry_get(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
ENT_LOGICAL_T *entLogical;
|
||||
int error;
|
||||
|
||||
/* find all the varbinds that share the same getproc and instance */
|
||||
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
|
||||
|
||||
if ((tcount != 1) || ((entLogical = Ent_Logical_Lookup(*tlist)) == 0)) {
|
||||
for ( ; vbp ; vbp = vbp->vb_link)
|
||||
getproc_nosuchins(pktp, vbp);
|
||||
}
|
||||
else {
|
||||
/* retrieve all the values from the same data structure */
|
||||
for ( ; vbp ; vbp = vbp->vb_link) {
|
||||
if ((error = entLogicalEntry_get_value(vbp->vb_ml.ml_last_match,
|
||||
pktp, vbp, entLogical))
|
||||
!= NO_ERROR)
|
||||
getproc_error(pktp, vbp, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
entLogicalEntry_next(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
ENT_LOGICAL_T *entLogical;
|
||||
OIDC_T entIndex[1];
|
||||
int error;
|
||||
|
||||
/* find all the varbinds that share the same getproc and instance */
|
||||
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
|
||||
|
||||
entLogical = Ent_Logical_Next(tcount, tlist);
|
||||
if (entLogical) {
|
||||
entIndex[0] = Ent_Logical_Get_Index(entLogical);
|
||||
for ( ; vbp ; vbp = vbp->vb_link ) {
|
||||
if ((error = entLogicalEntry_get_value(vbp->vb_ml.ml_last_match,
|
||||
pktp, vbp, entLogical))
|
||||
== NO_ERROR)
|
||||
nextproc_next_instance(pktp, vbp, 1, entIndex);
|
||||
else
|
||||
nextproc_error(pktp, vbp, error);
|
||||
}
|
||||
}
|
||||
else /* there's no more in this table */
|
||||
for ( ; vbp ; vbp = vbp->vb_link)
|
||||
nextproc_no_next(pktp, vbp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Method routines for the entityGeneral variables:
|
||||
*
|
||||
* entLastChangeTime -- read-only
|
||||
* The value of sysUpTime at the time a conceptual row is
|
||||
* created, modified, or deleted in any of these tables:
|
||||
* - entPhysicalTable
|
||||
* - entLogicalTable
|
||||
* - entLPMappingTable
|
||||
* - entAliasMappingTable
|
||||
* - entPhysicalContainsTable
|
||||
|
||||
*/
|
||||
|
||||
static int
|
||||
entityGeneral_get_value(OIDC_T lastmatch,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
ENT_GENERAL_T *entGeneral)
|
||||
{
|
||||
switch(lastmatch) {
|
||||
case LEAF_entLastChangeTime:
|
||||
getproc_got_uint32(pktp, vbp,
|
||||
Ent_General_Get_Last_Change_Time(entGeneral),
|
||||
VT_TIMETICKS);
|
||||
break;
|
||||
default:
|
||||
return GEN_ERR;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
void
|
||||
entityGeneral_get(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
int error;
|
||||
|
||||
/* find all the varbinds that share the same getproc and instance */
|
||||
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
|
||||
|
||||
/* check that the instance is exactly .0 */
|
||||
if (!((tcount == 1) && (*tlist == 0)))
|
||||
for ( ; vbp; vbp = vbp->vb_link)
|
||||
getproc_nosuchins(pktp, vbp);
|
||||
else {
|
||||
/* retrieve all the values from the same data structure */
|
||||
for ( ; vbp; vbp = vbp->vb_link) {
|
||||
if ((error = entityGeneral_get_value(vbp->vb_ml.ml_last_match,
|
||||
pktp, vbp,
|
||||
Ent_General_Group_Lookup()))
|
||||
!= NO_ERROR)
|
||||
getproc_error(pktp, vbp, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
entityGeneral_next(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
OIDC_T instance = 0;
|
||||
|
||||
/* the only time there's a next for a scalar is if we're given
|
||||
* no instance at all. */
|
||||
if (tcount != 0)
|
||||
nextproc_no_next(pktp, vbp);
|
||||
else {
|
||||
/* find all the varbinds in this group and retrieve their
|
||||
* values from the same data structure */
|
||||
for (group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
|
||||
vbp; vbp = vbp->vb_link) {
|
||||
nextproc_next_instance(pktp, vbp, 1, &instance);
|
||||
entityGeneral_get_value(vbp->vb_ml.ml_last_match,
|
||||
pktp, vbp,
|
||||
Ent_General_Group_Lookup());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,280 @@
|
||||
/*
|
||||
* Copyright 2002-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.
|
||||
*/
|
||||
|
||||
/* entlogic.c - object manipulation routines for the entLogicalTable */
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
$Log: entlogic.c,v $
|
||||
Revision 1.2 2002/05/23 20:00:25 josh
|
||||
quick fix to make call to ENVOY_GET_SYSUPTIME() properly
|
||||
|
||||
Revision 1.1 2002/05/23 18:47:31 josh
|
||||
support for the entLogicalTable from RFC 2737
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This module contains the object manipulation routines for the
|
||||
logical entity object.
|
||||
|
||||
INCLUDE FILES: asn1.h, snmp.h, buffer.h, objectid.h, snmpdefs.h,
|
||||
entlogic.h
|
||||
*/
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/objectid.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/entlogic.h>
|
||||
|
||||
/****************************************************************************
|
||||
* entLogicalFindBefore - find the where the previous entLogical object
|
||||
* would be in the entLogical list.
|
||||
*
|
||||
* Search through the list until we find the entLogical structure we are
|
||||
* looking for. We return a pointer to the pointer that would point to the
|
||||
* requested entLogical if it were to exist. The calling routine is
|
||||
* responsible for determining if the requested entLogical exists. This
|
||||
* construction allows us to reuse this code for all of the find routines
|
||||
* (lookup and install).
|
||||
*
|
||||
* RETURNS: ENT_LOGICAL_T ** pointer to pointer that would point to the
|
||||
* entLogical object if it were to exist.
|
||||
*/
|
||||
|
||||
static ENT_LOGICAL_T ** entLogicalFindBefore
|
||||
(
|
||||
bits32_t entLogicalIndex
|
||||
)
|
||||
{
|
||||
ENT_LOGICAL_T ** ppEntLogical; /* pointer for walking the list */
|
||||
|
||||
for(ppEntLogical = &root_ent_logical;
|
||||
*ppEntLogical;
|
||||
ppEntLogical = &(*ppEntLogical)->next)
|
||||
{
|
||||
if (Ent_Logical_Get_Index (*ppEntLogical) >= entLogicalIndex)
|
||||
break;
|
||||
}
|
||||
|
||||
return(ppEntLogical);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Ent_Logical_Lookup - look up a logical entity object by name
|
||||
*
|
||||
* Find the logical entity with the given name.
|
||||
*
|
||||
* RETURNS: ENT_LOGICAL_T * pointer to the logical entity
|
||||
* 0 if no logical entity found
|
||||
*/
|
||||
|
||||
ENT_LOGICAL_T * Ent_Logical_Lookup
|
||||
(
|
||||
bits32_t entLogicalIndex
|
||||
)
|
||||
{
|
||||
ENT_LOGICAL_T ** ppEntLogical; /* pointer for walking the list */
|
||||
|
||||
ppEntLogical = entLogicalFindBefore (entLogicalIndex);
|
||||
|
||||
if ((*ppEntLogical != 0) &&
|
||||
(Ent_Logical_Get_Index (*ppEntLogical) == entLogicalIndex))
|
||||
return (*ppEntLogical);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Ent_Logical_Next - Find the next logical entity after this instance
|
||||
*
|
||||
* This routine takes instance information as input and attempts to find the
|
||||
* lexicographically next logical entity object in the logical entity list.
|
||||
*
|
||||
* the indexing information is of the form:
|
||||
* <entLogicalIndex>
|
||||
*
|
||||
* RETURNS: ENT_LOGICAL_T * pointer to logical entity
|
||||
* 0 if none found
|
||||
*/
|
||||
ENT_LOGICAL_T * Ent_Logical_Next
|
||||
(
|
||||
int tcount,
|
||||
OIDC_T * tlist
|
||||
)
|
||||
{
|
||||
ENT_LOGICAL_T * pEntLogical; /* pointer for walking the list */
|
||||
|
||||
if (tcount == 0)
|
||||
return (root_ent_logical);
|
||||
|
||||
for (pEntLogical = root_ent_logical;
|
||||
pEntLogical;
|
||||
pEntLogical = pEntLogical->next)
|
||||
{
|
||||
if (Ent_Logical_Get_Index (pEntLogical) > *tlist)
|
||||
return (pEntLogical);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Ent_Logical_Next_Ent - find the logical entity object immediately after
|
||||
* this one
|
||||
*
|
||||
* This routine takes a logical entity object and returns the next object in
|
||||
* the logical entity list.
|
||||
*
|
||||
* RETURNS: ENT_LOGICAL_T * logical entity after the input argument
|
||||
* 0 if none
|
||||
*/
|
||||
|
||||
ENT_LOGICAL_T * Ent_Logical_Next_Ent
|
||||
(
|
||||
ENT_LOGICAL_T * pEntLogical
|
||||
)
|
||||
{
|
||||
if (pEntLogical)
|
||||
return (pEntLogical->next);
|
||||
return (root_ent_logical);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Ent_Logical_Destroy - Destroy the current logical entity object
|
||||
*
|
||||
* Clean up any memory associated with a logical entity. Note that this
|
||||
* doesn't touch the indexing information -- that will be handled by the
|
||||
* install and deinstall routines.
|
||||
*
|
||||
* RETURNS: N/A
|
||||
*/
|
||||
|
||||
void Ent_Logical_Destroy
|
||||
(
|
||||
ENT_LOGICAL_T * pEntLogical
|
||||
)
|
||||
{
|
||||
EBufferClean (&pEntLogical->entLogicalDescr);
|
||||
Clean_Obj_ID (&pEntLogical->entLogicalType);
|
||||
EBufferClean (&pEntLogical->entLogicalCommunity);
|
||||
EBufferClean (&pEntLogical->entLogicalTAddress);
|
||||
Clean_Obj_ID (&pEntLogical->entLogicalTDomain);
|
||||
EBufferClean (&pEntLogical->entLogicalContextEngineID);
|
||||
EBufferClean (&pEntLogical->entLogicalContextName);
|
||||
SNMP_memory_free_lt (pEntLogical);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Ent_Logical_Create - create and initialize a logical entity object
|
||||
*
|
||||
* Allocate memory for a new logical entity and fill in the defaults. Note
|
||||
* that this doesn't include indexing information, that will be added by the
|
||||
* install routine.
|
||||
*
|
||||
* RETURNS: ENT_LOGICAL_T * the logical entity that was created
|
||||
* 0 on error
|
||||
*/
|
||||
|
||||
ENT_LOGICAL_T * Ent_Logical_Create (void)
|
||||
{
|
||||
ENT_LOGICAL_T * pEntLogical;
|
||||
|
||||
pEntLogical = (ENT_LOGICAL_T *)
|
||||
SNMP_memory_alloc_lt (sizeof (ENT_LOGICAL_T));
|
||||
if (pEntLogical == 0)
|
||||
return(0);
|
||||
|
||||
Ent_Logical_Set_Defaults (pEntLogical);
|
||||
return (pEntLogical);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Ent_Logical_Install - install a logical entity into the logical entity list
|
||||
*
|
||||
* Install the given logical entity into the logical entity list as specified
|
||||
* by the indexing information. Once installed a logical entity should be
|
||||
* deinstalled before being destroyed.
|
||||
*
|
||||
* It is an error if a logical entity is already installed with the given
|
||||
* indexing information.
|
||||
*
|
||||
* RETURNS: ENVOY_ERR_NOERR if successful
|
||||
* ENVOY_ERR_BAD_INSTANCE if the instance information is incorrect
|
||||
* ENVOY_ERR_EXISTS if an object already exists with that instance
|
||||
*/
|
||||
|
||||
envoy_err_t Ent_Logical_Install
|
||||
(
|
||||
ENT_LOGICAL_T * inEntLogical,
|
||||
bits32_t entLogicalIndex
|
||||
)
|
||||
{
|
||||
ENT_LOGICAL_T ** ppEntLogical;
|
||||
|
||||
/* see if the index information is reasonable */
|
||||
if (entLogicalIndex > ETC_ENT_LOGICAL_MAX_INDEX)
|
||||
return (ENVOY_ERR_BAD_INSTANCE);
|
||||
|
||||
/* see if the logical entity already exists */
|
||||
ppEntLogical = entLogicalFindBefore (entLogicalIndex);
|
||||
if ((*ppEntLogical != 0) &&
|
||||
(Ent_Logical_Get_Index (*ppEntLogical) == entLogicalIndex))
|
||||
return (ENVOY_ERR_EXISTS);
|
||||
|
||||
Ent_Logical_Set_Index (inEntLogical, entLogicalIndex);
|
||||
Ent_General_Set_Last_Change_Time (Ent_General_Group_Lookup(),
|
||||
ENVOY_GET_SYSUPTIME(0));
|
||||
|
||||
/* insert the proxy into the list */
|
||||
inEntLogical->next = *ppEntLogical;
|
||||
*ppEntLogical = inEntLogical;
|
||||
return (ENVOY_ERR_NOERR);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Ent_Logical_Deinstall - deinstall the logical entity object from the list
|
||||
*
|
||||
* Unhook a logical entity from the logical entity list. The logical entity is
|
||||
* not destroyed but is no longer useable by the engine. To destroy the
|
||||
* logical entity use the destroy routine.
|
||||
*
|
||||
*
|
||||
* RETURNS: N/A
|
||||
*/
|
||||
|
||||
void Ent_Logical_Deinstall
|
||||
(
|
||||
ENT_LOGICAL_T * inEntLogical
|
||||
)
|
||||
{
|
||||
ENT_LOGICAL_T ** ppEntLogical;
|
||||
|
||||
for(ppEntLogical = &root_ent_logical;
|
||||
*ppEntLogical;
|
||||
ppEntLogical = &(*ppEntLogical)->next)
|
||||
if (*ppEntLogical == inEntLogical)
|
||||
{
|
||||
*ppEntLogical = inEntLogical->next;
|
||||
Ent_Logical_Set_Index (inEntLogical, 0);
|
||||
inEntLogical->next = 0;
|
||||
Ent_General_Set_Last_Change_Time (Ent_General_Group_Lookup(),
|
||||
ENVOY_GET_SYSUPTIME(0));
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,413 @@
|
||||
/* env_init.c - env_init.c routines */
|
||||
|
||||
/*
|
||||
* Copyright 2000-2011 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 1994-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: env_init.c,v $
|
||||
* Revision 1.5 2003/01/15 14:05:04 josh
|
||||
* directory structure shifting
|
||||
*
|
||||
* Revision 1.4 2002/05/23 18:51:14 josh
|
||||
* code modifications to support the entity MIB
|
||||
*
|
||||
* Revision 1.3 2001/11/06 21:50:46 josh
|
||||
* second (and hopefully final) pass of new path hacking
|
||||
*
|
||||
* Revision 1.2 2001/11/06 21:20:09 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.5.4.6 2001/10/02 17:57:02 meister
|
||||
* fix up compiler warnings
|
||||
*
|
||||
* Revision 9.5.4.5 2001/09/27 01:12:05 meister
|
||||
* dynamic config rototill
|
||||
*
|
||||
* Revision 9.5.4.4 2001/09/20 17:10:45 meister
|
||||
* added some missing dynamic component function pointer initializations
|
||||
*
|
||||
* Revision 9.5.4.3 2001/09/13 17:35:25 meister
|
||||
* added some casts to deal with compiler warnings
|
||||
*
|
||||
* Revision 9.5.4.2 2001/08/07 21:53:31 meister
|
||||
* reworked to use dynamic component configuration macros, to allow
|
||||
* separate vxworks agentx components
|
||||
*
|
||||
* Revision 9.5.4.1 2001/08/06 20:05:37 meister
|
||||
* Added dynamic component configuration macros to V3 conditional code
|
||||
*
|
||||
* Revision 9.5 2001/01/19 22:22:21 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.4 2000/03/17 00:19:05 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.3 1999/11/01 19:56:53 josh
|
||||
* cleaning up initializations to keep extra files out of code when not
|
||||
* in use
|
||||
*
|
||||
* Revision 9.2 1999/11/01 15:03:49 josh
|
||||
* manually reinitialize globals on startup -- makes Envoy restartable
|
||||
*
|
||||
* Revision 9.1 1999/10/26 19:58:37 sar
|
||||
* Modify the handling of cleanups for sub agents that timeout.
|
||||
* We now use the infrastructure lock to mediate access to the
|
||||
* cookies, group lists, groups and handles by the query and timeout
|
||||
* code for the epilogue sub agent scheme. This allows the cleanups
|
||||
* to occur more quickly than previously and be interleaved with
|
||||
* the queries more.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:24 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.15 1998/09/22 22:14:41 josh
|
||||
* ENVOY_PSOS_CONFIG is a better name that ENVOY_PSOS_SYSCONF.
|
||||
* Eliminate some confusion, there.
|
||||
*
|
||||
* Revision 8.14 1998/09/11 16:30:43 paul
|
||||
* Auto-initialize common library.
|
||||
*
|
||||
* Revision 8.13 1998/08/12 04:43:56 sar
|
||||
* Move the initialization routines around some in order to minimize
|
||||
* the amount of code that gets pulled in for init purposes.
|
||||
*
|
||||
* Revision 8.12 1998/07/03 19:35:15 josh
|
||||
* modifying init code again -- new scheme allows us to get
|
||||
* certain settings from a sys_conf.h, if there is one.
|
||||
*
|
||||
* Revision 8.11 1998/07/03 16:51:34 sar
|
||||
* Removed the many engine option and moved this engine's boots and time
|
||||
* informtaion into an engine entry
|
||||
*
|
||||
* Revision 8.10 1998/06/22 17:27:44 josh
|
||||
* minor mods to init code
|
||||
*
|
||||
* Revision 8.9 1998/06/19 22:13:11 josh
|
||||
* bugfixes to init code
|
||||
*
|
||||
* Revision 8.8 1998/06/19 16:27:46 josh
|
||||
* modifications to initialize globals in envoy_init()
|
||||
*
|
||||
* Revision 8.7 1998/06/15 18:54:42 josh
|
||||
* a few changes as part of merging in SNMp sources
|
||||
*
|
||||
* Revision 8.6 1998/05/29 17:04:00 josh
|
||||
* newmacros for locking code
|
||||
*
|
||||
* Revision 8.5 1998/05/28 03:43:53 sar
|
||||
* Added a lock to protect the engine boots and time values
|
||||
*
|
||||
* Revision 8.4 1998/05/27 22:55:45 sar
|
||||
* Added routines to manipulate the auth and priv lists (add and find)
|
||||
* and put code into the init routine to install those routines we know
|
||||
* about (if they are installed).
|
||||
*
|
||||
* Revision 8.3 1998/05/24 04:36:09 sar
|
||||
* Split the lock code into a differnet function to make it more
|
||||
* obvious when we actually add something to the main init routine.
|
||||
*
|
||||
* Revision 8.2 1998/04/16 15:48:48 josh
|
||||
* A new lock init API, and a new lock (both optional)
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:47 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:48 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.1 1997/10/22 03:10:20 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01j,16jun11,y_t update for requirement WIND00242199
|
||||
01i,21apr10,y_t update for REQWIND00197530
|
||||
01g,15sep09,y_t fix for WIND00181371
|
||||
01f,17feb06,job fix APIGEN markup
|
||||
01e,13jan06,job add a prototype for determineSnmpdComponents()
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains env_init.c routines.
|
||||
|
||||
INCLUDE FILES: snmp.h
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/etimer.h>
|
||||
#include <wrn/wm/snmp/engine/view.h>
|
||||
|
||||
#include <wrn/wm/common/cmn_init.h>
|
||||
#include <wrn/wm/common/dyncfg.h>
|
||||
|
||||
#if INSTALL_COMMON_DYNAMIC_COMP_CONFIG && INSTALL_ENVOY_VXWORKS
|
||||
#include <wrn/wm/snmp/engine/vxcmpnts.h>
|
||||
#endif
|
||||
|
||||
#if INSTALL_COMMON_DYNAMIC_COMP_CONFIG
|
||||
void determineSnmpdComponents(void);
|
||||
#endif
|
||||
|
||||
#include <wrn/wm/snmp/engine/localio.h>
|
||||
|
||||
DYNCFG_FUNCPTR0(envoy_v3_init,void)
|
||||
DYNCFG_FUNCPTR0(envoy_ax_ma_init,void)
|
||||
DYNCFG_FUNCPTR0(envoy_ax_sa_init,void)
|
||||
|
||||
DYNCFG_EXTERN_FUNCPTR0(SNMP_Auth_Add_MD5,int)
|
||||
DYNCFG_EXTERN_FUNCPTR0(SNMP_Auth_Add_SHA,int)
|
||||
DYNCFG_EXTERN_FUNCPTR0(SNMP_Priv_Add_DES,int)
|
||||
DYNCFG_EXTERN_FUNCPTR0(SNMP_Priv_Add_AESCFB128,int)
|
||||
|
||||
|
||||
DYNCFG_VBL_DECLARE_GLOBAL(envoy_use_v2_types)
|
||||
DYNCFG_VBL_DECLARE_GLOBAL(envoy_use_v2_protos)
|
||||
DYNCFG_VBL_DECLARE_GLOBAL(envoy_snmp_coexistence)
|
||||
DYNCFG_VBL_DECLARE_GLOBAL(envoy_snmp_proxy)
|
||||
DYNCFG_VBL_DECLARE_GLOBAL(envoy_snmp_target)
|
||||
DYNCFG_VBL_DECLARE_GLOBAL(envoy_snmp_notify)
|
||||
DYNCFG_VBL_DECLARE_GLOBAL(snmpv3_component)
|
||||
DYNCFG_VBL_DECLARE_GLOBAL(agentx_master_component)
|
||||
DYNCFG_VBL_DECLARE_GLOBAL(agentx_subagent_component)
|
||||
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_3
|
||||
#include <wrn/wm/snmp/engine/v3_ini.h>
|
||||
#include <wrn/wm/snmp/engine/v3_auth.h>
|
||||
#include <wrn/wm/snmp/engine/v3_priv.h>
|
||||
#endif
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_PROXY
|
||||
#include <wrn/wm/snmp/engine/proxy.h>
|
||||
#endif
|
||||
|
||||
#if INSTALL_ENVOY_AGENTX
|
||||
#include <wrn/wm/snmp/engine/agentx.h>
|
||||
#endif
|
||||
|
||||
#if INSTALL_ENVOY_ENTITY_MIB
|
||||
#include <wrn/wm/snmp/engine/entlogic.h>
|
||||
#endif
|
||||
|
||||
#if INSTALL_ENVOY_PSOS_CONFIG
|
||||
#include <env_conf.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* These options may be turned on by the sys_conf.h, or
|
||||
* in envoy.h for source users.
|
||||
*/
|
||||
|
||||
#ifndef ENVOY_SC_USE_AGENTX_MASTER
|
||||
#define ENVOY_SC_USE_AGENTX_MASTER 1
|
||||
#endif
|
||||
|
||||
#ifndef ENVOY_SC_USE_SNMPV3
|
||||
#define ENVOY_SC_USE_SNMPV3 1
|
||||
#endif
|
||||
|
||||
#ifndef ENVOY_SC_USE_MD5
|
||||
#define ENVOY_SC_USE_MD5 1
|
||||
#endif
|
||||
|
||||
#ifndef ENVOY_SC_USE_SHA
|
||||
#define ENVOY_SC_USE_SHA 1
|
||||
#endif
|
||||
|
||||
#ifndef ENVOY_SC_USE_DES
|
||||
#define ENVOY_SC_USE_DES 1
|
||||
#endif
|
||||
|
||||
/* End of sys_conf options. */
|
||||
|
||||
#if (INSTALL_ENVOY_SNMP_LOCK)
|
||||
ENVOY_SNMP_LOCK(SNMP_CoarseLock);
|
||||
|
||||
ENVOY_SNMP_LOCK(SNMP_infrastructure_lock);
|
||||
#endif /* install locks */
|
||||
|
||||
#if (INSTALL_ENVOY_SNMP_SERIALIZE)
|
||||
extern INT_32_T Gate_Readers;
|
||||
extern INT_32_T Gate_Writers;
|
||||
extern INT_32_T Gate_Running;
|
||||
|
||||
struct GATEKEEPER_S;
|
||||
|
||||
extern struct GATEKEEPER_S *gateroot;
|
||||
#endif /* serialization */
|
||||
|
||||
#if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS) || (INSTALL_ENVOY_SNMP_RFC2275_VIEWS)
|
||||
extern VIEWINDEX_T *viewroot;
|
||||
|
||||
#ifndef ENVOY_INITIALIZE_VIEWROOT
|
||||
#define ENVOY_INITIALIZE_VIEWROOT(VR) ((VR) = 0)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if INSTALL_ENVOY_ENTITY_MIB
|
||||
ENT_LOGICAL_T *root_ent_logical = 0;
|
||||
ENT_GENERAL_T root_ent_general;
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* envoy_init - initialize Wind Manage SNMP
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* void envoy_init()
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine initializes Wind River SNMP. Call it before calling any other
|
||||
* Wind River SNMP routines
|
||||
*
|
||||
* PARAMETERS
|
||||
* None.
|
||||
*
|
||||
* RETURNS: None.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: None.
|
||||
*/
|
||||
void
|
||||
envoy_init()
|
||||
{
|
||||
|
||||
#if INSTALL_COMMON_DYNAMIC_COMP_CONFIG
|
||||
determineSnmpdComponents();
|
||||
#endif
|
||||
|
||||
envoy_timer_init();
|
||||
|
||||
#if (INSTALL_ENVOY_SNMP_VERSION_3 && ENVOY_SC_USE_SNMPV3)
|
||||
DYNCFG_IFCFGVBL_BEGIN(snmpv3_component)
|
||||
DYNCFG_FUNCALL(envoy_v3_init) ();
|
||||
|
||||
/* try to add in auth routines */
|
||||
#if (INSTALL_ENVOY_MD5 && ENVOY_SC_USE_MD5)
|
||||
(void) DYNCFG_FUNCALL(SNMP_Auth_Add_MD5)();
|
||||
#endif /* (INSTALL_ENVOY_MD5 && ENVOY_SC_USE_MD5) */
|
||||
|
||||
#if (INSTALL_ENVOY_SHA && ENVOY_SC_USE_SHA)
|
||||
(void) DYNCFG_FUNCALL(SNMP_Auth_Add_SHA)();
|
||||
#endif /* (INSTALL_ENVOY_SHA && ENVOY_SC_USE_SHA) */
|
||||
|
||||
/* then the priv routine */
|
||||
#ifndef OPENSSL_FIPS
|
||||
#if (INSTALL_ENVOY_DES && ENVOY_SC_USE_DES)
|
||||
(void) DYNCFG_FUNCALL(SNMP_Priv_Add_DES)();
|
||||
#endif /* (INSTALL_ENVOY_DES && ENVOY_SC_USE_DES) */
|
||||
#endif
|
||||
|
||||
#if INSTALL_ENVOY_AESCFB128
|
||||
(void) DYNCFG_FUNCALL(SNMP_Priv_Add_AESCFB128)();
|
||||
#endif /* (INSTALL_ENVOY_DES && ENVOY_SC_USE_DES) */
|
||||
|
||||
|
||||
DYNCFG_IFCFGVBL_END(snmpv3_component)
|
||||
#endif /* (INSTALL_ENVOY_SNMP_VERSION_3 && ENVOY_SC_USE_SNMPV3) */
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_PROXY
|
||||
envoy_proxy_init();
|
||||
#endif
|
||||
|
||||
#if (INSTALL_ENVOY_AGENTX_MASTER && ENVOY_SC_USE_AGENTX_MASTER)
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
DYNCFG_FUNCALL(envoy_ax_ma_init) ();
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
#endif
|
||||
|
||||
#if INSTALL_ENVOY_AGENTX_SUB
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_subagent_component)
|
||||
DYNCFG_FUNCALL(envoy_ax_sa_init) ();
|
||||
DYNCFG_IFCFGVBL_END(agentx_subagent_component)
|
||||
#endif
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_LOCK
|
||||
ENVOY_SNMP_INIT_LOCK_TAG(SNMP_CoarseLock, SNMP_COARSELOCK_TAG);
|
||||
|
||||
ENVOY_SNMP_INIT_LOCK_TAG(SNMP_infrastructure_lock,
|
||||
SNMP_INFRASTRUCTURELOCK_TAG);
|
||||
#endif
|
||||
|
||||
#if (INSTALL_ENVOY_SNMP_SERIALIZE)
|
||||
Gate_Readers = 0;
|
||||
Gate_Writers = 0;
|
||||
Gate_Running = 0;
|
||||
|
||||
gateroot = 0;
|
||||
#endif /* INSTALL_ENVOY_SNMP_SERIALIZE */
|
||||
|
||||
#if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS) || (INSTALL_ENVOY_SNMP_RFC2275_VIEWS)
|
||||
ENVOY_INITIALIZE_VIEWROOT(viewroot);
|
||||
#endif
|
||||
|
||||
#if INSTALL_ENVOY_ENTITY_MIB
|
||||
root_ent_logical = 0;
|
||||
Ent_General_Set_Defaults(Ent_General_Group_Lookup());
|
||||
#endif
|
||||
|
||||
/*COMMON_INIT_FROM_ENVOY();*/ /* initialize the strong random generator */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#if INSTALL_COMMON_DYNAMIC_COMP_CONFIG
|
||||
|
||||
/*
|
||||
* this function is meant to be called by an snmp component initialization
|
||||
* function startup task (probably in vxWorks) to initialize these component
|
||||
* config variables to zero (not installed). Other component initialization
|
||||
* tasks may subsequently reset them to 1 (installed)
|
||||
*/
|
||||
|
||||
void envoy_dyncfg_init (void)
|
||||
{
|
||||
|
||||
DYNCFG_VBL_SET(envoy_use_v2_types,0);
|
||||
DYNCFG_VBL_SET(envoy_use_v2_protos,0);
|
||||
DYNCFG_VBL_SET(envoy_snmp_coexistence,0);
|
||||
DYNCFG_VBL_SET(envoy_snmp_proxy,0);
|
||||
DYNCFG_VBL_SET(envoy_snmp_target,0);
|
||||
DYNCFG_VBL_SET(envoy_snmp_proxy,0);
|
||||
DYNCFG_VBL_SET(snmpv3_component,0);
|
||||
DYNCFG_VBL_SET(agentx_master_component,0);
|
||||
DYNCFG_VBL_SET(agentx_subagent_component,0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,366 @@
|
||||
/*
|
||||
* 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: etimer.c,v $
|
||||
* Revision 1.4 2003/01/15 14:05:04 josh
|
||||
* directory structure shifting
|
||||
*
|
||||
* Revision 1.3 2001/11/06 21:50:47 josh
|
||||
* second (and hopefully final) pass of new path hacking
|
||||
*
|
||||
* Revision 1.2 2001/11/06 21:20:09 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:22:21 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:19:05 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:26 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.4 1998/08/12 04:44:01 sar
|
||||
* Move the initialization routines around some in order to minimize
|
||||
* the amount of code that gets pulled in for init purposes.
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:13:51 sar
|
||||
* make sure all files include asn1conf.h and snmp.h to pick up all of
|
||||
* the common code
|
||||
*
|
||||
* Revision 8.2 1998/02/25 15:21:30 sra
|
||||
* Finish moving types.h, bug.h, and bugdef.h to common/h/.
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:48 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:49 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.4 1997/10/22 03:10:27 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:45:51 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:48:55 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.0 1995/05/31 21:47:23 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.4 1995/05/02 23:34:50 sar
|
||||
* Copied sra's newest code (so basically the file is new).
|
||||
*
|
||||
* Revision 1.3 1995/04/28 23:13:36 sar
|
||||
* Modified one of the loops to use the next field instead of the current
|
||||
* entry.
|
||||
*
|
||||
* Revision 1.2 1995/04/18 21:19:26 sar
|
||||
* Use the new lock macros and modfiy the code to set a timer to take into
|
||||
* account any time that has elapsed since the first timer was put on the
|
||||
* list.
|
||||
*
|
||||
* Revision 1.1 1995/03/21 00:09:23 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/common/types.h>
|
||||
#include <wrn/wm/snmp/engine/asn1conf.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/etimer.h>
|
||||
|
||||
#include <wrn/wm/common/bug.h>
|
||||
|
||||
/* This code was adapted from the attache timer code for use in the
|
||||
Envoy product, the major difference is the addition of if defs to
|
||||
use the envoy locking scheme if it is installed */
|
||||
|
||||
/* Timers are stored in an ordered linked list. Each timer has a field,
|
||||
t->expire, which indicates when it will expire. The expire field is
|
||||
set to the number of milliseconds it will expire after its predecessor.
|
||||
The first time in the list is set to the number of milliseconds it was
|
||||
originally set to.
|
||||
|
||||
successive timers that are all set to expire at the same time have
|
||||
t->expire set to 0.
|
||||
|
||||
The timer code calls ENVOY_CALL_TIMER() to set the one timer provided by the
|
||||
OS; it tells the OS to call envoy_timer_exp() within a certain number of
|
||||
milliseconds. envoy_timer_exp() processes the first timer on the list, and
|
||||
all others after it with t->expire set to 0 until it finds a non-0 timer.
|
||||
|
||||
envoy_tm_cancel() attempts to clear a timer and remove it from the list,
|
||||
if it fails (can't get the lock) it returns 1, in this case the user
|
||||
should not free the timer block. They may try to cancel the timer
|
||||
later and then free the timer block.
|
||||
|
||||
we can tell whether a timer is currently in use by checking its
|
||||
expire field. This field is NOT_IN_USE when the timer is not in use. */
|
||||
|
||||
static void envoy_timer_exp(void);
|
||||
static void envoy_timer_update(void);
|
||||
|
||||
#define NOT_IN_USE 0xFFFFFFFFL
|
||||
#define IN_USE(tm) ((tm)->expire != NOT_IN_USE)
|
||||
|
||||
/*
|
||||
* Initialize a timer to a known state (ie, mark timer as not in use).
|
||||
*/
|
||||
void
|
||||
envoy_tm_init (ENVOY_TIMER_T *tm)
|
||||
{
|
||||
tm->expire = NOT_IN_USE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Bring the expire times of all timers currently in the queue up to date.
|
||||
* ALL code that modifies the timer queue MUST call this function FIRST!
|
||||
* They must also acquire the write lock for the timer code.
|
||||
*/
|
||||
static void
|
||||
envoy_timer_update(void)
|
||||
{
|
||||
static bits32_t envoy_last_update;
|
||||
bits32_t now = ENVOY_NOW();
|
||||
bits32_t elapsed = now - envoy_last_update;
|
||||
ENVOY_TIMER_T *t = envoy_timer_list;
|
||||
|
||||
while (t && elapsed > t->expire) {
|
||||
elapsed -= t->expire;
|
||||
t->expire = 0;
|
||||
t = t->link;
|
||||
}
|
||||
|
||||
if (t && elapsed > 0)
|
||||
t->expire -= elapsed;
|
||||
|
||||
envoy_last_update = now;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is called when the OS timer fires. This code presumes
|
||||
* that we will not be called until we should have been, and then,
|
||||
* precisely once. [This may no longer be true, but let's be paranoid....]
|
||||
*
|
||||
* We have to be able to deal with the timer list changing as we run through
|
||||
* it, so we loop bringing the expire times up to date and processing the
|
||||
* first timer on the queue if we're reached its expire time. If there's
|
||||
* anything left on the queue when we finish processing expired timers,
|
||||
* we schedule the OS timer to wake us up when it's time to resume processing.
|
||||
*
|
||||
* Processing a timer means dequeuing it and calling its handler.
|
||||
*/
|
||||
static void
|
||||
envoy_timer_exp(void)
|
||||
{
|
||||
ENVOY_TIMER_T *t;
|
||||
void (*handler)(ENVOY_TIMER_T *, void *);
|
||||
void *cookie;
|
||||
|
||||
while(1) {
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_LOCK
|
||||
/* We don't have any good options if we can't get the lock.
|
||||
So we require the user to not do that, if they do we generate
|
||||
a bug report and if they don't handle that we reschedule the
|
||||
timer for a short time in the future which is the the least
|
||||
bad thing to do. */
|
||||
|
||||
if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_TimerLock)) {
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_FATAL, 0,
|
||||
(BUG_OUT, "envoy_timer_exp(): timer lock is broken", 0));
|
||||
ENVOY_CALL_TIMER(100, envoy_timer_exp);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
envoy_timer_update();
|
||||
if (envoy_timer_list && envoy_timer_list->expire == 0) {
|
||||
t = envoy_timer_list;
|
||||
envoy_timer_list = t->link;
|
||||
t->expire = NOT_IN_USE;
|
||||
handler = t->handler;
|
||||
cookie = t->cookie;
|
||||
}
|
||||
else {
|
||||
if (envoy_timer_list)
|
||||
ENVOY_CALL_TIMER(envoy_timer_list->expire, envoy_timer_exp);
|
||||
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_TimerLock);
|
||||
return;
|
||||
}
|
||||
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_TimerLock);
|
||||
handler(t, cookie);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set a timer to expire "when" milliseconds from now, canceling it first
|
||||
* if it was already set. We won't queue a timer that has no handler.
|
||||
*
|
||||
* For fairness, if there are other timers already queued that will
|
||||
* expire at the same time as this one, we put this one at the end of
|
||||
* the group so the others will get to run first.
|
||||
*
|
||||
* If, when we're done with the insertion, this timer is the new head
|
||||
* of the queue, we reset the OS timer accordingly.
|
||||
*/
|
||||
int
|
||||
envoy_tm_set (ENVOY_TIMER_T *tm, bits32_t when)
|
||||
{
|
||||
register ENVOY_TIMER_T **tt;
|
||||
|
||||
if (!tm || !tm->handler)
|
||||
return(1);
|
||||
if (IN_USE(tm))
|
||||
if (envoy_tm_cancel(tm))
|
||||
return(1);
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_LOCK
|
||||
if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_TimerLock)) {
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT, "envoy_tm_set: timer lock broken", 0));
|
||||
return(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
envoy_timer_update();
|
||||
|
||||
/* Skip down the queue looking for the right place to insert,
|
||||
adjusting the relative expire time as we go. */
|
||||
|
||||
tm->expire = when;
|
||||
for (tt = &envoy_timer_list;
|
||||
*tt && (*tt)->expire <= tm->expire;
|
||||
tt = &(*tt)->link)
|
||||
tm->expire -= (*tt)->expire;
|
||||
|
||||
/* Insert the timer, and adjust the relative expiration time of
|
||||
the timer immediately following it, if there is one. */
|
||||
tm->link = *tt;
|
||||
*tt = tm;
|
||||
if (tm->link)
|
||||
tm->link->expire -= tm->expire;
|
||||
|
||||
/* If we inserted at the front of the queue, set the OS timer. */
|
||||
if (tm == envoy_timer_list)
|
||||
ENVOY_CALL_TIMER(envoy_timer_list->expire, envoy_timer_exp);
|
||||
|
||||
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_TimerLock);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Cancel a timer. We have to adjust the relative expiration time
|
||||
* of the timer immediately following the one we're canceling.
|
||||
* If we're canceling the first timer and the adjusted expiration time
|
||||
* of the new head of the queue is still in the future, we reset the OS
|
||||
* timer. We don't need to reset the OS timer if we're not canceling
|
||||
* the head of the queue. We don't want to reset the OS timer if
|
||||
* the OS is already running behind schedule, because we expect the OS
|
||||
* timer we've already scheduled to expire Real Soon Now.
|
||||
*/
|
||||
int
|
||||
envoy_tm_cancel (ENVOY_TIMER_T *tm)
|
||||
{
|
||||
register ENVOY_TIMER_T **tt;
|
||||
boolean_t was_first;
|
||||
|
||||
if (!tm || !IN_USE(tm))
|
||||
return(0);
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_LOCK
|
||||
if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_TimerLock)) {
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT, "envoy_tm_cancel: timer lock broken", 0));
|
||||
return(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
tt = &envoy_timer_list;
|
||||
was_first = (tm == envoy_timer_list);
|
||||
|
||||
envoy_timer_update();
|
||||
|
||||
if (tm->link)
|
||||
tm->link->expire += tm->expire;
|
||||
|
||||
while (*tt && *tt != tm)
|
||||
tt = &(*tt)->link;
|
||||
if (*tt)
|
||||
*tt = tm->link;
|
||||
|
||||
tm->expire = NOT_IN_USE;
|
||||
|
||||
if (was_first && envoy_timer_list && envoy_timer_list->expire > 0)
|
||||
ENVOY_CALL_TIMER(envoy_timer_list->expire, envoy_timer_exp);
|
||||
|
||||
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_TimerLock);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
#ifdef PRINTF
|
||||
void
|
||||
envoy_tm_print(void)
|
||||
{
|
||||
ENVOY_TIMER_T *t;
|
||||
|
||||
if (ENVOY_SNMP_GET_READ_LOCK(SNMP_TimerLock)) {
|
||||
PRINTF("Unable to get read lock for timer list\n");
|
||||
return;
|
||||
}
|
||||
|
||||
PRINTF("Timer List:");
|
||||
for (t = envoy_timer_list; t; t = t->link)
|
||||
PRINTF(" %lx(%lu)", (unsigned long) t, (unsigned long) (t->expire));
|
||||
PRINTF("\n");
|
||||
|
||||
ENVOY_SNMP_RELEASE_READ_LOCK(SNMP_TimerLock);
|
||||
}
|
||||
#endif /* PRINTF */
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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 1986-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: etimerin.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:09 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:22:21 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:19:06 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:27 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.1 1998/08/12 04:44:01 sar
|
||||
* Move the initialization routines around some in order to minimize
|
||||
* the amount of code that gets pulled in for init purposes.
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1conf.h>
|
||||
#include <wrn/wm/snmp/engine/etimer.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
|
||||
ENVOY_TIMER_T *envoy_timer_list = 0;
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_LOCK
|
||||
ENVOY_SNMP_LOCK(SNMP_TimerLock);
|
||||
#endif
|
||||
|
||||
void
|
||||
envoy_timer_init (void)
|
||||
{
|
||||
envoy_timer_list = 0;
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_LOCK
|
||||
ENVOY_SNMP_INIT_LOCK_TAG(SNMP_TimerLock, SNMP_TIMERLOCK_TAG);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* 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: exist_as.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:10 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:38 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:50 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:22 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:11:56 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:30 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:18:34 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:44 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:07 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:55:57 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:49:47 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 6.0 1995/05/31 21:50:29 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.1 1995/03/08 23:08:05 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
/* Test function for simple mib variables that have exactly one
|
||||
instance of 0, so the "object instance" , i.e. the unused
|
||||
portion of the object identifier, must be a single component of
|
||||
value zero.
|
||||
*/
|
||||
|
||||
void
|
||||
it_exists_async(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
if ((tcount == 1) && (*tlist == 0))
|
||||
testproc_good(pktp, vbp);
|
||||
else
|
||||
testproc_error(pktp, vbp, NO_CREATION);
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* 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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: exists.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:10 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:38 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:51 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:22 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:11:57 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:31 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:45 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:08 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:55:57 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:49:47 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:30 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.1 1993/09/30 19:37:53 sar
|
||||
* Modified it_exists to return TPROC_NO_CREATION if we are trying to set
|
||||
* or create this object.
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.1 1993/03/01 17:14:17 dab
|
||||
* Changed variable named index to vb_index so it doesn't shadow index()
|
||||
* routine that some systems have.
|
||||
*
|
||||
* Revision 3.0 1992/04/03 19:53:01 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 1.2 91/10/30 20:37:57 dab
|
||||
* Directly include asn1conf.h and snmpdefs.h.
|
||||
*
|
||||
* Revision 1.1 91/10/24 11:05:06 dab
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1conf.h>
|
||||
#include <wrn/wm/snmp/engine/asn1.h>
|
||||
#include <wrn/wm/snmp/engine/localio.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/decode.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
|
||||
/* Test function for simple mib variables that have exactly one
|
||||
* instance of 0.
|
||||
*/
|
||||
int
|
||||
it_exists(int form, /* TEST_SET & TEST_GET from mib.h */
|
||||
OIDC_T lastmatch, /* Last component matched */
|
||||
int tcount,
|
||||
OIDC_T * tlist,
|
||||
char * cookie,
|
||||
SNMP_PKT_T *pktp,
|
||||
int vb_index) /* Index (zero based) of VB_T */
|
||||
{
|
||||
/* For non-tabular parameters, the "object instance", i.e. the unused */
|
||||
/* portion of the object identifier, must be a single component of */
|
||||
/* value zero. */
|
||||
if ((tcount == 1) && (*tlist == 0))
|
||||
return 0;
|
||||
|
||||
/* If this was a get we return no such, for sets or creates we return
|
||||
no creation */
|
||||
if (form == TEST_GET)
|
||||
return(TPROC_NOSUCH);
|
||||
else
|
||||
return(TPROC_NO_CREATION);
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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: gas_incr.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:10 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:38 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:51 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:22 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:11:57 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:33 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:18:35 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:45 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:09 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:55:58 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:49:49 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/11 00:00:48 sar
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
/* Get the TestAndIncr integer referenced by cookie. */
|
||||
void
|
||||
get_TestAndIncr_async(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
/* Test the instance qualifier, we must have one subid
|
||||
with a value of 0 */
|
||||
if ((tcount != 1) || (*tlist != 0))
|
||||
getproc_nosuchins(pktp, vbp);
|
||||
else
|
||||
getproc_got_int32(pktp, vbp, *(INT_32_T *)(VB_TO_COOKIE(vbp)));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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: gas_int.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:10 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:38 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:51 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:23 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:11:58 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:35 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:18:36 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:45 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:11 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:55:58 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:49:49 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 6.0 1995/05/31 21:50:32 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.1 1995/03/08 23:08:05 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
/* Get the 32-bit integer referenced by cookie. */
|
||||
void
|
||||
get_int_async(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
/* Test the instance qualifier, we must have one subid
|
||||
with a value of 0 */
|
||||
if ((tcount != 1) || (*tlist != 0))
|
||||
getproc_nosuchins(pktp, vbp);
|
||||
else
|
||||
getproc_got_int32(pktp, vbp, *(INT_32_T *)(VB_TO_COOKIE(vbp)));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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: gas_ip.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:11 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:38 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:51 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:23 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:11:58 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:37 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:18:37 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:46 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:12 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:55:59 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:49:50 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 6.0 1995/05/31 21:50:32 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.1 1995/03/08 23:08:05 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
/* Return the address of an IP address referenced by cookie. */
|
||||
|
||||
void
|
||||
get_ip_address_async(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
/* Test the instance qualifier, we must have one subid
|
||||
with a value of 0 */
|
||||
if ((tcount != 1) || (*tlist != 0))
|
||||
getproc_nosuchins(pktp, vbp);
|
||||
else
|
||||
getproc_got_ip_address(pktp, vbp, *(UINT_32_T *)(VB_TO_COOKIE(vbp)));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* 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: gas_oid.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:11 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:38 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:51 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:24 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:11:58 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:38 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:18:39 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:46 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:13 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:00 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:49:51 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 6.0 1995/05/31 21:50:33 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.1 1995/03/08 23:08:05 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
/* Return the address of an Object ID refenced by cookie. This routine
|
||||
assumes the oid is stored in static space and won't be changed between
|
||||
calling this routine and writing out the outbound packet */
|
||||
|
||||
void
|
||||
get_object_identifier_async(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
OBJ_ID_T *objid;
|
||||
/* Test the instance qualifier, we must have one subid with a value of 0 */
|
||||
if ((tcount != 1) || (*tlist != 0))
|
||||
getproc_nosuchins(pktp, vbp);
|
||||
else {
|
||||
objid = (OBJ_ID_T *)(VB_TO_COOKIE(vbp));
|
||||
getproc_got_object_id(pktp, vbp, objid->num_components,
|
||||
objid->component_list, 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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: gas_str.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:11 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:38 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:52 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:24 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:11:58 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:39 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:18:39 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:47 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:15 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:00 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:49:52 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 6.0 1995/05/31 21:50:33 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.1 1995/03/08 23:08:05 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01c,10jun10,y_t update for LP64
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1conf.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/auxfuncs.h>
|
||||
|
||||
/* Return a C string referenced by cookie. The address returned
|
||||
* *MUST* reference a static location.
|
||||
*/
|
||||
|
||||
void
|
||||
get_string_async(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
/* Test the instance qualifier, we must have one subid with a value of 0 */
|
||||
if ((tcount != 1) || (*tlist != 0))
|
||||
getproc_nosuchins(pktp, vbp);
|
||||
else {
|
||||
getproc_got_string(pktp, vbp, (ALENGTH_T)strlen((char *)(VB_TO_COOKIE(vbp))),
|
||||
(bits8_t *)(VB_TO_COOKIE(vbp)), 0,
|
||||
vbp->vb_ml.ml_leaf->expected_tag);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* 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: gas_ui64.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:11 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:38 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:52 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:25 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:11:59 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:40 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:18:41 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:47 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:16 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:01 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:49:53 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 6.0 1995/05/31 21:50:34 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.1 1995/03/08 23:08:05 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1conf.h>
|
||||
#include <wrn/wm/snmp/engine/ui64.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
|
||||
void
|
||||
get_ui64_async(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
/* Test the instance qualifier, we must have one subid with a value of 0 */
|
||||
if ((tcount != 1) || (*tlist != 0))
|
||||
getproc_nosuchins(pktp, vbp);
|
||||
else
|
||||
getproc_got_uint64(pktp, vbp, (UINT_64_T *)(VB_TO_COOKIE(vbp)));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* 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: gas_uint.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:11 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:38 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:52 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:26 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:11:59 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:41 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:18:43 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:47 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:17 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:01 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:49:54 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 6.0 1995/05/31 21:50:35 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.1 1995/03/08 23:08:05 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: gas_uint.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:11 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:38 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:52 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:26 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:11:59 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:41 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:18:43 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:47 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:17 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:01 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:49:54 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 6.0 1995/05/31 21:50:35 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.1 1995/03/08 23:08:05 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
/* Get the 32-bit unsigned integer referenced by cookie. */
|
||||
|
||||
void
|
||||
get_uint_async(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
/* Test the instance qualifier, we must have one subid
|
||||
with a value of 0 */
|
||||
if ((tcount != 1) || (*tlist != 0))
|
||||
getproc_nosuchins(pktp, vbp);
|
||||
else
|
||||
getproc_got_uint32(pktp, vbp, *(UINT_32_T *)(VB_TO_COOKIE(vbp)),
|
||||
vbp->vb_ml.ml_leaf->expected_tag);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* 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: gas_ulng.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:12 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:52 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:26 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:11:59 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:41 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:18:44 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:47 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:18 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:01 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:49:55 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 6.0 1995/05/31 21:50:36 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.1 1995/03/08 23:08:05 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
/* Get the 32-but unsigned integer referenced by cookie. This is
|
||||
* identical to get_uint() but up to version 2.0, the MIB compiler
|
||||
* generated get_ulong() instead. */
|
||||
void
|
||||
get_ulong_async(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
/* Test the instance qualifier, we must have one subid
|
||||
with a value of 0 */
|
||||
if ((tcount != 1) || (*tlist != 0))
|
||||
getproc_nosuchins(pktp, vbp);
|
||||
else
|
||||
getproc_got_uint32(pktp, vbp, *(UINT_32_T *)(VB_TO_COOKIE(vbp)),
|
||||
vbp->vb_ml.ml_leaf->expected_tag);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* 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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: get_int.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:12 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:52 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:27 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:00 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:42 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:48 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:20 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:02 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:49:56 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:41 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.0 1992/04/03 19:53:01 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 1.2 91/10/30 20:38:27 dab
|
||||
* Directly include asn1conf.h and snmpdefs.h.
|
||||
*
|
||||
* Revision 1.1 91/10/24 11:06:23 dab
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
/* Get the 32-bit integer referenced by cookie. */
|
||||
INT_32_T
|
||||
get_int(OIDC_T lastmatch, /* Last component matched */
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
char *cookie,
|
||||
SNMP_PKT_T *pktp)
|
||||
{
|
||||
return *((INT_32_T *)cookie);
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: get_ip.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:12 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:53 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:27 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:00 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:44 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:48 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:21 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:02 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:49:57 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:42 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.0 1992/04/03 19:53:01 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 1.3 92/02/24 10:59:05 dab
|
||||
* Added addr argument.
|
||||
*
|
||||
* Revision 1.2 91/10/30 20:38:28 dab
|
||||
* Directly include asn1conf.h and snmpdefs.h.
|
||||
*
|
||||
* Revision 1.1 91/10/24 11:06:40 dab
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
/* Return the address of an IP address referenced by cookie. */
|
||||
unsigned char *
|
||||
get_ip_address(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
char *cookie,
|
||||
SNMP_PKT_T *pktp,
|
||||
UINT_32_T *addr)
|
||||
{
|
||||
return (unsigned char *)cookie;
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* 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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: get_oid.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:12 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:53 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:28 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:01 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:46 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:49 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:22 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:03 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:49:58 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:43 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.0 1992/04/03 19:53:01 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 1.3 92/02/24 10:58:56 dab
|
||||
* Added dynamic argument.
|
||||
*
|
||||
* Revision 1.2 91/10/30 20:38:30 dab
|
||||
* Directly include asn1conf.h and snmpdefs.h.
|
||||
*
|
||||
* Revision 1.1 91/10/24 11:06:59 dab
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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/auxfuncs.h>
|
||||
|
||||
/* Return the address of an Object ID refenced by cookie. If this routine
|
||||
* sets *dynamic to 1 then the storage for OBJ_ID_T and its component list
|
||||
* will be freed by SNMP_memory_free() soon after this routine returns. */
|
||||
OBJ_ID_T *
|
||||
get_object_identifier(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
char *cookie,
|
||||
SNMP_PKT_T *pktp,
|
||||
int *dynamic)
|
||||
{
|
||||
return (OBJ_ID_T *)cookie;
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* 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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: get_str.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:12 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:53 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:28 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:01 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:48 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:49 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:24 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:03 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:49:59 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:43 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.1 1993/03/01 17:15:26 dab
|
||||
* Removed strlen() declaration. This should be supplied by the system.
|
||||
*
|
||||
* Revision 3.0 1992/04/03 19:53:01 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 1.4 92/02/05 18:47:30 dab
|
||||
* Moved declaration of strlen() to outside of the function. MSC
|
||||
* couldn't deal.
|
||||
*
|
||||
* Revision 1.2 91/10/30 20:38:31 dab
|
||||
* Directly include asn1conf.h and snmpdefs.h.
|
||||
*
|
||||
* Revision 1.1 91/10/24 11:07:14 dab
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
/* Return a C string referenced by cookie. The address returned
|
||||
* *MUST* reference a static location.
|
||||
*/
|
||||
unsigned char *
|
||||
get_string(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
char *cookie,
|
||||
int *lengthp,
|
||||
SNMP_PKT_T *pktp,
|
||||
int *dynamic)
|
||||
{
|
||||
*lengthp = (int)strlen(cookie);
|
||||
return (unsigned char *)cookie;
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* 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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: get_ui64.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:13 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:53 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:29 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:02 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:49 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:49 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:26 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:04 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:00 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:43 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.1 1994/04/15 21:37:38 sar
|
||||
* Added the dynamic flag to get_ui64.
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 1.1 1993/06/07 18:23:16 sar
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1conf.h>
|
||||
#include <wrn/wm/snmp/engine/ui64.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
|
||||
/* Get the 64-bit unsigned integer referenced by cookie. */
|
||||
UINT_64_T *
|
||||
get_ui64(OIDC_T lastmatch, /* Last component matched */
|
||||
int tcount,
|
||||
OIDC_T * tlist,
|
||||
char * cookie,
|
||||
SNMP_PKT_T * pktp,
|
||||
int * dynamic)
|
||||
{
|
||||
return ((UINT_64_T *)cookie);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* 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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: get_uint.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:13 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:53 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:29 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:02 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:51 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:50 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:28 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:04 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:01 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:44 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.0 1992/04/03 19:53:01 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 1.2 91/10/30 20:38:32 dab
|
||||
* Directly include asn1conf.h and snmpdefs.h.
|
||||
*
|
||||
* Revision 1.1 91/10/24 11:07:33 dab
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
/* Get the 32-but unsigned integer referenced by cookie. */
|
||||
UINT_32_T
|
||||
get_uint(OIDC_T lastmatch, /* Last component matched */
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
char *cookie,
|
||||
SNMP_PKT_T *pktp)
|
||||
{
|
||||
return *((UINT_32_T *)cookie);
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: get_ulng.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:13 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:54 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:29 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:02 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:53 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:50 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:29 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:04 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:02 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:44 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 1.1 1993/04/22 17:52:43 dab
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
/* Get the 32-but unsigned integer referenced by cookie. This is
|
||||
* identical to get_uint() but up to version 2.0, the MIB compiler
|
||||
* generated get_ulong() instead. */
|
||||
UINT_32_T
|
||||
get_ulong(OIDC_T lastmatch, /* Last component matched */
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
char *cookie,
|
||||
SNMP_PKT_T *pktp)
|
||||
{
|
||||
return *((UINT_32_T *)cookie);
|
||||
}
|
||||
@@ -0,0 +1,485 @@
|
||||
/*
|
||||
* 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: getpdu.c,v $
|
||||
* Revision 1.4 2003/01/15 14:05:04 josh
|
||||
* directory structure shifting
|
||||
*
|
||||
* Revision 1.3 2001/11/06 21:50:47 josh
|
||||
* second (and hopefully final) pass of new path hacking
|
||||
*
|
||||
* Revision 1.2 2001/11/06 21:20:13 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2.4.1 2001/08/07 21:53:31 meister
|
||||
* reworked to use dynamic component configuration macros, to allow
|
||||
* separate vxworks agentx components
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:22:21 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:19:06 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:30 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.7 1998/06/16 05:25:00 sar
|
||||
* clean up some type stuff, some calls to send error
|
||||
*
|
||||
* Revision 8.6 1998/06/08 22:05:25 sar
|
||||
* Tidied up some v3 error returns, notably authorization error
|
||||
*
|
||||
* Revision 8.5 1998/06/05 18:53:13 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.4 1998/05/29 04:31:14 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:30 sra
|
||||
* Finish moving types.h, bug.h, and bugdef.h to common/h/.
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:50 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:49 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.4 1997/10/22 03:10:21 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:45:53 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:48:56 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/11/01 00:46:48 sar
|
||||
* Added a default option in the version case statement to allow
|
||||
* new versions such as usec to be added without touching getpdu
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:47:24 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.3 1995/03/21 00:25:01 sar
|
||||
* Basically rewritten to use the new async apis.
|
||||
*
|
||||
* Revision 5.2 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.1 1994/06/17 21:00:45 sar
|
||||
* After we are done with the incoming error-status and error_index
|
||||
* set them to 0 so we can use it for error replies from gets.
|
||||
*
|
||||
* 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/12 17:16:29 sar
|
||||
* in call_the_get_routine, for get routines that return pointers check
|
||||
* to see if the pointer is 0 in which case we zero the object value.
|
||||
*
|
||||
* Revision 4.5 1994/05/04 22:45:43 sar
|
||||
* Added code to allow a failure during the getproc. This shouldn't be
|
||||
* used in general.
|
||||
*
|
||||
* Revision 4.4 1994/04/29 21:19:45 sar
|
||||
* Added some ifdefs for the sub agent scheme which required moving some
|
||||
* code around, modified the call to find_object_node and get_ui64.
|
||||
*
|
||||
* Revision 4.3 1994/01/25 20:46:16 sar
|
||||
* SNMPv2 requires a too big error return to have the var binds removed
|
||||
* we were not doing this.
|
||||
*
|
||||
* Revision 4.2 1993/11/11 22:00:51 sar
|
||||
* Increment the no such name counter when generating a no such error
|
||||
* the testproc failed.
|
||||
*
|
||||
* Revision 4.1 1993/09/30 20:28:23 sar
|
||||
* Added some size testing at the start of the routine to catch packets taht
|
||||
* will be too large for get bulk and silent drop them, also modified get
|
||||
* bulk to return no var bind packets if size so dictates. Modified the
|
||||
* code to decide the non repeaters and max reps in the face of different
|
||||
* word sizes and such.
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:45:46 sar
|
||||
* Updated revision to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.18 1993/06/17 23:33:44 sar
|
||||
* removed the ENVOY_ from the UI64 routines.
|
||||
*
|
||||
* Revision 3.17 1993/06/07 18:26:04 sar
|
||||
* Modified call to get a 64 bit unsigned int.
|
||||
*
|
||||
* Revision 3.16 1993/06/02 23:09:24 dab
|
||||
* Changed #ifdef's to #if's for things from install.h
|
||||
*
|
||||
* Revision 3.15 1993/05/24 20:38:20 sar
|
||||
* Moved the use of vblp to be inside the ifdef v2 areas so we won't
|
||||
* get any compiler warnings about not using it.
|
||||
*
|
||||
* Revision 3.14 1993/05/19 20:25:22 sar
|
||||
* Tidied up types to make compilers happy (mostly int to ALENGTH_T).
|
||||
*
|
||||
* Revision 3.13 1993/05/14 19:02:36 sar
|
||||
* Mad maxreps and reps int_32_T and nonreps a size_t to avoid compileer
|
||||
* warnings.
|
||||
*
|
||||
* Revision 3.12 1993/05/03 17:16:12 sar
|
||||
* Added routines for local time, removed {party context} oids from packet
|
||||
* structure, added asn1len to {party context} structures and
|
||||
* SNMP_{Party Context}_Name where needed to lookup the name for a given
|
||||
* {Party Context}.
|
||||
*
|
||||
* Revision 3.11 1993/04/28 22:02:29 sar
|
||||
* moved the def of UINT_64_T and added some new types to the routines.
|
||||
*
|
||||
* Revision 3.10 1993/04/23 23:31:53 sar
|
||||
* In getbulk processing added check to see if all of the varbinds are at end of
|
||||
* mib.
|
||||
*
|
||||
* Revision 3.9 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.8 1993/04/20 19:54:59 sar
|
||||
* Added code to handle adding new auth and priv routines, and cleaned up
|
||||
* the party set code and a padding argument in the priv structure.
|
||||
*
|
||||
* Revision 3.7 1993/04/19 18:28:34 sar
|
||||
* cleanup, mostly some correcting some non-ansi misspellings and adding
|
||||
* static defs.
|
||||
*
|
||||
* Revision 3.6 1993/03/24 01:01:40 sar
|
||||
* added a check on the non repeaters to make sure that we don't go off the
|
||||
* end of the vb list if non repeaters > count of var binds.
|
||||
*
|
||||
* Revision 3.5 1993/03/05 03:58:02 dab
|
||||
* fixed up types
|
||||
*
|
||||
* Revision 3.4 1993/03/01 20:52:16 sar
|
||||
* moved some definitions to allow clean version 1 compiles.
|
||||
*
|
||||
* Revision 3.3 1993/03/01 17:13:33 dab
|
||||
* Changed varialbe named index so it doesn't shadow index() routine
|
||||
* that some systems have.
|
||||
*
|
||||
* Revision 3.2 1993/02/24 01:02:41 sar
|
||||
* Changed many call to use OIDC_T/lenght pairs instead of OBJ_ID_T as now
|
||||
* we don't need to specifically allocate the OBJ_ID_T.
|
||||
* Removed the name objid from the PARTYLEAF_T as the name may be determined from
|
||||
* the tree itself. For efficiency purposes put the dest/src party names into
|
||||
* the pkt so we don't have to look them up frequently.
|
||||
*
|
||||
* Revision 3.1 1993/02/17 21:02:56 sar
|
||||
* Update stat keeping for v1 and v2 (or both or neither).
|
||||
* Added build_error_packet which create an error packet and does some
|
||||
* v2 size checking.
|
||||
* Updated Process_SNMP_GetClass_Pdu to handle the getbulk case.
|
||||
* (The other cases are treated as special cases of the getbulk case.)
|
||||
* Added VT_UINTEGER32 value case to the get area.
|
||||
*
|
||||
* Revision 3.0 92/04/03 19:52:37 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 2.108 92/02/24 11:11:51 dab
|
||||
* Don't do an extra copy on dynamic returns from get_oid.
|
||||
*
|
||||
* Revision 2.107 92/02/24 10:57:37 dab
|
||||
* In call_the_get_function, added the dynamic argument to get_oid and
|
||||
* the addr argument to get_ip_address.
|
||||
*
|
||||
* Revision 2.106 92/01/30 14:02:43 dab
|
||||
* Fixed up calls to getprocs so they had the proper procedure prototypes
|
||||
* including parameters for those compilers that care.
|
||||
*
|
||||
* Revision 2.105 91/10/30 20:41:59 dab
|
||||
* Directly include asn1conf.h, snmpdefs.h, and snmpstat.h (if needed).
|
||||
*
|
||||
* Revision 2.104 91/09/20 11:17:09 dab
|
||||
* Added static argument to getproc calls for strings.
|
||||
*
|
||||
* Revision 2.103 91/08/15 12:31:01 dab
|
||||
* Removed <libfuncs.h>.
|
||||
*
|
||||
* Revision 2.102 91/08/14 10:46:53 dab
|
||||
* Added trace functions that Karl put in as macros.
|
||||
*
|
||||
* Revision 2.101 91/08/12 12:47:38 dab
|
||||
* Cast arguments to memcpy() and memset() to PTR_T.
|
||||
*
|
||||
* Revision 2.100 91/08/09 14:08:21 dab
|
||||
* Update version.
|
||||
*
|
||||
* Revision 1.1 91/07/30 02:23:43 romkey
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
* Rev 2.0 31 Mar 1990 15:06:34
|
||||
* Release 2.00
|
||||
*
|
||||
* Rev 1.9 27 Apr 1989 15:56:24
|
||||
* Removed unused variables
|
||||
*
|
||||
* Rev 1.8 19 Mar 1989 12:28:28
|
||||
* A call to memcpy was being made when the correct routine was memset.
|
||||
* This resulted in a copy of 4 bytes from address zero. This occurred
|
||||
* when an attempt to get an IP address failed.
|
||||
*
|
||||
* Rev 1.7 17 Mar 1989 21:41:38
|
||||
* Calls to memcpy/memset protected against zero lengths
|
||||
*
|
||||
* Rev 1.6 19 Sep 1988 17:26:06
|
||||
* Made changes to make the Sun C compiler happy.
|
||||
*
|
||||
* Rev 1.5 19 Sep 1988 9:24:02
|
||||
* Reversed change made in revision 1.2
|
||||
*
|
||||
* Rev 1.4 15 Sep 1988 21:35:40
|
||||
* On the previous update, not all of the get procedures had the necessary
|
||||
* casts added. This update fixes that.
|
||||
*
|
||||
* Rev 1.3 15 Sep 1988 21:22:06
|
||||
* Added casts to calls to the getproc to avoid improper type conversions
|
||||
* when "int" and pointers are of different sizes.
|
||||
*
|
||||
* Rev 1.2 15 Sep 1988 20:03:50
|
||||
* Recalculated size of outgoing packet before transmission.
|
||||
*
|
||||
* Rev 1.1 14 Sep 1988 17:57:06
|
||||
* Moved includes of system include files into libfuncs.h.
|
||||
*
|
||||
* Rev 1.0 12 Sep 1988 10:46:58
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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/objectid.h>
|
||||
#include <wrn/wm/snmp/engine/view.h>
|
||||
|
||||
#include <wrn/wm/common/bug.h>
|
||||
|
||||
#include <wrn/wm/common/dyncfg.h>
|
||||
DYNCFG_VBL_DECLARE_EXTERN(agentx_master_component)
|
||||
DYNCFG_VBL_DECLARE_EXTERN(agentx_subagent_component)
|
||||
|
||||
/****************************************************************************
|
||||
NAME: SNMP_Process_Get_PDU
|
||||
|
||||
PURPOSE: Process a get 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
|
||||
event. For v1 this means an error, for v2 an exception. After
|
||||
we have found all the objects we call the getproc routines to
|
||||
find the value for each var bind.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * The decoded GET PDU
|
||||
|
||||
RETURNS: int 0 all of the gets have been started successfully
|
||||
1 error of some sort, any error packet has been sent.
|
||||
****************************************************************************/
|
||||
|
||||
int
|
||||
SNMP_Process_Get_PDU(SNMP_PKT_T *pktp)
|
||||
{
|
||||
VB_T *vbp, *newvbp, *oldvbp;
|
||||
int count, indx, eret;
|
||||
sbits32_t *err_stat;
|
||||
|
||||
/* get some initial information */
|
||||
if (((oldvbp = pktp->pdu.std_pdu.std_vbl.vblist) == 0) ||
|
||||
((count = pktp->pdu.std_pdu.std_vbl.vbl_count) == 0))
|
||||
return(0);
|
||||
|
||||
/* We will be looking at the error status a lot so we get a local pointer
|
||||
to it to make things easier */
|
||||
err_stat = &(pktp->pdu.std_pdu.error_status);
|
||||
|
||||
/* assume that everything will work */
|
||||
*err_stat = NO_ERROR;
|
||||
pktp->pdu.std_pdu.error_index = 0;
|
||||
|
||||
/* Copy the vb list so we can use the original list if we have an error */
|
||||
if ((newvbp = VarBindList_Allocate(count)) == 0) {
|
||||
ENVOY_Send_SNMP_Error_Packet(pktp, GEN_ERR, 0);
|
||||
return(1);
|
||||
}
|
||||
for(indx = count, vbp = newvbp; indx; indx--, oldvbp++, vbp++) {
|
||||
vbp->vb_data_flags_n_type = VT_EMPTY;
|
||||
if (clone_object_id(&oldvbp->vb_obj_id, &vbp->vb_obj_id))
|
||||
break;
|
||||
}
|
||||
if (indx != 0) {
|
||||
/* we had an error trying to clone an object id (probably couldn't
|
||||
get the space), clean up any vbs we modified and free the newvbp
|
||||
space */
|
||||
for(vbp = newvbp; indx < count; indx++, vbp++)
|
||||
Clean_vb(vbp);
|
||||
SNMP_memory_free(newvbp);
|
||||
ENVOY_Send_SNMP_Error_Packet(pktp, GEN_ERR, 0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* We have successfully copied the sections of the vblist we need
|
||||
move the old vblist to the saved area and install the new vblist
|
||||
into the current area */
|
||||
pktp->pdu.std_pdu.saved_vbl.vbl_count = count;
|
||||
pktp->pdu.std_pdu.saved_vbl.vblist = pktp->pdu.std_pdu.std_vbl.vblist;
|
||||
pktp->pdu.std_pdu.std_vbl.vblist = newvbp;
|
||||
|
||||
/* Attempt to find all the requested objects */
|
||||
|
||||
/* Try to get the infrastructure lock, we release it using
|
||||
the ENVOY_AX_MA_RELEASE_WRITE_LOCK macro */
|
||||
#if (INSTALL_ENVOY_AGENTX_MASTER && INSTALL_ENVOY_SNMP_LOCK)
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_infrastructure_lock)) {
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT, "SNMP_Process_Get_PDU: infrastructure lock broken", 0));
|
||||
ENVOY_Send_SNMP_Error_Packet(pktp, GEN_ERR, 0);
|
||||
return(1);
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
#endif
|
||||
|
||||
/* If necessary try to find the view index structure, if we want to do
|
||||
rfc1445 view checking find_object_node will expect this routine
|
||||
to have been run and to have inserted a pointer into pktp */
|
||||
#if (INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS)
|
||||
if (SNMP_View_Find_Family(pktp) && (pktp->snmp_version == SNMP_VERSION_3)) {
|
||||
ENVOY_AX_MA_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);
|
||||
ENVOY_Send_SNMP_Error_Packet(pktp, AUTHORIZATION_ERROR, 0);
|
||||
return(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
for(indx = 0, vbp = newvbp; indx < count; indx++, vbp++) {
|
||||
eret = find_object_node(vbp, pktp, 1);
|
||||
|
||||
#if (INSTALL_ENVOY_AGENTX_MASTER)
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
if (eret == -3) {
|
||||
ENVOY_AX_MA_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);
|
||||
ENVOY_Send_SNMP_Error_Packet(pktp, GEN_ERR, 0);
|
||||
return(1);
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
#endif
|
||||
|
||||
if ((eret != 0) ||
|
||||
((vbp->vb_ml.ml_flags & ML_IS_LEAF) == 0) ||
|
||||
(((vbp->vb_ml.ml_leaf)->access_type & READ_ACCESS) == 0)) {
|
||||
switch(pktp->snmp_version) {
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
case SNMP_VERSION_1:
|
||||
ENVOY_AX_MA_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);
|
||||
/* If version 1 we send a NO_SUCH_NAME error back.
|
||||
We set up the packet for a nosuch name error,
|
||||
then attempt to send it */
|
||||
ENVOY_Send_SNMP_Error_Packet(pktp, NO_SUCH_NAME,
|
||||
(sbits32_t)(SNMP_ERROR_INDEX(indx)));
|
||||
return(1);
|
||||
#endif /* INSTALL_ENVOY_SNMP_VERSION_2 */
|
||||
|
||||
#if ENVOY_USE_V2_PROTOS
|
||||
case SNMP_VERSION_2:
|
||||
case SNMP_VERSION_3:
|
||||
default:
|
||||
/* If not version 1 we send a NO_SUCH_OBJECT exception back.
|
||||
We set the data_flags_n_type of the current vbp to
|
||||
NO_SUCH_OBJECT, tag the vbp as having been done
|
||||
and continue with the rest */
|
||||
vbp->vb_data_flags_n_type = VT_NOSUCHOBJ;
|
||||
vbp->vb_flags |= VFLAG_GET_STARTED | VFLAG_GET_DONE;
|
||||
break;
|
||||
#endif /* #if ENVOY_USE_V2_PROTOS */
|
||||
}
|
||||
} /* if ((find_object...) */
|
||||
} /* for(indx = 0...) */
|
||||
ENVOY_AX_MA_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);
|
||||
|
||||
/* Now we loop through the vblist again and start all the gets */
|
||||
for(vbp = newvbp; count; count--, vbp++) {
|
||||
/* If the get started flag is set then either we set it above or
|
||||
the getproc of some other var bind has claimed responsibility for
|
||||
this var bind. In either case we skip this var bind and continue */
|
||||
if (vbp->vb_flags & (VFLAG_GET_STARTED | VFLAG_GET_DONE))
|
||||
continue;
|
||||
((vbp->vb_ml.ml_leaf)->getproc)
|
||||
(vbp->vb_ml.ml_last_match, vbp->vb_ml.ml_remaining_objid.num_components,
|
||||
vbp->vb_ml.ml_remaining_objid.component_list, pktp, vbp);
|
||||
vbp->vb_flags |= VFLAG_GET_STARTED;
|
||||
|
||||
/* test the error code, if we had an error then mark any remaining
|
||||
vbs as having been gotten (so we won't trip over them later).
|
||||
We need to skip the first vb as that is the one that
|
||||
caused the failure. Then break because we are done */
|
||||
if (*err_stat) {
|
||||
for (vbp++, count--; count; count--, vbp++)
|
||||
if (!(vbp->vb_flags & VFLAG_GET_STARTED))
|
||||
vbp->vb_flags |= VFLAG_GET_STARTED | VFLAG_GET_DONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*lint +e715 */
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* 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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: indx_vbp.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:13 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:21:54 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:17:30 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:56 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:50 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:30 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:05 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:04 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:45 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.2 1993/06/02 23:07:24 dab
|
||||
* Changed #ifdef's to #if's for things from install.h
|
||||
*
|
||||
* Revision 3.1 1993/04/26 20:22:55 sar
|
||||
* Added ifdefs to allow clean version 1 or version 2 makes.
|
||||
*
|
||||
* Revision 3.0 1992/04/03 19:53:01 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 1.2 91/10/30 20:38:33 dab
|
||||
* Directly include asn1conf.h and snmpdefs.h.
|
||||
*
|
||||
* Revision 1.1 91/10/24 11:07:51 dab
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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/auxfuncs.h>
|
||||
|
||||
/****************************************************************************
|
||||
NAME: index_to_vbp
|
||||
|
||||
PURPOSE: Given a packet structure and the zero-based index of a varBind
|
||||
element in that packet, return a pointer to that VB_T
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * The whole packet.
|
||||
int The index of the VB_T desired.
|
||||
(0 is the index of the first VB_T).
|
||||
|
||||
RETURNS: VB_T * The address of the desired varBind element
|
||||
(VB_T *)0 returned if out of range.
|
||||
****************************************************************************/
|
||||
VB_T *
|
||||
index_to_vbp(SNMP_PKT_T *pktp,
|
||||
int vb_index)
|
||||
{
|
||||
VBL_T *vblp;
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
if (pktp->pdu_type == TRAP_PDU)
|
||||
vblp = &(pktp->pdu.trap_pdu.trap_vbl);
|
||||
else
|
||||
#endif
|
||||
vblp = &(pktp->pdu.std_pdu.std_vbl);
|
||||
|
||||
if (vb_index < vblp->vbl_count)
|
||||
return &(vblp->vblist[vb_index]);
|
||||
else
|
||||
return(0);
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
/* ip2llist.c - ip2llist.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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: ip2llist.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:14 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:21:54 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:17:31 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:08:58 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:51 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:32 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:05 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:05 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:45 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.0 1992/04/03 19:53:01 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 1.5 92/03/26 10:53:18 dab
|
||||
* Fixed comment about this function being macro'd out if sizeof(long)
|
||||
* == sizeof(OIDC_T). The C compiler can't handle this. Sigh.
|
||||
*
|
||||
* Revision 1.4 92/01/30 13:59:22 dab
|
||||
* Fixed up some typos in the NO_PP parts.
|
||||
*
|
||||
* Revision 1.3 91/10/31 14:23:57 dab
|
||||
* llist argument should be signed longs.
|
||||
*
|
||||
* Revision 1.2 91/10/30 20:38:35 dab
|
||||
* Directly include asn1conf.h and snmpdefs.h.
|
||||
*
|
||||
* Revision 1.1 91/10/30 18:12:21 dab
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains ip2llist.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/localio.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/decode.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ip_to_llist - fill an object ID with the byte components of an IP address
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int ip_to_llist
|
||||
* (
|
||||
* UINT_32_T ip_address,
|
||||
* INT_32_T * long_list
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine fills an object ID with the byte components of an IP address.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <ip_address>
|
||||
* Specify an IP address.
|
||||
* \i <*long_list>
|
||||
* Specify an object ID.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: This routine always returns the number of components (4).
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: ip_to_rlist(), oid_to_ip()
|
||||
*/
|
||||
int
|
||||
ip_to_llist(UINT_32_T ip,
|
||||
INT_32_T *llist)
|
||||
{
|
||||
union {
|
||||
UINT_32_T laddr;
|
||||
OCTET_T baddr[4];
|
||||
} ip_address;
|
||||
int i;
|
||||
|
||||
ip_address.laddr = ip;
|
||||
for (i = 0; i < 4; i++)
|
||||
*llist++ = ip_address.baddr[i];
|
||||
return 4;
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
/* ip2rlist.c - ip2rlist.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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: ip2rlist.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:14 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:21:54 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:17:32 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:00 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:51 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:33 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:06 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:06 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:46 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.0 1992/04/03 19:53:01 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 1.2 91/10/30 20:38:36 dab
|
||||
* Directly include asn1conf.h and snmpdefs.h.
|
||||
*
|
||||
* Revision 1.1 91/10/30 18:11:59 dab
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains ip2rlist.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/localio.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/decode.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ip_to_rlist - fill an array of longs with the byte components of an IP address
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int ip_to_rlist
|
||||
* (
|
||||
* UINT_32_T ip_address,
|
||||
* OIDC_T * object_id
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine fills an array of longs with the byte components of an IP
|
||||
* address.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <ip_address>
|
||||
* Specify an IP address.
|
||||
* \i <*object_id>
|
||||
* Specify an object ID.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: This routine always returns the number of components (4).
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: ip_to_llist(), oid_to_ip()
|
||||
*/
|
||||
int
|
||||
ip_to_rlist(UINT_32_T ip,
|
||||
OIDC_T *rlist)
|
||||
{
|
||||
union {
|
||||
UINT_32_T laddr;
|
||||
OCTET_T baddr[4];
|
||||
} ip_address;
|
||||
int i;
|
||||
|
||||
ip_address.laddr = ip;
|
||||
for (i = 0; i < 4; i++)
|
||||
*rlist++ = ip_address.baddr[i];
|
||||
return 4;
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
/* llistcmp.c - llistcmp.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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: llistcmp.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:14 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:21:54 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:17:35 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:02 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:51 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:37 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:06 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:07 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:46 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.0 1992/04/03 19:53:01 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 1.2 92/01/30 13:59:53 dab
|
||||
* Fixed a typo in the NO_PP part.
|
||||
*
|
||||
* Revision 1.1 91/10/31 13:17:50 dab
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains llistcmp.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/localio.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/decode.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* llist_cmp - compare two lists of longs
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int llist_cmp
|
||||
* (
|
||||
* INT_32_T * list1,
|
||||
* INT_32_T * list2,
|
||||
* int length
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine compares two lists of longs.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <list1>
|
||||
* Specify the first list.
|
||||
* \i <list2>
|
||||
* Specify the second list.
|
||||
* \i <length>
|
||||
* Specify the length of the list.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If <list1> is greater than <list2>, this routine returns 1. If
|
||||
* <list1> is less than <list2>, it returns -1. If they are the same, it returns
|
||||
* 0.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: oidcmp(), oidcmp2(), oidorder()
|
||||
*/
|
||||
int
|
||||
llist_cmp(INT_32_T *idp1,
|
||||
INT_32_T *idp2,
|
||||
int n)
|
||||
{
|
||||
INT_32_T i;
|
||||
|
||||
while (n-- > 0) {
|
||||
i = *idp1++ - *idp2++;
|
||||
if (i)
|
||||
return (i < 0) ? -1 : 1;
|
||||
}
|
||||
|
||||
return 0; /* OIDs are the same */
|
||||
}
|
||||
@@ -0,0 +1,393 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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 1986-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: localio.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:14 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:22:21 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:19:07 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:32 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.5 1998/09/04 14:15:44 sar
|
||||
* Clean up the return values for lcl_resize, we were trying to return
|
||||
* a -1 for an error. As we weren't using the return values we now
|
||||
* return a 0 for succes and 1 for error.
|
||||
*
|
||||
* Revision 8.4 1998/06/22 03:11:14 sar
|
||||
* Changed the type used for lengths in localio. We now use ALENGTH_Ts
|
||||
* to make it match the rest of the code and keep compilers happy
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:13:52 sar
|
||||
* make sure all files include asn1conf.h and snmp.h to pick up all of
|
||||
* the common code
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:53:13 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:53 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:50 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.3 1997/03/20 06:48:58 sra
|
||||
* DFARS-safe copyright text. Zap!
|
||||
*
|
||||
* Revision 7.2 1997/02/25 10:49:26 sra
|
||||
* Update copyright notice, dust under the bed.
|
||||
*
|
||||
* Revision 7.1 1997/01/16 20:46:52 sar
|
||||
* changed uchar to bits8_t
|
||||
*
|
||||
* 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:26 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.1 1993/08/04 19:13:11 sra
|
||||
* Add a cast to make Borland C++ 3.1 happier.
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:45:46 sar
|
||||
* Updated revision to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.3 1993/05/14 19:02:36 sar
|
||||
* made oldval in lcl_resize a size_t and cast it to an int for return
|
||||
* to avoid compiler warnings.
|
||||
*
|
||||
* Revision 3.2 1993/03/06 21:55:24 dab
|
||||
* Lcl_Dup() shouldn't assume that newfile is initialized even it
|
||||
* if it's non-zero.
|
||||
*
|
||||
* Revision 3.1 1993/02/17 21:04:43 sar
|
||||
* Removed #define then and uses of it.
|
||||
* Added Lcl_Dup - duplicate an i/o stream.
|
||||
*
|
||||
* Revision 3.0 92/04/03 19:52:37 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 2.102 91/09/18 12:32:21 dab
|
||||
* Updated to use new macros from <asn1conf.h> and <snmpconf.h>.
|
||||
*
|
||||
* Revision 2.101 91/08/15 12:31:02 dab
|
||||
* Removed <libfuncs.h>.
|
||||
*
|
||||
* Revision 2.100 91/08/09 14:08:22 dab
|
||||
* Update version.
|
||||
*
|
||||
* Revision 1.1 91/07/30 02:23:44 romkey
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
* Rev 2.0 31 Mar 1990 15:06:48
|
||||
* Release 2.00
|
||||
*
|
||||
* Rev 1.4 27 Apr 1989 15:56:38
|
||||
* Removed unused variables
|
||||
*
|
||||
* Rev 1.3 12 Apr 1989 12:02:10
|
||||
* Added cast on SNMP_mem_alloc.
|
||||
*
|
||||
* Rev 1.2 23 Mar 1989 11:22:02
|
||||
* Revised Lcl_Open to return a null pointer if it can't obtain dynamic
|
||||
* memory for a local file descriptor.
|
||||
*
|
||||
* Rev 1.1 14 Sep 1988 17:57:10
|
||||
* Moved includes of system include files into libfuncs.h.
|
||||
*
|
||||
* Rev 1.0 12 Sep 1988 10:47:00
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,10jun10,y_t update for LP64
|
||||
01c,12may05,job fix apigen comments
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1conf.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/localio.h>
|
||||
|
||||
/****************************************************************************
|
||||
Local I/O package -- performs I/O like operations on data in a buffer.
|
||||
|
||||
Caveat: This version supports only input operations.
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
Lcl_Open -- Open a buffer for use as a local I/O stream
|
||||
|
||||
PARAMETERS
|
||||
LCL_FILE * lfile
|
||||
bits8_t * buffer
|
||||
ALENGTH_T nbytes
|
||||
|
||||
If lfile == (LCL_FILE *)0 a local file descriptor will be allocated.
|
||||
|
||||
Returns: (LCL_FILE *) if sucessful, (LCL_FILE *)0 if unsucessful.
|
||||
****************************************************************************/
|
||||
LCL_FILE *
|
||||
Lcl_Open(register LCL_FILE *lfile,
|
||||
bits8_t *buff,
|
||||
ALENGTH_T nbytes)
|
||||
{
|
||||
if (lfile == 0) {
|
||||
if ((lfile = (LCL_FILE *)SNMP_memory_alloc(sizeof(LCL_FILE))) == 0)
|
||||
return 0;
|
||||
else
|
||||
lfile->lcl_flags = LCL_MALLOC;
|
||||
}
|
||||
else
|
||||
lfile->lcl_flags = 0;
|
||||
|
||||
lfile->lbuf_start = buff;
|
||||
lfile->lbuf_next = buff;
|
||||
lfile->lbuf_end = (bits8_t *)(buff + nbytes);
|
||||
return (lfile);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Lcl_Close -- Close a local file descriptor
|
||||
|
||||
PARAMETERS
|
||||
LCL_FILE * lfile
|
||||
|
||||
Returns: nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
Lcl_Close(register LCL_FILE *lfile)
|
||||
{
|
||||
if (lfile->lcl_flags & LCL_MALLOC) SNMP_memory_free((char *)lfile);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Lcl_Getc -- Read a character from a local I/O stream
|
||||
|
||||
PARAMETERS
|
||||
LCL_FILE * lfile
|
||||
|
||||
Returns: If sucessful: the character read, but in integer format
|
||||
If unsucessful: -1
|
||||
****************************************************************************/
|
||||
#if !defined(GETC_MACRO)
|
||||
int
|
||||
Lcl_Getc(register LCL_FILE *lfile)
|
||||
{
|
||||
if (lfile->lcl_flags & LCL_EOF) return -1;
|
||||
if (lfile->lbuf_next < lfile->lbuf_end)
|
||||
return (*(lfile->lbuf_next++));
|
||||
else {
|
||||
lfile->lcl_flags |= LCL_EOF;
|
||||
return -1;
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
#endif /* GETC_MACRO */
|
||||
|
||||
/****************************************************************************
|
||||
Lcl_Peekc -- Peek at a character from a local I/O stream, the seek pointer
|
||||
is not advanced.
|
||||
|
||||
PARAMETERS
|
||||
LCL_FILE * lfile
|
||||
|
||||
Returns: If sucessful: the character read, but in integer format
|
||||
If unsucessful: -1
|
||||
****************************************************************************/
|
||||
int
|
||||
Lcl_Peekc(register LCL_FILE *lfile)
|
||||
{
|
||||
if (lfile->lcl_flags & LCL_EOF)
|
||||
return -1;
|
||||
if (lfile->lbuf_next < lfile->lbuf_end)
|
||||
return (*(lfile->lbuf_next));
|
||||
else {
|
||||
lfile->lcl_flags |= LCL_EOF;
|
||||
return -1;
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Lcl_Read -- Read a set of characters from a local I/O stream.
|
||||
|
||||
PARAMETERS
|
||||
LCL_FILE * lfile
|
||||
bits8_t * ubuf
|
||||
ALENGTH_T nbytes
|
||||
|
||||
Returns: The number of bytes actually read.
|
||||
****************************************************************************/
|
||||
ALENGTH_T
|
||||
Lcl_Read(LCL_FILE *lfile,
|
||||
bits8_t *ubuf,
|
||||
ALENGTH_T nbytes)
|
||||
{
|
||||
/* This is a quick implementation, to be replaced later */
|
||||
ALENGTH_T orig_nbytes = nbytes;
|
||||
bits8_t c;
|
||||
while (nbytes > 0)
|
||||
{
|
||||
c = (bits8_t)Lcl_Getc(lfile);
|
||||
if (Lcl_Eof(lfile)) break;
|
||||
*ubuf++ = c;
|
||||
--nbytes;
|
||||
}
|
||||
return (ALENGTH_T)(orig_nbytes - nbytes);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Lcl_Seek -- Move the seek pointer to a give position in the local I/O buffer.
|
||||
|
||||
PARAMETERS
|
||||
LCL_FILE * lfile
|
||||
ALENGTH_T offset
|
||||
int whence:
|
||||
0 to set pointer to offset bytes from the start
|
||||
1 to move pointer by offset bytes
|
||||
2 to set pointer to offset bytes from the end
|
||||
|
||||
Returns: 0 if sucessful, -1 if not.
|
||||
|
||||
Note: The "end" position is the byte AFTER the last one in the buffer
|
||||
containing data. Thus, a Lcl_Seek(.., 0, 2) will leave the caller at
|
||||
the end-of-file. The last byte is reached by Lcl_Seek(.., 1, 2).
|
||||
****************************************************************************/
|
||||
int
|
||||
Lcl_Seek(register LCL_FILE *lfile,
|
||||
ALENGTH_T offset,
|
||||
int whence)
|
||||
{
|
||||
register bits8_t *next;
|
||||
|
||||
switch (whence)
|
||||
{
|
||||
case 0:
|
||||
next = (bits8_t *)(lfile->lbuf_start + offset);
|
||||
break;
|
||||
case 1:
|
||||
next = (bits8_t *)(lfile->lbuf_next + offset);
|
||||
break;
|
||||
case 2:
|
||||
next = (bits8_t *)(lfile->lbuf_end - offset);
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((next < lfile->lbuf_start) || (next > lfile->lbuf_end)) return -1;
|
||||
|
||||
if (next < lfile->lbuf_end) lfile->lcl_flags = (bits8_t)(lfile->lcl_flags & ~LCL_EOF);
|
||||
lfile->lbuf_next = next;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Lcl_Resize -- Move the end-of-buffer position for the local I/O buffer.
|
||||
The buffer may be extended or contracted.
|
||||
|
||||
PARAMETERS
|
||||
LCL_FILE * lfile
|
||||
ALENGTH_T offset
|
||||
int whence:
|
||||
0 to set new end to offset bytes from the start
|
||||
1 to move new end by offset bytes from the current
|
||||
read/write position
|
||||
2 to set new end to offset bytes from the end
|
||||
|
||||
Returns: 0 indicates success, 1 indicates error
|
||||
****************************************************************************/
|
||||
ALENGTH_T
|
||||
Lcl_Resize(register LCL_FILE *lfile,
|
||||
ALENGTH_T offset,
|
||||
int whence)
|
||||
{
|
||||
switch (whence)
|
||||
{
|
||||
case 0:
|
||||
lfile->lbuf_end = (bits8_t *)(lfile->lbuf_start + offset);
|
||||
break;
|
||||
case 1:
|
||||
lfile->lbuf_end = (bits8_t *)(lfile->lbuf_next + offset);
|
||||
break;
|
||||
case 2:
|
||||
lfile->lbuf_end = (bits8_t *)(lfile->lbuf_end - offset);
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (lfile->lbuf_next < lfile->lbuf_end)
|
||||
lfile->lcl_flags = (bits8_t)(lfile->lcl_flags & ~LCL_EOF);
|
||||
else
|
||||
lfile->lcl_flags |= LCL_EOF;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Lcl_Dup -- Duplicate an I/O stream
|
||||
|
||||
PARAMETERS
|
||||
LCL_FILE * newfile
|
||||
LCL_FILE * oldfile
|
||||
|
||||
If newfile == (LCL_FILE *)0 a local file descriptor will be allocated.
|
||||
If newfile != 0, the structure is assumed to be uninitialized and we mark
|
||||
the structure as not-malloc'd.
|
||||
|
||||
Returns: (LCL_FILE *) if sucessful, (LCL_FILE *)0 if unsucessful.
|
||||
****************************************************************************/
|
||||
LCL_FILE *
|
||||
Lcl_Dup(register LCL_FILE *newfile,
|
||||
register LCL_FILE *oldfile)
|
||||
{
|
||||
if (newfile == 0) {
|
||||
if ((newfile = (LCL_FILE *)SNMP_memory_alloc(sizeof(LCL_FILE))) == 0)
|
||||
return 0;
|
||||
else
|
||||
newfile->lcl_flags = LCL_MALLOC | oldfile->lcl_flags;
|
||||
}
|
||||
else
|
||||
newfile->lcl_flags = (bits8_t)(oldfile->lcl_flags & ~LCL_MALLOC);
|
||||
|
||||
newfile->lbuf_start = oldfile->lbuf_start;
|
||||
newfile->lbuf_next = oldfile->lbuf_next;
|
||||
newfile->lbuf_end = oldfile->lbuf_end;
|
||||
return (newfile);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,340 @@
|
||||
/*
|
||||
* 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: mib_fon.c,v $
|
||||
* Revision 1.4 2003/01/15 14:05:05 josh
|
||||
* directory structure shifting
|
||||
*
|
||||
* Revision 1.3 2001/11/06 21:50:47 josh
|
||||
* second (and hopefully final) pass of new path hacking
|
||||
*
|
||||
* Revision 1.2 2001/11/06 21:20:15 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:42 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2.4.3 2001/10/19 20:30:07 josh
|
||||
* fixing the fix for the broken gcc compiler -- need to make the
|
||||
* correct comparison
|
||||
*
|
||||
* Revision 9.2.4.2 2001/10/18 21:26:28 josh
|
||||
* the gcc compiler that ships with TAE 1.1 for MIPS has a bug in it,
|
||||
* so we need to rework our code slightly to get around it.
|
||||
*
|
||||
* Revision 9.2.4.1 2001/08/07 21:53:32 meister
|
||||
* reworked to use dynamic component configuration macros, to allow
|
||||
* separate vxworks agentx components
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:22:22 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:19:08 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:40 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/05 18:53:14 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.2 1998/05/24 04:47:17 sar
|
||||
* Change the ifdef code to depend on DYNAMIC_VIEWS instead of RFC1445_VIEWS.
|
||||
* also modified the view_check call to use view_family_check this means
|
||||
* the routine that called the mib routines must also have set up the
|
||||
* view family.
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:51:58 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:51 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 1.2 1997/10/22 03:10:21 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 1.1 1997/10/16 00:35:06 sar
|
||||
* Result of the break up of the mibutils.c file. These were broken
|
||||
* out to allow for better granularity and smaller size for customers
|
||||
* that weren't using all of the functions in mibutils.c
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/* moved find_object_node here from mibutils.c (where most of the
|
||||
revision log is) to allow for better granularity of code. */
|
||||
|
||||
#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/objectid.h>
|
||||
#include <wrn/wm/snmp/engine/view.h>
|
||||
|
||||
#include <wrn/wm/common/dyncfg.h>
|
||||
DYNCFG_VBL_DECLARE_EXTERN(agentx_master_component)
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
NAME: find_object_node
|
||||
|
||||
PURPOSE: Locate a node in the MIB tree corresponding to a given object id.
|
||||
The search terminates sucessfully when all the object identifer
|
||||
components have been consumed or a leaf node is encountered.
|
||||
(One of the status flags in the MIBLOC_T structure indicates
|
||||
whether the search terminated at an inner node or a leaf.)
|
||||
|
||||
The search terminates unsucessfully (return code -1) if an
|
||||
object identifier component does not match those available at
|
||||
a given inner node.
|
||||
|
||||
PARAMETERS:
|
||||
OBJ_ID_T * Object ID to be used
|
||||
SNMP_PKT_T * The received packet
|
||||
int Do the view check (1) or not (0)
|
||||
|
||||
RETURNS: int Zero if node located
|
||||
vbp->vb_ml structure will be filled in with lots
|
||||
of information about the found object.
|
||||
-1 if nothing located (MIBLOC_T is not valid)
|
||||
-2 if we found something but it was outside
|
||||
of our view.
|
||||
-3 if we had a more general error
|
||||
****************************************************************************/
|
||||
int
|
||||
find_object_node(VB_T * vbp,
|
||||
SNMP_PKT_T * pktp,
|
||||
int check_flag)
|
||||
{
|
||||
OBJ_ID_T *objp;
|
||||
MIBLOC_T *mlp;
|
||||
MIBNODE_T *np;
|
||||
MIBARC_T *ap;
|
||||
OIDC_T *compp; /* Current object id component of interest */
|
||||
int comp_num; /* Index of current object id component */
|
||||
|
||||
#if (INSTALL_ENVOY_AGENTX_MASTER)
|
||||
MIBLEAF_T *ax_np = 0;
|
||||
OIDC_T ax_last_match = 0, *ax_compp = 0;
|
||||
int ax_comp_num = 0;
|
||||
#endif
|
||||
|
||||
objp = &(vbp->vb_obj_id);
|
||||
mlp = &(vbp->vb_ml);
|
||||
|
||||
/* The user can choose (at compile time) to use the old Epilogue
|
||||
view mask system, or to use the view scheme described in rfc1445.
|
||||
The user will be forced to choose the rfc1445 scheme if they choose
|
||||
to use the master agent code. */
|
||||
/* We can do the check here for this scheme because we only need the
|
||||
object id, in the old v1 scheme we need the actual node to examine
|
||||
the view masks so we have to wait until after the tree lookup. */
|
||||
|
||||
#if (INSTALL_ENVOY_MAIN_AGENT && INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS)
|
||||
if (check_flag) {
|
||||
if (SNMP_View_Family_Check(pktp, objp->component_list,
|
||||
objp->num_components,
|
||||
VIEW_CHECK_DET) == VIEW_EXCLUDED)
|
||||
return (-2);
|
||||
}
|
||||
#endif /* (INSTALL_ENVOY_MAIN_AGENT && INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS) */
|
||||
|
||||
/* find the proper root of the tree */
|
||||
if (pktp->mib_root)
|
||||
np = pktp->mib_root;
|
||||
else
|
||||
np = &(ENVOY_MIB_ROOT_NODE);
|
||||
|
||||
/* if agentx is installed see if the root node has a leaf, if so
|
||||
save some information about it */
|
||||
#if (INSTALL_ENVOY_AGENTX_MASTER)
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
if (np && ((np->node_type & NODE_TYPE) == INNER_NODE) && np->leaf) {
|
||||
ax_np = np->leaf;
|
||||
ax_last_match = 0;
|
||||
ax_comp_num = objp->num_components;
|
||||
ax_compp = objp->component_list;
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
#endif /* INSTALL_ENVOY_AGENTX_MASTER */
|
||||
|
||||
for(comp_num = objp->num_components, compp = objp->component_list;
|
||||
((np->node_type & NODE_TYPE) == INNER_NODE) && (comp_num > 0);
|
||||
comp_num--, compp++)
|
||||
{
|
||||
for(ap = np->arcs; (MIBNODE_T *)(ap->nodep) != 0; ap++) {
|
||||
if (ap->id == *compp)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((MIBNODE_T *)(ap->nodep) == 0) {
|
||||
/* If we fall through the arcs, then there is no terminating leaf,
|
||||
if agentx is installed we see if we have an interior leaf */
|
||||
#if (INSTALL_ENVOY_AGENTX_MASTER)
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
if (np->leaf) {
|
||||
/* adjust the leaf information */
|
||||
np = (MIBNODE_T *)np->leaf;
|
||||
break;
|
||||
}
|
||||
else if (ax_np) {
|
||||
/* adjust the leaf, comp num and last match information */
|
||||
np = (MIBNODE_T *)ax_np;
|
||||
mlp->ml_last_match = ax_last_match;
|
||||
comp_num = ax_comp_num;
|
||||
compp = ax_compp;
|
||||
break;
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
#endif /* INSTALL_ENVOY_AGENTX_MASTER */
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* if agentx is installed see if this inner node also has a leaf,
|
||||
if it does we save some information so we can get back to it
|
||||
later if necessary */
|
||||
#if (INSTALL_ENVOY_AGENTX_MASTER)
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
if (np->leaf) {
|
||||
ax_np = np->leaf;
|
||||
ax_last_match = *compp;
|
||||
ax_comp_num = comp_num - 1;
|
||||
ax_compp = compp + 1;
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
#endif /* INSTALL_ENVOY_AGENTX_MASTER */
|
||||
|
||||
/* Save the value of the matched arc so that later, when we call */
|
||||
/* the procs for the various objects we can tell them the last arc */
|
||||
/* matched. This will allow the routines which access tabular */
|
||||
/* objects to know which column (attribute) of the table is being */
|
||||
/* used. */
|
||||
|
||||
mlp->ml_last_match = *compp;
|
||||
np = (MIBNODE_T *)(ap->nodep);
|
||||
}
|
||||
|
||||
/* Here we have either run out of object identifiers or we have hit */
|
||||
/* a leaf node (in which case there may be zero or more identifers left.) */
|
||||
|
||||
/* If agentx is installed we may need to adjust the node that we
|
||||
are using. If the current node is an inner node we try to
|
||||
find a leaf, either from the current node or that we saved earlier.
|
||||
If the current node is an inactive leaf we check the saved information */
|
||||
|
||||
#if (INSTALL_ENVOY_AGENTX_MASTER)
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
if ((np->node_type & NODE_TYPE) == INNER_NODE) {
|
||||
if (np->leaf)
|
||||
np = (MIBNODE_T *)np->leaf;
|
||||
else if (ax_np) {
|
||||
/* adjust the leaf, comp num and last match information */
|
||||
np = (MIBNODE_T *)ax_np;
|
||||
mlp->ml_last_match = ax_last_match;
|
||||
comp_num = ax_comp_num;
|
||||
compp = ax_compp;
|
||||
}
|
||||
}
|
||||
|
||||
if (np->node_type & LEAF_INACTIVE) {
|
||||
/* if agentx is installed see if we have a saved leaf */
|
||||
if (ax_np) {
|
||||
/* adjust the leaf, comp num and last match information */
|
||||
np = (MIBNODE_T *)ax_np;
|
||||
mlp->ml_last_match = ax_last_match;
|
||||
comp_num = ax_comp_num;
|
||||
compp = ax_compp;
|
||||
}
|
||||
else
|
||||
return (-1);
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
|
||||
# if INSTALL_COMMON_DYNAMIC_COMP_CONFIG
|
||||
DYNCFG_IFNOTCFGVBL_BEGIN(agentx_master_component)
|
||||
/* If agentx isn't an installed component,
|
||||
installed inactive leaves are errors */
|
||||
if (np->node_type & LEAF_INACTIVE)
|
||||
return (-1);
|
||||
DYNCFG_IFNOTCFGVBL_END(agentx_master_component)
|
||||
# endif /* INSTALL_COMMON_DYNAMIC_COMP_CONFIG */
|
||||
|
||||
#else
|
||||
/* If agentx isn't installed inactive leaves are errors */
|
||||
if (np->node_type & LEAF_INACTIVE)
|
||||
return (-1);
|
||||
|
||||
#endif /* INSTALL_ENVOY_AGENTX_MASTER */
|
||||
|
||||
if ((np->node_type & NODE_TYPE) == LEAF_NODE) {
|
||||
/* We now have the node and can start doing various checks
|
||||
The first one is to determine if the type is acceptable.
|
||||
In the case that we have both v1 installed and aren't allowing
|
||||
v2_types we may have objects that have types that shouldn't be used
|
||||
in a v1 setting. We need to test for that case (v1 && !v2_types)
|
||||
and skip any objects that have v2 types if this is a v1 packet */
|
||||
|
||||
#if (INSTALL_ENVOY_SNMP_VERSION_1 && !(INSTALL_ENVOY_SNMP_USE_V2_TYPES))
|
||||
if ((pktp->snmp_version == SNMP_VERSION_1) &&
|
||||
(((MIBLEAF_T *)np)->expected_tag == VT_COUNTER64))
|
||||
return(-1);
|
||||
#endif
|
||||
|
||||
/* Now we have the node we can do the old envoy view check.
|
||||
It will only be required if rfc1445 views aren't installed
|
||||
and the sub agent isn't installed. (The sub agent doesn't do
|
||||
view checks and the rfc1445 view check must be installed if
|
||||
the master agent is also installed) */
|
||||
|
||||
#if (INSTALL_ENVOY_MAIN_AGENT && !(INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS))
|
||||
if ((check_flag) && ((((MIBLEAF_T *)np)->view_mask & pktp->mib_view) == 0))
|
||||
return (-2);
|
||||
#endif /* (INSTALL_ENVOY_MAIN_AGENT && !(INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS)) */
|
||||
mlp->ml_flags = ML_IS_LEAF;
|
||||
}
|
||||
else
|
||||
mlp->ml_flags = 0;
|
||||
|
||||
#if (INSTALL_ENVOY_AGENTX_MASTER)
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
/* If agentx is installed we need to reference count agentx leaves */
|
||||
if (np->node_type & AGENTX_LEAF) {
|
||||
if (((MIBLEAF_T *)np)->ref_count == AX_MAX_REF_COUNT)
|
||||
return (-3);
|
||||
else
|
||||
((MIBLEAF_T *)np)->ref_count++;
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
#endif /* INSTALL_ENVOY_AGENTX_MASTER */
|
||||
|
||||
mlp->ml_remaining_objid.num_components = comp_num;
|
||||
mlp->ml_remaining_objid.component_list = compp;
|
||||
mlp->ml_node = np;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,395 @@
|
||||
/*
|
||||
* 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: mib_next.c,v $
|
||||
* Revision 1.4 2003/01/15 14:05:05 josh
|
||||
* directory structure shifting
|
||||
*
|
||||
* Revision 1.3 2001/11/06 21:50:47 josh
|
||||
* second (and hopefully final) pass of new path hacking
|
||||
*
|
||||
* Revision 1.2 2001/11/06 21:20:15 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:43 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.6.4.1 2001/08/07 21:53:32 meister
|
||||
* reworked to use dynamic component configuration macros, to allow
|
||||
* separate vxworks agentx components
|
||||
*
|
||||
* Revision 9.6 2001/04/11 20:12:02 josh
|
||||
* merging changes from the kingfisher branch back onto
|
||||
* the trunk
|
||||
*
|
||||
* Revision 9.5 2001/01/19 22:22:22 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.4.2.2 2001/03/12 22:08:19 tneale
|
||||
* Updated copyright
|
||||
*
|
||||
* Revision 9.4.2.1 2000/10/13 21:17:36 josh
|
||||
* function prototypes and static declarations to eliminate warnings
|
||||
* from the Tornado compiler
|
||||
*
|
||||
* Revision 9.4 2000/03/17 00:19:08 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.3 2000/02/29 21:39:18 sar
|
||||
* Handle short registrations (a single subid) better in find_next_bound.
|
||||
* Previously we could use an uninitialized pointer and try to copy a zero
|
||||
* length string.
|
||||
*
|
||||
* Revision 9.2 1999/09/15 16:20:01 josh
|
||||
* adding a break to a switch statement to make a compiler happy
|
||||
*
|
||||
* Revision 9.1 1999/03/15 17:04:28 josh
|
||||
* make tree walking agentx subagents more efficient
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:41 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.4 1998/06/22 03:34:27 sar
|
||||
* Cast some things to unsigned ints to try and keep compilers happy
|
||||
*
|
||||
* Revision 8.3 1998/06/05 18:53:14 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.2 1998/05/24 04:47:14 sar
|
||||
* Change the ifdef code to depend on DYNAMIC_VIEWS instead of RFC1445_VIEWS.
|
||||
* also modified the view_check call to use view_family_check this means
|
||||
* the routine that called the mib routines must also have set up the
|
||||
* view family.
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:52:02 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:52 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 1.2 1997/10/22 03:10:22 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 1.1 1997/10/16 00:35:06 sar
|
||||
* Result of the break up of the mibutils.c file. These were broken
|
||||
* out to allow for better granularity and smaller size for customers
|
||||
* that weren't using all of the functions in mibutils.c
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/* moved the routines for find next object here from mibutils.c (where
|
||||
the revision log lives) to allow for better granularity of code. */
|
||||
|
||||
#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/objectid.h>
|
||||
#include <wrn/wm/snmp/engine/view.h>
|
||||
|
||||
#include <wrn/wm/common/dyncfg.h>
|
||||
DYNCFG_VBL_DECLARE_EXTERN(agentx_master_component)
|
||||
DYNCFG_EXTERN_FUNCPTR8(_snmp_find_next_helper_ax, int, MIBNODE_T *, int, OIDC_T*, OBJ_ID_T *, int, VB_T *, SNMP_PKT_T *, int)
|
||||
|
||||
DYNCFG_EXTERN_FUNCPTR2(_snmp_find_next_bound, int, MIBNODE_T *, VB_T *)
|
||||
|
||||
extern int
|
||||
_snmp_find_next_helper_ax(MIBNODE_T *, int, OIDC_T *, OBJ_ID_T *,int,
|
||||
VB_T *vbp, SNMP_PKT_T *, int);
|
||||
|
||||
extern int
|
||||
_snmp_find_next_bound(MIBNODE_T *, VB_T *);
|
||||
|
||||
|
||||
int
|
||||
_snmp_leaf_check(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
MIBLEAF_T *lp,
|
||||
OBJ_ID_T *robj,
|
||||
int rcount,
|
||||
int check_flag)
|
||||
{
|
||||
|
||||
/* An inactive leaf is the same as the leaf not existing, if the inactive
|
||||
flag is set return an error indicating no leaf found */
|
||||
if (lp->node_type & LEAF_INACTIVE)
|
||||
return(VIEW_EXCLUDED);
|
||||
|
||||
/* We also skip objects that don't allow read access */
|
||||
if (((lp->access_type) & READ_ACCESS) == 0)
|
||||
return(VIEW_EXCLUDED);
|
||||
|
||||
|
||||
/* If we have v1 installed and don't have use_v2_types installed
|
||||
then we may have objects that have types that shouldn't be used
|
||||
in a v1 setting. We need to test for that case (v1 && !v2_types)
|
||||
and skip any objects that have v2 types if this is a v1 packet */
|
||||
#if (INSTALL_ENVOY_SNMP_VERSION_1 && !(INSTALL_ENVOY_SNMP_USE_V2_TYPES))
|
||||
if ((pktp->snmp_version == SNMP_VERSION_1) &&
|
||||
(lp->expected_tag == VT_COUNTER64))
|
||||
return(VIEW_EXCLUDED);
|
||||
#endif
|
||||
|
||||
#if (INSTALL_ENVOY_MAIN_AGENT)
|
||||
if (check_flag) {
|
||||
/* Check if the variable is within the given view of the MIB.
|
||||
The customer chooses which view mechanism to use at compile
|
||||
time. */
|
||||
#if (INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS)
|
||||
return(SNMP_View_Family_Check(pktp, robj->component_list,
|
||||
rcount, VIEW_CHECK_IND));
|
||||
#else /* (INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS) */
|
||||
if ((lp->view_mask & pktp->mib_view) == 0)
|
||||
return (VIEW_EXCLUDED);
|
||||
#endif /* (INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS) */
|
||||
}
|
||||
#endif /* INSTALL_ENVOY_MAIN_AGENT */
|
||||
|
||||
return(VIEW_INCLUDED);
|
||||
}
|
||||
|
||||
/* return codes: -1 error, 0 leaf found, 1 no leaf found */
|
||||
|
||||
static int
|
||||
find_next_helper(MIBNODE_T *np,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
OBJ_ID_T *robj,
|
||||
int rcount,
|
||||
VB_T *vbp,
|
||||
SNMP_PKT_T *pktp,
|
||||
int check_flag)
|
||||
{
|
||||
int eret;
|
||||
MIBLEAF_T *lp;
|
||||
|
||||
if (rcount + MAX_OID_COUNT > robj->num_components) {
|
||||
OIDC_T *nlist;
|
||||
nlist = (OIDC_T *)SNMP_memory_alloc((unsigned int)
|
||||
((robj->num_components + 4) *
|
||||
sizeof(OIDC_T)));
|
||||
if (nlist == 0)
|
||||
return(-1);
|
||||
MEMCPY(nlist, robj->component_list, robj->num_components * sizeof(OIDC_T));
|
||||
SNMP_memory_free(robj->component_list);
|
||||
robj->component_list = nlist;
|
||||
robj->num_components = robj->num_components + 4;
|
||||
}
|
||||
|
||||
if ((np->node_type & NODE_TYPE) == INNER_NODE) {
|
||||
MIBARC_T *ap = np->arcs;
|
||||
|
||||
/* if agentx is installed we see if we have an interior leaf.
|
||||
if we do we send it to an agentx specific routine to
|
||||
figure out if the leaf is within our view and if there
|
||||
are any other leaves in that leave's subtree */
|
||||
|
||||
#if INSTALL_ENVOY_AGENTX_MASTER
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
if (np->leaf) {
|
||||
eret = DYNCFG_FUNCALL(_snmp_find_next_helper_ax) (np, tcount,
|
||||
tlist, robj, rcount,
|
||||
vbp, pktp, check_flag);
|
||||
if (eret == 3)
|
||||
return(0);
|
||||
else
|
||||
return(eret);
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
#endif /* INSTALL_ENVOY_AGENTX_MASTER */
|
||||
|
||||
/* if we have a target object id then we need to skip any
|
||||
arcs that come "before" the target. If one matches the
|
||||
target we need to check if it has a "next" at a lower level
|
||||
If there isn't a target or for the arcs "after" the target
|
||||
we need to check if any of those provide a usable next */
|
||||
|
||||
if (tcount > 0) {
|
||||
for(; ap->nodep && (ap->id < *tlist); ap++)
|
||||
;
|
||||
|
||||
if (ap->nodep && (ap->id == *tlist)) {
|
||||
vbp->vb_ml.ml_last_match = ap->id;
|
||||
robj->component_list[rcount] = ap->id;
|
||||
eret = find_next_helper((MIBNODE_T *)ap->nodep, tcount - 1,
|
||||
tlist + 1, robj, rcount + 1,
|
||||
vbp, pktp, check_flag);
|
||||
if (eret <= 0)
|
||||
return (eret);
|
||||
ap++;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we have no target object id at this level, then */
|
||||
/* we need to scan the available arcs, from the lowest */
|
||||
/* to the highest, to see if any of them can provide */
|
||||
/* a usable "next". */
|
||||
|
||||
#if INSTALL_ENVOY_AGENTX_MASTER
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
/* set the include flag so that we will get this item
|
||||
if its both an agentx and instance object */
|
||||
vbp->ax_flags |= ENVOY_AX_FLAGS_INCLUDE;
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
#endif /* INSTALL_ENVOY_AGENTX_MASTER */
|
||||
|
||||
for(; ap->nodep; ap++) {
|
||||
robj->component_list[rcount] = ap->id;
|
||||
vbp->vb_ml.ml_last_match = ap->id;
|
||||
eret = find_next_helper((MIBNODE_T *)(ap->nodep), 0, 0, robj,
|
||||
rcount + 1, vbp, pktp, check_flag);
|
||||
if (eret <= 0)
|
||||
return (eret);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
else { /* node_type != INNER_NODE, i.e. it must be of type LEAF_NODE */
|
||||
/* We have a leaf node, if it is in our view we set up the info we
|
||||
want to return. Finish building the object by attaching any
|
||||
remaining target information (this will be instance info).
|
||||
We don't worry about running out of space in the result buffer
|
||||
as the only way we have instance information is if we didn't
|
||||
modify the target oid and we allocated enough space to hold
|
||||
the entire target oid. */
|
||||
|
||||
/* Cast the structure so it's easier to work with */
|
||||
lp = (MIBLEAF_T *)np;
|
||||
|
||||
switch(_snmp_leaf_check(pktp, vbp, lp, robj, rcount, check_flag)) {
|
||||
case VIEW_EXCLUDED:
|
||||
return(1);
|
||||
case VIEW_INDETERMINATE:
|
||||
vbp->vb_flags |= VFLAG_NEXT_VCREQ;
|
||||
break;
|
||||
}
|
||||
|
||||
if (tcount) {
|
||||
MEMCPY(robj->component_list + rcount, tlist, tcount * sizeof(OIDC_T));
|
||||
vbp->vb_ml.ml_remaining_objid.component_list = robj->component_list +
|
||||
rcount;
|
||||
}
|
||||
else {
|
||||
vbp->vb_ml.ml_remaining_objid.component_list = 0;
|
||||
}
|
||||
|
||||
vbp->vb_ml.ml_remaining_objid.num_components = tcount;
|
||||
robj->num_components = rcount + tcount;
|
||||
|
||||
vbp->vb_ml.ml_node = np;
|
||||
vbp->vb_ml.ml_flags = ML_IS_LEAF;
|
||||
return(0);
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: find_next_object
|
||||
|
||||
PURPOSE: Given an object identifier, find the "next" SNMP object using
|
||||
SNMP's notion of lexicographic ordering of object identifiers.
|
||||
The "next" object may be a leaf node of the MIB tree or an object
|
||||
within a tabular structure. In the latter case, located object
|
||||
id will pass through the leaf node representing the table.
|
||||
|
||||
We install an object id and some mib leaf info into the given
|
||||
var bind. The returned object id, unless null, will be a
|
||||
valid id for the next routine named in the leaf node for the
|
||||
object.
|
||||
|
||||
PARAMETERS:
|
||||
VB_T * The vb structure to store the results, we put the
|
||||
result object id, and some mib leaf info into it.
|
||||
OBJ_ID_T * The target oid to start with.
|
||||
SNMP_PKT_T * The received packet
|
||||
int Do the view check (1) or not (0)
|
||||
|
||||
RETURNS: int > 0 for success,
|
||||
0 if nothing found,
|
||||
-1 for internal failure.
|
||||
On success, the object identifier referenced by
|
||||
the vbp will contain the resulting object id.
|
||||
Note that the for the bulk of find_next_object and find_next helper we
|
||||
use the num_components field in the result objid as the amount of space
|
||||
we have allocated in the componet_list field. Rcount is the actual number
|
||||
of components.
|
||||
****************************************************************************/
|
||||
int
|
||||
find_next_object(VB_T *vbp,
|
||||
OBJ_ID_T *targetp,
|
||||
SNMP_PKT_T *pktp,
|
||||
int check_flag)
|
||||
{
|
||||
OBJ_ID_T *resultp;
|
||||
MIBNODE_T *np;
|
||||
int eret;
|
||||
|
||||
/* Set result to point to the objid in the vbp (where we want the result) */
|
||||
resultp = &(vbp->vb_obj_id);
|
||||
|
||||
resultp->num_components = max(targetp->num_components, 16 + MAX_OID_COUNT);
|
||||
resultp->component_list =
|
||||
(OIDC_T *)SNMP_memory_alloc((unsigned int)
|
||||
(resultp->num_components * sizeof(OIDC_T)));
|
||||
if (resultp->component_list == 0)
|
||||
return(-1);
|
||||
|
||||
if (pktp->mib_root)
|
||||
np = pktp->mib_root;
|
||||
else
|
||||
np = &(ENVOY_MIB_ROOT_NODE);
|
||||
|
||||
eret = find_next_helper(np, targetp->num_components, targetp->component_list,
|
||||
resultp, 0, vbp, pktp, check_flag);
|
||||
if (eret) {
|
||||
Clean_Obj_ID(resultp);
|
||||
if (eret > 0)
|
||||
return(0);
|
||||
else
|
||||
return(-1);
|
||||
}
|
||||
|
||||
#if INSTALL_ENVOY_AGENTX_MASTER
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
/* if agentx is installed and this is an agentx leaf
|
||||
we need to find the boundary oid.
|
||||
We also need to update the reference counter */
|
||||
if (vbp->vb_ml.ml_node->node_type & AGENTX_LEAF) {
|
||||
if (DYNCFG_FUNCALL(_snmp_find_next_bound) (np, vbp) ||
|
||||
(vbp->vb_ml.ml_leaf->ref_count == AX_MAX_REF_COUNT)) {
|
||||
Clean_Obj_ID(resultp);
|
||||
return(-1);
|
||||
}
|
||||
vbp->vb_ml.ml_leaf->ref_count++;
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
#endif /* INSTALL_ENVOY_AGENTX_MASTER */
|
||||
|
||||
return (resultp->num_components);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,826 @@
|
||||
/* mibutils.c - mibutils.c routines */
|
||||
|
||||
/*
|
||||
* Copyright 2000-2007, 2014 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: mibutils.c,v $
|
||||
* Revision 1.5 2003/01/15 14:05:05 josh
|
||||
* directory structure shifting
|
||||
*
|
||||
* Revision 1.4 2002/04/05 22:03:30 josh
|
||||
* std_next_async() needs to call nextproc_next_instance() on all
|
||||
* grouped varbinds, if they're grouped
|
||||
*
|
||||
* Revision 1.3 2001/11/06 21:50:48 josh
|
||||
* second (and hopefully final) pass of new path hacking
|
||||
*
|
||||
* Revision 1.2 2001/11/06 21:20:15 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:43 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.5.4.3 2001/10/19 20:30:07 josh
|
||||
* fixing the fix for the broken gcc compiler -- need to make the
|
||||
* correct comparison
|
||||
*
|
||||
* Revision 9.5.4.2 2001/10/18 21:26:28 josh
|
||||
* the gcc compiler that ships with TAE 1.1 for MIPS has a bug in it,
|
||||
* so we need to rework our code slightly to get around it.
|
||||
*
|
||||
* Revision 9.5.4.1 2001/08/07 21:53:33 meister
|
||||
* reworked to use dynamic component configuration macros, to allow
|
||||
* separate vxworks agentx components
|
||||
*
|
||||
* Revision 9.5 2001/03/27 16:06:09 josh
|
||||
* std_next_async() needs to be more careful about which varbinds it
|
||||
* groups together.
|
||||
*
|
||||
* Revision 9.4 2001/01/19 22:22:22 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.3 2000/03/17 00:19:09 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/09/09 19:36:00 sar
|
||||
* Correct the field we use when cleaning up newnode on an alloc failure
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:43 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.4 1998/06/22 03:34:26 sar
|
||||
* Cast some things to unsigned ints to try and keep compilers happy
|
||||
*
|
||||
* Revision 8.3 1998/06/05 18:53:15 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.2 1998/05/24 04:32:09 sar
|
||||
* Fixed an error in the add_node code. We know handle adding a leaf
|
||||
* (instead of a branch) correctly. Previously we would lose a subid
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:52:05 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:52 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.4 1997/10/22 03:10:22 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:45:55 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:00 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.2 1995/11/01 00:46:48 sar
|
||||
* Removed localio.h, buffer.h and decode.h
|
||||
*
|
||||
* Revision 6.1 1995/10/20 23:02:48 sar
|
||||
* changed party.h to view.h
|
||||
* removed nsapaddress, uinteger32 and bitstring types
|
||||
* removed no_pp stuff
|
||||
* rearranged the view code to so the rfc1445 view scheme for both v1 & v2
|
||||
* if INSTALL_ENVOY_SNMP_RFC1445_VIEWS is installed or the old envoy
|
||||
* scheme if it isn't
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:47:32 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.6 1995/04/28 23:12:28 sar
|
||||
* Dropped the static/dynamice flag in the call to nextproc_next_instance
|
||||
*
|
||||
* Revision 5.5 1995/03/22 18:39:10 sar
|
||||
* Added parans around the access_type check to make compilers happy.
|
||||
*
|
||||
* Revision 5.4 1995/03/21 00:25:01 sar
|
||||
* Updated to use the new async system, the biggest effect is in the next
|
||||
* routines where we no longer call the nexproc routine, This has effects
|
||||
* on the way we deal with view checking and the use of the result object.
|
||||
*
|
||||
* Revision 5.3 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.2 1994/08/19 18:39:21 sar
|
||||
* Copy the entire target oid into the result field during find_next_obj
|
||||
* so that the sub agents can access the entire oid easily. This requires
|
||||
* allocating enough space for the oid as well.
|
||||
*
|
||||
* Revision 5.1 1994/08/04 22:04:16 sar
|
||||
* Added multiple mib tree capability
|
||||
*
|
||||
* 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 17:28:52 sar
|
||||
* Removed the #if master_agent from around the find, add, and remove node
|
||||
* functions.
|
||||
*
|
||||
* Revision 4.5 1994/05/10 20:15:07 sar
|
||||
* Added some #if's and added some clauses to compile only what we need
|
||||
* for the sub agent.
|
||||
*
|
||||
* Revision 4.4 1994/05/09 21:03:44 sar
|
||||
* Added #if around a return statment so it should only be included when it
|
||||
* will be used (to avoid unreachable code warnings).
|
||||
*
|
||||
* Revision 4.3 1994/04/29 21:56:01 sar
|
||||
* Mostly mods dealing with the view check stuff, added a flag to
|
||||
* find_object_node to determine if the view check should be done,
|
||||
* add ifdefs to handle the sub agent and v1 using v2 view schemes.
|
||||
* Modified the calling sequence to find_node.
|
||||
*
|
||||
* Revision 4.2 1994/02/01 23:40:34 sar
|
||||
* Made the handling of oids more dynamic in the find next routines.
|
||||
* Added the routines Find, Add and Remove_Node for use with dynamic mib
|
||||
* manipulation.
|
||||
*
|
||||
* Revision 4.1 1993/10/06 19:49:43 sar
|
||||
* moved the version 2 view check to be at the beginning of find_object_node.
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:45:46 sar
|
||||
* Updated revision to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.9 1993/06/17 23:33:44 sar
|
||||
* Modified view_check to be able to check the view before a next proc is
|
||||
* run (though it may need to be called again after the nextproc is run).
|
||||
*
|
||||
* Revision 3.8 1993/06/07 18:26:04 sar
|
||||
* Modified the find_next_objid (or whatever) and find_next_helper to
|
||||
* allocate the objids it uses dynamically, this allows them to grow
|
||||
* if neccesary and guarantees the method routines at least MAX_OID_COUNT
|
||||
* oids in the list handed to them.
|
||||
*
|
||||
* Revision 3.7 1993/06/02 23:09:24 dab
|
||||
* Changed #ifdef's to #if's for things from install.h
|
||||
*
|
||||
* Revision 3.6 1993/05/22 01:04:31 sar
|
||||
* Cleaned up some unused variables
|
||||
*
|
||||
* Revision 3.5 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.4 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.3 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.2 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.1 1993/02/17 21:05:50 sar
|
||||
* Removed #define then and uses of it, general rearrangement.
|
||||
*
|
||||
* Revision 3.0 92/04/03 19:52:37 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 2.102 91/10/30 20:42:04 dab
|
||||
* Directly include asn1conf.h, snmpdefs.h, and snmpstat.h (if needed).
|
||||
*
|
||||
* Revision 2.101 91/08/15 12:31:04 dab
|
||||
* Removed <libfuncs.h>.
|
||||
*
|
||||
* Revision 2.100 91/08/09 14:08:22 dab
|
||||
* Update version.
|
||||
*
|
||||
* Revision 1.1 91/07/30 02:23:45 romkey
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
* Rev 2.0 31 Mar 1990 15:06:50
|
||||
* Release 2.00
|
||||
*
|
||||
* Rev 1.4 24 Sep 1989 22:06:38
|
||||
* Renamed mib_root to mib_root_node to support the MIB compiler.
|
||||
*
|
||||
* Rev 1.3 27 Apr 1989 15:55:58
|
||||
* Removed unused variables
|
||||
*
|
||||
* Rev 1.2 19 Sep 1988 17:26:34
|
||||
* Made changes to make the Sun C compiler happy.
|
||||
*
|
||||
* Rev 1.1 14 Sep 1988 17:57:16
|
||||
* Moved includes of system include files into libfuncs.h.
|
||||
*
|
||||
* Rev 1.0 12 Sep 1988 10:47:02
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01h,23apr14,bbz resolve the unexpected oid when sending "getnext"
|
||||
request(VXW6-80814)
|
||||
01g,16aug07,jbl add missing include file
|
||||
01f,08jun07,jbl put a call to group_by_getproc_and_instance() in
|
||||
std_next_async()
|
||||
01e,17feb06,job fix APIGEN markup
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,14feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains mibutils.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/auxfuncs.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/objectid.h>
|
||||
#include <wrn/wm/snmp/engine/view.h>
|
||||
|
||||
#include <wrn/wm/common/dyncfg.h>
|
||||
DYNCFG_VBL_DECLARE_EXTERN(agentx_master_component)
|
||||
|
||||
/*lint -e715 */
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
std_next(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T * tlist,
|
||||
OIDC_T * rlist,
|
||||
char * cookie,
|
||||
SNMP_PKT_T * pktp)
|
||||
{
|
||||
if (tcount > 0)
|
||||
return 0;
|
||||
else {
|
||||
*rlist = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
std_next_async(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T * tlist,
|
||||
SNMP_PKT_T * pktp,
|
||||
VB_T * vbp)
|
||||
{
|
||||
OIDC_T oidc = 0;
|
||||
VBL_T *vblp;
|
||||
VB_T *last_vbp, *tvbp, *group_vbp;
|
||||
|
||||
if (tcount > 0)
|
||||
nextproc_no_next(pktp, vbp);
|
||||
else {
|
||||
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
|
||||
|
||||
/* this function just got a whole lot more ugly. The problem is
|
||||
* that if you were to issue a next on, say, foo and foo.0, where
|
||||
* foo is an object that uses std_next_async() as its nextproc,
|
||||
* and has a getproc that calls group_by_getproc_and_instance(),
|
||||
* the foo.0 object will be improperly handled. So, now we scan
|
||||
* through the varbind list for any varbinds that might cause
|
||||
* problems like this.
|
||||
*/
|
||||
for (vblp = &(pktp->pdu.std_pdu.std_vbl); vblp->vblp; vblp = vblp->vblp)
|
||||
;
|
||||
|
||||
for (last_vbp = &vblp->vblist[vblp->vbl_count], tvbp = vbp + 1;
|
||||
tvbp < last_vbp; tvbp++) {
|
||||
/* find varbinds with the same nextproc which aren't already
|
||||
* in use. Note that people who use the same getproc but
|
||||
* different nextprocs for their objects will lose horribly.
|
||||
*/
|
||||
if (tvbp->vb_ml.ml_leaf &&
|
||||
((tvbp->vb_flags & (VFLAG_SET_STARTED | VFLAG_SET_DONE |
|
||||
VFLAG_TEST_STARTED | VFLAG_TEST_DONE)) == 0) &&
|
||||
(tvbp->vb_ml.ml_leaf->nextproc == std_next_async) &&
|
||||
(tvbp->vb_ml.ml_remaining_objid.num_components != 0)) {
|
||||
nextproc_no_next(pktp, tvbp);
|
||||
}
|
||||
}
|
||||
|
||||
for (group_vbp = vbp; group_vbp; group_vbp = group_vbp->vb_link) {
|
||||
nextproc_next_instance(pktp, group_vbp, 1, &oidc);
|
||||
group_vbp->vb_ml.ml_leaf->getproc(lastmatch, 1, &oidc, pktp, group_vbp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
\NOMANUAL
|
||||
NAME: branch_free
|
||||
|
||||
PURPOSE: Free any allocated memory when cleaning a partially allocated
|
||||
branch of the mib tree. Given two nodes, descend from the
|
||||
first one and free any allocated memory up to, but not including
|
||||
the second one.
|
||||
|
||||
PARAMETERS:
|
||||
MIBNODE_T * Starting node
|
||||
MIBNODE_T * Ending node
|
||||
|
||||
RETURNS: void
|
||||
|
||||
****************************************************************************/
|
||||
void
|
||||
branch_free(MIBNODE_T *startnode,
|
||||
MIBNODE_T *endnode)
|
||||
{
|
||||
MIBARC_T *ap;
|
||||
|
||||
if (startnode == endnode)
|
||||
return;
|
||||
|
||||
for(ap = startnode->arcs; (MIBNODE_T *)(ap->nodep) != 0; ap++)
|
||||
branch_free((MIBNODE_T *)(ap->nodep), endnode);
|
||||
|
||||
if ((startnode->node_type & ARC_DYNAMIC) != 0)
|
||||
SNMP_memory_free((char *)(startnode->arcs));
|
||||
|
||||
if ((startnode->node_type & NODE_DYNAMIC) != 0)
|
||||
SNMP_memory_free((char *)startnode);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Find_Node_From_Root - locate the node at the specified point in the MIB tree
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* INT_32_T Find_Node_From_Root
|
||||
* (
|
||||
* MIBNODE_T * root,
|
||||
* OBJ_ID_T * objp,
|
||||
* MIBNODE_T ** npp
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine locates the node at the specified point in the specified MIB
|
||||
* tree. Use this routine when you are writing an SNMP agent or server rather
|
||||
* than in SNMP managers or clients.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <*root>
|
||||
* Specify the MIB tree root. To specify the default MIB tree, set this value to
|
||||
* 0.
|
||||
* \i <*objp>
|
||||
* Specify where to look for the node.
|
||||
* \i <**npp>
|
||||
* Point to a leaf node.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: This routine returns one of three codes.
|
||||
* \ml
|
||||
* \m -
|
||||
* If all components of the object ID have been consumed, it returns 0 and sets
|
||||
* <npp> to a pointer to the node.
|
||||
* \m -
|
||||
* If a leaf node was encountered before all of the components were consumed, it
|
||||
* returns 1 and sets <npp> to a pointer to the node.
|
||||
* \m -
|
||||
* If an object identifier component does not match any of the choices at an
|
||||
* inner node, it returns 2 and sets <npp> to 0.
|
||||
* \me
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: Add_Node_From_Root(), Remove_Node_From_Root()
|
||||
*/
|
||||
sbits32_t
|
||||
Find_Node_From_Root(MIBNODE_T *root,
|
||||
OBJ_ID_T *objp,
|
||||
MIBNODE_T **npp)
|
||||
{
|
||||
MIBNODE_T *np;
|
||||
MIBARC_T *ap;
|
||||
OIDC_T *compp; /* Current object id component of interest */
|
||||
int comp_num; /* Index of current object id component */
|
||||
|
||||
/* find the proper root of the tree */
|
||||
if (root)
|
||||
np = root;
|
||||
else
|
||||
np = &(ENVOY_MIB_ROOT_NODE);
|
||||
|
||||
for(comp_num = objp->num_components, compp = objp->component_list;
|
||||
((np->node_type & NODE_TYPE) == INNER_NODE) && (comp_num > 0);
|
||||
comp_num--, compp++)
|
||||
{
|
||||
for(ap = np->arcs; (MIBNODE_T *)(ap->nodep) != 0; ap++) {
|
||||
if (ap->id == *compp)
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we fall through the arcs, then we have failed in the search */
|
||||
if ((MIBNODE_T *)(ap->nodep) == 0) {
|
||||
*npp = 0;
|
||||
return (2);
|
||||
}
|
||||
|
||||
/* we found a matching arc so we step down to the next level of the tree */
|
||||
np = (MIBNODE_T *)(ap->nodep);
|
||||
}
|
||||
|
||||
/* We have a node, set up to return it to the caller, then check
|
||||
if we have consumed all the identifiers. If we haven't we return
|
||||
1 otherwise return 0 */
|
||||
|
||||
*npp = np;
|
||||
if (comp_num > 0)
|
||||
return(1);
|
||||
else
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Add_Node_From_Root - add node to the specified MIB tree at the specified point
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int Add_Node_From_Root
|
||||
* (
|
||||
* MIBNODE_T * root,
|
||||
* OBJ_ID_T * objp,
|
||||
* MIBNODE_T * anode,
|
||||
* MIBNODE_T ** rnode
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine adds a node to a MIB tree at the specified point. Use this
|
||||
* routine when you are writing an SNMP agent or server rather than in SNMP
|
||||
* managers or clients. This routine also creates any missing branches to
|
||||
* connect the new node. If there is an error any new branches are freed.
|
||||
*
|
||||
* \&NOTE: It is up to the calling routine to free <rnode>.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <*root>
|
||||
* Specify the MIB tree root. To specify the default MIB tree, set this value to
|
||||
* 0.
|
||||
* \i <*objp>
|
||||
* Specify where to add the new node.
|
||||
* \i <*anode>
|
||||
* Specify the node to add. When you build a node, pay particular attention to
|
||||
* the <node_type> field. The flags in this field specify the type of the node
|
||||
* and how to handle the node. You can use these options to make the node
|
||||
* removable and replaceable or mark the node and any arcs or cookies that it
|
||||
* points to as dynamic. Once you install a node, you can not change its flags
|
||||
* to make it replaceable or removable.
|
||||
* \i <**rnode>
|
||||
* Specify a replaceable node. If a replaceable node already exists at that
|
||||
* point in the tree, this routine unlinks it and returns a pointer to it in
|
||||
* <rnode>.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If successful, this routine returns 0. If a general error occurs,
|
||||
* for example, a memory allocation failure, it returns 1. If it is unable to
|
||||
* attach the node because the MIB contains a leaf, it returns 2. If there is an
|
||||
* unreachable node at the specified location, it returns 3. If a replaceable
|
||||
* node exists but it is different type, for example, an inner node rather than
|
||||
* a leaf node, it returns 4. If the object ID was invalid, it returns 5.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: Find_Node_From_Root(), Remove_Node_From_Root()
|
||||
*/
|
||||
int
|
||||
Add_Node_From_Root(MIBNODE_T *root,
|
||||
OBJ_ID_T *objp,
|
||||
MIBNODE_T *anode,
|
||||
MIBNODE_T **rnode)
|
||||
{
|
||||
MIBNODE_T *np, *newnode;
|
||||
MIBARC_T *ap = 0, *newarc, *savearc;
|
||||
OIDC_T *compp; /* Current object id component of interest */
|
||||
int comp_num; /* Index of current object id component */
|
||||
int num_arcs; /* number of arcs, for allocating more space */
|
||||
|
||||
/* Make sure the objid is acceptable */
|
||||
if (objp->num_components < 1)
|
||||
return(5);
|
||||
|
||||
/* Set the replaced node to be 0 in case we don't have a node to return */
|
||||
*rnode = 0;
|
||||
|
||||
/* find the proper root of the tree */
|
||||
if (root)
|
||||
np = root;
|
||||
else
|
||||
np = &(ENVOY_MIB_ROOT_NODE);
|
||||
|
||||
/* find the last matching node in the given object id */
|
||||
for(comp_num = objp->num_components, compp = objp->component_list;
|
||||
((np->node_type & NODE_TYPE) == INNER_NODE) && (comp_num > 0);
|
||||
comp_num--, compp++, np = (MIBNODE_T *)(ap->nodep))
|
||||
{
|
||||
for(ap = np->arcs; (MIBNODE_T *)(ap->nodep) != 0; ap++) {
|
||||
if (ap->id == *compp)
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we are out of arcs we use the current node else we had a matching
|
||||
arc and we continue to the next level */
|
||||
if ((MIBNODE_T *)(ap->nodep) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Take care of the simple cases first, if we are out of sub ids
|
||||
we are at the point where we would add the new node, so we do
|
||||
some tests to make sure we don't destroy a leaf or overwrite
|
||||
something that can't be overwritten or overwrite a leaf with
|
||||
an inner node or vice versa. If none of the tests fail we simply
|
||||
change the pointer in the arc list to point to the new node. */
|
||||
|
||||
if (comp_num == 0) {
|
||||
if ((np->node_type & NODE_TYPE) == LEAF_NODE) {
|
||||
if ((((MIBLEAF_T *)np)->node_type & REPLACEABLE) == 0)
|
||||
return(3);
|
||||
if ((anode->node_type & NODE_TYPE) != LEAF_NODE)
|
||||
return(4);
|
||||
*rnode = np;
|
||||
ap->nodep = (MIBARC_T *)anode;
|
||||
return(0);
|
||||
}
|
||||
else {
|
||||
if ((np->node_type & REPLACEABLE) == 0)
|
||||
return(3);
|
||||
if ((anode->node_type & NODE_TYPE) != INNER_NODE)
|
||||
return(4);
|
||||
*rnode = np;
|
||||
ap->nodep = (MIBARC_T *)anode;
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* If we are here we have more sub ids left. We check that the last
|
||||
node we matched isn't a leaf node (we need an inner node to hook the
|
||||
subtree we are about to create onto) and then we start building the
|
||||
subtree. */
|
||||
|
||||
if ((np->node_type & NODE_TYPE) == LEAF_NODE)
|
||||
return(2);
|
||||
|
||||
/* We work from the leaf back to the current tree, allocate the arc space
|
||||
fill it in (including the terminator), allocate the next level node,
|
||||
connect the arcs to it and repeat */
|
||||
|
||||
for (newnode = anode; comp_num > 1; comp_num--) {
|
||||
newarc = (MIBARC_T *)SNMP_memory_alloc(sizeof(MIBARC_T) * 2);
|
||||
if (newarc == 0) {
|
||||
/* free any memory allocated for this branch */
|
||||
branch_free(newnode, anode);
|
||||
return(1);
|
||||
}
|
||||
|
||||
newarc[0].id = compp[comp_num - 1];
|
||||
newarc[0].nodep = (MIBARC_T *)newnode;
|
||||
newarc[1].id = 0;
|
||||
newarc[1].nodep = 0;
|
||||
|
||||
if ((newnode = (MIBNODE_T *)SNMP_memory_alloc(sizeof(MIBNODE_T))) == 0) {
|
||||
/* free any memory allocated for this branch */
|
||||
newnode = (MIBNODE_T *)(newarc->nodep);
|
||||
SNMP_memory_free(newarc);
|
||||
branch_free(newnode, anode);
|
||||
return(1);
|
||||
}
|
||||
|
||||
MEMSET(newnode, 0, sizeof(MIBNODE_T));
|
||||
newnode->node_type = INNER_NODE | NODE_DYNAMIC | ARC_DYNAMIC |
|
||||
SYSTEM_OWNED;
|
||||
newnode->arcs = newarc;
|
||||
}
|
||||
|
||||
/* num_arcs is the number of arcs in the current list */
|
||||
for(num_arcs = 1, ap = np->arcs; (MIBNODE_T *)(ap->nodep) != 0; ap++)
|
||||
num_arcs++;
|
||||
|
||||
/* add one to num_arcs for the new arc we are adding */
|
||||
newarc = (MIBARC_T *)SNMP_memory_alloc((unsigned int)
|
||||
(sizeof(MIBARC_T) * (num_arcs + 1)));
|
||||
if (newarc == 0) {
|
||||
/* free the branch */
|
||||
branch_free(newnode, anode);
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* copy all arcs less then the new arc, then add the new arc */
|
||||
/* then copy all the arcs after the new arc, there will always be at least
|
||||
one, the terminator */
|
||||
savearc = newarc;
|
||||
for(ap = np->arcs;
|
||||
(ap->id < *compp) && ((MIBNODE_T *)(ap->nodep) != 0);
|
||||
ap++, newarc++, num_arcs--)
|
||||
MEMCPY(newarc, ap, sizeof(MIBARC_T));
|
||||
|
||||
newarc->id = *compp;
|
||||
newarc->nodep = (MIBARC_T *)newnode;
|
||||
newarc++;
|
||||
MEMCPY(newarc, ap, sizeof(MIBARC_T) * num_arcs);
|
||||
|
||||
/* now clean up, if necessary free the old arc list then tag the node so that
|
||||
the new arc list will be freed when released */
|
||||
ap = np->arcs;
|
||||
np->arcs = savearc;
|
||||
if (np->node_type & ARC_DYNAMIC)
|
||||
SNMP_memory_free(ap);
|
||||
np->node_type |= ARC_DYNAMIC;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Remove_Node_From_Root - remove a node from the MIB tree
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* MIBNODE_T * Remove_Node_From_Root
|
||||
* (
|
||||
* MIBNODE_T * root
|
||||
* OBJ_ID_T * objp
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine removes a node from the MIB tree and any branches that exist
|
||||
* only to connect that node to the tree. Use this routine when you are writing
|
||||
* an SNMP agent or server rather than in SNMP managers or clients.
|
||||
*
|
||||
* \&NOTE: The caller must free any allocated space associated with the node.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <*root>
|
||||
* Specify the MIB tree root. To specify the default MIB tree, set this value to
|
||||
* 0.
|
||||
* \i <*objp>
|
||||
* Specify where to look for the node.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If successful, this routine returns the MIB node being removed. If
|
||||
* it does not find a node, it returns 0.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: Add_Node_From_Root()
|
||||
*/
|
||||
MIBNODE_T *
|
||||
Remove_Node_From_Root(MIBNODE_T *root,
|
||||
OBJ_ID_T *objp)
|
||||
{
|
||||
MIBNODE_T *np, *bnode;
|
||||
MIBARC_T *ap;
|
||||
OIDC_T barc, *compp; /* Current object id component of interest */
|
||||
int comp_num; /* Index of current object id component */
|
||||
|
||||
if (objp->num_components < 1)
|
||||
return(0);
|
||||
|
||||
/* find the proper root of the tree */
|
||||
if (root)
|
||||
np = root;
|
||||
else
|
||||
np = &(ENVOY_MIB_ROOT_NODE);
|
||||
bnode = np;
|
||||
|
||||
/* find the last matching node in the given object id */
|
||||
for(comp_num = objp->num_components, compp = objp->component_list,
|
||||
barc = *compp;
|
||||
((np->node_type & NODE_TYPE) == INNER_NODE) && (comp_num > 0);
|
||||
comp_num--, compp++, np = (MIBNODE_T *)(ap->nodep))
|
||||
{
|
||||
/* If we have multiple branches descending from this node or this
|
||||
node isn't owned by the system we update the branch node pointer
|
||||
(which will control what gets removed along with the specified
|
||||
node). */
|
||||
ap = np->arcs;
|
||||
if (((np->node_type & SYSTEM_OWNED) == 0) ||
|
||||
((MIBNODE_T *)(ap[1].nodep) != 0)) {
|
||||
bnode = np;
|
||||
barc = *compp;
|
||||
}
|
||||
|
||||
/* step through the arcs (ap is already pointing to the beginning
|
||||
of the arcs) looking for the current subid. If we hit a null
|
||||
node pointer we have run out of arcs and the node we were looking
|
||||
for doesn't exist so we return a 0 for an error */
|
||||
for(; ; ap++) {
|
||||
if (ap->id == *compp)
|
||||
break;
|
||||
if ((MIBNODE_T *)(ap->nodep) == 0)
|
||||
return(0);
|
||||
}
|
||||
|
||||
#if INSTALL_ENVOY_AGENTX_MASTER
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
/* if agentx is installed we want to set the branch pointer
|
||||
in front of inner nodes that also have direct pointers to leaves
|
||||
but that aren't the node to remove. This will allow us to
|
||||
keep those leaves by moving them into the arc list in place
|
||||
of the node */
|
||||
if (((MIBNODE_T *)ap->nodep)->leaf && (comp_num != 1)) {
|
||||
bnode = np;
|
||||
barc = *compp;
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* np should point to the node we want to remove, bnode points to the last
|
||||
node before the branch that should be removed from the tree and
|
||||
barc is the id of the branch coming out of bnode's arc list that
|
||||
connects to np */
|
||||
|
||||
/* first some tests, we see if we used all of the subids and if the
|
||||
node is removeable */
|
||||
if ((comp_num != 0) || ((np->node_type & REMOVABLE) == 0))
|
||||
return(0);
|
||||
|
||||
/* Now we unlink the branch from the tree */
|
||||
/* Find the arc to remove then either copy all the arcs above it
|
||||
down by one arc structure or if agentx is installed we might
|
||||
need to move a leaf pointer from the first node in the branch
|
||||
to the arc list in its place.
|
||||
In either case save a pointer to the branch to be removed. */
|
||||
for(ap = bnode->arcs; ap->id != barc; ap++)
|
||||
;
|
||||
bnode = (MIBNODE_T *)ap->nodep;
|
||||
|
||||
#if INSTALL_ENVOY_AGENTX_MASTER
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
if ((bnode != np) && (bnode->leaf)) {
|
||||
ap->nodep = (MIBARC_T *)bnode->leaf;
|
||||
branch_free(bnode, np);
|
||||
return(np);
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
#endif
|
||||
|
||||
for(; ((MIBNODE_T *)(ap->nodep) != 0); ap++)
|
||||
MEMCPY(ap, (ap + 1), sizeof(MIBARC_T));
|
||||
|
||||
/* Free the branch */
|
||||
branch_free(bnode, np);
|
||||
|
||||
/* return the node */
|
||||
return(np);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,819 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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: nextpdu.c,v $
|
||||
* Revision 1.4 2003/01/15 14:05:06 josh
|
||||
* directory structure shifting
|
||||
*
|
||||
* Revision 1.3 2001/11/06 21:50:48 josh
|
||||
* second (and hopefully final) pass of new path hacking
|
||||
*
|
||||
* Revision 1.2 2001/11/06 21:20:16 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:43 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2.4.3 2001/08/17 20:42:37 meister
|
||||
* Fixed a DYNCFG_IFCFGVBL_BEGIN which should have been a
|
||||
* DYNCFG_IFCFGVBL_END
|
||||
*
|
||||
* Revision 9.2.4.2 2001/08/07 21:53:33 meister
|
||||
* reworked to use dynamic component configuration macros, to allow
|
||||
* separate vxworks agentx components
|
||||
*
|
||||
* Revision 9.2.4.1 2001/08/06 20:05:37 meister
|
||||
* Added dynamic component configuration macros to V3 conditional code
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:22:22 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:19:13 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:45 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.8 1998/06/17 19:32:51 sar
|
||||
* Moved some code around in the start of the next processing code
|
||||
* to make sure we 0 out the error index and status before sending
|
||||
* a reply packet
|
||||
*
|
||||
* Revision 8.7 1998/06/08 22:05:25 sar
|
||||
* Tidied up some v3 error returns, notably authorization error
|
||||
*
|
||||
* Revision 8.6 1998/06/05 18:53:16 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.5 1998/06/01 20:45:09 sar
|
||||
* Modified the size calculations for too bigs to cover the v3 case.
|
||||
*
|
||||
* Revision 8.4 1998/05/29 04:31:14 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:06 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:31 sra
|
||||
* Finish moving types.h, bug.h, and bugdef.h to common/h/.
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:52:08 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:53 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.5 1997/10/22 03:10:23 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.4 1997/10/16 00:45:56 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.3 1997/03/20 06:49:02 sra
|
||||
* DFARS-safe copyright text. Zap!
|
||||
*
|
||||
* Revision 7.2 1997/02/25 10:49:26 sra
|
||||
* Update copyright notice, dust under the bed.
|
||||
*
|
||||
* Revision 7.1 1996/03/25 15:10:34 sar
|
||||
* If we have a getbulk with no variables requested clean up
|
||||
* the packet and return an empty vb list.
|
||||
*
|
||||
* Revision 7.0 1996/03/18 20:01:11 sar
|
||||
* Updated revision to 7.0 and copyright to 96
|
||||
*
|
||||
* Revision 6.6 1996/01/15 19:45:11 sar
|
||||
* In the size check for getbulk, made updating the vblcount
|
||||
* be dependent on bufsize <= maxpkt rather than bufzsize < maxpkt.
|
||||
*
|
||||
* Revision 6.5 1995/11/14 22:44:42 sar
|
||||
* Renamed the silentdrops & proxydrops counters to match the mib def
|
||||
*
|
||||
* Revision 6.4 1995/11/02 01:55:22 sar
|
||||
* Moved an endif that was blocking out a }
|
||||
*
|
||||
* Revision 6.3 1995/11/01 00:46:48 sar
|
||||
* Added a default option in the version case statement to allow
|
||||
* new versions such as usec to be added without touching nextpdu
|
||||
*
|
||||
* Revision 6.2 1995/10/20 23:02:48 sar
|
||||
* rearranged the view code so we use the rfc1445 view scheme for both
|
||||
* v1 & v2 if INSTALL_ENVOY_SNMP_RFC1445_VIEWS is installed or the old
|
||||
* scheme if it isn't
|
||||
*
|
||||
* Revision 6.1 1995/06/05 20:58:44 sar
|
||||
* Added a call to clean_vb_data if the instance returned by a nextproc
|
||||
* isn't in our view.
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:47:35 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.3 1995/05/03 20:44:14 sar
|
||||
* Moved a variable declaration to be within an ifdefed block to avoid
|
||||
* compiler complaints when that block isn't being compiled.
|
||||
*
|
||||
* Revision 1.2 1995/04/18 21:13:44 sar
|
||||
* Added a check at the start of proxess_next_redo to handle a packet
|
||||
* that has already been tagged with an error.
|
||||
*
|
||||
* Revision 1.1 1995/03/21 00:09:23 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,10jun10,y_t update for LP64
|
||||
01c,14jul08,y_t fix the bulk overflow
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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/objectid.h>
|
||||
#include <wrn/wm/snmp/engine/view.h>
|
||||
#include <wrn/wm/snmp/engine/snmpstat.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_Next_PDU
|
||||
|
||||
PURPOSE: Process a next or bulk type pdu in an async fashion. First we
|
||||
find possible objects for all the var binds (checking that the
|
||||
objects are in the view). If any var binds would send us off the
|
||||
end of the mib we flag a end of mib event. For v1 this means a
|
||||
no such error, for v2 an exception. After we have found all the
|
||||
objects we call the nextproc routines to find the value for
|
||||
each var bind.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * The decoded NEXT/BULK PDU
|
||||
|
||||
RETURNS: int 0 all of the nexts for this rep have been started successfully
|
||||
1 error of some sort, any error packet has been sent.
|
||||
****************************************************************************/
|
||||
|
||||
int
|
||||
SNMP_Process_Next_PDU(SNMP_PKT_T *pktp)
|
||||
{
|
||||
VB_T *vbp, *newvbp, *oldvbp;
|
||||
INT_32_T maxreps = 1, *err_stat;
|
||||
int nonreps = 0, count, indx;
|
||||
|
||||
/* We will be looking at the error status a lot so we get a local pointer
|
||||
to it to make things easier */
|
||||
err_stat = &(pktp->pdu.std_pdu.error_status);
|
||||
|
||||
/* get some initial information */
|
||||
oldvbp = pktp->pdu.std_pdu.std_vbl.vblist;
|
||||
count = pktp->pdu.std_pdu.std_vbl.vbl_count;
|
||||
|
||||
|
||||
#if ENVOY_USE_V2_PROTOS
|
||||
DYNCFG_IFCFGVBL_BEGIN(envoy_use_v2_protos)
|
||||
if (pktp->pdu_type == GET_BULK_REQUEST_PDU) {
|
||||
ALENGTH_T need;
|
||||
/* Test the packet and see if even an empty var bind list
|
||||
will casue a too big, if so we drop the packet. We've
|
||||
already saved the vblist and count so we 0 those fields
|
||||
and do a bufsize check, then restore the fields. */
|
||||
pktp->pdu.std_pdu.std_vbl.vblist = 0;
|
||||
pktp->pdu.std_pdu.std_vbl.vbl_count = 0;
|
||||
need = SNMP_Bufsize_For_Packet(pktp);
|
||||
pktp->pdu.std_pdu.std_vbl.vblist = oldvbp;
|
||||
pktp->pdu.std_pdu.std_vbl.vbl_count = count;
|
||||
|
||||
if (pktp->maxpkt < need) {
|
||||
SGRPv2_INC_COUNTER(snmp_stats.snmpSilentDrops);
|
||||
/* sar may need to add a different return here */
|
||||
pktp->error_complete(&pktp->pkt_src, &pktp->pkt_dst, 1,
|
||||
pktp->async_cookie);
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* Pull the maxreps and nonreps information from the packet and
|
||||
rationalize it. */
|
||||
maxreps = pktp->pdu.std_pdu.error_index;
|
||||
if (*err_stat < 0)
|
||||
nonreps = 0;
|
||||
else if (*err_stat >= count) {
|
||||
nonreps = count;
|
||||
maxreps = 1;
|
||||
}
|
||||
else
|
||||
nonreps = (int)(*err_stat & 0xFFFF);
|
||||
|
||||
if (maxreps < 1) {
|
||||
maxreps = 1;
|
||||
/* This is kinda wierd, the manager sent a bulk packet but doesn't
|
||||
want any of the repeaters, adjust the counters */
|
||||
if (nonreps == 0) {
|
||||
Clean_vb_list(&pktp->pdu.std_pdu.std_vbl);
|
||||
pktp->pdu.std_pdu.std_vbl.vblist = 0;
|
||||
pktp->pdu.std_pdu.std_vbl.vbl_count = 0;
|
||||
}
|
||||
count = nonreps;
|
||||
}
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(envoy_use_v2_protos)
|
||||
#endif /* #if ENVOY_USE_V2_PROTOS */
|
||||
|
||||
/* assume the packet will work */
|
||||
*err_stat = NO_ERROR;
|
||||
pktp->pdu.std_pdu.error_index = 0;
|
||||
|
||||
/* Check to see if the user actually wants anything, if not we
|
||||
are done and we bail out, note that this test must happen
|
||||
after we set the err status & index fields to 0 */
|
||||
if ((oldvbp == 0) || (count == 0))
|
||||
return(0);
|
||||
|
||||
/* Fill in the max_reps and non_reps fields. If this is a bulk packet
|
||||
we pulled the information from the error fields. If it isn't
|
||||
a bulk packet we are using default values */
|
||||
pktp->pdu.std_pdu.max_reps = maxreps;
|
||||
pktp->pdu.std_pdu.non_reps = nonreps;
|
||||
|
||||
/* Some errors may require us to use the original list so we save the
|
||||
original and allocate space for a new one. The objid for the new vbs
|
||||
will be filled in by the find_next_object routine, but we will need to
|
||||
clone the object id if find_next_object tells us their aren't any
|
||||
more objects. */
|
||||
if ((newvbp = VarBindList_Allocate(count)) == 0) {
|
||||
ENVOY_Send_SNMP_Error_Packet(pktp, GEN_ERR, 0);
|
||||
return(1);
|
||||
}
|
||||
pktp->pdu.std_pdu.saved_vbl.vbl_count = pktp->pdu.std_pdu.std_vbl.vbl_count;
|
||||
pktp->pdu.std_pdu.saved_vbl.vblist = oldvbp;
|
||||
pktp->pdu.std_pdu.std_vbl.vbl_count = count;
|
||||
pktp->pdu.std_pdu.std_vbl.vblist = newvbp;
|
||||
|
||||
/* Try to get the infrastructure lock, we release it using
|
||||
the ENVOY_AX_MA_RELEASE_WRITE_LOCK macro */
|
||||
#if (INSTALL_ENVOY_AGENTX_MASTER && INSTALL_ENVOY_SNMP_LOCK)
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_infrastructure_lock)) {
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT, "SNMP_Process_Next_PDU: infrastructure lock broken", 0));
|
||||
ENVOY_Send_SNMP_Error_Packet(pktp, GEN_ERR, 0);
|
||||
return(1);
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
#endif
|
||||
|
||||
/* If necessary try to find the view index structure, if we want to do
|
||||
rfc1445 view checking find_object_node will expect this routine
|
||||
to have been run and to have inserted a pointer into pktp */
|
||||
#if (INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS)
|
||||
if (SNMP_View_Find_Family(pktp) && (pktp->snmp_version == SNMP_VERSION_3)) {
|
||||
ENVOY_AX_MA_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);
|
||||
ENVOY_Send_SNMP_Error_Packet(pktp, AUTHORIZATION_ERROR, 0);
|
||||
return(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Attempt to find all the requested objects
|
||||
Note: if we find an error we set indx = count to break the loop */
|
||||
for(indx = 0, vbp = newvbp; indx < count; indx++, vbp++, oldvbp++) {
|
||||
switch(find_next_object(vbp, &(oldvbp->vb_obj_id), pktp, 1)) {
|
||||
case 0:
|
||||
/* Nothing was found, generate an error for v1 or
|
||||
an exception for v2 */
|
||||
switch(pktp->snmp_version) {
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
case SNMP_VERSION_1:
|
||||
/* If version 1 we send a NO_SUCH_NAME error back.
|
||||
We set up the packet for a nosuch name error. */
|
||||
*err_stat = NO_SUCH_NAME;
|
||||
pktp->pdu.std_pdu.error_index = SNMP_ERROR_INDEX(indx);
|
||||
indx = count;
|
||||
break;
|
||||
#endif
|
||||
#if ENVOY_USE_V2_PROTOS
|
||||
case SNMP_VERSION_2:
|
||||
case SNMP_VERSION_3:
|
||||
default:
|
||||
DYNCFG_IFCFGVBL_BEGIN(envoy_use_v2_protos)
|
||||
/* If not version 1 we send a END_OF_MIB exception back.
|
||||
We set the data_flags_n_type of the current vbp
|
||||
to END_OF_MIB, clone the object id and tag the
|
||||
vbp as having been done and continue with the rest */
|
||||
vbp->vb_data_flags_n_type = VT_ENDOFMIB;
|
||||
vbp->vb_flags |= VFLAG_NEXT_STARTED | VFLAG_NEXT_DONE;
|
||||
if (clone_object_id(&oldvbp->vb_obj_id, &vbp->vb_obj_id)) {
|
||||
/* We were unable to clone an object so we return
|
||||
a gen err */
|
||||
*err_stat = GEN_ERR;
|
||||
indx = count;
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(envoy_use_v2_protos)
|
||||
break;
|
||||
#endif /* #if ENVOY_USE_V2_PROTOS */
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
/* An internal error occurred send back a generr */
|
||||
*err_stat = GEN_ERR;
|
||||
indx = count;
|
||||
break;
|
||||
} /* switch(find_next_object...) */
|
||||
} /* for(indx = 0...) */
|
||||
|
||||
ENVOY_AX_MA_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);
|
||||
if (*err_stat) {
|
||||
ENVOY_Send_SNMP_Error_Packet(pktp, *err_stat,
|
||||
pktp->pdu.std_pdu.error_index);
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* Now we loop through the vblist again and start all the nexts */
|
||||
for(vbp = newvbp; count; count--, vbp++) {
|
||||
/* If the next started flag is set then either we set it above or
|
||||
the nextproc of some other var bind has claimed responsibility for
|
||||
this var bind. In either case we skip this var bind and continue */
|
||||
if (vbp->vb_flags & (VFLAG_NEXT_STARTED | VFLAG_NEXT_DONE))
|
||||
continue;
|
||||
((vbp->vb_ml.ml_leaf)->nextproc)
|
||||
(vbp->vb_ml.ml_last_match, vbp->vb_ml.ml_remaining_objid.num_components,
|
||||
vbp->vb_ml.ml_remaining_objid.component_list, pktp, vbp);
|
||||
vbp->vb_flags |= VFLAG_NEXT_STARTED;
|
||||
|
||||
/* test the error code, if we had an error then mark any remaining
|
||||
vbs as having been gotten (so we won't trip over them later).
|
||||
We need to skip the first vb as that is the one that
|
||||
caused the failure. Then break because we are done */
|
||||
if (*err_stat) {
|
||||
for (vbp++, count--; count; count--, vbp++)
|
||||
if (!(vbp->vb_flags & VFLAG_NEXT_STARTED))
|
||||
vbp->vb_flags |= VFLAG_NEXT_STARTED | VFLAG_NEXT_DONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: SNMP_Process_Next_Redo
|
||||
|
||||
PURPOSE: This is the second stage of the next or bulk processing.
|
||||
We look through the pdu after all of the first set of nextprocs
|
||||
have finished. For each pdu we have several possibilities
|
||||
the next proc may have found something which is in our
|
||||
view, it may have found something that isn't in our view
|
||||
(if we are using v2 views) or it may not have found anything.
|
||||
After we've looked over the entire list we do next procs for
|
||||
any vbs in case 2 or 3.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * The decoded NEXT/BULK PDU
|
||||
|
||||
RETURNS: int 0 this stage of processing is finished continue onward.
|
||||
-1 An (error) packet needs to be sent the caller should
|
||||
do so and then free pktp.
|
||||
1 Several nextprocs were restarted we need to redo this
|
||||
stage
|
||||
****************************************************************************/
|
||||
|
||||
int
|
||||
SNMP_Process_Next_Redo(SNMP_PKT_T *pktp)
|
||||
{
|
||||
VBL_T *vblp;
|
||||
VB_T *vbp, *tvbp, *oldvbp;
|
||||
int count, indx, eret, restart_flag = 0, redo_flag = 1;
|
||||
OBJ_ID_T target;
|
||||
sbits32_t *err_stat;
|
||||
|
||||
/* If somebody has already set up an error, then we don't need to do
|
||||
anything here except return an error indication to our caller */
|
||||
err_stat = &(pktp->pdu.std_pdu.error_status);
|
||||
if (*err_stat != NO_ERROR)
|
||||
return(-1);
|
||||
|
||||
/* Get some initial information. We need to determine which var bind list
|
||||
to use. Nexts have only one but bulks may have several chained together.
|
||||
We want the last one as it will be the only one with variables that may
|
||||
need to be redone. We also get a pointer to the object list as the
|
||||
base for this round. We will need this pointer in the case of a v2
|
||||
end of mib exception as we are suppossed to send back the object we
|
||||
attempted a next from. */
|
||||
|
||||
vblp = &(pktp->pdu.std_pdu.std_vbl);
|
||||
if (vblp->vblp == 0)
|
||||
oldvbp = pktp->pdu.std_pdu.saved_vbl.vblist;
|
||||
else
|
||||
for(oldvbp = vblp->vblist + pktp->pdu.std_pdu.non_reps, vblp = vblp->vblp;
|
||||
vblp->vblp;
|
||||
oldvbp = vblp->vblist, vblp = vblp->vblp)
|
||||
;
|
||||
if (((vbp = vblp->vblist) == 0) || ((count = vblp->vbl_count) == 0))
|
||||
return(0);
|
||||
|
||||
/* Try to get the infrastructure lock, we release it using
|
||||
the ENVOY_AX_MA_RELEASE_WRITE_LOCK macro */
|
||||
#if (INSTALL_ENVOY_AGENTX_MASTER && INSTALL_ENVOY_SNMP_LOCK)
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_infrastructure_lock)) {
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT, "SNMP_Process_Next_Redo: infrastructure lock broken", 0));
|
||||
*err_stat = GEN_ERR;
|
||||
return(-1);
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
#endif
|
||||
|
||||
/* If necessary try to find the view index structure, if we want to do
|
||||
rfc1445 view checking find_object_node will expect this routine
|
||||
to have been run and to have inserted a pointer into pktp */
|
||||
#if (INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS)
|
||||
if (SNMP_View_Find_Family(pktp) && (pktp->snmp_version == SNMP_VERSION_3)) {
|
||||
ENVOY_AX_MA_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);
|
||||
*err_stat = AUTHORIZATION_ERROR;
|
||||
return(-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Note: if we find an error we set indx = count to break the loop */
|
||||
for(tvbp = vbp, indx = 0; indx < count; tvbp++, indx++) {
|
||||
if (!(tvbp->vb_flags & VFLAG_NEXT_REDO)) {
|
||||
#if (INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS)
|
||||
/* If we are using the rfc1445 view scheme we may need to redo
|
||||
the view check now that we know the instance of the variable */
|
||||
if (((tvbp->vb_flags & VFLAG_NEXT_VCBITS) == VFLAG_NEXT_VCREQ) &&
|
||||
(SNMP_View_Family_Check(pktp, tvbp->vb_obj_id.component_list,
|
||||
tvbp->vb_obj_id.num_components,
|
||||
VIEW_CHECK_DET) != VIEW_INCLUDED)) {
|
||||
/* Reset any flags that were set and free any space that was
|
||||
allocated by the method routines */
|
||||
tvbp->vb_flags = (OCTET_T)(tvbp->vb_flags & (~VFLAG_NEXT_FLAGS | VFLAG_NEXT_VCREQ));
|
||||
Clean_vb_data(tvbp);
|
||||
restart_flag = 1;
|
||||
|
||||
#if INSTALL_ENVOY_AGENTX_MASTER
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
/* Reset the include flag as we don't won't to get
|
||||
the current object, that's the one we just found
|
||||
was not in the view */
|
||||
tvbp->ax_flags = (OCTET_T)(tvbp->ax_flags & ~ENVOY_AX_FLAGS_INCLUDE);
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
#endif
|
||||
}
|
||||
else
|
||||
tvbp->vb_flags |= VFLAG_NEXT_VCDONE;
|
||||
#endif /* (INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS) */
|
||||
continue;
|
||||
} /* if (!(tvbp->vb_flags & VFLAG_NEXT_REDO)) { */
|
||||
|
||||
/* We need to redo the given vbp */
|
||||
|
||||
#if INSTALL_ENVOY_AGENTX_MASTER
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
/* We set the include flag in case the object we find is
|
||||
an agentx object. The include flag will inform the sub
|
||||
agent that it should try a get of the object id before
|
||||
trying a next */
|
||||
tvbp->ax_flags |= ENVOY_AX_FLAGS_INCLUDE;
|
||||
|
||||
|
||||
/* if agentx is installed and this is an agentx leaf
|
||||
we use the boundary oid as the start of the next search.
|
||||
we need to free what is currently in the vb_obj_id
|
||||
and move the boundary info into the target oid */
|
||||
if (tvbp->vb_ml.ml_node->node_type & AGENTX_LEAF) {
|
||||
Clean_Obj_ID(&tvbp->vb_obj_id);
|
||||
target.num_components = tvbp->ax_search_end.num_components;
|
||||
target.component_list = tvbp->ax_search_end.component_list;
|
||||
tvbp->ax_search_end.num_components = 0;
|
||||
tvbp->ax_search_end.component_list = 0;
|
||||
|
||||
tvbp->vb_ml.ml_leaf->ref_count--;
|
||||
if (tvbp->vb_ml.ml_leaf->ref_count == 0)
|
||||
SNMP_memory_free(tvbp->vb_ml.ml_leaf);
|
||||
tvbp->vb_ml.ml_leaf = 0;
|
||||
redo_flag = 0;
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
|
||||
#endif /* INSTALL_ENVOY_AGENTX_MASTER */
|
||||
if (redo_flag)
|
||||
{
|
||||
/* Redo is required, next proc was unable to find anything, go
|
||||
to next obj. Chop off any instance qualifier and increment
|
||||
the last subid of the object id */
|
||||
target.num_components = tvbp->vb_obj_id.num_components -
|
||||
tvbp->vb_ml.ml_remaining_objid.num_components;
|
||||
target.component_list = tvbp->vb_obj_id.component_list;
|
||||
tvbp->vb_obj_id.component_list = 0;
|
||||
tvbp->vb_obj_id.num_components = 0;
|
||||
|
||||
while(1) {
|
||||
if (target.num_components == 0)
|
||||
break;
|
||||
|
||||
target.component_list[target.num_components-1]++;
|
||||
if (target.component_list[target.num_components-1])
|
||||
break;
|
||||
target.num_components--;
|
||||
}
|
||||
}
|
||||
|
||||
tvbp->vb_flags = (OCTET_T)(tvbp->vb_flags & ~VFLAG_NEXT_FLAGS);
|
||||
|
||||
if (target.num_components == 0)
|
||||
eret = 0;
|
||||
else
|
||||
eret = find_next_object(tvbp, &target, pktp, 1);
|
||||
|
||||
Clean_Obj_ID(&target);
|
||||
|
||||
switch(eret) {
|
||||
case 0:
|
||||
switch(pktp->snmp_version) {
|
||||
#if (INSTALL_ENVOY_SNMP_VERSION_1)
|
||||
case SNMP_VERSION_1:
|
||||
/* For version 1 we send back a NO_SUCH_NAME error */
|
||||
*err_stat = NO_SUCH_NAME;
|
||||
pktp->pdu.std_pdu.error_index = SNMP_ERROR_INDEX(indx);
|
||||
indx = count;
|
||||
break;
|
||||
#endif /* (INSTALL_ENVOY_SNMP_VERSION_1) */
|
||||
#if (ENVOY_USE_V2_PROTOS)
|
||||
case SNMP_VERSION_2:
|
||||
case SNMP_VERSION_3:
|
||||
default:
|
||||
DYNCFG_IFCFGVBL_BEGIN(envoy_use_v2_protos)
|
||||
/* For version 2 we send back an END_OF_MIB exception.
|
||||
We set the data_flags_n_type of the current vbp to
|
||||
END_OF_MIB, clone the object id and tag the vbp as
|
||||
having been done and continue with the rest */
|
||||
tvbp->vb_data_flags_n_type = VT_ENDOFMIB;
|
||||
tvbp->vb_flags |= VFLAG_NEXT_STARTED | VFLAG_NEXT_DONE;
|
||||
if (clone_object_id((&(oldvbp + indx)->vb_obj_id),
|
||||
&tvbp->vb_obj_id)) {
|
||||
/* We were unable to clone an object so we return
|
||||
a gen err */
|
||||
*err_stat = GEN_ERR;
|
||||
indx = count;
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(envoy_use_v2_protos)
|
||||
break;
|
||||
#endif /* #if (ENVOY_USE_V2_PROTOS) */
|
||||
} /* switch(pktp->snmp_version) { */
|
||||
break;
|
||||
case -1:
|
||||
/* An internal error occurred send back a generr */
|
||||
Clean_Obj_ID(&target);
|
||||
*err_stat = GEN_ERR;
|
||||
indx = count;
|
||||
break;
|
||||
default:
|
||||
restart_flag = 1;
|
||||
break;
|
||||
} /* switch(eret) { */
|
||||
} /* for(tvbp = vbp, indx = 0; indx < count; tvbp++, indx++) { */
|
||||
|
||||
ENVOY_AX_MA_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);
|
||||
if (*err_stat)
|
||||
return(-1);
|
||||
|
||||
/* If necessary we loop through the vblist again and start all the nexts */
|
||||
if (restart_flag) {
|
||||
for(indx = 0, tvbp = vbp; indx < count; indx++, tvbp++) {
|
||||
/* If the next started flag is set then either we set it above or
|
||||
the nextproc of some other var bind has claimed responsibility for
|
||||
this var bind. In either case we skip this var bind and continue */
|
||||
if (tvbp->vb_flags & (VFLAG_NEXT_STARTED | VFLAG_NEXT_DONE))
|
||||
continue;
|
||||
((tvbp->vb_ml.ml_leaf)->nextproc)
|
||||
(tvbp->vb_ml.ml_last_match,
|
||||
tvbp->vb_ml.ml_remaining_objid.num_components,
|
||||
tvbp->vb_ml.ml_remaining_objid.component_list, pktp, tvbp);
|
||||
tvbp->vb_flags |= VFLAG_NEXT_STARTED;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
#if (ENVOY_USE_V2_PROTOS)
|
||||
/****************************************************************************
|
||||
NAME: SNMP_Process_Bulk_Redo
|
||||
|
||||
PURPOSE: This is the third stage of bulk processing. To get here
|
||||
we have successfully finished getting information about one
|
||||
repetition's objects. We do a size check to determine if
|
||||
we need to remove some of the objects. If we have enough space
|
||||
we check to see if we want to try another round
|
||||
(if maxreps > 1 && some variable doesn't have an end of mib
|
||||
exception)
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * The decoded NEXT/BULK PDU
|
||||
|
||||
RETURNS: int 0 The caller should send and free the packet
|
||||
1 Several nextprocs were started we need to redo this
|
||||
stage
|
||||
****************************************************************************/
|
||||
|
||||
int
|
||||
SNMP_Process_Bulk_Redo(SNMP_PKT_T *pktp)
|
||||
{
|
||||
VBL_T *vblp;
|
||||
VB_T *vbp, *tvbp, *newvbp;
|
||||
int count, indx, nonreps, restart_flag = 0;
|
||||
ALENGTH_T bufsize;
|
||||
sbits32_t *err_stat;
|
||||
|
||||
/* Find the correct vblist to work with. Bulks may have several vblists
|
||||
chained togther, we want the last one (the only one that may have ops
|
||||
outstanding). The other pdus only have one vblist */
|
||||
for(vblp = &(pktp->pdu.std_pdu.std_vbl); vblp->vblp; vblp = vblp->vblp)
|
||||
;
|
||||
if (((vbp = vblp->vblist) == 0) || ((count = vblp->vbl_count) == 0))
|
||||
return(0);
|
||||
if (vblp == &(pktp->pdu.std_pdu.std_vbl))
|
||||
nonreps = pktp->pdu.std_pdu.non_reps;
|
||||
else
|
||||
nonreps = 0;
|
||||
|
||||
/* Do the size check, if the packet would exceed the maximum
|
||||
start removing vbs until the packet is smaller than the max.
|
||||
At that point we are done and can return 0 */
|
||||
bufsize = SNMP_Bufsize_For_Packet(pktp);
|
||||
|
||||
if (bufsize > pktp->maxpkt) {
|
||||
for(indx = count, tvbp = vbp + indx - 1; indx; indx--, tvbp--) {
|
||||
Clean_vb(tvbp);
|
||||
/* Recalculate the bufsize, 2 is for the tag and length fields,
|
||||
the length field may be greater than 1 but that is ok, the only
|
||||
thing that will happen is we may put less than the maximum in
|
||||
a buffer */
|
||||
vblp->vbl_count = indx - 1;
|
||||
bufsize = (ALENGTH_T)(bufsize - 2 + tvbp->vb_seq_size);
|
||||
|
||||
if (bufsize <= pktp->maxpkt) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Determine if we want to try another round of nexts */
|
||||
if (pktp->pdu.std_pdu.max_reps <= 1)
|
||||
return(0);
|
||||
for(indx = count - nonreps, tvbp = vbp + nonreps; indx; indx--, tvbp++)
|
||||
if (tvbp->vb_data_flags_n_type != VT_ENDOFMIB)
|
||||
break;
|
||||
if (indx == 0)
|
||||
return(0);
|
||||
|
||||
/* set up the err_stat as we shall use it several times */
|
||||
err_stat = &(pktp->pdu.std_pdu.error_status);
|
||||
|
||||
/* So we want to try another round, start by decrementing the reps number
|
||||
then set up the next vblist in the chain */
|
||||
pktp->pdu.std_pdu.max_reps--;
|
||||
|
||||
if ((vblp->vblp = VBList_Allocate(count - nonreps)) == 0) {
|
||||
*err_stat = GEN_ERR;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Attempt to find the correct object for each of the repeaters. Currently
|
||||
we copy all of the objs and then start any required nexts. Eventually
|
||||
we should copy objects tagged as ENDOFMIB (we aren't going to find anything
|
||||
new) and tabular objects. We will run find_next_object on scalar objects
|
||||
as there won't be anymore instances. */
|
||||
|
||||
/* Try to get the infrastructure lock, we release it using
|
||||
the ENVOY_AX_MA_RELEASE_WRITE_LOCK macro */
|
||||
#if (INSTALL_ENVOY_AGENTX_MASTER && INSTALL_ENVOY_SNMP_LOCK)
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_infrastructure_lock)) {
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT, "SNMP_Process_Bulk_Redo: infrastructure lock broken", 0));
|
||||
*err_stat = GEN_ERR;
|
||||
return(0);
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
#endif
|
||||
|
||||
/* Note: if we find an error we set indx = 0 to break the loop */
|
||||
for(indx = count - nonreps, tvbp = vbp + nonreps, newvbp = vblp->vblp->vblist;
|
||||
indx > 0;
|
||||
indx--, tvbp++, newvbp++) {
|
||||
newvbp->vb_flags = (OCTET_T)(tvbp->vb_flags & VFLAG_NEXT_VCREQ);
|
||||
if (clone_object_id((&tvbp->vb_obj_id), (&newvbp->vb_obj_id))) {
|
||||
/* We were unable to clone an object so we return a gen err */
|
||||
*err_stat = GEN_ERR;
|
||||
indx = 0;
|
||||
}
|
||||
|
||||
if (tvbp->vb_data_flags_n_type == VT_ENDOFMIB) {
|
||||
newvbp->vb_data_flags_n_type = VT_ENDOFMIB;
|
||||
newvbp->vb_flags |= VFLAG_NEXT_STARTED | VFLAG_NEXT_DONE;
|
||||
}
|
||||
else {
|
||||
restart_flag = 1;
|
||||
/* And copy the mib leaf information */
|
||||
newvbp->vb_ml.ml_node = tvbp->vb_ml.ml_node;
|
||||
newvbp->vb_ml.ml_flags = ML_IS_LEAF;
|
||||
newvbp->vb_ml.ml_last_match = tvbp->vb_ml.ml_last_match;
|
||||
newvbp->vb_ml.ml_remaining_objid.num_components =
|
||||
tvbp->vb_ml.ml_remaining_objid.num_components;
|
||||
newvbp->vb_ml.ml_remaining_objid.component_list =
|
||||
newvbp->vb_obj_id.component_list +
|
||||
newvbp->vb_obj_id.num_components -
|
||||
newvbp->vb_ml.ml_remaining_objid.num_components;
|
||||
|
||||
#if INSTALL_ENVOY_AGENTX_MASTER
|
||||
DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)
|
||||
/* if agentx is installed we need to move the boundary object id */
|
||||
if (tvbp->vb_ml.ml_node->node_type & AGENTX_LEAF) {
|
||||
newvbp->ax_search_end.num_components =
|
||||
tvbp->ax_search_end.num_components;
|
||||
newvbp->ax_search_end.component_list =
|
||||
tvbp->ax_search_end.component_list;
|
||||
|
||||
tvbp->ax_search_end.num_components = 0;
|
||||
tvbp->ax_search_end.component_list = 0;
|
||||
|
||||
/* if possible update the reference counts */
|
||||
if (tvbp->vb_ml.ml_leaf->ref_count == AX_MAX_REF_COUNT) {
|
||||
*err_stat = GEN_ERR;
|
||||
indx = 0;
|
||||
}
|
||||
tvbp->vb_ml.ml_leaf->ref_count++;
|
||||
}
|
||||
DYNCFG_IFCFGVBL_END(agentx_master_component)
|
||||
#endif /* INSTALL_ENVOY_AGENTX_MASTER */
|
||||
}
|
||||
}
|
||||
|
||||
ENVOY_AX_MA_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);
|
||||
if (*err_stat)
|
||||
return(0);
|
||||
|
||||
if (restart_flag) {
|
||||
for(indx = count - nonreps, newvbp = vblp->vblp->vblist;
|
||||
indx;
|
||||
indx--, newvbp++) {
|
||||
/* If the next started flag is set then either we set it above or
|
||||
the nextproc of some other var bind has claimed responsibility for
|
||||
this var bind. In either case we skip this var bind and continue */
|
||||
if (newvbp->vb_flags & (VFLAG_NEXT_STARTED | VFLAG_NEXT_DONE))
|
||||
continue;
|
||||
((newvbp->vb_ml.ml_leaf)->nextproc)
|
||||
(newvbp->vb_ml.ml_last_match,
|
||||
newvbp->vb_ml.ml_remaining_objid.num_components,
|
||||
newvbp->vb_ml.ml_remaining_objid.component_list, pktp, newvbp);
|
||||
newvbp->vb_flags |= VFLAG_NEXT_STARTED;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
else
|
||||
return(0);
|
||||
}
|
||||
#endif /* #if (ENVOY_USE_V2_PROTOS) */
|
||||
|
||||
@@ -0,0 +1,455 @@
|
||||
/*
|
||||
* Copyright 2000-2012 2015 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 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: ntfy_chk.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:16 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:43 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.8.4.1 2001/08/07 18:33:58 josh
|
||||
* adding support for SNMPv1/v2c/v3 coexistence to SNMP Notify code
|
||||
*
|
||||
* Revision 9.8 2001/04/11 20:42:57 josh
|
||||
* merge from the kingfisher branch
|
||||
*
|
||||
* Revision 9.7 2001/01/19 22:22:23 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.6 2000/07/12 20:06:00 josh
|
||||
* some functions are no longer static, some only build when
|
||||
* ENVOY_SNMP_V3_NOTIFY is installed.
|
||||
*
|
||||
* Revision 9.5.2.4 2001/03/12 22:08:20 tneale
|
||||
* Updated copyright
|
||||
*
|
||||
* Revision 9.5.2.3 2000/12/13 20:51:08 josh
|
||||
* SNMP_Send_Notify_Name() now obsoletes SNMP_Send_Notify()
|
||||
* logic of SNMP_Send_Notify_Name() is improved to help prevent nesting of
|
||||
* locks and generally smooth out flow of data
|
||||
*
|
||||
* Revision 9.5.2.2 2000/11/30 19:40:06 josh
|
||||
* fixing a few small bugs in the notify code and method routines...
|
||||
*
|
||||
* Revision 9.5.2.1 2000/09/20 21:47:01 josh
|
||||
* bringing branch up to currency with the root tree
|
||||
*
|
||||
* Revision 9.5 2000/03/17 00:19:13 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.4 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.3 1999/12/23 15:42:21 josh
|
||||
* a bug in taglist_check() was causing "foobar foo" to not match
|
||||
* with "foo"
|
||||
*
|
||||
* Revision 9.2 1999/11/09 17:56:39 josh
|
||||
* fixing memory leaks and initialization issues
|
||||
*
|
||||
* Revision 9.1 1999/11/04 21:14:05 josh
|
||||
* fixing Purify-related bugs
|
||||
*
|
||||
* Revision 9.0 1999/10/21 20:41:38 josh
|
||||
* updating version stamps
|
||||
*
|
||||
* Revision 1.4 1999/09/27 21:11:46 josh
|
||||
* fixing nits, rewriting engine id <--> address code, adding installation
|
||||
* option
|
||||
*
|
||||
* Revision 1.3 1999/09/21 21:33:13 josh
|
||||
* deal with fact that sysUpTime is first, TrapID is second varbind
|
||||
*
|
||||
* Revision 1.2 1999/09/14 19:29:28 josh
|
||||
* completed code for sending notifies
|
||||
*
|
||||
* Revision 1.1 1999/09/08 18:10:51 josh
|
||||
* functions to build a target list for a given notify
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,13may15,r_w fix for VXW6-84352 (roll back WIND00369557)
|
||||
01c,16aug12,rjq fix for WIND00369557 SNMP notify does not work
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/view.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/v3_ntfy.h>
|
||||
#include <wrn/wm/snmp/engine/v3_trgt.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/objectid.h>
|
||||
#include <wrn/wm/snmp/engine/ntfy_chk.h>
|
||||
|
||||
/****************************************************************************
|
||||
NAME: taglist_next_tag
|
||||
|
||||
PURPOSE: Advance a pointer in an EBUFFER_T to point to the next tag in the
|
||||
tag list.
|
||||
|
||||
PARAMETERS: EBUFFER_T * pointer to the tag list
|
||||
bits8_t * pointer into the tag list
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
static bits8_t *
|
||||
taglist_next_tag(EBUFFER_T *tag_list,
|
||||
bits8_t *tlp)
|
||||
{
|
||||
if ((tlp < EBufferStart(tag_list)) ||
|
||||
(tlp >= EBufferNext(tag_list))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while ((tlp < EBufferNext(tag_list)) && (!tag_whitespace(*tlp)))
|
||||
tlp++;
|
||||
|
||||
if (tlp < EBufferNext(tag_list)) {
|
||||
while ((tlp < EBufferNext(tag_list)) && tag_whitespace(*tlp))
|
||||
tlp++;
|
||||
}
|
||||
|
||||
if (tlp >= EBufferNext(tag_list))
|
||||
return 0;
|
||||
|
||||
return tlp;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: taglist_check
|
||||
|
||||
PURPOSE: Check to see if a given tag is in a given tag list
|
||||
|
||||
PARAMETERS: EBUFFER_T * pointer to the tag list
|
||||
EBUFFER_T * pointer to the tag
|
||||
|
||||
RETURNS: 0 if tag is in list, -1 otherwise
|
||||
****************************************************************************/
|
||||
int
|
||||
taglist_check(EBUFFER_T *tag_list,
|
||||
EBUFFER_T *tag)
|
||||
{
|
||||
bits8_t *tlp, *tp;
|
||||
int tag_len, match_len;
|
||||
|
||||
|
||||
tag_len = EBufferUsed(tag);
|
||||
|
||||
for (tlp = EBufferStart(tag_list), tp = EBufferStart(tag), match_len = 0;
|
||||
tlp;
|
||||
tlp = taglist_next_tag(tag_list, tlp), tp = EBufferStart(tag),
|
||||
match_len = 0) {
|
||||
for (;
|
||||
((tlp < EBufferNext(tag_list)) && (tp < EBufferNext(tag)) &&
|
||||
(match_len < tag_len) && (*tlp == *tp)) ;
|
||||
tlp++, tp++, match_len++)
|
||||
;
|
||||
if ((match_len == tag_len) &&
|
||||
((tlp == EBufferNext(tag_list)) || tag_whitespace(*tlp)))
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: init_target_list
|
||||
|
||||
PURPOSE: Initializes all the field in the TARGET_LIST_T structure.
|
||||
|
||||
PARAMETERS: TARGET_LIST_T * the target list item to be initialized
|
||||
|
||||
RETURNS: nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
init_target_list(TARGET_LIST_T *target_list)
|
||||
{
|
||||
target_list->pktp = 0;
|
||||
target_list->vblp = 0;
|
||||
EBufferInitialize(&(target_list->context));
|
||||
MEMSET(&(target_list->for_addr), 0, sizeof(SNMPADDR_T));
|
||||
target_list->tdomain.num_components = 0;
|
||||
target_list->tdomain.component_list = 0;
|
||||
EBufferInitialize(&(target_list->taddress));
|
||||
target_list->timeout = 0;
|
||||
target_list->retry_count = 0;
|
||||
target_list->mms = 0;
|
||||
target_list->ptype = 0;
|
||||
target_list->mp_model = 0;
|
||||
target_list->sec_model = 0;
|
||||
EBufferInitialize(&(target_list->sec_name));
|
||||
target_list->sec_level = 0;
|
||||
target_list->flags = 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: clean_target_list
|
||||
|
||||
PURPOSE: Destroy a target list. However, don't destroy anything that's
|
||||
being used to send a probe.
|
||||
|
||||
PARAMETERS: TARGET_LIST_T * pointer to the OID to be checked
|
||||
|
||||
RETURNS: nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
clean_target_list(TARGET_LIST_T *tlist)
|
||||
{
|
||||
TARGET_LIST_T *current;
|
||||
|
||||
while (tlist) {
|
||||
current = tlist;
|
||||
tlist = tlist->next;
|
||||
if (current->flags & SNMP_TARGET_LIST_SEND_PROBE) {
|
||||
current->next = 0;
|
||||
continue;
|
||||
}
|
||||
Clean_Obj_ID(&(current->tdomain));
|
||||
EBufferClean(&(current->taddress));
|
||||
EBufferClean(&(current->context));
|
||||
EBufferClean(&(current->sec_name));
|
||||
if (current->vblp) {
|
||||
Clean_vb_list(current->vblp);
|
||||
SNMP_memory_free(current->vblp);
|
||||
}
|
||||
SNMP_memory_free(current);
|
||||
}
|
||||
}
|
||||
|
||||
#if (INSTALL_ENVOY_SNMP_V3_NOTIFY)
|
||||
/****************************************************************************
|
||||
NAME: filter_subtree_check
|
||||
|
||||
PURPOSE: Check to see if a given OID matches a subtree and mask
|
||||
|
||||
PARAMETERS: OBJ_ID_T * pointer to the OID to be checked
|
||||
OBJ_ID_T * pointer to the subtree
|
||||
EBUFFER_T * pointer to the subtree mask
|
||||
|
||||
RETURNS: 0 if subtree matches, -1 if not
|
||||
****************************************************************************/
|
||||
static int
|
||||
filter_subtree_check(OBJ_ID_T *check_oid,
|
||||
OBJ_ID_T *filter_subtree,
|
||||
EBUFFER_T *filter_mask)
|
||||
{
|
||||
OIDC_T *testoidc, *suboidc;
|
||||
bits8_t *mask;
|
||||
int testlen, sublen, masklen, i;
|
||||
|
||||
testoidc = check_oid->component_list;
|
||||
suboidc = filter_subtree->component_list;
|
||||
mask = EBufferStart(filter_mask);
|
||||
|
||||
testlen = check_oid->num_components;
|
||||
sublen = filter_subtree->num_components;
|
||||
masklen = EBufferUsed(filter_mask) * 8;
|
||||
|
||||
i = 0;
|
||||
|
||||
while (i < min(testlen, sublen)) {
|
||||
if (*testoidc != *suboidc) {
|
||||
if (i < masklen) {
|
||||
if (mask[i/8] & (0x80 >> (i%8)))
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
testoidc++;
|
||||
suboidc++;
|
||||
}
|
||||
|
||||
if (i == sublen)
|
||||
return 0;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: build_target_list
|
||||
|
||||
PURPOSE: Given a Notify and a VarBindList, construct a list of targets
|
||||
that the Notify can be sent to. NOTE: This function will do
|
||||
tag matching and filter checking, but not view checking.
|
||||
|
||||
PARAMETERS: SNMP_NOTIFY_T * pointer to notify structure
|
||||
VBL_T * the varbind list to check against
|
||||
|
||||
RETURNS: TARGET_LIST_T * the linked list of targets
|
||||
****************************************************************************/
|
||||
|
||||
TARGET_LIST_T *
|
||||
build_target_list(SNMP_NOTIFY_T *notify,
|
||||
VBL_T *vblp)
|
||||
{
|
||||
|
||||
SNMP_TARGET_ADDR_T *test_addr;
|
||||
SNMP_NOTIFY_FILTER_PROFILE_T *test_profile;
|
||||
SNMP_NOTIFY_FILTER_T *test_filter;
|
||||
TARGET_LIST_T *target_list_head = 0, *target_list;
|
||||
VB_T *vbp;
|
||||
int notify_oid_ok, vb_oids_ok, vb_cnt;
|
||||
|
||||
if ((vblp->vbl_count < 2) ||
|
||||
(vblp->vblist[1].vb_data_flags_n_type != VT_OBJECT))
|
||||
return 0;
|
||||
|
||||
/* Step 1: Scan through the SNMP_TARGET_ADDR_T list, looking for
|
||||
* target_addrs that have the notify tag in their tag list.
|
||||
*/
|
||||
for (test_addr = root_target_addr; test_addr; test_addr = test_addr->next) {
|
||||
if ((taglist_check(&(test_addr->tag_list), &(notify->notify_tag)) != 0) ||
|
||||
(SNMP_Target_Addr_Get_Status(test_addr) != ETC_RS_ACTIVE))
|
||||
continue;
|
||||
|
||||
/* We have a target_addr structure that matches this notify's tag.
|
||||
* Now we have to get to the right notify_filter. We do this
|
||||
* by following the target_addr's params field to the notify filter
|
||||
* profile table, and then looking through all the notify filters
|
||||
* associated with that notify filter profile.
|
||||
*/
|
||||
if (((test_profile =
|
||||
SNMP_Notify_Profile_Lookup(SNMP_Target_Addr_Get_Params(test_addr),
|
||||
SNMP_Target_Addr_Get_Params_Len(test_addr))) == 0) ||
|
||||
(SNMP_Notify_Profile_Get_Status(test_profile) != ETC_RS_ACTIVE)) {
|
||||
/* no notify filter profile for this target == no filtering */
|
||||
if ((target_list = SNMP_memory_alloc(sizeof(TARGET_LIST_T))) == 0) {
|
||||
/* memory allocation error */
|
||||
clean_target_list(target_list_head);
|
||||
return 0;
|
||||
}
|
||||
init_target_list(target_list);
|
||||
target_list->target = test_addr;
|
||||
target_list->next = target_list_head;
|
||||
target_list_head = target_list;
|
||||
continue;
|
||||
}
|
||||
/* We have a notify filter profile object. Now use it to go
|
||||
* through the NotifyFilterTable. This requires two passes.
|
||||
* The first pass is checking the OID of the notify itself
|
||||
* against the possible filters. If no match (or match and
|
||||
* filter blocks it), notify is not sent to this target.
|
||||
*/
|
||||
for (test_filter = root_notify_filter, notify_oid_ok = 0;
|
||||
test_filter;
|
||||
test_filter = SNMP_Notify_Filter_Next_Filter(test_filter)) {
|
||||
if ((SNMP_Notify_Profile_Get_Profile_Len(test_profile) !=
|
||||
SNMP_Notify_Filter_Get_Profile_Len(test_filter)) ||
|
||||
(MEMCMP(SNMP_Notify_Profile_Get_Profile(test_profile),
|
||||
SNMP_Notify_Filter_Get_Profile(test_filter),
|
||||
SNMP_Notify_Profile_Get_Profile_Len(test_profile)) != 0) ||
|
||||
(SNMP_Notify_Filter_Get_Status(test_filter) != ETC_RS_ACTIVE))
|
||||
/* This filter doesn't match the profile we have, or
|
||||
* it's not active. Not valid to use in either case.
|
||||
*/
|
||||
continue;
|
||||
|
||||
/* We have a filter that matches our profile. Now we have to
|
||||
* do subtree checking.
|
||||
*/
|
||||
/* such as coldStart,warmStart,linkDown,linkUp */
|
||||
if (filter_subtree_check(&(vblp->vblist[1]).value_u.v_object,
|
||||
&(test_filter->subtree),
|
||||
&(test_filter->filter_mask)) == 0) {
|
||||
/* a subtree match! */
|
||||
if (SNMP_Notify_Filter_Get_Type(test_filter) ==
|
||||
SNMP_NOTIFY_FILTER_INCLUDED)
|
||||
notify_oid_ok = 1;
|
||||
else
|
||||
/* we need to reset this value in case it was set by
|
||||
* a less specific match.
|
||||
*/
|
||||
notify_oid_ok = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (notify_oid_ok == 0)
|
||||
continue;
|
||||
|
||||
/* We've found a filter that applies to the OID of the notify
|
||||
* and includes it. Now we have to make sure that none of the
|
||||
* OIDs for the varbinds being sent are explicitly excluded.
|
||||
* In this case, no matching filter means it's OK, matching filter
|
||||
* with excluded set is the only thing that will block it.
|
||||
*/
|
||||
for (vb_cnt = 0, vbp = &(vblp->vblist[vb_cnt]), vb_oids_ok = 1;
|
||||
(vb_cnt < vblp->vbl_count) && vb_oids_ok;
|
||||
vb_cnt++, vbp = &(vblp->vblist[vb_cnt])) {
|
||||
if (vb_cnt == 1)
|
||||
continue;
|
||||
for (test_filter = root_notify_filter;
|
||||
test_filter;
|
||||
test_filter = SNMP_Notify_Filter_Next_Filter(test_filter)) {
|
||||
if ((SNMP_Notify_Profile_Get_Profile_Len(test_profile) !=
|
||||
SNMP_Notify_Filter_Get_Profile_Len(test_filter)) ||
|
||||
(MEMCMP(SNMP_Notify_Profile_Get_Profile(test_profile),
|
||||
SNMP_Notify_Filter_Get_Profile(test_filter),
|
||||
SNMP_Notify_Profile_Get_Profile_Len(test_profile))
|
||||
!= 0) ||
|
||||
(SNMP_Notify_Filter_Get_Status(test_filter) != ETC_RS_ACTIVE))
|
||||
/* This filter doesn't match the profile we have, or
|
||||
* it's not active. Not valid to use in either case.
|
||||
*/
|
||||
continue;
|
||||
|
||||
/* such as snmpTrapOID, sysUpTime */
|
||||
if (filter_subtree_check(&(vbp->vb_obj_id),
|
||||
&(test_filter->subtree),
|
||||
&(test_filter->filter_mask)) == 0) {
|
||||
/* subtree match! */
|
||||
if (SNMP_Notify_Filter_Get_Type(test_filter) ==
|
||||
SNMP_NOTIFY_FILTER_EXCLUDED)
|
||||
vb_oids_ok = 0;
|
||||
else
|
||||
/* we need to reset this value in case it was
|
||||
* cleared by a less-specific match.
|
||||
*/
|
||||
vb_oids_ok = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vb_oids_ok == 0)
|
||||
continue;
|
||||
|
||||
/* If we made it to this point, the target has passed all
|
||||
* necessary tests and is eligible to receive this notification.
|
||||
* Add it to the list.
|
||||
*/
|
||||
|
||||
if ((target_list = SNMP_memory_alloc(sizeof(TARGET_LIST_T))) == 0) {
|
||||
/* memory allocation error */
|
||||
clean_target_list(target_list_head);
|
||||
return 0;
|
||||
}
|
||||
init_target_list(target_list);
|
||||
target_list->target = test_addr;
|
||||
target_list->next = target_list_head;
|
||||
target_list_head = target_list;
|
||||
}
|
||||
return target_list_head;
|
||||
}
|
||||
|
||||
#endif /* #if (INSTALL_ENVOY_SNMP_V3_NOTIFY) */
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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: null_gas.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:16 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:55 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:36 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:03 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:07 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:18:46 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:52 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:39 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:07 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:08 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 6.0 1995/05/31 21:50:47 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.1 1995/03/08 23:08:05 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
void
|
||||
null_get_async(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
getproc_good(pktp, vbp);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* 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: null_get.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:16 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:55 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:36 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:03 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:12 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:52 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:40 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:07 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:09 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:48 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.0 1992/04/03 19:53:01 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 1.2 91/10/30 20:38:37 dab
|
||||
* Directly include asn1conf.h and snmpdefs.h.
|
||||
*
|
||||
* Revision 1.1 91/10/24 11:08:31 dab
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
/* For those variables which don't have a get proceedure. */
|
||||
INT_32_T
|
||||
null_get_proc(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T * tlist,
|
||||
char * cookie,
|
||||
SNMP_PKT_T * pktp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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: null_nas.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:17 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:55 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:37 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:04 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:14 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:18:47 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:52 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:42 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:08 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:10 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 1996/01/05 18:58:29 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
void
|
||||
null_next_async(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
nextproc_next_instance(pktp, vbp, 0, 0);
|
||||
nextproc_good(pktp, vbp);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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: null_nxt.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:17 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:55 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:37 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:04 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:16 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:53 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:43 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:08 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:10 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 1996/01/05 18:58:29 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
/* For those variables which don't have a next proceedure. */
|
||||
int
|
||||
null_next_proc(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
OIDC_T *rlist,
|
||||
char *cookie,
|
||||
SNMP_PKT_T *pktp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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: null_sas.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:17 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:55 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:38 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:04 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:18 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:18:48 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:53 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:44 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:09 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:11 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 6.0 1995/05/31 21:50:49 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.1 1995/03/08 23:08:05 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
void
|
||||
null_set_async(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
setproc_good(pktp, vbp);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* 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: null_set.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:17 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/04/11 20:03:34 josh
|
||||
* the guinea pig commit for the big branch merge
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:21:56 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1.2.2 2001/03/12 22:07:39 tneale
|
||||
* Updated copyright
|
||||
*
|
||||
* Revision 9.1.2.1 2000/09/21 21:25:51 josh
|
||||
* bringing branch into line with main tree
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:17:38 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:21 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:53 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:45 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:09 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:12 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 6.0 1995/05/31 21:50:49 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.0 1992/04/03 19:53:01 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 1.2 91/10/30 20:38:38 dab
|
||||
* Directly include asn1conf.h and snmpdefs.h.
|
||||
*
|
||||
* Revision 1.1 91/10/24 11:08:53 dab
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1conf.h>
|
||||
#include <wrn/wm/snmp/engine/asn1.h>
|
||||
#include <wrn/wm/snmp/engine/localio.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/decode.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
|
||||
|
||||
void
|
||||
null_set_proc(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
char *cookie,
|
||||
INT_32_T value,
|
||||
SNMP_PKT_T *pktp,
|
||||
int vb_index)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* 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: null_tas.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:17 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:56 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:38 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:04 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:23 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:18:50 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:54 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:47 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:10 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:13 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 1996/01/05 18:58:29 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
void
|
||||
null_test_async(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
testproc_good(pktp, vbp);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* 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 1996-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: null_tst.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:18 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:21:56 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:39 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:05 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:25 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:54 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:48 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:10 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:14 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 1996/01/05 18:58:29 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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>
|
||||
|
||||
/* For those variables which don't have a test proceedure. */
|
||||
int
|
||||
null_test_proc(int form,
|
||||
OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
char *cookie,
|
||||
SNMP_PKT_T *pktp,
|
||||
int indx)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
* 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: objectid.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:18 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:43 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:22:23 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:19:14 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:47 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:53:16 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:52:11 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:54 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:49:05 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:37 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.1 1995/03/21 00:25:01 sar
|
||||
* Minor cleanup, removed unneeded casts of 0 and started using MEMCPY
|
||||
*
|
||||
* 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/02/17 21:06:14 sar
|
||||
* Removed the #define the and uses of it.
|
||||
*
|
||||
* Revision 3.0 92/04/03 19:52:37 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 2.103 91/10/30 20:42:06 dab
|
||||
* Directly include asn1conf.h, snmpdefs.h, and snmpstat.h (if needed).
|
||||
*
|
||||
* Revision 2.102 91/09/18 12:32:26 dab
|
||||
* Updated to use new macros from <asn1conf.h> and <snmpconf.h>.
|
||||
*
|
||||
* Revision 2.101 91/08/15 12:31:06 dab
|
||||
* Removed <libfuncs.h>.
|
||||
*
|
||||
* Revision 2.100 91/08/09 14:08:23 dab
|
||||
* Update version.
|
||||
*
|
||||
* Revision 1.1 91/07/30 02:23:46 romkey
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
* Rev 2.0 31 Mar 1990 15:06:50
|
||||
* Release 2.00
|
||||
*
|
||||
* Rev 1.4 17 Mar 1989 21:41:28
|
||||
* Calls to memcpy/memset protected against zero lengths
|
||||
*
|
||||
* Rev 1.3 04 Mar 1989 10:35:34
|
||||
* Added cast to actual parameter on call to memcpy to avoid warnings on
|
||||
* some compilers.
|
||||
*
|
||||
* Rev 1.2 11 Jan 1989 12:46:44
|
||||
* Moved Clean_Obj_ID() to objectid.c
|
||||
*
|
||||
* Rev 1.1 14 Sep 1988 17:57:16
|
||||
* Moved includes of system include files into libfuncs.h.
|
||||
*
|
||||
* Rev 1.0 12 Sep 1988 10:47:04
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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/objectid.h>
|
||||
|
||||
/****************************************************************************
|
||||
NAME: build_object_id
|
||||
|
||||
PURPOSE: Build an object id structure
|
||||
|
||||
PARAMETERS:
|
||||
int Number of components in the old structure
|
||||
OIDC_T * List of components in the old structure
|
||||
OBJ_ID_T * The new Object Identifier structure
|
||||
|
||||
RETURNS: 0 if sucessful, -1 if not
|
||||
****************************************************************************/
|
||||
int
|
||||
build_object_id(int oldc,
|
||||
OIDC_T *oldl,
|
||||
OBJ_ID_T *new)
|
||||
{
|
||||
new->component_list = 0; /* Just in case the list is empty */
|
||||
|
||||
if ((new->num_components = oldc) != 0) {
|
||||
unsigned int need;
|
||||
|
||||
need = (unsigned int)(sizeof(OIDC_T) * new->num_components);
|
||||
if ((new->component_list = (OIDC_T *)SNMP_memory_alloc(need)) == 0)
|
||||
return -1;
|
||||
|
||||
if (need != 0)
|
||||
MEMCPY(new->component_list, oldl, need);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: Clean_Obj_ID
|
||||
|
||||
PURPOSE: Clean up an OBJ_ID_T structure
|
||||
|
||||
PARAMETERS: OBJ_ID_T *
|
||||
|
||||
RETURNS: Nothing
|
||||
****************************************************************************/
|
||||
void
|
||||
Clean_Obj_ID(OBJ_ID_T *objp)
|
||||
{
|
||||
if (objp->component_list != 0){
|
||||
SNMP_memory_free(objp->component_list);
|
||||
objp->component_list = 0;
|
||||
}
|
||||
objp->num_components = 0;
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
/* oid2ip.c - oid2ip.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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: oid2ip.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:18 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:21:56 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:17:39 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:28 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:54 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:49 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:10 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:14 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:50 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.0 1992/04/03 15:32:31 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 1.5 92/03/30 18:42:07 dab
|
||||
* checked in with -k by dab at 92.04.03.15.31.34.
|
||||
*
|
||||
* Revision 1.5 92/03/30 18:42:07 dab
|
||||
* Changed arguments so oid_to_ip() could return an error if the instance
|
||||
* wasn't legal for an IP address.
|
||||
*
|
||||
* Revision 1.4 92/02/05 16:58:19 dab
|
||||
* Added cast on assignment from OIDC_T to OCTET_T.
|
||||
*
|
||||
* Revision 1.3 91/11/03 09:52:42 dab
|
||||
* Forgot to increment a loop variable.
|
||||
*
|
||||
* Revision 1.2 91/10/30 20:38:40 dab
|
||||
* Directly include asn1conf.h and snmpdefs.h.
|
||||
*
|
||||
* Revision 1.1 91/10/30 18:12:45 dab
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains oid2ip.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/localio.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/decode.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* oid_to_ip - convert the encoded IP address in an object identifier
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int oid_to_ip
|
||||
* (
|
||||
* int count,
|
||||
* OIDC_T * object_id,
|
||||
* UINT_32_T * addr
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine converts the encoded IP address in the instance part of an
|
||||
* object identifier into an IP address.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <count>
|
||||
* Specify the number of octets in the object identifier occupied by IP address.
|
||||
* This value is usually 4. If it is less than 4, this routine zero-fills the
|
||||
* rest of the IP address.
|
||||
* \i <*object_id>
|
||||
* Specify an object ID.
|
||||
* \i <*addr>
|
||||
* Specify an IP Address.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If successful, this routine returns 0 and puts the IP address in
|
||||
* <*addr>. Otherwise, it returns 1.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: ip_to_llist(), ip_to_rlist()
|
||||
*/
|
||||
int
|
||||
oid_to_ip(int tcount,
|
||||
OIDC_T *tlist,
|
||||
UINT_32_T *addr)
|
||||
{
|
||||
union {
|
||||
UINT_32_T laddr;
|
||||
OCTET_T baddr[4];
|
||||
} ip_address;
|
||||
int i;
|
||||
|
||||
ip_address.laddr = 0;
|
||||
|
||||
if (tcount > 4)
|
||||
tcount = 4;
|
||||
|
||||
for (i = 0; tcount; tcount--, i++) {
|
||||
if (*tlist > 255)
|
||||
return 1; /* not a legal component for an IP address */
|
||||
ip_address.baddr[i] = (OCTET_T)*tlist++;
|
||||
}
|
||||
|
||||
*addr = ip_address.laddr;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
/* oid2str.c - oid2str.c routines */
|
||||
|
||||
/*
|
||||
* Copyright 2000-2010 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 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: oid2str.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:18 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:39 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:21:56 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:17:39 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:30 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 1.7 1998/09/04 15:11:06 sar
|
||||
* Added some casts to try and keep the msc compiler happy and not
|
||||
* complaining about signed/unsigned mismatches.
|
||||
*
|
||||
* Revision 1.6 1998/07/20 02:02:34 sar
|
||||
* Added a check to see if the subid is > 0xff in which case we
|
||||
* return an error
|
||||
*
|
||||
* Revision 1.5 1998/07/01 01:41:02 sar
|
||||
* make sure we have some subids before trying to read one
|
||||
*
|
||||
* Revision 1.4 1998/06/19 20:18:51 sar
|
||||
* Make all files include asn1conf.h and snmp.h to make sure we get the
|
||||
* common code
|
||||
*
|
||||
* Revision 1.3 1998/06/05 18:52:55 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 1.2 1998/05/23 20:32:06 sar
|
||||
* Correct copyright statement
|
||||
*
|
||||
* Revision 1.1 1998/05/22 19:48:33 sar
|
||||
* Routines for translating from an object id to a string and back.
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01f,10jun10,y_t update for LP64
|
||||
01e,12may05,job fix apigen comments
|
||||
01d,18apr05,job update copyright notices
|
||||
01c,04mar05,job apigen update
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains oid2str.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/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* oid_to_string - convert part of an object ID into a string
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int oid_to_string
|
||||
* (
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* ALENGTH_T * blen,
|
||||
* bits8_t * buffp,
|
||||
* int iflag
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine converts part of an object ID into a string reducing each sub ID
|
||||
* to a byte in the string.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <tcount>
|
||||
* Specify the length of the object ID pointed to by <tlist>.
|
||||
* \i <*tlist>
|
||||
* Specify the object identifier.
|
||||
* \i <blen>
|
||||
* On input, specifies the amount of space available in the buffer pointed to by
|
||||
* <buffp>. On output, it specifies the amount of space used by this string.
|
||||
* \i <*buffp>
|
||||
* Point to the string to be converted.
|
||||
* \i <iflag>
|
||||
* When zero (0), set <tcount> to the length of the string. Otherwise, the
|
||||
* length is the first sub ID.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If successful, this routine returns 0 and updates the value of
|
||||
* <blen>. If the required length exceeds the supplied buffer the routine, this
|
||||
* routine returns 1 and updates the value of <blen>. If the string length is
|
||||
* greater than <tcount> or a sub ID is larger than a byte (0xFF), this routine
|
||||
* returns -1.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: string_to_oid()
|
||||
*/
|
||||
int
|
||||
oid_to_string(int tcount,
|
||||
OIDC_T *tlist,
|
||||
ALENGTH_T *blen,
|
||||
bits8_t *buffp,
|
||||
int iflag)
|
||||
{
|
||||
int temp_tcount;
|
||||
|
||||
/* work out the length of the string and if necessary adjust the tlist ptr */
|
||||
if (iflag)
|
||||
temp_tcount = tcount;
|
||||
else {
|
||||
if ((tcount < 1) || (tlist[0] >= (OIDC_T)tcount))
|
||||
return(-1);
|
||||
temp_tcount = (int)tlist[0];
|
||||
tlist++;
|
||||
}
|
||||
|
||||
if ((bits32_t)temp_tcount > (bits32_t)(*blen)) {
|
||||
*blen = (ALENGTH_T)temp_tcount;
|
||||
return(1);
|
||||
}
|
||||
|
||||
for(*blen = (ALENGTH_T)temp_tcount; temp_tcount; temp_tcount--, buffp++, tlist++) {
|
||||
if (*tlist > 0xff)
|
||||
return(-1);
|
||||
*buffp = (bits8_t)((*tlist) & 0xff);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* string_to_oid - convert a string to an object ID
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int string_to_oid
|
||||
* (
|
||||
* ALENGTH_T blen,
|
||||
* bits8_t * buffp,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist,
|
||||
* int iflag
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine converts a string to an object ID. It converts each byte in the
|
||||
* string to a single sub ID in the object ID.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <blen>
|
||||
* Specify the length in bytes of the string pointed to by <buffp>.
|
||||
* \i <*buffp>
|
||||
* Point to the string to be converted.
|
||||
* \i <tcount>
|
||||
* Specify number of components available in the object Id pointed to by
|
||||
* <tlist>.
|
||||
* \i <*tlist>
|
||||
* Specify the object identifier.
|
||||
* \i <iflag>
|
||||
* Insert the length as the first sub ID of the instance when set to 0.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If successful, this routine returns 0. If <blen> is greater than
|
||||
* <tcount>, it is an error and this routine returns -1.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: oid_to_string()
|
||||
*/
|
||||
int
|
||||
string_to_oid(ALENGTH_T blen,
|
||||
bits8_t *buffp,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
int iflag)
|
||||
{
|
||||
|
||||
if (iflag == 0) {
|
||||
if ((bits32_t)tcount < (bits32_t)(blen + 1))
|
||||
return(-1);
|
||||
*tlist = blen;
|
||||
tlist++;
|
||||
}
|
||||
else {
|
||||
if ((bits32_t)tcount < (bits32_t)blen)
|
||||
return(-1);
|
||||
}
|
||||
|
||||
for(; blen; blen--, buffp++, tlist++)
|
||||
*tlist = *buffp;
|
||||
|
||||
return(0);
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
/* oidcmp.c - oidcmp.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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: oidcmp.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.3 2001/01/19 22:21:57 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:40 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:05 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:31 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:55 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:51 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:11 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:15 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:50 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.0 1992/04/03 19:53:01 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 1.1 92/02/04 10:49:08 dab
|
||||
* Initial revision
|
||||
*
|
||||
* Revision 1.1 91/11/04 15:10:55 dab
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains oidcmp.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/localio.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/decode.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* oidcmp - compare two objects identifiers of different lengths
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int oidcmp
|
||||
* (
|
||||
* int length_1,
|
||||
* OIDC_T * oid_1,
|
||||
* int length_2,
|
||||
* OIDC_T * oid_2
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine compares two objects identifiers that may or may not have the
|
||||
* same length.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <length_1>
|
||||
* Specify the length of the first object identifier.
|
||||
* \i <*oid_1>
|
||||
* Specify the first object identifier.
|
||||
* \i <length_2>
|
||||
* Specify the length of the second object identifier.
|
||||
* \i <*oid_2>
|
||||
* Specify the second object identifier.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If <oid1> is the same as <oid2>, this routine returns 1. Otherwise,
|
||||
* it returns 0.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: llist_cmp(), oidcmp2(), oidorder()
|
||||
*/
|
||||
int
|
||||
oidcmp(int tcount_1,
|
||||
OIDC_T *tlist_1,
|
||||
int tcount_2,
|
||||
OIDC_T *tlist_2)
|
||||
{
|
||||
if (tcount_1 != tcount_2)
|
||||
return 0;
|
||||
|
||||
while (tcount_1-- > 0) {
|
||||
if (*tlist_1++ != *tlist_2++)
|
||||
return 0; /* OIDs are different */
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
/* oidcmp2.c - oidcmp2.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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: oidcmp2.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:40 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:33 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:55 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:52 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:11 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:16 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:51 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.2 1994/03/08 18:02:30 dab
|
||||
* Mkae argument order consistent with oidcmp.
|
||||
*
|
||||
* Revision 4.1 1994/01/10 23:00:31 dab
|
||||
* taken from oidcmp.c
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains oidcmp2.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/localio.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/decode.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* oidcmp2 - compare any two objects identifiers
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int oidcmp2
|
||||
* (
|
||||
* int n1,
|
||||
* OIDC_T * idp1,
|
||||
* int n2,
|
||||
* OIDC_T * idp2
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine compares any two objects identifiers. This routine combines the
|
||||
* functions of both oidorder() and oidcmp().
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <n1>
|
||||
* Specify the length of the first object identifier
|
||||
* \i <*idp1>
|
||||
* Specify the first object identifier.
|
||||
* \i <n2>
|
||||
* Specify the length of the second object identifier.
|
||||
* \i <*idp2>
|
||||
* Specify the second object identifier.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If <idp1> is greater than <idp2>, this routine returns 1. If <idp1>
|
||||
* is less than <idp2>, it returns -1. If they are the same, it returns 0.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: llist_cmp(), oidcmp(), oidorder()
|
||||
*/
|
||||
int
|
||||
oidcmp2(int n1, OIDC_T *idp1, int n2, OIDC_T *idp2)
|
||||
{
|
||||
while ((n1 > 0) && (n2 > 0)) {
|
||||
if (*idp1 != *idp2)
|
||||
return (*idp1 < *idp2) ? -1 : 1;
|
||||
|
||||
idp1++; idp2++; n1--; n2--;
|
||||
}
|
||||
if (n1 == n2)
|
||||
return 0; /* OIDs are the same */
|
||||
else if (n1 > n2)
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
/* oidorder.c - oidorder.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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: oidorder.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:34 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:56 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:53 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:12 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50: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/15 22:21:24 sar
|
||||
* Updated revision to 7.0 and copyright to 96
|
||||
*
|
||||
* Revision 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:52 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.0 1992/04/03 15:57:40 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 1.3 92/04/03 13:53:01 dab
|
||||
* checked in with -k by dab at 92.04.03.15.57.02.
|
||||
*
|
||||
* Revision 1.2 92/03/30 18:42:41 dab
|
||||
* Don't convert OIDC_T's to signed and so lose a bit of range.
|
||||
*
|
||||
* Revision 1.1 91/11/04 15:10:55 dab
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains oidorder.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/localio.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/decode.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* oidorder - compare two object identifiers of the same length
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* int oidorder
|
||||
* (
|
||||
* OIDC_T * oid_1,
|
||||
* OIDC_T * oid_2,
|
||||
* int length
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine compares two object identifiers of the same length to determine
|
||||
* which is greater.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <*oid_1>
|
||||
* Specify the first object identifier.
|
||||
* \i <*oid_2>
|
||||
* Specify the second object identifier.
|
||||
* \i <length>
|
||||
* Specify the length of the object identifiers.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If <oid_1> is greater than <oid_2>, this routine returns 1. If
|
||||
* <oid_1> is less than <oid_2>, it returns -1. If they are the same, it returns
|
||||
* 0.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: llist_cmp(), oidcmp(), oidcmp2()
|
||||
*/
|
||||
int
|
||||
oidorder(OIDC_T *idp1, OIDC_T *idp2, int n)
|
||||
{
|
||||
while (n-- > 0) {
|
||||
if (*idp1 != *idp2)
|
||||
return (*idp1 < *idp2) ? -1 : 1;
|
||||
|
||||
idp1++; idp2++;
|
||||
}
|
||||
|
||||
return 0; /* OIDs are the same */
|
||||
}
|
||||
@@ -0,0 +1,560 @@
|
||||
/*
|
||||
* 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.c,v $
|
||||
* Revision 1.4 2003/01/15 14:05:06 josh
|
||||
* directory structure shifting
|
||||
*
|
||||
* Revision 1.3 2001/11/06 21:50:48 josh
|
||||
* second (and hopefully final) pass of new path hacking
|
||||
*
|
||||
* Revision 1.2 2001/11/06 21:20:19 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:41 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.5 2001/01/19 22:22:23 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.4 2000/03/17 00:19:15 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.3 1999/12/23 14:47:30 josh
|
||||
* cleaning up code per Shawn's comments -- removing extraneous
|
||||
* comments and doing proxy check before notify check
|
||||
*
|
||||
* Revision 9.2 1999/11/01 19:56:54 josh
|
||||
* cleaning up initializations to keep extra files out of code when not
|
||||
* in use
|
||||
*
|
||||
* Revision 9.1 1998/11/30 21:07:53 sar
|
||||
* Modified the timer code to use ENVOY_TIMER_32_Ts to make sure the 32 bit
|
||||
* ids are properly aligned and saved.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:51 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.4 1998/08/12 04:43:56 sar
|
||||
* Move the initialization routines around some in order to minimize
|
||||
* the amount of code that gets pulled in for init purposes.
|
||||
*
|
||||
* Revision 8.3 1998/06/05 18:53:16 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.2 1998/02/25 15:21:31 sra
|
||||
* Finish moving types.h, bug.h, and bugdef.h to common/h/.
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:52:14 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:54 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.5 1997/11/01 01:25:36 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.4 1997/10/22 03:10:29 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:45:58 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:06 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.4 1996/02/27 00:02:24 sar
|
||||
* Added test for large repsones to gets and get-nexts.
|
||||
*
|
||||
* Revision 6.3 1996/01/10 16:34:47 sar
|
||||
* proper cast of proxy routines
|
||||
*
|
||||
* Revision 6.2 1995/11/14 22:44:42 sar
|
||||
* Moved the translation routines to auxi/proxy_{v1 v2}
|
||||
*
|
||||
* Revision 6.1 1995/11/04 01:52:51 sar
|
||||
* Basically rebuilt the code, this was necessitated by the
|
||||
* demise of parties and the removal of the transport info
|
||||
* that parties had carried.
|
||||
* The proxy capability was also expanded to cover the v1 case
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:47:50 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.5 1995/05/23 23:23:14 sar
|
||||
* Clean up the response packet's ppc oids before overwriting tehm.
|
||||
*
|
||||
* Revision 1.4 1995/04/28 23:16:40 sar
|
||||
* Changed tow of the loops that walk a linked list to use ** to walk
|
||||
* down the links.
|
||||
*
|
||||
* Revision 1.3 1995/04/18 21:13:44 sar
|
||||
* Use the new lock macros, added code to determine where to send v2 traps
|
||||
* from a v1 soruce we are proxying for.
|
||||
*
|
||||
* Revision 1.2 1995/03/22 18:41:13 sar
|
||||
* We now test that the pcb_root points to something before trying to
|
||||
* use it as a pointer.
|
||||
* Changed the method for sending packets from io_complete to
|
||||
* ENVOY_Send_SNMP_Packet, to take advantage of the size checks.
|
||||
*
|
||||
* Revision 1.1 1995/03/21 00:09:23 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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/objectid.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/buildpkt.h>
|
||||
#include <wrn/wm/snmp/engine/snmpstat.h>
|
||||
#include <wrn/wm/snmp/engine/etimer.h>
|
||||
#include <wrn/wm/snmp/engine/wkobj.h>
|
||||
#include <wrn/wm/snmp/engine/proxy.h>
|
||||
|
||||
#include <wrn/wm/common/bug.h>
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_PROXY
|
||||
|
||||
extern PROXY_CB_T *pcb_root;
|
||||
extern UINT_32_T proxy_id;
|
||||
|
||||
void
|
||||
Clean_PCB(PROXY_CB_T *pcb)
|
||||
{
|
||||
EBufferClean(&pcb->community);
|
||||
SNMP_memory_free(pcb);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: SNMP_Proxy_Timer
|
||||
|
||||
PURPOSE: Routine to be called by the timer code to clean up the proxy
|
||||
list on timeouts. The cookie is the index into the proxy
|
||||
list we look up the index and remove the control block.
|
||||
|
||||
|
||||
PARAMETERS:
|
||||
struct envoy_timer * the timer control block
|
||||
void * the cookie pointer
|
||||
|
||||
RETURNS: void
|
||||
****************************************************************************/
|
||||
|
||||
void
|
||||
SNMP_Proxy_Timer(ENVOY_TIMER_T *tm,
|
||||
void *cookiep)
|
||||
{
|
||||
bits32_t reqid;
|
||||
PROXY_CB_T *pcb = 0, **pcbp;
|
||||
|
||||
reqid = ((ENVOY_TIMER_32_T *)cookiep)->id;
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_LOCK
|
||||
/* We don't have any good options if we can't get the lock.
|
||||
So we require the user to not do that, if they do we generate
|
||||
a bug report and if they don't handle that we return which is
|
||||
the least bad thing to do. */
|
||||
if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_ProxyLock)) {
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_FATAL, 0,
|
||||
(BUG_OUT, "SNMP_Proxy_Timer(): proxy lock is broken", 0));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
for(pcbp = &pcb_root; *pcbp; pcbp = &(*pcbp)->next)
|
||||
if ((*pcbp)->indx == reqid) {
|
||||
pcb = *pcbp;
|
||||
*pcbp = pcb->next;
|
||||
break;
|
||||
}
|
||||
|
||||
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_ProxyLock);
|
||||
|
||||
/* if we found a structure clean it up */
|
||||
if (pcb) {
|
||||
pcb->err_comp(&pcb->for_addr, &pcb->loc_addr, 1, pcb->async_cookie);
|
||||
Clean_PCB(pcb);
|
||||
}
|
||||
|
||||
SNMP_memory_free(cookiep);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: SNMP_Proxy_Request
|
||||
|
||||
PURPOSE: Provide proxy handling, we save state information and then
|
||||
call the routine supplied by the transport structure to
|
||||
do the actual proxy handling.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * Packet we're working on
|
||||
|
||||
RETURNS: void
|
||||
****************************************************************************/
|
||||
|
||||
void
|
||||
SNMP_Proxy_Request(SNMP_PKT_T *pktp)
|
||||
{
|
||||
PROXY_CB_T *pcb;
|
||||
ENVOY_TIMER_32_T *tm32;
|
||||
UINT_32_T pid, old_reqid;
|
||||
INT_32_T ttl;
|
||||
|
||||
/* Size checks. For sets and bulks we make sure that a response
|
||||
packet will be smaller than the current max packet, any size restrictions
|
||||
for other types will be handled by the packet sending routines. */
|
||||
|
||||
#if (INSTALL_ENVOY_SNMP_VERSION_2)
|
||||
if ((pktp->pdu_type == GET_BULK_REQUEST_PDU) &&
|
||||
(pktp->maxpkt < (25 + EBufferUsed(&pktp->community)))) {
|
||||
SGRPv2_INC_COUNTER(snmp_stats.snmpSilentDrops);
|
||||
pktp->error_complete(&pktp->pkt_src, &pktp->pkt_dst, 1,
|
||||
pktp->async_cookie);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((pktp->snmp_version != SNMP_VERSION_1) &&
|
||||
(pktp->pdu_type == SET_REQUEST_PDU) &&
|
||||
((SNMP_Bufsize_For_Packet(pktp) + 4) > pktp->maxpkt)) {
|
||||
ENVOY_Send_SNMP_Error_Packet(pktp, TOO_BIG, 0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Attempt to get the proxy id, we need to lock it (in a reentrent system)
|
||||
to make sure the proxy ids are unique */
|
||||
#if (INSTALL_ENVOY_SNMP_LOCK)
|
||||
if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_ProxyLock)) {
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT, "SNMP_Proxy_Request: proxy lock broken", 0));
|
||||
ENVOY_Send_SNMP_Error_Packet(pktp, GEN_ERR, 0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
pid = proxy_id++;
|
||||
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_ProxyLock);
|
||||
|
||||
/* save the old reqid for later and install the new reqid,
|
||||
then try and send the packet */
|
||||
old_reqid = pktp->pdu.std_pdu.request_id;
|
||||
pktp->pdu.std_pdu.request_id = pid;
|
||||
ttl = ((INT_32_T (*) __((SNMP_PKT_T *)))(pktp->proxy_routine))(pktp);
|
||||
|
||||
/* restore the old reqid in case we need to send an error packet */
|
||||
pktp->pdu.std_pdu.request_id = old_reqid;
|
||||
|
||||
/* If the proxy routine failed we send out an error */
|
||||
if (ttl < 0) {
|
||||
ENVOY_Send_SNMP_Error_Packet(pktp, GEN_ERR, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Acquire the space for the proxy state block and the timer block */
|
||||
if ((pcb = (PROXY_CB_T *)SNMP_memory_alloc(sizeof(PROXY_CB_T))) == 0) {
|
||||
ENVOY_Send_SNMP_Error_Packet(pktp, GEN_ERR, 0);
|
||||
return;
|
||||
}
|
||||
EBufferInitialize(&pcb->community);
|
||||
|
||||
tm32 = (ENVOY_TIMER_32_T *)SNMP_memory_alloc(sizeof(ENVOY_TIMER_32_T));
|
||||
if (tm32 == 0) {
|
||||
Clean_PCB(pcb);
|
||||
ENVOY_Send_SNMP_Error_Packet(pktp, GEN_ERR, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Move the community string from the packet structure
|
||||
to the proxy block structure. This code resets the
|
||||
packet flags to STATIC because the ownership now
|
||||
rests with the proxy block structure. */
|
||||
EBufferPreLoad(pktp->community.bflags, &pcb->community,
|
||||
EBufferStart(&pktp->community),
|
||||
EBufferUsed(&pktp->community));
|
||||
pktp->community.bflags = BFL_IS_STATIC;
|
||||
|
||||
pcb->indx = pid;
|
||||
pcb->reqid = old_reqid;
|
||||
MEMCPY(&pcb->loc_addr, &pktp->pkt_dst, sizeof(SNMPADDR_T));
|
||||
MEMCPY(&pcb->for_addr, &pktp->pkt_src, sizeof(SNMPADDR_T));
|
||||
pcb->io_comp = pktp->io_complete;
|
||||
pcb->err_comp = pktp->error_complete;
|
||||
pcb->async_cookie = pktp->async_cookie;
|
||||
pcb->maxpkt = pktp->maxpkt;
|
||||
pcb->pdu_type = pktp->pdu_type;
|
||||
pcb->original_version = pktp->snmp_version;
|
||||
|
||||
/* We need to get the proxy lock before trying to install the timer and pcb
|
||||
blocks into their proper lists */
|
||||
#if (INSTALL_ENVOY_SNMP_LOCK)
|
||||
if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_ProxyLock)) {
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT, "SNMP_Proxy_Request: proxy lock broken", 0));
|
||||
ENVOY_Send_SNMP_Error_Packet(pktp, GEN_ERR, 0);
|
||||
Clean_PCB(pcb);
|
||||
SNMP_memory_free(tm32);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* attempt to set up a timer to clean up the pcb if we don't get a response
|
||||
packet, if we can't set up the timer remove the pcb and send an error
|
||||
packet */
|
||||
envoy_tm_init(&(tm32->timer));
|
||||
tm32->id = pcb->indx;
|
||||
tm32->timer.cookie = tm32;
|
||||
tm32->timer.handler = SNMP_Proxy_Timer;
|
||||
if (envoy_tm_set(&(tm32->timer), ttl)) {
|
||||
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_ProxyLock);
|
||||
ENVOY_Send_SNMP_Error_Packet(pktp, GEN_ERR, 0);
|
||||
Clean_PCB(pcb);
|
||||
SNMP_memory_free(tm32);
|
||||
return;
|
||||
}
|
||||
|
||||
/* We have succeeded in building all the right structures, attach
|
||||
the pcb to the list */
|
||||
pcb->next = pcb_root;
|
||||
pcb_root = pcb;
|
||||
|
||||
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_ProxyLock);
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: SNMP_Proxy_Response
|
||||
|
||||
PURPOSE: Provide proxy handling, attempt to restore the saved state
|
||||
and transmit a response packet to the original request.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * Packet we're working on
|
||||
|
||||
RETURNS: 0 if successfully processed packet, 1 otherwise
|
||||
****************************************************************************/
|
||||
|
||||
int
|
||||
SNMP_Proxy_Response(SNMP_PKT_T *pktp)
|
||||
{
|
||||
PROXY_CB_T *pcb = 0, **pcbp;
|
||||
UINT_32_T reqid;
|
||||
ALENGTH_T pktsize;
|
||||
|
||||
/* Dig out the saved state, and prepare the response packet */
|
||||
reqid = pktp->pdu.std_pdu.request_id;
|
||||
|
||||
#if (INSTALL_ENVOY_SNMP_LOCK)
|
||||
if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_ProxyLock)) {
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT, "SNMP_Proxy_Response: proxy lock broken", 0));
|
||||
pktp->error_complete(&pktp->pkt_src, &pktp->pkt_dst, 1,
|
||||
pktp->async_cookie);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
for(pcbp = &pcb_root; *pcbp; pcbp = &(*pcbp)->next)
|
||||
if ((*pcbp)->indx == reqid) {
|
||||
pcb = *pcbp;
|
||||
*pcbp = pcb->next;
|
||||
break;
|
||||
}
|
||||
|
||||
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_ProxyLock);
|
||||
|
||||
/* if we didn't find any state drop the packet */
|
||||
if (pcb == 0) {
|
||||
pktp->error_complete(&pktp->pkt_src, &pktp->pkt_dst, 1,
|
||||
pktp->async_cookie);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Indicate that we are done with the addressing information
|
||||
from the respone packet */
|
||||
pktp->error_complete(&pktp->pkt_src, &pktp->pkt_dst, 0, pktp->async_cookie);
|
||||
|
||||
/* restore the state */
|
||||
pktp->pdu.std_pdu.request_id = pcb->reqid;
|
||||
MEMCPY(&pktp->pkt_dst, &pcb->loc_addr, sizeof(SNMPADDR_T));
|
||||
MEMCPY(&pktp->pkt_src, &pcb->for_addr, sizeof(SNMPADDR_T));
|
||||
pktp->io_complete = pcb->io_comp;
|
||||
pktp->error_complete = pcb->err_comp;
|
||||
pktp->async_cookie = pcb->async_cookie;
|
||||
pktp->maxpkt = pcb->maxpkt;
|
||||
pktp->pdu_type = pcb->pdu_type;
|
||||
pktp->snmp_version = pcb->original_version;
|
||||
|
||||
/* Clean up the current community string and then
|
||||
replace it with the saved community string */
|
||||
EBufferClean(&pktp->community);
|
||||
EBufferPreLoad(pcb->community.bflags, &pktp->community,
|
||||
EBufferStart(&pcb->community),
|
||||
EBufferUsed(&pcb->community));
|
||||
EBufferInitialize(&pcb->community);
|
||||
|
||||
/* we are done with the pcb so clean it up */
|
||||
Clean_PCB(pcb);
|
||||
|
||||
/* If the current packet doesn't have it we need to get the read lock */
|
||||
#if (INSTALL_ENVOY_SNMP_LOCK)
|
||||
if (pktp->lockflags == LOCK_NOLOCK) {
|
||||
if (ENVOY_SNMP_GET_READ_LOCK(SNMP_CoarseLock)) {
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT,
|
||||
"SNMP_Proxy_Response: coarse lock broken",
|
||||
0));
|
||||
pktp->error_complete(&pktp->pkt_src, &pktp->pkt_dst,
|
||||
1, pktp->async_cookie);
|
||||
return 1;
|
||||
}
|
||||
pktp->lockflags = LOCK_READ;
|
||||
pktp->coarse_lock = &SNMP_CoarseLock;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* determine if the packet is small enough to be sent out */
|
||||
pktsize = SNMP_Bufsize_For_Packet(pktp);
|
||||
if (pktsize > pktp->maxpkt) {
|
||||
switch (pktp->pdu_type) {
|
||||
case GET_REQUEST_PDU:
|
||||
case GET_NEXT_REQUEST_PDU:
|
||||
/* set up an alternate response, strip the vbl and
|
||||
tag it as too_big */
|
||||
Clean_vb_list(&pktp->pdu.std_pdu.std_vbl);
|
||||
pktp->pdu.std_pdu.std_vbl.vblist = 0;
|
||||
pktp->pdu.std_pdu.std_vbl.vbl_count = 0;
|
||||
pktp->pdu.std_pdu.error_status = TOO_BIG;
|
||||
pktp->pdu.std_pdu.error_index = 0;
|
||||
break;
|
||||
|
||||
#if (INSTALL_ENVOY_SNMP_VERSION_2)
|
||||
case GET_BULK_REQUEST_PDU:
|
||||
/* if we have a BULK request we may need to remove vbs to
|
||||
fit in to the maximum packet size */
|
||||
{
|
||||
int indx;
|
||||
VB_T *vbp;
|
||||
for (indx = pktp->pdu.std_pdu.std_vbl.vbl_count,
|
||||
vbp = pktp->pdu.std_pdu.std_vbl.vblist + indx - 1;
|
||||
indx;
|
||||
indx--, vbp--) {
|
||||
Clean_vb(vbp);
|
||||
/* Recalculate the pktsize, 2 is for the tag and length
|
||||
fields, the length field may be greater than 1 but
|
||||
that is ok, the only thing that will happen is we
|
||||
may put less than the maximum in a buffer */
|
||||
pktsize -= 2 + vbp->vb_seq_size;
|
||||
if (pktsize < pktp->maxpkt) {
|
||||
pktp->pdu.std_pdu.std_vbl.vbl_count = indx - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif /* #if (INSTALL_ENVOY_SNMP_VERSION_2) */
|
||||
}
|
||||
}
|
||||
|
||||
ENVOY_Send_SNMP_Packet(pktp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: SNMP_Proxy_Traps_And_Reports
|
||||
|
||||
PURPOSE: Provide proxy handling for traps and reports
|
||||
Figure out if we have the information for a proxy
|
||||
event, if so ship the message onward if not tag
|
||||
the appropriate error. In any case indicate that
|
||||
we are finished with the packet and free it.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * Packet we're working on
|
||||
|
||||
RETURNS: void
|
||||
****************************************************************************/
|
||||
|
||||
void
|
||||
SNMP_Proxy_Traps_And_Reports(SNMP_PKT_T *pktp)
|
||||
{
|
||||
/* If we don't have a translation routine we bail out */
|
||||
if (pktp->proxy_routine == 0) {
|
||||
pktp->error_complete(&pktp->pkt_src, &pktp->pkt_dst,
|
||||
1, pktp->async_cookie);
|
||||
return;
|
||||
}
|
||||
|
||||
/* If the current packet doesn't have it we need to get the read lock */
|
||||
#if (INSTALL_ENVOY_SNMP_LOCK)
|
||||
if (pktp->lockflags == LOCK_NOLOCK) {
|
||||
if (ENVOY_SNMP_GET_READ_LOCK(SNMP_CoarseLock)) {
|
||||
BUG(BUG_ENVOY_LOCKING, BUG_CONTINUABLE, 0,
|
||||
(BUG_OUT,
|
||||
"SNMP_Proxy_Traps_and_Reports: coarse lock broken",
|
||||
0));
|
||||
pktp->error_complete(&pktp->pkt_src, &pktp->pkt_dst,
|
||||
1, pktp->async_cookie);
|
||||
return;
|
||||
}
|
||||
pktp->lockflags = LOCK_READ;
|
||||
pktp->coarse_lock = &SNMP_CoarseLock;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((((INT_32_T (*) __((SNMP_PKT_T *)))(pktp->proxy_routine))(pktp)) < 0)
|
||||
pktp->error_complete(&pktp->pkt_src, &pktp->pkt_dst, 1,
|
||||
pktp->async_cookie);
|
||||
else
|
||||
pktp->error_complete(&pktp->pkt_src, &pktp->pkt_dst, 0,
|
||||
pktp->async_cookie);
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* INSTALL_ENVOY_SNMP_PROXY */
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* 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 notices
|
||||
01a,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_Translation
|
||||
|
||||
PURPOSE: 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 on
|
||||
|
||||
RETURNS: 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 */
|
||||
|
||||
@@ -0,0 +1,371 @@
|
||||
/*
|
||||
* 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_v2.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:20 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:36 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:56 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:13 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:19 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 notices
|
||||
01a,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/objectid.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/buildpkt.h>
|
||||
#include <wrn/wm/snmp/engine/wkobj.h>
|
||||
#include <wrn/wm/snmp/engine/proxy_tr.h>
|
||||
|
||||
/* We include the proxy translation routine if we install v2 and
|
||||
the v1 to v2 trap routine if v1 is installed as well */
|
||||
|
||||
#if (INSTALL_ENVOY_SNMP_PROXY && INSTALL_ENVOY_SNMP_VERSION_2)
|
||||
|
||||
static OIDC_T csoidc[] = {SNMP_COLDSTART};
|
||||
static OIDC_T wsoidc[] = {SNMP_WARMSTART};
|
||||
static OIDC_T ldoidc[] = {SNMP_LINKDOWN};
|
||||
static OIDC_T luoidc[] = {SNMP_LINKUP};
|
||||
static OIDC_T afoidc[] = {SNMP_AUTHENTICATIONFAILURE};
|
||||
static OIDC_T egoidc[] = {SNMP_EGPNEIGHBORLOSS};
|
||||
static OIDC_T stoidc[] = {SNMP_SNMPTRAPOID, 0};
|
||||
static OIDC_T sysupoidc[] = {1, 3, 6, 1, 2, 1, 1, 3, 0};
|
||||
static OIDC_T enteroidc[] = {SNMP_SNMPTRAPENTERPRISE, 0};
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
/****************************************************************************
|
||||
NAME: SNMP_Proxy_Trap_V1_To_V2
|
||||
|
||||
PURPOSE: Translate a v1 trap to a v2 trap, encode it
|
||||
and call the proxy transport routine to send it.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * Packet we're working on
|
||||
|
||||
RETURNS: 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 (indeed this one
|
||||
doesn't expect a response).
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
INT_32_T
|
||||
SNMP_Proxy_Trap_V1_To_V2(SNMP_PKT_T *v1_pkt)
|
||||
{
|
||||
PROXY_BLOCK_T *pblockp;
|
||||
SNMP_PKT_T *v2_pkt;
|
||||
VB_T *vbp;
|
||||
OBJ_ID_T *eoid;
|
||||
OIDC_T *tempoidc;
|
||||
EBUFFER_T ebuf;
|
||||
INT_32_T eflag;
|
||||
int incount, outcount, tempcount, free_tempoidc = 0, i;
|
||||
|
||||
pblockp = (PROXY_BLOCK_T *)(v1_pkt->user_private);
|
||||
incount = v1_pkt->pdu.trap_pdu.trap_vbl.vbl_count;
|
||||
outcount = incount + 3;
|
||||
|
||||
/* Attempt to allocate a new packet */
|
||||
if ((v2_pkt = SNMP_Create_Request2(TRAP2_PDU, SNMP_VERSION_2,
|
||||
EBufferUsed(&pblockp->community),
|
||||
(char *)EBufferStart(&pblockp->community),
|
||||
0, outcount, 0, 0)) == 0)
|
||||
return(-1);
|
||||
|
||||
/* we may use the enterprise oid several times so get a pointer */
|
||||
eoid = &v1_pkt->pdu.trap_pdu.enterprise_objid;
|
||||
|
||||
/* copy sysuptime into the first varbind */
|
||||
if (SNMP_Bind_Timeticks(v2_pkt, 0, sizeof(sysupoidc)/sizeof(OIDC_T),
|
||||
sysupoidc, v1_pkt->pdu.trap_pdu.trap_time_ticks)) {
|
||||
SNMP_Free(v2_pkt);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* work out the snmptrapoid and put it into the second varbind */
|
||||
switch (v1_pkt->pdu.trap_pdu.generic_trap) {
|
||||
case COLD_START:
|
||||
tempoidc = csoidc;
|
||||
tempcount = sizeof(csoidc)/sizeof(OIDC_T);
|
||||
break;
|
||||
case WARM_START:
|
||||
tempoidc = wsoidc;
|
||||
tempcount = sizeof(wsoidc)/sizeof(OIDC_T);
|
||||
break;
|
||||
case LINK_DOWN:
|
||||
tempoidc = ldoidc;
|
||||
tempcount = sizeof(ldoidc)/sizeof(OIDC_T);
|
||||
break;
|
||||
case LINK_UP:
|
||||
tempoidc = luoidc;
|
||||
tempcount = sizeof(luoidc)/sizeof(OIDC_T);
|
||||
break;
|
||||
case AUTH_FAILURE:
|
||||
tempoidc = afoidc;
|
||||
tempcount = sizeof(afoidc)/sizeof(OIDC_T);
|
||||
break;
|
||||
case EGP_NEIGHBOR_LOSS:
|
||||
tempoidc = egoidc;
|
||||
tempcount = sizeof(egoidc)/sizeof(OIDC_T);
|
||||
break;
|
||||
case ENTERPRISE_SPECIFIC:
|
||||
tempcount = eoid->num_components + 2;
|
||||
tempoidc = (OIDC_T *)SNMP_memory_alloc(sizeof(OIDC_T) * tempcount);
|
||||
if (tempoidc == 0) {
|
||||
SNMP_Free(v2_pkt);
|
||||
return(-1);
|
||||
}
|
||||
free_tempoidc = 1;
|
||||
MEMCPY(tempoidc, eoid->component_list,
|
||||
sizeof(OIDC_T) * (tempcount - 2));
|
||||
tempoidc[tempcount - 2] = 0;
|
||||
tempoidc[tempcount - 1] = v1_pkt->pdu.trap_pdu.specific_trap;
|
||||
break;
|
||||
default:
|
||||
SNMP_Free(v2_pkt);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
eflag = (INT_32_T)SNMP_Bind_Object_ID(v2_pkt, 1, sizeof(stoidc)/sizeof(OIDC_T),
|
||||
stoidc, tempcount, tempoidc);
|
||||
if (free_tempoidc)
|
||||
SNMP_memory_free(tempoidc);
|
||||
if (eflag) {
|
||||
SNMP_Free(v2_pkt);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* copy the vblist into the third through outcount - 2 */
|
||||
for (vbp = v1_pkt->pdu.trap_pdu.trap_vbl.vblist, i = 2;
|
||||
incount;
|
||||
incount--, i++, vbp++) {
|
||||
switch(vbp->vb_data_flags_n_type) {
|
||||
case VT_NUMBER:
|
||||
if (SNMP_Bind_Integer(v2_pkt, i,
|
||||
vbp->vb_obj_id.num_components,
|
||||
vbp->vb_obj_id.component_list,
|
||||
vbp->value_u.v_number)) {
|
||||
SNMP_Free(v2_pkt);
|
||||
return(-1);
|
||||
}
|
||||
break;
|
||||
case VT_COUNTER:
|
||||
case VT_GAUGE:
|
||||
case VT_TIMETICKS:
|
||||
if (SNMP_Bind_Unsigned_Integer(v2_pkt, i,
|
||||
vbp->vb_obj_id.num_components,
|
||||
vbp->vb_obj_id.component_list,
|
||||
vbp->vb_data_flags_n_type,
|
||||
vbp->value_u.v_counter)) {
|
||||
SNMP_Free(v2_pkt);
|
||||
return(-1);
|
||||
}
|
||||
break;
|
||||
case VT_IPADDRESS:
|
||||
if (SNMP_Bind_IP_Address(v2_pkt, i,
|
||||
vbp->vb_obj_id.num_components,
|
||||
vbp->vb_obj_id.component_list,
|
||||
vbp->value_u.v_network_address)) {
|
||||
SNMP_Free(v2_pkt);
|
||||
return(-1);
|
||||
}
|
||||
break;
|
||||
case VT_OBJECT:
|
||||
if (SNMP_Bind_Object_ID(v2_pkt, i,
|
||||
vbp->vb_obj_id.num_components,
|
||||
vbp->vb_obj_id.component_list,
|
||||
vbp->value_u.v_object.num_components,
|
||||
vbp->value_u.v_object.component_list)) {
|
||||
SNMP_Free(v2_pkt);
|
||||
return(-1);
|
||||
}
|
||||
break;
|
||||
case VT_STRING:
|
||||
case VT_OPAQUE:
|
||||
if (SNMP_Bind_String(v2_pkt, i,
|
||||
vbp->vb_obj_id.num_components,
|
||||
vbp->vb_obj_id.component_list,
|
||||
vbp->vb_data_flags_n_type,
|
||||
EBufferUsed(&vbp->value_u.v_string),
|
||||
EBufferStart(&vbp->value_u.v_string),
|
||||
0)) {
|
||||
SNMP_Free(v2_pkt);
|
||||
return(-1);
|
||||
}
|
||||
break;
|
||||
case VT_EMPTY:
|
||||
if (SNMP_Bind_Null(v2_pkt, i,
|
||||
vbp->vb_obj_id.num_components,
|
||||
vbp->vb_obj_id.component_list)) {
|
||||
SNMP_Free(v2_pkt);
|
||||
return(-1);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
SNMP_Free(v2_pkt);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
/* copy the enterprise information into the last var bind (outcount - 1) */
|
||||
if (SNMP_Bind_Object_ID(v2_pkt, outcount - 1, sizeof(enteroidc)/sizeof(OIDC_T),
|
||||
enteroidc, eoid->num_components,
|
||||
eoid->component_list)) {
|
||||
SNMP_Free(v2_pkt);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* So we have finally got the packet built, attempt to encode and send it */
|
||||
EBufferInitialize(&ebuf);
|
||||
eflag = (INT_32_T)SNMP_Encode_Packet(v2_pkt, &ebuf);
|
||||
SNMP_Free(v2_pkt);
|
||||
if (eflag)
|
||||
return(-1);
|
||||
eflag = pblockp->transport_routine(&ebuf, pblockp->transport_block);
|
||||
EBufferClean(&ebuf);
|
||||
return(eflag);
|
||||
}
|
||||
#endif /* #if INSTALL_ENVOY_SNMP_VERSION_1 */
|
||||
|
||||
/****************************************************************************
|
||||
NAME: SNMP_Proxy_V2_Translation
|
||||
|
||||
PURPOSE: Translate packets to v2 format then encode the packet and
|
||||
call the transport routine to send the byte string.
|
||||
Traps are changed to trap2s, all other pdus are
|
||||
unchanged
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * Packet we're working on
|
||||
|
||||
RETURNS: 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_V2_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 GET_BULK_REQUEST_PDU:
|
||||
case TRAP2_PDU:
|
||||
case INFORM_REQUEST_PDU:
|
||||
case REPORT_PDU:
|
||||
break;
|
||||
#if (INSTALL_ENVOY_SNMP_VERSION_1)
|
||||
case TRAP_PDU:
|
||||
return(SNMP_Proxy_Trap_V1_To_V2(pktp));
|
||||
#endif /* #if (INSTALL_ENVOY_SNMP_VERSION_1) */
|
||||
default:
|
||||
/* Unknown packet types */
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Save the version stamp and community string so we can restore
|
||||
them after we encode the packet, then replace them with version 2
|
||||
and the new community string */
|
||||
version = pktp->snmp_version;
|
||||
pktp->snmp_version = SNMP_VERSION_2;
|
||||
|
||||
/* 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_PROXY ...) */
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: proxyini.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:20 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:43 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.4 2001/01/19 22:22:23 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.3 2000/03/17 00:19:16 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.2 1999/11/01 19:56:54 josh
|
||||
* cleaning up initializations to keep extra files out of code when not
|
||||
* in use
|
||||
*
|
||||
* Revision 9.1 1999/11/01 15:03:49 josh
|
||||
* manually reinitialize globals on startup -- makes Envoy restartable
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:53 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.1 1998/08/12 04:43:57 sar
|
||||
* Move the initialization routines around some in order to minimize
|
||||
* the amount of code that gets pulled in for init purposes.
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1conf.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/proxy.h>
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_LOCK
|
||||
ENVOY_SNMP_LOCK(SNMP_ProxyLock);
|
||||
#endif
|
||||
|
||||
PROXY_CB_T *pcb_root = 0;
|
||||
UINT_32_T proxy_id = 0;
|
||||
|
||||
void
|
||||
envoy_proxy_init (void)
|
||||
{
|
||||
#if INSTALL_ENVOY_SNMP_LOCK
|
||||
ENVOY_SNMP_INIT_LOCK_TAG(SNMP_ProxyLock, SNMP_PROXYLOCK_TAG);
|
||||
#endif
|
||||
|
||||
pcb_root = 0;
|
||||
proxy_id = 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* 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 1993-1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: psosinit.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:20 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:44 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:22:14 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/04/05 19:07:45 josh
|
||||
* clearing up some warnings for pSOS+ 3.0
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:18:16 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:10:35 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 1.2 1998/06/15 18:21:19 josh
|
||||
* added copyright notices
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/* ************************************************************************
|
||||
*
|
||||
* snmpinit.c
|
||||
*
|
||||
* Implements SNMP_Init() needed for pSOS+/SNMP applications
|
||||
*
|
||||
* *********************************************************************** */
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1conf.h>
|
||||
#include <wrn/wm/snmp/engine/asn1.h>
|
||||
#include <wrn/wm/snmp/engine/localio.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/decode.h>
|
||||
#include <wrn/wm/snmp/engine/encode.h>
|
||||
#include <wrn/wm/snmp/engine/objectid.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/snmpstat.h>
|
||||
#include <wrn/wm/snmp/engine/wkobj.h>
|
||||
|
||||
/* Needed for the LOCK INIT routines */
|
||||
#include <psos.h>
|
||||
|
||||
#define SMVERSION "Envoy SNMP Version 9.1"
|
||||
|
||||
/* Global variable for storing SNMP library-wide information */
|
||||
int max_oid_count;
|
||||
int max_packet_size;
|
||||
|
||||
const char *sm_version = SMVERSION;
|
||||
|
||||
const char *sm_getvers(void);
|
||||
|
||||
|
||||
const char *
|
||||
sm_getvers()
|
||||
{
|
||||
return (sm_version);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* SNMP_Init: init all the statics requring initial values */
|
||||
/* INPUTS: */
|
||||
/* RETURNS: */
|
||||
/* OUTPUTS: */
|
||||
/* NOTE(S): */
|
||||
/************************************************************************/
|
||||
void SNMP_Init(snmp_cfg *scfgp)
|
||||
{
|
||||
|
||||
max_packet_size = scfgp->max_packet_size;
|
||||
max_oid_count = scfgp->max_oid_count;
|
||||
|
||||
envoy_init();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* 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 1993-1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: psosutil.c,v $
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:44 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.3 2001/01/19 22:22:14 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/04/05 19:07:46 josh
|
||||
* clearing up some warnings for pSOS+ 3.0
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:18:17 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:10:36 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 1.2 1998/06/15 18:21:20 josh
|
||||
* added copyright notices
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include "psos.h"
|
||||
|
||||
#define RN_WAIT 0x00000000 /* Wait for a segment */
|
||||
#define NULL 0
|
||||
|
||||
void *SNMP_memset(unsigned char *, unsigned char, unsigned long);
|
||||
void *SNMP_memcpy(unsigned char *, unsigned char *, long);
|
||||
|
||||
/************************************************************************/
|
||||
/* ChangeTaskPreemption: modify task's mode word */
|
||||
/* INPUTS: */
|
||||
/* RETURNS: */
|
||||
/* OUTPUTS: */
|
||||
/* NOTE(S): */
|
||||
/************************************************************************/
|
||||
unsigned long ChangeTaskPreemption(unsigned long nm)
|
||||
{
|
||||
unsigned long om;
|
||||
|
||||
t_mode(0x01, nm, &om);
|
||||
return om;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* RestoreTaskPreemption: restore task's mode word */
|
||||
/* INPUTS: */
|
||||
/* RETURNS: */
|
||||
/* OUTPUTS: */
|
||||
/* NOTE(S): */
|
||||
/************************************************************************/
|
||||
unsigned long RestoreTaskPreemption(unsigned long nm)
|
||||
{
|
||||
unsigned long om;
|
||||
|
||||
t_mode(0x01, nm, &om);
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
/* */
|
||||
/* FUNCTION MEMSET -- FILL MEMORY. */
|
||||
/* */
|
||||
/* void *memset (uchar *pt, uchar fill, ulong n ); */
|
||||
/* */
|
||||
/* This function fills n bytes with character 'fill' starting at */
|
||||
/* location pointed to by pt. */
|
||||
/* */
|
||||
/*********************************************************************/
|
||||
void *SNMP_memset(unsigned char *pt, unsigned char fill, unsigned long n)
|
||||
{
|
||||
unsigned char *str;
|
||||
|
||||
str = pt;
|
||||
while (n-- > 0)
|
||||
*(pt++) = fill;
|
||||
return(str);
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
/* */
|
||||
/* FUNCTION MEMCPY -- COPY FROM ONE BUFFER TO ANOTHER. */
|
||||
/* */
|
||||
/* void *memcpy (INT8 *mem1, INT8 *mem2, INT32 n); */
|
||||
/* */
|
||||
/* This function will copy n bytes from mem2 to mem1 regardless */
|
||||
/* of any control characters. If copying takes place between */
|
||||
/* objects that overlap, the behavior is undefined. */
|
||||
/* */
|
||||
/* The function returns a pointer to mem1. */
|
||||
/* */
|
||||
/*********************************************************************/
|
||||
void *SNMP_memcpy(unsigned char *mem1, unsigned char *mem2, long n)
|
||||
{
|
||||
unsigned char *str;
|
||||
|
||||
str = mem1;
|
||||
while (n--)
|
||||
*(mem1++) = *(mem2++);
|
||||
return(str);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,344 @@
|
||||
/*
|
||||
* 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: rcv_pkt.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:21 josh
|
||||
* revised new path hacking
|
||||
*
|
||||
* Revision 1.1.1.1 2001/11/05 17:47:43 tneale
|
||||
* Tornado shuffle
|
||||
*
|
||||
* Revision 9.2 2001/01/19 22:22:24 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:19:16 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:11:54 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:53:17 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:52:16 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:55 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.3 1997/10/16 23:51:49 sar
|
||||
* In async_compat_io the code included if SNMP_user_get_encode_buffer
|
||||
* was defined used the wrong name for the packet variable and attempted
|
||||
* to return an error value rather than saving it into the compatibility
|
||||
* block.
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:49:07 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.0 1995/05/31 21:47:52 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.3 1995/03/21 00:30:26 sar
|
||||
* Made Process_Received_SNMP_Packet into a glue routine, allowing
|
||||
* the user to continue using it for backwards compatibility. The real
|
||||
* work is done by the async processing routine.
|
||||
* Several other routines were written to provide the necessary async
|
||||
* functions.
|
||||
*
|
||||
* Revision 5.2 1994/07/29 18:05:34 sar
|
||||
* Replaced incrementing snmpInBadTypes with incrementing snmpInASNParseErrs.
|
||||
* Removed some casts of 0 as they aren't needed.
|
||||
*
|
||||
* Revision 5.1 1994/07/22 19:50:40 sar
|
||||
* Added a missing open bracket ({), at line 307.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:42:42 sar
|
||||
* Updated revision to 5.0 and copyright to include 1994
|
||||
*
|
||||
* Revision 4.2 1994/04/29 21:50:48 sar
|
||||
* Modified the party/context manipulation code to take advantage of
|
||||
* the oids stored in the packet structure.
|
||||
*
|
||||
* Revision 4.1 1993/09/30 20:35:37 sar
|
||||
* Corrected the couting of snmpOutGetResponses.
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:45:46 sar
|
||||
* Updated revision to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.12 1993/06/23 00:04:16 sar
|
||||
* Made ENABLE_PROXY be just PROXY in the install defs
|
||||
*
|
||||
* Revision 3.11 1993/06/07 18:26:04 sar
|
||||
* Modifed SNMP_Decode_Packet to be SNMP_Deocde_Packet_WER to allow
|
||||
* the decode routines to return an error (with error return) that
|
||||
* indicates the caller should send the packet back as a response.
|
||||
*
|
||||
* 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/05/03 17:16:12 sar
|
||||
* Added routines for local time, removed {party context} oids from packet
|
||||
* structure, added asn1len to {party context} structures and
|
||||
* SNMP_{Party Context}_Name where needed to lookup the name for a given
|
||||
* {Party Context}.
|
||||
*
|
||||
* Revision 3.8 1993/04/30 22:54:08 sar
|
||||
* Added mechanism for minimial proxies and coarse grained locks. The
|
||||
* latter required the addition of routines to get the name of a leaf given
|
||||
* a pointer to the leaf.
|
||||
*
|
||||
* Revision 3.7 1993/04/28 22:02:29 sar
|
||||
* started adding proxy capabilities.
|
||||
*
|
||||
* Revision 3.6 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.5 1993/03/05 03:58:02 dab
|
||||
* fixed up types
|
||||
*
|
||||
* Revision 3.4 1993/03/01 20:51:30 sar
|
||||
* moved some definitions to allow clean version 1 compiles.
|
||||
*
|
||||
* Revision 3.3 1993/02/26 17:33:20 sar
|
||||
* Before calling the set routine swap the src and dest party and oid info
|
||||
* so that the set will enocde the packet correctly.
|
||||
*
|
||||
* Revision 3.2 1993/02/24 01:02:41 sar
|
||||
* Changed many call to use OIDC_T/lenght pairs instead of OBJ_ID_T as now
|
||||
* we don't need to specifically allocate the OBJ_ID_T.
|
||||
* Removed the name objid from the PARTYLEAF_T as the name may be determined from
|
||||
* the tree itself. For efficiency purposes put the dest/src party names into
|
||||
* the pkt so we don't have to look them up frequently.
|
||||
*
|
||||
* Revision 3.1 1993/02/17 21:06:50 sar
|
||||
* Removed #define then and uses of it.
|
||||
* Updated stats to deal with v1 and v2 (or both or neither).
|
||||
* Updated ifdef compile for v1 or v2.
|
||||
* Updated to deal with v2 packets.
|
||||
*
|
||||
* Revision 3.0 92/04/03 19:52:37 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 2.103 91/10/30 20:42:08 dab
|
||||
* Directly include asn1conf.h, snmpdefs.h, and snmpstat.h (if needed).
|
||||
*
|
||||
* Revision 2.102 91/08/15 12:31:08 dab
|
||||
* Removed <libfuncs.h>.
|
||||
*
|
||||
* Revision 2.101 91/08/14 10:47:26 dab
|
||||
* Added trace functions that Karl put in as macros.
|
||||
*
|
||||
* Revision 2.100 91/08/09 14:08:24 dab
|
||||
* Update version.
|
||||
*
|
||||
* Revision 1.1 91/07/30 02:23:48 romkey
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
* Rev 2.0 31 Mar 1990 15:06:52
|
||||
* Release 2.00
|
||||
*
|
||||
* Rev 1.9 14 Dec 1989 16:00:54
|
||||
* Added support for Borland Turbo C compiler
|
||||
*
|
||||
* Rev 1.8 27 Apr 1989 15:56:28
|
||||
* Removed unused variables
|
||||
*
|
||||
* Rev 1.7 04 Mar 1989 13:22:58
|
||||
* When SNMP_Decode_Packet returned an error, an attempt was made to
|
||||
* free a non-existent packet structure, causing chaos.
|
||||
*
|
||||
* Rev 1.6 11 Jan 1989 12:27:40
|
||||
* Fix Process_Received_SNMP_Packet to reject any but REQUEST packets.
|
||||
*
|
||||
* Rev 1.5 19 Sep 1988 17:26:44
|
||||
* Made changes to make the Sun C compiler happy.
|
||||
*
|
||||
* Rev 1.4 17 Sep 1988 20:41:54
|
||||
* A user-supplied routine is now called to generate the authentication
|
||||
* trap packet.
|
||||
*
|
||||
* Rev 1.3 17 Sep 1988 12:20:44
|
||||
* Moved packet validation macros out of rcv_pkt.c into libfuncs.h.
|
||||
*
|
||||
* Rev 1.2 15 Sep 1988 20:05:06
|
||||
* After parsing an erroneous packet, the packet structure was not being freed.
|
||||
*
|
||||
* 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 notices
|
||||
01a,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>
|
||||
|
||||
typedef struct COMPAT_BLOCK_S {
|
||||
int flags;
|
||||
EBUFFER_T *ebufp;
|
||||
} COMPAT_BLOCK_T;
|
||||
|
||||
/****************************************************************************
|
||||
NAME: async_compat_error
|
||||
|
||||
PURPOSE: An error completion routine for use with the backwards compatibility
|
||||
routine for Process_SNMP_Received_Packet. It puts the error
|
||||
code into a structure that the received packet specified as
|
||||
the private info. An error code of 0 indicates that there
|
||||
wasn't an error but the packet shouldn't be sent (most likely
|
||||
due to proxy processing).
|
||||
|
||||
PARAMETERS:
|
||||
SNMPADDR_T * Foreign address of packet
|
||||
SNMPADDR_T * Local address of packet
|
||||
int The error code
|
||||
PTR_T Pointer to private information block
|
||||
in this case a COMPAT_BLOCK_T.
|
||||
|
||||
RETURNS: nothing
|
||||
****************************************************************************/
|
||||
|
||||
void
|
||||
async_compat_error(SNMPADDR_T *for_addr,
|
||||
SNMPADDR_T *loc_addr,
|
||||
int ecode,
|
||||
PTR_T cookie)
|
||||
{
|
||||
if (ecode)
|
||||
((COMPAT_BLOCK_T *)cookie)->flags = -1;
|
||||
else
|
||||
((COMPAT_BLOCK_T *)cookie)->flags = 1;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: async_compat_io
|
||||
|
||||
PURPOSE: An io completion routine for use with the backwards compatibility
|
||||
routine for Process_SNMP_Received_Packet. It attempts to
|
||||
encode the packet into the ebuffer given to the received routine.
|
||||
It finds this ebuffer in the private information area. If
|
||||
the encode fails it puts an error code into the private area.
|
||||
|
||||
PARAMETERS:
|
||||
SNMPADDR_T * Foreign address of packet
|
||||
SNMPADDR_T * Local address of packet
|
||||
PTR_T Pointer to the packet structure
|
||||
ALENGTH_T Max space the packet will require
|
||||
PTR_T Pointer to private information block
|
||||
in this case a COMPAT_BLOCK_T.
|
||||
|
||||
RETURNS: nothing
|
||||
****************************************************************************/
|
||||
|
||||
void
|
||||
async_compat_io(SNMPADDR_T *for_addr,
|
||||
SNMPADDR_T *loc_addr,
|
||||
PTR_T pktp,
|
||||
ALENGTH_T need,
|
||||
PTR_T cookie)
|
||||
{
|
||||
SNMP_PKT_T *pkt = (SNMP_PKT_T *)pktp;
|
||||
EBUFFER_T *ebuffp;
|
||||
ebuffp = ((COMPAT_BLOCK_T *)cookie)->ebufp;
|
||||
|
||||
/* Give the user a chance to allocate space from other areas */
|
||||
#if defined(SNMP_user_get_encode_buffer)
|
||||
if (ebuffp->start_bp == 0)
|
||||
if (SNMP_user_get_encode_buffer(pkt, need, ebuffp) != 0) {
|
||||
((COMPAT_BLOCK_T *)cookie)->flags = -1;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Attempt to encode the packet into the buffer, note that the buf size
|
||||
required has already been worked out in need */
|
||||
if (SNMP_Process_Finish(pkt, ebuffp, need))
|
||||
((COMPAT_BLOCK_T *)cookie)->flags = -1;
|
||||
else
|
||||
((COMPAT_BLOCK_T *)cookie)->flags = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
NAME: Process_Received_SNMP_Packet
|
||||
|
||||
PURPOSE: Manage the decoding of an incoming SNMP packet.
|
||||
|
||||
PARAMETERS:
|
||||
unsigned char * Address of the packet
|
||||
int length of the packet
|
||||
SNMPADDR_T * Source of the packet
|
||||
SNMPADDR_T * Destination of the packet (most likely
|
||||
the address of the machine on which this
|
||||
code is running.)
|
||||
EBUFFER_T * Buffer to hold any generated result packet.
|
||||
Space to hold the packet will be allocated if
|
||||
necessary.
|
||||
The EBUFFER_T structure must have been initialized
|
||||
using EBufferInitialize() or been setup using
|
||||
EBufferSetup().
|
||||
|
||||
RETURNS: int 0: A good response of some type is in the result
|
||||
buffer.
|
||||
-1: An error, the result buffer contents should be
|
||||
discarded.
|
||||
1: No error and no response packet, this may occur
|
||||
if a proxy routine is called and chooses to send
|
||||
a packet itself (perhaps to the final target)
|
||||
NOTE: The result packet may be any valid SNMP response packet.
|
||||
****************************************************************************/
|
||||
|
||||
int
|
||||
Process_Received_SNMP_Packet(unsigned char * pktp,
|
||||
int pktl,
|
||||
SNMPADDR_T * pktsrc,
|
||||
SNMPADDR_T * pktdst,
|
||||
EBUFFER_T * rebuffp)
|
||||
{
|
||||
COMPAT_BLOCK_T cblock;
|
||||
ALENGTH_T pktsize;
|
||||
|
||||
cblock.flags = 0;
|
||||
cblock.ebufp = rebuffp;
|
||||
|
||||
if ((pktsize = EBufferRemaining(rebuffp)) == 0)
|
||||
pktsize = SNMP_MAX_PACKET_SIZE;
|
||||
|
||||
Process_Rcvd_SNMP_Packet_Async((size_t)pktl, (bits8_t *)pktp, pktsrc,
|
||||
pktdst, pktsize, async_compat_io,
|
||||
async_compat_error, (PTR_T)&cblock);
|
||||
return(cblock.flags);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,307 @@
|
||||
/* row.c - row.c routines */
|
||||
|
||||
/*
|
||||
* Copyright 2000-2010 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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: row.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:21 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:42 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:06 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:37 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/08 20:02:22 sar
|
||||
* Modify var bind check to make sure we have a leaf and to check
|
||||
* all of the flags before the oid compare
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:57 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:57 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:13 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.3 1997/03/20 06:50:20 sra
|
||||
* DFARS-safe copyright text. Zap!
|
||||
*
|
||||
* Revision 7.2 1997/02/25 10:49:26 sra
|
||||
* Update copyright notice, dust under the bed.
|
||||
*
|
||||
* Revision 7.1 1996/10/06 03:46:13 sar
|
||||
* Corrected ending condition in scan_vb_for_leaf, switched from
|
||||
* vbl_count to vbl_count - 1
|
||||
*
|
||||
* Revision 7.0 1996/03/15 22:21:24 sar
|
||||
* Updated revision to 7.0 and copyright to 96
|
||||
*
|
||||
* Revision 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:52 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.1 1995/03/16 21:13:45 sar
|
||||
* Modified internal calls to use a var bind pointer instead of an index.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.4 1993/06/02 23:07:24 dab
|
||||
* Changed #ifdef's to #if's for things from install.h
|
||||
*
|
||||
* Revision 3.3 1993/04/27 20:52:51 sar
|
||||
* moved index_to_vbp to snmp/buildpkt.c (where a copy already existed).
|
||||
* updated the makefile to ignore indx_vbp.c.
|
||||
* update row.c to use buildpkt.h to find index_to_vbp.
|
||||
*
|
||||
* Revision 3.2 1993/04/26 20:22:55 sar
|
||||
* Added ifdefs to allow clean version 1 or version 2 makes.
|
||||
*
|
||||
* Revision 3.1 1993/02/26 17:25:51 sar
|
||||
* made scan_for_leaf_and_match and scan_vb_for_leaf useable by outside
|
||||
* routines (removed the static declaration).\
|
||||
*
|
||||
* Revision 3.0 1992/04/03 19:53:01 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 1.6 92/03/31 12:23:55 dab
|
||||
* Changed flags in the create_row structure again.
|
||||
*
|
||||
* Revision 1.5 92/03/31 11:17:11 dab
|
||||
* Use flags in create_row structure instead of just needed field.
|
||||
*
|
||||
* Revision 1.4 92/03/26 15:08:00 dab
|
||||
* Fixed bug where scan_for_leaf_and_match went into an infinte loop if
|
||||
* it hit an error.
|
||||
*
|
||||
* Revision 1.3 92/03/05 16:37:25 romkey
|
||||
* corrected 'tatic' to 'static'
|
||||
*
|
||||
* Revision 1.2 92/02/27 16:48:56 dab
|
||||
* Changed to use MIBLEAF_T* instead of a locator value.
|
||||
*
|
||||
* Revision 1.1 91/11/06 14:42:36 dab
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01e,10jun10,y_t update for LP64
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,23feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains row.c routines.
|
||||
|
||||
INCLUDE FILES: snmp.h, auxfuncs.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/auxfuncs.h>
|
||||
|
||||
/* Scans the varbind list of the packet, starting at vb_index, looking for a
|
||||
* varbind that references the MIB node leaf. Returns a pointer to the
|
||||
* varbind or 0 if it doesn't find any. */
|
||||
VB_T *
|
||||
scan_vb_for_leaf(SNMP_PKT_T *pktp,
|
||||
VB_T *vbp,
|
||||
MIBLEAF_T *leaf)
|
||||
{
|
||||
VB_T *last_vbp;
|
||||
VBL_T *vblp;
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
if (pktp->pdu_type == TRAP_PDU)
|
||||
vblp = &(pktp->pdu.trap_pdu.trap_vbl);
|
||||
else
|
||||
#endif
|
||||
/* find the last vblp, which is always the one we are working on */
|
||||
for (vblp = &(pktp->pdu.std_pdu.std_vbl); vblp->vblp; vblp = vblp->vblp)
|
||||
;
|
||||
|
||||
for (last_vbp = &vblp->vblist[vblp->vbl_count - 1]; vbp <= last_vbp; vbp++) {
|
||||
if (vbp->vb_ml.ml_leaf == leaf)
|
||||
return vbp;
|
||||
}
|
||||
|
||||
return 0; /* Not found */
|
||||
}
|
||||
|
||||
/* Look for the varbind matching leaf node and also having the same instance
|
||||
* as tcount/tlist. */
|
||||
VB_T *
|
||||
scan_for_leaf_and_match(SNMP_PKT_T *pkt,
|
||||
VB_T *vbp,
|
||||
MIBLEAF_T *leaf,
|
||||
int tcount,
|
||||
OIDC_T *tlist)
|
||||
{
|
||||
|
||||
vbp--; /* set up vbp so scan_vb_for_leaf starts at vbp */
|
||||
|
||||
while (1) {
|
||||
vbp = scan_vb_for_leaf(pkt, vbp + 1, leaf);
|
||||
if (vbp == 0)
|
||||
return 0; /* we didn't find a match */
|
||||
/* Check the instance */
|
||||
if (((vbp->vb_flags & (VFLAG_SET_STARTED | VFLAG_SET_DONE |
|
||||
VFLAG_TEST_STARTED | VFLAG_TEST_DONE)) == 0) &&
|
||||
(tcount == vbp->vb_ml.ml_remaining_objid.num_components) &&
|
||||
(oidorder(vbp->vb_ml.ml_remaining_objid.component_list,
|
||||
tlist, tcount) == 0))
|
||||
return vbp;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* vb_extract_row - group similar 'VarBinds' to create a row in a table
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* struct create_row
|
||||
* {
|
||||
* MIBLEAF_T * leaf
|
||||
* OCTET_T flags;
|
||||
* }
|
||||
*
|
||||
* #define ROW_FLAG_NEEDED 0x01
|
||||
* #define ROW_FLAG_CALL_SET 0x02
|
||||
*
|
||||
* VB_T * vb_extract_row
|
||||
* (
|
||||
* SNMP_PKT_T * pktp,
|
||||
* int start_index,
|
||||
* int instance_length,
|
||||
* OIDC_T * instance,
|
||||
* int row_structure_length,
|
||||
* struct create_row * row
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine is often used by the 'testproc' routine to create a row in a
|
||||
* table. It scans the SNMP packet for all the pieces that go together. It
|
||||
* searches the 'VarBinds' in the packet for any 'VarBinds' that match the MIB
|
||||
* leaf pointer specified in the <row> array and <instance>.
|
||||
* This routine links the VarBinds from the first MIB leaf node in the row
|
||||
* array, marks them as tested and as already set, except for the first entry.
|
||||
* After this is done, Envoy only needs to call the set routine associated with
|
||||
* the first MIB leaf in the row array. If you want to call another entry\’s set
|
||||
* routine separately, set the entry\’s flag to ROW_FLAG_CALL_SET.
|
||||
*
|
||||
* \&NOTE: This routine is obsolete and maintained for backward compatibility.
|
||||
* Use group_by_getproc_and_instance() for new applications.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <leaf>
|
||||
* Specify a MIB leaf entry
|
||||
* \i <flags>
|
||||
* Indicate if this variable (column) in the table is required.
|
||||
* \i <*pktp>
|
||||
* Specify an SNMP packet.
|
||||
* \i <start_index>
|
||||
* Specify the first 'VarBind'. This 'VarBind' must be in the packet whether it
|
||||
* is marked as needed or not.
|
||||
* \i <instance_length>
|
||||
* Specify the length in bytes of <instance>.
|
||||
* \i <*instance>
|
||||
* Specify the instance to match.
|
||||
* \i <row_structure_length>
|
||||
* Specify the length of the <row> array.
|
||||
* \i <*row>
|
||||
* Specify a list of MIB leaf pointers referring to variables in the table.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If successful, this routine returns the first 'VarBind' in the
|
||||
* packet. If this routine does not find a matching 'VarBind' and the leaf is
|
||||
* flagged as 'ROW_FLAG_NEEDED' in the <row> array, it returns 0.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: group_by_getproc_and_instance(), vb_extract_row_loose()
|
||||
*/
|
||||
VB_T *
|
||||
vb_extract_row(SNMP_PKT_T *pkt,
|
||||
int start_indx,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
int row_len,
|
||||
struct create_row *row)
|
||||
{
|
||||
VB_T *start_vbp, *first_vb, *vbp;
|
||||
VB_T **vb_linkp;
|
||||
|
||||
/* set up the starting vbp */
|
||||
start_vbp = index_to_vbp(pkt, start_indx);
|
||||
|
||||
/* Look up the first one and set it up as the first in the linked
|
||||
* list and as the only one whos set method will be called. */
|
||||
first_vb = scan_for_leaf_and_match(pkt, start_vbp, row->leaf, tcount, tlist);
|
||||
if (first_vb == 0)
|
||||
return 0;
|
||||
first_vb->vb_link = 0;
|
||||
vb_linkp = &first_vb->vb_link;
|
||||
first_vb->vb_flags |= VFLAG_ALREADY_TEST;
|
||||
|
||||
/* Now get all the rest of the row, returning 0 if needed elements
|
||||
* are missing. */
|
||||
for (row++, row_len--; row_len; row++, row_len--) {
|
||||
vbp = scan_for_leaf_and_match(pkt, start_vbp, row->leaf, tcount, tlist);
|
||||
if (vbp != 0) {
|
||||
/* Link it in and mark it done. */
|
||||
vbp->vb_link = 0;
|
||||
*vb_linkp = vbp;
|
||||
vb_linkp = &vbp->vb_link;
|
||||
vbp->vb_flags = (OCTET_T)(vbp->vb_flags | (row->flags & ROW_FLAG_CALL_SET) ?
|
||||
VFLAG_ALREADY_TEST :
|
||||
VFLAG_ALREADY_TEST | VFLAG_ALREADY_SET);
|
||||
}
|
||||
else if (row->flags & ROW_FLAG_NEEDED)
|
||||
return 0; /* needed piece is missing */
|
||||
}
|
||||
|
||||
return first_vb;
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
/* row_get.c - row_get.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 1996-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: row_get.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:21 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:42 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:06 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:38 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/08 20:02:22 sar
|
||||
* Modify var bind check to make sure we have a leaf and to check
|
||||
* all of the flags before the oid compare
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:52:57 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:49:59 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:13 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:21 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 1996/01/05 18:58:29 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,16feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains row_get.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/vbdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* group_by_getproc_and_instance - group similar 'VarBinds'
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* void group_by_getproc_and_instance
|
||||
* (
|
||||
* SNMP_PKT_T * pktp,
|
||||
* VB_T * first_vbp,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine groups similar 'VarBinds'. Starting at <first_vbp>, it searches
|
||||
* the packet for any 'VarBinds' that match the 'getproc' pointer of <first_vbp>
|
||||
* and have an instance of <tcount> and <tlist> and it links all the 'VarBinds'
|
||||
* that match this criteria.
|
||||
*
|
||||
* \&NOTE: This routine does not set any flags in the 'VarBinds'. Your calling
|
||||
* routine must set the tested or set flags.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <*pktp>
|
||||
* Specify a packet.
|
||||
* \i <*first_vbp>
|
||||
* Specify the first 'VarBind' entry to use. If this value is 0, there are no
|
||||
* more 'VarBinds'.
|
||||
* \i <tcount>
|
||||
* Specify the component count of the object identifier of the 'VarBind'.
|
||||
* \i <*tlist>
|
||||
* Specify the components of the object identifier of the 'VarBind'.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: None.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: vb_extract_row(), vb_extract_row()
|
||||
*/
|
||||
void
|
||||
group_by_getproc_and_instance(SNMP_PKT_T *pktp,
|
||||
VB_T *first_vbp,
|
||||
int tcount,
|
||||
OIDC_T *tlist)
|
||||
{
|
||||
VBL_T *vblp;
|
||||
VB_T *last_vbp;
|
||||
VB_T *vbp;
|
||||
VB_T *list;
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
if (pktp->pdu_type == TRAP_PDU)
|
||||
vblp = &(pktp->pdu.trap_pdu.trap_vbl);
|
||||
else
|
||||
#endif
|
||||
/* find the last vblp, which is always the one we are working on */
|
||||
for (vblp = &(pktp->pdu.std_pdu.std_vbl); vblp->vblp; vblp = vblp->vblp)
|
||||
;
|
||||
|
||||
list = first_vbp;
|
||||
list->vb_link = 0;
|
||||
for (last_vbp = &vblp->vblist[vblp->vbl_count], vbp = first_vbp + 1;
|
||||
vbp < last_vbp; vbp++) {
|
||||
/* find varbinds with the same getproc which aren't already in use */
|
||||
if (vbp->vb_ml.ml_leaf &&
|
||||
((vbp->vb_flags & (VFLAG_SET_STARTED | VFLAG_SET_DONE |
|
||||
VFLAG_TEST_STARTED | VFLAG_TEST_DONE)) == 0) &&
|
||||
(vbp->vb_ml.ml_leaf->getproc == first_vbp->vb_ml.ml_leaf->getproc) &&
|
||||
(oidcmp2(tcount, tlist, vbp->vb_ml.ml_remaining_objid.num_components,
|
||||
vbp->vb_ml.ml_remaining_objid.component_list) == 0)) {
|
||||
/* link onto the list */
|
||||
list->vb_link = vbp;
|
||||
list = vbp;
|
||||
vbp->vb_link = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
/* rowloose.c - rowloose.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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: rowloose.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:21 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:06 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:41 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* 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:00 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:21 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:53 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.1 1995/03/16 21:13:45 sar
|
||||
* Modified internal calls to use a var bind pointer instead of an index.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 1.6 1993/05/14 15:19:18 sar
|
||||
* added header and log to the file.
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01d,12may05,job fix apigen comments
|
||||
01c,18apr05,job update copyright notices
|
||||
01b,23feb05,job apigen for documented APIs
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains rowloose.c routines.
|
||||
|
||||
INCLUDE FILES: snmp.h, auxfuncs.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/auxfuncs.h>
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* vb_extract_row_loose - group similar VarBinds in several packets to create a table row
|
||||
* SYNOPSIS
|
||||
*
|
||||
* \cs
|
||||
* VB_T * vb_extract_row_loose
|
||||
* (
|
||||
* SNMP_PKT_T * pktp,
|
||||
* int index,
|
||||
* MIBLEAF_T ** leaves,
|
||||
* int tcount,
|
||||
* OIDC_T * tlist
|
||||
* )
|
||||
* \ce
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* This routine implements a type of row create sets known as dribble creates.
|
||||
* In this situation, the management station splits the creation of a new table
|
||||
* entry into multiple packets. Unlike vb_extract_row(), vb_extract_row_loose()
|
||||
* does not guarantee that a specific item is in a packet. Starting at <index>,
|
||||
* this routine searched the 'VarBinds' in a packet for any 'VarBinds' that
|
||||
* match the MIB leaf pointer specified in the <leaves> array and instance
|
||||
* specified by <tcount> and <tlist>. It links all the 'VarBinds' that match
|
||||
* this criteria.
|
||||
* This routine does not set any flags in the 'VarBinds'. Your calling routine
|
||||
* must set the tested or set flags. For an example of how this routine is used,
|
||||
* see 'viewmth.c'.
|
||||
*
|
||||
* \&NOTE: This routine is obsolete and maintained for backward compatibility.
|
||||
* Use group_by_getproc_and_instance() for new applications.
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i <*pktp>
|
||||
* Specify an SNMP packet.
|
||||
* \i <index>
|
||||
* Specify the first 'VarBind'.
|
||||
* \i <**leaves>
|
||||
* Specify the MIB leaf pointer array.
|
||||
* \i <tcount>
|
||||
* Specify the component count of the object identifier of the 'VarBind'.
|
||||
* \i <*tlist>
|
||||
* Specify the components of the object identifier of the 'VarBind'.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: If successful, this routine returns the first 'VarBind' in the first
|
||||
* packet that matches the criteria. If this routine does not find a matching
|
||||
* 'VarBind', it returns 0.
|
||||
*
|
||||
* ERRNO: N/A
|
||||
*
|
||||
* SEE ALSO: group_by_getproc_and_instance(), vb_extract_row()
|
||||
*/
|
||||
VB_T *
|
||||
vb_extract_row_loose(SNMP_PKT_T *pktp,
|
||||
int indx,
|
||||
MIBLEAF_T **leaves,
|
||||
int tcount,
|
||||
OIDC_T *tlist)
|
||||
{
|
||||
VB_T *vbp, *startvbp = 0;
|
||||
|
||||
for(; *leaves != 0; leaves++) {
|
||||
vbp = index_to_vbp(pktp, indx);
|
||||
while((vbp = scan_for_leaf_and_match(pktp, vbp, *leaves, tcount, tlist))
|
||||
!= 0) {
|
||||
vbp->vb_link = startvbp;
|
||||
startvbp = vbp;
|
||||
vbp++;
|
||||
}
|
||||
}
|
||||
|
||||
return(startvbp);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Copyright 2000-2005, 2013 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
|
||||
-------------------
|
||||
01c,06aug13,bbz clear the med impact warning from prevent.pl(WIND00429583)
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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))
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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_int.c,v $
|
||||
* 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:44 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:43 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:18:53 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:03 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:15 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:23 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 6.0 1995/05/31 21:50:54 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.1 1995/03/08 23:08:05 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01c,18jun10,y_t update for LP64
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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_int_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;
|
||||
}
|
||||
|
||||
/* Set a 32-bit integer referenced by cookie, and save the old value
|
||||
in case we need to undo the set. */
|
||||
void
|
||||
set_int_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)));
|
||||
|
||||
*(INT_32_T *)(VB_TO_COOKIE(vbp)) = VB_GET_INT32(vbp);
|
||||
|
||||
undoproc_set(pktp, vbp, undo_int_async);
|
||||
setproc_good(pktp, vbp);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* 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_ui64.c,v $
|
||||
* 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.4 2001/01/19 22:21:59 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.3 2000/03/17 00:17:44 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.2 1999/05/24 20:12:07 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.1 1999/04/09 20:36:58 josh
|
||||
* Obsoleting ENVOY_SNMP_VERSON_USEC and ENVOY_40_VB_FREE_COMPAT
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:45 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:18:54 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:59 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:50:04 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:15 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:24 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 6.0 1995/05/31 21:50:54 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.1 1995/03/08 23:08:05 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1conf.h>
|
||||
#include <wrn/wm/snmp/engine/ui64.h>
|
||||
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
||||
#include <wrn/wm/snmp/engine/snmp.h>
|
||||
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
||||
|
||||
/* Routine to clean up the space allocated by the uint 64 test routine */
|
||||
void
|
||||
ui64_async_cleanup(PTR_T value)
|
||||
{
|
||||
SNMP_memory_free(((VB_T *)value)->vb_priv);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Undo the set, restore the information we saved to the vb_priv pointer
|
||||
during the test phase back to the cookie pointer */
|
||||
void
|
||||
ui64_async_undo(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
UI64_Copy((UINT_64_T *)(VB_TO_COOKIE(vbp)), (UINT_64_T *)vbp->vb_priv);
|
||||
SNMP_memory_free(vbp->vb_priv);
|
||||
vbp->vb_free_priv = 0;
|
||||
|
||||
undoproc_good(pktp, vbp);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Attempt to allocate space to save the current value in case an undo
|
||||
is required */
|
||||
void
|
||||
ui64_async_test(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
UINT_64_T *value;
|
||||
|
||||
if ((value = (UINT_64_T *)SNMP_memory_alloc(sizeof(UINT_64_T))) == 0) {
|
||||
testproc_error(pktp, vbp, RESOURCE_UNAVAILABLE);
|
||||
return;
|
||||
}
|
||||
|
||||
UI64_Copy(value, (UINT_64_T *)(VB_TO_COOKIE(vbp)));
|
||||
vbp->vb_priv = (PTR_T)value;
|
||||
vbp->vb_free_priv = ui64_async_cleanup;
|
||||
undoproc_set(pktp, vbp, ui64_async_undo);
|
||||
|
||||
testproc_good(pktp, vbp);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set 64-bit unsigned integer referenced by cookie. */
|
||||
void
|
||||
ui64_async_set(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
UI64_Copy((UINT_64_T *)(VB_TO_COOKIE(vbp)), VB_GET_UINT64(vbp));
|
||||
setproc_good(pktp, vbp);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* 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_uint.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:27 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:59 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.2 2000/03/17 00:17:45 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.1 1999/05/24 20:12:08 josh
|
||||
* 'compc' and 'compl' have been replaced by 'tcount' and 'tlist'
|
||||
* to avoid C++ compiler errors.
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:46 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.3 1998/06/19 20:18:55 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:59 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:50:08 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:16 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:25 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 6.0 1995/05/31 21:50:54 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 1.1 1995/03/08 23:08:05 sar
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,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_uint_async(OIDC_T lastmatch,
|
||||
int tcount,
|
||||
OIDC_T *tlist,
|
||||
SNMP_PKT_T *pktp,
|
||||
VB_T *vbp)
|
||||
{
|
||||
*(UINT_32_T *)(VB_TO_COOKIE(vbp)) = (UINT_32_T)vbp->vb_priv;
|
||||
undoproc_good(pktp, vbp);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set a 32-bit unsigned integer referenced by cookie, and save the old value
|
||||
in case we need to undo the set. */
|
||||
void
|
||||
set_uint_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)(*(UINT_32_T *)(VB_TO_COOKIE(vbp)));
|
||||
|
||||
*(UINT_32_T *)(VB_TO_COOKIE(vbp)) = VB_GET_UINT32(vbp);
|
||||
|
||||
undoproc_set(pktp, vbp, undo_uint_async);
|
||||
setproc_good(pktp, vbp);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* 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 1991-1997 Epilogue Technology Corporation.
|
||||
* Copyright 1998 Integrated Systems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: scan_loc.c,v $
|
||||
* Revision 1.2 2001/11/06 21:20:27 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:59 paul
|
||||
* Update copyright.
|
||||
*
|
||||
* Revision 9.1 2000/03/17 00:17:45 meister
|
||||
* Update copyright message
|
||||
*
|
||||
* Revision 9.0 1998/10/16 22:09:48 sar
|
||||
* Update version stamp to match release
|
||||
*
|
||||
* Revision 8.2 1998/06/05 18:53:00 sra
|
||||
* "#include <foo.h>" => "#include <envoy/h/foo.h>".
|
||||
*
|
||||
* Revision 8.1 1998/02/25 04:50:09 sra
|
||||
* Update copyrights.
|
||||
*
|
||||
* Revision 8.0 1997/11/18 00:56:16 sar
|
||||
* Updated revision to 8.0
|
||||
*
|
||||
* Revision 7.2 1997/03/20 06:50:26 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 6.1 1996/01/05 19:02:18 sar
|
||||
* Removed no_pp style definitions as well as unnecessary include files
|
||||
*
|
||||
* Revision 6.0 1995/05/31 21:50:55 sra
|
||||
* Release 6.0.
|
||||
*
|
||||
* Revision 5.0 1994/05/16 15:29:57 sar
|
||||
* Updated revision to 5.0 and copyright to 1994
|
||||
*
|
||||
* Revision 4.0 1993/06/24 15:58:43 sar
|
||||
* Updated rev to 4.0 and copyright to 93
|
||||
*
|
||||
* Revision 3.2 1993/06/02 23:07:24 dab
|
||||
* Changed #ifdef's to #if's for things from install.h
|
||||
*
|
||||
* Revision 3.1 1993/04/26 20:22:55 sar
|
||||
* Added ifdefs to allow clean version 1 or version 2 makes.
|
||||
*
|
||||
* Revision 3.0 1992/04/03 19:53:01 dab
|
||||
* Release 3.0
|
||||
*
|
||||
* Revision 1.2 91/10/30 20:38:41 dab
|
||||
* Directly include asn1conf.h and snmpdefs.h.
|
||||
*
|
||||
* Revision 1.1 91/10/24 11:09:05 dab
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
/* [clearcase]
|
||||
modification history
|
||||
-------------------
|
||||
01b,18apr05,job update copyright notices
|
||||
01a,24nov03,job update copyright information
|
||||
*/
|
||||
|
||||
#include <wrn/wm/snmp/engine/asn1conf.h>
|
||||
#include <wrn/wm/snmp/engine/asn1.h>
|
||||
#include <wrn/wm/snmp/engine/localio.h>
|
||||
#include <wrn/wm/snmp/engine/buffer.h>
|
||||
#include <wrn/wm/snmp/engine/decode.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/auxfuncs.h>
|
||||
|
||||
/****************************************************************************
|
||||
NAME: scan_vb_for_locator
|
||||
|
||||
PURPOSE: scan the VB list of a packet structure looking for a particular
|
||||
locator value.
|
||||
|
||||
PARAMETERS:
|
||||
SNMP_PKT_T * The whole received packet.
|
||||
int The index of the VB_T where to start the search
|
||||
(0 is the index of the first VB_T).
|
||||
UINT_16_T The desired locator.
|
||||
|
||||
RETURNS: int The index in the varBindList of the VB_T which
|
||||
references the MIB leaf with the specified locator.
|
||||
-1 if none are found.
|
||||
|
||||
CAVEAT: It is assumed that the vb_ml field of the various VB_Ts has been
|
||||
already set and has valid contents.
|
||||
|
||||
NOTE: It is possible for a VB list to have more VB_Ts which
|
||||
reference the same MIB leaf.
|
||||
|
||||
****************************************************************************/
|
||||
int
|
||||
scan_vb_for_locator(SNMP_PKT_T * pktp,
|
||||
int vb_index,
|
||||
UINT_16_T loc)
|
||||
{
|
||||
VB_T * vbp;
|
||||
VBL_T * vblp;
|
||||
|
||||
#if INSTALL_ENVOY_SNMP_VERSION_1
|
||||
if (pktp->pdu_type == TRAP_PDU)
|
||||
vblp = &(pktp->pdu.trap_pdu.trap_vbl);
|
||||
else
|
||||
#endif
|
||||
vblp = &(pktp->pdu.std_pdu.std_vbl);
|
||||
|
||||
for (vbp = &(vblp->vblist[vb_index]);
|
||||
vb_index < vblp->vbl_count;
|
||||
vb_index++, vbp++) {
|
||||
if ((vbp->vb_ml.ml_leaf)->locator == loc)
|
||||
return vb_index;
|
||||
}
|
||||
|
||||
return -1; /* Not found */
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user