~ubuntu-branches/ubuntu/edgy/net-snmp/edgy-updates

« back to all changes in this revision

Viewing changes to man/netsnmp_snmp_agent.3

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-03-31 04:21:37 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050331042137-z0vw1grslj6cek9k
Tags: 5.1.2-6ubuntu2
Apply safe-but-hackish patch by Henrique de Moraes Holschuh to
fix the libdir in libsnmp5-dev's .la files (Ubuntu bug #8393)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
.TH "net-snmp agent related processing" 3 "19 Mar 2004" "net-snmp" \" -*- nroff -*-
 
1
.TH "net-snmp agent related processing" 3 "7 Aug 2004" "net-snmp" \" -*- nroff -*-
2
2
.ad l
3
3
.nh
4
4
.SH NAME
7
7
 
8
8
.in +1c
9
9
.ti -1c
 
10
.RI "struct \fBaddrCache\fP"
 
11
.br
 
12
.ti -1c
10
13
.RI "struct \fB_agent_nsap\fP"
11
14
.br
12
15
.ti -1c
13
 
.RI "struct \fBaddrCache\fP"
14
 
.br
15
 
.ti -1c
16
16
.RI "struct \fBagent_set_cache_s\fP"
17
17
.br
18
18
.in -1c
 
19
.SS "Defines"
 
20
 
 
21
.in +1c
 
22
.ti -1c
 
23
.RI "#define \fBSNMP_NEED_REQUEST_LIST\fP"
 
24
.br
 
25
.ti -1c
 
26
.RI "#define \fBSNMP_ADDRCACHE_SIZE\fP   10"
 
27
.br
 
28
.in -1c
 
29
.SS "Typedefs"
 
30
 
 
31
.in +1c
 
32
.ti -1c
 
33
.RI "typedef _agent_nsap \fBagent_nsap\fP"
 
34
.br
 
35
.ti -1c
 
36
.RI "typedef agent_set_cache_s \fBagent_set_cache\fP"
 
37
.br
 
38
.in -1c
19
39
.SS "Functions"
20
40
 
21
41
.in +1c
22
42
.ti -1c
 
43
.RI "int \fBnetsnmp_agent_check_packet\fP (\fBnetsnmp_session\fP *, struct netsnmp_transport_s *, void *, int)"
 
44
.br
 
45
.ti -1c
 
46
.RI "int \fBnetsnmp_agent_check_parse\fP (\fBnetsnmp_session\fP *, \fBnetsnmp_pdu\fP *, int)"
 
47
.br
 
48
.ti -1c
 
49
.RI "void \fBdelete_subnetsnmp_tree_cache\fP (netsnmp_agent_session *asp)"
 
50
.br
 
51
.ti -1c
23
52
.RI "int \fBhandle_pdu\fP (netsnmp_agent_session *asp)"
24
53
.br
25
 
.RI "\fIThis function calls into netsnmp_set_mode_request_error, sets error_value given a reqinfo->mode value.\fP"
 
54
.RI "\fIThis function calls into netsnmp_set_mode_request_error, sets error_value given a reqinfo->mode value. \fP"
 
55
.ti -1c
 
56
.RI "int \fBnetsnmp_handle_request\fP (netsnmp_agent_session *asp, int status)"
 
57
.br
 
58
.ti -1c
 
59
.RI "int \fBnetsnmp_wrap_up_request\fP (netsnmp_agent_session *asp, int status)"
 
60
.br
 
61
.ti -1c
 
62
.RI "int \fBcheck_delayed_request\fP (netsnmp_agent_session *asp)"
 
63
.br
26
64
.ti -1c
27
65
.RI "int \fBhandle_getnext_loop\fP (netsnmp_agent_session *asp)"
28
66
.br
29
 
.RI "\fIrepeatedly calls getnext handlers looking for an answer till all requests are satisified.\fP"
 
67
.RI "\fIrepeatedly calls getnext handlers looking for an answer till all requests are satisified. \fP"
 
68
.ti -1c
 
69
.RI "int \fBhandle_set_loop\fP (netsnmp_agent_session *asp)"
 
70
.br
 
71
.ti -1c
 
72
.RI "int \fBnetsnmp_check_queued_chain_for\fP (netsnmp_agent_session *asp)"
 
73
.br
 
74
.ti -1c
 
75
.RI "int \fBnetsnmp_add_queued\fP (netsnmp_agent_session *asp)"
 
76
.br
 
77
.ti -1c
 
78
.RI "int \fBnetsnmp_remove_from_delegated\fP (netsnmp_agent_session *asp)"
 
79
.br
 
80
.ti -1c
 
81
.RI "int \fBnetsnmp_allocate_globalcacheid\fP (void)"
 
82
.br
 
83
.ti -1c
 
84
.RI "int \fBnetsnmp_get_local_cachid\fP (netsnmp_cachemap *cache_store, int globalid)"
 
85
.br
 
86
.ti -1c
 
87
.RI "netsnmp_cachemap * \fBnetsnmp_get_or_add_local_cachid\fP (netsnmp_cachemap **cache_store, int globalid, int localid)"
 
88
.br
 
89
.ti -1c
 
90
.RI "void \fBnetsnmp_free_cachemap\fP (netsnmp_cachemap *cache_store)"
 
91
.br
 
92
.ti -1c
 
93
.RI "agent_set_cache * \fBsave_set_cache\fP (netsnmp_agent_session *asp)"
 
94
.br
 
95
.ti -1c
 
96
.RI "int \fBget_set_cache\fP (netsnmp_agent_session *asp)"
 
97
.br
 
98
.ti -1c
 
99
.RI "NETSNMP_STATIC_INLINE void \fB_reorder_getbulk\fP (netsnmp_agent_session *asp)"
 
100
.br
 
101
.ti -1c
 
102
.RI "int \fBgetNextSessID\fP ()"
 
103
.br
30
104
.ti -1c
31
105
.RI "int \fBagent_check_and_process\fP (int block)"
32
106
.br
33
 
.RI "\fIThis function checks for packets arriving on the SNMP port and processes them(snmp_read) if some are found, using the select().\fP"
 
107
.RI "\fIThis function checks for packets arriving on the SNMP port and processes them(snmp_read) if some are found, using the select(). \fP"
 
108
.ti -1c
 
109
.RI "void \fBnetsnmp_addrcache_initialise\fP (void)"
 
110
.br
 
111
.ti -1c
 
112
.RI "void \fBnetsnmp_addrcache_age\fP (void)"
 
113
.br
 
114
.ti -1c
 
115
.RI "int \fBnetsnmp_agent_check_packet\fP (\fBnetsnmp_session\fP *session, netsnmp_transport *transport, void *transport_data, int transport_data_length)"
 
116
.br
 
117
.ti -1c
 
118
.RI "int \fBnetsnmp_register_agent_nsap\fP (netsnmp_transport *t)"
 
119
.br
 
120
.ti -1c
 
121
.RI "void \fBnetsnmp_deregister_agent_nsap\fP (int handle)"
 
122
.br
 
123
.ti -1c
 
124
.RI "int \fBinit_master_agent\fP (void)"
 
125
.br
 
126
.ti -1c
 
127
.RI "void \fBclear_nsap_list\fP (void)"
 
128
.br
 
129
.ti -1c
 
130
.RI "void \fBshutdown_master_agent\fP (void)"
 
131
.br
 
132
.ti -1c
 
133
.RI "netsnmp_agent_session * \fBinit_agent_snmp_session\fP (\fBnetsnmp_session\fP *session, \fBnetsnmp_pdu\fP *pdu)"
 
134
.br
 
135
.ti -1c
 
136
.RI "void \fBfree_agent_snmp_session\fP (netsnmp_agent_session *asp)"
 
137
.br
 
138
.ti -1c
 
139
.RI "int \fBnetsnmp_check_for_delegated\fP (netsnmp_agent_session *asp)"
 
140
.br
 
141
.ti -1c
 
142
.RI "int \fBnetsnmp_check_delegated_chain_for\fP (netsnmp_agent_session *asp)"
 
143
.br
 
144
.ti -1c
 
145
.RI "int \fBnetsnmp_check_for_delegated_and_add\fP (netsnmp_agent_session *asp)"
 
146
.br
 
147
.ti -1c
 
148
.RI "int \fBnetsnmp_remove_delegated_requests_for_session\fP (\fBnetsnmp_session\fP *sess)"
 
149
.br
34
150
.ti -1c
35
151
.RI "void \fBdump_sess_list\fP (void)"
36
152
.br
37
 
.RI "\fIif asp->pdu\fP"
38
 
.ti -1c
39
 
.RI "int \fBhandle_snmp_packet\fP (int op, netsnmp_session *session, int reqid, netsnmp_pdu *pdu, void *magic)"
40
 
.br
41
 
.RI "\fIhandles an incoming SNMP packet into the agent\fP"
 
153
.ti -1c
 
154
.RI "void \fBnetsnmp_remove_and_free_agent_snmp_session\fP (netsnmp_agent_session *asp)"
 
155
.br
 
156
.ti -1c
 
157
.RI "void \fBnetsnmp_free_agent_snmp_session_by_session\fP (\fBnetsnmp_session\fP *sess, void(*free_request)(netsnmp_request_list *))"
 
158
.br
 
159
.ti -1c
 
160
.RI "int \fBhandle_snmp_packet\fP (int op, \fBnetsnmp_session\fP *session, int reqid, \fBnetsnmp_pdu\fP *pdu, void *magic)"
 
161
.br
 
162
.RI "\fIhandles an incoming SNMP packet into the agent \fP"
 
163
.ti -1c
 
164
.RI "\fBnetsnmp_request_info\fP * \fBnetsnmp_add_varbind_to_cache\fP (netsnmp_agent_session *asp, int vbcount, \fBnetsnmp_variable_list\fP *varbind_ptr, netsnmp_subtree *tp)"
 
165
.br
42
166
.ti -1c
43
167
.RI "int \fBcheck_acm\fP (netsnmp_agent_session *asp, u_char type)"
44
168
.br
45
169
.ti -1c
 
170
.RI "int \fBnetsnmp_create_subtree_cache\fP (netsnmp_agent_session *asp)"
 
171
.br
 
172
.ti -1c
 
173
.RI "int \fBnetsnmp_reassign_requests\fP (netsnmp_agent_session *asp)"
 
174
.br
 
175
.ti -1c
 
176
.RI "void \fBnetsnmp_delete_request_infos\fP (\fBnetsnmp_request_info\fP *reqlist)"
 
177
.br
 
178
.ti -1c
 
179
.RI "void \fBnetsnmp_delete_subtree_cache\fP (netsnmp_agent_session *asp)"
 
180
.br
 
181
.ti -1c
 
182
.RI "int \fBnetsnmp_check_requests_error\fP (\fBnetsnmp_request_info\fP *requests)"
 
183
.br
 
184
.ti -1c
 
185
.RI "int \fBnetsnmp_check_requests_status\fP (netsnmp_agent_session *asp, \fBnetsnmp_request_info\fP *requests, int look_for_specific)"
 
186
.br
 
187
.ti -1c
 
188
.RI "int \fBnetsnmp_check_all_requests_status\fP (netsnmp_agent_session *asp, int look_for_specific)"
 
189
.br
 
190
.ti -1c
 
191
.RI "int \fBhandle_var_requests\fP (netsnmp_agent_session *asp)"
 
192
.br
 
193
.ti -1c
 
194
.RI "void \fBnetsnmp_check_outstanding_agent_requests\fP (void)"
 
195
.br
 
196
.ti -1c
46
197
.RI "int \fBnetsnmp_check_transaction_id\fP (int transaction_id)"
47
198
.br
48
 
.RI "\fIDecide if the requested transaction_id is still being processed within the agent.\fP"
 
199
.RI "\fIDecide if the requested transaction_id is still being processed within the agent. \fP"
49
200
.ti -1c
50
201
.RI "int \fBcheck_getnext_results\fP (netsnmp_agent_session *asp)"
51
202
.br
52
 
.RI "\fIreturns 1 if there are valid GETNEXT requests left.\fP"
53
 
.ti -1c
54
 
.RI "NETSNMP_STATIC_INLINE int \fB_request_set_error\fP (netsnmp_request_info *request, int mode, int error_value)"
55
 
.br
56
 
.RI "\fIset error for a request\fP"
57
 
.ti -1c
58
 
.RI "int \fBnetsnmp_request_set_error\fP (netsnmp_request_info *request, int error_value)"
59
 
.br
60
 
.RI "\fIset error for a request\fP"
61
 
.ti -1c
62
 
.RI "NETSNMP_INLINE int \fBnetsnmp_request_set_error_all\fP (netsnmp_request_info *requests, int error)"
63
 
.br
64
 
.RI "\fIset error for all requests\fP"
65
 
.ti -1c
66
 
.RI "int \fBnetsnmp_set_request_error\fP (netsnmp_agent_request_info *reqinfo, netsnmp_request_info *request, int error_value)"
67
 
.br
68
 
.RI "\fIdeprecated, use netsnmp_request_set_error instead\fP"
69
 
.ti -1c
70
 
.RI "int \fBnetsnmp_set_mode_request_error\fP (int mode, netsnmp_request_info *request, int error_value)"
71
 
.br
72
 
.RI "\fIdeprecated, use netsnmp_request_set_error instead\fP"
73
 
.ti -1c
74
 
.RI "int \fBnetsnmp_set_all_requests_error\fP (netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests, int error_value)"
75
 
.br
76
 
.RI "\fIset error for all request\fP"
 
203
.RI "\fIreturns 1 if there are valid GETNEXT requests left. \fP"
 
204
.ti -1c
 
205
.RI "int \fBhandle_set\fP (netsnmp_agent_session *asp)"
 
206
.br
 
207
.ti -1c
 
208
.RI "NETSNMP_STATIC_INLINE int \fB_request_set_error\fP (\fBnetsnmp_request_info\fP *request, int mode, int error_value)"
 
209
.br
 
210
.RI "\fIset error for a request \fP"
 
211
.ti -1c
 
212
.RI "int \fBnetsnmp_request_set_error\fP (\fBnetsnmp_request_info\fP *request, int error_value)"
 
213
.br
 
214
.RI "\fIset error for a request \fP"
 
215
.ti -1c
 
216
.RI "NETSNMP_INLINE int \fBnetsnmp_request_set_error_all\fP (\fBnetsnmp_request_info\fP *requests, int error)"
 
217
.br
 
218
.RI "\fIset error for all requests \fP"
 
219
.ti -1c
 
220
.RI "u_long \fBnetsnmp_marker_uptime\fP (marker_t pm)"
 
221
.br
 
222
.ti -1c
 
223
.RI "u_long \fBnetsnmp_timeval_uptime\fP (struct timeval *tv)"
 
224
.br
 
225
.ti -1c
 
226
.RI "u_long \fBnetsnmp_get_agent_uptime\fP (void)"
 
227
.br
 
228
.ti -1c
 
229
.RI "NETSNMP_INLINE void \fBnetsnmp_agent_add_list_data\fP (\fBnetsnmp_agent_request_info\fP *ari, \fBnetsnmp_data_list\fP *node)"
 
230
.br
 
231
.ti -1c
 
232
.RI "NETSNMP_INLINE void * \fBnetsnmp_agent_get_list_data\fP (\fBnetsnmp_agent_request_info\fP *ari, const char *name)"
 
233
.br
 
234
.ti -1c
 
235
.RI "NETSNMP_INLINE void \fBnetsnmp_free_agent_data_set\fP (\fBnetsnmp_agent_request_info\fP *ari)"
 
236
.br
 
237
.ti -1c
 
238
.RI "NETSNMP_INLINE void \fBnetsnmp_free_agent_data_sets\fP (\fBnetsnmp_agent_request_info\fP *ari)"
 
239
.br
 
240
.ti -1c
 
241
.RI "NETSNMP_INLINE void \fBnetsnmp_free_agent_request_info\fP (\fBnetsnmp_agent_request_info\fP *ari)"
 
242
.br
 
243
.ti -1c
 
244
.RI "int \fBnetsnmp_set_request_error\fP (\fBnetsnmp_agent_request_info\fP *reqinfo, \fBnetsnmp_request_info\fP *request, int error_value)"
 
245
.br
 
246
.RI "\fIdeprecated, use netsnmp_request_set_error instead \fP"
 
247
.ti -1c
 
248
.RI "int \fBnetsnmp_set_mode_request_error\fP (int mode, \fBnetsnmp_request_info\fP *request, int error_value)"
 
249
.br
 
250
.RI "\fIdeprecated, use netsnmp_request_set_error instead \fP"
 
251
.ti -1c
 
252
.RI "int \fBnetsnmp_set_all_requests_error\fP (\fBnetsnmp_agent_request_info\fP *reqinfo, \fBnetsnmp_request_info\fP *requests, int error_value)"
 
253
.br
 
254
.RI "\fIset error for all request \fP"
77
255
.in -1c
78
256
.SS "Variables"
79
257
 
80
258
.in +1c
81
259
.ti -1c
 
260
.RI "int \fBlastAddrAge\fP = 0"
 
261
.br
 
262
.ti -1c
 
263
.RI "int \fBlog_addresses\fP = 0"
 
264
.br
 
265
.ti -1c
 
266
.RI "netsnmp_agent_session * \fBagent_delegated_list\fP = NULL"
 
267
.br
 
268
.ti -1c
 
269
.RI "netsnmp_agent_session * \fBnetsnmp_agent_queued_list\fP = NULL"
 
270
.br
 
271
.ti -1c
 
272
.RI "\fBnetsnmp_session\fP * \fBmain_session\fP = NULL"
 
273
.br
 
274
.ti -1c
82
275
.RI "timeval \fBstarttime\fP"
83
276
.br
84
 
.RI "\fIparanoid sanity checks\fP"
 
277
.ti -1c
 
278
.RI "int \fBlog_addresses\fP"
 
279
.br
 
280
.ti -1c
 
281
.RI "int \fBlastAddrAge\fP"
 
282
.br
85
283
.in -1c
86
 
.SH "FUNCTION DOCUMENTATION"
 
284
.SH "Function Documentation"
87
285
.PP 
88
 
.SS "NETSNMP_STATIC_INLINE int _request_set_error (netsnmp_request_info * request, int mode, int error_value)"
89
 
.PP
90
 
set error for a request
91
 
.PP
92
 
Definition at line 3075 of file snmp_agent.c.
 
286
.SS "NETSNMP_STATIC_INLINE int _request_set_error (\fBnetsnmp_request_info\fP * request, int mode, int error_value)"
 
287
.PP
 
288
set error for a request Definition at line 3075 of file snmp_agent.c.
93
289
.PP
94
290
References netsnmp_request_info_s::delegated, netsnmp_request_info_s::processed, netsnmp_request_info_s::requestvb, snmp_log(), netsnmp_request_info_s::status, and variable_list::type.
95
291
.PP
96
292
Referenced by netsnmp_request_set_error(), netsnmp_request_set_error_all(), netsnmp_set_mode_request_error(), and netsnmp_set_request_error().
97
293
.SS "int agent_check_and_process (int block)"
98
294
.PP
99
 
This function checks for packets arriving on the SNMP port and processes them(snmp_read) if some are found, using the select().
100
 
.PP
101
 
If block is non zero, the function call blocks until a packet arrives
102
 
.PP
103
 
\fBParameters: \fP
104
 
.in +1c
105
 
.TP
106
 
\fB\fIblock\fP\fP
107
 
used to control blocking in the select() function, 1 = block forever, and 0 = don't block
108
 
.PP
109
 
\fBReturns: \fP
110
 
.in +1c
 
295
This function checks for packets arriving on the SNMP port and processes them(snmp_read) if some are found, using the select(). If block is non zero, the function call blocks until a packet arrives
 
296
.PP
 
297
\fBParameters:\fP
 
298
.RS 4
 
299
\fIblock\fP used to control blocking in the select() function, 1 = block forever, and 0 = don't block
 
300
.RE
 
301
.PP
 
302
\fBReturns:\fP
 
303
.RS 4
111
304
Returns a positive integer if packets were processed, and -1 if an error was found. 
 
305
.RE
112
306
.PP
113
 
Definition at line 499 of file snmp_agent.c.
 
307
Definition at line 500 of file snmp_agent.c.
114
308
.PP
115
309
References snmp_log().
116
 
.SS "int check_acm (netsnmp_agent_session * asp, u_char type)"
117
 
.PP
118
 
\fBTodo: \fP
119
 
.in +1c
120
 
 make this be more intelligent about ranges. Right now we merely take the highest level commonality of a registration range and use that. At times we might be able to be smarter about checking the range itself as opposed to the node above where the range exists, but I doubt this will come up all that frequently. 
121
 
.PP
122
 
Definition at line 1865 of file snmp_agent.c.
123
 
.PP
124
 
References variable_list::name, variable_list::name_length, netsnmp_request_info_s::next, variable_list::next_variable, netsnmp_request_info_s::orig_repeat, netsnmp_request_info_s::repeat, netsnmp_request_info_s::requestvb, netsnmp_request_info_s::requestvb_start, snmp_set_var_typed_value(), and variable_list::type.
125
 
.PP
126
 
Referenced by handle_getnext_loop(), and handle_pdu().
127
310
.SS "int check_getnext_results (netsnmp_agent_session * asp)"
128
311
.PP
129
 
returns 1 if there are valid GETNEXT requests left.
130
 
.PP
131
 
Returns 0 if not. 
132
 
.PP
133
 
Definition at line 2491 of file snmp_agent.c.
 
312
returns 1 if there are valid GETNEXT requests left. Returns 0 if not. Definition at line 2491 of file snmp_agent.c.
134
313
.PP
135
314
References netsnmp_request_info_s::inclusive, netsnmp_request_info_s::index, variable_list::name, variable_list::name_length, netsnmp_request_info_s::next, netsnmp_request_info_s::range_end, netsnmp_request_info_s::range_end_len, netsnmp_request_info_s::repeat, netsnmp_request_info_s::requestvb, snmp_oid_compare(), snmp_set_var_typed_value(), and variable_list::type.
136
315
.PP
137
316
Referenced by handle_getnext_loop().
138
 
.SS "void dump_sess_list (void)"
139
 
.PP
140
 
if asp->pdu
141
 
.PP
142
 
Definition at line 1512 of file snmp_agent.c.
143
317
.SS "int handle_getnext_loop (netsnmp_agent_session * asp)"
144
318
.PP
145
 
repeatedly calls getnext handlers looking for an answer till all requests are satisified.
146
 
.PP
147
 
It's expected that one pass has been made before entering this function 
148
 
.PP
149
 
Definition at line 2596 of file snmp_agent.c.
150
 
.PP
151
 
References check_acm(), check_getnext_results(), and variable_list::next_variable.
 
319
repeatedly calls getnext handlers looking for an answer till all requests are satisified. It's expected that one pass has been made before entering this function Definition at line 2596 of file snmp_agent.c.
 
320
.PP
 
321
References check_getnext_results(), and variable_list::next_variable.
152
322
.PP
153
323
Referenced by handle_pdu().
154
324
.SS "int handle_pdu (netsnmp_agent_session * asp)"
155
325
.PP
156
 
This function calls into netsnmp_set_mode_request_error, sets error_value given a reqinfo->mode value.
157
 
.PP
158
 
It's used to send specific errors back to the agent to process accordingly.
159
 
.PP
160
 
If error_value is set to SNMP_NOSUCHOBJECT, SNMP_NOSUCHINSTANCE, or SNMP_ENDOFMIBVIEW the following is applicable: Sets the error_value to request->requestvb->type if  reqinfo->mode value is set to MODE_GET. If the reqinfo->mode  value is set to MODE_GETNEXT or MODE_GETBULK the code calls  snmp_log logging an error message.
161
 
.PP
162
 
Otherwise, the request->status value is checked, if it's < 0 snmp_log is called with an error message and SNMP_ERR_GENERR is  assigned to request->status. If the request->status value is >= 0 the error_value is set to request->status.
163
 
.PP
164
 
\fBParameters: \fP
165
 
.in +1c
166
 
.TP
167
 
\fB\fIreqinfo\fP\fP
168
 
is a pointer to the netsnmp_agent_request_info struct. It contains the reqinfo->mode which is required to set error_value or log error messages.
169
 
.TP
170
 
\fB\fIrequest\fP\fP
171
 
is a pointer to the netsnmp_request_info struct. The  error_value is set to request->requestvb->type
172
 
.TP
173
 
\fB\fIerror_value\fP\fP
174
 
is the exception value you want to set, below are possible values.
175
 
.TP
 
326
This function calls into netsnmp_set_mode_request_error, sets error_value given a reqinfo->mode value. It's used to send specific errors back to the agent to process accordingly.
 
327
.PP
 
328
If error_value is set to SNMP_NOSUCHOBJECT, SNMP_NOSUCHINSTANCE, or SNMP_ENDOFMIBVIEW the following is applicable: Sets the error_value to request->requestvb->type if reqinfo->mode value is set to MODE_GET. If the reqinfo->mode value is set to MODE_GETNEXT or MODE_GETBULK the code calls snmp_log logging an error message.
 
329
.PP
 
330
Otherwise, the request->status value is checked, if it's < 0 snmp_log is called with an error message and SNMP_ERR_GENERR is assigned to request->status. If the request->status value is >= 0 the error_value is set to request->status.
 
331
.PP
 
332
\fBParameters:\fP
 
333
.RS 4
 
334
\fIreqinfo\fP is a pointer to the netsnmp_agent_request_info struct. It contains the reqinfo->mode which is required to set error_value or log error messages.
 
335
.br
 
336
\fIrequest\fP is a pointer to the netsnmp_request_info struct. The error_value is set to request->requestvb->type
 
337
.br
 
338
\fIerror_value\fP is the exception value you want to set, below are possible values.
 
339
.IP "\(bu" 2
176
340
SNMP_NOSUCHOBJECT
177
 
.TP
 
341
.IP "\(bu" 2
178
342
SNMP_NOSUCHINSTANCE
179
 
.TP
 
343
.IP "\(bu" 2
180
344
SNMP_ENDOFMIBVIEW
181
 
.TP
 
345
.IP "\(bu" 2
182
346
SNMP_ERR_NOERROR
183
 
.TP
 
347
.IP "\(bu" 2
184
348
SNMP_ERR_TOOBIG
185
 
.TP
 
349
.IP "\(bu" 2
186
350
SNMP_ERR_NOSUCHNAME
187
 
.TP
 
351
.IP "\(bu" 2
188
352
SNMP_ERR_BADVALUE
189
 
.TP
 
353
.IP "\(bu" 2
190
354
SNMP_ERR_READONLY
191
 
.TP
 
355
.IP "\(bu" 2
192
356
SNMP_ERR_GENERR
193
 
.TP
 
357
.IP "\(bu" 2
194
358
SNMP_ERR_NOACCESS
195
 
.TP
 
359
.IP "\(bu" 2
196
360
SNMP_ERR_WRONGTYPE
197
 
.TP
 
361
.IP "\(bu" 2
198
362
SNMP_ERR_WRONGLENGTH
199
 
.TP
 
363
.IP "\(bu" 2
200
364
SNMP_ERR_WRONGENCODING
201
 
.TP
 
365
.IP "\(bu" 2
202
366
SNMP_ERR_WRONGVALUE
203
 
.TP
 
367
.IP "\(bu" 2
204
368
SNMP_ERR_NOCREATION
205
 
.TP
 
369
.IP "\(bu" 2
206
370
SNMP_ERR_INCONSISTENTVALUE
207
 
.TP
 
371
.IP "\(bu" 2
208
372
SNMP_ERR_RESOURCEUNAVAILABLE
209
 
.TP
 
373
.IP "\(bu" 2
210
374
SNMP_ERR_COMMITFAILED
211
 
.TP
 
375
.IP "\(bu" 2
212
376
SNMP_ERR_UNDOFAILED
213
 
.TP
 
377
.IP "\(bu" 2
214
378
SNMP_ERR_AUTHORIZATIONERROR
215
 
.TP
 
379
.IP "\(bu" 2
216
380
SNMP_ERR_NOTWRITABLE
217
 
.TP
 
381
.IP "\(bu" 2
218
382
SNMP_ERR_INCONSISTENTNAME
219
383
.PP
220
 
\fBReturns: \fP
221
 
.in +1c
 
384
.RE
 
385
.PP
 
386
\fBReturns:\fP
 
387
.RS 4
222
388
Returns error_value under all conditions. 
 
389
.RE
223
390
.PP
224
391
Definition at line 2890 of file snmp_agent.c.
225
392
.PP
226
 
References check_acm(), handle_getnext_loop(), variable_list::next_variable, snmp_set_var_typed_value(), and variable_list::type.
227
 
.SS "int handle_snmp_packet (int op, netsnmp_session * session, int reqid, netsnmp_pdu * pdu, void * magic)"
228
 
.PP
229
 
handles an incoming SNMP packet into the agent
230
 
.PP
231
 
Definition at line 1573 of file snmp_agent.c.
 
393
References handle_getnext_loop(), variable_list::next_variable, snmp_set_var_typed_value(), and variable_list::type.
 
394
.SS "int handle_snmp_packet (int op, \fBnetsnmp_session\fP * session, int reqid, \fBnetsnmp_pdu\fP * pdu, void * magic)"
 
395
.PP
 
396
handles an incoming SNMP packet into the agent Definition at line 1573 of file snmp_agent.c.
232
397
.PP
233
398
References snmp_pdu::command, snmp_session::s_snmp_errno, send_easy_trap(), and snmp_pdu::version.
 
399
.SS "\fBnetsnmp_request_info\fP* netsnmp_add_varbind_to_cache (netsnmp_agent_session * asp, int vbcount, \fBnetsnmp_variable_list\fP * varbind_ptr, netsnmp_subtree * tp)"
 
400
.PP
 
401
Definition at line 1670 of file snmp_agent.c.
 
402
.PP
 
403
References netsnmp_request_info_s::agent_req_info, netsnmp_request_info_s::delegated, netsnmp_request_info_s::inclusive, netsnmp_request_info_s::index, variable_list::name, variable_list::name_length, netsnmp_acm_check_subtree(), netsnmp_free_request_data_sets(), netsnmp_oid_find_prefix(), netsnmp_request_info_s::next, netsnmp_request_info_s::parent_data, netsnmp_request_info_s::prev, netsnmp_request_info_s::processed, netsnmp_request_info_s::range_end, netsnmp_request_info_s::range_end_len, netsnmp_request_info_s::requestvb, netsnmp_request_info_s::requestvb_start, netsnmp_request_info_s::status, netsnmp_request_info_s::subtree, and variable_list::type.
234
404
.SS "int netsnmp_check_transaction_id (int transaction_id)"
235
405
.PP
236
 
Decide if the requested transaction_id is still being processed within the agent.
237
 
.PP
238
 
This is used to validate whether a delayed cache (containing possibly freed pointers) is still usable.
239
 
.PP
240
 
returns SNMPERR_SUCCESS if it's still valid, or SNMPERR_GENERR if not. 
241
 
.PP
242
 
Definition at line 2401 of file snmp_agent.c.
 
406
Decide if the requested transaction_id is still being processed within the agent. This is used to validate whether a delayed cache (containing possibly freed pointers) is still usable.
 
407
.PP
 
408
returns SNMPERR_SUCCESS if it's still valid, or SNMPERR_GENERR if not. Definition at line 2401 of file snmp_agent.c.
243
409
.PP
244
410
Referenced by netsnmp_handler_check_cache().
245
 
.SS "int netsnmp_request_set_error (netsnmp_request_info * request, int error_value)"
246
 
.PP
247
 
set error for a request
248
 
.PP
249
 
\fBParameters: \fP
250
 
.in +1c
251
 
.TP
252
 
\fB\fIrequest\fP\fP
253
 
request which has error 
254
 
.TP
255
 
\fB\fIerror_value\fP\fP
256
 
error value for request 
 
411
.SS "int netsnmp_request_set_error (\fBnetsnmp_request_info\fP * request, int error_value)"
 
412
.PP
 
413
set error for a request \fBParameters:\fP
 
414
.RS 4
 
415
\fIrequest\fP request which has error 
 
416
.br
 
417
\fIerror_value\fP error value for request 
 
418
.RE
257
419
.PP
258
420
Definition at line 3140 of file snmp_agent.c.
259
421
.PP
260
422
References _request_set_error(), netsnmp_request_info_s::agent_req_info, and netsnmp_agent_request_info_s::mode.
261
 
.SS "NETSNMP_INLINE int netsnmp_request_set_error_all (netsnmp_request_info * requests, int error)"
262
 
.PP
263
 
set error for all requests
264
 
.PP
265
 
\fBParameters: \fP
266
 
.in +1c
267
 
.TP
268
 
\fB\fIrequests\fP\fP
269
 
request list 
270
 
.TP
271
 
\fB\fIerror_value\fP\fP
272
 
error value for requests 
273
 
.PP
274
 
\fBReturns: \fP
275
 
.in +1c
 
423
.SS "NETSNMP_INLINE int netsnmp_request_set_error_all (\fBnetsnmp_request_info\fP * requests, int error)"
 
424
.PP
 
425
set error for all requests \fBParameters:\fP
 
426
.RS 4
 
427
\fIrequests\fP request list 
 
428
.br
 
429
\fIerror_value\fP error value for requests 
 
430
.RE
 
431
.PP
 
432
\fBReturns:\fP
 
433
.RS 4
276
434
SNMPERR_SUCCESS, or an error code 
 
435
.RE
277
436
.PP
278
 
Definition at line 3155 of file snmp_agent.c.
 
437
paranoid sanity checks Definition at line 3155 of file snmp_agent.c.
279
438
.PP
280
439
References _request_set_error(), netsnmp_request_info_s::agent_req_info, netsnmp_agent_request_info_s::mode, netsnmp_request_info_s::next, and snmp_log().
281
440
.PP
282
441
Referenced by netsnmp_set_all_requests_error().
283
 
.SS "int netsnmp_set_all_requests_error (netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests, int error_value)"
284
 
.PP
285
 
set error for all request
286
 
.PP
287
 
\fBDeprecated: \fP
288
 
.in +1c
289
 
use netsnmp_request_set_error_all 
290
 
.PP
291
 
\fBParameters: \fP
292
 
.in +1c
293
 
.TP
294
 
\fB\fIreqinfo\fP\fP
295
 
agent_request_info pointer for requests 
296
 
.TP
297
 
\fB\fIrequests\fP\fP
298
 
request list 
299
 
.TP
300
 
\fB\fIerror_value\fP\fP
301
 
error value for requests 
302
 
.PP
303
 
\fBReturns: \fP
304
 
.in +1c
 
442
.SS "int netsnmp_set_all_requests_error (\fBnetsnmp_agent_request_info\fP * reqinfo, \fBnetsnmp_request_info\fP * requests, int error_value)"
 
443
.PP
 
444
set error for all request \fBDeprecated\fP
 
445
.RS 4
 
446
use netsnmp_request_set_error_all
 
447
.RE
 
448
.PP
 
449
\fBParameters:\fP
 
450
.RS 4
 
451
\fIreqinfo\fP agent_request_info pointer for requests 
 
452
.br
 
453
\fIrequests\fP request list 
 
454
.br
 
455
\fIerror_value\fP error value for requests 
 
456
.RE
 
457
.PP
 
458
\fBReturns:\fP
 
459
.RS 4
305
460
error_value 
 
461
.RE
306
462
.PP
307
463
Definition at line 3319 of file snmp_agent.c.
308
464
.PP
309
465
References netsnmp_request_set_error_all().
310
466
.PP
311
467
Referenced by netsnmp_multiplexer_helper_handler().
312
 
.SS "int netsnmp_set_mode_request_error (int mode, netsnmp_request_info * request, int error_value)"
313
 
.PP
314
 
deprecated, use netsnmp_request_set_error instead
315
 
.PP
316
 
\fBDeprecated: \fP
317
 
.in +1c
318
 
, use netsnmp_request_set_error instead 
319
 
.PP
320
 
\fBParameters: \fP
321
 
.in +1c
322
 
.TP
323
 
\fB\fImode\fP\fP
324
 
Net-SNMP agent processing mode 
325
 
.TP
326
 
\fB\fIrequest\fP\fP
327
 
request_info pointer 
328
 
.TP
329
 
\fB\fIerror_value\fP\fP
330
 
error value for requests 
331
 
.PP
332
 
\fBReturns: \fP
333
 
.in +1c
 
468
.SS "int netsnmp_set_mode_request_error (int mode, \fBnetsnmp_request_info\fP * request, int error_value)"
 
469
.PP
 
470
deprecated, use netsnmp_request_set_error instead \fBDeprecated\fP
 
471
.RS 4
 
472
, use netsnmp_request_set_error instead
 
473
.RE
 
474
.PP
 
475
\fBParameters:\fP
 
476
.RS 4
 
477
\fImode\fP Net-SNMP agent processing mode 
 
478
.br
 
479
\fIrequest\fP request_info pointer 
 
480
.br
 
481
\fIerror_value\fP error value for requests 
 
482
.RE
 
483
.PP
 
484
\fBReturns:\fP
 
485
.RS 4
334
486
error_value 
 
487
.RE
335
488
.PP
336
489
Definition at line 3303 of file snmp_agent.c.
337
490
.PP
338
491
References _request_set_error().
339
 
.SS "int netsnmp_set_request_error (netsnmp_agent_request_info * reqinfo, netsnmp_request_info * request, int error_value)"
340
 
.PP
341
 
deprecated, use netsnmp_request_set_error instead
342
 
.PP
343
 
\fBDeprecated: \fP
344
 
.in +1c
345
 
, use netsnmp_request_set_error instead 
346
 
.PP
347
 
\fBParameters: \fP
348
 
.in +1c
349
 
.TP
350
 
\fB\fIreqinfo\fP\fP
351
 
agent_request_info pointer for request 
352
 
.TP
353
 
\fB\fIrequest\fP\fP
354
 
request_info pointer 
355
 
.TP
356
 
\fB\fIerror_value\fP\fP
357
 
error value for requests 
358
 
.PP
359
 
\fBReturns: \fP
360
 
.in +1c
 
492
.SS "int netsnmp_set_request_error (\fBnetsnmp_agent_request_info\fP * reqinfo, \fBnetsnmp_request_info\fP * request, int error_value)"
 
493
.PP
 
494
deprecated, use netsnmp_request_set_error instead \fBDeprecated\fP
 
495
.RS 4
 
496
, use netsnmp_request_set_error instead
 
497
.RE
 
498
.PP
 
499
\fBParameters:\fP
 
500
.RS 4
 
501
\fIreqinfo\fP agent_request_info pointer for request 
 
502
.br
 
503
\fIrequest\fP request_info pointer 
 
504
.br
 
505
\fIerror_value\fP error value for requests 
 
506
.RE
 
507
.PP
 
508
\fBReturns:\fP
 
509
.RS 4
361
510
error_value 
 
511
.RE
 
512
.PP
 
513
 
362
514
.PP
363
515
\fBExamples: \fP
364
516
.in +1c
369
521
References _request_set_error(), and netsnmp_agent_request_info_s::mode.
370
522
.PP
371
523
Referenced by netsnmp_old_api_helper(), netsnmp_table_data_helper_handler(), netsnmp_table_data_set_helper_handler(), and table_helper_handler().
372
 
.SH "VARIABLE DOCUMENTATION"
373
 
.PP 
374
 
.SS "struct timeval starttime"
375
 
.PP
376
 
paranoid sanity checks
377
 
.PP
378
 
Definition at line 3182 of file snmp_agent.c.
379
 
.PP
380
 
Referenced by init_agent().
 
524
.SS "int netsnmp_wrap_up_request (netsnmp_agent_session * asp, int status)"
 
525
.PP
 
526
Definition at line 1343 of file snmp_agent.c.
 
527
.PP
 
528
References variable_list::next_variable, and variable_list::type.