Commit 903ac2f1 authored by Philipp Schafft's avatar Philipp Schafft 🦁

Feature: Added fundamental report xml handling

parent 5df79580
......@@ -31,6 +31,7 @@ noinst_HEADERS = \
tls.h \
refobject.h \
module.h \
reportxml.h \
event.h \
event_log.h \
event_exec.h \
......@@ -72,6 +73,7 @@ icecast_SOURCES = \
tls.c \
refobject.c \
module.c \
reportxml.c \
format.c \
format_ogg.c \
format_mp3.c \
......
......@@ -98,6 +98,11 @@ typedef struct module_tag module_t;
typedef struct module_container_tag module_container_t;
/* ---[ reportxml.[ch] ]--- */
typedef struct reportxml_tag reportxml_t;
typedef struct reportxml_node_tag reportxml_node_t;
/* ---[ refobject.[ch] ]--- */
typedef struct refobject_base_tag refobject_base_t;
......@@ -107,6 +112,8 @@ typedef union __attribute__ ((__transparent_union__)) {
refobject_base_t *refobject_base;
module_t *module;
module_container_t *module_container;
reportxml_t *reportxml;
reportxml_node_t *reportxml_node;
} refobject_t;
#else
typedef void * refobject_t;
......
This diff is collapsed.
/* Icecast
*
* This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source.
*
* Copyright 2018, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
*/
#ifndef __REPORTXML_H__
#define __REPORTXML_H__
#include <libxml/tree.h>
#include "icecasttypes.h"
#include "compat.h"
typedef enum {
REPORTXML_NODE_TYPE__ERROR,
REPORTXML_NODE_TYPE_REPORT,
REPORTXML_NODE_TYPE_DEFINITION,
REPORTXML_NODE_TYPE_INCIDENT,
REPORTXML_NODE_TYPE_STATE,
REPORTXML_NODE_TYPE_BACKTRACE,
REPORTXML_NODE_TYPE_POSITION,
REPORTXML_NODE_TYPE_MORE,
REPORTXML_NODE_TYPE_FIX,
REPORTXML_NODE_TYPE_ACTION,
REPORTXML_NODE_TYPE_REASON,
REPORTXML_NODE_TYPE_TEXT,
REPORTXML_NODE_TYPE_TIMESTAMP,
REPORTXML_NODE_TYPE_RESOURCE,
REPORTXML_NODE_TYPE_VALUE,
REPORTXML_NODE_TYPE_REFERENCE,
REPORTXML_NODE_TYPE_EXTENSION
} reportxml_node_type_t;
reportxml_t * reportxml_new(void);
reportxml_node_t * reportxml_get_root_node(reportxml_t *report);
reportxml_t * reportxml_parse_xmldoc(xmlDocPtr doc);
xmlDocPtr reportxml_render_xmldoc(reportxml_t *report);
reportxml_node_t * reportxml_node_new(reportxml_node_type_t type, const char *id, const char *definition, const char *akindof);
reportxml_node_t * reportxml_node_parse_xmlnode(xmlNodePtr xmlnode);
xmlNodePtr reportxml_node_render_xmlnode(reportxml_node_t *node);
reportxml_node_type_t reportxml_node_get_type(reportxml_node_t *node);
int reportxml_node_set_attribute(reportxml_node_t *node, const char *key, const char *value);
char * reportxml_node_get_attribute(reportxml_node_t *node, const char *key);
int reportxml_node_add_child(reportxml_node_t *node, reportxml_node_t *child);
ssize_t reportxml_node_count_child(reportxml_node_t *node);
reportxml_node_t * reportxml_node_get_child(reportxml_node_t *node, size_t idx);
int reportxml_node_set_content(reportxml_node_t *node, const char *value);
char * reportxml_node_get_content(reportxml_node_t *node);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment