summaryrefslogtreecommitdiffstats
path: root/common/elapi/elapi_sink.h
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2009-08-07 15:50:34 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-08-12 12:24:27 -0400
commit1771d32e945b758326951384f0e17121042ad74e (patch)
tree070df00bcb1e049a1bdf794922b9b970479942a8 /common/elapi/elapi_sink.h
parentd59ba3139bba2d28c1209f62c01a7017c26dd635 (diff)
downloadsssd-1771d32e945b758326951384f0e17121042ad74e.tar.gz
sssd-1771d32e945b758326951384f0e17121042ad74e.tar.xz
sssd-1771d32e945b758326951384f0e17121042ad74e.zip
ELAPI Next round of functionality - logging part of the interface
a) Added the main logging interface which allows creating dispatcher and logging messages or events. Can't actully log anything yet since the sinks are stubbed out. b) Made default template be a part of the default dispatcher. c) Updated UNIT test. d) Some of the calls are stubbed out but they are there to indicate where next round of work will be.
Diffstat (limited to 'common/elapi/elapi_sink.h')
-rw-r--r--common/elapi/elapi_sink.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/common/elapi/elapi_sink.h b/common/elapi/elapi_sink.h
new file mode 100644
index 000000000..40b12a266
--- /dev/null
+++ b/common/elapi/elapi_sink.h
@@ -0,0 +1,78 @@
+/*
+ ELAPI
+
+ Common sink interface header.
+
+ Copyright (C) Dmitri Pal <dpal@redhat.com> 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef ELAPI_SINK_H
+#define ELAPI_SINK_H
+
+#include <time.h>
+#include "collection.h"
+
+#define ELAPI_SINK_OK 0 /* Sink can be used for logging */
+#define ELAPI_SINK_SUSPENDED 1 /* Sink is temporary disabled due to recoverable error */
+#define ELAPI_SINK_DISABLED 2 /* Sink is explicitely disabled by the application */
+#define ELAPI_SINK_PULSE 3 /* Sink is disabled for this one event */
+
+#define SINK_LIB_NAME_SIZE 100
+#define SINK_ENTRY_POINT "get_sink_info"
+#define SINK_NAME_TEMPLATE "libelapi_sink_%s.so"
+#define SINK_NEVER_RETRY -1
+
+/* Flags related to loading sinks */
+#define SINK_FLAG_NO_LIMIT 0x00000000 /* NO limits to loading and manipulating this sink - default */
+#define SINK_FLAG_LOAD_SINGLE 0x00000001 /* Only allow one instance of the sink per process */
+
+struct data_descriptor {
+ char *appname;
+ void *config;
+ void *internal_data;
+};
+
+/* Log facility callbacks */
+typedef int (*init_fn)(struct data_descriptor *dblock);
+typedef void (*cleanup_fn)(struct data_descriptor *dblock);
+typedef int (*format_fn)(struct data_descriptor *dblock, const char *format_str, struct collection_item *event);
+typedef int (*submit_fn)(struct data_descriptor *dblock);
+typedef void (*close_fn)(struct data_descriptor *dblock);
+
+struct sink_capability {
+ int retry_interval;
+ int flags;
+ int instance;
+ init_fn init_cb;
+ cleanup_fn cleanup_cb;
+ format_fn format_cb;
+ submit_fn submit_cb;
+ close_fn close_cb;
+};
+
+/* The only open function the link can expose */
+typedef void (*capability_fn)(struct sink_capability *sink_cpb_block);
+
+struct sink_descriptor {
+ struct sink_capability sink_cpb_block;
+ struct data_descriptor dblock;
+ int suspended;
+ time_t lasttry;
+ void *lib_handle;
+};
+
+/*Standard capability function */
+void get_sink_info(struct sink_capability *sink_cpb_block);
+
+#endif