1 #ifndef AGENT_HANDLER_H
2 #define AGENT_HANDLER_H
8 /** @addgroup handler */
10 struct netsnmp_handler_registration_s;
12 typedef struct netsnmp_mib_handler_s {
14 void *myvoid; /* for handler's internal use */
16 int (*access_method) (struct netsnmp_mib_handler_s *,
18 netsnmp_handler_registration_s *,
20 netsnmp_agent_request_info_s *,
21 struct netsnmp_request_info_s *);
23 struct netsnmp_mib_handler_s *next;
24 struct netsnmp_mib_handler_s *prev;
25 } netsnmp_mib_handler;
27 #define HANDLER_CAN_GETANDGETNEXT 0x1 /* must be able to do both */
28 #define HANDLER_CAN_SET 0x2
29 #define HANDLER_CAN_GETBULK 0x4
31 #define HANDLER_CAN_RONLY (HANDLER_CAN_GETANDGETNEXT)
32 #define HANDLER_CAN_RWRITE (HANDLER_CAN_GETANDGETNEXT | HANDLER_CAN_SET)
33 #define HANDLER_CAN_DEFAULT HANDLER_CAN_RONLY
36 * root registration info
38 typedef struct netsnmp_handler_registration_s {
40 char *handlerName; /* for mrTable listings, and other uses */
41 char *contextName; /* NULL = default context */
44 * where are we registered at?
52 netsnmp_mib_handler *handler;
64 } netsnmp_handler_registration;
67 * function handler definitions
69 typedef int (Netsnmp_Node_Handler) (netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, /* pointer to registration struct */
70 netsnmp_agent_request_info *reqinfo, /* pointer to current transaction */
74 typedef struct netsnmp_delegated_cache_s {
76 netsnmp_mib_handler *handler;
77 netsnmp_handler_registration *reginfo;
78 netsnmp_agent_request_info *reqinfo;
79 netsnmp_request_info *requests;
81 } netsnmp_delegated_cache;
84 * handler API functions
86 void netsnmp_init_handler_conf(void);
87 int netsnmp_register_handler(netsnmp_handler_registration
90 netsnmp_register_handler_nocallback(netsnmp_handler_registration
92 int netsnmp_inject_handler(netsnmp_handler_registration
94 netsnmp_mib_handler *handler);
96 *netsnmp_find_handler_by_name(netsnmp_handler_registration
97 *reginfo, const char *name);
99 *netsnmp_find_handler_data_by_name(netsnmp_handler_registration
100 *reginfo, const char *name);
101 int netsnmp_call_handlers(netsnmp_handler_registration
103 netsnmp_agent_request_info
105 netsnmp_request_info *requests);
106 int netsnmp_call_handler(netsnmp_mib_handler *next_handler,
107 netsnmp_handler_registration
109 netsnmp_agent_request_info
111 netsnmp_request_info *requests);
112 int netsnmp_call_next_handler(netsnmp_mib_handler *current,
113 netsnmp_handler_registration
115 netsnmp_agent_request_info
119 int netsnmp_call_next_handler_one_request(netsnmp_mib_handler *current,
120 netsnmp_handler_registration *reginfo,
121 netsnmp_agent_request_info *reqinfo,
122 netsnmp_request_info *requests);
124 netsnmp_mib_handler *netsnmp_create_handler(const char *name,
125 Netsnmp_Node_Handler *
126 handler_access_method);
127 netsnmp_handler_registration *
128 netsnmp_create_handler_registration(const char *name,
129 Netsnmp_Node_Handler *
130 handler_access_method,
135 NETSNMP_INLINE netsnmp_delegated_cache
136 *netsnmp_create_delegated_cache(netsnmp_mib_handler *,
137 netsnmp_handler_registration *,
138 netsnmp_agent_request_info *,
139 netsnmp_request_info *, void *);
140 NETSNMP_INLINE void netsnmp_free_delegated_cache(netsnmp_delegated_cache
142 NETSNMP_INLINE netsnmp_delegated_cache
143 *netsnmp_handler_check_cache(netsnmp_delegated_cache *dcache);
144 void netsnmp_register_handler_by_name(const char *,
149 netsnmp_request_add_list_data(netsnmp_request_info *request,
150 netsnmp_data_list *node);
152 NETSNMP_INLINE void *netsnmp_request_get_list_data(netsnmp_request_info
157 netsnmp_free_request_data_set(netsnmp_request_info *request);
160 netsnmp_free_request_data_sets(netsnmp_request_info *request);
162 void netsnmp_handler_free(netsnmp_mib_handler *);
163 netsnmp_mib_handler *netsnmp_handler_dup(netsnmp_mib_handler *);
164 netsnmp_handler_registration
165 *netsnmp_handler_registration_dup(netsnmp_handler_registration *);
167 netsnmp_handler_registration_free(netsnmp_handler_registration *);
169 #define REQUEST_IS_DELEGATED 1
170 #define REQUEST_IS_NOT_DELEGATED 0
172 netsnmp_handler_mark_requests_as_delegated(netsnmp_request_info *,
174 void *netsnmp_handler_get_parent_data(netsnmp_request_info *,
181 #endif /* AGENT_HANDLER_H */