📄 envoy.h
字号:
SNMP_NV_View_2275_Add_Mod(CUR, NEW, NV_MOD_DESTROY)#define SNMP_VIEW_2275_CREATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_View_2275_Add_Mod(CUR, NEW, 0)#define SNMP_VIEW_2275_UPDATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_View_2275_Add_Mod(CUR, NEW, 0)#define SNMP_VIEW_2275_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_VIEW_2275_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_VIEW_2275_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_VIEW_2275_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_VIEW_2275_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_VIEW_2275_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_VIEW_2275_FINISHED() SNMP_NV_Doit()#endif /* #if (INSTALL_ENVOY_SNMP_RFC2275_VIEWS) *//***************************************************************** If version 3 is installed we may need the following macros. ENVOY_TIME - returns a clock with a granularity of seconds PARAMETERS: none returns: bits32_t SNMP_validate_address This routine gives the user a chance to examine the address information as well as most of the packet itself before a v3 packet is processed. The routine must attach the address information to the packet. It may attach a non-default mib tree if desired. Note: in some error cases the packet will not be decoded when this routine is called. 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: 0 - ok 1 - failure, drop the packet Lastly are are a series of macros that will connect the method routines we supplied for the v3 tables to your non-volatile storage areas. You should consult the manuals for more information about these macros.*****************************************************************/#if INSTALL_ENVOY_SNMP_VERSION_3#include <wrn/wm/demo/nvutils.h>extern long time(long *);#define ENVOY_TIME() (time((long *) 0))extern int validate_SNMP_V3_address __((SNMP_PKT_T *, SNMPADDR_T *, SNMPADDR_T *));#define SNMP_validate_address(p, s, d) validate_SNMP_V3_address(p, s, d)#define SNMP_V3_GROUP_DESTROY_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_Group_Add_Mod(CUR, NEW, NV_MOD_DESTROY)#define SNMP_V3_GROUP_CREATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_Group_Add_Mod(CUR, NEW, 0)#define SNMP_V3_GROUP_UPDATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_Group_Add_Mod(CUR, NEW, 0)#define SNMP_V3_GROUP_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_GROUP_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_GROUP_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_GROUP_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_GROUP_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_GROUP_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_GROUP_FINISHED() SNMP_NV_Doit()#define SNMP_V3_ACCESS_DESTROY_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_Access_Add_Mod(CUR, NEW, NV_MOD_DESTROY)#define SNMP_V3_ACCESS_CREATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_Access_Add_Mod(CUR, NEW, 0)#define SNMP_V3_ACCESS_UPDATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_Access_Add_Mod(CUR, NEW, 0)#define SNMP_V3_ACCESS_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_ACCESS_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_ACCESS_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_ACCESS_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_ACCESS_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_ACCESS_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_ACCESS_FINISHED() SNMP_NV_Doit()#define SNMP_V3_USER_DESTROY_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_User_Add_Mod(CUR, NEW, NV_MOD_DESTROY)#define SNMP_V3_USER_CREATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_User_Add_Mod(CUR, NEW, 0)#define SNMP_V3_USER_UPDATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_User_Add_Mod(CUR, NEW, 0)#define SNMP_V3_USER_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_USER_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_USER_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_USER_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_USER_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_USER_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_USER_FINISHED() SNMP_NV_Doit()#define SNMP_V3_TADDR_DESTROY_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_TAddr_Add_Mod(CUR, NEW, NV_MOD_DESTROY)#define SNMP_V3_TADDR_CREATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_TAddr_Add_Mod(CUR, NEW, 0)#define SNMP_V3_TADDR_UPDATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_TAddr_Add_Mod(CUR, NEW, 0)#define SNMP_V3_TADDR_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_TADDR_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_TADDR_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_TADDR_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_TADDR_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_TADDR_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_TADDR_FINISHED() SNMP_NV_Doit()#define SNMP_V3_TPARAM_DESTROY_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_TParam_Add_Mod(CUR, NEW, NV_MOD_DESTROY)#define SNMP_V3_TPARAM_CREATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_TParam_Add_Mod(CUR, NEW, 0)#define SNMP_V3_TPARAM_UPDATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_TParam_Add_Mod(CUR, NEW, 0)#define SNMP_V3_TPARAM_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_TPARAM_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_TPARAM_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_TPARAM_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_TPARAM_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_TPARAM_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_TPARAM_FINISHED() SNMP_NV_Doit()#define SNMP_V3_NOTIFY_DESTROY_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_Notify_Add_Mod(CUR, NEW, NV_MOD_DESTROY)#define SNMP_V3_NOTIFY_CREATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_Notify_Add_Mod(CUR, NEW, 0)#define SNMP_V3_NOTIFY_UPDATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_Notify_Add_Mod(CUR, NEW, 0)#define SNMP_V3_NOTIFY_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_NOTIFY_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_NOTIFY_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_NOTIFY_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_NOTIFY_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_NOTIFY_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_NOTIFY_FINISHED() SNMP_NV_Doit()#define SNMP_V3_NPROF_DESTROY_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_NProf_Add_Mod(CUR, NEW, NV_MOD_DESTROY)#define SNMP_V3_NPROF_CREATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_NProf_Add_Mod(CUR, NEW, 0)#define SNMP_V3_NPROF_UPDATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_NProf_Add_Mod(CUR, NEW, 0)#define SNMP_V3_NPROF_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_NPROF_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_NPROF_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_NPROF_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_NPROF_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_NPROF_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_NPROF_FINISHED() SNMP_NV_Doit()#define SNMP_V3_NFILT_DESTROY_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_NFilt_Add_Mod(CUR, NEW, NV_MOD_DESTROY)#define SNMP_V3_NFILT_CREATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_NFilt_Add_Mod(CUR, NEW, 0)#define SNMP_V3_NFILT_UPDATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_NFilt_Add_Mod(CUR, NEW, 0)#define SNMP_V3_NFILT_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_NFILT_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_NFILT_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_NFILT_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_NFILT_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_NFILT_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_NFILT_FINISHED() SNMP_NV_Doit()#define SNMP_V3_PROXY_DESTROY_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_Proxy_Add_Mod(CUR, NEW, NV_MOD_DESTROY)#define SNMP_V3_PROXY_CREATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_Proxy_Add_Mod(CUR, NEW, 0)#define SNMP_V3_PROXY_UPDATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_V3_Proxy_Add_Mod(CUR, NEW, 0)#define SNMP_V3_PROXY_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_PROXY_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_PROXY_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_PROXY_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_PROXY_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_PROXY_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_PROXY_FINISHED() SNMP_NV_Doit()#define SNMP_V3_COMM_DESTROY_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_Community_Add_Mod(CUR, NEW, NV_MOD_DESTROY)#define SNMP_V3_COMM_CREATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_Community_Add_Mod(CUR, NEW, 0)#define SNMP_V3_COMM_UPDATE_TEST(PKT, VBP, CUR, NEW) \ SNMP_NV_Community_Add_Mod(CUR, NEW, 0)#define SNMP_V3_COMM_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_COMM_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_COMM_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean()#define SNMP_V3_COMM_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_COMM_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_COMM_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0)#define SNMP_V3_COMM_FINISHED() SNMP_NV_Doit()#if INSTALL_ENVOY_SNMP_V3_PROXY#if INSTALL_ATTACHEvoid envoy_snmp_send_proxy __((SNMPADDR_T *, SNMPADDR_T *, PTR_T, ALENGTH_T));#define ENVOY_SNMP_SEND_PROXY(FOR, LOC, PKT, SIZ) \ envoy_snmp_send_proxy((FOR), (LOC), (PKT), (SIZ))#endif#endif /* #if INSTALL_ENVOY_SNMP_V3_PROXY */#endif /* #if INSTALL_ENVOY_SNMP_VERSION_3 *//***************************************************************** If usec is installed we may need the following macros. NOTE WELL: usec was an experimental protocol for providing security to snmp. It has been superseeded by v3. It should not be used and will be removed in a future release. SNMP_USECTIME - returns a clock with a granularity of seconds*****************************************************************/#if (INSTALL_ENVOY_SNMP_VERSION_USEC)typedef long USECTIME_T;extern long time(long *);#define SNMP_USECTIME ((USECTIME_T)time((long *)0))#endif /* INSTALL_ENVOY_SNMP_VERSION_USEC *//*****************************************************************A macro for use with the epilogue master agent.*****************************************************************/#if (INSTALL_ENVOY_EPI_MASTER)#define SNMP_RESETSYSUPTIME#endif#if (INSTALL_ENVOY_AGENTX_MASTER) || (INSTALL_ENVOY_ENTITY_MIB)extern bits32_t envoy_get_sysuptime(void);#define ENVOY_GET_SYSUPTIME(CON) envoy_get_sysuptime()#endif /* #if (INSTALL_ENVOY_AGENTX_MASTER) || (INSTALL_ENVOY_ENTITY_MIB) *//***************************************************************** AgentX routines and macros for the master Defaults are fine for the following macros: #define ENVOY_AX_DEFAULT_TIMEOUT 1 #define ENVOY_AX_FIND_MIB(CONTEXT) (EBufferUsed(CONTEXT) ? 0 : &mib_root_node) #define ENVOY_AX_MA_AC_ADD(PKTP, MIBROOT) GEN_ERR #define ENVOY_AX_MA_AC_REMOVE(PKTP, MIBROOT) GEN_ERR #define ENVOY_AX_MA_AC_CLEAN(SESS_ID)*****************************************************************/#if INSTALL_ENVOY_AGENTX_MASTERextern sbits32_t envoy_ax_transport_type(ptr_t);extern int envoy_ax_transport_string(ptr_t, ALENGTH_T *, bits8_t **, int *);extern void envoy_ax_translate_context(SNMP_PKT_T *pktp, struct ENVOY_AX_PKT_S *query_pkt);#define ENVOY_AX_TRANSPORT_TYPE(COOKIE) envoy_ax_transport_type(COOKIE)#define ENVOY_AX_TRANSPORT_STRING(COOKIE, NEED, BUF, DYN) \ envoy_ax_transport_string(COOKIE, NEED, BUF, DYN)#define ENVOY_AX_TRANSPORTS_SUPPORTED {0}#define ENVOY_AX_TRANSLATE_CONTEXT(PKT, AX_PKT) \ envoy_ax_translate_context(PKT, AX_PKT)#endif /* #if INSTALL_ENVOY_AGENTX_MASTER */ /***************************************************************** AgentX routines and macros for the sub agent Defaults are fine for the following macros: #define ENVOY_AX_SA_MIB_ROOT_NODE(CKE, PKT) 0 #define ENVOY_AX_SA_TIMEOUT 1000*****************************************************************//***************************************************************** Lock Test Code: The following macros define a simple example to test the locking code. NOTE WELL: this code doesn't block and so is not acceptable for use as the locking code, it is only here for test purposes. A lock is 2 uints one for reading and one for writing. When a routine gets a lock the value is incremented by 1, when a routine frees a lock it is decremented by 1. We are allowing multiple readers and one writer. As this code can't block we simply return an error if we can't get a lock, real locking code must block in that case.*****************************************************************/#if (INSTALL_ENVOY_SNMP_LOCK)#define ENVOY_SNMP_LOCK(name) ENVOY_LOCK_T name = {0, 0}#define ENVOY_SNMP_LOCK_EXTERN(name) extern ENVOY_LOCK_T name#define ENVOY_SNMP_INIT_LOCK(name) ((name).readers = 0, (name).writers = 0)#define ENVOY_SNMP_GET_READ_LOCK(name) \ (((name).writers) ? 1 : ((name).readers++, 0))#define ENVOY_SNMP_RELEASE_READ_LOCK(name) ((name).readers--)#define ENVOY_SNMP_GET_WRITE_LOCK(name) \ (((name).readers || (name).writers) ? 1 : ((name).writers++, 0))#define ENVOY_SNMP_RELEASE_WRITE_LOCK(name) ((name).writers--)#endif /* (INSTALL_ENVOY_SNMP_LOCK) */#endif /* CONFIG_PREAMBLE */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -