.TH "A generic callback mechanism" 3 "30 Jun 2005" "Version 5.2.1.rc3" "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 "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 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. .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 \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 .PP Definition at line 182 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. .PP 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 .PP .RE .PP .IP "\(bu" 2 SNMP_CALLBACK_APPLICATION .PP .PP \fBParameters:\fP .RS 4 \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 .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. .PP 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? .PP Definition at line 295 of file callback.c. .PP References snmp_log().