summaryrefslogtreecommitdiffstats
path: root/common/elapi/elapi_priv.h
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2009-08-25 16:54:01 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-09-08 19:25:16 -0400
commitc5461b548d303e6e66e20048544814338b46efb5 (patch)
treeddf98cf7e498349739fb0c8e9612a0f962e14c41 /common/elapi/elapi_priv.h
parent7a9bee06e2bc5bcc75659e9a46bdffa870951d7a (diff)
downloadsssd-c5461b548d303e6e66e20048544814338b46efb5.tar.gz
sssd-c5461b548d303e6e66e20048544814338b46efb5.tar.xz
sssd-c5461b548d303e6e66e20048544814338b46efb5.zip
ELAPI sinks and providers
This patch drills down to the next level of ELAPI functionality. I adds the creation and loading of the sinks. It also implements a skeleton for the first low level provider which will be capable of writing to a file. The configuration ini file is extended to define new configuration parameters and their meanings.
Diffstat (limited to 'common/elapi/elapi_priv.h')
-rw-r--r--common/elapi/elapi_priv.h72
1 files changed, 67 insertions, 5 deletions
diff --git a/common/elapi/elapi_priv.h b/common/elapi/elapi_priv.h
index eb1d11f8b..4b55f9648 100644
--- a/common/elapi/elapi_priv.h
+++ b/common/elapi/elapi_priv.h
@@ -24,6 +24,8 @@
#include "collection.h"
#include "elapi_async.h"
+#include "elapi_sink.h"
+
/* Classes of the collections used by ELAPI internally */
#define COL_CLASS_ELAPI_BASE 21000
#define COL_CLASS_ELAPI_EVENT COL_CLASS_ELAPI_BASE + 0
@@ -45,6 +47,28 @@
#define ELAPI_SINK_REFS "srefs"
#define ELAPI_TARGET_VALUE "value"
#define ELAPI_SINK_PROVIDER "provider"
+#define ELAPI_SINK_REQUIRED "required"
+#define ELAPI_SINK_ONERROR "onerror"
+#define ELAPI_SINK_TIMEOUT "timeout"
+#define ELAPI_SINK_SYNCH "synch"
+
+/* Default timout before dispatcher tries to revive sink.
+ * The actual value is configurable on per sink basis
+ * so I do not see a value in making this a compile time
+ * option (at least at the moment).
+ */
+#define ELAPI_SINK_DEFAULT_TIMEOUT 60
+
+/* Names of embedded providers */
+#define ELAPI_EMB_PRVDR_FILE "file"
+#define ELAPI_EMB_PRVDR_STDERR "stderr"
+#define ELAPI_EMB_PRVDR_SYSLOG "syslog"
+
+/* Numbers for embedded providers */
+#define ELAPI_EMB_PRVDR_FILENUM 0
+#define ELAPI_EMB_PRVDR_STDERRNUM 1
+#define ELAPI_EMB_PRVDR_SYSLOGNUM 2
+
#define ELAPI_TARGET_ALL 0xFFFF /* 65k targets should be enough */
@@ -96,21 +120,47 @@ struct elapi_tgt_ctx {
*/
};
+/* FIXME: Compbine with context */
+struct sink_status {
+ int suspended;
+ time_t lasttry;
+};
+
+/* Common configuration items for all sinks */
+struct elapi_sink_cfg {
+ char *provider;
+ uint32_t required;
+ uint32_t onerror;
+ uint32_t timeout;
+ uint32_t synch;
+ void *priv_ctx;
+ void *libhandle;
+ sink_cpb_fn ability;
+ struct sink_cpb cpb_cb;
+};
+
/* The structure that describes the sink in the dispatcher */
struct elapi_sink_ctx {
- /* Inpit queue of a sink */
+ /* Input queue of a sink */
struct collection_item *in_queue;
/* Pending list */
struct collection_item *pending;
/* FIXME: add:
* sink's error status
- * sink's common config data (common between all sinks)
- * sink personal specific config data (config data specific to this sink)
*/
- /* Is this a sink or async sink */
uint32_t async_mode;
+ /* Sink configuration data */
+ struct elapi_sink_cfg sink_cfg;
+};
+
+/* Generic data structure for the data output */
+struct elapi_data_out {
+ char *buffer;
+ size_t size;
+ size_t written;
};
+
/* The structure to hold a command and a result of the command execution */
struct elapi_get_sink {
int action;
@@ -153,6 +203,14 @@ int elapi_sink_add(struct collection_item **sink_ref,
char *sink,
struct elapi_dispatcher *handle);
+/* Function to create a sink */
+int elapi_sink_create(struct elapi_sink_ctx **sink_ctx,
+ char *name,
+ struct collection_item *ini_config);
+
+/* Destroy sink */
+void elapi_sink_destroy(struct elapi_sink_ctx *context);
+
/* Create target object */
int elapi_tgt_create(struct elapi_tgt_ctx **context,
char *target,
@@ -185,8 +243,12 @@ int elapi_tgt_mklist(struct elapi_dispatcher *handle);
/* Send ELAPI config errors into a file */
void elapi_dump_ini_err(struct collection_item *error_list);
-/* Print dispatcher internals for testing and debugin purposes */
+#ifdef ELAPI_UTEST
+/* Print dispatcher internals for testing and debugging purposes */
void elapi_print_dispatcher(struct elapi_dispatcher *handle);
+/* Print sink context details */
+void elapi_print_sink_ctx(struct elapi_sink_ctx *sink_context);
+#endif
#endif