summaryrefslogtreecommitdiffstats
path: root/common/elapi/providers/file/file_provider.h
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2009-09-02 19:41:06 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-09-08 19:26:27 -0400
commit13cf6a9c9d37a14ff46f6d512aab402616359570 (patch)
tree81b8dae12607b7df36c422191575c1a99009c060 /common/elapi/providers/file/file_provider.h
parentc5461b548d303e6e66e20048544814338b46efb5 (diff)
downloadsssd-13cf6a9c9d37a14ff46f6d512aab402616359570.tar.gz
sssd-13cf6a9c9d37a14ff46f6d512aab402616359570.tar.xz
sssd-13cf6a9c9d37a14ff46f6d512aab402616359570.zip
ELAPI Adding file provider and CSV format
This patch creates the infrastructure for logging of the event from the top of the interface to the bottom. It is a start. A lot of functionality is left aside. The attempt of this patch is pass event from caller of the ELAPI interface via targets to sinks then to providers and do serialization creating entity that is ready to be written to a file. It also implements more specific provider related configuration parameters. Also it addresses couple suggestions that were brought up against previous patch. ELAPI Correcting issues This patch addresses the issues found during the review of the previous patches and addresses ticket #166.
Diffstat (limited to 'common/elapi/providers/file/file_provider.h')
-rw-r--r--common/elapi/providers/file/file_provider.h67
1 files changed, 47 insertions, 20 deletions
diff --git a/common/elapi/providers/file/file_provider.h b/common/elapi/providers/file/file_provider.h
index 218f69f58..f5e6753df 100644
--- a/common/elapi/providers/file/file_provider.h
+++ b/common/elapi/providers/file/file_provider.h
@@ -24,48 +24,75 @@
#include "elapi_sink.h"
+/* Common configuration parameters */
+#define FILE_OUTNAME "filename"
+#define FILE_KEEPOPEN "keepopen"
+#define FILE_OUTMODE "outmode"
+#define FILE_FIELDSET "set"
+#define FILE_FORMAT "format"
+#define FILE_FLUSH "fsyncmode"
+
+
+/* Max supported mode */
+/* NOTE: Increase this value when you add a new mode.
+ * If it ever gets to 10 the logic in the
+ * function that builds the set needs to change.
+ */
+#define FILE_MAXMODE 5
+/* Modes: */
+#define FILE_MODE_CSV 0
+#define FILE_MODE_FORMAT 1
+#define FILE_MODE_HTML 2
+#define FILE_MODE_XML 3
+#define FILE_MODE_JSON 4
+#define FILE_MODE_KVP 5
+
+
+/* FIXME: Should it be a compile time switch? */
+#define FILE_SUFFIX ".log"
+#define FILE_SET_END '@'
+
+/* Field set collection */
+#define FILE_FIELDSET_COL "set"
+#define FILE_FIELDSET_CLASS 21000
+
+/* Special file name - stderr is handled differently */
+#define FILE_STDERR "stderr"
+
/* Structure that holds internal configuration of the file
* provider.
*/
struct file_prvdr_cfg {
char *filename; /* File name */
+ uint32_t ownfile; /* Do I own the file handle? */
uint32_t keepopen; /* Do we need to keep file open */
- uint32_t fsyncmode; /* How frequently data is fsynced */
+ int32_t fsyncmode; /* How frequently data is fsynced */
uint32_t outmode; /* Output mode */
struct collection_item *set; /* Field set without leftovers symbol */
uint32_t use_leftovers; /* Was there a leftover symbol */
uint32_t jam_leftovers; /* leftovers should be serialized into one field */
uint32_t mode_leftovers; /* Format for the leftover fields */
- uint32_t csvheader; /* Include csv header or not? */
- char csvqualifier; /* What is the qualifier? */
- char csvseparator; /* What is the separator? */
- uint32_t csvescape; /* Do we need to escape strings ? */
- char csvescchar; /* What is the escape character? */
+ void *main_fmt_cfg; /* Configuration data for the main format */
+ void *lo_fmt_cfg; /* Configuration data for leftovers format */
+ /* FIXME add other config data strutures here */
+
+ /* FIXME: Rotation rules ? */
};
+
/* File context */
struct file_prvdr_ctx {
struct file_prvdr_cfg config; /* Configuration */
int outfile; /* File handle */
+ uint32_t smode; /* Sink's synch mode */
/* FIXME - other things go here */
};
-
-
-/* Function to read configuration */
-int file_read_cfg(struct file_prvdr_cfg *file_cfg,
- char *name,
- struct collection_item *ini_config);
-
-/* Function to create context */
-int file_create_ctx(struct file_prvdr_ctx **file_ctx,
- char *name,
- struct collection_item *ini_config);
-
/* File init function */
int file_init(void **priv_ctx,
- char *name,
- struct collection_item *ini_config);
+ const char *name,
+ struct collection_item *ini_config,
+ const char *appname);
/* File close function */
void file_close(void **priv_ctx);