jabberd2
2.3.3
|
#include "sx.h"
Go to the source code of this file.
Functions | |
sx_t | sx_new (sx_env_t env, int tag, sx_callback_t cb, void *arg) |
void | sx_free (sx_t s) |
void | sx_auth (sx_t s, const char *auth_method, const char *auth_id) |
force advance into auth state More... | |
void | _sx_reset (sx_t s) |
utility; reset stream state More... | |
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... | |
void | _sx_buffer_free (sx_buf_t buf) |
utility: kill a buffer More... | |
void | _sx_buffer_clear (sx_buf_t buf) |
utility: clear out a buffer, but don't deallocate it More... | |
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... | |
void | _sx_buffer_set (sx_buf_t buf, char *newdata, int newlength, char *newheap) |
utility: reset a sx_buf_t's contents. More... | |
void | __sx_debug (const char *file, int line, const char *msgfmt,...) |
debug macro helpers More... | |
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... | |
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().
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().
void sx_auth | ( | sx_t | s, |
const char * | auth_method, | ||
const char * | auth_id | ||
) |
force advance into auth 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().
void _sx_reset | ( | sx_t | s | ) |
utility; reset stream state
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().
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().
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().
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().
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().
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().
void __sx_debug | ( | const char * | file, |
int | line, | ||
const char * | msgfmt, | ||
... | |||
) |
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.