📄 envoy.h
字号:
/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/isisnmp/envoy.h,v 1.2 2001/11/09 17:45:08 josh Exp $ *//* * Copyright (C) 1999-2004 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-1997 Epilogue Technology Corporation. * Copyright 1998 Integrated Systems, Inc. * All rights reserved. ****************************************************************************//* * $Log: envoy.h,v $ * Revision 1.2 2001/11/09 17:45:08 josh * pSOS-related path fixes * * Revision 1.1.1.1 2001/11/05 17:47:09 tneale * Tornado shuffle * * Revision 1.13.4.1 2001/09/21 18:30:06 josh * updating porting files with new information for proxy and * coexistence * * Revision 1.13 2001/01/19 22:22:57 paul * Update copyright. * * Revision 1.12 2000/06/09 14:57:35 josh * updating header files to correspond with new installation options and * new code * * Revision 1.11 2000/04/05 19:40:51 josh * clearing up some additional warnings for pSOS+ 3.0 * * Revision 1.10 2000/03/17 00:10:01 meister * Update copyright message * * Revision 1.9 1999/11/10 22:15:31 josh * adding support for the envoy_ax_translate_context userexit * * Revision 1.8 1999/11/10 18:28:05 josh * adding notification support to pSOS Envoy and fixing a few bugs * * Revision 1.7 1998/09/22 03:28:35 sar * correct a typo in a type * * Revision 1.6 1998/09/16 19:54:30 sar * Fixed up some user exits to allow binary customers a standard api * * Revision 1.5 1998/08/19 20:03:16 josh * removing extraneous () from things * * Revision 1.4 1998/08/13 22:56:05 josh * bringing in line with latest code changes * * Revision 1.3 1998/08/13 20:11:31 josh * updates for pSOS * * Revision 1.2 1998/06/28 21:18:28 josh * updating/bugfixing for SNMp * * Revision 1.1 1998/06/19 16:09:05 josh * port files for building SNMp * *//* [clearcase]modification history-------------------*/#if INSTALL_ON_ISIX86#ifndef NVRAM_START#define NVRAM_START 0xf000#endif#ifndef P386#define P386 1#endif#endif#ifdef CONFIG_PREAMBLE#include <string.h>extern void * SNMP_memory_alloc(int );extern void SNMP_memory_free(void *);/* pSOS port */extern int max_packet_size;extern int max_oid_count;extern int protect_critical_section;/*----------------------------------------------------------------------*//* To tailor snmp for different applications *//*----------------------------------------------------------------------*/typedef struct snmp_cfg { /*--------------------------------------------------------------------*/ /* Maximum snmp packet size this entity allows. */ /*--------------------------------------------------------------------*/ int max_packet_size; /*--------------------------------------------------------------------*/ /* Maximum number of oid components allowed in a valid object id. */ /*--------------------------------------------------------------------*/ int max_oid_count; /*--------------------------------------------------------------------*/ /* snmp enters critical section before the testproc and leaves it */ /* after it has returned from the setproc/getproc. Application should*/ /* indicate whether to turn off task preemption globally when entering*/ /* the critical section and to turn it back on at exit. If this is */ /* set to FALSE, then the testproc/setproc/getproc for each individual*/ /* mib object should properly implement the necessary locking */ /* mechanism to ensure the atomicity of the GET/SET operations. */ /*--------------------------------------------------------------------*/ int protect_critical_section; /* TRUE/FALSE */ } snmp_cfg;extern void SNMP_Init(snmp_cfg *);/* pSOS port *//*----------------------------------------------------------------------*//* locks for local databases access *//*----------------------------------------------------------------------*/typedef struct { unsigned char type; /* READLOCK or WRITELOCK */#define NO_LOCK 0x0#define READLOCK 0x1#define WRITELOCK 0x2 unsigned long sema; /* Semaphore id */ int count; /* how many readlocks obtained */ } LOCK_T;#define ENVOY_LOCK_T LOCK_T#else/* This first should be the same as DECORUM_MAX_PACKET_SIZE in decorum.h */#define SNMP_MAX_PACKET_SIZE max_packet_size#define SNMP_MIN_PACKET_SIZE 484#define MAX_OID_COUNT max_oid_count#define validate_SNMP_version(x) ((x) == SNMP_VERSION_1)extern int validate_SNMP_community __((SNMP_PKT_T *, SNMPADDR_T *, SNMPADDR_T *));/*---------------------------------------------------------------- SNMP_validate_community -- Check an operation against the community name. Parameters: SNMP_PKT_T *pkt The received packet (decoded format) SNMPADDR_T *src Source of the packet SNMPADDR_T *dst Destination of the packet (most likely the address of the machine on which this code is running.)Returns: This procedure should return 0 if happy with the community and 1 if not. This routine should fill in the packet structure with the mib view mask associated with the community string. This routine may hang additional data onto the "private" field of the packet structure. The user will be given the opportinity to release that memory via SNMP_release_private(). ----------------------------------------------------------------*/#define SNMP_validate_community(x, y, z) validate_SNMP_community(x,y,z)/*---------------------------------------------------------------- SNMP_release_private -- Get rid of a any private data attached to the packet structure. May be left undefined in which case nothing is done with the private field when the SNMP packet structure is freed. Parameters: SNMP_PKT_T *pkt The packet itself Returns: Nothing ----------------------------------------------------------------*/extern void release_private __((SNMP_PKT_T *));#define SNMP_release_private(pkt) release_private(pkt)/*---------------------------------------------------------------- SNMP_user_get_encode_buffer -- Allows the user the opportunity to get the buffer that the SNMP packet will be encoded into. If not used then leave undefined. Parameters: SNMP_PKT_T *pkt The packet being encoded. unsigned int need The amount of storage needed. EBUFFER_T *ebuffp The ebuffer to fill in with the actual buffer. Returns: 0 successful 1 not successful ----------------------------------------------------------------*/extern int user_get_encode_buffer(SNMP_PKT_T *, unsigned int, EBUFFER_T *);#define SNMP_user_get_encode_buffer(pkt, need, ebuffp) \ user_get_encode_buffer(pkt, need, ebuffp)/*---------------------------------------------------------------- SNMP_trace_input SNMP_trace_output -- for implementing packet tracing through the SNMP code. May not be left undefined but may instead be defined as nothing. Parameters: SNMP_PKT_T *pkt The packet being traced Returns: Nothing ----------------------------------------------------------------*/extern void TRACE_INPUT(SNMP_PKT_T *pkt);extern void TRACE_OUTPUT(SNMP_PKT_T *pkt);#define SNMP_TRACE_INPUT(pkt) TRACE_INPUT(pkt)#define SNMP_TRACE_OUTPUT(pkt) TRACE_OUTPUT(pkt)/***************************************************************** * The next series of macros are hooks into the processing of SET PDUs. * For most uses you should be able to leave these undefined. *****************************************************************//*---------------------------------------------------------------- SNMP_validate_set_pdu -- Perform a global validation of a SET PDU. Parameters: SNMP_PKT_T *pkt The packet itself Returns: -1 If the PDU is bad and should be rejected with a GEN_ERR. 0 If the PDU is good and normal handling should proceed. +1 If the PDU is good and this routine has performed all of the set operations internally. ----------------------------------------------------------------*/extern int validate_set_pdu(SNMP_PKT_T *pkt);#define SNMP_validate_set_pdu(pkt) validate_set_pdu(pkt)/*---------------------------------------------------------------- SNMP_user_pre_set -- Perform a global validation of a SET PDU after all of the test procedures have been called and given the "go ahead". Parameters: SNMP_PKT_T *pkt The packet itself Returns: -1 If the PDU is bad and should be rejected with a GEN_ERR. 0 If the PDU is good and normal handling should proceed. +1 If the PDU is good and this routine has performed all of the set operations internally. ----------------------------------------------------------------*/extern int user_pre_set(SNMP_PKT_T *pkt);#define SNMP_user_pre_set(pkt) user_pre_set(pkt)/*---------------------------------------------------------------- SNMP_user_post_set -- Perform any final activities after all of the set procedures have been called. Parameters: SNMP_PKT_T *pkt The packet itself Returns: Nothing
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -