static void dump_document(xmlmod_plugin_t *plugin, xmlDoc *doc) | |
{ | |
xmlNodeDumpOutput(plugin->fd, doc, doc->children, 0, plugin->format, NULL); | |
if ( plugin->format ) | |
xmlOutputBufferWriteString(plugin->fd, "\n"); | |
| |
xmlOutputBufferFlush(plugin->fd); | |
| |
if ( plugin->no_buffering ) | |
fflush(plugin->fd->context); | |
| |
if ( plugin->idmef_dtd ) | |
validate_dtd(plugin, doc); | |
} | |
| |
| |
| |
static int xmlmod_run(prelude_plugin_instance_t *pi, idmef_message_t *message) | |
{ | |
xmlNodePtr root; | |
xmlDoc *document; | |
xmlmod_plugin_t *plugin = prelude_plugin_instance_get_plugin_data(pi); | |
| |
document = xmlNewDoc((const xmlChar *) "1.0"); | |
if ( ! document ) { | |
prelude_log(PRELUDE_LOG_ERR, "error creating XML document.\n"); | |
return -1; | |
} | |
| |
root = xmlNewDocNode(document, NULL, (const xmlChar *) "IDMEF-Message", NULL); | |
if ( ! root ) { | |
xmlFreeDoc(document); | |
return -1; | |
} | |