blob: d9ddfa2e4607766572a7177153dabe6599d94b02 [file] [log] [blame]
.TH "A generic callback mechanism" 3 "31 Oct 2005" "net-snmp" \" -*- nroff -*-
.ad l
.nh
.SH NAME
A generic callback mechanism \-
.SS "Functions"
.in +1c
.ti -1c
.RI "void \fBinit_callbacks\fP (void)"
.br
.ti -1c
.RI "int \fBsnmp_register_callback\fP (int major, int minor, SNMPCallback *new_callback, void *arg)"
.br
.RI "\fIThis function registers a generic callback function. \fP"
.ti -1c
.RI "int \fBnetsnmp_register_callback\fP (int major, int minor, SNMPCallback *new_callback, void *arg, int priority)"
.br
.ti -1c
.RI "int \fBsnmp_call_callbacks\fP (int major, int minor, void *caller_arg)"
.br
.RI "\fIThis function calls the callback function for each registered callback of type major and minor. \fP"
.ti -1c
.RI "int \fBsnmp_count_callbacks\fP (int major, int minor)"
.br
.ti -1c
.RI "int \fBsnmp_callback_available\fP (int major, int minor)"
.br
.ti -1c
.RI "int \fBsnmp_unregister_callback\fP (int major, int minor, SNMPCallback *target, void *arg, int matchargs)"
.br
.RI "\fIThis function unregisters a specified callback function given a major and minor type. \fP"
.ti -1c
.RI "int \fBnetsnmp_callback_clear_client_arg\fP (void *ptr, int i, int j)"
.br
.RI "\fIfind and clear client args that match ptr \fP"
.ti -1c
.RI "void \fBclear_callback\fP (void)"
.br
.ti -1c
.RI "snmp_gen_callback * \fBsnmp_callback_list\fP (int major, int minor)"
.br
.in -1c
.SH "Function Documentation"
.PP
.SS "int netsnmp_callback_clear_client_arg (void * ptr, int i, int j)"
.PP
find and clear client args that match ptr \fBParameters:\fP
.RS 4
\fIptr\fP pointer to search for
.br
\fIi\fP callback id to start at
.br
\fIj\fP callback subid to start at
.RE
.PP
Definition at line 347 of file callback.c.
.SS "int snmp_call_callbacks (int major, int minor, void * caller_arg)"
.PP
This function calls the callback function for each registered callback of type major and minor. \fBParameters:\fP
.RS 4
\fImajor\fP is the SNMP callback major type used
.br
\fIminor\fP is the SNMP callback minor type used
.br
\fIcaller_arg\fP is a void pointer which is sent in as the callback's serverarg parameter, if needed.
.RE
.PP
\fBReturns:\fP
.RS 4
Returns SNMPERR_GENERR if major is >= MAX_CALLBACK_IDS or minor is >= MAX_CALLBACK_SUBIDS, otherwise SNMPERR_SUCCESS is returned.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBsnmp_register_callback\fP
.PP
\fBsnmp_unregister_callback\fP
.RE
.PP
Definition at line 183 of file callback.c.
.PP
References snmp_log().
.PP
Referenced by netsnmp_acm_check_subtree(), netsnmp_register_mib_table_row(), snmp_shutdown(), and unregister_mib_context().
.SS "int snmp_register_callback (int major, int minor, SNMPCallback * new_callback, void * arg)"
.PP
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 snmp_gen_callback. The function makes sure to append this callback function at the end of the link list, snmp_gen_callback->next.
.PP
\fBParameters:\fP
.RS 4
\fImajor\fP is the SNMP callback major type used
.IP "\(bu" 2
SNMP_CALLBACK_LIBRARY
.IP "\(bu" 2
SNMP_CALLBACK_APPLICATION
.PP
.br
\fIminor\fP is the SNMP callback minor type used
.IP "\(bu" 2
SNMP_CALLBACK_POST_READ_CONFIG
.IP "\(bu" 2
SNMP_CALLBACK_STORE_DATA
.IP "\(bu" 2
SNMP_CALLBACK_SHUTDOWN
.IP "\(bu" 2
SNMP_CALLBACK_POST_PREMIB_READ_CONFIG
.IP "\(bu" 2
SNMP_CALLBACK_LOGGING
.IP "\(bu" 2
SNMP_CALLBACK_SESSION_INIT
.PP
.br
\fInew_callback\fP is the callback function that is registered.
.br
\fIarg\fP when not NULL is a void pointer used whenever new_callback function is exercised.
.RE
.PP
\fBReturns:\fP
.RS 4
Returns SNMPERR_GENERR if major is >= MAX_CALLBACK_IDS or minor is >= MAX_CALLBACK_SUBIDS or a snmp_gen_callback pointer could not be allocated, otherwise SNMPERR_SUCCESS is returned.
.IP "\(bu" 2
#define MAX_CALLBACK_IDS 2
.IP "\(bu" 2
#define MAX_CALLBACK_SUBIDS 16
.PP
.RE
.PP
\fBSee also:\fP
.RS 4
\fBsnmp_call_callbacks\fP
.PP
\fBsnmp_unregister_callback\fP
.RE
.PP
Definition at line 115 of file callback.c.
.PP
Referenced by netsnmp_register_save_list().
.SS "int snmp_unregister_callback (int major, int minor, SNMPCallback * target, void * arg, int matchargs)"
.PP
This function unregisters a specified callback function given a major and minor type. Note: no bound checking on major and minor.
.PP
\fBParameters:\fP
.RS 4
\fImajor\fP is the SNMP callback major type used
.br
\fIminor\fP is the SNMP callback minor type used
.br
\fItarget\fP is the callback function that will be unregistered.
.br
\fIarg\fP is a void pointer used for comparison against the registered callback's sc_client_arg variable.
.br
\fImatchargs\fP is an integer used to bypass the comparison of arg and the callback's sc_client_arg variable only when matchargs is set to 0.
.RE
.PP
\fBReturns:\fP
.RS 4
Returns the number of callbacks that were unregistered.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBsnmp_register_callback\fP
.PP
\fBsnmp_call_callbacks\fP
.RE
.PP
set cleanup flag? Definition at line 296 of file callback.c.
.PP
References SNMP_FREE, and snmp_log().