jabberd2  2.7.0
Data Structures | Macros | Typedefs | Enumerations | Functions
sx.h File Reference
#include "ac-stdint.h"
#include <expat.h>
#include <util/util.h>
#include "plugins.h"

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...
 

Macros

#define JABBERD2_API   extern
 
#define SX_SUCCESS   (0x00)
 
#define SX_ERR_STREAM   (0x01)
 
#define SX_ERR_AUTH   (0x02)
 
#define SX_ERR_XML_PARSE   (0x03)
 
#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 More...
 
#define stream_err_BAD_FORMAT   (0)
 
#define stream_err_BAD_NAMESPACE_PREFIX   (1)
 
#define stream_err_CONFLICT   (2)
 
#define stream_err_CONNECTION_TIMEOUT   (3)
 
#define stream_err_HOST_GONE   (4)
 
#define stream_err_HOST_UNKNOWN   (5)
 
#define stream_err_IMPROPER_ADDRESSING   (6)
 
#define stream_err_INTERNAL_SERVER_ERROR   (7)
 
#define stream_err_INVALID_FROM   (8)
 
#define stream_err_INVALID_ID   (9)
 
#define stream_err_INVALID_NAMESPACE   (10)
 
#define stream_err_INVALID_XML   (11)
 
#define stream_err_NOT_AUTHORIZED   (12)
 
#define stream_err_POLICY_VIOLATION   (13)
 
#define stream_err_REMOTE_CONNECTION_FAILED   (14)
 
#define stream_err_RESTRICTED_XML   (15)
 
#define stream_err_RESOURCE_CONSTRAINT   (16)
 
#define stream_err_SEE_OTHER_HOST   (17)
 
#define stream_err_SYSTEM_SHUTDOWN   (18)
 
#define stream_err_UNDEFINED_CONDITION   (19)
 
#define stream_err_UNSUPPORTED_ENCODING   (20)
 
#define stream_err_UNSUPPORTED_STANZA_TYPE   (21)
 
#define stream_err_UNSUPPORTED_VERSION   (22)
 
#define stream_err_XML_NOT_WELL_FORMED   (23)
 
#define stream_err_LAST   (24)
 
#define sx_nad_write(s, nad)   sx_nad_write_elem(s, nad, 0)
 
#define ZONE   __FILE__,__LINE__
 debugging macros More...
 
#define _sx_event(s, e, data)   __sx_event(ZONE, s, e, data)
 
#define _sx_debug   if(0) __sx_debug
 
#define _sx_state(s, st)   s->state = st
 

Typedefs

typedef struct _sx_stsx_t
 
typedef struct _sx_env_stsx_env_t
 
typedef struct _sx_plugin_stsx_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_stsx_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)
 if you change these, reflect your changes in the table in error.c More...
 
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 char * _sx_flags (sx_t s)
 show sx flags as string - for logging More...
 
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...
 

Macro Definition Documentation

◆ JABBERD2_API

#define JABBERD2_API   extern

Definition at line 42 of file sx.h.

◆ SX_SUCCESS

#define SX_SUCCESS   (0x00)

Definition at line 93 of file sx.h.

◆ SX_ERR_STREAM

#define SX_ERR_STREAM   (0x01)

◆ SX_ERR_AUTH

#define SX_ERR_AUTH   (0x02)

◆ SX_ERR_XML_PARSE

#define SX_ERR_XML_PARSE   (0x03)

Definition at line 96 of file sx.h.

Referenced by _sx_process_read().

◆ _sx_gen_error

#define _sx_gen_error (   e,
  c,
  g,
 
)    do { e.code = c; e.generic = g; e.specific = s; } while(0);

◆ stream_err_BAD_FORMAT

#define stream_err_BAD_FORMAT   (0)

Definition at line 124 of file sx.h.

Referenced by _sx_client_element_start(), _sx_server_element_start(), and _sx_websocket_rio().

◆ stream_err_BAD_NAMESPACE_PREFIX

#define stream_err_BAD_NAMESPACE_PREFIX   (1)

Definition at line 125 of file sx.h.

◆ stream_err_CONFLICT

#define stream_err_CONFLICT   (2)

Definition at line 126 of file sx.h.

Referenced by c2s_router_sx_callback().

◆ stream_err_CONNECTION_TIMEOUT

#define stream_err_CONNECTION_TIMEOUT   (3)

Definition at line 127 of file sx.h.

Referenced by _s2s_check_conn_routes(), and _s2s_time_checks().

◆ stream_err_HOST_GONE

#define stream_err_HOST_GONE   (4)

Definition at line 128 of file sx.h.

Referenced by _c2s_client_sx_callback(), and _c2s_time_checks().

◆ stream_err_HOST_UNKNOWN

#define stream_err_HOST_UNKNOWN   (5)

Definition at line 129 of file sx.h.

Referenced by _c2s_client_sx_callback(), and _router_sx_callback().

◆ stream_err_IMPROPER_ADDRESSING

#define stream_err_IMPROPER_ADDRESSING   (6)

Definition at line 130 of file sx.h.

◆ stream_err_INTERNAL_SERVER_ERROR

#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().

◆ stream_err_INVALID_FROM

#define stream_err_INVALID_FROM   (8)

Definition at line 132 of file sx.h.

◆ stream_err_INVALID_ID

#define stream_err_INVALID_ID   (9)

Definition at line 133 of file sx.h.

Referenced by _out_result(), and _out_verify().

◆ stream_err_INVALID_NAMESPACE

#define stream_err_INVALID_NAMESPACE   (10)

Definition at line 134 of file sx.h.

Referenced by _router_sx_callback().

◆ stream_err_INVALID_XML

#define stream_err_INVALID_XML   (11)

Definition at line 135 of file sx.h.

Referenced by _sx_compress_rio().

◆ stream_err_NOT_AUTHORIZED

#define stream_err_NOT_AUTHORIZED   (12)

Definition at line 136 of file sx.h.

Referenced by _c2s_client_sx_callback(), and _router_process_handshake().

◆ stream_err_POLICY_VIOLATION

#define stream_err_POLICY_VIOLATION   (13)

Definition at line 137 of file sx.h.

Referenced by _c2s_client_sx_callback(), and _sx_process_read().

◆ stream_err_REMOTE_CONNECTION_FAILED

#define stream_err_REMOTE_CONNECTION_FAILED   (14)

Definition at line 138 of file sx.h.

◆ stream_err_RESTRICTED_XML

#define stream_err_RESTRICTED_XML   (15)

Definition at line 139 of file sx.h.

◆ stream_err_RESOURCE_CONSTRAINT

#define stream_err_RESOURCE_CONSTRAINT   (16)

Definition at line 140 of file sx.h.

◆ stream_err_SEE_OTHER_HOST

#define stream_err_SEE_OTHER_HOST   (17)

Definition at line 141 of file sx.h.

Referenced by _c2s_client_sx_callback().

◆ stream_err_SYSTEM_SHUTDOWN

#define stream_err_SYSTEM_SHUTDOWN   (18)

Definition at line 142 of file sx.h.

Referenced by JABBER_MAIN().

◆ stream_err_UNDEFINED_CONDITION

#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().

◆ stream_err_UNSUPPORTED_ENCODING

#define stream_err_UNSUPPORTED_ENCODING   (20)

Definition at line 144 of file sx.h.

◆ stream_err_UNSUPPORTED_STANZA_TYPE

#define stream_err_UNSUPPORTED_STANZA_TYPE   (21)

Definition at line 145 of file sx.h.

◆ stream_err_UNSUPPORTED_VERSION

#define stream_err_UNSUPPORTED_VERSION   (22)

Definition at line 146 of file sx.h.

Referenced by _sx_server_element_start().

◆ stream_err_XML_NOT_WELL_FORMED

#define stream_err_XML_NOT_WELL_FORMED   (23)

Definition at line 147 of file sx.h.

Referenced by _sx_process_read().

◆ stream_err_LAST

#define stream_err_LAST   (24)

Definition at line 148 of file sx.h.

Referenced by sx_error(), and sx_error_extended().

◆ sx_nad_write

#define sx_nad_write (   s,
  nad 
)    sx_nad_write_elem(s, nad, 0)

◆ ZONE

#define ZONE   __FILE__,__LINE__

debugging macros

Definition at line 388 of file sx.h.

◆ _sx_event

#define _sx_event (   s,
  e,
  data 
)    __sx_event(ZONE, s, e, data)

◆ _sx_debug

#define _sx_debug   if(0) __sx_debug

Definition at line 408 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(), _sx_websocket_http_header_field(), _sx_websocket_http_header_value(), _sx_websocket_http_headers_complete(), _sx_websocket_new(), _sx_websocket_rio(), _sx_websocket_wio(), libwebsock_fragment_buffer(), 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(), sx_ssl_server_addcert(), and sx_websocket_init().

◆ _sx_state

#define _sx_state (   s,
  st 
)    s->state = st

Typedef Documentation

◆ sx_t

typedef struct _sx_st* sx_t

Definition at line 51 of file sx.h.

◆ sx_env_t

typedef struct _sx_env_st* sx_env_t

Definition at line 52 of file sx.h.

◆ sx_plugin_t

typedef struct _sx_plugin_st* sx_plugin_t

Definition at line 53 of file sx.h.

◆ sx_callback_t

typedef int(* sx_callback_t) (sx_t s, sx_event_t e, void *data, void *arg)

event callback

Definition at line 87 of file sx.h.

◆ sx_plugin_init_t

typedef int(* sx_plugin_init_t) (sx_env_t env, sx_plugin_t p, va_list args)

plugin init

Definition at line 90 of file sx.h.

◆ sx_error_t

typedef struct _sx_error_st sx_error_t

error info for event_ERROR

◆ _sx_notify_t

typedef void(* _sx_notify_t) (sx_t s, void *arg)

prototype for the write notify function

Definition at line 109 of file sx.h.

◆ sx_buf_t

typedef struct _sx_buf_st* sx_buf_t

utility: buffer

Definition at line 112 of file sx.h.

◆ _sx_chain_t

typedef struct _sx_chain_st* _sx_chain_t

read/write plugin chain

Definition at line 244 of file sx.h.

Enumeration Type Documentation

◆ sx_event_t

enum sx_event_t

things that can happen

Enumerator
event_WANT_READ 
event_WANT_WRITE 
event_READ 
event_WRITE 
event_STREAM 
event_OPEN 
event_PACKET 
event_CLOSED 
event_ERROR 

Definition at line 56 of file sx.h.

◆ _sx_state_t

connection states

Enumerator
state_NONE 
state_STREAM_RECEIVED 
state_STREAM_SENT 
state_STREAM 
state_OPEN 
state_CLOSING 
state_CLOSED 

Definition at line 69 of file sx.h.

◆ _sx_type_t

enum _sx_type_t

connection types

Enumerator
type_NONE 
type_CLIENT 
type_SERVER 

Definition at line 80 of file sx.h.

Function Documentation

◆ sx_new()

JABBERD2_API sx_t sx_new ( sx_env_t  env,
int  tag,
sx_callback_t  cb,
void *  arg 
)

◆ sx_free()

JABBERD2_API void sx_free ( sx_t  s)

◆ sx_client_init()

JABBERD2_API void sx_client_init ( sx_t  s,
unsigned int  flags,
const char *  ns,
const char *  to,
const char *  from,
const char *  version 
)

◆ sx_server_init()

JABBERD2_API void sx_server_init ( sx_t  s,
unsigned int  flags 
)

◆ sx_can_read()

JABBERD2_API int sx_can_read ( sx_t  s)

◆ sx_can_write()

JABBERD2_API int sx_can_write ( sx_t  s)

◆ sx_nad_write_elem()

JABBERD2_API void sx_nad_write_elem ( sx_t  s,
nad_t  nad,
int  elem 
)

sending a nad

sending a nad

Definition at line 449 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().

◆ sx_raw_write()

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 483 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().

◆ sx_auth()

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().

◆ sx_env_new()

JABBERD2_API sx_env_t sx_env_new ( void  )

Definition at line 23 of file env.c.

Referenced by JABBER_MAIN().

◆ sx_env_free()

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().

◆ sx_env_plugin()

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().

◆ sx_error()

JABBERD2_API void sx_error ( sx_t  s,
int  err,
const char *  text 
)

◆ sx_error_extended()

JABBERD2_API void sx_error_extended ( sx_t  s,
int  err,
const char *  content 
)

Definition at line 140 of file error.c.

References _sx_error_extended(), _sx_event, event_WANT_WRITE, and stream_err_LAST.

Referenced by _c2s_client_sx_callback().

◆ sx_close()

JABBERD2_API void sx_close ( sx_t  s)

◆ sx_kill()

JABBERD2_API void sx_kill ( sx_t  s)

◆ _sx_flags()

JABBERD2_API char* _sx_flags ( sx_t  s)

show sx flags as string - for logging

Definition at line 349 of file sx.c.

References _sx_st::flags, _sx_st::ssf, SX_COMPRESS_WRAPPER, and SX_WEBSOCKET_WRAPPER.

Referenced by _authreg_auth_log(), _c2s_client_sx_callback(), _out_result(), _out_verify(), sx_client_init(), and sx_server_init().

◆ _sx_element_start()

JABBERD2_API void _sx_element_start ( void *  arg,
const char *  name,
const char **  atts 
)

◆ _sx_element_end()

JABBERD2_API void _sx_element_end ( void *  arg,
const char *  name 
)

◆ _sx_cdata()

JABBERD2_API void _sx_cdata ( void *  arg,
const char *  str,
int  len 
)

◆ _sx_namespace_start()

JABBERD2_API void _sx_namespace_start ( void *  arg,
const char *  prefix,
const char *  uri 
)

◆ _sx_process_read()

JABBERD2_API void _sx_process_read ( sx_t  s,
sx_buf_t  buf 
)

◆ _sx_nad_process()

JABBERD2_API void _sx_nad_process ( sx_t  s,
nad_t  nad 
)

main nad processor

◆ _sx_chain_io_plugin()

JABBERD2_API void _sx_chain_io_plugin ( sx_t  s,
sx_plugin_t  p 
)

◆ _sx_chain_nad_plugin()

JABBERD2_API void _sx_chain_nad_plugin ( sx_t  s,
sx_plugin_t  p 
)

◆ _sx_chain_io_write()

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().

◆ _sx_chain_io_read()

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().

◆ _sx_chain_nad_write()

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().

◆ _sx_chain_nad_read()

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().

◆ _sx_buffer_new()

JABBERD2_API sx_buf_t _sx_buffer_new ( const char *  data,
int  len,
_sx_notify_t  notify,
void *  notify_arg 
)

◆ _sx_buffer_free()

JABBERD2_API void _sx_buffer_free ( sx_buf_t  buf)

utility: kill a buffer

Definition at line 244 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().

◆ _sx_buffer_clear()

JABBERD2_API void _sx_buffer_clear ( sx_buf_t  buf)

utility: clear out a buffer, but don't deallocate it

Definition at line 252 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(), _sx_ssl_wio(), and _sx_websocket_rio().

◆ _sx_buffer_alloc_margin()

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 262 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().

◆ _sx_buffer_set()

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 299 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(), _sx_sasl_wio(), _sx_websocket_rio(), and _sx_websocket_wio().

◆ _sx_nad_write()

JABBERD2_API int _sx_nad_write ( sx_t  s,
nad_t  nad,
int  elem 
)

◆ _sx_reset()

JABBERD2_API void _sx_reset ( sx_t  s)

◆ _sx_error()

JABBERD2_API void _sx_error ( sx_t  s,
int  err,
const char *  text 
)

◆ _sx_error_extended()

JABBERD2_API void _sx_error_extended ( sx_t  s,
int  err,
const char *  content 
)

◆ _sx_close()

JABBERD2_API void _sx_close ( sx_t  s)

◆ __sx_debug()

JABBERD2_API void __sx_debug ( const char *  file,
int  line,
const char *  msgfmt,
  ... 
)

helper functions for macros when we're debugging

helper functions for macros when we're debugging

Definition at line 317 of file sx.c.

References MAX_DEBUG.

◆ __sx_event()

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 336 of file sx.c.

References _sx_debug, _sx_st::cb, _sx_st::cb_arg, _sx_st::reentry, and _sx_st::tag.