|
jabberd14 1.6.2
|
Go to the source code of this file.
Data Structures | |
| struct | dpacket_struct |
| struct | handel_struct |
| struct | register_notifier_struct |
| struct | instance_struct |
| struct | xdbcache_struct |
| struct | mtqueue_struct |
| struct | mth_struct |
| struct | mio_wb_q_st |
| struct | mio_st |
| struct | mio_main_st |
| structure that holds the global mio data More... | |
| struct | mio_handlers_st |
| class | xmppd::logmessage |
| class | xmppd::logging |
| class | xmppd::instance_base |
Namespaces | |
| namespace | xmppd |
Defines | |
| #define | LOGT_LEGACY 1 |
| #define | LOGT_DELIVER 2 |
| #define | LOGT_REGISTER 4 |
| #define | LOGT_STATUS 8 |
| #define | LOGT_EVENT 16 |
| #define | LOGT_CONFIG 32 |
| #define | LOGT_DYNAMIC 64 |
| #define | LOGT_IO 128 |
| #define | LOGT_INIT 256 |
| #define | LOGT_EXECFLOW 512 |
| #define | LOGT_CLEANUP 1024 |
| #define | LOGT_STRANGE 2048 |
| #define | LOGT_XML 4096 |
| #define | LOGT_THREAD 8192 |
| #define | LOGT_STORAGE 16384 |
| #define | LOGT_AUTH 32768 |
| #define | LOGT_SESSION 65536 |
| #define | LOGT_ROSTER 131072 |
| #define | LOGT_BYTES 262144 |
| #define | MAX_LOG_SIZE 1024 |
| #define | log_debug if(debug_flag&1) debug_log |
| #define | log_debug2 if(debug_flag) debug_log2 |
| #define | log_error log_alert |
| #define | SERROR_NAMESPACE "<stream:error><invalid-namespace xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xmlns='urn:ietf:params:xml:ns:xmpp-streams' xml:lang='en'>Invalid namespace specified.</text></stream:error>" |
| #define | SERROR_INVALIDHOST "<stream:error><invalid-from xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xmlns='urn:ietf:params:xml:ns:xmpp-streams' xml:lang='en'>Invalid hostname used.</text></stream:error>" |
| #define | MTQ_THREADS 10 |
| #define | MIO_RAW_READ (mio_read_func)&_mio_raw_read |
| #define | MIO_RAW_WRITE (mio_write_func)&_mio_raw_write |
| #define | MIO_RAW_ACCEPTED (mio_accepted_func)NULL |
| #define | MIO_RAW_PARSER (mio_parser_func)&_mio_raw_parser |
| #define | MIO_XML_PARSER (mio_parser_func)&_mio_xml_parser |
| #define | MIO_LISTEN_RAW mio_handlers_new(NULL, NULL, NULL) |
| #define | MIO_CONNECT_RAW mio_handlers_new(NULL, NULL, NULL) |
| #define | MIO_LISTEN_XML mio_handlers_new(NULL, NULL, MIO_XML_PARSER) |
| #define | MIO_CONNECT_XML mio_handlers_new(NULL, NULL, MIO_XML_PARSER) |
| #define | MIO_SSL_READ _mio_ssl_read |
| #define | MIO_SSL_WRITE _mio_ssl_write |
| #define | MIO_SSL_ACCEPTED _mio_ssl_accepted |
| #define | MIO_NEW 0 |
| #define | MIO_BUFFER 1 |
| #define | MIO_XML_ROOT 2 |
| #define | MIO_XML_NODE 3 |
| #define | MIO_CLOSED 4 |
| #define | MIO_ERROR 5 |
| #define | mio_pool(m) (m->p) |
| #define | mio_ip(m) (m ? m->peer_ip : NULL) |
| #define | mio_connect_errmsg(m) (m->connect_errmsg) |
| #define | HTTP_BOUNCE_URI "http://jabberd.org/get-bounce" |
Typedefs | |
| typedef struct instance_struct * | instance |
| typedef struct instance_struct | _instance |
| typedef struct dpacket_struct * | dpacket |
| typedef struct dpacket_struct | _dpacket |
| typedef result(* | phandler )(instance id, dpacket p, void *arg) |
| typedef struct handel_struct * | handel |
| typedef struct handel_struct | _handel |
| typedef void(* | register_notify )(instance i, const char *destination, int is_register, void *arg) |
| typedef struct register_notifier_struct * | register_notifier |
| typedef struct register_notifier_struct | _register_notifier |
| typedef result(* | cfhandler )(instance id, xmlnode x, void *arg) |
| typedef result(* | beathandler )(void *arg) |
| typedef void(* | shutdown_func )(void *arg) |
| typedef struct xdbcache_struct * | xdbcache |
| typedef struct xdbcache_struct | _xdbcache |
| typedef void(* | mtq_callback )(void *arg) |
| typedef struct mtqueue_struct * | mtq |
| typedef struct mtqueue_struct | _mtq |
| typedef struct mth_struct * | mth |
| typedef struct mth_struct | _mth |
| typedef struct mio_wb_q_st | _mio_wbq |
| typedef struct mio_wb_q_st * | mio_wbq |
| typedef void(* | mio_std_cb )(mio_st *m, int state, void *arg, xmlnode x, char *buffer, int bufsz) |
| typedef struct mio_st * | mio |
| typedef struct mio_st | _mio |
| typedef struct mio_main_st | _ios |
| structure that holds the global mio data | |
| typedef struct mio_main_st * | ios |
| typedef ssize_t(* | mio_read_func )(mio m, void *buf, size_t count) |
| typedef ssize_t(* | mio_write_func )(mio m, void const *buf, size_t count) |
| typedef void(* | mio_parser_func )(mio m, void const *buf, size_t bufsz) |
| typedef int(* | mio_accepted_func )(mio m) |
| typedef int(* | mio_handshake_func )(mio m) |
| typedef void(* | mio_close_func )(mio m, bool close_read) |
| typedef struct mio_handlers_st | _mio_handlers |
| typedef struct mio_handlers_st * | mio_handlers |
Enumerations | |
| enum | ptype { p_NONE, p_NORM, p_XDB, p_LOG, p_ROUTE } |
| enum | order { o_PRECOND, o_COND, o_PREDELIVER, o_DELIVER } |
| enum | result { r_UNREG, r_NONE, r_PASS, r_LAST, r_ERR, r_DONE } |
| enum | mio_queue_type { queue_XMLNODE, queue_CDATA } |
| enum | mio_state { state_ACTIVE, state_CLOSE } |
| enum | mio_type { type_LISTEN, type_NORMAL, type_NUL, type_HTTP } |
| enum | xmppd::loglevel { xmppd::notice, xmppd::warn, xmppd::error, xmppd::alert } |
Functions | |
| void | register_config (pool p, char const *node, cfhandler f, void *arg) |
| void | register_beat (int freq, beathandler f, void *arg) |
| void | register_shutdown (shutdown_func f, void *arg) |
| void | register_instance (instance i, char const *host) |
| void | unregister_instance (instance i, char const *host) |
| void | register_routing_update_callback (instance i, register_notify f, void *arg) |
| void | register_phandler (instance id, order o, phandler f, void *arg) |
| dpacket | dpacket_new (xmlnode x) |
| dpacket | dpacket_copy (dpacket p) |
| void | deliver (dpacket p, instance i) |
| void | deliver_fail (dpacket p, const char *err) |
| bool | deliver_is_delivered_to (Glib::ustring const &host, _instance const *i) |
| bool | deliver_is_uplink (instance i) |
| std::set< Glib::ustring > | deliver_routed_hosts (ptype type, instance i) |
| void | deliver_config_filter (xmlnode greymatter) |
| int | log_get_facility (char const *facility) |
| int | log_get_level (char const *level) |
| int | get_debug_flag (void) |
| void | set_debug_flag (int v) |
| void | set_cmdline_debug_flag (int v) |
| void | set_debug_facility (int facility) |
| void | debug_log (char const *zone, char const *msgfmt,...) |
| void | debug_log2 (char const *zone, int type, char const *msgfmt,...) |
| void | log_notice (char const *host, char const *msgfmt,...) |
| void | log_warn (char const *host, char const *msgfmt,...) |
| void | log_alert (char const *host, char const *msgfmt,...) |
| void | logger (char const *type, char const *host, char const *message) |
| void | log_record (char const *id, char const *type, char const *action, char const *msgfmt,...) |
| void | log_generic (char const *logtype, char const *id, char const *type, char const *action, char const *msgfmt,...) |
| xdbcache | xdb_cache (instance i) |
| xmlnode | xdb_get (xdbcache xc, jid owner, const char *ns) |
| int | xdb_act (xdbcache xc, jid owner, const char *ns, char *act, char const *match, xmlnode data) |
| int | xdb_act_path (xdbcache xc, jid owner, const char *ns, char const *act, char const *matchpath, xht namespaces, xmlnode data) |
| int | xdb_set (xdbcache xc, jid owner, const char *ns, xmlnode data) |
| mtq | mtq_new (pool p) |
| void | mtq_send (mtq q, pool p, mtq_callback f, void *arg) |
| ssize_t | _mio_raw_read (mio m, void *buf, size_t count) |
| ssize_t | _mio_raw_write (mio m, void *buf, size_t count) |
| void | _mio_raw_parser (mio m, const void *buf, size_t bufsz) |
| void | mio_xml_reset (mio m) |
| int | mio_xml_starttls (mio m, int originator, const char *identity) |
| void | _mio_xml_parser (mio m, const void *buf, size_t bufsz) |
| void | mio_ssl_init (xmlnode x) |
| bool | mio_tls_early_init () |
| int | mio_ssl_starttls (mio m, int originator, const char *identity) |
| int | mio_ssl_starttls_possible (mio m, const char *identity) |
| int | mio_ssl_verify (mio m, const char *id_on_xmppAddr) |
| ssize_t | _mio_ssl_read (mio m, void *buf, size_t count) |
| ssize_t | _mio_ssl_write (mio m, const void *buf, size_t count) |
| int | _mio_ssl_accepted (mio m) |
| void | mio_tls_get_characteristics (mio m, char *buffer, size_t len) |
| void | mio_tls_get_certtype (mio m, char *buffer, size_t len) |
| void | mio_tls_get_compression (mio m, char *buffer, size_t len) |
| int | mio_is_encrypted (mio m) |
| mio_handlers | mio_handlers_new (mio_read_func rf, mio_write_func wf, mio_parser_func pf) |
| void | mio_handlers_free (mio_handlers mh) |
| void | mio_set_handlers (mio m, mio_handlers mh) |
| void | mio_init (void) |
| void | mio_stop (void) |
| mio | mio_new (int fd, mio_std_cb cb, void *cb_arg, mio_handlers mh) |
| void | mio_reset (mio m, mio_std_cb cb, void *arg) |
| void | mio_close (mio m) |
| void | mio_write (mio m, xmlnode stanza, char const *buffer, int len) |
| void | mio_write_root (mio m, xmlnode root, int stream_type) |
| void | mio_karma (mio m, int val, int max, int inc, int dec, int penalty, int restore) |
| void | mio_karma2 (mio m, struct karma *k) |
| void | mio_rate (mio m, int rate_time, int max_points) |
| xmlnode | mio_cleanup (mio m) |
| void | mio_connect (char *host, int port, mio_std_cb cb, void *cb_arg, int timeout, mio_handlers mh) |
| mio | mio_listen (int port, char const *sourceip, mio_std_cb cb, void *cb_arg, mio_handlers mh) |
| int | _mio_write_dump (mio m) |
| int | acl_check_access (xdbcache xdb, const char *function, const jid user) |
| jid | acl_get_users (xdbcache xdb, const char *function) |
Variables | |
| int | debug_flag |
| #define HTTP_BOUNCE_URI "http://jabberd.org/get-bounce" |
Referenced by _mio_xml_parser().
| #define log_debug if(debug_flag&1) debug_log |
Referenced by js_session_from(), and js_session_to().
| #define log_debug2 if(debug_flag) debug_log2 |
Referenced by _dialback_beat_idle(), _dialback_beat_in_idle(), _dialback_beat_out_idle(), _dialback_miod_hash_cleanup(), _js_authreg_auth(), _js_authreg_register(), _js_hosts_del(), _js_session_end(), _js_session_from(), _js_session_to(), _js_users_del(), _jsm_shutdown(), _mio_ssl_cleanup(), _mio_ssl_read(), _mio_ssl_write(), _mio_tls_cont_handshake_server(), _mio_write_dump(), _mio_xml_parser(), _xdb_file_purge(), _xdb_get_hashes(), acl_check_access(), base_accept(), base_connect(), base_dir(), base_file(), base_format(), base_importspool(), base_load(), base_stderr(), base_stdout(), base_syslog(), base_syslog_config(), base_to(), base_unsubscribe(), xmppd::proxy65::connected_sockets::connected_sockets(), deliver(), deliver_config_filter(), deliver_fail(), dialback(), dialback_beat_idle(), dialback_check_settings(), dialback_in_read(), dialback_in_read_db(), dialback_in_verify(), dialback_ip_get(), dialback_ip_set(), dialback_merlin(), dialback_miod_hash(), dialback_out_connect(), dialback_out_connection(), dialback_out_packet(), dialback_out_read(), dialback_out_read_db(), dnsrv(), dnsrv_child_main(), dnsrv_child_process_xstream_io(), dnsrv_lookup(), dnsrv_process_io(), dnsrv_process_xstream_io(), dnsrv_resend(), js_bounce_xmpp(), js_config(), js_deliver(), js_mapi_call2(), js_mapi_register(), js_mapi_session(), js_offline_main(), js_packet(), js_psend(), js_sc_session_new(), js_server_main(), js_session_end(), js_session_new(), js_user(), js_users_gc(), jsm(), jsm_shutdown(), log_generic(), logger(), main(), mio_close(), mio_listen(), mio_new(), mio_ssl_init(), mio_ssl_starttls(), mio_stop(), mio_write(), mio_xml_starttls(), mod_agents(), mod_auth_crypt(), mod_auth_digest(), mod_auth_plain(), mod_last(), mod_log(), mod_offline(), mod_presence(), mod_privacy(), mod_register(), mod_useridpolicy(), mtq_new(), mtq_send(), pthsock_client(), register_instance(), register_routing_update_callback(), xmppd::proxy65::socks5stub::socks5stub(), srv_lookup(), unregister_instance(), xdb_convert_spool(), xdb_file(), xdb_file_load(), xdb_file_phandler(), xdb_file_purge(), xdb_get(), and xdb_sql().
| #define log_error log_alert |
| #define LOGT_AUTH 32768 |
| #define LOGT_BYTES 262144 |
Referenced by _mio_write_dump().
| #define LOGT_CLEANUP 1024 |
Referenced by _dialback_miod_hash_cleanup(), _jsm_shutdown(), dnsrv_child_main(), jsm_shutdown(), and mio_stop().
| #define LOGT_CONFIG 32 |
Referenced by base_syslog_config(), deliver(), dnsrv(), js_config(), and main().
| #define LOGT_DELIVER 2 |
| #define LOGT_DYNAMIC 64 |
Referenced by base_load().
| #define LOGT_EVENT 16 |
Referenced by main().
| #define LOGT_EXECFLOW 512 |
| #define LOGT_INIT 256 |
Referenced by base_accept(), base_connect(), base_dir(), base_file(), base_format(), base_importspool(), base_stderr(), base_stdout(), base_syslog(), base_syslog_config(), base_to(), base_unsubscribe(), dialback(), dnsrv(), dnsrv_child_main(), dnsrv_process_io(), js_mapi_register(), js_mapi_session(), jsm(), mod_agents(), mod_auth_crypt(), mod_auth_digest(), mod_auth_plain(), mod_last(), mod_log(), mod_offline(), mod_presence(), mod_privacy(), mod_register(), mod_useridpolicy(), pthsock_client(), xdb_file(), and xdb_sql().
| #define LOGT_IO 128 |
Referenced by _dialback_beat_idle(), _dialback_beat_in_idle(), _dialback_beat_out_idle(), _mio_ssl_cleanup(), _mio_ssl_read(), _mio_ssl_write(), _mio_tls_cont_handshake_server(), _mio_write_dump(), _mio_xml_parser(), xmppd::proxy65::connected_sockets::connected_sockets(), dialback_check_settings(), dialback_in_read(), dialback_in_read_db(), dialback_ip_get(), dialback_ip_set(), dialback_out_connect(), dialback_out_connection(), dialback_out_packet(), dialback_out_read(), dialback_out_read_db(), dnsrv_child_main(), dnsrv_child_process_xstream_io(), dnsrv_lookup(), dnsrv_process_io(), dnsrv_process_xstream_io(), dnsrv_resend(), mio_listen(), mio_ssl_init(), mio_ssl_starttls(), mio_write(), mio_xml_starttls(), and srv_lookup().
| #define LOGT_LEGACY 1 |
| #define LOGT_REGISTER 4 |
Referenced by register_instance(), and unregister_instance().
| #define LOGT_ROSTER 131072 |
| #define LOGT_SESSION 65536 |
Referenced by _js_hosts_del(), _js_session_end(), _js_users_del(), js_sc_session_new(), js_session_end(), js_session_new(), and js_user().
| #define LOGT_STATUS 8 |
Referenced by js_users_gc(), and main().
| #define LOGT_STORAGE 16384 |
Referenced by _xdb_file_purge(), _xdb_get_hashes(), xdb_convert_spool(), xdb_file_load(), xdb_file_phandler(), xdb_file_purge(), and xdb_get().
| #define LOGT_STRANGE 2048 |
Referenced by dnsrv_child_main(), dnsrv_process_io(), and mio_write().
| #define LOGT_THREAD 8192 |
Referenced by mtq_new(), mtq_send(), and xdb_get().
| #define LOGT_XML 4096 |
Referenced by _mio_xml_parser().
| #define MAX_LOG_SIZE 1024 |
Referenced by debug_log(), debug_log2(), and deliver_fail().
| #define MIO_BUFFER 1 |
Referenced by _mio_raw_parser().
| #define MIO_CLOSED 4 |
Referenced by dialback_out_read().
| #define mio_connect_errmsg | ( | m | ) | (m->connect_errmsg) |
Referenced by dialback_out_read().
| #define MIO_CONNECT_RAW mio_handlers_new(NULL, NULL, NULL) |
| #define MIO_CONNECT_XML mio_handlers_new(NULL, NULL, MIO_XML_PARSER) |
Referenced by dialback_out_connect().
| #define MIO_ERROR 5 |
Referenced by _mio_write_dump(), and _mio_xml_parser().
| #define mio_ip | ( | m | ) | (m ? m->peer_ip : NULL) |
| #define MIO_LISTEN_RAW mio_handlers_new(NULL, NULL, NULL) |
Referenced by xmppd::proxy65::proxy65::proxy65().
| #define MIO_LISTEN_XML mio_handlers_new(NULL, NULL, MIO_XML_PARSER) |
Referenced by dialback(), and pthsock_client().
| #define MIO_NEW 0 |
Referenced by dialback_out_read().
| #define mio_pool | ( | m | ) | (m->p) |
| #define MIO_RAW_ACCEPTED (mio_accepted_func)NULL |
| #define MIO_RAW_PARSER (mio_parser_func)&_mio_raw_parser |
Referenced by mio_handlers_new().
| #define MIO_RAW_READ (mio_read_func)&_mio_raw_read |
Referenced by mio_handlers_new().
| #define MIO_RAW_WRITE (mio_write_func)&_mio_raw_write |
Referenced by mio_handlers_new().
| #define MIO_SSL_ACCEPTED _mio_ssl_accepted |
Referenced by pthsock_client().
| #define MIO_SSL_READ _mio_ssl_read |
Referenced by mio_ssl_starttls(), and pthsock_client().
| #define MIO_SSL_WRITE _mio_ssl_write |
Referenced by mio_ssl_starttls(), and pthsock_client().
| #define MIO_XML_NODE 3 |
Referenced by dialback_in_read_db(), dialback_out_read(), and dialback_out_read_db().
| #define MIO_XML_PARSER (mio_parser_func)&_mio_xml_parser |
Referenced by pthsock_client().
| #define MIO_XML_ROOT 2 |
Referenced by dialback_in_read(), and dialback_out_read().
| #define MTQ_THREADS 10 |
Referenced by mtq_send().
| #define SERROR_INVALIDHOST "<stream:error><invalid-from xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xmlns='urn:ietf:params:xml:ns:xmpp-streams' xml:lang='en'>Invalid hostname used.</text></stream:error>" |
| #define SERROR_NAMESPACE "<stream:error><invalid-namespace xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xmlns='urn:ietf:params:xml:ns:xmpp-streams' xml:lang='en'>Invalid namespace specified.</text></stream:error>" |
| typedef struct dpacket_struct _dpacket |
| typedef struct handel_struct _handel |
| typedef struct instance_struct _instance |
| typedef struct mio_main_st _ios |
structure that holds the global mio data
MIO internal use only
| typedef struct mio_handlers_st _mio_handlers |
The MIO handlers data type
| typedef struct mio_wb_q_st _mio_wbq |
| typedef struct mth_struct _mth |
| typedef struct mtqueue_struct _mtq |
| typedef struct register_notifier_struct _register_notifier |
| typedef struct xdbcache_struct _xdbcache |
| typedef result(* beathandler)(void *arg) |
Heartbeat function callback definition
Config file handler function callback definition
| typedef struct dpacket_struct * dpacket |
Packet wrapper, d as in delivery or daemon, whichever pleases you
| typedef struct handel_struct * handel |
Delivery handler list. See register_phandler().
| typedef struct instance_struct* instance |
| typedef struct mio_main_st* ios |
| typedef int(* mio_accepted_func)(mio m) |
| typedef void(* mio_close_func)(mio m, bool close_read) |
| typedef struct mio_handlers_st * mio_handlers |
| typedef int(* mio_handshake_func)(mio m) |
| typedef void(* mio_parser_func)(mio m, void const *buf, size_t bufsz) |
| typedef ssize_t(* mio_read_func)(mio m, void *buf, size_t count) |
| typedef void(* mio_std_cb)(mio_st *m, int state, void *arg, xmlnode x, char *buffer, int bufsz) |
| typedef struct mio_wb_q_st* mio_wbq |
| typedef ssize_t(* mio_write_func)(mio m, void const *buf, size_t count) |
| typedef struct mth_struct * mth |
Managed thread queue. Has the message port for the running thread, and the current queue it's processing.
| typedef struct mtqueue_struct * mtq |
Managed thread queue. Has a pointer to the currently assigned thread for this queue.
| typedef void(* mtq_callback)(void *arg) |
mtq callback simple function definition
Delivery handler function callback definition
| typedef struct register_notifier_struct * register_notifier |
List of functions, that get notified of registering/unregistering hosts
| typedef void(* register_notify)(instance i, const char *destination, int is_register, void *arg) |
Callback function that gets notified of registering/unregistering hosts for an instance
| typedef void(* shutdown_func)(void *arg) |
| typedef struct xdbcache_struct * xdbcache |
Ring for handling cached structures
| enum mio_queue_type |
| enum mio_state |
| enum mio_type |
| enum order |
the stages of packet delivery - the order in which packet handlers gets called.
Delivery starts with o_PRECOND handlers, then o_COND handlers, then o_PREDELIVER handlers, and o_DELIVER handlers last
| o_PRECOND |
o_PRECOND handlers always get called first - used by xdb.cc to filter out xdb results |
| o_COND |
currently not used by jabberd14 |
| o_PREDELIVER |
handlers that should get called before o_DELIVER handlers - used by base_format.cc to reformat messages |
| o_DELIVER |
normal deliveries |
| enum ptype |
| enum result |
Result types, unregister me, I pass, I should be last, I suck, I rock
In case of r_DONE or r_LAST the passed data is consumed (i.e. freed), if of the other values is returned, the data has not been consumed and the caller must free it if necessary.
| void _mio_raw_parser | ( | mio | m, |
| const void * | buf, | ||
| size_t | bufsz | ||
| ) |
receiving bytes on a network socket
the _mio_raw_parser implements a mio parser, that does not parse the received data at all, but just passes the received data as bytes to the application callback function, that registered for this mio object
| m | the mio object where the data has been read |
| buf | the data that has been read |
| bufsz | the number of bytes, that have been read on the socket |
References mio_st::cb, mio_st::cb_arg, and MIO_BUFFER.
| ssize_t _mio_raw_read | ( | mio | m, |
| void * | buf, | ||
| size_t | count | ||
| ) |
read data from a network socket, that does not use TLS encryption
m->flags.recall_read_when_writeable is cleared, m->flags.recall_read_when_readable is updated by this function
| m | the mio representing this socket |
| buf | the buffer where to read data to |
| count | size of the buffer, how many data should be read at most |
References mio_st::fd.
| ssize_t _mio_raw_write | ( | mio | m, |
| void * | buf, | ||
| size_t | count | ||
| ) |
write data to a network socket, that does not use TLS encryption
m->flags.recall_write_when_readable is clared, m->flags.recall_write_when_writeable is updated by this function
| m | the mio representing this socket |
| buf | the data that should be written |
| count | how many bytes should be written (at most) |
References mio_st::fd.
| int _mio_ssl_accepted | ( | mio | m | ) |
accepted a new incoming connection, where we have to start the TLS layer without a STARTTLS command, e.g. on port 5223
| m | the mio of the listening socket |
References mio_ssl_starttls(), and mio_st::our_ip.
| ssize_t _mio_ssl_read | ( | mio | m, |
| void * | buf, | ||
| size_t | count | ||
| ) |
read data from a socket, that is TLS protected
The m->flags.recall_read_when_readable and m->flags.recall_read_when_writeable is updated by this function.
| m | the mio where data might be available |
| buf | where to write the written data to |
| count | how many bytes should be read at most |
References mio_st::fd, mio_st::flags, log_debug2, log_notice(), LOGT_IO, mio_st::recall_read_when_readable, mio_st::recall_read_when_writeable, mio_st::ssl, and ZONE.
| ssize_t _mio_ssl_write | ( | mio | m, |
| const void * | buf, | ||
| size_t | count | ||
| ) |
write data to a socket, that is TLS protected
The m->flags.recall_write_when_readable and m->flags.recall_write_when_writeable is updated by this function.
| m | the mio where writing is possible |
| buf | data that should be written |
| count | how many bytes should be written at most |
References mio_st::fd, mio_st::flags, log_debug2, log_notice(), LOGT_IO, mio_st::recall_write_when_readable, mio_st::recall_write_when_writeable, mio_st::ssl, and ZONE.
| int _mio_write_dump | ( | mio | m | ) |
Dump this socket's write queue.
Tries to write * as much of the write queue as it can, before the write call would block the server
| m | the connection that should get it's write queue dumped |
References mio_st::cb, mio_st::cb_arg, mio_wb_q_st::cur, mio_st::fd, mio_wb_q_st::len, log_debug2, LOGT_BYTES, LOGT_IO, mio_st::mh, MIO_ERROR, mio_wb_q_st::next, mio_wb_q_st::p, pool_free(), mio_st::queue, mio_st::tail, mio_handlers_st::write, and ZONE.
Referenced by mio_xml_starttls().
| void _mio_xml_parser | ( | mio | m, |
| const void * | vbuf, | ||
| size_t | bufsz | ||
| ) |
receiving an XML document on a network socket
This parser implements an XML parser reading on a network socket. Stanzas (second level XML document elements) are passed to the application callback function, that registered with this mio object
| m | the mio where data has been read |
| vbuf | the buffer containing the read data |
| bufsz | the number of bytes, that have been read |
References _mio_xstream_cleanup(), _mio_xstream_init(), mio_main_st::bounce_uri, mio_st::cb, mio_st::cb_arg, mio_st::flags, mio_main_st::flash_policy, HTTP_BOUNCE_URI, log_debug2, log_error, log_notice(), log_warn(), LOGT_IO, LOGT_XML, mio_close(), MIO_ERROR, mio_write(), mio_st::parser, mio_st::reset_stream, mio_st::root, mio_st::type, type_HTTP, type_NORMAL, type_NUL, mio_main_st::webserver_path, and ZONE.
check if a user has access to a given functionality
| xdb | instance of an xdbcache used to check the access |
| function | functionality for which access should be checked |
| user | user for which access should be checked |
References acl_get_users(), xmppd::jabberid_pool::get_pool(), jid_cmpx(), jid_full(), JID_SERVER, JID_USER, log_debug2, LOGT_AUTH, xmppd::jabberid_pool::next, pool_free(), and ZONE.
Referenced by js_trust().
get the list of users, that have access to a given functionality
| xdb | instance of an xdbcache used to check the access |
| function | functionality for which access should be checked |
References j_strcmp(), jid_append(), jid_new(), NS_JABBERD_ACL, NS_JABBERD_CONFIGFILE, pool_new, xhash_new(), xhash_put(), xmlnode_get_attrib_ns(), xmlnode_get_data(), and xmlnode_get_tags().
Referenced by acl_check_access().
| void debug_log | ( | char const * | zone, |
| char const * | msgfmt, | ||
| ... | |||
| ) |
Generate a debug log message
This generates a debugging message. The function should not be called directly. Instead the macro log_debug should be called, which first checks if debugging is enabled.
Do not use this function or log_debug at all. Better use log_debug2.
| zone | the zone (file) the function is called from. __ZONE__ should be used here. |
| msgfmt | the format string for the log message, parameters like for printf() are given afterwards |
References _debug_facility, and MAX_LOG_SIZE.
| void debug_log2 | ( | char const * | zone, |
| int | type, | ||
| char const * | msgfmt, | ||
| ... | |||
| ) |
Generate a debug log message
This generates a debugging message. The function should not be called directly. Instead the macro log_debug2 should be called, which first checks if debugging is enabled.
| zone | the zone (file) the function is called from. __ZONE__ should be used here. |
| type | LOGT_* constent telling which type of debug log message is passed |
| msgfmt | the format string for the log message, parameters like for printf() are given afterwards |
References _debug_facility, get_debug_flag(), and MAX_LOG_SIZE.
deliver a dpacket to an instance using the configured XML routings
| p | the packet that should be delivered (packet gets consumed) |
| i | unused/ignored (was: the instance of the sender (!) of the packet) |
References deliver(), deliver__flag, deliver__mp, filter_expressions, filter_namespaces, dpacket_struct::from_jid, xmppd::jabberid::get_domain(), xmppd::jabberid::get_node(), xmppd::jabberid::has_node(), dpacket_struct::host, jid_full(), jid_new(), log_debug2, log_notice(), LOGT_CONFIG, LOGT_DELIVER, NS_JABBERD_CONFIGFILE, NS_JABBERD_CONFIGFILE_ROUTER, dpacket_struct::p, deliver_mp_st::p, p_LOG, p_NORM, p_XDB, pmalloco(), pool_free(), pool_new, dpacket_struct::to_jid, dpacket_struct::type, dpacket_struct::x, xhash_free(), xhash_new(), xhash_put(), xhash_walk(), xmlnode_get_attrib_ns(), xmlnode_get_data(), xmlnode_get_tags(), xmlnode_pool(), xmlnode_serialize_string(), and ZONE.
Referenced by _js_routed_auth_packet(), _js_routed_session_control_packet(), _js_routed_session_packet(), deliver(), deliver_fail(), dialback_in_read_db(), dialback_miod_read(), dnsrv_resend(), js_authreg(), js_deliver(), js_session_route(), log_generic(), logger(), main(), and xdb_file_phandler().
| void deliver_config_filter | ( | xmlnode | greymatter | ) |
initializes or updates the dump filters of the router
| greymatter | the parsed configuration file |
References filter_expressions, filter_namespaces, log_debug2, LOGT_DELIVER, NS_JABBERD_CONFIGFILE, xmlnode_t::p, pool_free(), pool_new, pstrdup(), xhash_free(), xhash_new(), xhash_put(), xmlnode_get_attrib_ns(), xmlnode_get_data(), xmlnode_get_tags(), and ZONE.
Referenced by configurate().
| void deliver_fail | ( | dpacket | p, |
| const char * | err | ||
| ) |
bounce on the delivery, use the result to better gague what went wrong
References deliver(), dpacket_new(), dpacket_struct::host, j_strcmp(), jutil_error_xmpp(), jutil_tofrom(), log_debug2, log_notice(), log_warn(), LOGT_DELIVER, MAX_LOG_SIZE, messages_get(), xterror_struct::msg, NS_JABBERD_ERRMSG, NS_SESSION, dpacket_struct::p, p_LOG, p_NORM, p_ROUTE, p_XDB, pool_free(), dpacket_struct::type, dpacket_struct::x, xmlnode_get_attrib_ns(), xmlnode_get_firstchild(), xmlnode_get_lang(), xmlnode_get_namespace(), xmlnode_hide(), xmlnode_insert_tag_ns(), xmlnode_put_attrib_ns(), xmlnode_serialize_string(), XTERROR_EXTERNAL, and ZONE.
Referenced by _dialback_out_beat_packets(), _dnsrv_beat_packets(), _js_routed_packet(), dialback_out_connection_cleanup(), and dnsrv_lookup().
| bool deliver_is_delivered_to | ( | Glib::ustring const & | host, |
| _instance const * | i | ||
| ) |
util to check and see which instance this hostname is going to get mapped to for normal packets
| host | the hostname to get checked |
References ilist_struct::i, and ilist_struct::next.
| bool deliver_is_uplink | ( | instance | i | ) |
checks if an instance is configured to be the uplink
| i | the instance to check |
References deliver__uplink.
get list of hosts with explicit routing
| type | the type to get the routing for |
| i | the instance to exclude from the result (NULL for not excluding any instance) |
References deliver_routed_hosts_walk_args::i, deliver_routed_hosts_walk_args::result, and xhash_walk().
create a clone of a deliverable packet
References dpacket_new(), dpacket_struct::x, and xmlnode_dup().
create a new deliverable packet out of an xmlnode
| x | the xmlnode to generate the deliverable packet for |
References dpacket_struct::from_jid, xmppd::jabberid::get_domain(), dpacket_struct::host, dpacket_struct::id, jid_new(), log_warn(), dpacket_struct::p, p_LOG, p_NONE, p_NORM, p_ROUTE, p_XDB, pmalloco(), pstrdup(), dpacket_struct::to_jid, dpacket_struct::type, dpacket_struct::x, xmlnode_free(), xmlnode_get_attrib_ns(), xmlnode_get_localname(), xmlnode_pool(), and xmlnode_serialize_string().
Referenced by _dialback_out_beat_packets(), _js_routed_auth_packet(), _js_routed_packet(), _js_routed_session_control_packet(), _js_routed_session_packet(), xmppd::instance_base::deliver(), deliver_fail(), dialback_in_read_db(), dialback_miod_read(), dialback_out_connection_cleanup(), dnsrv_resend(), dpacket_copy(), js_authreg(), js_deliver(), js_session_route(), log_generic(), logger(), and xdb_file_phandler().
| int get_debug_flag | ( | void | ) | [inline] |
| void log_alert | ( | char const * | host, |
| char const * | msgfmt, | ||
| ... | |||
| ) |
generate a log message of type "alert"
| host | the sending host (domain) of the log message - NULL if the host is not known, in that case the message is logged as jabberd internal |
| msgfmt | the format string for the message, parameters are passed afterwards like for the printf() function |
References logger().
Referenced by dialback_out_read(), main(), and mio_listen().
| void log_generic | ( | char const * | logtype, |
| char const * | id, | ||
| char const * | type, | ||
| char const * | action, | ||
| char const * | msgfmt, | ||
| ... | |||
| ) |
writing log messages of arbitrary logging type
| logtype | logging type (e.g. "record") |
| id | to which id is the message related |
| type | type of the log message (e.g. "session") |
| action | action that is logged (e.g. a failed auth) |
| msgfmt | printf()-like format string, parameters are following |
References deliver(), dpacket_new(), j_strlen(), log_debug2, LOGT_DELIVER, NS_SERVER, xmlnode_insert_cdata(), xmlnode_new_tag_ns(), xmlnode_put_attrib_ns(), xmlnode_serialize_string(), and ZONE.
Referenced by log_record().
| int log_get_facility | ( | char const * | facility | ) |
get the facility value for a syslog facility
| facility | as a string |
References j_strcmp().
| int log_get_level | ( | char const * | level | ) |
get the level value for a syslog level
| level | as a string |
References j_strcmp().
| void log_notice | ( | char const * | host, |
| char const * | msgfmt, | ||
| ... | |||
| ) |
generate a log message of type "notice"
| host | the sending host (domain) of the log message - NULL if the host is not known, in that case the message is logged as jabberd internal |
| msgfmt | the format string for the message, parameters are passed afterwards like for the printf() function |
References logger().
Referenced by _dnsrv_beat_packets(), _js_routed_error_packet(), _js_routed_packet(), _mio_ssl_read(), _mio_ssl_write(), _mio_xml_parser(), _xdb_convert_hostspool(), deliver(), deliver_fail(), dialback_check_settings(), dialback_in_read_db(), dialback_out_connection_cleanup(), dialback_out_read(), dnsrv_deliver(), js_users_gc(), jsm_deserialize(), main(), mio_ssl_starttls(), mio_ssl_verify(), mod_dynamic(), unregister_instance(), and xdb_file_phandler().
| void log_record | ( | char const * | id, |
| char const * | type, | ||
| char const * | action, | ||
| char const * | msgfmt, | ||
| ... | |||
| ) |
generic log record support
| id | to which id is the message related |
| type | the type of the log message (e.g. "session") |
| action | action that is logged (e.g. a failed auth) |
| msgfmt | printf()-like format string, parameters are following |
References log_generic().
Referenced by _dialback_miod_hash_cleanup().
| void log_warn | ( | char const * | host, |
| char const * | msgfmt, | ||
| ... | |||
| ) |
generate a log message of type "warn"
| host | the sending host (domain) of the log message - NULL if the host is not known, in that case the message is logged as jabberd internal |
| msgfmt | the format string for the message, parameters are passed afterwards like for the printf() function |
References logger().
Referenced by _js_routed_session_control_packet(), _js_routed_session_packet(), _mio_xml_parser(), deliver_fail(), dialback_check_settings(), dialback_in_read_db(), dialback_in_verify(), dialback_miod_read(), dialback_out_packet(), dialback_out_read(), dialback_out_read_db(), dpacket_new(), js_deliver(), js_packet(), mio_init(), mio_ssl_init(), mod_auth_crypt(), pthsock_client(), set_debug_facility(), xdb_file_load(), and xdb_file_phandler().
| void logger | ( | char const * | type, |
| char const * | host, | ||
| char const * | message | ||
| ) |
send a log message to the logging components
| type | the type of log message (one of "notice"+/"record", "warn"+, "alert", "stat"+, "info", "emerg", "crit", or "err"+ - in jabberd only the marked ones are used - "debug" should not be used as debugging messages should not be routed on the XML router) |
| host | the sending host (domain) of the message, or NULL if no sending host is known (the message are than logged as jabberd internal) |
| message | The message to be logged |
References deliver(), dpacket_new(), j_strlen(), log_debug2, LOGT_DELIVER, NS_SERVER, xmlnode_insert_cdata(), xmlnode_new_tag_ns(), xmlnode_put_attrib_ns(), xmlnode_serialize_string(), and ZONE.
Referenced by log_alert(), log_notice(), and log_warn().
pops the last xmlnode from the queue
This function removes the last xmlnode from a write queue. This is normally used to get unsent stanzas from the queue in case of an error happens and the stanzas cannot be delivered.
The returned xmlnodes have to be freed by the caller.
Elements in the write queue, that have no xmlnode attached, but are just character data are deleted by this function and the memory associated with these items is freed by mio_cleanup().
| m | the mio stream to get the last xmlnode stanza in the write queue for. |
References mio_wb_q_st::next, mio_wb_q_st::p, pool_free(), mio_st::queue, mio_st::tail, and mio_wb_q_st::x.
| void mio_close | ( | mio | m | ) |
client call to close the socket
| m | the socket, that should be closed |
References log_debug2, LOGT_EXECFLOW, mio_st::state, state_CLOSE, ZONE, mio_main_st::zzz, and mio_main_st::zzz_active.
Referenced by _dialback_beat_idle(), _dialback_beat_in_idle(), _dialback_beat_out_idle(), _mio_xml_parser(), dialback_check_settings(), dialback_in_read(), dialback_in_read_db(), dialback_out_read(), dialback_out_read_db(), and mio_ssl_starttls().
| void mio_connect | ( | char * | host, |
| int | port, | ||
| mio_std_cb | cb, | ||
| void * | cb_arg, | ||
| int | timeout, | ||
| mio_handlers | mh | ||
| ) |
request to connect to a remote host
| host | the host where to connect to (either a IPv4 or IPv6) |
| port | the port number to connect to |
| cb | the application callback function |
| cb_arg | argument to pass to the application callback function |
| timeout | how long to wait for a connection to be established (0 for using the default value) |
| mh | the mio_handlers used to select the desired type of socket (e.g. an XML stream or a TLS protected socket) |
References mio_connect_st::cb, mio_connect_st::cb_arg, mio_connect_st::ip, mio_connect_st::mh, mio_handlers_new(), mio_connect_st::p, pmalloco(), pool_new, mio_connect_st::port, pstrdup(), register_beat(), and mio_connect_st::t.
Referenced by dialback_out_connect().
| void mio_handlers_free | ( | mio_handlers | mh | ) |
free a mio_handlers structure
| mh | the mio_handlers structure that should be freed |
References mio_handlers_st::p, and pool_free().
Referenced by mio_set_handlers().
| mio_handlers mio_handlers_new | ( | mio_read_func | rf, |
| mio_write_func | wf, | ||
| mio_parser_func | pf | ||
| ) |
create a mio_handlers instance, that can be passed to mio_listen() or mio_accept()
The mio_handlers can be used to setup different 'types' of sockets
Default is to have an unencrypted socket reading plain bytes.
If you are requesting a TLS protected socket (using MIO_SSL_READ and MIO_SSL_WRITE), you also have to modify the accepted function in the returned mio_handlers afterwards!
| rf | handler used for reading, NULL for default (may be MIO_RAW_READ or MIO_SSL_READ) |
| wf | handler used for writing, NULL for default (may be MIO_RAW_WRITE or MIO_SSL_WRITE) |
| pf | handler used for parsing, NULL for default (may be MIO_RAW_PARSER or MIO_XML_PARSER) |
References MIO_RAW_PARSER, MIO_RAW_READ, MIO_RAW_WRITE, mio_handlers_st::p, mio_handlers_st::parser, pmalloco(), pool_new, mio_handlers_st::read, and mio_handlers_st::write.
Referenced by mio_connect(), mio_listen(), and pthsock_client().
| void mio_init | ( | void | ) |
Initialize manged I/O handling
This must be called before MIO is used
References mio_main_st::bounce_uri, karma::dec, mio_main_st::flash_policy, karma::inc, j_atoi(), mio_main_st::k, KARMA_DEC, KARMA_HEARTBEAT, KARMA_INC, KARMA_INIT, KARMA_MAX, karma_new(), KARMA_PENALTY, KARMA_RESETMETER, KARMA_RESTORE, log_warn(), karma::max, mio_ssl_init(), NS_JABBERD_CONFIGFILE, mio_main_st::p, karma::penalty, pmalloco(), pool_new, pstrdup(), mio_main_st::rate_p, mio_main_st::rate_t, register_beat(), karma::reset_meter, karma::restore, mio_main_st::t, karma::val, mio_main_st::webserver_path, xhash_free(), xhash_new(), xhash_put(), xmlnode_get_attrib_ns(), xmlnode_get_data(), xmlnode_get_list_item(), xmlnode_get_tags(), xmlnode_serialize_string(), and mio_main_st::zzz.
Referenced by main().
| int mio_is_encrypted | ( | mio | m | ) |
check if a connection is encrypted
| m | the connection |
References mio_st::ssl.
Referenced by dialback_check_settings(), and dialback_in_read().
| void mio_karma | ( | mio | m, |
| int | val, | ||
| int | max, | ||
| int | inc, | ||
| int | dec, | ||
| int | penalty, | ||
| int | restore | ||
| ) |
sets karma values
References karma::dec, karma::inc, mio_st::k, karma::max, karma::penalty, karma::restore, and karma::val.
copy karma to a mio socket
| m | the mio to copy the karma to |
| k | the karma to copy to the mio |
References mio_st::k, and karma_copy().
Referenced by dialback(), mio_new(), and pthsock_client().
| mio mio_listen | ( | int | port, |
| char const * | listen_host, | ||
| mio_std_cb | cb, | ||
| void * | arg, | ||
| mio_handlers | mh | ||
| ) |
call to start listening with select
| port | port to listen at |
| listen_host | IPv4 or IPv6 address to listen at |
| cb | application callback function |
| arg | argument to pass to the application callback function |
| mh | mio_handlers used for this connection |
References log_alert(), log_debug2, LOGT_IO, make_netsocket(), mio_handlers_new(), mio_new(), NETSOCKET_SERVER, mio_st::our_ip, mio_st::p, pstrdup(), mio_st::type, type_LISTEN, and ZONE.
Referenced by dialback(), xmppd::proxy65::proxy65::proxy65(), and pthsock_client().
| mio mio_new | ( | int | fd, |
| mio_std_cb | cb, | ||
| void * | arg, | ||
| mio_handlers | mh | ||
| ) |
creates a new mio object from a file descriptor
| fd | the file descriptor the caller already has |
| cb | the callback function, MIO should call on events |
| arg | the argument MIO should pass to the callback function, when calling it |
| mh | which mio_handlers MIO should use for this connection |
References mio_st::cb, mio_st::cb_arg, mio_st::fd, mio_main_st::k, log_debug2, LOGT_EXECFLOW, mio_karma2(), mio_rate(), mio_set_handlers(), mio_st::p, pmalloco(), pool_new, mio_main_st::rate_p, mio_main_st::rate_t, mio_st::state, state_ACTIVE, mio_st::type, type_NORMAL, ZONE, mio_main_st::zzz, and mio_main_st::zzz_active.
Referenced by mio_listen().
| void mio_rate | ( | mio | m, |
| int | rate_time, | ||
| int | max_points | ||
| ) |
sets connection rate limits
References mio_st::flags, jlimit_free(), jlimit_new(), mio_st::rate, and mio_st::rated.
Referenced by dialback(), mio_new(), and pthsock_client().
| void mio_reset | ( | mio | m, |
| mio_std_cb | cb, | ||
| void * | arg | ||
| ) |
resets the callback function
| m | the mio to update the callback function for |
| cb | the new callback function |
| arg | the new argument MIO should pass to the callback function |
References mio_st::cb, and mio_st::cb_arg.
Referenced by xmppd::proxy65::connected_sockets::connected_sockets(), dialback_in_read(), dialback_in_read_db(), dialback_out_read(), and xmppd::proxy65::socks5stub::socks5stub().
| void mio_set_handlers | ( | mio | m, |
| mio_handlers | mh | ||
| ) |
reset the handlers of a mio structure
| m | the mio to set the handlers for |
| mh | the new handlers to set |
References mio_st::mh, and mio_handlers_free().
Referenced by mio_new().
| void mio_ssl_init | ( | xmlnode | x | ) |
initialize the mio SSL/TLS module using the GNU TLS library
| x | xmlnode containing the configuration information (the io/tls element) |
References j_strcmp(), log_debug2, log_error, log_warn(), LOGT_IO, NS_JABBERD_CONFIGFILE, NTYPE_TAG, pool_new, xmlnode_t::type, xhash_free(), xhash_new(), xhash_put(), xmlnode_get_attrib_ns(), xmlnode_get_data(), xmlnode_get_firstchild(), xmlnode_get_localname(), xmlnode_get_namespace(), xmlnode_get_nextsibling(), and ZONE.
Referenced by mio_init().
| int mio_ssl_starttls | ( | mio | m, |
| int | originator, | ||
| const char * | identity | ||
| ) |
start a TLS layer on a connection and set the appropriate mio handlers for SSL/TLS
| m | the connection on which the TLS layer should be established |
| originator | 1 if this side is the originating side, 0 else |
| identity | our own identity (selector for the used certificate) |
References _mio_ssl_cleanup(), _mio_tls_cont_handshake_server(), mio_handlers_st::close, mio_st::fd, mio_st::flags, mio_handlers_st::handshake, mio_st::k, log_debug2, log_error, log_notice(), LOGT_EXECFLOW, LOGT_IO, mio_st::mh, mio_close(), MIO_SSL_READ, MIO_SSL_WRITE, mio_tls_certtypes, mio_tls_ciphers, mio_tls_compression, mio_tls_credentials, mio_tls_kx, mio_tls_mac, mio_tls_protocols, mio_st::our_ip, mio_st::p, mio_st::peer_ip, pool_cleanup(), mio_handlers_st::read, mio_st::recall_handshake_when_readable, mio_st::recall_handshake_when_writeable, mio_st::ssl, karma::val, mio_handlers_st::write, and ZONE.
Referenced by _mio_ssl_accepted(), and mio_xml_starttls().
| int mio_ssl_starttls_possible | ( | mio | m, |
| const char * | identity | ||
| ) |
check if it would be possible to start TLS on a connection
| m | the connection |
| identity | our own identity (check if certificate is present) |
References mio_tls_credentials, and mio_st::ssl.
Referenced by dialback_in_read(), dialback_in_read_db(), and dialback_out_read().
| int mio_ssl_verify | ( | mio | m, |
| const char * | id_on_xmppAddr | ||
| ) |
verify the SSL/TLS certificate of the peer for the given MIO connection
| m | the connection for which the peer should be verified |
| id_on_xmppAddr | the JabberID, that the certificate should be checked for, if NULL it is only checked if the certificate is valid and trusted |
References log_notice(), and mio_st::ssl.
Referenced by dialback_check_settings(), dialback_in_read(), and dialback_in_read_db().
| void mio_stop | ( | void | ) |
Cleanup function when server is shutting down, closes all sockets, so that everything can be cleaned up properly.
References log_debug2, LOGT_CLEANUP, mio_main_st::master__list, mio_st::next, mio_main_st::p, pool_free(), mio_main_st::shutdown, mio_main_st::t, and ZONE.
| bool mio_tls_early_init | ( | ) |
early initiatizations for GnuTLS
This has to be called as soon as possible after application startup
References mio_tls_asn1_tree, mio_tls_gcrypt_init(), and subjectAltName_asn1_tab.
Referenced by main().
| void mio_tls_get_certtype | ( | mio | m, |
| char * | buffer, | ||
| size_t | len | ||
| ) |
References mio_st::ssl.
Referenced by dialback_check_settings().
| void mio_tls_get_characteristics | ( | mio | m, |
| char * | buffer, | ||
| size_t | len | ||
| ) |
get some information on what protocols are used inside the TLS layer
| m | the mio object to request the information for |
| buffer | where to write the result |
| len | size of the buffer to place the information in |
References mio_st::ssl.
Referenced by dialback_check_settings().
| void mio_tls_get_compression | ( | mio | m, |
| char * | buffer, | ||
| size_t | len | ||
| ) |
References mio_st::ssl.
Referenced by dialback_check_settings().
writes a str, or XML stanza to the client socket
You can only write the xmlnode OR the buffer to the mio. If the buffer argument is not equal to NULL, the buffer is used and the xmlnode is ignored.
| m | the mio to write the data to |
| stanza | xmlnode containing the stanza, that should be written to a stream (gets freed after the data has been written) |
| buffer | pointer to a buffer of characters, that should be written to the connection |
| len | number of bytes contained in the buffer, that should be written (-1 to write a zero terminated string contained in the buffer) |
References mio_wb_q_st::cur, mio_wb_q_st::data, mio_wb_q_st::len, log_debug2, LOGT_EXECFLOW, LOGT_IO, LOGT_STRANGE, mio_wb_q_st::next, mio_st::out_ns, mio_wb_q_st::p, pmalloco(), pool_free(), pool_new, mio_st::queue, queue_CDATA, queue_XMLNODE, mio_st::tail, mio_st::type, mio_wb_q_st::type, type_NUL, mio_wb_q_st::x, xmlnode_pool(), xmlnode_serialize_string(), ZONE, mio_main_st::zzz, and mio_main_st::zzz_active.
Referenced by _dialback_beat_idle(), _dialback_beat_in_idle(), _dialback_beat_out_idle(), _mio_xml_parser(), xmppd::proxy65::connected_sockets::connected_sockets(), dialback_check_settings(), dialback_in_read(), dialback_in_read_db(), dialback_in_verify(), dialback_miod_write(), dialback_out_connection(), dialback_out_packet(), dialback_out_read(), dialback_out_read_db(), mio_write_root(), and xmppd::resolver::resolver::send_query().
write the start tag for the root element to a stream
| m | the mio of the stream where to write the start tag for the root element to |
| root | the root element (freed by this function) |
| stream_type | type of stream: 0 for 'jabber:server', 1 for 'jabber:client', 2 for 'jabber:component:accept' |
References mio_write(), NS_CLIENT, NS_COMPONENT_ACCEPT, NS_SERVER, NS_XMLNS, mio_st::out_ns, xmppd::ns_decl_list::update(), xmlnode_free(), xmlnode_get_attrib_ns(), and xstream_header_char().
Referenced by dialback_in_read(), and dialback_out_read().
| void mio_xml_reset | ( | mio | m | ) |
reset a stream (restart it)
| m | the stream to reset |
References mio_st::flags, and mio_st::reset_stream.
Referenced by dialback_in_read_db(), dialback_out_read(), and mio_xml_starttls().
| int mio_xml_starttls | ( | mio | m, |
| int | originator, | ||
| const char * | identity | ||
| ) |
restart a stream, starting the use of a TLS layer
| m | the connection |
| originator | 1 if we are the originator, 0 else |
| identity | identity to use for selecting the certificate |
References _mio_write_dump(), log_debug2, LOGT_IO, mio_ssl_starttls(), mio_xml_reset(), and ZONE.
Referenced by dialback_in_read_db(), and dialback_out_read().
Creates a new queue, is automatically cleaned up when p frees
public queue creation function, queue lives as long as the pool
Create a new job queue
The queue gets destroyed automatically when the passed pool gets freed.
For more information on what a queue is and how it is used, please see the information about mtq.cc.
| p | the memory pool where some memory can be allocated from and with that the new queue will share the lifetime. |
References log_debug2, LOGT_THREAD, mtqueue_struct::mp, pmalloco(), pool_cleanup(), and ZONE.
Referenced by js_sc_session_new(), and js_session_new().
| void mtq_send | ( | mtq | q, |
| pool | p, | ||
| mtq_callback | f, | ||
| void * | arg | ||
| ) |
appends the arg to the queue to be run on a thread
initiate that a function is executed asyncronously to the calling thread
This will arrange that the function f is executed in one of the threads managed by mtq.
| q | thread queue to which f should be added (NULL if f should be called as soon as possible and no thread queue is used) |
| p | memory pool that can be used to allocate some memory used to manage this job (should not get freed before the job has been finished) |
| f | the function to execute |
| arg | argument to pass to f |
References mtqmaster_struct::all, mtqcall_struct::arg, mth_struct::busy, mtqcall_struct::f, mth_struct::id, log_debug2, LOGT_THREAD, mtqueue_struct::mp, mth_struct::mp, mtqmaster_struct::mp, MTQ_THREADS, mtqmaster_struct::overflow, mth_struct::p, pmalloco(), pool_new, mtqcall_struct::q, mtqueue_struct::routed, and ZONE.
Referenced by _js_routed_auth_packet(), js_psend(), js_sc_session_new(), js_session_end(), js_session_from(), js_session_new(), and js_session_to().
| void register_beat | ( | int | freq, |
| beathandler | f, | ||
| void * | arg | ||
| ) |
register a function to receive heartbeats
References _new_beat(), beat_struct::arg, beat_struct::f, beat_struct::freq, heartbeat__ring, beat_struct::last, beat_struct::next, and beat_struct::prev.
Referenced by dialback(), dnsrv(), jsm(), main(), mio_connect(), mio_init(), mod_stat(), pthsock_client(), xmppd::instance_base::set_heartbeat_interval(), xdb_cache(), and xdb_file().
register a function to handle that node in the config file
| p | memory pool used to allocate data belonging to this registration |
| node | the node that should be handled by the handler |
| f | the handler function that should be registered |
| arg | argument, that should be passed to the handler function |
References cfg_struct::arg, cfhandlers__, cfg_struct::f, cfg_struct::next, cfg_struct::node, pmalloco(), and pstrdup().
Referenced by base_accept(), base_connect(), base_dir(), base_file(), base_format(), base_importspool(), base_load(), base_null(), base_stderr(), base_stdout(), base_syslog(), base_to(), base_unsubscribe(), deliver_init(), mod_auth_crypt(), mod_auth_digest(), mod_auth_plain(), and mod_last().
| void register_instance | ( | instance | i, |
| char const * | host | ||
| ) |
register this instance as a possible recipient of packets to this host
| i | the instance to register |
| host | the domain to register this instance for (or "*" to register as the default routing) |
References register_notifier_struct::arg, register_notifier_struct::callback, instance_struct::id, log_debug2, LOGT_REGISTER, register_notifier_struct::next, NS_JABBERD_CONFIGFILE, instance_struct::p, p_LOG, p_XDB, pstrdup(), instance_struct::routing_update_callbacks, instance_struct::type, instance_struct::x, xhash_free(), xhash_get(), xhash_new(), xhash_put(), xmlnode_get_list_item(), xmlnode_get_tags(), and ZONE.
Referenced by dialback_miod_hash(), dialback_out_packet(), and mod_dynamic().
register a function to handle delivery for this instance
References handel_struct::arg, handel_struct::f, instance_struct::hds, handel_struct::next, handel_struct::o, o_COND, o_DELIVER, o_PRECOND, o_PREDELIVER, handel_struct::p, pmalloco(), and pool_new.
Referenced by dialback(), dnsrv(), xmppd::instance_base::instance_base(), jsm(), pthsock_client(), xdb_cache(), xdb_file(), and xdb_sql().
| void register_routing_update_callback | ( | instance | i, |
| register_notify | f, | ||
| void * | arg | ||
| ) |
register a function that gets called on registering/unregistering a host for an instance
register a function that gets called on registering/unregistering a host for an instance
| i | the instance to get register/unregister events for (NULL for a global registration) |
| f | the callback method to call |
| arg | argument to pass to the callback |
References register_notifier_struct::arg, register_notifier_struct::callback, log_debug2, LOGT_EXECFLOW, register_notifier_struct::next, instance_struct::p, pmalloco(), pool_new, instance_struct::routing_update_callbacks, and ZONE.
Referenced by jsm().
| void register_shutdown | ( | shutdown_func | f, |
| void * | arg | ||
| ) |
register a function to be called on shutdown
| f | the function to be called on shutdown |
| arg | the argument to be passed to the callback function |
References cfg_struct::arg, shutdown_list::arg, cfg_struct::f, shutdown_list::f, shutdown_list::next, shutdown_list::p, pmalloco(), pool_new, and shutdown__list.
| void set_cmdline_debug_flag | ( | int | v | ) |
set the value of the cmdline_debug_flag which is always ORed to the value that is set by set_debug_flag() this will reset the mask set with set_debug_flag(), so set_cmdline_debug_flag() should be called first.
| v | the debug mask given on the command line |
References cmdline_debug_flag, and debug_flag.
Referenced by main().
| void set_debug_facility | ( | int | facility | ) |
set the facility used to write debugging messages to syslog
| facility | the facility to use, -1 if writing to the standard output is requested |
References _debug_facility, and log_warn().
| void set_debug_flag | ( | int | v | ) |
set the debugging mask, if 0 no debugging is requested for other values debugging is enabled, the different bits in the value enable different log message types the value set with set_cmdline_debug_flag() (what the user specified on the command line) is always ORed to this value
| v | the new debugging mask |
References cmdline_debug_flag, and debug_flag.
| void unregister_instance | ( | instance | i, |
| char const * | host | ||
| ) |
unregister an instance as a possible recipient of packets for a domain
| i | the instance to unregister |
| host | the domain to unregister (or "*" to unregister as the default routing) |
References register_notifier_struct::arg, register_notifier_struct::callback, instance_struct::id, log_debug2, log_notice(), LOGT_REGISTER, register_notifier_struct::next, instance_struct::p, pstrdup(), instance_struct::routing_update_callbacks, instance_struct::static_hosts, instance_struct::type, xhash_get(), xhash_put(), xhash_zap(), and ZONE.
Referenced by _dialback_miod_hash_cleanup(), and instance_shutdown().
| int xdb_act | ( | xdbcache | xc, |
| jid | owner, | ||
| const char * | ns, | ||
| char * | act, | ||
| char const * | match, | ||
| xmlnode | data | ||
| ) |
sends new xml action, returns non-zero if failure
Referenced by _js_session_to().
| int xdb_act_path | ( | xdbcache | xc, |
| jid | owner, | ||
| const char * | ns, | ||
| char const * | act, | ||
| char const * | matchpath, | ||
| xht | namespaces, | ||
| xmlnode | data | ||
| ) |
sends new xml action, returns non-zero if failure
Referenced by _js_session_from().
create a new xdb cache for this instance
create an xdbcache for the specified instance
This creates the _xdbcache structure from the memory pool of the instance, and registers two handlers: One handler is registered to get/handle the xdb responses that are delivered to the instance. The other handler is registered to get called regularily every 10 seconds.
References xdbcache_struct::i, xdbcache_struct::mutex, xdbcache_struct::next, o_PRECOND, instance_struct::p, pmalloco(), xdbcache_struct::prev, register_beat(), and register_phandler().
Referenced by dialback(), dnsrv(), jsm(), pthsock_client(), xdb_file(), and xdb_sql().
blocks until namespace is retrieved, returns xmlnode or NULL if failed
query data from the xdb
blocks until namespace is retrieved, host must map back to this service!
| xc | the xdbcache used for this query |
| owner | for which JID the query should be made |
| ns | which namespace to query |
References xdbcache_struct::cond, xdbcache_struct::data, xdbcache_struct::i, xdbcache_struct::id, jid_full(), log_debug2, LOGT_STORAGE, LOGT_THREAD, xdbcache_struct::mutex, xdbcache_struct::next, xdbcache_struct::ns, NTYPE_TAG, xdbcache_struct::owner, xdbcache_struct::preblock, xdbcache_struct::prev, xdbcache_struct::sent, xdbcache_struct::set, xmlnode_free(), xmlnode_get_firstchild(), xmlnode_get_nextsibling(), xmlnode_get_type(), and ZONE.
Referenced by _js_authreg_register(), dialback(), dnsrv(), js_config(), js_user(), mod_dynamic(), pthsock_client(), xdb_file(), and xdb_sql().
sends new xml to replace old, returns non-zero if failure
| int debug_flag |
the active debugging mask (this is a bitmask of ORed LOGT_* constents)
Referenced by get_debug_flag(), set_cmdline_debug_flag(), and set_debug_flag().
1.7.4