summaryrefslogtreecommitdiffstats
path: root/common/elapi/elapi_log.h
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2009-08-14 15:05:12 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-08-20 15:47:34 -0400
commitc7916d6b820bde690145450ba02209e741154866 (patch)
tree8fa39e9d28e8d1f384471540e58cdc280975c72e /common/elapi/elapi_log.h
parentb776f0af14866051ab9dcdb696345643424261d5 (diff)
downloadsssd-c7916d6b820bde690145450ba02209e741154866.tar.gz
sssd-c7916d6b820bde690145450ba02209e741154866.tar.xz
sssd-c7916d6b820bde690145450ba02209e741154866.zip
ELAPI: Adding concept of targets
The targets are the destinations which caller wants to send the events to. The sinks are now on the second level under targets and constitute a so called fail over chain for a target. Such approach eliminates the need for complex routing function. The dispatcher keeps the list of targets in a collection. The element in the collection is the target context. Also gispatcher keeps the list of the sinks in a separate collection. Each target context has a list of the sinks associated with this target. But those are just pointers (at least for now) to the sinks form the list kept by dispatcher. I had to add some internal debug callbacks to be able to see that all the internals of the dispatcher are actually in order. See the conttent of config file for more comments. Also see information posted on SSSD wiki. https://fedorahosted.org/sssd/wiki/WikiPage/ELAPIInterface
Diffstat (limited to 'common/elapi/elapi_log.h')
-rw-r--r--common/elapi/elapi_log.h40
1 files changed, 33 insertions, 7 deletions
diff --git a/common/elapi/elapi_log.h b/common/elapi/elapi_log.h
index 6fff82b64..7d8a3b7d2 100644
--- a/common/elapi/elapi_log.h
+++ b/common/elapi/elapi_log.h
@@ -20,8 +20,18 @@
#ifndef ELAPI_LOG_H
#define ELAPI_LOG_H
+#include <stdint.h>
+
#include "elapi_async.h"
+/* Default values for targets -
+ * these constants match values in the default configuration.
+ */
+#define E_TARGET_DEBUG 0x00000001
+#define E_TARGET_AUDIT 0x00000002
+#define E_TARGET_LOG 0x00000004
+
+
/* Opaque dispatcher structure */
struct elapi_dispatcher;
@@ -51,10 +61,13 @@ int elapi_create_dispatcher_adv(struct elapi_dispatcher **dispatcher, /* Handle
void elapi_destroy_dispatcher(struct elapi_dispatcher *dispatcher);
/* Function to log an event */
-int elapi_dsp_log(struct elapi_dispatcher *dispatcher, struct collection_item *event);
+int elapi_dsp_log(uint32_t target,
+ struct elapi_dispatcher *dispatcher,
+ struct collection_item *event);
/* Function to log raw key value pairs without creating an event */
-int elapi_dsp_msg(struct elapi_dispatcher *dispatcher,
+int elapi_dsp_msg(uint32_t target,
+ struct elapi_dispatcher *dispatcher,
struct collection_item *template,
...);
@@ -62,11 +75,18 @@ int elapi_dsp_msg(struct elapi_dispatcher *dispatcher,
/* Managing the sink collection */
int elapi_alter_dispatcher(struct elapi_dispatcher *dispatcher, /* Dispatcher */
+ const char *target, /* Target to look for */
const char *sink, /* Sink to change */
int action); /* Action to perform for sink */
+/* Get target list */
+char **elapi_get_target_list(struct elapi_dispatcher *dispatcher);
+
+/* Free target list */
+void elapi_free_target_list(char **target_list);
+
/* Get sink list */
-char **elapi_get_sink_list(struct elapi_dispatcher *dispatcher);
+char **elapi_get_sink_list(struct elapi_dispatcher *dispatcher, char *target);
/* Free sink list */
void elapi_free_sink_list(char **sink_list);
@@ -102,13 +122,19 @@ void elapi_free_sink_list(char **sink_list);
int elapi_init(const char *appname, const char *config_path);
/* Log key value pairs */
-int elapi_msg(struct collection_item *template, ...);
-
+int elapi_msg(uint32_t target,
+ struct collection_item *template, ...);
/* Log event */
-int elapi_log(struct collection_item *event);
+int elapi_log(uint32_t target,
+ struct collection_item *event);
+
+/* Corresponding wrapping macroses */
+#define ELAPI_EVT_DEBUG(event) elapi_log(E_TARGET_DEBUG, event)
+#define ELAPI_EVT_LOG(event) elapi_log(E_TARGET_LOG, event)
+#define ELAPI_EVT_AUDIT(event) elapi_log(E_TARGET_AUDIT, event)
-/* Get dispatcher if you want to add sink to a default dispatcher or do some advanced operations */
+/* Get dispatcher if you want to do some advanced operations */
struct elapi_dispatcher *elapi_get_dispatcher(void);
/* Close audit */