jabberd2
2.3.2
|
Go to the source code of this file.
Data Structures | |
struct | _sx_error_st |
error info for event_ERROR More... | |
struct | _sx_buf_st |
struct | _sx_chain_st |
struct | _sx_st |
holds the state for a single stream More... | |
struct | _sx_plugin_st |
a plugin More... | |
struct | _sx_env_st |
an environment More... | |
Typedefs | |
typedef struct _sx_st * | sx_t |
typedef struct _sx_env_st * | sx_env_t |
typedef struct _sx_plugin_st * | sx_plugin_t |
typedef int(* | sx_callback_t )(sx_t s, sx_event_t e, void *data, void *arg) |
event callback More... | |
typedef int(* | sx_plugin_init_t )(sx_env_t env, sx_plugin_t p, va_list args) |
plugin init More... | |
typedef struct _sx_error_st | sx_error_t |
error info for event_ERROR More... | |
typedef void(* | _sx_notify_t )(sx_t s, void *arg) |
prototype for the write notify function More... | |
typedef struct _sx_buf_st * | sx_buf_t |
utility: buffer More... | |
typedef struct _sx_chain_st * | _sx_chain_t |
read/write plugin chain More... | |
Enumerations | |
enum | sx_event_t { event_WANT_READ, event_WANT_WRITE, event_READ, event_WRITE, event_STREAM, event_OPEN, event_PACKET, event_CLOSED, event_ERROR } |
things that can happen More... | |
enum | _sx_state_t { state_NONE, state_STREAM_RECEIVED, state_STREAM_SENT, state_STREAM, state_OPEN, state_CLOSING, state_CLOSED } |
connection states More... | |
enum | _sx_type_t { type_NONE, type_CLIENT, type_SERVER } |
connection types More... | |
Functions | |
JABBERD2_API sx_t | sx_new (sx_env_t env, int tag, sx_callback_t cb, void *arg) |
JABBERD2_API void | sx_free (sx_t s) |
JABBERD2_API void | sx_client_init (sx_t s, unsigned int flags, const char *ns, const char *to, const char *from, const char *version) |
JABBERD2_API void | sx_server_init (sx_t s, unsigned int flags) |
JABBERD2_API int | sx_can_read (sx_t s) |
we can read More... | |
JABBERD2_API int | sx_can_write (sx_t s) |
JABBERD2_API void | sx_nad_write_elem (sx_t s, nad_t nad, int elem) |
sending a nad More... | |
JABBERD2_API void | sx_raw_write (sx_t s, const char *buf, int len) |
sending raw data More... | |
JABBERD2_API void | sx_auth (sx_t s, const char *auth_method, const char *auth_id) |
authenticate the stream and move to the auth'd state More... | |
JABBERD2_API sx_env_t | sx_env_new (void) |
JABBERD2_API void | sx_env_free (sx_env_t env) |
JABBERD2_API sx_plugin_t | sx_env_plugin (sx_env_t env, sx_plugin_init_t init,...) |
load a plugin into the environment More... | |
JABBERD2_API void | sx_error (sx_t s, int err, const char *text) |
JABBERD2_API void | sx_error_extended (sx_t s, int err, const char *content) |
JABBERD2_API void | sx_close (sx_t s) |
JABBERD2_API void | sx_kill (sx_t s) |
JABBERD2_API void | _sx_element_start (void *arg, const char *name, const char **atts) |
primary expat callbacks More... | |
JABBERD2_API void | _sx_element_end (void *arg, const char *name) |
JABBERD2_API void | _sx_cdata (void *arg, const char *str, int len) |
JABBERD2_API void | _sx_namespace_start (void *arg, const char *prefix, const char *uri) |
JABBERD2_API void | _sx_process_read (sx_t s, sx_buf_t buf) |
processor for incoming wire data More... | |
JABBERD2_API void | _sx_nad_process (sx_t s, nad_t nad) |
main nad processor More... | |
JABBERD2_API void | _sx_chain_io_plugin (sx_t s, sx_plugin_t p) |
JABBERD2_API void | _sx_chain_nad_plugin (sx_t s, sx_plugin_t p) |
JABBERD2_API int | _sx_chain_io_write (sx_t s, sx_buf_t buf) |
JABBERD2_API int | _sx_chain_io_read (sx_t s, sx_buf_t buf) |
JABBERD2_API int | _sx_chain_nad_write (sx_t s, nad_t nad, int elem) |
JABBERD2_API int | _sx_chain_nad_read (sx_t s, nad_t nad) |
JABBERD2_API sx_buf_t | _sx_buffer_new (const char *data, int len, _sx_notify_t notify, void *notify_arg) |
utility: make a new buffer if len>0 but data is NULL, the buffer will contain that many bytes of garbage, to be overwritten by caller. More... | |
JABBERD2_API void | _sx_buffer_free (sx_buf_t buf) |
utility: kill a buffer More... | |
JABBERD2_API void | _sx_buffer_clear (sx_buf_t buf) |
utility: clear out a buffer, but don't deallocate it More... | |
JABBERD2_API void | _sx_buffer_alloc_margin (sx_buf_t buf, int before, int after) |
utility: ensure a certain amount of allocated space adjacent to buf->data More... | |
JABBERD2_API void | _sx_buffer_set (sx_buf_t buf, char *newdata, int newlength, char *newheap) |
utility: reset a sx_buf_t's contents. More... | |
JABBERD2_API int | _sx_nad_write (sx_t s, nad_t nad, int elem) |
sending a nad (internal) More... | |
JABBERD2_API void | _sx_reset (sx_t s) |
reset stream state without informing the app More... | |
JABBERD2_API void | _sx_error (sx_t s, int err, const char *text) |
send an error More... | |
JABBERD2_API void | _sx_error_extended (sx_t s, int err, const char *content) |
JABBERD2_API void | _sx_close (sx_t s) |
close a stream More... | |
JABBERD2_API void | __sx_debug (const char *file, int line, const char *msgfmt,...) |
helper functions for macros when we're debugging More... | |
JABBERD2_API int | __sx_event (const char *file, int line, sx_t s, sx_event_t e, void *data) |
helper and internal macro for firing the callback More... | |
#define SX_ERR_STREAM (0x01) |
Definition at line 94 of file sx.h.
Referenced by _out_sx_callback(), _sx_client_element_start(), _sx_process_read(), and _sx_server_element_start().
#define SX_ERR_AUTH (0x02) |
Definition at line 95 of file sx.h.
Referenced by _sx_sasl_process(), _sx_sasl_rio(), _sx_sasl_wio(), c2s_router_sx_callback(), s2s_router_sx_callback(), and sm_sx_callback().
#define SX_ERR_XML_PARSE (0x03) |
Definition at line 96 of file sx.h.
Referenced by _sx_process_read().
#define _sx_gen_error | ( | e, | |
c, | |||
g, | |||
s | |||
) | do { e.code = c; e.generic = g; e.specific = s; } while(0); |
helper macro to populate this struct
Definition at line 106 of file sx.h.
Referenced by _sx_client_element_start(), _sx_compress_process(), _sx_compress_rio(), _sx_compress_wio(), _sx_process_read(), _sx_sasl_process(), _sx_sasl_rio(), _sx_sasl_wio(), _sx_server_element_start(), _sx_ssl_handshake(), _sx_ssl_process(), _sx_ssl_rio(), and _sx_ssl_wio().
#define stream_err_BAD_FORMAT (0) |
Definition at line 124 of file sx.h.
Referenced by _sx_client_element_start(), and _sx_server_element_start().
#define stream_err_CONFLICT (2) |
Definition at line 126 of file sx.h.
Referenced by c2s_router_sx_callback().
#define stream_err_CONNECTION_TIMEOUT (3) |
Definition at line 127 of file sx.h.
Referenced by _s2s_check_conn_routes(), and _s2s_time_checks().
#define stream_err_HOST_GONE (4) |
Definition at line 128 of file sx.h.
Referenced by _c2s_client_sx_callback(), and _c2s_time_checks().
#define stream_err_HOST_UNKNOWN (5) |
Definition at line 129 of file sx.h.
Referenced by _c2s_client_sx_callback(), and _router_sx_callback().
#define stream_err_INTERNAL_SERVER_ERROR (7) |
Definition at line 131 of file sx.h.
Referenced by _sx_compress_wio(), and c2s_router_sx_callback().
#define stream_err_INVALID_ID (9) |
Definition at line 133 of file sx.h.
Referenced by _out_result(), and _out_verify().
#define stream_err_INVALID_NAMESPACE (10) |
Definition at line 134 of file sx.h.
Referenced by _router_sx_callback().
#define stream_err_INVALID_XML (11) |
Definition at line 135 of file sx.h.
Referenced by _sx_compress_rio().
#define stream_err_NOT_AUTHORIZED (12) |
Definition at line 136 of file sx.h.
Referenced by _c2s_client_sx_callback(), and _router_process_handshake().
#define stream_err_POLICY_VIOLATION (13) |
Definition at line 137 of file sx.h.
Referenced by _c2s_client_sx_callback(), and _sx_process_read().
#define stream_err_SEE_OTHER_HOST (17) |
Definition at line 141 of file sx.h.
Referenced by _c2s_client_sx_callback().
#define stream_err_SYSTEM_SHUTDOWN (18) |
Definition at line 142 of file sx.h.
Referenced by JABBER_MAIN().
#define stream_err_UNDEFINED_CONDITION (19) |
Definition at line 143 of file sx.h.
Referenced by _sx_ssl_handshake(), _sx_ssl_rio(), and _sx_ssl_wio().
#define stream_err_UNSUPPORTED_VERSION (22) |
Definition at line 146 of file sx.h.
Referenced by _sx_server_element_start().
#define stream_err_XML_NOT_WELL_FORMED (23) |
Definition at line 147 of file sx.h.
Referenced by _sx_process_read().
#define stream_err_LAST (24) |
Definition at line 148 of file sx.h.
Referenced by sx_error(), and sx_error_extended().
#define sx_nad_write | ( | s, | |
nad | |||
) | sx_nad_write_elem(s, nad, 0) |
Definition at line 166 of file sx.h.
Referenced by _authreg_auth_get(), _authreg_auth_set(), _authreg_register_get(), _authreg_register_set(), _c2s_client_sx_callback(), _in_packet(), _in_result(), _in_verify(), _out_dialback(), _out_verify(), _router_advertise_reverse(), _router_broadcast(), _router_comp_write(), _router_process_bind(), _router_process_handshake(), _router_process_unbind(), _session_in_router(), authreg_process(), c2s_router_sx_callback(), out_bounce_route_queue(), out_packet(), pkt_router(), s2s_router_sx_callback(), sess_route(), sm_c2s_action(), sm_create(), sm_delete(), sm_end(), sm_packet(), sm_start(), sm_sx_callback(), and sx_sasl_auth().
#define _sx_event | ( | s, | |
e, | |||
data | |||
) | __sx_event(ZONE, s, e, data) |
Definition at line 392 of file sx.h.
Referenced by _sx_client_element_start(), _sx_compress_process(), _sx_compress_rio(), _sx_compress_wio(), _sx_process_read(), _sx_sasl_process(), _sx_sasl_rio(), _sx_sasl_wio(), _sx_server_element_start(), _sx_server_notify_header(), _sx_ssl_handshake(), _sx_ssl_process(), _sx_ssl_rio(), _sx_ssl_wio(), sx_auth(), sx_can_read(), sx_can_write(), sx_client_init(), sx_close(), sx_compress_client_compress(), sx_error(), sx_error_extended(), sx_kill(), sx_nad_write_elem(), sx_raw_write(), sx_server_init(), and sx_ssl_client_starttls().
#define _sx_debug if(0) __sx_debug |
Definition at line 405 of file sx.h.
Referenced by __sx_event(), _address_features(), _sx_ack_process(), _sx_chain_io_plugin(), _sx_chain_io_read(), _sx_chain_io_write(), _sx_chain_nad_plugin(), _sx_chain_nad_read(), _sx_chain_nad_write(), _sx_client_element_start(), _sx_client_notify_header(), _sx_compress_features(), _sx_compress_new(), _sx_compress_notify_compress(), _sx_compress_process(), _sx_compress_rio(), _sx_compress_wio(), _sx_error(), _sx_error_extended(), _sx_get_pending_write(), _sx_nad_write(), _sx_process_read(), _sx_raw_write(), _sx_reset(), _sx_sasl_client_process(), _sx_sasl_features(), _sx_sasl_free(), _sx_sasl_gsasl_callback(), _sx_sasl_notify_success(), _sx_sasl_open(), _sx_sasl_process(), _sx_sasl_rio(), _sx_sasl_server_process(), _sx_sasl_stream(), _sx_sasl_wio(), _sx_server_element_start(), _sx_server_notify_header(), _sx_ssl_client(), _sx_ssl_features(), _sx_ssl_get_external_id(), _sx_ssl_handshake(), _sx_ssl_process(), _sx_ssl_rio(), _sx_ssl_server(), _sx_ssl_starttls_notify_proceed(), _sx_ssl_verify_callback(), _sx_ssl_wio(), s2s_db_key(), sx_auth(), sx_can_read(), sx_can_write(), sx_client_init(), sx_compress_client_compress(), sx_compress_init(), sx_env_plugin(), sx_free(), sx_new(), sx_sasl_auth(), sx_sasl_init(), sx_server_init(), sx_ssl_client_starttls(), sx_ssl_init(), and sx_ssl_server_addcert().
#define _sx_state | ( | s, | |
st | |||
) | s->state = st |
Definition at line 406 of file sx.h.
Referenced by _sx_client_element_start(), _sx_client_notify_header(), _sx_close(), _sx_process_read(), _sx_server_element_start(), _sx_server_notify_header(), sx_auth(), sx_can_read(), sx_can_write(), sx_close(), and sx_kill().
typedef struct _sx_env_st* sx_env_t |
typedef struct _sx_plugin_st* sx_plugin_t |
typedef int(* sx_callback_t)(sx_t s, sx_event_t e, void *data, void *arg) |
typedef int(* sx_plugin_init_t)(sx_env_t env, sx_plugin_t p, va_list args) |
typedef struct _sx_error_st sx_error_t |
error info for event_ERROR
typedef void(* _sx_notify_t)(sx_t s, void *arg) |
typedef struct _sx_buf_st* sx_buf_t |
typedef struct _sx_chain_st* _sx_chain_t |
enum sx_event_t |
enum _sx_state_t |
enum _sx_type_t |
JABBERD2_API sx_t sx_new | ( | sx_env_t | env, |
int | tag, | ||
sx_callback_t | cb, | ||
void * | arg | ||
) |
Definition at line 23 of file sx.c.
References _sx_debug, _sx_st::cb, _sx_st::cb_arg, _sx_st::env, _sx_st::expat, jqueue_new(), _sx_plugin_st::new, _sx_env_st::nplugins, _sx_st::plugin_data, _sx_env_st::plugins, _sx_st::rnadq, _sx_st::tag, _sx_st::wbufq, and ZONE.
Referenced by _c2s_client_mio_callback(), _c2s_router_connect(), _s2s_router_connect(), _sm_router_connect(), _sx_reset(), in_mio_callback(), out_route(), and router_mio_callback().
JABBERD2_API void sx_free | ( | sx_t | s | ) |
Definition at line 70 of file sx.c.
References _sx_buffer_free(), _sx_debug, _sx_st::auth_id, _sx_st::auth_method, _sx_st::env, _sx_st::expat, _sx_plugin_st::free, _sx_st::id, jqueue_free(), jqueue_pull(), _sx_st::nad, nad_free(), _sx_env_st::nplugins, _sx_st::ns, _sx_st::plugin_data, _sx_env_st::plugins, _sx_st::reentry, _sx_st::req_from, _sx_st::req_to, _sx_st::req_version, _sx_st::res_from, _sx_st::res_to, _sx_st::res_version, _sx_st::rnadq, _sx_st::tag, _sx_st::wbufpending, _sx_st::wbufq, _sx_st::wio, _sx_st::wnad, _sx_chain_st::wnext, and ZONE.
Referenced by _sx_reset(), and JABBER_MAIN().
JABBERD2_API void sx_client_init | ( | sx_t | s, |
unsigned int | flags, | ||
const char * | ns, | ||
const char * | to, | ||
const char * | from, | ||
const char * | version | ||
) |
Definition at line 111 of file client.c.
References _sx_buffer_new(), _sx_client_notify_header(), _sx_debug, _sx_event, _sx_plugin_st::client, _sx_buf_st::data, _sx_st::env, event_WANT_WRITE, _sx_st::flags, _sx_plugin_st::header, jqueue_push(), _sx_buf_st::len, _sx_env_st::nplugins, _sx_st::ns, _sx_env_st::plugins, _sx_st::req_from, _sx_st::req_to, _sx_st::req_version, _sx_st::state, state_NONE, _sx_st::tag, _sx_st::type, type_CLIENT, uri_STREAMS, _sx_st::want_write, _sx_st::wbufq, and ZONE.
Referenced by _c2s_router_connect(), _s2s_router_connect(), _sm_router_connect(), _sx_compress_process(), _sx_sasl_process(), _sx_ssl_process(), and out_route().
JABBERD2_API void sx_server_init | ( | sx_t | s, |
unsigned int | flags | ||
) |
Definition at line 228 of file server.c.
References _sx_debug, _sx_event, _sx_server_element_end(), _sx_server_element_start(), _sx_server_ns_start(), _sx_st::env, event_WANT_READ, _sx_st::expat, _sx_st::flags, _sx_env_st::nplugins, _sx_env_st::plugins, _sx_plugin_st::server, _sx_st::state, state_NONE, _sx_st::tag, _sx_st::type, type_SERVER, _sx_st::want_read, and ZONE.
Referenced by _c2s_client_mio_callback(), _sx_compress_notify_compress(), _sx_sasl_notify_success(), _sx_ssl_starttls_notify_proceed(), in_mio_callback(), and router_mio_callback().
JABBERD2_API int sx_can_read | ( | sx_t | s | ) |
we can read
Definition at line 181 of file io.c.
References _sx_buffer_free(), _sx_buffer_new(), _sx_chain_io_read(), _sx_debug, _sx_event, _sx_process_read(), _sx_state, _sx_buf_st::data, event_CLOSED, event_READ, event_WANT_WRITE, _sx_buf_st::len, _sx_buf_st::notify, _sx_buf_st::notify_arg, _sx_st::state, state_CLOSED, state_CLOSING, _sx_st::tag, _sx_st::want_read, _sx_st::want_write, and ZONE.
Referenced by _c2s_client_mio_callback(), _c2s_time_checks(), _out_mio_callback(), c2s_router_mio_callback(), in_mio_callback(), router_mio_callback(), s2s_router_mio_callback(), and sm_mio_callback().
JABBERD2_API int sx_can_write | ( | sx_t | s | ) |
Definition at line 318 of file io.c.
References _sx_buffer_free(), _sx_debug, _sx_event, _sx_get_pending_write(), _sx_state, _sx_buf_st::data, event_CLOSED, event_WANT_READ, event_WRITE, _sx_buf_st::len, _sx_buf_st::notify, _sx_buf_st::notify_arg, _sx_st::state, state_CLOSED, state_CLOSING, sx_kill(), _sx_st::tag, _sx_st::want_read, _sx_st::want_write, _sx_st::wbufpending, and ZONE.
Referenced by _c2s_client_mio_callback(), _out_mio_callback(), c2s_router_mio_callback(), in_mio_callback(), router_mio_callback(), s2s_router_mio_callback(), and sm_mio_callback().
JABBERD2_API void sx_nad_write_elem | ( | sx_t | s, |
nad_t | nad, | ||
int | elem | ||
) |
sending a nad
sending a nad
Definition at line 420 of file io.c.
References _sx_event, _sx_nad_write(), event_WANT_READ, event_WANT_WRITE, _sx_st::want_read, and _sx_st::want_write.
Referenced by _router_comp_write(), c2s_router_sx_callback(), and out_packet().
JABBERD2_API void sx_raw_write | ( | sx_t | s, |
const char * | buf, | ||
int | len | ||
) |
sending raw data
sending raw data (internal)
sending raw data
sending raw data (internal)
Definition at line 454 of file io.c.
References _sx_event, _sx_raw_write(), event_WANT_READ, event_WANT_WRITE, _sx_st::want_read, and _sx_st::want_write.
Referenced by _c2s_time_checks(), _router_time_checks(), and _s2s_time_checks().
JABBERD2_API void sx_auth | ( | sx_t | s, |
const char * | auth_method, | ||
const char * | auth_id | ||
) |
authenticate the stream and move to the auth'd state
authenticate the stream and move to the auth'd state
Definition at line 141 of file sx.c.
References _sx_debug, _sx_event, _sx_state, _sx_st::auth_id, _sx_st::auth_method, event_OPEN, state_OPEN, and ZONE.
Referenced by _router_process_handshake(), _sx_sasl_open(), and c2s_router_sx_callback().
JABBERD2_API sx_env_t sx_env_new | ( | void | ) |
Definition at line 23 of file env.c.
Referenced by JABBER_MAIN().
JABBERD2_API void sx_env_free | ( | sx_env_t | env | ) |
Definition at line 31 of file env.c.
References _sx_env_st::nplugins, _sx_env_st::plugins, and _sx_plugin_st::unload.
Referenced by JABBER_MAIN().
JABBERD2_API sx_plugin_t sx_env_plugin | ( | sx_env_t | env, |
sx_plugin_init_t | init, | ||
... | |||
) |
load a plugin into the environment
Definition at line 48 of file env.c.
References _sx_debug, _sx_plugin_st::env, _sx_plugin_st::index, _sx_env_st::nplugins, _sx_env_st::plugins, and ZONE.
Referenced by _c2s_hosts_expand(), _s2s_hosts_expand(), and JABBER_MAIN().
JABBERD2_API void sx_error | ( | sx_t | s, |
int | err, | ||
const char * | text | ||
) |
Definition at line 88 of file error.c.
References _sx_error(), _sx_event, event_WANT_WRITE, and stream_err_LAST.
Referenced by _c2s_client_sx_callback(), _c2s_time_checks(), _out_result(), _out_verify(), _router_process_handshake(), _router_sx_callback(), _s2s_check_conn_routes(), _s2s_time_checks(), _sx_compress_rio(), _sx_compress_wio(), _sx_ssl_handshake(), _sx_ssl_rio(), _sx_ssl_wio(), c2s_router_sx_callback(), and JABBER_MAIN().
JABBERD2_API void sx_error_extended | ( | sx_t | s, |
int | err, | ||
const char * | content | ||
) |
Definition at line 134 of file error.c.
References _sx_error_extended(), _sx_event, event_WANT_WRITE, and stream_err_LAST.
Referenced by _c2s_client_sx_callback().
JABBERD2_API void sx_close | ( | sx_t | s | ) |
Definition at line 480 of file io.c.
References _sx_close(), _sx_event, _sx_state, event_CLOSED, event_WANT_WRITE, _sx_st::state, state_CLOSED, state_CLOSING, and state_STREAM_SENT.
Referenced by _c2s_client_sx_callback(), _c2s_component_presence(), _c2s_time_checks(), _out_result(), _out_verify(), _router_process_handshake(), _router_sx_callback(), _s2s_check_conn_routes(), _s2s_time_checks(), _sx_compress_rio(), _sx_compress_wio(), _sx_ssl_handshake(), _sx_ssl_rio(), _sx_ssl_wio(), c2s_router_sx_callback(), JABBER_MAIN(), s2s_router_sx_callback(), and sm_sx_callback().
JABBERD2_API void sx_kill | ( | sx_t | s | ) |
Definition at line 495 of file io.c.
References _sx_event, _sx_state, event_CLOSED, and state_CLOSED.
Referenced by _c2s_client_mio_callback(), _c2s_client_sx_callback(), _in_sx_callback(), _out_mio_callback(), _out_sx_callback(), _router_sx_callback(), c2s_router_mio_callback(), c2s_router_sx_callback(), in_mio_callback(), router_mio_callback(), s2s_router_mio_callback(), s2s_router_sx_callback(), sm_mio_callback(), sm_sx_callback(), and sx_can_write().
JABBERD2_API void _sx_element_start | ( | void * | arg, |
const char * | name, | ||
const char ** | atts | ||
) |
primary expat callbacks
Definition at line 24 of file callback.c.
References _sx_st::depth, _sx_st::fail, _sx_st::nad, nad_add_namespace(), nad_append_attr(), nad_append_elem(), nad_append_namespace(), and nad_new().
Referenced by _sx_client_element_start(), and _sx_server_element_start().
JABBERD2_API void _sx_element_end | ( | void * | arg, |
const char * | name | ||
) |
Definition at line 108 of file callback.c.
References _sx_st::depth, _sx_st::fail, jqueue_push(), _sx_st::nad, _sx_st::rbytes, and _sx_st::rnadq.
Referenced by _sx_client_element_start(), and _sx_server_element_start().
JABBERD2_API void _sx_cdata | ( | void * | arg, |
const char * | str, | ||
int | len | ||
) |
Definition at line 129 of file callback.c.
References _sx_st::depth, _sx_st::fail, _sx_st::nad, and nad_append_cdata().
Referenced by _sx_client_element_start(), and _sx_server_element_start().
JABBERD2_API void _sx_namespace_start | ( | void * | arg, |
const char * | prefix, | ||
const char * | uri | ||
) |
Definition at line 142 of file callback.c.
References _sx_st::fail, _sx_st::nad, nad_add_namespace(), nad_new(), and nad_st::scope.
Referenced by _sx_client_element_start(), and _sx_server_element_start().
JABBERD2_API void _sx_process_read | ( | sx_t | s, |
sx_buf_t | buf | ||
) |
processor for incoming wire data
processor for incoming wire data
Definition at line 24 of file io.c.
References _sx_buffer_free(), _sx_buffer_new(), _sx_chain_nad_read(), _sx_close(), _sx_debug, _sx_error(), _sx_event, _sx_gen_error, _sx_state, _sx_buf_st::data, _sx_st::depth, _sx_st::env, event_ERROR, event_PACKET, _sx_st::expat, _sx_st::fail, jqueue_pull(), jqueue_push(), _sx_buf_st::len, NAD_CDATA, NAD_CDATA_L, NAD_ENAME, NAD_ENAME_L, NAD_ENS, nad_find_elem(), nad_find_scoped_namespace(), nad_free(), NAD_NURI, NAD_NURI_L, nad_print(), _sx_env_st::nplugins, _sx_env_st::plugins, _sx_plugin_st::process, _sx_st::rbytes, _sx_st::rbytesmax, _sx_st::rnadq, _sx_st::state, state_CLOSING, state_STREAM, state_STREAM_SENT, stream_err_POLICY_VIOLATION, stream_err_XML_NOT_WELL_FORMED, SX_ERR_STREAM, SX_ERR_XML_PARSE, uri_STREAM_ERR, uri_STREAMS, _sx_st::want_write, _sx_st::wbufq, and ZONE.
Referenced by _sx_server_notify_header(), and sx_can_read().
JABBERD2_API void _sx_nad_process | ( | sx_t | s, |
nad_t | nad | ||
) |
main nad processor
JABBERD2_API void _sx_chain_io_plugin | ( | sx_t | s, |
sx_plugin_t | p | ||
) |
Definition at line 25 of file chain.c.
References _sx_debug, _sx_chain_st::p, _sx_st::rio, _sx_chain_st::rnext, _sx_st::wio, _sx_chain_st::wnext, and ZONE.
Referenced by _sx_compress_new(), _sx_sasl_notify_success(), _sx_ssl_client(), and _sx_ssl_server().
JABBERD2_API void _sx_chain_nad_plugin | ( | sx_t | s, |
sx_plugin_t | p | ||
) |
Definition at line 50 of file chain.c.
References _sx_debug, _sx_chain_st::p, _sx_st::rnad, _sx_chain_st::rnext, _sx_st::wnad, _sx_chain_st::wnext, and ZONE.
JABBERD2_API int _sx_chain_io_write | ( | sx_t | s, |
sx_buf_t | buf | ||
) |
Definition at line 75 of file chain.c.
References _sx_debug, _sx_chain_st::p, _sx_st::wio, _sx_plugin_st::wio, _sx_chain_st::wnext, and ZONE.
Referenced by _sx_get_pending_write().
JABBERD2_API int _sx_chain_io_read | ( | sx_t | s, |
sx_buf_t | buf | ||
) |
Definition at line 89 of file chain.c.
References _sx_debug, _sx_chain_st::p, _sx_st::rio, _sx_plugin_st::rio, _sx_chain_st::rnext, and ZONE.
Referenced by sx_can_read().
JABBERD2_API int _sx_chain_nad_write | ( | sx_t | s, |
nad_t | nad, | ||
int | elem | ||
) |
Definition at line 103 of file chain.c.
References _sx_debug, _sx_chain_st::p, _sx_st::wnad, _sx_plugin_st::wnad, _sx_chain_st::wnext, and ZONE.
Referenced by _sx_nad_write().
JABBERD2_API int _sx_chain_nad_read | ( | sx_t | s, |
nad_t | nad | ||
) |
Definition at line 116 of file chain.c.
References _sx_debug, _sx_chain_st::p, _sx_st::rnad, _sx_plugin_st::rnad, _sx_chain_st::rnext, and ZONE.
Referenced by _sx_process_read().
JABBERD2_API sx_buf_t _sx_buffer_new | ( | const char * | data, |
int | len, | ||
_sx_notify_t | notify, | ||
void * | notify_arg | ||
) |
utility: make a new buffer if len>0 but data is NULL, the buffer will contain that many bytes of garbage, to be overwritten by caller.
otherwise, data pointed to by 'data' will be copied into buf
Definition at line 222 of file sx.c.
References _sx_buf_st::data, _sx_buf_st::heap, _sx_buf_st::len, _sx_buf_st::notify, and _sx_buf_st::notify_arg.
Referenced by _sx_ack_process(), _sx_close(), _sx_compress_new(), _sx_compress_process(), _sx_error(), _sx_error_extended(), _sx_get_pending_write(), _sx_nad_write(), _sx_process_read(), _sx_raw_write(), _sx_server_element_start(), _sx_server_notify_header(), _sx_ssl_process(), _sx_ssl_wio(), sx_can_read(), sx_client_init(), sx_compress_client_compress(), and sx_ssl_client_starttls().
JABBERD2_API void _sx_buffer_free | ( | sx_buf_t | buf | ) |
utility: kill a buffer
Definition at line 246 of file sx.c.
References _sx_buf_st::heap.
Referenced by _sx_compress_free(), _sx_get_pending_write(), _sx_process_read(), _sx_ssl_free(), _sx_ssl_wio(), sx_can_read(), sx_can_write(), and sx_free().
JABBERD2_API void _sx_buffer_clear | ( | sx_buf_t | buf | ) |
utility: clear out a buffer, but don't deallocate it
Definition at line 254 of file sx.c.
References _sx_buf_st::data, _sx_buf_st::heap, and _sx_buf_st::len.
Referenced by _sx_buffer_set(), _sx_compress_rio(), _sx_compress_wio(), _sx_ssl_rio(), and _sx_ssl_wio().
JABBERD2_API void _sx_buffer_alloc_margin | ( | sx_buf_t | buf, |
int | before, | ||
int | after | ||
) |
utility: ensure a certain amount of allocated space adjacent to buf->data
Definition at line 264 of file sx.c.
References _sx_buf_st::data, _sx_buf_st::heap, and _sx_buf_st::len.
Referenced by _s2s_db_header(), _sx_ack_header(), _sx_buffer_set(), _sx_compress_rio(), _sx_compress_wio(), _sx_ssl_rio(), and _sx_ssl_wio().
JABBERD2_API void _sx_buffer_set | ( | sx_buf_t | buf, |
char * | newdata, | ||
int | newlength, | ||
char * | newheap | ||
) |
utility: reset a sx_buf_t's contents.
If newheap is non-NULL it is assumed to be 'data's malloc block and ownership of the block is taken by the buffer. If newheap is NULL then the data is copied.
Definition at line 301 of file sx.c.
References _sx_buffer_alloc_margin(), _sx_buffer_clear(), _sx_buf_st::data, _sx_buf_st::heap, and _sx_buf_st::len.
Referenced by _sx_sasl_rio(), and _sx_sasl_wio().
JABBERD2_API int _sx_nad_write | ( | sx_t | s, |
nad_t | nad, | ||
int | elem | ||
) |
sending a nad (internal)
sending a nad (internal)
Definition at line 388 of file io.c.
References _sx_buffer_new(), _sx_chain_nad_write(), _sx_debug, jqueue_push(), log_debug, nad_free(), nad_print(), _sx_st::state, state_CLOSING, _sx_st::want_write, _sx_st::wbufq, and ZONE.
Referenced by _sx_sasl_client_process(), _sx_sasl_process(), _sx_sasl_server_process(), and sx_nad_write_elem().
JABBERD2_API void _sx_reset | ( | sx_t | s | ) |
reset stream state without informing the app
reset stream state without informing the app
Definition at line 154 of file sx.c.
References _sx_debug, _sx_st::cb, _sx_st::cb_arg, _sx_st::compressed, _sx_st::env, _sx_st::expat, _sx_st::flags, _sx_st::has_reset, _sx_st::ip, _sx_st::plugin_data, _sx_st::port, _sx_st::rbytesmax, _sx_st::reentry, _sx_st::rio, _sx_st::rnad, _sx_st::ssf, sx_free(), sx_new(), _sx_st::tag, _sx_st::wio, _sx_st::wnad, and ZONE.
Referenced by _sx_compress_notify_compress(), _sx_compress_process(), _sx_sasl_notify_success(), _sx_sasl_process(), _sx_ssl_process(), and _sx_ssl_starttls_notify_proceed().
JABBERD2_API void _sx_error | ( | sx_t | s, |
int | err, | ||
const char * | text | ||
) |
send an error
Definition at line 53 of file error.c.
References _stream_errors, _sx_buffer_new(), _sx_debug, _sx_buf_st::data, jqueue_push(), _sx_buf_st::len, _sx_st::state, state_STREAM, uri_STREAM_ERR, uri_STREAMS, _sx_st::want_write, _sx_st::wbufq, and ZONE.
Referenced by _sx_client_element_start(), _sx_process_read(), _sx_server_element_start(), and sx_error().
JABBERD2_API void _sx_error_extended | ( | sx_t | s, |
int | err, | ||
const char * | content | ||
) |
Definition at line 99 of file error.c.
References _stream_errors, _sx_buffer_new(), _sx_debug, _sx_buf_st::data, jqueue_push(), _sx_buf_st::len, _sx_st::state, state_STREAM, uri_STREAM_ERR, uri_STREAMS, _sx_st::want_write, _sx_st::wbufq, and ZONE.
Referenced by sx_error_extended().
JABBERD2_API void _sx_close | ( | sx_t | s | ) |
close a stream
Definition at line 470 of file io.c.
References _sx_buffer_new(), _sx_state, jqueue_push(), _sx_st::state, state_CLOSING, state_STREAM_SENT, _sx_st::want_write, and _sx_st::wbufq.
Referenced by _sx_process_read(), _sx_ssl_rio(), _sx_ssl_wio(), and sx_close().
JABBERD2_API void __sx_debug | ( | const char * | file, |
int | line, | ||
const char * | msgfmt, | ||
... | |||
) |
JABBERD2_API int __sx_event | ( | const char * | file, |
int | line, | ||
sx_t | s, | ||
sx_event_t | e, | ||
void * | data | ||
) |
helper and internal macro for firing the callback
Definition at line 338 of file sx.c.
References _sx_debug, _sx_st::cb, _sx_st::cb_arg, _sx_st::reentry, and _sx_st::tag.