jabberd2
2.2.16
|
Go to the source code of this file.
Data Structures | |
struct | build_data |
parse a buffer into a nad More... | |
Defines | |
#define | _nad_ptr_check(func, nad) |
!!! Things to do (after 2.0) | |
#define | BLOCKSIZE 128 |
#define | NAD_SAFE(blocks, size, len) if((size) > len) len = _nad_realloc((void**)&(blocks),(size)); |
this is the safety check used to make sure there's always enough mem | |
Functions | |
static int | _nad_realloc (void **oblocks, int len) |
Reallocate the given buffer to make it larger. | |
static int | _nad_cdata (nad_t nad, const char *cdata, int len) |
internal: append some cdata and return the index to it | |
static int | _nad_attr (nad_t nad, int elem, int ns, const char *name, const char *val, int vallen) |
internal: create a new attr on any given elem | |
nad_t | nad_new (void) |
create a new nad | |
nad_t | nad_copy (nad_t nad) |
copy a nad | |
void | nad_free (nad_t nad) |
free that nad | |
int | nad_find_elem (nad_t nad, int elem, int ns, const char *name, int depth) |
locate the next elem at a given depth with an optional matching name | |
int | nad_find_attr (nad_t nad, int elem, int ns, const char *name, const char *val) |
get a matching attr on this elem, both name and optional val | |
int | nad_find_namespace (nad_t nad, int elem, const char *uri, const char *prefix) |
get a matching ns on this elem, both uri and optional prefix | |
int | nad_find_scoped_namespace (nad_t nad, const char *uri, const char *prefix) |
find a namespace in scope | |
int | nad_find_elem_path (nad_t nad, int elem, int ns, const char *name) |
find elem using XPath like query name -- "name" for the child tag of that name "name/name" for a sub child (recurses) "?attrib" to match the first tag with that attrib defined "?attrib=value" to match the first tag with that attrib and value or any combination: "name/name/?attrib", etc | |
void | nad_set_attr (nad_t nad, int elem, int ns, const char *name, const char *val, int vallen) |
create, update, or zap any matching attr on this elem | |
int | nad_insert_elem (nad_t nad, int parent, int ns, const char *name, const char *cdata) |
shove in a new child elem after the given one | |
void | nad_drop_elem (nad_t nad, int elem) |
remove an element (and its subelements) | |
void | nad_wrap_elem (nad_t nad, int elem, int ns, const char *name) |
wrap an element with another element | |
int | nad_insert_nad (nad_t dest, int delem, nad_t src, int selem) |
insert part of a nad into another nad | |
int | nad_append_elem (nad_t nad, int ns, const char *name, int depth) |
create a new elem on the list | |
int | nad_append_attr (nad_t nad, int ns, const char *name, const char *val) |
attach new attr to the last elem | |
void | nad_append_cdata (nad_t nad, const char *cdata, int len, int depth) |
append new cdata to the last elem | |
int | nad_add_namespace (nad_t nad, const char *uri, const char *prefix) |
bring a new namespace into scope | |
int | nad_append_namespace (nad_t nad, int elem, const char *uri, const char *prefix) |
declare a namespace on an already-existing element | |
static void | _nad_escape (nad_t nad, int data, int len, int flag) |
static int | _nad_lp0 (nad_t nad, int elem) |
internal recursive printing function | |
void | nad_print (nad_t nad, int elem, char **xml, int *len) |
create a string representation of the given element (and children), point references to it | |
void | nad_serialize (nad_t nad, char **buf, int *len) |
nads serialize to a buffer of this form: | |
nad_t | nad_deserialize (const char *buf) |
static void | _nad_parse_element_start (void *arg, const char *name, const char **atts) |
static void | _nad_parse_element_end (void *arg, const char *name) |
static void | _nad_parse_cdata (void *arg, const char *str, int len) |
static void | _nad_parse_namespace_start (void *arg, const char *prefix, const char *uri) |
nad_t | nad_parse (const char *buf, int len) |
create a nad from raw xml |
#define _nad_ptr_check | ( | func, | |
nad | |||
) |
!!! Things to do (after 2.0)
Definition at line 61 of file nad.c.
Referenced by nad_new(), nad_copy(), nad_free(), nad_find_elem(), nad_find_attr(), nad_find_namespace(), nad_find_scoped_namespace(), nad_find_elem_path(), nad_set_attr(), nad_insert_elem(), nad_drop_elem(), nad_wrap_elem(), nad_insert_nad(), nad_append_elem(), nad_append_attr(), nad_append_cdata(), nad_add_namespace(), nad_append_namespace(), nad_print(), nad_serialize(), and nad_deserialize().
#define BLOCKSIZE 128 |
Definition at line 64 of file nad.c.
Referenced by _nad_realloc().
#define NAD_SAFE | ( | blocks, | |
size, | |||
len | |||
) | if((size) > len) len = _nad_realloc((void**)&(blocks),(size)); |
this is the safety check used to make sure there's always enough mem
Definition at line 89 of file nad.c.
Referenced by _nad_cdata(), _nad_attr(), nad_copy(), nad_insert_elem(), nad_wrap_elem(), nad_insert_nad(), nad_append_elem(), nad_add_namespace(), nad_append_namespace(), _nad_escape(), and _nad_lp0().
static int _nad_realloc | ( | void ** | oblocks, |
int | len | ||
) | [static] |
Reallocate the given buffer to make it larger.
oblocks | A pointer to a buffer that will be made larger. |
len | The minimum size in bytes to make the buffer. The actual size of the buffer will be rounded up to the nearest block of 1024 bytes. |
Definition at line 76 of file nad.c.
References BLOCKSIZE.
static int _nad_cdata | ( | nad_t | nad, |
const char * | cdata, | ||
int | len | ||
) | [static] |
internal: append some cdata and return the index to it
Definition at line 92 of file nad.c.
References NAD_SAFE, nad_st::cdata, nad_st::ccur, and nad_st::clen.
Referenced by _nad_attr(), nad_set_attr(), nad_insert_elem(), nad_wrap_elem(), nad_insert_nad(), nad_append_elem(), nad_append_cdata(), nad_add_namespace(), and nad_append_namespace().
static int _nad_attr | ( | nad_t | nad, |
int | elem, | ||
int | ns, | ||
const char * | name, | ||
const char * | val, | ||
int | vallen | ||
) | [static] |
internal: create a new attr on any given elem
Definition at line 102 of file nad.c.
References NAD_SAFE, nad_st::attrs, nad_st::acur, nad_st::alen, nad_attr_st::next, nad_st::elems, nad_elem_st::attr, nad_attr_st::lname, nad_attr_st::iname, _nad_cdata(), nad_attr_st::lval, nad_attr_st::ival, and nad_attr_st::my_ns.
Referenced by nad_set_attr(), and nad_append_attr().
nad_t nad_new | ( | void | ) |
create a new nad
Definition at line 125 of file nad.c.
References nad_st::scope, xhash_put(), pstrdup(), xhash_pool(), and _nad_ptr_check.
Referenced by _authreg_auth_get(), _authreg_auth_set(), _authreg_register_get(), _authreg_register_set(), _c2s_client_sx_callback(), c2s_router_sx_callback(), _pbx_presence_nad(), _sm_build_route(), sm_sx_callback(), sm_c2s_action(), _router_advertise(), _router_advertise_reverse(), s2s_router_sx_callback(), _in_result(), _out_dialback(), _out_verify(), pkt_create(), _sx_element_start(), _sx_namespace_start(), _sx_sasl_success(), _sx_sasl_failure(), _sx_sasl_challenge(), _sx_sasl_response(), _sx_sasl_abort(), sx_sasl_auth(), _sx_server_notify_header(), config_load_with_id(), nad_copy(), nad_deserialize(), and nad_parse().
copy a nad
Definition at line 145 of file nad.c.
References _nad_ptr_check, nad_new(), NAD_SAFE, nad_st::elems, nad_st::elen, nad_st::attrs, nad_st::alen, nad_st::nss, nad_st::nlen, nad_st::cdata, nad_st::clen, nad_st::ecur, nad_st::acur, nad_st::ncur, nad_st::ccur, and nad_st::scope.
Referenced by _router_broadcast(), _router_route_log_sink(), _router_process_route(), _announce_load(), _announce_in_sess(), _announce_broadcast_user(), _help_pkt_sm(), _iq_private_in_sess(), _offline_in_sess(), _offline_user_delete(), _status_sess_start(), _status_sess_end(), pkt_dup(), and pres_in().
void nad_free | ( | nad_t | nad | ) |
free that nad
Definition at line 178 of file nad.c.
References _nad_ptr_check, xhash_zap(), xhash_put(), pstrdup(), xhash_pool(), nad_st::elems, nad_st::attrs, nad_st::cdata, nad_st::nss, and nad_st::depths.
Referenced by _authreg_auth_get(), _authreg_auth_set(), _authreg_register_get(), _authreg_register_set(), _c2s_client_sx_callback(), _c2s_component_presence(), c2s_router_sx_callback(), JABBER_MAIN(), sm_sx_callback(), _router_advertise(), _router_process_handshake(), _router_process_route(), _router_sx_callback(), s2s_router_sx_callback(), user_table_load(), _in_sx_callback(), _in_result(), _in_verify(), _in_packet(), out_pkt_free(), out_packet(), _out_sx_callback(), _out_result(), _out_verify(), out_bounce_route_queue(), _announce_in_sess(), _announce_pkt_sm(), _announce_free(), _help_pkt_sm(), _status_sess_start(), _status_sess_end(), pkt_new(), pkt_free(), _sx_ack_process(), _sx_compress_process(), _sx_process_read(), _sx_nad_write(), _sx_sasl_process(), _sx_server_notify_header(), _sx_ssl_process(), sx_free(), config_load_with_id(), config_free(), and nad_parse().
int nad_find_elem | ( | nad_t | nad, |
int | elem, | ||
int | ns, | ||
const char * | name, | ||
int | depth | ||
) |
locate the next elem at a given depth with an optional matching name
find the next element with this name/depth
Definition at line 204 of file nad.c.
References _nad_ptr_check, nad_st::ecur, nad_st::elems, nad_elem_st::depth, nad_elem_st::lname, nad_st::cdata, nad_elem_st::iname, nad_elem_st::my_ns, NAD_NURI_L, and NAD_NURI.
Referenced by _authreg_auth_get(), _authreg_auth_set(), _authreg_register_set(), authreg_process(), _c2s_client_sx_callback(), c2s_router_sx_callback(), sm_sx_callback(), aci_load(), filter_load(), _router_process_bind(), s2s_router_sx_callback(), user_table_load(), _out_sx_callback(), mm_new(), _amp_pkt_user(), _announce_load(), _announce_pkt_sm(), _disco_pkt_sm_populate(), module_init(), _help_pkt_sm(), _iq_ping_reply(), _iq_private_in_sess(), _iq_vcard_to_object(), _iq_vcard_to_pkt(), _offline_in_sess(), _offline_pkt_user(), _offline_user_delete(), _pep_in_sess(), _privacy_out_router(), _privacy_result_builder(), _privacy_lists_result_builder(), _privacy_in_sess(), _roster_set_item(), _roster_in_sess(), _session_in_router(), _status_store(), _template_roster_reload(), _vacation_in_sess(), pkt_new(), pkt_router(), _sx_process_read(), nad_find_elem_path(), _xdata_field_parse(), and xdata_parse().
int nad_find_attr | ( | nad_t | nad, |
int | elem, | ||
int | ns, | ||
const char * | name, | ||
const char * | val | ||
) |
get a matching attr on this elem, both name and optional val
find the first matching attribute (and optionally value)
Definition at line 235 of file nad.c.
References _nad_ptr_check, nad_st::ecur, nad_st::elems, nad_elem_st::attr, nad_st::attrs, nad_attr_st::lname, nad_st::cdata, nad_attr_st::iname, nad_attr_st::lval, nad_attr_st::ival, nad_attr_st::my_ns, NAD_NURI_L, NAD_NURI, and nad_attr_st::next.
Referenced by _authreg_auth_get(), _authreg_auth_set(), _authreg_register_get(), _authreg_register_set(), authreg_process(), _c2s_client_sx_callback(), _c2s_component_presence(), c2s_router_sx_callback(), sm_sx_callback(), aci_load(), filter_load(), filter_packet(), _router_process_bind(), _router_process_unbind(), _router_comp_write(), _router_process_route(), _router_sx_callback(), s2s_router_sx_callback(), _in_sx_callback(), _in_result(), _in_verify(), _in_packet(), _out_result(), _out_verify(), out_bounce_route_queue(), dispatch(), mm_new(), _amp_pkt_user(), _amp_pkt_sm(), _announce_load(), _disco_pkt_sm_populate(), _disco_pkt_sm(), module_init(), _offline_in_sess(), _offline_pkt_user(), _offline_user_delete(), _privacy_in_sess(), _roster_set_item(), _roster_in_sess(), _session_in_router(), _template_roster_reload(), pkt_new(), pkt_id(), _sx_ack_process(), _sx_sasl_process(), nad_find_elem_path(), nad_set_attr(), stanza_tofrom(), _xdata_field_parse(), and xdata_parse().
int nad_find_namespace | ( | nad_t | nad, |
int | elem, | ||
const char * | uri, | ||
const char * | prefix | ||
) |
get a matching ns on this elem, both uri and optional prefix
find the first matching namespace (and optionally prefix)
Definition at line 262 of file nad.c.
References _nad_ptr_check, nad_st::ecur, nad_st::elems, nad_elem_st::ns, NAD_NURI_L, NAD_NURI, nad_st::nss, nad_ns_st::iprefix, NAD_NPREFIX_L, NAD_NPREFIX, nad_ns_st::next, and nad_elem_st::parent.
Referenced by _c2s_client_sx_callback(), c2s_router_sx_callback(), _router_sx_callback(), _in_packet(), out_packet(), _session_in_router(), pkt_new(), pkt_router(), nad_find_elem_path(), and nad_append_namespace().
int nad_find_scoped_namespace | ( | nad_t | nad, |
const char * | uri, | ||
const char * | prefix | ||
) |
find a namespace in scope
find a namespace in scope (and optionally prefix)
Definition at line 290 of file nad.c.
References _nad_ptr_check, nad_st::ncur, NAD_NURI_L, NAD_NURI, nad_st::nss, nad_ns_st::iprefix, NAD_NPREFIX_L, and NAD_NPREFIX.
Referenced by _authreg_auth_get(), _authreg_auth_set(), _authreg_register_set(), authreg_process(), _c2s_client_sx_callback(), c2s_router_sx_callback(), sm_sx_callback(), s2s_router_sx_callback(), _out_sx_callback(), _amp_pkt_user(), _announce_load(), _disco_pkt_sm_populate(), _iq_ping_reply(), _iq_private_in_sess(), _offline_in_sess(), _offline_pkt_user(), _offline_user_delete(), _pep_in_sess(), _privacy_result_builder(), _privacy_lists_result_builder(), _privacy_in_sess(), _session_in_router(), _vacation_in_sess(), _sx_process_read(), and nad_add_namespace().
int nad_find_elem_path | ( | nad_t | nad, |
int | elem, | ||
int | ns, | ||
const char * | name | ||
) |
find elem using XPath like query name -- "name" for the child tag of that name "name/name" for a sub child (recurses) "?attrib" to match the first tag with that attrib defined "?attrib=value" to match the first tag with that attrib and value or any combination: "name/name/?attrib", etc
Definition at line 318 of file nad.c.
References _nad_ptr_check, nad_st::ecur, nad_find_elem(), nad_find_namespace(), nad_find_attr(), and nad_find_elem_path().
Referenced by filter_packet(), and nad_find_elem_path().
void nad_set_attr | ( | nad_t | nad, |
int | elem, | ||
int | ns, | ||
const char * | name, | ||
const char * | val, | ||
int | vallen | ||
) |
create, update, or zap any matching attr on this elem
reset or store the given attribute
Definition at line 375 of file nad.c.
References _nad_ptr_check, nad_find_attr(), _nad_attr(), nad_st::attrs, nad_attr_st::lval, nad_attr_st::lname, nad_attr_st::ival, and _nad_cdata().
Referenced by _authreg_auth_set(), _authreg_register_set(), _c2s_client_sx_callback(), c2s_router_sx_callback(), sm_packet(), sm_sx_callback(), filter_packet(), _router_advertise_reverse(), _router_process_bind(), _router_process_unbind(), _router_route_log_sink(), _router_process_route(), _router_sx_callback(), s2s_router_sx_callback(), _in_result(), _in_verify(), _in_packet(), _out_dialback(), _announce_in_sess(), _announce_broadcast_user(), _announce_pkt_sm(), _deliver_in_sess(), _disco_info_result(), _disco_in_sess_result(), _disco_pkt_sm(), _help_pkt_sm(), _iq_last_pkt_sm(), _iq_last_pkt_user(), _iq_ping_reply(), _iq_private_in_sess(), _iq_time_pkt_sm(), _iq_vcard_in_sess(), _iq_vcard_pkt_sm(), _iq_vcard_pkt_user(), _iq_version_pkt_sm(), _offline_pkt_user(), _presence_in_sess(), _privacy_result_builder(), _privacy_lists_result_builder(), _privacy_in_sess(), _roster_insert_item(), _roster_in_sess_s10n(), _roster_update_walker(), _roster_set_item(), _roster_in_sess(), _roster_pkt_user(), _session_in_router(), _vacation_in_sess(), pkt_tofrom(), pkt_dup(), pkt_id(), pkt_id_new(), pkt_router(), pkt_sess(), pkt_delay(), pres_in(), sess_route(), stanza_error(), and stanza_tofrom().
int nad_insert_elem | ( | nad_t | nad, |
int | parent, | ||
int | ns, | ||
const char * | name, | ||
const char * | cdata | ||
) |
shove in a new child elem after the given one
insert and return a new element as a child of this one
Definition at line 405 of file nad.c.
References nad_st::ecur, _nad_ptr_check, NAD_SAFE, nad_st::elems, nad_st::elen, nad_elem_st::parent, nad_elem_st::lname, nad_elem_st::iname, _nad_cdata(), nad_elem_st::attr, nad_elem_st::ns, nad_st::scope, nad_elem_st::itail, nad_elem_st::ltail, nad_elem_st::my_ns, nad_elem_st::lcdata, nad_elem_st::icdata, and nad_elem_st::depth.
Referenced by _help_pkt_sm(), _iq_time_pkt_sm(), _iq_version_pkt_sm(), _privacy_out_router(), _privacy_result_builder(), _privacy_lists_result_builder(), _privacy_in_sess(), _roster_insert_item(), _vacation_in_sess(), _vacation_pkt_user(), pkt_delay(), and stanza_error().
void nad_drop_elem | ( | nad_t | nad, |
int | elem | ||
) |
remove an element (and its subelements)
Definition at line 452 of file nad.c.
References _nad_ptr_check, nad_st::ecur, nad_st::elems, nad_elem_st::depth, and nad_elem_st::parent.
Referenced by _announce_pkt_sm(), _help_pkt_sm(), _iq_ping_reply(), _roster_in_sess(), and _session_in_router().
void nad_wrap_elem | ( | nad_t | nad, |
int | elem, | ||
int | ns, | ||
const char * | name | ||
) |
wrap an element with another element
Definition at line 475 of file nad.c.
References _nad_ptr_check, nad_st::ecur, NAD_SAFE, nad_st::elems, nad_st::elen, nad_elem_st::parent, nad_elem_st::lname, nad_elem_st::iname, _nad_cdata(), nad_elem_st::attr, nad_elem_st::ns, nad_st::scope, nad_elem_st::itail, nad_elem_st::ltail, nad_elem_st::icdata, nad_elem_st::lcdata, nad_elem_st::my_ns, and nad_elem_st::depth.
Referenced by sm_packet(), _router_sx_callback(), and _in_packet().
insert part of a nad into another nad
Definition at line 512 of file nad.c.
References _nad_ptr_check, nad_st::ecur, nad_st::elems, nad_elem_st::depth, NAD_SAFE, nad_st::elen, nad_elem_st::parent, nad_elem_st::lname, nad_elem_st::iname, _nad_cdata(), nad_st::cdata, nad_elem_st::lcdata, nad_elem_st::icdata, nad_elem_st::ltail, nad_elem_st::itail, nad_elem_st::my_ns, nad_elem_st::ns, nad_st::scope, nad_st::ncur, NAD_NURI_L, NAD_NURI, NAD_NPREFIX_L, NAD_NPREFIX, nad_add_namespace(), nad_st::nss, nad_ns_st::next, nad_elem_st::attr, nad_st::acur, nad_st::attrs, nad_attr_st::next, nad_st::alen, nad_attr_st::lname, nad_attr_st::iname, nad_attr_st::lval, nad_attr_st::ival, and nad_attr_st::my_ns.
int nad_append_elem | ( | nad_t | nad, |
int | ns, | ||
const char * | name, | ||
int | depth | ||
) |
create a new elem on the list
append and return a new element
Definition at line 667 of file nad.c.
References _nad_ptr_check, NAD_SAFE, nad_st::elems, nad_st::ecur, nad_st::elen, nad_elem_st::lname, nad_elem_st::iname, _nad_cdata(), nad_elem_st::icdata, nad_elem_st::lcdata, nad_elem_st::itail, nad_elem_st::ltail, nad_elem_st::attr, nad_elem_st::ns, nad_st::scope, nad_elem_st::depth, nad_elem_st::my_ns, nad_st::depths, nad_st::dlen, and nad_elem_st::parent.
Referenced by _authreg_auth_get(), _authreg_auth_set(), _authreg_register_get(), _authreg_register_set(), _bind_features(), _c2s_client_sx_callback(), c2s_router_sx_callback(), _pbx_presence_nad(), _sm_build_route(), sm_sx_callback(), sm_c2s_action(), _router_advertise(), _router_advertise_reverse(), s2s_router_sx_callback(), _s2s_db_features(), _in_result(), _out_dialback(), _out_verify(), amp_build_response_pkt(), _amp_pkt_sm(), _disco_items_result(), _disco_info_result(), _disco_agents_result(), _disco_in_sess_result(), _disco_sessions_result(), _disco_pkt_sm(), _disco_pkt_router(), _help_disco_extend(), _iq_vcard_to_pkt(), _iq_version_disco_extend(), _offline_pkt_user(), _pep_out_sess(), _roster_in_sess_s10n(), _roster_update_walker(), _roster_set_item(), _roster_pkt_user(), pkt_create(), _sx_ack_features(), _sx_address_features(), _sx_element_start(), _sx_compress_features(), _sx_sasl_features(), _sx_sasl_success(), _sx_sasl_failure(), _sx_sasl_challenge(), _sx_sasl_response(), _sx_sasl_abort(), sx_sasl_auth(), _sx_server_notify_header(), _sx_ssl_features(), _config_startElement(), and _nad_parse_element_start().
int nad_append_attr | ( | nad_t | nad, |
int | ns, | ||
const char * | name, | ||
const char * | val | ||
) |
attach new attr to the last elem
append attribs to the last element
Definition at line 701 of file nad.c.
References _nad_ptr_check, _nad_attr(), and nad_st::ecur.
Referenced by _authreg_auth_get(), _authreg_register_get(), c2s_router_sx_callback(), _pbx_presence_nad(), _sm_build_route(), sm_sx_callback(), sm_c2s_action(), _router_advertise(), s2s_router_sx_callback(), _in_result(), _out_verify(), amp_build_response_pkt(), _amp_pkt_sm(), _disco_items_result(), _disco_info_result(), _disco_agents_result(), _disco_in_sess_result(), _disco_sessions_result(), _disco_pkt_sm(), _help_disco_extend(), _iq_version_disco_extend(), _pep_out_sess(), pkt_create(), _sx_element_start(), sx_sasl_auth(), _config_startElement(), and _nad_parse_element_start().
void nad_append_cdata | ( | nad_t | nad, |
const char * | cdata, | ||
int | len, | ||
int | depth | ||
) |
append new cdata to the last elem
append more cdata to the last element
Definition at line 709 of file nad.c.
References nad_st::ecur, _nad_ptr_check, nad_st::elems, nad_elem_st::depth, nad_elem_st::icdata, nad_st::ccur, _nad_cdata(), nad_elem_st::lcdata, nad_st::depths, nad_elem_st::itail, and nad_elem_st::ltail.
Referenced by _authreg_auth_get(), _authreg_register_get(), _c2s_client_sx_callback(), _pbx_presence_nad(), _in_result(), _out_dialback(), _disco_agents_result(), _help_disco_extend(), _iq_vcard_to_pkt(), _iq_version_disco_extend(), _offline_pkt_user(), _sx_address_features(), _sx_cdata(), _sx_compress_features(), _sx_sasl_features(), _sx_sasl_challenge(), _sx_sasl_response(), _sx_sasl_success(), sx_sasl_auth(), _config_charData(), and _nad_parse_cdata().
int nad_add_namespace | ( | nad_t | nad, |
const char * | uri, | ||
const char * | prefix | ||
) |
bring a new namespace into scope
add a namespace to the next element (ie, called when the namespace comes into scope)
Definition at line 734 of file nad.c.
References _nad_ptr_check, nad_find_scoped_namespace(), NAD_SAFE, nad_st::nss, nad_st::ncur, nad_st::nlen, nad_ns_st::next, nad_st::scope, nad_ns_st::luri, nad_ns_st::iuri, _nad_cdata(), nad_ns_st::lprefix, and nad_ns_st::iprefix.
Referenced by _authreg_auth_get(), _authreg_auth_set(), _authreg_register_get(), _authreg_register_set(), _bind_features(), _c2s_client_sx_callback(), c2s_router_sx_callback(), _pbx_presence_nad(), _sm_build_route(), sm_packet(), sm_sx_callback(), sm_c2s_action(), _router_advertise(), _router_advertise_reverse(), _router_sx_callback(), s2s_router_sx_callback(), _s2s_db_features(), _in_result(), _in_packet(), _out_dialback(), _out_verify(), amp_build_response_pkt(), _amp_pkt_sm(), _disco_items_result(), _disco_info_result(), _disco_agents_result(), _disco_sessions_result(), _disco_pkt_sm(), _disco_pkt_router(), _help_disco_extend(), _iq_vcard_to_pkt(), _iq_version_disco_extend(), _offline_pkt_user(), _privacy_out_router(), _privacy_in_sess(), _roster_insert_item(), _roster_in_sess_s10n(), _roster_update_walker(), _roster_set_item(), _roster_pkt_user(), pkt_create(), pkt_delay(), _sx_address_features(), _sx_element_start(), _sx_namespace_start(), _sx_compress_features(), _sx_sasl_features(), _sx_sasl_success(), _sx_sasl_failure(), _sx_sasl_challenge(), _sx_sasl_response(), _sx_sasl_abort(), sx_sasl_auth(), _sx_server_notify_header(), _sx_ssl_features(), nad_insert_nad(), _nad_parse_element_start(), _nad_parse_namespace_start(), and stanza_error().
int nad_append_namespace | ( | nad_t | nad, |
int | elem, | ||
const char * | uri, | ||
const char * | prefix | ||
) |
declare a namespace on an already-existing element
declare a namespace on an already existing element
Definition at line 767 of file nad.c.
References _nad_ptr_check, nad_find_namespace(), NAD_SAFE, nad_st::nss, nad_st::ncur, nad_st::nlen, nad_ns_st::next, nad_st::elems, nad_elem_st::ns, nad_ns_st::luri, nad_ns_st::iuri, _nad_cdata(), nad_ns_st::lprefix, and nad_ns_st::iprefix.
Referenced by sm_packet(), sess_route(), _sx_element_start(), and _nad_parse_element_start().
static void _nad_escape | ( | nad_t | nad, |
int | data, | ||
int | len, | ||
int | flag | ||
) | [static] |
Definition at line 798 of file nad.c.
References nad_st::cdata, NAD_SAFE, nad_st::ccur, and nad_st::clen.
Referenced by _nad_lp0().
static int _nad_lp0 | ( | nad_t | nad, |
int | elem | ||
) | [static] |
internal recursive printing function
Definition at line 902 of file nad.c.
References nad_st::ecur, nad_st::elems, nad_elem_st::my_ns, nad_st::nss, nad_ns_st::iprefix, NAD_SAFE, nad_st::cdata, nad_st::ccur, nad_elem_st::lname, nad_ns_st::lprefix, nad_st::clen, nad_elem_st::iname, nad_elem_st::ns, nad_ns_st::next, nad_ns_st::luri, uri_XML, nad_ns_st::iuri, nad_elem_st::attr, nad_st::attrs, nad_attr_st::next, nad_attr_st::lname, nad_attr_st::my_ns, nad_attr_st::iname, _nad_escape(), nad_attr_st::ival, nad_attr_st::lval, nad_elem_st::depth, nad_elem_st::lcdata, nad_elem_st::icdata, nad_elem_st::itail, and nad_elem_st::ltail.
Referenced by nad_print().
void nad_print | ( | nad_t | nad, |
int | elem, | ||
char ** | xml, | ||
int * | len | ||
) |
create a string representation of the given element (and children), point references to it
Definition at line 1115 of file nad.c.
References nad_st::ccur, _nad_ptr_check, _nad_lp0(), and nad_st::cdata.
Referenced by c2s_router_sx_callback(), _router_process_route(), _help_pkt_sm(), _sx_process_read(), _sx_nad_write(), and _sx_server_notify_header().
void nad_serialize | ( | nad_t | nad, |
char ** | buf, | ||
int * | len | ||
) |
nads serialize to a buffer of this form:
serialize and deserialize a nad
[buflen][ecur][acur][ncur][ccur][elems][attrs][nss][cdata]
nothing is done with endianness or word length, so the nad must be serialized and deserialized on the same platform
buflen is not actually used by deserialize(), but is provided as a convenience to the application so it knows how many bytes to read before passing them in to deserialize()
the depths array is not stored, so after deserialization nad_append_elem() and nad_append_cdata() will not work. this is rarely a problem
Definition at line 1143 of file nad.c.
References _nad_ptr_check, nad_st::ecur, nad_st::acur, nad_st::ncur, nad_st::ccur, nad_st::elems, nad_st::attrs, nad_st::nss, and nad_st::cdata.
nad_t nad_deserialize | ( | const char * | buf | ) |
Definition at line 1169 of file nad.c.
References nad_new(), _nad_ptr_check, nad_st::ecur, nad_st::acur, nad_st::ncur, nad_st::ccur, nad_st::elen, nad_st::alen, nad_st::nlen, nad_st::clen, nad_st::elems, nad_st::attrs, nad_st::nss, and nad_st::cdata.
static void _nad_parse_element_start | ( | void * | arg, |
const char * | name, | ||
const char ** | atts | ||
) | [static] |
Definition at line 1223 of file nad.c.
References nad_add_namespace(), build_data::nad, nad_append_elem(), build_data::depth, nad_append_namespace(), and nad_append_attr().
Referenced by nad_parse().
static void _nad_parse_element_end | ( | void * | arg, |
const char * | name | ||
) | [static] |
static void _nad_parse_cdata | ( | void * | arg, |
const char * | str, | ||
int | len | ||
) | [static] |
Definition at line 1306 of file nad.c.
References nad_append_cdata(), build_data::nad, and build_data::depth.
Referenced by nad_parse().
static void _nad_parse_namespace_start | ( | void * | arg, |
const char * | prefix, | ||
const char * | uri | ||
) | [static] |
Definition at line 1313 of file nad.c.
References nad_add_namespace(), build_data::nad, and nad_st::scope.
Referenced by nad_parse().
nad_t nad_parse | ( | const char * | buf, |
int | len | ||
) |
create a nad from raw xml
Definition at line 1337 of file nad.c.
References build_data::p, build_data::nad, nad_new(), build_data::depth, _nad_parse_element_start(), _nad_parse_element_end(), _nad_parse_cdata(), _nad_parse_namespace_start(), and nad_free().
Referenced by filter_load(), user_table_load(), and _template_roster_reload().