#include <jabberdlib.h>
#include <iostream>
Functions | |
| xstream | xstream_new (pool p, xstream_onNode f, void *arg) |
| int | xstream_eat (xstream xs, char *buff, int len) |
| xmlnode | xstream_header (const char *to, const char *from) |
| char * | xstream_header_char (xmlnode x, int stream_type) |
| void | xstream_format_error (std::ostream &out, streamerr errstruct) |
| streamerr_severity | xstream_parse_error (pool p, xmlnode errnode, streamerr errstruct) |
xstream is a way to have a consistent method of handling incoming XML stream based events ... if doesn't handle the generation of an XML stream, but provides some facilities to help doing that
Currently this is only used by base_stdout.c and the stream used by dnsrv to communicate with the co-process. Other XML streams (c2s, s2s, components, ...) use XML streaming implemented in mio_xml.c.
| int xstream_eat | ( | xstream | xs, | |
| char * | buff, | |||
| int | len | |||
| ) |
attempts to parse the buff onto this stream firing events to the handler
| xs | the xstream to parse the data on | |
| buff | the new data | |
| len | length of the data |
References xstream_struct::arg, xstream_struct::cdata_len, xstream_struct::f, xstream_struct::node, NS_SERVER, xstream_struct::parser, pool_size(), xstream_struct::status, xmlnode_insert_cdata(), xmlnode_new_tag_ns(), xmlnode_pool(), XSTREAM_ERR, and XSTREAM_MAXNODE.
Referenced by dnsrv_child_main(), and dnsrv_process_io().
| void xstream_format_error | ( | std::ostream & | out, | |
| streamerr | errstruct | |||
| ) |
format a stream error for logging
| out | where to write the result | |
| errstruct | the information about the error |
References bad_format, bad_namespace_prefix, conflict, connection_timeout, host_gone, host_unknown, improper_addressing, internal_server_error, invalid_from, invalid_id, invalid_namespace, invalid_xml, streamerr_struct::lang, not_authorized, policy_violation, streamerr_struct::reason, remote_connection_failed, resource_constraint, restricted_xml, see_other_host, system_shutdown, streamerr_struct::text, undefined_condition, unknown_error_type, unsupported_encoding, unsupported_stanza_type, unsupported_version, and xml_not_well_formed.
Referenced by dialback_in_read_db(), dialback_out_read(), and dialback_out_read_db().
| xmlnode xstream_header | ( | const char * | to, | |
| const char * | from | |||
| ) |
give a standard template xmlnode to work from
| to | where the stream is sent to | |
| from | where we are (source of the stream) |
References NS_SERVER, NS_STREAM, NS_XMLNS, shahash_r(), xmlnode_new_tag_ns(), and xmlnode_put_attrib_ns().
Referenced by dialback_in_read(), and dialback_out_read().
| char* xstream_header_char | ( | xmlnode | x, | |
| int | stream_type | |||
| ) |
trim the xmlnode to only the opening header :)
this function does ignore most explicit declarations of namespace prefixes. The only exceptions are explicit declarations of the default namespace, or the namespace defined by the prefix 'db'
| x | the xmlnode | |
| stream_type | 0 for 'jabber:server', 1 for 'jabber:client', 2 for 'jabber:component:accept' |
References NS_CLIENT, NS_COMPONENT_ACCEPT, NS_SERVER, NS_XMLNS, pstrdup(), strescape(), xmlnode_get_attrib_ns(), xmlnode_has_children(), xmlnode_pool(), and xmlnode_serialize_string().
Referenced by mio_write_root().
| xstream xstream_new | ( | pool | p, | |
| xstream_onNode | f, | |||
| void * | arg | |||
| ) |
creates a new xstream with given pool, xstream will be cleaned up w/ pool
| p | the memory pool to use for the stream | |
| f | function pointer to the event handler function | |
| arg | parameter to pass to the event handler function |
References xstream_struct::arg, xstream_struct::f, xstream_struct::p, xstream_struct::parser, pmalloco(), pool_cleanup(), and XMLNS_SEPARATOR.
Referenced by dnsrv_child_main(), and dnsrv_process_io().
| streamerr_severity xstream_parse_error | ( | pool | p, | |
| xmlnode | errnode, | |||
| streamerr | errstruct | |||
| ) |
parse a received stream error
| p | memory pool used to allocate memory for strings | |
| errnode | the xmlnode containing the stream error | |
| errstruct | where to place the results |
References bad_format, bad_namespace_prefix, configuration, conflict, connection_timeout, error, feature_lack, host_gone, host_unknown, improper_addressing, internal_server_error, invalid_from, invalid_id, invalid_namespace, invalid_xml, j_strcmp(), streamerr_struct::lang, normal, not_authorized, NS_XMPP_STREAMS, NTYPE_CDATA, NTYPE_TAG, policy_violation, pstrdup(), streamerr_struct::reason, remote_connection_failed, resource_constraint, restricted_xml, see_other_host, streamerr_struct::severity, system_shutdown, streamerr_struct::text, undefined_condition, unknown, unknown_error_type, unsupported_encoding, unsupported_stanza_type, unsupported_version, xml_not_well_formed, xmlnode_get_data(), xmlnode_get_firstchild(), xmlnode_get_lang(), xmlnode_get_localname(), xmlnode_get_namespace(), xmlnode_get_nextsibling(), xmlnode_get_type(), and xmlnode_pool().
Referenced by dialback_in_read_db(), dialback_out_read(), and dialback_out_read_db().
1.5.5