1 .TH "A generic callback mechanism" 3 "23 Sep 2009" "Version 5.5" "net-snmp" \" -*- nroff -*-
5 A generic callback mechanism \-
10 .RI "#define \fBCALLBACK_NAME_LOGGING\fP 1"
13 .RI "#define \fBLOCK_PER_CALLBACK_SUBID\fP 1"
16 .RI "#define \fBCALLBACK_LOCK\fP(maj, min) ++_locks[maj][min]"
19 .RI "#define \fBCALLBACK_UNLOCK\fP(maj, min) --_locks[maj][min]"
22 .RI "#define \fBCALLBACK_LOCK_COUNT\fP(maj, min) _locks[maj][min]"
29 .RI "NETSNMP_STATIC_INLINE int \fB_callback_lock\fP (int major, int minor, const char *warn, int assert)"
32 .RI "NETSNMP_STATIC_INLINE void \fB_callback_unlock\fP (int major, int minor)"
35 .RI "void \fBinit_callbacks\fP (void)"
38 .RI "int \fBsnmp_register_callback\fP (int major, int minor, SNMPCallback *new_callback, void *arg)"
40 .RI "\fIThis function registers a generic callback function. \fP"
42 .RI "int \fBnetsnmp_register_callback\fP (int major, int minor, SNMPCallback *new_callback, void *arg, int priority)"
45 .RI "int \fBsnmp_call_callbacks\fP (int major, int minor, void *caller_arg)"
47 .RI "\fIThis function calls the callback function for each registered callback of type major and minor. \fP"
49 .RI "int \fBsnmp_count_callbacks\fP (int major, int minor)"
52 .RI "int \fBsnmp_callback_available\fP (int major, int minor)"
55 .RI "int \fBsnmp_unregister_callback\fP (int major, int minor, SNMPCallback *target, void *arg, int matchargs)"
57 .RI "\fIThis function unregisters a specified callback function given a major and minor type. \fP"
59 .RI "int \fBnetsnmp_callback_clear_client_arg\fP (void *ptr, int i, int j)"
61 .RI "\fIfind and clear client args that match ptr \fP"
63 .RI "void \fBclear_callback\fP (void)"
66 .RI "struct \fBsnmp_gen_callback\fP * \fBsnmp_callback_list\fP (int major, int minor)"
69 .SH "Function Documentation"
71 .SS "int netsnmp_callback_clear_client_arg (void * ptr, int i, int j)"
73 find and clear client args that match ptr \fBParameters:\fP
75 \fIptr\fP pointer to search for
77 \fIi\fP callback id to start at
79 \fIj\fP callback subid to start at
84 Definition at line 474 of file callback.c.
85 .SS "int snmp_call_callbacks (int major, int minor, void * caller_arg)"
87 This function calls the callback function for each registered callback of type major and minor. \fBParameters:\fP
89 \fImajor\fP is the SNMP callback major type used
91 \fIminor\fP is the SNMP callback minor type used
93 \fIcaller_arg\fP is a void pointer which is sent in as the callback's serverarg parameter, if needed.
98 Returns SNMPERR_GENERR if major is >= MAX_CALLBACK_IDS or minor is >= MAX_CALLBACK_SUBIDS, otherwise SNMPERR_SUCCESS is returned.
103 \fBsnmp_register_callback\fP
105 \fBsnmp_unregister_callback\fP
110 Definition at line 298 of file callback.c.
111 .SS "int snmp_register_callback (int major, int minor, SNMPCallback * new_callback, void * arg)"
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.
117 \fImajor\fP is the SNMP callback major type used
119 SNMP_CALLBACK_LIBRARY
124 SNMP_CALLBACK_APPLICATION
129 \fIminor\fP is the SNMP callback minor type used
131 SNMP_CALLBACK_POST_READ_CONFIG
133 SNMP_CALLBACK_STORE_DATA
135 SNMP_CALLBACK_SHUTDOWN
137 SNMP_CALLBACK_POST_PREMIB_READ_CONFIG
139 SNMP_CALLBACK_LOGGING
141 SNMP_CALLBACK_SESSION_INIT
144 \fInew_callback\fP is the callback function that is registered.
146 \fIarg\fP when not NULL is a void pointer used whenever new_callback function is exercised.
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.
153 #define MAX_CALLBACK_IDS 2
155 #define MAX_CALLBACK_SUBIDS 16
161 \fBsnmp_call_callbacks\fP
163 \fBsnmp_unregister_callback\fP
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)"
171 This function unregisters a specified callback function given a major and minor type. Note: no bound checking on major and minor.
175 \fImajor\fP is the SNMP callback major type used
177 \fIminor\fP is the SNMP callback minor type used
179 \fItarget\fP is the callback function that will be unregistered.
181 \fIarg\fP is a void pointer used for comparison against the registered callback's sc_client_arg \fBvariable\fP.
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.
188 Returns the number of callbacks that were unregistered.
193 \fBsnmp_register_callback\fP
195 \fBsnmp_call_callbacks\fP
202 Definition at line 418 of file callback.c.
205 Generated automatically by Doxygen for net-snmp from the source code.