summaryrefslogtreecommitdiff
path: root/man/netsnmp_oid_stash.3
blob: 45ab2e20372a34bccb407e3a345c768996b65edd (plain)
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
.TH "Store and retrieve data referenced by an OID." 3 "23 May 2010" "Version 5.4.3.pre1" "net-snmp" \" -*- nroff -*-
.ad l
.nh
.SH NAME
Store and retrieve data referenced by an OID. \- 
.PP
This is essentially a way of storing data associated with a given OID.  

.SS "Functions"

.in +1c
.ti -1c
.RI "\fBnetsnmp_oid_stash_node\fP * \fBnetsnmp_oid_stash_create_sized_node\fP (size_t mysize)"
.br
.RI "\fICreate an netsnmp_oid_stash \fBnode\fP. \fP"
.ti -1c
.RI "NETSNMP_INLINE \fBnetsnmp_oid_stash_node\fP * \fBnetsnmp_oid_stash_create_node\fP (void)"
.br
.RI "\fICreates a netsnmp_oid_stash_node. \fP"
.ti -1c
.RI "int \fBnetsnmp_oid_stash_add_data\fP (\fBnetsnmp_oid_stash_node\fP **root, oid *lookup, size_t lookup_len, void *mydata)"
.br
.RI "\fIadds data to the stash at a given oid. \fP"
.ti -1c
.RI "\fBnetsnmp_oid_stash_node\fP * \fBnetsnmp_oid_stash_get_node\fP (\fBnetsnmp_oid_stash_node\fP *root, oid *lookup, size_t lookup_len)"
.br
.RI "\fIreturns a \fBnode\fP associated with a given OID. \fP"
.ti -1c
.RI "\fBnetsnmp_oid_stash_node\fP * \fBnetsnmp_oid_stash_getnext_node\fP (\fBnetsnmp_oid_stash_node\fP *root, oid *lookup, size_t lookup_len)"
.br
.RI "\fIreturns the next \fBnode\fP associated with a given OID. \fP"
.ti -1c
.RI "void * \fBnetsnmp_oid_stash_get_data\fP (\fBnetsnmp_oid_stash_node\fP *root, oid *lookup, size_t lookup_len)"
.br
.RI "\fIreturns a data pointer associated with a given OID. \fP"
.ti -1c
.RI "int \fBnetsnmp_oid_stash_store_all\fP (int majorID, int minorID, void *serverarg, void *clientarg)"
.br
.RI "\fIa wrapper around netsnmp_oid_stash_store for use with a \fBsnmp_alarm\fP. \fP"
.ti -1c
.RI "void \fBnetsnmp_oid_stash_store\fP (\fBnetsnmp_oid_stash_node\fP *root, const char *tokenname, NetSNMPStashDump *dumpfn, oid *curoid, size_t curoid_len)"
.br
.RI "\fIstores data in a starsh \fBtree\fP to peristent storage. \fP"
.ti -1c
.RI "void \fBoid_stash_dump\fP (\fBnetsnmp_oid_stash_node\fP *root, char *prefix)"
.br
.RI "\fIFor debugging: dump the netsnmp_oid_stash \fBtree\fP to stdout. \fP"
.ti -1c
.RI "void \fBnetsnmp_oid_stash_free\fP (\fBnetsnmp_oid_stash_node\fP **root, NetSNMPStashFreeNode *freefn)"
.br
.RI "\fIFrees the contents of a netsnmp_oid_stash \fBtree\fP. \fP"
.ti -1c
.RI "void \fBnetsnmp_oid_stash_no_free\fP (void *bogus)"
.br
.in -1c
.SH "Detailed Description"
.PP 
This is essentially a way of storing data associated with a given OID. 

It stores a bunch of data pointers within a memory \fBtree\fP that allows fairly efficient lookups with a heavily populated \fBtree\fP. 
.SH "Function Documentation"
.PP 
.SS "int netsnmp_oid_stash_add_data (\fBnetsnmp_oid_stash_node\fP ** root, oid * lookup, size_t lookup_len, void * mydata)"
.PP
adds data to the stash at a given oid. \fBParameters:\fP
.RS 4
\fIroot\fP the top of the stash \fBtree\fP 
.br
\fIlookup\fP the oid index to store the data at. 
.br
\fIlookup_len\fP the length of the lookup oid. 
.br
\fImydata\fP the data to store
.RE
.PP
\fBReturns:\fP
.RS 4
SNMPERR_SUCCESS on success, SNMPERR_GENERR if data is already there, SNMPERR_MALLOC on malloc failures or if arguments passed in with NULL values. 
.RE
.PP

.PP
Definition at line 83 of file oid_stash.c.
.SS "NETSNMP_INLINE \fBnetsnmp_oid_stash_node\fP* netsnmp_oid_stash_create_node (void)"
.PP
Creates a netsnmp_oid_stash_node. Assumes you want the default OID_STASH_CHILDREN_SIZE hash size for the \fBnode\fP. 
.PP
\fBReturns:\fP
.RS 4
NULL on error, otherwise the newly allocated \fBnode\fP 
.RE
.PP

.PP
Definition at line 66 of file oid_stash.c.
.SS "\fBnetsnmp_oid_stash_node\fP* netsnmp_oid_stash_create_sized_node (size_t mysize)"
.PP
Create an netsnmp_oid_stash \fBnode\fP. \fBParameters:\fP
.RS 4
\fImysize\fP the size of the child pointer array
.RE
.PP
\fBReturns:\fP
.RS 4
NULL on error, otherwise the newly allocated \fBnode\fP 
.RE
.PP

.PP
Definition at line 46 of file oid_stash.c.
.SS "void netsnmp_oid_stash_free (\fBnetsnmp_oid_stash_node\fP ** root, NetSNMPStashFreeNode * freefn)"
.PP
Frees the contents of a netsnmp_oid_stash \fBtree\fP. \fBParameters:\fP
.RS 4
\fIroot\fP the top of the \fBtree\fP (or branch to be freed) 
.br
\fIfreefn\fP The function to be called on each data (void *) pointer. If left NULL the system free() function will be called 
.RE
.PP

.PP
Definition at line 401 of file oid_stash.c.
.SS "void* netsnmp_oid_stash_get_data (\fBnetsnmp_oid_stash_node\fP * root, oid * lookup, size_t lookup_len)"
.PP
returns a data pointer associated with a given OID. This is equivelent to netsnmp_oid_stash_get_node, but returns only the data not the entire \fBnode\fP.
.PP
\fBParameters:\fP
.RS 4
\fIroot\fP the top of the stash 
.br
\fIlookup\fP the oid to search for 
.br
\fIlookup_len\fP the length of the search oid. 
.RE
.PP

.PP
Definition at line 282 of file oid_stash.c.
.SS "\fBnetsnmp_oid_stash_node\fP* netsnmp_oid_stash_get_node (\fBnetsnmp_oid_stash_node\fP * root, oid * lookup, size_t lookup_len)"
.PP
returns a \fBnode\fP associated with a given OID. \fBParameters:\fP
.RS 4
\fIroot\fP the top of the stash \fBtree\fP 
.br
\fIlookup\fP the oid to look up a \fBnode\fP for. 
.br
\fIlookup_len\fP the length of the lookup oid 
.RE
.PP

.PP
Definition at line 154 of file oid_stash.c.
.SS "\fBnetsnmp_oid_stash_node\fP* netsnmp_oid_stash_getnext_node (\fBnetsnmp_oid_stash_node\fP * root, oid * lookup, size_t lookup_len)"
.PP
returns the next \fBnode\fP associated with a given OID. INCOMPLETE. This is equivelent to a GETNEXT operation. 
.PP
Definition at line 191 of file oid_stash.c.
.SS "void netsnmp_oid_stash_store (\fBnetsnmp_oid_stash_node\fP * root, const char * tokenname, NetSNMPStashDump * dumpfn, oid * curoid, size_t curoid_len)"
.PP
stores data in a starsh \fBtree\fP to peristent storage. This function can be called to save all data in a stash \fBtree\fP to Net-SNMP's percent storage. Make sure you register a parsing function with the read_config system to re-incorperate your saved data into future trees.
.PP
\fBParameters:\fP
.RS 4
\fIroot\fP the top of the stash to store. 
.br
\fItokenname\fP the file token name to save in (passing 'snmpd' will save things into snmpd.conf). 
.br
\fIdumpfn\fP A function which can dump the data stored at a particular \fBnode\fP into a char buffer. 
.br
\fIcuroid\fP must be a pointer to a OID array of length MAX_OID_LEN. 
.br
\fIcuroid_len\fP must be 0 for the top level call. 
.RE
.PP

.PP
Definition at line 334 of file oid_stash.c.
.SS "int netsnmp_oid_stash_store_all (int majorID, int minorID, void * serverarg, void * clientarg)"
.PP
a wrapper around netsnmp_oid_stash_store for use with a \fBsnmp_alarm\fP. when calling \fBsnmp_alarm\fP, you can list this as a callback. The clientarg should be a pointer to a netsnmp_oid_stash_save_info pointer. It can also be called directly, of course. The last argument (clientarg) is the only one that is used. The rest are ignored by the function. 
.PP
\fBParameters:\fP
.RS 4
\fImajorID\fP 
.br
\fIminorID\fP 
.br
\fIserverarg\fP 
.br
\fIclientarg\fP A pointer to a netsnmp_oid_stash_save_info structure. 
.RE
.PP

.PP
Definition at line 304 of file oid_stash.c.
.SS "void oid_stash_dump (\fBnetsnmp_oid_stash_node\fP * root, char * prefix)"
.PP
For debugging: dump the netsnmp_oid_stash \fBtree\fP to stdout. \fBParameters:\fP
.RS 4
\fIroot\fP The top of the \fBtree\fP 
.br
\fIprefix\fP a character string prefix printed to the beginning of each line. 
.RE
.PP

.PP
Definition at line 374 of file oid_stash.c.
.SH "Author"
.PP 
Generated automatically by Doxygen for net-snmp from the source code.