/usr/include/net-snmp/agent/agent_handler.h is in libsnmp-dev 5.4.3~dfsg-2.4ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | /* Portions of this file are subject to the following copyright(s). See
* the Net-SNMP's COPYING file for more details and other copyrights
* that may apply:
*/
/*
* Portions of this file are copyrighted by:
* Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms specified in the COPYING file
* distributed with the Net-SNMP package.
*/
#ifndef AGENT_HANDLER_H
#define AGENT_HANDLER_H
#ifdef __cplusplus
extern "C" {
#endif
/** @file agent_handler.h
*
* @addtogroup handler
*
* @{
*/
struct netsnmp_handler_registration_s;
/*
* per mib handler flags.
* NOTE: Lower bits are reserved for the agent handler's use.
* The high 4 bits (31-28) are reserved for use by the handler.
*/
#define MIB_HANDLER_AUTO_NEXT 0x00000001
#define MIB_HANDLER_AUTO_NEXT_OVERRIDE_ONCE 0x00000002
#define MIB_HANDLER_INSTANCE 0x00000004
#define MIB_HANDLER_CUSTOM4 0x10000000
#define MIB_HANDLER_CUSTOM3 0x20000000
#define MIB_HANDLER_CUSTOM2 0x40000000
#define MIB_HANDLER_CUSTOM1 0x80000000
/** @typedef struct netsnmp_mib_handler_s netsnmp_mib_handler
* Typedefs the netsnmp_mib_handler_s struct into netsnmp_mib_handler */
/** @struct netsnmp_mib_handler_s
* the mib handler structure to be registered
*/
typedef struct netsnmp_mib_handler_s {
char *handler_name;
/** for handler's internal use */
void *myvoid;
/** for agent_handler's internal use */
int flags;
/** if you add more members, you probably also want to update */
/** _clone_handler in agent_handler.c. */
int (*access_method) (struct netsnmp_mib_handler_s *,
struct
netsnmp_handler_registration_s *,
struct
netsnmp_agent_request_info_s *,
struct netsnmp_request_info_s *);
void (*data_free)(void *myvoid); /**< data free hook for myvoid */
struct netsnmp_mib_handler_s *next;
struct netsnmp_mib_handler_s *prev;
} netsnmp_mib_handler;
/*
* per registration flags
*/
#define HANDLER_CAN_GETANDGETNEXT 0x01 /* must be able to do both */
#define HANDLER_CAN_SET 0x02 /* implies create, too */
#define HANDLER_CAN_GETBULK 0x04
#define HANDLER_CAN_NOT_CREATE 0x08 /* auto set if ! CAN_SET */
#define HANDLER_CAN_BABY_STEP 0x10
#define HANDLER_CAN_STASH 0x20
#define HANDLER_CAN_RONLY (HANDLER_CAN_GETANDGETNEXT)
#define HANDLER_CAN_RWRITE (HANDLER_CAN_GETANDGETNEXT | HANDLER_CAN_SET)
#define HANDLER_CAN_SET_ONLY (HANDLER_CAN_SET | HANDLER_CAN_NOT_CREATE)
#define HANDLER_CAN_DEFAULT (HANDLER_CAN_RONLY | HANDLER_CAN_NOT_CREATE)
/** @typedef struct netsnmp_handler_registration_s netsnmp_handler_registration
* Typedefs the netsnmp_handler_registration_s struct into netsnmp_handler_registration */
/** @struct netsnmp_handler_registration_s
* Root registration info.
* The variables handlerName, contextName, and rootoid need to be allocated
* on the heap, when the registration structure is unregistered using
* unregister_mib_context() the code attempts to free them.
*/
typedef struct netsnmp_handler_registration_s {
/** for mrTable listings, and other uses */
char *handlerName;
/** NULL = default context */
char *contextName;
/**
* where are we registered at?
*/
oid *rootoid;
size_t rootoid_len;
/**
* handler details
*/
netsnmp_mib_handler *handler;
int modes;
/**
* more optional stuff
*/
int priority;
int range_subid;
oid range_ubound;
int timeout;
int global_cacheid;
/**
* void ptr for registeree
*/
void * my_reg_void;
} netsnmp_handler_registration;
/*
* function handler definitions
*/
typedef int (Netsnmp_Node_Handler) (netsnmp_mib_handler *handler,
/** pointer to registration struct */
netsnmp_handler_registration *reginfo,
/** pointer to current transaction */
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests);
typedef struct netsnmp_handler_args_s {
netsnmp_mib_handler *handler;
netsnmp_handler_registration *reginfo;
netsnmp_agent_request_info *reqinfo;
netsnmp_request_info *requests;
} netsnmp_handler_args;
typedef struct netsnmp_delegated_cache_s {
int transaction_id;
netsnmp_mib_handler *handler;
netsnmp_handler_registration *reginfo;
netsnmp_agent_request_info *reqinfo;
netsnmp_request_info *requests;
void *localinfo;
} netsnmp_delegated_cache;
/*
* handler API functions
*/
void netsnmp_init_handler_conf(void);
int netsnmp_register_handler(netsnmp_handler_registration
*reginfo);
int netsnmp_unregister_handler(netsnmp_handler_registration
*reginfo);
int
netsnmp_register_handler_nocallback(netsnmp_handler_registration
*reginfo);
int netsnmp_inject_handler(netsnmp_handler_registration
*reginfo,
netsnmp_mib_handler *handler);
int
netsnmp_inject_handler_before(netsnmp_handler_registration *reginfo,
netsnmp_mib_handler *handler,
const char *before_what);
netsnmp_mib_handler
*netsnmp_find_handler_by_name(netsnmp_handler_registration
*reginfo, const char *name);
void
*netsnmp_find_handler_data_by_name(netsnmp_handler_registration
*reginfo, const char *name);
int netsnmp_call_handlers(netsnmp_handler_registration
*reginfo,
netsnmp_agent_request_info
*reqinfo,
netsnmp_request_info *requests);
int netsnmp_call_handler(netsnmp_mib_handler *next_handler,
netsnmp_handler_registration
*reginfo,
netsnmp_agent_request_info
*reqinfo,
netsnmp_request_info *requests);
int netsnmp_call_next_handler(netsnmp_mib_handler *current,
netsnmp_handler_registration
*reginfo,
netsnmp_agent_request_info
*reqinfo,
netsnmp_request_info
*requests);
int netsnmp_call_next_handler_one_request(netsnmp_mib_handler *current,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests);
netsnmp_mib_handler *netsnmp_create_handler(const char *name,
Netsnmp_Node_Handler *
handler_access_method);
netsnmp_handler_registration *
netsnmp_handler_registration_create(const char *name,
netsnmp_mib_handler *handler,
oid * reg_oid, size_t reg_oid_len,
int modes);
netsnmp_handler_registration *
netsnmp_create_handler_registration(const char *name, Netsnmp_Node_Handler*
handler_access_method, oid *reg_oid,
size_t reg_oid_len, int modes);
netsnmp_delegated_cache
*netsnmp_create_delegated_cache(netsnmp_mib_handler *,
netsnmp_handler_registration *,
netsnmp_agent_request_info *,
netsnmp_request_info *, void *);
void netsnmp_free_delegated_cache(netsnmp_delegated_cache *dcache);
netsnmp_delegated_cache
*netsnmp_handler_check_cache(netsnmp_delegated_cache *dcache);
void netsnmp_register_handler_by_name(const char *,
netsnmp_mib_handler
*);
void netsnmp_clear_handler_list(void);
void
netsnmp_request_add_list_data(netsnmp_request_info *request,
netsnmp_data_list *node);
int
netsnmp_request_remove_list_data(netsnmp_request_info *request,
const char *name);
void *netsnmp_request_get_list_data(netsnmp_request_info
*request,
const char *name);
void
netsnmp_free_request_data_set(netsnmp_request_info *request);
void
netsnmp_free_request_data_sets(netsnmp_request_info *request);
void netsnmp_handler_free(netsnmp_mib_handler *);
netsnmp_mib_handler *netsnmp_handler_dup(netsnmp_mib_handler *);
netsnmp_handler_registration
*netsnmp_handler_registration_dup(netsnmp_handler_registration *);
void
netsnmp_handler_registration_free(netsnmp_handler_registration *);
#define REQUEST_IS_DELEGATED 1
#define REQUEST_IS_NOT_DELEGATED 0
void
netsnmp_handler_mark_requests_as_delegated(netsnmp_request_info *,
int);
void *netsnmp_handler_get_parent_data(netsnmp_request_info *,
const char *);
#ifdef __cplusplus
}
#endif
#endif /* AGENT_HANDLER_H */
/** @} */
|