~ubuntu-branches/ubuntu/hardy/net-snmp/hardy-proposed

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
.TH "storage space for defaults" 3 "14 Jul 2006" "Version 5.2.3" "net-snmp" \" -*- nroff -*-
.ad l
.nh
.SH NAME
storage space for defaults \- The purpose of the default storage is three-fold:.  

.PP
.SS "Data Structures"

.in +1c
.ti -1c
.RI "struct \fBnetsnmp_ds_read_config_s\fP"
.br
.in -1c
.SS "Typedefs"

.in +1c
.ti -1c
.RI "typedef \fBnetsnmp_ds_read_config_s\fP \fBnetsnmp_ds_read_config\fP"
.br
.in -1c
.SS "Functions"

.in +1c
.ti -1c
.RI "void \fBnetsnmp_ds_handle_config\fP (const char *token, char *line)"
.br
.ti -1c
.RI "int \fBnetsnmp_ds_set_boolean\fP (int storeid, int which, int value)"
.br
.RI "\fIStores 'true' or 'false' given an int value for value into netsnmp_ds_booleans[store][which] slot. \fP"
.ti -1c
.RI "int \fBnetsnmp_ds_toggle_boolean\fP (int storeid, int which)"
.br
.ti -1c
.RI "int \fBnetsnmp_ds_get_boolean\fP (int storeid, int which)"
.br
.ti -1c
.RI "int \fBnetsnmp_ds_set_int\fP (int storeid, int which, int value)"
.br
.ti -1c
.RI "int \fBnetsnmp_ds_get_int\fP (int storeid, int which)"
.br
.ti -1c
.RI "int \fBnetsnmp_ds_set_string\fP (int storeid, int which, const char *value)"
.br
.ti -1c
.RI "char * \fBnetsnmp_ds_get_string\fP (int storeid, int which)"
.br
.ti -1c
.RI "int \fBnetsnmp_ds_set_void\fP (int storeid, int which, void *value)"
.br
.ti -1c
.RI "void * \fBnetsnmp_ds_get_void\fP (int storeid, int which)"
.br
.ti -1c
.RI "int \fBnetsnmp_ds_register_config\fP (u_char type, const char *ftype, const char *token, int storeid, int which)"
.br
.ti -1c
.RI "int \fBnetsnmp_ds_register_premib\fP (u_char type, const char *ftype, const char *token, int storeid, int which)"
.br
.ti -1c
.RI "void \fBnetsnmp_ds_shutdown\fP ()"
.br
.in -1c
.SH "Detailed Description"
.PP 
The purpose of the default storage is three-fold:. 
.PP
1) To create a global storage space without creating a whole bunch of globally accessible variables or a whole bunch of access functions to work with more privately restricted variables.
.PP
2) To provide a single location where the thread lock- ing needs to be implemented. At the time of this writing, however, thread locking is not yet in place.
.PP
3) To reduce the number of cross dependencies between code pieces that may or may not be linked together in the long run. This provides for a single loca- tion in which configuration data, for example, can be stored for a separate section of code that may not be linked in to the application in question.
.PP
The functions defined here implement these goals.
.PP
Currently, three data types are supported: booleans, inte- gers, and strings. Each of these data types have separate storage spaces. In addition, the storage space for each data type is divided further by the application level. Currently, there are two storage spaces. The first is reserved for the SNMP library itself. The second is intended for use in applications and is not modified or checked by the library, and, therefore, this is the space usable by you.
.PP
These definitions correspond with the 'storid' argument to the API
.IP "\(bu" 2
#define NETSNMP_DS_LIBRARY_ID 0
.IP "\(bu" 2
#define NETSNMP_DS_APPLICATION_ID 1
.IP "\(bu" 2
#define NETSNMP_DS_TOKEN_ID 2
.PP
.PP
These definitions correspond with the 'which' argument to the API, when the storeid argument is NETSNMP_DS_LIBRARY_ID
.PP
library booleans
.PP
.IP "\(bu" 2
#define NETSNMP_DS_LIB_MIB_ERRORS 0
.IP "\(bu" 2
#define NETSNMP_DS_LIB_SAVE_MIB_DESCRS 1
.IP "\(bu" 2
#define NETSNMP_DS_LIB_MIB_COMMENT_TERM 2
.IP "\(bu" 2
#define NETSNMP_DS_LIB_MIB_PARSE_LABEL 3
.IP "\(bu" 2
#define NETSNMP_DS_LIB_DUMP_PACKET 4
.IP "\(bu" 2
#define NETSNMP_DS_LIB_LOG_TIMESTAMP 5
.IP "\(bu" 2
#define NETSNMP_DS_LIB_DONT_READ_CONFIGS 6
.IP "\(bu" 2
#define NETSNMP_DS_LIB_MIB_REPLACE 7 replace objects from latest module
.IP "\(bu" 2
#define NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM 8 print only numeric enum values
.IP "\(bu" 2
#define NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS 9 print only numeric enum values
.IP "\(bu" 2
#define NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS 10 dont print oid indexes specially
.IP "\(bu" 2
#define NETSNMP_DS_LIB_ALARM_DONT_USE_SIG 11 don't use the alarm() signal
.IP "\(bu" 2
#define NETSNMP_DS_LIB_PRINT_FULL_OID 12 print fully qualified oids
.IP "\(bu" 2
#define NETSNMP_DS_LIB_QUICK_PRINT 13 print very brief output for parsing
.IP "\(bu" 2
#define NETSNMP_DS_LIB_RANDOM_ACCESS 14 random access to oid labels
.IP "\(bu" 2
#define NETSNMP_DS_LIB_REGEX_ACCESS 15 regex matching to oid labels
.IP "\(bu" 2
#define NETSNMP_DS_LIB_DONT_CHECK_RANGE 16 don't check values for ranges on send
.IP "\(bu" 2
#define NETSNMP_DS_LIB_NO_TOKEN_WARNINGS 17 no warn about unknown config tokens
.IP "\(bu" 2
#define NETSNMP_DS_LIB_NUMERIC_TIMETICKS 18 print timeticks as a number
.IP "\(bu" 2
#define NETSNMP_DS_LIB_ESCAPE_QUOTES 19 shell escape quote marks in oids
.IP "\(bu" 2
#define NETSNMP_DS_LIB_REVERSE_ENCODE 20 encode packets from back to front
.IP "\(bu" 2
#define NETSNMP_DS_LIB_PRINT_BARE_VALUE 21 just print value (not OID = value)
.IP "\(bu" 2
#define NETSNMP_DS_LIB_EXTENDED_INDEX 22 print extended index format [x1][x2]
.IP "\(bu" 2
#define NETSNMP_DS_LIB_PRINT_HEX_TEXT 23 print ASCII text along with hex strings
.IP "\(bu" 2
#define NETSNMP_DS_LIB_PRINT_UCD_STYLE_OID 24 print OID's using the UCD-style prefix suppression
.IP "\(bu" 2
#define NETSNMP_DS_LIB_READ_UCD_STYLE_OID 25 require top-level OIDs to be prefixed with a dot
.IP "\(bu" 2
#define NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG 26 have the pre-mib parsing config tokens been processed
.IP "\(bu" 2
#define NETSNMP_DS_LIB_HAVE_READ_CONFIG 27 have the config tokens been processed
.IP "\(bu" 2
#define NETSNMP_DS_LIB_QUICKE_PRINT 28
.IP "\(bu" 2
#define NETSNMP_DS_LIB_DONT_PRINT_UNITS 29 don't print UNITS suffix
.IP "\(bu" 2
#define NETSNMP_DS_LIB_NO_DISPLAY_HINT 30 don't apply DISPLAY-HINTs
.IP "\(bu" 2
#define NETSNMP_DS_LIB_16BIT_IDS 31 restrict requestIDs, etc to 16-bit values
.IP "\(bu" 2
#define NETSNMP_DS_LIB_DONT_PERSIST_STATE 32 don't save/load any persistant state
.IP "\(bu" 2
#define NETSNMP_DS_LIB_2DIGIT_HEX_OUTPUT 33 print a leading 0 on hex values <= 'f'
.PP
.PP
library integers
.PP
.IP "\(bu" 2
#define NETSNMP_DS_LIB_MIB_WARNINGS 0
.IP "\(bu" 2
#define NETSNMP_DS_LIB_SECLEVEL 1
.IP "\(bu" 2
#define NETSNMP_DS_LIB_SNMPVERSION 2
.IP "\(bu" 2
#define NETSNMP_DS_LIB_DEFAULT_PORT 3
.IP "\(bu" 2
#define NETSNMP_DS_LIB_OID_OUTPUT_FORMAT 4
.IP "\(bu" 2
#define NETSNMP_DS_LIB_STRING_OUTPUT_FORMAT 5
.PP
.PP
library strings
.PP
.IP "\(bu" 2
#define NETSNMP_DS_LIB_SECNAME 0
.IP "\(bu" 2
#define NETSNMP_DS_LIB_CONTEXT 1
.IP "\(bu" 2
#define NETSNMP_DS_LIB_PASSPHRASE 2
.IP "\(bu" 2
#define NETSNMP_DS_LIB_AUTHPASSPHRASE 3
.IP "\(bu" 2
#define NETSNMP_DS_LIB_PRIVPASSPHRASE 4
.IP "\(bu" 2
#define NETSNMP_DS_LIB_OPTIONALCONFIG 5
.IP "\(bu" 2
#define NETSNMP_DS_LIB_APPTYPE 6
.IP "\(bu" 2
#define NETSNMP_DS_LIB_COMMUNITY 7
.IP "\(bu" 2
#define NETSNMP_DS_LIB_PERSISTENT_DIR 8
.IP "\(bu" 2
#define NETSNMP_DS_LIB_CONFIGURATION_DIR 9
.IP "\(bu" 2
#define NETSNMP_DS_LIB_SECMODEL 10
.IP "\(bu" 2
#define NETSNMP_DS_LIB_MIBDIRS 11
.IP "\(bu" 2
#define NETSNMP_DS_LIB_OIDSUFFIX 12
.IP "\(bu" 2
#define NETSNMP_DS_LIB_OIDPREFIX 13
.IP "\(bu" 2
#define NETSNMP_DS_LIB_CLIENT_ADDR 14
.IP "\(bu" 2
#define NETSNMP_DS_LIB_TEMP_FILE_PATTERN 15
.IP "\(bu" 2
#define NETSNMP_DS_LIB_AUTHMASTERKEY 16
.IP "\(bu" 2
#define NETSNMP_DS_LIB_PRIVMASTERKEY 17
.IP "\(bu" 2
#define NETSNMP_DS_LIB_AUTHLOCALIZEDKEY 18
.IP "\(bu" 2
#define NETSNMP_DS_LIB_PRIVLOCALIZEDKEY 19 
.PP

.SH "Function Documentation"
.PP 
.SS "int netsnmp_ds_set_boolean (int storeid, int which, int value)"
.PP
Stores 'true' or 'false' given an int value for value into netsnmp_ds_booleans[store][which] slot. 
.PP
\fBParameters:\fP
.RS 4
\fIstoreid\fP an index to the boolean storage container's first index(store)
.br
\fIwhich\fP an index to the boolean storage container's second index(which)
.br
\fIvalue\fP if > 0, 'true' is set into the slot otherwise 'false'
.RE
.PP
\fBReturns:\fP
.RS 4
Returns SNMPPERR_GENERR if the storeid and which parameters do not correspond to a valid slot, or SNMPERR_SUCCESS otherwise. 
.RE
.PP

.PP
Definition at line 197 of file default_store.c.
.PP
Referenced by init_agent(), netsnmp_ds_handle_config(), read_configs(), read_premib_configs(), setup_tree(), and snmp_out_toggle_options().