aboutsummaryrefslogtreecommitdiffstats
path: root/src/cfg_xml.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-03-25 19:19:47 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-03-25 19:19:47 +0300
commit2f2642851746b0985f67e8dde58e2458eae07cca (patch)
treec379cf43cf7a26be6e70111e8e79815258a1c0ee /src/cfg_xml.h
parent9e16e433e1386b3613ea5667b12ee14c3ef0588c (diff)
downloadrspamd-2f2642851746b0985f67e8dde58e2458eae07cca.tar.gz
rspamd-2f2642851746b0985f67e8dde58e2458eae07cca.zip
* Initial add of xml parser for rspamd configuration
Diffstat (limited to 'src/cfg_xml.h')
-rw-r--r--src/cfg_xml.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/cfg_xml.h b/src/cfg_xml.h
new file mode 100644
index 000000000..3e1a4bcd4
--- /dev/null
+++ b/src/cfg_xml.h
@@ -0,0 +1,66 @@
+#ifndef RSPAMD_CFG_XML_H
+#define RSPAMD_CFG_XML_H
+
+#include "config.h"
+#include "cfg_file.h"
+
+#define XML_START_MISSING 1
+#define XML_PARAM_MISSING 2
+#define XML_EXTRA_ELEMENT 3
+#define XML_UNMATCHED_TAG 4
+
+enum xml_read_state {
+ XML_READ_START,
+ XML_READ_PARAM,
+ XML_READ_MODULE,
+ XML_READ_CLASSIFIER,
+ XML_READ_STATFILE,
+ XML_READ_FACTORS,
+ XML_READ_METRIC,
+ XML_READ_WORKER,
+ XML_READ_VARIABLE,
+ XML_READ_PIDFILE,
+ XML_READ_STATFILE_POOL,
+ XML_READ_FILTERS,
+ XML_READ_LOGGING,
+ XML_ERROR,
+ XML_END
+};
+
+struct rspamd_xml_userdata {
+ enum xml_read_state state;
+ struct config_file *cfg;
+ gchar *section_name;
+ gpointer other_data;
+};
+
+/* Called for open tags <foo bar="baz"> */
+void rspamd_xml_start_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ gpointer user_data,
+ GError **error);
+
+/* Called for close tags </foo> */
+void rspamd_xml_end_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ gpointer user_data,
+ GError **error);
+
+/* text is not nul-terminated */
+void rspamd_xml_text (GMarkupParseContext *context,
+ const gchar *text,
+ gsize text_len,
+ gpointer user_data,
+ GError **error);
+
+/* Called on error, including one set by other
+* methods in the vtable. The GError should not be freed.
+*/
+void rspamd_xml_error (GMarkupParseContext *context,
+ GError *error,
+ gpointer user_data);
+
+
+#endif