jabberd2
2.3.2
|
Not A DOM. More...
Go to the source code of this file.
Data Structures | |
struct | nad_elem_st |
struct | nad_attr_st |
struct | nad_ns_st |
struct | nad_st |
Macros | |
#define | JABBERD2_API extern |
#define | NAD_ENAME(N, E) (N->cdata + N->elems[E].iname) |
#define | NAD_ENAME_L(N, E) (N->elems[E].lname) |
#define | NAD_CDATA(N, E) (N->cdata + N->elems[E].icdata) |
#define | NAD_CDATA_L(N, E) (N->elems[E].lcdata) |
#define | NAD_ANAME(N, A) (N->cdata + N->attrs[A].iname) |
#define | NAD_ANAME_L(N, A) (N->attrs[A].lname) |
#define | NAD_AVAL(N, A) (N->cdata + N->attrs[A].ival) |
#define | NAD_AVAL_L(N, A) (N->attrs[A].lval) |
#define | NAD_NURI(N, NS) (N->cdata + N->nss[NS].iuri) |
#define | NAD_NURI_L(N, NS) (N->nss[NS].luri) |
#define | NAD_NPREFIX(N, NS) (N->cdata + N->nss[NS].iprefix) |
#define | NAD_NPREFIX_L(N, NS) (N->nss[NS].lprefix) |
#define | NAD_ENS(N, E) (N->elems[E].my_ns) |
#define | NAD_ANS(N, A) (N->attrs[A].my_ns) |
Typedefs | |
typedef struct nad_st * | nad_t |
Functions | |
JABBERD2_API nad_t | nad_new (void) |
create a new nad More... | |
JABBERD2_API nad_t | nad_copy (nad_t nad) |
copy a nad More... | |
JABBERD2_API void | nad_free (nad_t nad) |
free that nad More... | |
JABBERD2_API int | nad_find_elem (nad_t nad, int elem, int ns, const char *name, int depth) |
find the next element with this name/depth More... | |
JABBERD2_API int | nad_find_attr (nad_t nad, int elem, int ns, const char *name, const char *val) |
find the first matching attribute (and optionally value) More... | |
JABBERD2_API int | nad_find_namespace (nad_t nad, int elem, const char *uri, const char *prefix) |
find the first matching namespace (and optionally prefix) More... | |
JABBERD2_API int | nad_find_scoped_namespace (nad_t nad, const char *uri, const char *prefix) |
find a namespace in scope (and optionally prefix) More... | |
JABBERD2_API 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 More... | |
JABBERD2_API void | nad_set_attr (nad_t nad, int elem, int ns, const char *name, const char *val, int vallen) |
reset or store the given attribute More... | |
JABBERD2_API int | nad_insert_elem (nad_t nad, int elem, int ns, const char *name, const char *cdata) |
insert and return a new element as a child of this one More... | |
JABBERD2_API void | nad_drop_elem (nad_t nad, int elem) |
remove an element (and its subelements) More... | |
JABBERD2_API void | nad_wrap_elem (nad_t nad, int elem, int ns, const char *name) |
wrap an element with another element More... | |
JABBERD2_API int | nad_insert_nad (nad_t dest, int delem, nad_t src, int selem) |
insert part of a nad into another nad More... | |
JABBERD2_API int | nad_append_elem (nad_t nad, int ns, const char *name, int depth) |
append and return a new element More... | |
JABBERD2_API int | nad_append_attr (nad_t nad, int ns, const char *name, const char *val) |
append attribs to the last element More... | |
JABBERD2_API void | nad_append_cdata (nad_t nad, const char *cdata, int len, int depth) |
append more cdata to the last element More... | |
JABBERD2_API int | nad_add_namespace (nad_t nad, const char *uri, const char *prefix) |
add a namespace to the next element (ie, called when the namespace comes into scope) More... | |
JABBERD2_API int | nad_append_namespace (nad_t nad, int elem, const char *uri, const char *prefix) |
declare a namespace on an already existing element More... | |
JABBERD2_API void | nad_print (nad_t nad, int elem, const char **xml, int *len) |
create a string representation of the given element (and children), point references to it More... | |
JABBERD2_API void | nad_serialize (nad_t nad, char **buf, int *len) |
serialize and deserialize a nad More... | |
JABBERD2_API nad_t | nad_deserialize (const char *buf) |
JABBERD2_API nad_t | nad_parse (const char *buf, int len) |
create a nad from raw xml More... | |
Not A DOM.
NAD is very simplistic, and requires all string handling to use a length. Apps using this must be aware of the structure and access it directly for most information. NADs can only be built by successively using the append functions correctly. After built, they can be modified using other functions, or by direct access. To access cdata on an elem or attr, use nad->cdata + nad->xxx[index].ixxx for the start, and .lxxx for len.
Namespace support seems to work, but hasn't been thoroughly tested. in particular, editing the NAD after its creation might have quirks. use at your own risk! Note that nad_add_namespace() brings a namespace into scope for the next element added with nad_append_elem(), nad_insert_elem() or nad_wrap_elem() (and by extension, any of its subelements). This is the same way that Expat does things, so nad_add_namespace() can be driven from Expat's StartNamespaceDeclHandler. See nad_parse() for an example of how to use Expat to drive NAD.
Definition in file nad.h.
#define NAD_ENAME | ( | N, | |
E | |||
) | (N->cdata + N->elems[E].iname) |
Definition at line 183 of file nad.h.
Referenced by _c2s_client_sx_callback(), _in_sx_callback(), _out_sx_callback(), _router_process_route(), _router_sx_callback(), _sx_ack_process(), _sx_compress_process(), _sx_process_read(), _sx_sasl_process(), _sx_ssl_process(), authreg_process(), c2s_router_sx_callback(), message_log(), out_packet(), pkt_new(), s2s_router_sx_callback(), sm_sx_callback(), and xdata_parse().
#define NAD_ENAME_L | ( | N, | |
E | |||
) | (N->elems[E].lname) |
Definition at line 184 of file nad.h.
Referenced by _c2s_client_sx_callback(), _in_sx_callback(), _out_sx_callback(), _router_process_route(), _router_sx_callback(), _sx_ack_process(), _sx_compress_process(), _sx_process_read(), _sx_sasl_process(), _sx_ssl_process(), authreg_process(), c2s_router_sx_callback(), message_log(), out_packet(), pkt_new(), s2s_router_sx_callback(), sm_sx_callback(), and xdata_parse().
#define NAD_CDATA | ( | N, | |
E | |||
) | (N->cdata + N->elems[E].icdata) |
Definition at line 185 of file nad.h.
Referenced by _authreg_auth_get(), _authreg_auth_set(), _authreg_register_set(), _c2s_client_sx_callback(), _help_pkt_sm(), _in_result(), _in_verify(), _iq_vcard_to_object(), _roster_set_item(), _router_process_handshake(), _status_store(), _sx_process_read(), _sx_sasl_process(), _template_roster_reload(), _vacation_in_sess(), _xdata_field_parse(), aci_load(), config_load_with_id(), message_log(), mm_new(), module_init(), pkt_new(), user_table_load(), and xdata_parse().
#define NAD_CDATA_L | ( | N, | |
E | |||
) | (N->elems[E].lcdata) |
Definition at line 186 of file nad.h.
Referenced by _authreg_auth_get(), _authreg_auth_set(), _authreg_register_set(), _c2s_client_sx_callback(), _help_pkt_sm(), _in_result(), _in_verify(), _iq_vcard_to_object(), _roster_set_item(), _router_process_handshake(), _status_store(), _sx_process_read(), _sx_sasl_process(), _template_roster_reload(), _vacation_in_sess(), _xdata_field_parse(), aci_load(), config_load_with_id(), message_log(), mm_new(), module_init(), pkt_new(), user_table_load(), and xdata_parse().
#define NAD_ANAME | ( | N, | |
A | |||
) | (N->cdata + N->attrs[A].iname) |
Definition at line 187 of file nad.h.
Referenced by config_load_with_id().
#define NAD_ANAME_L | ( | N, | |
A | |||
) | (N->attrs[A].lname) |
Definition at line 188 of file nad.h.
Referenced by config_load_with_id().
#define NAD_AVAL | ( | N, | |
A | |||
) | (N->cdata + N->attrs[A].ival) |
Definition at line 189 of file nad.h.
Referenced by _amp_pkt_sm(), _amp_pkt_user(), _announce_load(), _authreg_auth_get(), _authreg_auth_set(), _authreg_register_get(), _authreg_register_set(), _c2s_client_sx_callback(), _c2s_component_presence(), _disco_pkt_sm(), _disco_pkt_sm_populate(), _in_packet(), _in_result(), _in_sx_callback(), _in_verify(), _offline_in_sess(), _offline_pkt_user(), _offline_user_delete(), _out_result(), _out_verify(), _privacy_in_sess(), _roster_in_sess(), _roster_set_item(), _router_comp_write(), _router_process_bind(), _router_process_route(), _router_process_unbind(), _router_sx_callback(), _session_in_router(), _sx_ack_process(), _sx_sasl_process(), _template_roster_reload(), _xdata_field_parse(), aci_load(), authreg_process(), c2s_router_sx_callback(), config_load_with_id(), dispatch(), filter_load(), filter_packet(), mm_new(), module_init(), pkt_id(), pkt_new(), s2s_router_sx_callback(), sm_sx_callback(), stanza_tofrom(), and xdata_parse().
#define NAD_AVAL_L | ( | N, | |
A | |||
) | (N->attrs[A].lval) |
Definition at line 190 of file nad.h.
Referenced by _amp_pkt_sm(), _amp_pkt_user(), _announce_load(), _authreg_auth_get(), _authreg_auth_set(), _authreg_register_get(), _authreg_register_set(), _c2s_client_sx_callback(), _c2s_component_presence(), _disco_pkt_sm(), _disco_pkt_sm_populate(), _in_packet(), _in_result(), _in_sx_callback(), _in_verify(), _offline_in_sess(), _offline_pkt_user(), _offline_user_delete(), _out_result(), _out_verify(), _privacy_in_sess(), _roster_in_sess(), _roster_set_item(), _router_comp_write(), _router_process_bind(), _router_process_route(), _router_process_unbind(), _router_sx_callback(), _session_in_router(), _sx_ack_process(), _sx_sasl_process(), _template_roster_reload(), _xdata_field_parse(), aci_load(), authreg_process(), c2s_router_sx_callback(), config_load_with_id(), dispatch(), filter_load(), filter_packet(), mm_new(), module_init(), pkt_id(), pkt_new(), s2s_router_sx_callback(), sm_sx_callback(), stanza_tofrom(), and xdata_parse().
#define NAD_NURI | ( | N, | |
NS | |||
) | (N->cdata + N->nss[NS].iuri) |
Definition at line 191 of file nad.h.
Referenced by _in_sx_callback(), _iq_private_in_sess(), _out_sx_callback(), _router_sx_callback(), _sx_ack_process(), _sx_compress_process(), _sx_process_read(), _sx_sasl_process(), _sx_ssl_process(), c2s_router_sx_callback(), nad_find_attr(), nad_find_elem(), nad_find_namespace(), nad_find_scoped_namespace(), nad_insert_nad(), out_bounce_route_queue(), pkt_new(), s2s_router_sx_callback(), sm_sx_callback(), and xdata_parse().
#define NAD_NURI_L | ( | N, | |
NS | |||
) | (N->nss[NS].luri) |
Definition at line 192 of file nad.h.
Referenced by _in_sx_callback(), _iq_private_in_sess(), _out_sx_callback(), _router_sx_callback(), _sx_ack_process(), _sx_compress_process(), _sx_process_read(), _sx_sasl_process(), _sx_ssl_process(), c2s_router_sx_callback(), nad_find_attr(), nad_find_elem(), nad_find_namespace(), nad_find_scoped_namespace(), nad_insert_nad(), out_bounce_route_queue(), pkt_new(), s2s_router_sx_callback(), sm_sx_callback(), and xdata_parse().
#define NAD_NPREFIX | ( | N, | |
NS | |||
) | (N->cdata + N->nss[NS].iprefix) |
Definition at line 193 of file nad.h.
Referenced by nad_find_namespace(), nad_find_scoped_namespace(), and nad_insert_nad().
#define NAD_NPREFIX_L | ( | N, | |
NS | |||
) | (N->nss[NS].lprefix) |
Definition at line 194 of file nad.h.
Referenced by nad_find_namespace(), nad_find_scoped_namespace(), and nad_insert_nad().
#define NAD_ENS | ( | N, | |
E | |||
) | (N->elems[E].my_ns) |
Definition at line 196 of file nad.h.
Referenced by _c2s_client_sx_callback(), _disco_pkt_sm(), _help_pkt_sm(), _in_sx_callback(), _iq_private_in_sess(), _iq_time_pkt_sm(), _iq_vcard_to_object(), _iq_vcard_to_pkt(), _iq_version_pkt_sm(), _out_sx_callback(), _roster_in_sess(), _roster_insert_item(), _roster_set_item(), _router_process_bind(), _router_sx_callback(), _status_store(), _sx_ack_process(), _sx_compress_process(), _sx_process_read(), _sx_sasl_process(), _sx_ssl_process(), _template_roster_reload(), _vacation_pkt_user(), _xdata_field_parse(), c2s_router_sx_callback(), out_bounce_route_queue(), pkt_new(), s2s_router_sx_callback(), sm_sx_callback(), and xdata_parse().
JABBERD2_API nad_t nad_new | ( | void | ) |
create a new nad
Definition at line 125 of file nad.c.
References _nad_ptr_check, pstrdup(), nad_st::scope, xhash_pool(), and xhash_put().
Referenced by _authreg_auth_get(), _authreg_auth_set(), _authreg_register_get(), _authreg_register_set(), _c2s_client_sx_callback(), _in_result(), _out_dialback(), _out_verify(), _pbx_presence_nad(), _router_advertise(), _router_advertise_reverse(), _sm_build_route(), _sx_element_start(), _sx_namespace_start(), _sx_sasl_abort(), _sx_sasl_challenge(), _sx_sasl_failure(), _sx_sasl_response(), _sx_sasl_success(), _sx_server_notify_header(), c2s_router_sx_callback(), config_load_with_id(), nad_copy(), nad_deserialize(), nad_parse(), pkt_create(), s2s_router_sx_callback(), sm_c2s_action(), sm_sx_callback(), and sx_sasl_auth().
JABBERD2_API nad_t nad_copy | ( | nad_t | nad | ) |
copy a nad
Definition at line 145 of file nad.c.
References _nad_ptr_check, nad_st::acur, nad_st::alen, nad_st::attrs, nad_st::ccur, nad_st::cdata, nad_st::clen, nad_st::ecur, nad_st::elems, nad_st::elen, nad_new(), NAD_SAFE, nad_st::ncur, nad_st::nlen, nad_st::nss, and nad_st::scope.
Referenced by _announce_broadcast_user(), _announce_in_sess(), _announce_load(), _help_pkt_sm(), _iq_private_in_sess(), _offline_in_sess(), _offline_user_delete(), _router_broadcast(), _router_process_route(), _router_route_log_sink(), _status_sess_end(), _status_sess_start(), pkt_dup(), and pres_in().
JABBERD2_API void nad_free | ( | nad_t | nad | ) |
free that nad
Definition at line 178 of file nad.c.
References _nad_ptr_check, nad_st::attrs, nad_st::cdata, nad_st::depths, nad_st::elems, nad_st::nss, pstrdup(), xhash_pool(), xhash_put(), and xhash_zap().
Referenced by _announce_free(), _announce_in_sess(), _announce_pkt_sm(), _authreg_auth_get(), _authreg_auth_set(), _authreg_register_get(), _authreg_register_set(), _c2s_client_sx_callback(), _c2s_component_presence(), _help_pkt_sm(), _in_packet(), _in_result(), _in_sx_callback(), _in_verify(), _out_result(), _out_sx_callback(), _out_verify(), _router_advertise(), _router_process_handshake(), _router_process_route(), _router_sx_callback(), _status_sess_end(), _status_sess_start(), _sx_ack_process(), _sx_compress_process(), _sx_nad_write(), _sx_process_read(), _sx_sasl_process(), _sx_server_notify_header(), _sx_ssl_process(), c2s_router_sx_callback(), config_free(), config_load_with_id(), JABBER_MAIN(), nad_parse(), out_bounce_route_queue(), out_packet(), out_pkt_free(), pkt_free(), pkt_new(), s2s_router_sx_callback(), sm_sx_callback(), sx_free(), and user_table_load().
JABBERD2_API int nad_find_elem | ( | nad_t | nad, |
int | elem, | ||
int | ns, | ||
const char * | name, | ||
int | depth | ||
) |
find the next element with this name/depth
0 for siblings, 1 for children and so on
find the next element with this name/depth
Definition at line 204 of file nad.c.
References _nad_ptr_check, nad_st::cdata, nad_elem_st::depth, nad_st::ecur, nad_st::elems, nad_elem_st::iname, nad_elem_st::lname, nad_elem_st::my_ns, NAD_NURI, and NAD_NURI_L.
Referenced by _amp_pkt_user(), _announce_load(), _announce_pkt_sm(), _authreg_auth_get(), _authreg_auth_set(), _authreg_register_set(), _c2s_client_sx_callback(), _disco_pkt_sm_populate(), _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(), _out_sx_callback(), _pep_in_sess(), _privacy_in_sess(), _privacy_lists_result_builder(), _privacy_out_router(), _privacy_result_builder(), _roster_in_sess(), _roster_set_item(), _router_process_bind(), _session_in_router(), _status_store(), _sx_process_read(), _template_roster_reload(), _vacation_in_sess(), _xdata_field_parse(), aci_load(), authreg_process(), c2s_router_sx_callback(), filter_load(), mm_new(), module_init(), nad_find_elem_path(), pkt_new(), pkt_router(), s2s_router_sx_callback(), sm_sx_callback(), user_table_load(), and xdata_parse().
JABBERD2_API int nad_find_attr | ( | nad_t | nad, |
int | elem, | ||
int | ns, | ||
const char * | name, | ||
const char * | val | ||
) |
find the first matching attribute (and optionally value)
find the first matching attribute (and optionally value)
Definition at line 235 of file nad.c.
References _nad_ptr_check, nad_elem_st::attr, nad_st::attrs, nad_st::cdata, nad_st::ecur, nad_st::elems, nad_attr_st::iname, nad_attr_st::ival, nad_attr_st::lname, nad_attr_st::lval, nad_attr_st::my_ns, NAD_NURI, NAD_NURI_L, and nad_attr_st::next.
Referenced by _amp_pkt_sm(), _amp_pkt_user(), _announce_load(), _authreg_auth_get(), _authreg_auth_set(), _authreg_register_get(), _authreg_register_set(), _c2s_client_sx_callback(), _c2s_component_presence(), _disco_pkt_sm(), _disco_pkt_sm_populate(), _in_packet(), _in_result(), _in_sx_callback(), _in_verify(), _offline_in_sess(), _offline_pkt_user(), _offline_user_delete(), _out_result(), _out_verify(), _privacy_in_sess(), _roster_in_sess(), _roster_set_item(), _router_comp_write(), _router_process_bind(), _router_process_route(), _router_process_unbind(), _router_sx_callback(), _session_in_router(), _sx_ack_process(), _sx_sasl_process(), _template_roster_reload(), _xdata_field_parse(), aci_load(), authreg_process(), c2s_router_sx_callback(), dispatch(), filter_load(), filter_packet(), mm_new(), module_init(), nad_find_elem_path(), nad_set_attr(), out_bounce_route_queue(), pkt_id(), pkt_new(), s2s_router_sx_callback(), sm_sx_callback(), stanza_tofrom(), and xdata_parse().
JABBERD2_API int nad_find_namespace | ( | nad_t | nad, |
int | elem, | ||
const char * | uri, | ||
const char * | prefix | ||
) |
find the first matching namespace (and optionally 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_ns_st::iprefix, NAD_NPREFIX, NAD_NPREFIX_L, NAD_NURI, NAD_NURI_L, nad_ns_st::next, nad_elem_st::ns, nad_st::nss, and nad_elem_st::parent.
Referenced by _c2s_client_sx_callback(), _in_packet(), _router_sx_callback(), _session_in_router(), c2s_router_sx_callback(), nad_append_namespace(), nad_find_elem_path(), out_packet(), pkt_new(), and pkt_router().
JABBERD2_API int nad_find_scoped_namespace | ( | nad_t | nad, |
const char * | uri, | ||
const char * | prefix | ||
) |
find a namespace in scope (and optionally prefix)
find a namespace in scope (and optionally prefix)
Definition at line 290 of file nad.c.
References _nad_ptr_check, nad_ns_st::iprefix, NAD_NPREFIX, NAD_NPREFIX_L, NAD_NURI, NAD_NURI_L, nad_st::ncur, and nad_st::nss.
Referenced by _amp_pkt_user(), _announce_load(), _authreg_auth_get(), _authreg_auth_set(), _authreg_register_set(), _c2s_client_sx_callback(), _disco_pkt_sm_populate(), _iq_ping_reply(), _iq_private_in_sess(), _offline_in_sess(), _offline_pkt_user(), _offline_user_delete(), _out_sx_callback(), _pep_in_sess(), _privacy_in_sess(), _privacy_lists_result_builder(), _privacy_result_builder(), _session_in_router(), _sx_process_read(), _vacation_in_sess(), authreg_process(), c2s_router_sx_callback(), nad_add_namespace(), s2s_router_sx_callback(), and sm_sx_callback().
JABBERD2_API 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_attr(), nad_find_elem(), nad_find_elem_path(), and nad_find_namespace().
Referenced by filter_packet(), and nad_find_elem_path().
JABBERD2_API void nad_set_attr | ( | nad_t | nad, |
int | elem, | ||
int | ns, | ||
const char * | name, | ||
const char * | val, | ||
int | vallen | ||
) |
reset or store the given attribute
reset or store the given attribute
Definition at line 375 of file nad.c.
References _nad_attr(), _nad_cdata(), _nad_ptr_check, nad_st::attrs, nad_attr_st::ival, nad_attr_st::lname, nad_attr_st::lval, and nad_find_attr().
Referenced by _announce_broadcast_user(), _announce_in_sess(), _announce_pkt_sm(), _authreg_auth_set(), _authreg_register_set(), _c2s_client_sx_callback(), _deliver_in_sess(), _disco_in_sess_result(), _disco_info_result(), _disco_pkt_sm(), _help_pkt_sm(), _in_packet(), _in_result(), _in_verify(), _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(), _out_dialback(), _presence_in_sess(), _privacy_in_sess(), _privacy_lists_result_builder(), _privacy_result_builder(), _roster_in_sess(), _roster_in_sess_s10n(), _roster_insert_item(), _roster_pkt_user(), _roster_set_item(), _roster_update_walker(), _router_advertise_reverse(), _router_process_bind(), _router_process_route(), _router_process_unbind(), _router_route_log_sink(), _router_sx_callback(), _session_in_router(), _vacation_in_sess(), c2s_router_sx_callback(), filter_packet(), pkt_delay(), pkt_dup(), pkt_id(), pkt_id_new(), pkt_router(), pkt_sess(), pkt_tofrom(), pres_in(), s2s_router_sx_callback(), sess_route(), sm_packet(), sm_sx_callback(), stanza_error(), and stanza_tofrom().
JABBERD2_API int nad_insert_elem | ( | nad_t | nad, |
int | parent, | ||
int | ns, | ||
const char * | name, | ||
const char * | cdata | ||
) |
insert and return a new element as a child of this one
insert and return a new element as a child of this one
Definition at line 405 of file nad.c.
References _nad_cdata(), _nad_ptr_check, nad_elem_st::attr, nad_elem_st::depth, nad_st::ecur, nad_st::elems, nad_st::elen, nad_elem_st::icdata, nad_elem_st::iname, nad_elem_st::itail, nad_elem_st::lcdata, nad_elem_st::lname, nad_elem_st::ltail, nad_elem_st::my_ns, NAD_SAFE, nad_elem_st::ns, nad_elem_st::parent, and nad_st::scope.
Referenced by _help_pkt_sm(), _iq_time_pkt_sm(), _iq_version_pkt_sm(), _privacy_in_sess(), _privacy_lists_result_builder(), _privacy_out_router(), _privacy_result_builder(), _roster_insert_item(), _vacation_in_sess(), _vacation_pkt_user(), pkt_delay(), and stanza_error().
JABBERD2_API 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_elem_st::depth, nad_st::ecur, nad_st::elems, and nad_elem_st::parent.
Referenced by _announce_pkt_sm(), _help_pkt_sm(), _iq_ping_reply(), _roster_in_sess(), and _session_in_router().
JABBERD2_API 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_cdata(), _nad_ptr_check, nad_elem_st::attr, nad_elem_st::depth, nad_st::ecur, nad_st::elems, nad_st::elen, nad_elem_st::icdata, nad_elem_st::iname, nad_elem_st::itail, nad_elem_st::lcdata, nad_elem_st::lname, nad_elem_st::ltail, nad_elem_st::my_ns, NAD_SAFE, nad_elem_st::ns, nad_elem_st::parent, and nad_st::scope.
Referenced by _in_packet(), _router_sx_callback(), and sm_packet().
JABBERD2_API int nad_insert_nad | ( | nad_t | dest, |
int | delem, | ||
nad_t | src, | ||
int | selem | ||
) |
insert part of a nad into another nad
Definition at line 512 of file nad.c.
References _nad_cdata(), _nad_ptr_check, nad_st::acur, nad_st::alen, nad_elem_st::attr, nad_st::attrs, nad_st::cdata, nad_elem_st::depth, nad_st::ecur, nad_st::elems, nad_st::elen, nad_elem_st::icdata, nad_elem_st::iname, nad_attr_st::iname, nad_elem_st::itail, nad_attr_st::ival, nad_elem_st::lcdata, nad_elem_st::lname, nad_attr_st::lname, nad_elem_st::ltail, nad_attr_st::lval, nad_elem_st::my_ns, nad_attr_st::my_ns, nad_add_namespace(), NAD_NPREFIX, NAD_NPREFIX_L, NAD_NURI, NAD_NURI_L, NAD_SAFE, nad_st::ncur, nad_attr_st::next, nad_ns_st::next, nad_elem_st::ns, nad_st::nss, nad_elem_st::parent, and nad_st::scope.
JABBERD2_API int nad_append_elem | ( | nad_t | nad, |
int | ns, | ||
const char * | name, | ||
int | depth | ||
) |
append and return a new element
append and return a new element
Definition at line 667 of file nad.c.
References _nad_cdata(), _nad_ptr_check, nad_elem_st::attr, nad_elem_st::depth, nad_st::depths, nad_st::dlen, nad_st::ecur, nad_st::elems, nad_st::elen, nad_elem_st::icdata, nad_elem_st::iname, nad_elem_st::itail, nad_elem_st::lcdata, nad_elem_st::lname, nad_elem_st::ltail, nad_elem_st::my_ns, NAD_SAFE, nad_elem_st::ns, nad_elem_st::parent, and nad_st::scope.
Referenced by _address_features(), _amp_pkt_sm(), _authreg_auth_get(), _authreg_auth_set(), _authreg_register_get(), _authreg_register_set(), _bind_features(), _c2s_client_sx_callback(), _config_startElement(), _disco_agents_result(), _disco_in_sess_result(), _disco_info_result(), _disco_items_result(), _disco_pkt_router(), _disco_pkt_sm(), _disco_sessions_result(), _help_disco_extend(), _in_result(), _iq_vcard_to_pkt(), _iq_version_disco_extend(), _nad_parse_element_start(), _offline_pkt_user(), _out_dialback(), _out_verify(), _pbx_presence_nad(), _pep_out_sess(), _roster_in_sess_s10n(), _roster_pkt_user(), _roster_set_item(), _roster_update_walker(), _router_advertise(), _router_advertise_reverse(), _s2s_db_features(), _sm_build_route(), _sx_ack_features(), _sx_compress_features(), _sx_element_start(), _sx_sasl_abort(), _sx_sasl_challenge(), _sx_sasl_failure(), _sx_sasl_features(), _sx_sasl_response(), _sx_sasl_success(), _sx_server_notify_header(), _sx_ssl_features(), amp_build_response_pkt(), c2s_router_sx_callback(), pkt_create(), s2s_router_sx_callback(), sm_c2s_action(), sm_sx_callback(), and sx_sasl_auth().
JABBERD2_API int nad_append_attr | ( | nad_t | nad, |
int | ns, | ||
const char * | name, | ||
const char * | val | ||
) |
append attribs to the last element
append attribs to the last element
Definition at line 701 of file nad.c.
References _nad_attr(), _nad_ptr_check, and nad_st::ecur.
Referenced by _amp_pkt_sm(), _authreg_auth_get(), _authreg_register_get(), _config_startElement(), _disco_agents_result(), _disco_in_sess_result(), _disco_info_result(), _disco_items_result(), _disco_pkt_sm(), _disco_sessions_result(), _help_disco_extend(), _in_result(), _iq_version_disco_extend(), _nad_parse_element_start(), _out_verify(), _pbx_presence_nad(), _pep_out_sess(), _router_advertise(), _sm_build_route(), _sx_element_start(), amp_build_response_pkt(), c2s_router_sx_callback(), pkt_create(), s2s_router_sx_callback(), sm_c2s_action(), sm_sx_callback(), and sx_sasl_auth().
JABBERD2_API void nad_append_cdata | ( | nad_t | nad, |
const char * | cdata, | ||
int | len, | ||
int | depth | ||
) |
append more cdata to the last element
append more cdata to the last element
Definition at line 709 of file nad.c.
References _nad_cdata(), _nad_ptr_check, nad_st::ccur, nad_elem_st::depth, nad_st::depths, nad_st::ecur, nad_st::elems, nad_elem_st::icdata, nad_elem_st::itail, nad_elem_st::lcdata, and nad_elem_st::ltail.
Referenced by _address_features(), _authreg_auth_get(), _authreg_register_get(), _c2s_client_sx_callback(), _config_charData(), _disco_agents_result(), _help_disco_extend(), _in_result(), _iq_vcard_to_pkt(), _iq_version_disco_extend(), _nad_parse_cdata(), _offline_pkt_user(), _out_dialback(), _pbx_presence_nad(), _sx_cdata(), _sx_compress_features(), _sx_sasl_challenge(), _sx_sasl_features(), _sx_sasl_response(), _sx_sasl_success(), and sx_sasl_auth().
JABBERD2_API int nad_add_namespace | ( | nad_t | nad, |
const char * | uri, | ||
const char * | prefix | ||
) |
add a namespace to the next element (ie, called when the namespace comes 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_cdata(), _nad_ptr_check, nad_ns_st::iprefix, nad_ns_st::iuri, nad_ns_st::lprefix, nad_ns_st::luri, nad_find_scoped_namespace(), NAD_SAFE, nad_st::ncur, nad_ns_st::next, nad_st::nlen, nad_st::nss, and nad_st::scope.
Referenced by _address_features(), _amp_pkt_sm(), _authreg_auth_get(), _authreg_auth_set(), _authreg_register_get(), _authreg_register_set(), _bind_features(), _c2s_client_sx_callback(), _disco_agents_result(), _disco_info_result(), _disco_items_result(), _disco_pkt_router(), _disco_pkt_sm(), _disco_sessions_result(), _help_disco_extend(), _in_packet(), _in_result(), _iq_vcard_to_pkt(), _iq_version_disco_extend(), _nad_parse_element_start(), _nad_parse_namespace_start(), _offline_pkt_user(), _out_dialback(), _out_verify(), _pbx_presence_nad(), _privacy_in_sess(), _privacy_out_router(), _roster_in_sess_s10n(), _roster_insert_item(), _roster_pkt_user(), _roster_set_item(), _roster_update_walker(), _router_advertise(), _router_advertise_reverse(), _router_sx_callback(), _s2s_db_features(), _sm_build_route(), _sx_compress_features(), _sx_element_start(), _sx_namespace_start(), _sx_sasl_abort(), _sx_sasl_challenge(), _sx_sasl_failure(), _sx_sasl_features(), _sx_sasl_response(), _sx_sasl_success(), _sx_server_notify_header(), _sx_ssl_features(), amp_build_response_pkt(), c2s_router_sx_callback(), nad_insert_nad(), pkt_create(), pkt_delay(), s2s_router_sx_callback(), sm_c2s_action(), sm_packet(), sm_sx_callback(), stanza_error(), and sx_sasl_auth().
JABBERD2_API 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_cdata(), _nad_ptr_check, nad_st::elems, nad_ns_st::iprefix, nad_ns_st::iuri, nad_ns_st::lprefix, nad_ns_st::luri, nad_find_namespace(), NAD_SAFE, nad_st::ncur, nad_ns_st::next, nad_st::nlen, nad_elem_st::ns, and nad_st::nss.
Referenced by _nad_parse_element_start(), _sx_element_start(), sess_route(), and sm_packet().
JABBERD2_API void nad_print | ( | nad_t | nad, |
int | elem, | ||
const char ** | xml, | ||
int * | len | ||
) |
create a string representation of the given element (and children), point references to it
Definition at line 1158 of file nad.c.
References _nad_lp0(), _nad_ptr_check, nad_st::ccur, and nad_st::cdata.
Referenced by _help_pkt_sm(), _router_process_route(), _sx_nad_write(), _sx_process_read(), _sx_server_notify_header(), and c2s_router_sx_callback().
JABBERD2_API void nad_serialize | ( | nad_t | nad, |
char ** | buf, | ||
int * | len | ||
) |
serialize and deserialize a nad
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 1186 of file nad.c.
References _nad_ptr_check, nad_st::acur, nad_st::attrs, nad_st::ccur, nad_st::cdata, nad_st::ecur, nad_st::elems, nad_st::ncur, and nad_st::nss.
JABBERD2_API nad_t nad_deserialize | ( | const char * | buf | ) |
Definition at line 1212 of file nad.c.
References _nad_ptr_check, nad_st::acur, nad_st::alen, nad_st::attrs, nad_st::ccur, nad_st::cdata, nad_st::clen, nad_st::ecur, nad_st::elems, nad_st::elen, nad_new(), nad_st::ncur, nad_st::nlen, and nad_st::nss.
JABBERD2_API nad_t nad_parse | ( | const char * | buf, |
int | len | ||
) |
create a nad from raw xml
Definition at line 1380 of file nad.c.
References _nad_parse_cdata(), _nad_parse_element_end(), _nad_parse_element_start(), _nad_parse_namespace_start(), build_data::depth, build_data::nad, nad_free(), nad_new(), and build_data::p.
Referenced by _template_roster_reload(), filter_load(), and user_table_load().