📄 snmpdefs.h
字号:
/* various vb utility routines */extern int vbp_to_index_error __((SNMP_PKT_T *, VB_T *, int));extern VB_T * index_to_vbp __((SNMP_PKT_T *, int));extern VB_T * vblp_index_to_vbp __((VBL_T *, int));/* Return values from TEST routine */#define TPROC_GOOD 0#define TPROC_NOSUCH -1#define TPROC_GENERR -2#define TPROC_BADVALUE -3#define TPROC_READ_ONLY -4#define TPROC_TOO_BIG -5#define TPROC_NO_ACCESS -NO_ACCESS#define TPROC_WRONG_TYPE -WRONG_TYPE#define TPROC_WRONG_LENGTH -WRONG_LENGTH#define TPROC_WRONG_ENCODING -WRONG_ENCODING#define TPROC_WRONG_VALUE -WRONG_VALUE#define TPROC_NO_CREATION -NO_CREATION#define TPROC_INCONSISTENT_VALUE -INCONSISTENT_VALUE#define TPROC_RESOURCE_UNAVAILABLE -RESOURCE_UNAVAILABLE#define TPROC_COMMIT_FAILED -COMMIT_FAILED#define TPROC_UNDO_FAILED -UNDO_FAILED#define TPROC_AUTHORIZATION_ERROR -AUTHORIZATION_ERROR#define TPROC_NOT_WRITABLE -NOT_WRITABLE#define TPROC_INCONSISTENT_NAME -INCONSISTENT_NAME#define TPROC_LAST_ERROR -LAST_ERROR#define TPROC_BADVALUE_INDEX(I) (I + 1)#define TPROC_SET_ERROR(P, V, E) ((P)->pdu.std_pdu.error_index = \ (vbp_to_index_error(P, V, 1)),\ (P)->pdu.std_pdu.error_status = (sbits32_t)(E),\ TPROC_LAST_ERROR)#define SNMP_ERROR_INDEX(I) (I + 1)/* Defines for the security violations in the decode and auth code *//* Decode first */#define SNMP_DEC_VIO_UNKNOWN_DST 1#define SNMP_DEC_VIO_DST_NOTLOCAL 2#define SNMP_DEC_VIO_UNKNOWN_SRC 3#define SNMP_DEC_VIO_FAILED_VFY 4#define SNMP_DEC_VIO_UNKNOWN_CON 5#define SNMP_DEC_VIO_CON_NOTLOCAL 6#define SNMP_DEC_VIO_BAD_OPR1 7#define SNMP_DEC_VIO_BAD_OPR2 8#define SNMP_DEC_VIO_MAX 8/* auth next */#define SNMP_AUTH_VIO_LIFETIME 1#define SNMP_AUTH_VIO_FAILED_VFY 2/* Macros to manipulate Integers, Counters, and Gauges. *//* These assume that these are held as longs. *//* Integers are signed, counters and gauges are not. */#define inc_integer(I) ((I)++)#define dec_integer(I) ((I)--)#define add_integer(I,V) ((I) += (V))#define sub_integer(I,V) ((I) -= (V))/* Counter's can't be decremented */#define inc_counter(C) (C++)#define add_counter(C,V) (C += (V))/* Gauges latch at the maximum value */#define GGMAX ((bits32_t)0xFFFFFFFF)#define inc_gauge(G) ((bits32_t)(G) != GGMAX ? G++ : G)#define dec_gauge(G) ((bits32_t)(G) != GGMAX ? G-- : G)#define add_gauge(G,V) (G = \ (bits32_t)(V) > (GGMAX - (bits32_t)(G)) ? \ GGMAX : \ (bits32_t)(G) + (bits32_t)(V))#define sub_gauge(G,V) (G -= ((bits32_t)(G) != GGMAX ? (bits32_t)(V) : 0))/* error codes for certain decode routines, other return codes are in use by some of the routines so take care when adding to this list. (positive numbers are used by one routine) */#define DECODE_ASN_PARSE_ERROR -1#define DECODE_ALLOCATION_FAILURE -2#define DECODE_UNKNOWN_PDU_HANDLERS -3#define DECODE_UNKNOWN_CONTEXTS -4/* a definition of error returns, for more informative and useful functions. */enum envoy_err_e { ENVOY_ERR_INSUFFICIENT_MEMORY = -1, ENVOY_ERR_NOERR = 0, ENVOY_ERR_BAD_INSTANCE, ENVOY_ERR_EXISTS, ENVOY_ERR_LOCK_FAILED, ENVOY_ERR_NO_TARGET, ENVOY_ERR_UNKNOWN, ENVOY_ERR_NO_FORWARD, ENVOY_ERR_TOO_BIG, ENVOY_ERR_last_error };typedef enum envoy_err_e envoy_err_t;/* new abstract data types for use with MIB-based structures. currently, they're just wrappers, but this could change. */typedef bits16_t ETC_STORAGE_T;typedef bits16_t ETC_STATUS_T;#define SNMP_Decode_Packet(buf, len, saddr, daddr) \ SNMP_Decode_Packet_WER(buf, len, saddr, daddr, 0)extern void envoy_init __((void));extern void SNMP_Continue_function __((SNMP_PKT_T *pktp)); extern void process_packet_two __((PTR_T dptr));extern int Process_Received_SNMP_Packet __((unsigned char *, int, SNMPADDR_T *, SNMPADDR_T *, EBUFFER_T *));extern void Process_Rcvd_SNMP_Packet_Async __((size_t, bits8_t *, SNMPADDR_T *, SNMPADDR_T *, ALENGTH_T, IO_COMPLETE_T *, ERR_COMPLETE_T *, ptr_t));#define SNMP_Continue(PKTP) ((PKTP)->cont(PKTP))extern void Process_Internal_SNMP_Packet __((SNMP_PKT_T *));struct LCL_FILE_S;extern int SNMP_Decode_PDU __((SNMP_PKT_T *, struct LCL_FILE_S *)); extern SNMP_PKT_T * SNMP_Decode_Packet_WER __((unsigned char *, int, SNMPADDR_T *, SNMPADDR_T *, int *));extern SNMP_PKT_T * SNMP_Allocate __((void));extern void SNMP_Free __((SNMP_PKT_T *));extern void Initialize_Pkt __((SNMP_PKT_T *));extern bits32_t set_pdu_size __((SNMP_PKT_T *));extern void encode_snmp_normal_pdu __((SNMP_PKT_T *, EBUFFER_T *));extern ALENGTH_T SNMP_Bufsize_For_Packet __((SNMP_PKT_T *));extern int SNMP_Encode_Pkt_With_Siz __((SNMP_PKT_T *, EBUFFER_T *, ALENGTH_T));extern int SNMP_Encode_Packet __((SNMP_PKT_T *, EBUFFER_T *));extern int SNMP_Encode_Auth_Msg __((SNMP_PKT_T *, EBUFFER_T *));extern SNMP_PKT_T * _snmp_create_request(int);extern void branch_free(MIBNODE_T *, MIBNODE_T *);extern int _snmp_leaf_check(SNMP_PKT_T *, VB_T *, MIBLEAF_T *, OBJ_ID_T *, int rcount, int);#if (INSTALL_ENVOY_SNMP_VERSION_3)extern ALENGTH_T bufsize_for_v3_pkt __((SNMP_PKT_T *));extern void encode_snmp_scoped_pdu __((SNMP_PKT_T *, EBUFFER_T *));extern int encode_snmp_v3 __((SNMP_PKT_T *, EBUFFER_T *));extern SNMP_PKT_T * Send_Report_PDU __((SNMP_PKT_T *, struct LCL_FILE_S *, bits8_t, OIDC_T *, int, bits32_t, int *, SNMPADDR_T *, SNMPADDR_T *));struct SNMP_USER_S;extern int decode_scoped_pdu __((SNMP_PKT_T *, struct LCL_FILE_S *, SNMPADDR_T *, SNMPADDR_T *, ALENGTH_T, struct SNMP_USER_S *));extern SNMP_PKT_T * SNMP_Decode_V3_Packet __((SNMP_PKT_T *, struct LCL_FILE_S *, SNMPADDR_T *, SNMPADDR_T *, ALENGTH_T, int *));#if (INSTALL_ENVOY_SNMP_V3_TARGET)extern int envoy_add_engine_address __((SNMP_PKT_T *, SNMPADDR_T *, int));#endif /* INSTALL_ENVOY_SNMP_V3_TARGET */#endif /* INSTALL_ENVOY_SNMP_VERSION_3 */extern void SNMP_Proxy_Request __((SNMP_PKT_T *));extern int SNMP_Proxy_Response __((SNMP_PKT_T *));extern void SNMP_Proxy_Traps_And_Reports __((SNMP_PKT_T *));extern int SNMP_Process_Get_PDU __((SNMP_PKT_T *));extern int SNMP_Process_Test_PDU __((SNMP_PKT_T *));extern int SNMP_Process_Set_PDU __((SNMP_PKT_T *));extern int SNMP_Process_Next_PDU __((SNMP_PKT_T *));extern int SNMP_Process_Next_Redo __((SNMP_PKT_T *));extern int SNMP_Process_Bulk_Redo __((SNMP_PKT_T *));extern int SNMP_Process_Finish __((SNMP_PKT_T *, EBUFFER_T *, ALENGTH_T));extern void ENVOY_Send_SNMP_Packet __((SNMP_PKT_T *));extern void ENVOY_Send_SNMP_Error_Packet __((SNMP_PKT_T *, sbits32_t, sbits32_t));extern int scan_vb_for_locator __((SNMP_PKT_T *, int, bits16_t));extern int oidcmp __((int, OIDC_T *, int, OIDC_T *));extern int find_object_node __((VB_T *, SNMP_PKT_T *, int));extern int find_next_object __((VB_T *, OBJ_ID_T *, SNMP_PKT_T *, int));#if (INSTALL_COMMON_DYNAMIC_COMP_CONFIG)extern void v3_dyncfg_init(void);extern void envoy_dyncfg_init(void);#endif#if (INSTALL_ENVOY_SNMP_LOCK)/* definitions for use with the locking functions */#define SNMP_READ_LOCK LOCK_READ#define SNMP_WRITE_LOCK LOCK_WRITE/* function prototypes for locking functions */extern envoy_err_t SNMP_Get_System_Lock __((bits8_t which));extern void SNMP_Release_System_Lock __((bits8_t which));#endif /* #if (INSTALL_ENVOY_SNMP_LOCK) */#if INSTALL_ENVOY_SNMP_UTIL_MACROS#define getproc_started(P, V) ((V)->vb_flags |= VFLAG_GET_STARTED)#define getproc_good(P, V) ((V)->vb_flags |= VFLAG_GET_DONE)#define getproc_error(P, V, E) ((P)->pdu.std_pdu.error_status = E, \ (P)->pdu.std_pdu.error_index = \ (vbp_to_index_error(P, V, 1)),\ (V)->vb_flags |= VFLAG_GET_DONE)#define nextproc_started(P, V) ((V)->vb_flags |= VFLAG_NEXT_STARTED)#define nextproc_good(P, V) ((V)->vb_flags |= VFLAG_NEXT_DONE)#define nextproc_no_next(P, V) ((V)->vb_flags |= VFLAG_NEXT_DONE | \ VFLAG_NEXT_REDO)#define nextproc_error(P, V, E) ((P)->pdu.std_pdu.error_status = E, \ (P)->pdu.std_pdu.error_index = \ (vbp_to_index_error(P, V, 1)),\ (V)->vb_flags |= VFLAG_NEXT_DONE)#define getproc_got_int32(P, V, D) ((V)->vb_data_flags_n_type = VT_NUMBER, \ (V)->value_u.v_number = D, \ (V)->vb_flags |= VFLAG_GET_DONE)#define getproc_got_uint32(P, V, D, T) ((V)->vb_data_flags_n_type = T,\ (V)->value_u.v_counter = D, \ (V)->vb_flags |= VFLAG_GET_DONE)#define getproc_got_uint64(P, V, D) \ ((V)->vb_data_flags_n_type = VT_COUNTER64, \ (V)->value_u.v_counter64.high = (D)->high, \ (V)->value_u.v_counter64.low = (D)->low, \ (V)->vb_flags |= VFLAG_GET_DONE)#define getproc_got_uint64_high_low(P, V, H, L) \ ((V)->vb_data_flags_n_type = VT_COUNTER64, \ (V)->value_u.v_counter64.high = H, \ (V)->value_u.v_counter64.low = L, \ (V)->vb_flags |= VFLAG_GET_DONE)#define getproc_got_ip_address(P, V, D) \ ((V)->vb_data_flags_n_type = VT_IPADDRESS, \ MEMCPY(&((V)->value_u.v_network_address), \ &(D), 4), \ (V)->vb_flags |= VFLAG_GET_DONE)#define getproc_got_empty(P, V) ((V)->vb_data_flags_n_type = VT_EMPTY, \ (V)->vb_flags |= VFLAG_GET_DONE)#define getproc_got_string(P, V, S, D, F, T) \ ((V)->vb_data_flags_n_type = T, \ (V)->vb_flags |= VFLAG_GET_DONE, \ EBufferPreLoad((F) ? BFL_IS_DYNAMIC : BFL_IS_STATIC,\ &((V)->value_u.v_string), D, S))#define getproc_got_octet_string(P, V, S, D, T) \ ((V)->vb_data_flags_n_type = T, \ (V)->vb_flags |= VFLAG_GET_DONE, \ EBufferPreLoad(BFL_IS_ALLOC,\ &((V)->value_u.v_string), D, S))#define testproc_started(P, V) ((V)->vb_flags |= VFLAG_TEST_STARTED)#define testproc_good(P, V) ((V)->vb_flags |= VFLAG_TEST_DONE)#define setproc_started(P, V) ((V)->vb_flags |= VFLAG_SET_STARTED)#define setproc_good(P, V) ((V)->vb_flags |= VFLAG_SET_DONE)#define setproc_error(P, V, E) ((P)->pdu.std_pdu.error_status = E, \ (P)->pdu.std_pdu.error_index = \ (vbp_to_index_error(P, V, 1)),\ (V)->vb_flags |= VFLAG_SET_DONE)#define undoproc_started(P, V) ((V)->vb_flags |= VFLAG_UNDO_STARTED)#define undoproc_good(P, V) ((V)->vb_flags |= VFLAG_UNDO_DONE)#define undoproc_error(P, V, E) ((P)->pdu.std_pdu.error_status = E, \ (P)->pdu.std_pdu.error_index = \ (vbp_to_index_error(P, V, 1)),\ (V)->vb_flags |= VFLAG_UNDO_DONE)#else /* INSTALL_ENVOY_SNMP_UTIL_MACROS */void getproc_started __((SNMP_PKT_T *, VB_T *)); void getproc_good __((SNMP_PKT_T *, VB_T *)); void getproc_error __((SNMP_PKT_T *, VB_T *, INT_32_T)); void nextproc_started __((SNMP_PKT_T *, VB_T *)); void nextproc_good __((SNMP_PKT_T *, VB_T *)); void nextproc_no_next __((SNMP_PKT_T *, VB_T *)); void nextproc_error __((SNMP_PKT_T *, VB_T *, INT_32_T)); void testproc_started __((SNMP_PKT_T *, VB_T *)); void testproc_good __((SNMP_PKT_T *, VB_T *)); void setproc_started __((SNMP_PKT_T *, VB_T *)); void setproc_good __((SNMP_PKT_T *, VB_T *)); void setproc_error __((SNMP_PKT_T *, VB_T *, INT_32_T)); void undoproc_started __((SNMP_PKT_T *, VB_T *)); void undoproc_good __((SNMP_PKT_T *, VB_T *)); void undoproc_error __((SNMP_PKT_T *, VB_T *, INT_32_T)); void getproc_got_int32 __((SNMP_PKT_T *, VB_T *, INT_32_T));void getproc_got_uint32 __((SNMP_PKT_T *, VB_T *, UINT_32_T, OCTET_T));void getproc_got_ip_address __((SNMP_PKT_T *, VB_T *, UINT_32_T));void getproc_got_empty __((SNMP_PKT_T *, VB_T *));void getproc_got_string __((SNMP_PKT_T *, VB_T *, ALENGTH_T, OCTET_T *, int, OCTET_T));void getproc_got_octet_string __((SNMP_PKT_T *, VB_T *, ALENGTH_T, OCTET_T *, OCTET_T));void getproc_got_uint64 __((SNMP_PKT_T *, VB_T *, UINT_64_T *));void getproc_got_uint64_high_low __((SNMP_PKT_T *, VB_T *, UINT_32_T, UINT_32_T));#endif /* INSTALL_ENVOY_SNMP_UTIL_MACROS */#define getproc_got_ipaddr(P, V, D) \ ((V)->vb_data_flags_n_type = VT_IPADDRESS, \ MEMCPY(&((V)->value_u.v_network_address), \ PTR_IPADDR_BITS(D), 4), \ (V)->vb_flags |= VFLAG_GET_DONE)#define setproc_all_bits(P, V) ((V)->vb_flags |= VFLAG_TEST_STARTED | \ VFLAG_TEST_DONE | \ VFLAG_SET_STARTED | \ VFLAG_SET_DONE | \ VFLAG_UNDO_STARTED | \ VFLAG_UNDO_DONE)#define undoproc_set(P, V, R) ((V)->undoproc = (UNDOPROC_T *)(R))extern void getproc_nosuchins __((SNMP_PKT_T *, VB_T *));extern void getproc_got_object_id __((SNMP_PKT_T *, VB_T *, int, OIDC_T *, int));extern void nextproc_next_instance __((SNMP_PKT_T *, VB_T *, int, OIDC_T *));extern void nextproc_next_instance_string __((SNMP_PKT_T *, VB_T *, ALENGTH_T, bits8_t *, int));extern void testproc_tproc_error __((SNMP_PKT_T *, VB_T *, int));extern void testproc_error __((SNMP_PKT_T *, VB_T *, sbits32_t));#if (INSTALL_ENVOY_SNMP_SERIALIZE)typedef void GATE_CONTINUE_T __((ptr_t));extern int GateKeeper_Test __((void));extern int GateKeeper_Add __((sbits16_t, ptr_t, GATE_CONTINUE_T *));extern void GateRunDeferreds __((void));extern void GateDecrement __((SNMP_PKT_T *));#define GATE_SNMP 1#define GATE_SUBAGENT 2#endif#if (!defined(auxmth_inc))#include <wrn/wm/snmp/engine/auxmth.h>#endifextern int std_next __((OIDC_T lastmastch, int tcount, OIDC_T *tlist, OIDC_T *rlist, char *cookie, SNMP_PKT_T *pktp));extern void std_next_async __((OIDC_T lastmastch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp));/* We define the following functions for use with the compatibility routines */extern void async_compat_test __((OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp));extern void async_compat_get __((OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp));extern void async_compat_set __((OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp));extern void async_compat_next __((OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp));extern void async_compat_error __((SNMPADDR_T *for_addr, SNMPADDR_T *loc_addr, int ecode, PTR_T cookie));extern void async_compat_io __((SNMPADDR_T *for_addr, SNMPADDR_T *loc_addr, PTR_T pktp, ALENGTH_T need, PTR_T cookie));#ifdef __cplusplus}#endif#endif /* snmpdefs_inc */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -