From 7e92818dd0c083201715d16b4cc545d3d98db505 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Mon, 20 May 2013 12:28:01 -0400 Subject: [PATCH] Ticket 283 - Expose slapi_eq_* API Description: Make the event queue API public. https://fedorahosted.org/389/ticket/283 Reviewed by: ? --- ldap/servers/slapd/slapi-plugin.h | 55 ++++++++++++++++++++++++++++++++++++ ldap/servers/slapd/slapi-private.h | 8 ----- 2 files changed, 55 insertions(+), 8 deletions(-) diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h index 2d618e9..7000df6 100644 --- a/ldap/servers/slapd/slapi-plugin.h +++ b/ldap/servers/slapd/slapi-plugin.h @@ -7419,6 +7419,61 @@ char *slapi_pr_strerror( const PRErrorCode prerrno ); */ const char *slapi_system_strerror( const int syserrno ); +/* event queue routines and data types */ + +/** + * Represents a scheduled event object. + */ +typedef void* Slapi_Eq_Context; + +/** + * Represents the function that will be performed when an event is triggered. + */ +typedef void (*slapi_eq_fn_t)(time_t when, void *arg); + +/** + * Cause an event to happen exactly once. + * + * \param fn The function to call when the event is triggered. + * \param arg An argument to pass to the called function. + * \param when The time that the function should be called. + * + * \return slapi_eq_context + */ +Slapi_Eq_Context slapi_eq_once(slapi_eq_fn_t fn, void *arg, time_t when); + +/** + * Cause an event to happen repeatedly. + * + * \param fn The function to call when the vent is triggered. + * \param arg An argument to pass to the called function. + * \param when The time that the function should be called. + * \param interval The amount of time (in milliseconds) between + * successive calls to the function. + * + * \return slapi_eq_context + */ +Slapi_Eq_Context slapi_eq_repeat(slapi_eq_fn_t fn, void *arg, time_t when, unsigned long interval); + +/** + * Cause a scheduled event to be canceled. + * + * \param ctx The event object to cancel + * + * \return 1 If event was found and canceled. + * \return 0 If event was not found in the queue. + */ +int slapi_eq_cancel(Slapi_Eq_Context ctx); + +/** + * Return the event's argument. + * + * \param ctx The event object + * + * \return A pointer to the event argument. + */ +void *slapi_eq_get_arg (Slapi_Eq_Context ctx); + #ifdef __cplusplus } #endif diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h index 49ecb52..1e8a53a 100644 --- a/ldap/servers/slapd/slapi-private.h +++ b/ldap/servers/slapd/slapi-private.h @@ -1168,14 +1168,6 @@ void addlenstr( lenstr *l, const char *str ); void lenstr_free( lenstr ** ); lenstr *lenstr_new(void); -/* event queue routines and data types */ -typedef void* Slapi_Eq_Context; -typedef void (*slapi_eq_fn_t)(time_t when, void *arg); -Slapi_Eq_Context slapi_eq_once(slapi_eq_fn_t fn, void *arg, time_t when); -Slapi_Eq_Context slapi_eq_repeat(slapi_eq_fn_t fn, void *arg, time_t when, unsigned long interval); -int slapi_eq_cancel(Slapi_Eq_Context ctx); -void *slapi_eq_get_arg (Slapi_Eq_Context ctx); - /* config DN */ char *get_config_DN(void); -- 1.7.1