~ubuntu-branches/ubuntu/trusty/net-snmp/trusty

« back to all changes in this revision

Viewing changes to man/netsnmp_table.3

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2004-09-13 12:06:21 UTC
  • Revision ID: james.westby@ubuntu.com-20040913120621-g952ntonlleihcvm
Tags: upstream-5.1.1
ImportĀ upstreamĀ versionĀ 5.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.TH "table: Helps you implement a table." 3 "19 Mar 2004" "net-snmp" \" -*- nroff -*-
 
2
.ad l
 
3
.nh
 
4
.SH NAME
 
5
table: Helps you implement a table. \- This handler helps you implement a table by doing some of the processing for you. 
 
6
More...
 
7
.SS "Modules"
 
8
 
 
9
.in +1c
 
10
.ti -1c
 
11
.RI "\fBtable_array: Helps you implement a table when data can be stored locally. The data is stored in a sorted array, using a binary search for lookups.\fP"
 
12
.br
 
13
.RI "\fIThe table_array handler is used (automatically) in conjuntion with the \fBtable\fP handler.\fP"
 
14
.PP
 
15
.in +1c
 
16
 
 
17
.ti -1c
 
18
.RI "\fBtable_data: Helps you implement a table with datamatted storage.\fP"
 
19
.br
 
20
.RI "\fIThis helper helps you implement a table where all the indexes are expected to be stored within the agent itself and not in some external storage location.\fP"
 
21
.PP
 
22
.in +1c
 
23
 
 
24
.ti -1c
 
25
.RI "\fBtable_iterator: The table iterator helper is designed to simplify the task of writing a table handler for the net-snmp agent when the data being accessed is not in an oid sorted form and must be accessed externally.\fP"
 
26
.br
 
27
.RI "\fIFunctionally, it is a specialized version of the more generic table helper but easies the burden of GETNEXT processing by manually looping through all the data indexes retrieved through function calls which should be supplied by the module that wishes help.\fP"
 
28
.PP
 
29
 
 
30
.in -1c
 
31
.SS "Functions"
 
32
 
 
33
.in +1c
 
34
.ti -1c
 
35
.RI "\fBnetsnmp_mib_handler\fP * \fBnetsnmp_get_table_handler\fP (netsnmp_table_registration_info *tabreq)"
 
36
.br
 
37
.RI "\fIGiven a netsnmp_table_registration_info object, creates a table handler.\fP"
 
38
.ti -1c
 
39
.RI "int \fBnetsnmp_register_table\fP (\fBnetsnmp_handler_registration\fP *reginfo, netsnmp_table_registration_info *tabreq)"
 
40
.br
 
41
.RI "\fIcreates a table handler given the netsnmp_table_registration_info object, inserts it into the request chain and then calls \fBnetsnmp_register_handler()\fP to register the table into the agent.\fP"
 
42
.ti -1c
 
43
.RI "NETSNMP_INLINE netsnmp_table_request_info * \fBnetsnmp_extract_table_info\fP (netsnmp_request_info *request)"
 
44
.br
 
45
.RI "\fIExtracts the processed table information from a given request.\fP"
 
46
.ti -1c
 
47
.RI "netsnmp_table_registration_info * \fBnetsnmp_find_table_registration_info\fP (\fBnetsnmp_handler_registration\fP *reginfo)"
 
48
.br
 
49
.RI "\fIextracts the registered netsnmp_table_registration_info object from a netsnmp_handler_registration object\fP"
 
50
.ti -1c
 
51
.RI "int \fBtable_helper_handler\fP (\fBnetsnmp_mib_handler\fP *handler, \fBnetsnmp_handler_registration\fP *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)"
 
52
.br
 
53
.RI "\fIimplements the table helper handler\fP"
 
54
.ti -1c
 
55
.RI "int \fBnetsnmp_table_build_result\fP (\fBnetsnmp_handler_registration\fP *reginfo, netsnmp_request_info *reqinfo, netsnmp_table_request_info *table_info, u_char type, u_char *result, size_t result_len)"
 
56
.br
 
57
.RI "\fIBuilds the result to be returned to the agent given the table information.\fP"
 
58
.ti -1c
 
59
.RI "int \fBnetsnmp_table_build_oid\fP (\fBnetsnmp_handler_registration\fP *reginfo, netsnmp_request_info *reqinfo, netsnmp_table_request_info *table_info)"
 
60
.br
 
61
.RI "\fIgiven a registration info object, a request object and the table info object it builds the request->requestvb->name oid from the index values and column information found in the table_info object.\fP"
 
62
.ti -1c
 
63
.RI "int \fBnetsnmp_table_build_oid_from_index\fP (\fBnetsnmp_handler_registration\fP *reginfo, netsnmp_request_info *reqinfo, netsnmp_table_request_info *table_info)"
 
64
.br
 
65
.RI "\fIBuilds an oid from index information.\fP"
 
66
.ti -1c
 
67
.RI "int \fBnetsnmp_update_variable_list_from_index\fP (netsnmp_table_request_info *tri)"
 
68
.br
 
69
.RI "\fIparses an OID into table indexses\fP"
 
70
.ti -1c
 
71
.RI "int \fBnetsnmp_update_indexes_from_variable_list\fP (netsnmp_table_request_info *tri)"
 
72
.br
 
73
.RI "\fIbuilds an oid given a set of indexes.\fP"
 
74
.ti -1c
 
75
.RI "int \fBnetsnmp_check_getnext_reply\fP (netsnmp_request_info *request, oid *prefix, size_t prefix_len, netsnmp_variable_list *newvar, netsnmp_variable_list **outvar)"
 
76
.br
 
77
.RI "\fIchecks the original request against the current data being passed in if its greater than the request oid but less than the current valid return, set the current valid return to the new value.\fP"
 
78
.in -1c
 
79
.SH "DETAILED DESCRIPTION"
 
80
.PP 
 
81
This handler helps you implement a table by doing some of the processing for you.
 
82
.PP
 
83
This handler truly shows the power of the new handler mechanism. By creating a table handler and injecting it into your calling chain, or by using the \fBnetsnmp_register_table()\fP function to register your table, you get access to some pre-parsed information. Specifically, the table handler pulls out the column number and indexes from the request oid so that you don't have to do the complex work to do that parsing within your own code.
 
84
.PP
 
85
To do this, the table handler needs to know up front how your table is structured. To inform it about this, you fill in a table_registeration_info structure that is passed to the table handler. It contains the asn index types for the table as well as the minimum and maximum column that should be used. 
 
86
.SH "FUNCTION DOCUMENTATION"
 
87
.PP 
 
88
.SS "int netsnmp_check_getnext_reply (netsnmp_request_info * request, oid * prefix, size_t prefix_len, netsnmp_variable_list * newvar, netsnmp_variable_list ** outvar)"
 
89
.PP
 
90
checks the original request against the current data being passed in if its greater than the request oid but less than the current valid return, set the current valid return to the new value.
 
91
.PP
 
92
returns 1 if outvar was replaced with the oid from newvar (success). returns 0 if not. 
 
93
.PP
 
94
Definition at line 700 of file table.c.
 
95
.PP
 
96
References variable_list::name, variable_list::name_length, netsnmp_request_info_s::requestvb, snmp_oid_compare(), snmp_set_var_typed_value(), variable_list::type, variable_list::val, and variable_list::val_len.
 
97
.SS "NETSNMP_INLINE netsnmp_table_request_info* netsnmp_extract_table_info (netsnmp_request_info * request)"
 
98
.PP
 
99
Extracts the processed table information from a given request.
 
100
.PP
 
101
Call this from subhandlers on a request to extract the processed netsnmp_request_info information. The resulting information includes the index values and the column number.
 
102
.PP
 
103
\fBParameters: \fP
 
104
.in +1c
 
105
.TP
 
106
\fB\fIrequest\fP\fP
 
107
populated netsnmp request structure
 
108
.PP
 
109
\fBReturns: \fP
 
110
.in +1c
 
111
populated netsnmp_table_request_info structure 
 
112
.PP
 
113
Definition at line 123 of file table.c.
 
114
.PP
 
115
References netsnmp_request_get_list_data().
 
116
.PP
 
117
Referenced by netsnmp_insert_iterator_context(), netsnmp_table_data_helper_handler(), netsnmp_table_data_set_helper_handler(), netsnmp_table_iterator_helper_handler(), and table_helper_handler().
 
118
.SS "netsnmp_table_registration_info* netsnmp_find_table_registration_info (\fBnetsnmp_handler_registration\fP * reginfo)"
 
119
.PP
 
120
extracts the registered netsnmp_table_registration_info object from a netsnmp_handler_registration object
 
121
.PP
 
122
Definition at line 132 of file table.c.
 
123
.PP
 
124
References netsnmp_find_handler_data_by_name().
 
125
.PP
 
126
Referenced by netsnmp_table_data_helper_handler(), and netsnmp_table_iterator_helper_handler().
 
127
.SS "\fBnetsnmp_mib_handler\fP* netsnmp_get_table_handler (netsnmp_table_registration_info * tabreq)"
 
128
.PP
 
129
Given a netsnmp_table_registration_info object, creates a table handler.
 
130
.PP
 
131
You can use this table handler by injecting it into a calling chain. When the handler gets called, it'll do processing and store it's information into the request->parent_data structure.
 
132
.PP
 
133
The table helper handler pulls out the column number and indexes from  the request oid so that you don't have to do the complex work of parsing within your own code.
 
134
.PP
 
135
\fBParameters: \fP
 
136
.in +1c
 
137
.TP
 
138
\fB\fItabreq\fP\fP
 
139
is a pointer to a netsnmp_table_registration_info struct. The table handler needs to know up front how your table is structured. A netsnmp_table_registeration_info structure that is  passed to the table handler should contain the asn index types for the  table as well as the minimum and maximum column that should be used.
 
140
.PP
 
141
\fBReturns: \fP
 
142
.in +1c
 
143
Returns a pointer to a netsnmp_mib_handler struct which contains the handler's name and the access method 
 
144
.PP
 
145
Definition at line 83 of file table.c.
 
146
.PP
 
147
References netsnmp_table_registration_info_s::indexes, netsnmp_mib_handler_s::myvoid, netsnmp_create_handler(), netsnmp_table_registration_info_s::number_indexes, snmp_log(), and table_helper_handler().
 
148
.PP
 
149
Referenced by netsnmp_register_table().
 
150
.SS "int netsnmp_register_table (\fBnetsnmp_handler_registration\fP * reginfo, netsnmp_table_registration_info * tabreq)"
 
151
.PP
 
152
creates a table handler given the netsnmp_table_registration_info object, inserts it into the request chain and then calls \fBnetsnmp_register_handler()\fP to register the table into the agent.
 
153
.PP
 
154
Definition at line 106 of file table.c.
 
155
.PP
 
156
References netsnmp_get_table_handler(), netsnmp_inject_handler(), and netsnmp_register_handler().
 
157
.PP
 
158
Referenced by netsnmp_register_table_data(), netsnmp_register_table_iterator(), and netsnmp_table_container_register().
 
159
.SS "int netsnmp_table_build_oid (\fBnetsnmp_handler_registration\fP * reginfo, netsnmp_request_info * reqinfo, netsnmp_table_request_info * table_info)"
 
160
.PP
 
161
given a registration info object, a request object and the table info object it builds the request->requestvb->name oid from the index values and column information found in the table_info object.
 
162
.PP
 
163
Definition at line 611 of file table.c.
 
164
.PP
 
165
References netsnmp_table_request_info_s::colnum, netsnmp_table_request_info_s::indexes, variable_list::name, variable_list::name_length, netsnmp_request_info_s::requestvb, netsnmp_handler_registration_s::rootoid, and netsnmp_handler_registration_s::rootoid_len.
 
166
.PP
 
167
Referenced by netsnmp_table_build_result().
 
168
.SS "int netsnmp_table_build_oid_from_index (\fBnetsnmp_handler_registration\fP * reginfo, netsnmp_request_info * reqinfo, netsnmp_table_request_info * table_info)"
 
169
.PP
 
170
Builds an oid from index information.
 
171
.PP
 
172
Definition at line 642 of file table.c.
 
173
.PP
 
174
References netsnmp_table_request_info_s::colnum, netsnmp_table_request_info_s::index_oid, netsnmp_table_request_info_s::index_oid_len, variable_list::name, variable_list::name_length, variable_list::name_loc, netsnmp_request_info_s::requestvb, netsnmp_handler_registration_s::rootoid, netsnmp_handler_registration_s::rootoid_len, and SNMP_FREE.
 
175
.SS "int netsnmp_table_build_result (\fBnetsnmp_handler_registration\fP * reginfo, netsnmp_request_info * reqinfo, netsnmp_table_request_info * table_info, u_char type, u_char * result, size_t result_len)"
 
176
.PP
 
177
Builds the result to be returned to the agent given the table information.
 
178
.PP
 
179
Use this function to return results from lowel level handlers to the agent. It takes care of building the proper resulting oid (containing proper indexing) and inserts the result value into the returning varbind. 
 
180
.PP
 
181
Definition at line 578 of file table.c.
 
182
.PP
 
183
References variable_list::name, variable_list::name_loc, netsnmp_table_build_oid(), netsnmp_request_info_s::requestvb, and snmp_set_var_typed_value().
 
184
.SS "int netsnmp_update_indexes_from_variable_list (netsnmp_table_request_info * tri)"
 
185
.PP
 
186
builds an oid given a set of indexes.
 
187
.PP
 
188
Definition at line 682 of file table.c.
 
189
.PP
 
190
References netsnmp_table_request_info_s::index_oid, netsnmp_table_request_info_s::index_oid_len, and netsnmp_table_request_info_s::indexes.
 
191
.SS "int netsnmp_update_variable_list_from_index (netsnmp_table_request_info * tri)"
 
192
.PP
 
193
parses an OID into table indexses
 
194
.PP
 
195
Definition at line 671 of file table.c.
 
196
.PP
 
197
References netsnmp_table_request_info_s::index_oid, netsnmp_table_request_info_s::index_oid_len, netsnmp_table_request_info_s::indexes, and parse_oid_indexes().
 
198
.SS "int table_helper_handler (\fBnetsnmp_mib_handler\fP * handler, \fBnetsnmp_handler_registration\fP * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)"
 
199
.PP
 
200
implements the table helper handler
 
201
.PP
 
202
Definition at line 140 of file table.c.
 
203
.PP
 
204
References netsnmp_table_request_info_s::colnum, netsnmp_mib_handler_s::handler_name, netsnmp_table_request_info_s::index_oid, netsnmp_table_request_info_s::index_oid_len, netsnmp_table_request_info_s::indexes, netsnmp_table_registration_info_s::indexes, netsnmp_table_registration_info_s::max_column, netsnmp_table_registration_info_s::min_column, netsnmp_agent_request_info_s::mode, netsnmp_mib_handler_s::myvoid, variable_list::name, variable_list::name_length, variable_list::name_loc, netsnmp_call_next_handler(), netsnmp_extract_table_info(), netsnmp_request_add_list_data(), netsnmp_set_request_error(), netsnmp_request_info_s::next, netsnmp_mib_handler_s::next, variable_list::next_variable, netsnmp_table_registration_info_s::number_indexes, netsnmp_table_request_info_s::number_indexes, netsnmp_request_info_s::processed, netsnmp_table_request_info_s::reg_info, netsnmp_request_info_s::requestvb, netsnmp_handler_registration_s::rootoid, netsnmp_handler_registration_s::rootoid_len, snmp_log(), SNMP_MALLOC_TYPEDEF, snmp_oid_compare(), sprint_realloc_by_type(), netsnmp_request_info_s::status, variable_list::type, and netsnmp_table_registration_info_s::valid_columns.
 
205
.PP
 
206
Referenced by netsnmp_get_table_handler().