jabberd14 1.6.2
Functions | Variables
mio_xml.cc File Reference

handling of XML streams on network connections More...

#include <jabberd.h>
#include <fstream>
#include <libgen.h>

Functions

void _mio_xstream_CDATA (void *_m, const char *cdata, int len)
void _mio_xstream_cleanup (void *arg)
void _mio_xstream_init (mio m)
void _mio_xml_parser (mio m, const void *vbuf, size_t bufsz)
void mio_xml_reset (mio m)
int mio_xml_starttls (mio m, int originator, const char *identity)

Variables

ios mio__data

Detailed Description

handling of XML streams on network connections

This file implements the functionality used to handle XML streams over network connections. The user can register a callback, that gets an event for the open tag for the root element and for the child elements of the root element (including their child elements).


Function Documentation

void _mio_xml_parser ( mio  m,
const void *  vbuf,
size_t  bufsz 
)

receiving an XML document on a network socket

This parser implements an XML parser reading on a network socket. Stanzas (second level XML document elements) are passed to the application callback function, that registered with this mio object

Parameters:
mthe mio where data has been read
vbufthe buffer containing the read data
bufszthe number of bytes, that have been read

References _mio_xstream_cleanup(), _mio_xstream_init(), mio_main_st::bounce_uri, mio_st::cb, mio_st::cb_arg, mio_st::flags, mio_main_st::flash_policy, HTTP_BOUNCE_URI, log_debug2, log_error, log_notice(), log_warn(), LOGT_IO, LOGT_XML, mio_close(), MIO_ERROR, mio_write(), mio_st::parser, mio_st::reset_stream, mio_st::root, mio_st::type, type_HTTP, type_NORMAL, type_NUL, mio_main_st::webserver_path, and ZONE.

void _mio_xstream_CDATA ( void *  _m,
const char *  cdata,
int  len 
)

internal expat callback for CDATA nodes

Parameters:
_mthe mio
cdatacontent of the CDATA node (not zero terminated!)
lenlength of the content

References mio_st::stacknode, and xmlnode_insert_cdata().

Referenced by _mio_xstream_init().

void _mio_xstream_cleanup ( void *  arg)

destructor for a mio xstream, frees allocated memory

Parameters:
argthe mio of the xstream, that should be closed

References mio_st::in_root, mio_st::in_stanza, mio_st::out_ns, mio_st::parser, mio_st::stacknode, and xmlnode_free().

Referenced by _mio_xml_parser(), and _mio_xstream_init().

void _mio_xstream_init ( mio  m)

init an xstream for a mio object

(allocates a XML parser instance)

Parameters:
mwhich mio object should be prepared for usage as an XML stream

References _mio_xstream_CDATA(), _mio_xstream_cleanup(), mio_st::p, mio_st::parser, pool_cleanup(), and XMLNS_SEPARATOR.

Referenced by _mio_xml_parser().

void mio_xml_reset ( mio  m)

reset a stream (restart it)

Parameters:
mthe stream to reset

References mio_st::flags, and mio_st::reset_stream.

Referenced by dialback_in_read_db(), dialback_out_read(), and mio_xml_starttls().

int mio_xml_starttls ( mio  m,
int  originator,
const char *  identity 
)

restart a stream, starting the use of a TLS layer

Parameters:
mthe connection
originator1 if we are the originator, 0 else
identityidentity to use for selecting the certificate
Returns:
0 on success, non-zero on failure

References _mio_write_dump(), log_debug2, LOGT_IO, mio_ssl_starttls(), mio_xml_reset(), and ZONE.

Referenced by dialback_in_read_db(), and dialback_out_read().


Variable Documentation

global data for mio