summaryrefslogtreecommitdiffstats
path: root/dispatcher/elapi_dispatcher.h
diff options
context:
space:
mode:
Diffstat (limited to 'dispatcher/elapi_dispatcher.h')
-rw-r--r--dispatcher/elapi_dispatcher.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/dispatcher/elapi_dispatcher.h b/dispatcher/elapi_dispatcher.h
index c7a582e..c47e8ff 100644
--- a/dispatcher/elapi_dispatcher.h
+++ b/dispatcher/elapi_dispatcher.h
@@ -43,6 +43,7 @@ typedef int (*event_router_fn)(char *sink,
char *previous_sink,
int previous_status,
struct collection_item *event,
+ char *format_string,
struct sink_descriptor *sink_data,
void *custom_data,
int *error);
@@ -56,6 +57,11 @@ struct dispatcher_handle {
void *custom_data;
};
+/******************** Low level thread safe interface ************************************/
+/* This interface should be used if application plans to control the dispatcher,
+ * implement its own sinks that can be added dynamically or implements it own routing finction.
+ */
+
/* Function to create a dispatcher */
int create_audit_dispatcher(struct dispatcher_handle **dispatcher, /* Handle of the dispatcher will be stored in this variable */
const char *appname, /* Application name. Passed to the sinks to do initialization */
@@ -68,7 +74,7 @@ int create_audit_dispatcher(struct dispatcher_handle **dispatcher, /* Handle of
void destroy_audit_dispatcher(struct dispatcher_handle *dispatcher);
/* Function to log an event */
-void log_audit_event(struct dispatcher_handle *dispatcher, struct collection_item *event);
+void log_audit_event(struct dispatcher_handle *dispatcher, char *format_string, struct collection_item *event);
/* Advanced functions */
/* Managing the sink collection */
@@ -79,7 +85,33 @@ int alter_audit_dispatcher(struct dispatcher_handle *dispatcher, /* Dispatcher *
/* This function is exposed in case you are providing your own routing callback */
int log_event_to_sink(struct sink_descriptor *sink_data,
struct collection_item *event,
+ char *format_string,
void *custom_data);
+/******************** High level interface ************************************/
+/* This interface is not thread safe but hides the dispatcher. */
+
+/* Function to open audit using default routing functions */
+/* If appname is NULL - uses module name */
+int open_audit(const char *appname, char **desired_sinks);
+
+/* Function to open audit using custom routing function */
+int open_audit_with_router(const char *appname,
+ char **desired_sinks,
+ event_router_fn desired_router,
+ void *custom_data);
+
+/* Log event */
+void log_event(char *format_string,struct collection_item *event);
+
+/* Get dispatcher if you want to add sink to a default deispatcher or do some advaced operations */
+struct dispatcher_handle *get_dispatcher(void);
+
+/* Close audit */
+void close_audit(void);
+
+/* Creates collection with the timestamp already prepopulated */
+int create_event(struct collection_item **event,char *name);
+
#endif