OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / user / net-snmp / man / netsnmp_callback.3
1 .TH "A generic callback mechanism" 3 "23 Sep 2009" "Version 5.5" "net-snmp" \" -*- nroff -*-
2 .ad l
3 .nh
4 .SH NAME
5 A generic callback mechanism \- 
6 .SS "Defines"
7
8 .in +1c
9 .ti -1c
10 .RI "#define \fBCALLBACK_NAME_LOGGING\fP   1"
11 .br
12 .ti -1c
13 .RI "#define \fBLOCK_PER_CALLBACK_SUBID\fP   1"
14 .br
15 .ti -1c
16 .RI "#define \fBCALLBACK_LOCK\fP(maj, min)   ++_locks[maj][min]"
17 .br
18 .ti -1c
19 .RI "#define \fBCALLBACK_UNLOCK\fP(maj, min)   --_locks[maj][min]"
20 .br
21 .ti -1c
22 .RI "#define \fBCALLBACK_LOCK_COUNT\fP(maj, min)   _locks[maj][min]"
23 .br
24 .in -1c
25 .SS "Functions"
26
27 .in +1c
28 .ti -1c
29 .RI "NETSNMP_STATIC_INLINE int \fB_callback_lock\fP (int major, int minor, const char *warn, int assert)"
30 .br
31 .ti -1c
32 .RI "NETSNMP_STATIC_INLINE void \fB_callback_unlock\fP (int major, int minor)"
33 .br
34 .ti -1c
35 .RI "void \fBinit_callbacks\fP (void)"
36 .br
37 .ti -1c
38 .RI "int \fBsnmp_register_callback\fP (int major, int minor, SNMPCallback *new_callback, void *arg)"
39 .br
40 .RI "\fIThis function registers a generic callback function. \fP"
41 .ti -1c
42 .RI "int \fBnetsnmp_register_callback\fP (int major, int minor, SNMPCallback *new_callback, void *arg, int priority)"
43 .br
44 .ti -1c
45 .RI "int \fBsnmp_call_callbacks\fP (int major, int minor, void *caller_arg)"
46 .br
47 .RI "\fIThis function calls the callback function for each registered callback of type major and minor. \fP"
48 .ti -1c
49 .RI "int \fBsnmp_count_callbacks\fP (int major, int minor)"
50 .br
51 .ti -1c
52 .RI "int \fBsnmp_callback_available\fP (int major, int minor)"
53 .br
54 .ti -1c
55 .RI "int \fBsnmp_unregister_callback\fP (int major, int minor, SNMPCallback *target, void *arg, int matchargs)"
56 .br
57 .RI "\fIThis function unregisters a specified callback function given a major and minor type. \fP"
58 .ti -1c
59 .RI "int \fBnetsnmp_callback_clear_client_arg\fP (void *ptr, int i, int j)"
60 .br
61 .RI "\fIfind and clear client args that match ptr \fP"
62 .ti -1c
63 .RI "void \fBclear_callback\fP (void)"
64 .br
65 .ti -1c
66 .RI "struct \fBsnmp_gen_callback\fP * \fBsnmp_callback_list\fP (int major, int minor)"
67 .br
68 .in -1c
69 .SH "Function Documentation"
70 .PP 
71 .SS "int netsnmp_callback_clear_client_arg (void * ptr, int i, int j)"
72 .PP
73 find and clear client args that match ptr \fBParameters:\fP
74 .RS 4
75 \fIptr\fP pointer to search for 
76 .br
77 \fIi\fP callback id to start at 
78 .br
79 \fIj\fP callback subid to start at 
80 .RE
81 .PP
82
83 .PP
84 Definition at line 474 of file callback.c.
85 .SS "int snmp_call_callbacks (int major, int minor, void * caller_arg)"
86 .PP
87 This function calls the callback function for each registered callback of type major and minor. \fBParameters:\fP
88 .RS 4
89 \fImajor\fP is the SNMP callback major type used
90 .br
91 \fIminor\fP is the SNMP callback minor type used
92 .br
93 \fIcaller_arg\fP is a void pointer which is sent in as the callback's serverarg parameter, if needed.
94 .RE
95 .PP
96 \fBReturns:\fP
97 .RS 4
98 Returns SNMPERR_GENERR if major is >= MAX_CALLBACK_IDS or minor is >= MAX_CALLBACK_SUBIDS, otherwise SNMPERR_SUCCESS is returned.
99 .RE
100 .PP
101 \fBSee also:\fP
102 .RS 4
103 \fBsnmp_register_callback\fP 
104 .PP
105 \fBsnmp_unregister_callback\fP 
106 .RE
107 .PP
108
109 .PP
110 Definition at line 298 of file callback.c.
111 .SS "int snmp_register_callback (int major, int minor, SNMPCallback * new_callback, void * arg)"
112 .PP
113 This function registers a generic callback function. The major and minor values are used to set the new_callback function into a global static multi-dimensional array of type struct \fBsnmp_gen_callback\fP. The function makes sure to append this callback function at the end of the link list, snmp_gen_callback->next.
114 .PP
115 \fBParameters:\fP
116 .RS 4
117 \fImajor\fP is the SNMP callback major type used
118 .IP "\(bu" 2
119 SNMP_CALLBACK_LIBRARY
120 .PP
121 .RE
122 .PP
123 .IP "\(bu" 2
124 SNMP_CALLBACK_APPLICATION
125 .PP
126 .PP
127 \fBParameters:\fP
128 .RS 4
129 \fIminor\fP is the SNMP callback minor type used
130 .IP "\(bu" 2
131 SNMP_CALLBACK_POST_READ_CONFIG
132 .IP "\(bu" 2
133 SNMP_CALLBACK_STORE_DATA
134 .IP "\(bu" 2
135 SNMP_CALLBACK_SHUTDOWN
136 .IP "\(bu" 2
137 SNMP_CALLBACK_POST_PREMIB_READ_CONFIG
138 .IP "\(bu" 2
139 SNMP_CALLBACK_LOGGING
140 .IP "\(bu" 2
141 SNMP_CALLBACK_SESSION_INIT
142 .PP
143 .br
144 \fInew_callback\fP is the callback function that is registered.
145 .br
146 \fIarg\fP when not NULL is a void pointer used whenever new_callback function is exercised.
147 .RE
148 .PP
149 \fBReturns:\fP
150 .RS 4
151 Returns SNMPERR_GENERR if major is >= MAX_CALLBACK_IDS or minor is >= MAX_CALLBACK_SUBIDS or a \fBsnmp_gen_callback\fP pointer could not be allocated, otherwise SNMPERR_SUCCESS is returned.
152 .IP "\(bu" 2
153 #define MAX_CALLBACK_IDS 2
154 .IP "\(bu" 2
155 #define MAX_CALLBACK_SUBIDS 16
156 .PP
157 .RE
158 .PP
159 \fBSee also:\fP
160 .RS 4
161 \fBsnmp_call_callbacks\fP 
162 .PP
163 \fBsnmp_unregister_callback\fP 
164 .RE
165 .PP
166
167 .PP
168 Definition at line 230 of file callback.c.
169 .SS "int snmp_unregister_callback (int major, int minor, SNMPCallback * target, void * arg, int matchargs)"
170 .PP
171 This function unregisters a specified callback function given a major and minor type. Note: no bound checking on major and minor.
172 .PP
173 \fBParameters:\fP
174 .RS 4
175 \fImajor\fP is the SNMP callback major type used
176 .br
177 \fIminor\fP is the SNMP callback minor type used
178 .br
179 \fItarget\fP is the callback function that will be unregistered.
180 .br
181 \fIarg\fP is a void pointer used for comparison against the registered callback's sc_client_arg \fBvariable\fP.
182 .br
183 \fImatchargs\fP is an integer used to bypass the comparison of arg and the callback's sc_client_arg \fBvariable\fP only when matchargs is set to 0.
184 .RE
185 .PP
186 \fBReturns:\fP
187 .RS 4
188 Returns the number of callbacks that were unregistered.
189 .RE
190 .PP
191 \fBSee also:\fP
192 .RS 4
193 \fBsnmp_register_callback\fP 
194 .PP
195 \fBsnmp_call_callbacks\fP 
196 .RE
197 .PP
198
199 .PP
200 set cleanup flag? 
201 .PP
202 Definition at line 418 of file callback.c.
203 .SH "Author"
204 .PP 
205 Generated automatically by Doxygen for net-snmp from the source code.