📄 agentx.h
字号:
/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/agentx.h,v 1.9 2002/05/30 17:24:54 andre Exp $ *//* * Copyright (C) 1999-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: agentx.h,v $ * Revision 1.9 2002/05/30 17:24:54 andre * Add placeholder definition for AX_RESPONSE_PREPROCESS * * Revision 1.8 2002/04/09 14:18:35 tneale * REGLIST changes to handle list-based registration * * Revision 1.7 2002/03/28 14:37:07 tneale * Removed externs of old mib variables * * Revision 1.6 2002/03/20 20:20:41 tneale * Fixed multiple definition of ENVOY_AX_PARSE_ERROR * * Revision 1.5 2002/03/19 21:47:01 tneale * Changed Agentx protocol error codes per RFC2741 * * Revision 1.4 2002/03/18 16:05:43 tneale * Added cmonnect_id member to Session structure * * Revision 1.3 2002/03/12 15:54:39 tneale * Added structure definition for the registration list * * Revision 1.2 2001/11/06 21:35:00 josh * new revised path structure, first pass. Also removing useless * shell include files. * * Revision 1.1.1.1 2001/11/05 17:47:22 tneale * Tornado shuffle * * Revision 9.6.4.1 2001/08/17 20:38:43 meister * Added prototypes for some agentx helper functions which were previously * declared statically. Added prototypes for agentx and v3 dynamic config init * functions. * * Revision 9.6 2001/01/19 22:22:02 paul * Update copyright. * * Revision 9.5 2000/03/17 19:48:27 meister * Update copyright notice * * Revision 9.4 2000/03/09 20:58:32 tneale * All structure definitions are now bracketted with a test that * potentially sets an alignment pragma. This is to maintain compatibility * with the code base that had been distributed by Wind River. * * Revision 9.3 2000/03/09 16:53:16 tneale * Added #ifdef for C++ to declare extern C if needed * * Revision 9.2 1999/12/23 14:47:26 josh * cleaning up code per Shawn's comments -- removing extraneous * comments and doing proxy check before notify check * * Revision 9.1 1999/03/30 15:20:13 josh * feature to allow customer-driven context conversion into AgentX * * Revision 9.0 1998/10/16 22:10:03 sar * Update version stamp to match release * * Revision 8.2 1998/08/12 04:52:15 sar * revamp the initialization routines to limit the amount of * code that might get pulled in. * * Revision 8.1 1998/02/25 04:50:19 sra * Update copyrights. * * Revision 8.0 1997/11/18 00:56:19 sar * Updated revision to 8.0 * * Revision 7.4 1997/10/30 04:23:16 sar * Update type information mostly convert bits16_ts to ALENGTH_Ts * also add MAX_ALENGTH * * Revision 7.3 1997/10/29 04:11:40 sar * Cleaned up some type mismatches to keep compilers happy * * Revision 7.2 1997/10/21 02:53:37 sar * Added defines for transport types and index allocate and deallocate macros * and removed leaf decrement function * * Revision 7.1 1997/10/16 00:25:16 sar * Primarily this set of modifications is for the agentx protocol. * Most of the work was in the agentx.h and ax_mth.h files. Most * other files (snmpdefs.h, vbdefs.h and mib.h) received updates * to their structures and snmp got some new lock macros. * * One other change of note was the modification of continue * processing. Previously we called a specific continue routine * directly, now we store a pointer to the corret continue * function in the snmp packet structure and call that. We include * macros for backwards compatibility. * *//* [clearcase]modification history-------------------01b,19apr05,job update copyright notices01a,04aug04,job dropped connection handling*/#if (!defined(envoy_agentx_inc))#define envoy_agentx_inc#ifdef __cplusplusextern"C" {#endif#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/vbdefs.h>#include <wrn/wm/snmp/engine/etimer.h>#include <wrn/wm/snmp/engine/tree.h>/*extern struct ENVOY_AX_PKT_S;extern struct SNMP_PKT_S;*/typedef void ENVOY_AX_ADMIN_T (ptr_t, ptr_t);typedef int ENVOY_AX_SEND_T (ptr_t, ptr_t, ptr_t, ALENGTH_T);typedef void ENVOY_AX_ERROR_T (ptr_t, int);typedef void ENVOY_AX_ADD_T (ptr_t);#define ENVOY_AX_MASTER_PORT 705#ifdef WINDNET_STRUCT_ALIGN#pragma align 1#endif/* Define a chunk block for agentx, this is used by the byte_handler code to save and build a packet when it arrives in chunks rather than all at once */typedef struct ENVOY_AX_CHUNK_S { EBUFFER_T chunk; } ENVOY_AX_CHUNK_T;/* Define a state block for the sub agent, primarily this will be useful if you want to have multiple sub agents in the same process space */typedef struct ENVOY_AX_SA_SB_S { struct ENVOY_AX_PKT_S *set_list; /* list of outstanding set requests */ struct ENVOY_AX_PKT_S *gnb_list; /* list of deferred gnb requests */ bits32_t readers; /* number of outstanding gnb reqs */ ENVOY_TIMER_T ager; /* timer block for aging pkts */ ENVOY_TIMER_T defer; /* timer block for deferring pkts */ bits32_t flags; /* currently only if the timer has been set */#if INSTALL_ENVOY_SNMP_LOCK ENVOY_LOCK_T list_lock; /* lock for manipulating this struct and the structs on the two lists */ ENVOY_LOCK_T coarse_lock; /* lock for manipulating the mib db */#endif } ENVOY_AX_SA_SB_T;/* Define the agentx structure */typedef struct ENVOY_AX_PKT_S { bits8_t version; /* The agentx protocol version */ bits8_t type; /* The agentx pdu type, see below */ bits8_t flags; /* Agentx flags, also see below */ bits32_t session_id; /* session id between mast & sub */ bits32_t transaction_id; /* groups agentx pkts to snmp pkts */ bits32_t packet_id; /* associates response pkts to reqs */ EBUFFER_T context; /* context, optional, see flags */ ENVOY_AX_SEND_T *send; /* io completion routine */ ENVOY_AX_ERROR_T *error; /* error completion routine */ ptr_t cookie; /* cookie for comp routines */ struct SNMP_PKT_S *pktp; /* snmp packet we've turned this agentx request into for processing */ ENVOY_AX_SA_SB_T *sasb; /* pointer to the state block for this sub agent */ struct ENVOY_AX_PKT_S *next; /* next pointer for lists */ bits32_t ts; /* timestamp for aging pkts */ bits32_t sysuptime; /* these 3 are only used in */ bits16_t error_stat; /* responses */ bits16_t error_index; union { /* pdu data, one of the following */ bits8_t reason; /* enum for reason for closing */ struct { /* used for opens, add caps and */ bits8_t timeout; /* remove caps */ bits8_t prefix; OBJ_ID_T sub_id; EBUFFER_T descr; } open_data; struct { /* used for (un)registers */ bits8_t timeout; bits8_t priority; bits8_t range; OBJ_ID_T region; OIDC_T bound; } reg_data; struct { /* gets, nexts, bulks, test sets, */ bits16_t non_reps; /* responses, notifies and index */ bits16_t max_reps; /* (de)allocates */ VBL_T vbl_str; bits8_t cur_phase; /* current phase of set processing */ /* same as vb flags */ bits32_t next_pid; /* info for the next phase */ bits8_t next_phase; /* of set processing, what */ ENVOY_AX_SEND_T *next_send; /* to do, and any comp info */ ENVOY_AX_ERROR_T *next_error; ptr_t *next_cookie; } proc_data; } data; } ENVOY_AX_PKT_T;/* AgentX pdu types */#define ENVOY_AX_OPEN 1#define ENVOY_AX_CLOSE 2#define ENVOY_AX_REGISTER 3#define ENVOY_AX_UNREGISTER 4#define ENVOY_AX_GET 5#define ENVOY_AX_NEXT 6#define ENVOY_AX_BULK 7#define ENVOY_AX_TEST 8#define ENVOY_AX_COMMIT 9#define ENVOY_AX_UNDO 10#define ENVOY_AX_CLEANUP 11#define ENVOY_AX_NOTIFY 12#define ENVOY_AX_PING 13#define ENVOY_AX_INDEX_ALLOCATE 14#define ENVOY_AX_INDEX_DEALLOCATE 15#define ENVOY_AX_ADD_AC 16#define ENVOY_AX_REMOVE_AC 17#define ENVOY_AX_RESPONSE 18/* AgentX flag bits */#define ENVOY_AX_BIT_INSTANCE 1#define ENVOY_AX_BIT_NEW_INDEX 2#define ENVOY_AX_BIT_ANY_INDEX 4#define ENVOY_AX_BIT_NDC 8 /* non-default context bit, when set optional context field is used */#define ENVOY_AX_BIT_BYTE_ORDER 16 /* when set, network byte order used *//* reasons for closing a connection */#define ENVOY_AX_CLOSE_OTHER 1#define ENVOY_AX_CLOSE_PARSE 2#define ENVOY_AX_CLOSE_PROTO 3#define ENVOY_AX_CLOSE_TIMEOUTS 4#define ENVOY_AX_CLOSE_SHUTDOWN 5#define ENVOY_AX_CLOSE_MANAGER 6/* AgentX codes for the next phase of sets */#define ENVOY_AX_NEXT_CLEANUP_START 1#define ENVOY_AX_NEXT_UNDO_START 2/* AgentX Protocol error codes */#define ENVOY_AX_OPEN_FAILED 256#define ENVOY_AX_NOT_OPEN 257#define ENVOY_AX_INDEX_WRONG_TYPE 258#define ENVOY_AX_INDEX_ALREADY_ALLOCATED 259#define ENVOY_AX_INDEX_NONE_AVAILABLE 260#define ENVOY_AX_INDEX_NOT_ALLOCATED 261#define ENVOY_AX_UNSUPPORTED_CONTEXT 262#define ENVOY_AX_DUPLICATE_REGISTRATION 263#define ENVOY_AX_UNKNOWN_REGISTRATION 264#define ENVOY_AX_UNKNOWN_AGENT_CAPS 265#define ENVOY_AX_PROTOCOL_PARSE_ERROR 266#define ENVOY_AX_REQUEST_DENIED 267#define ENVOY_AX_PROCESSING_ERROR 268#define ENVOY_AX_OTHER 0xffff/* AgentX error codes */#define ENVOY_AX_ALLOCATION_FAILURE 1#define ENVOY_AX_BAD_VALUE 2#define ENVOY_AX_TOO_SMALL 3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -