jabberd2
2.3.2
|
#include "router.h"
Go to the source code of this file.
Data Structures | |
struct | broadcast_st |
info for broadcasts More... | |
Macros | |
#define | MAX_JID 3072 |
#define | MAX_MESSAGE 65535 |
#define | SECS_PER_DAY 86400 |
#define | BYTES_PER_MEG 1048576 |
Typedefs | |
typedef struct broadcast_st * | broadcast_t |
info for broadcasts More... | |
Functions | |
static void | _router_broadcast (const char *key, int keylen, void *val, void *arg) |
broadcast a packet More... | |
static void | _router_advertise (router_t r, const char *domain, component_t src, int unavail) |
domain advertisement More... | |
static void | _router_advertise_reverse (const char *key, int keylen, void *val, void *arg) |
tell a component about all the others More... | |
static void | _router_process_handshake (component_t comp, nad_t nad) |
void | routes_free (routes_t routes) |
static int | _route_add (xht hroutes, const char *name, component_t comp, route_type_t rtype) |
static void | _route_remove (xht hroutes, const char *name, component_t comp) |
static void | _router_process_bind (component_t comp, nad_t nad) |
static void | _router_process_unbind (component_t comp, nad_t nad) |
static void | _router_comp_write (component_t comp, nad_t nad) |
static void | _router_route_log_sink (const char *key, int keylen, void *val, void *arg) |
static void | _router_process_route (component_t comp, nad_t nad) |
static void | _router_process_throttle (component_t comp, nad_t nad) |
static int | _router_sx_callback (sx_t s, sx_event_t e, void *data, void *arg) |
static int | _router_accept_check (router_t r, mio_fd_t fd, const char *ip) |
static void | _router_route_unbind_walker (const char *key, int keylen, void *val, void *arg) |
int | router_mio_callback (mio_t m, mio_action_t a, mio_fd_t fd, void *data, void *arg) |
int | message_log (nad_t nad, router_t r, const char *msg_from, const char *msg_to) |
#define MAX_MESSAGE 65535 |
Definition at line 24 of file router.c.
Referenced by message_log().
typedef struct broadcast_st * broadcast_t |
info for broadcasts
|
static |
broadcast a packet
Definition at line 36 of file router.c.
References routes_st::comp, component_st::legacy, broadcast_st::nad, nad_copy(), routes_st::ncomp, component_st::s, broadcast_st::src, and sx_nad_write.
Referenced by _router_advertise().
|
static |
domain advertisement
Definition at line 51 of file router.c.
References _router_broadcast(), log_debug, broadcast_st::nad, nad_add_namespace(), nad_append_attr(), nad_append_elem(), nad_free(), nad_new(), broadcast_st::r, router_st::routes, broadcast_st::src, uri_COMPONENT, xhash_walk(), and ZONE.
Referenced by _router_process_bind(), _router_process_unbind(), _router_route_unbind_walker(), and _router_sx_callback().
|
static |
tell a component about all the others
Definition at line 74 of file router.c.
References routes_st::comp, log_debug, broadcast_st::nad, nad_add_namespace(), nad_append_elem(), nad_new(), nad_set_attr(), routes_st::name, routes_st::ncomp, component_st::s, sx_nad_write, uri_COMPONENT, and ZONE.
Referenced by _router_process_bind().
|
static |
Definition at line 100 of file router.c.
References nad_st::elems, nad_elem_st::icdata, _sx_st::id, nad_elem_st::itail, nad_elem_st::lcdata, router_st::local_secret, log_debug, nad_elem_st::ltail, NAD_CDATA, NAD_CDATA_L, nad_free(), component_st::r, _sx_st::req_to, component_st::s, shahash_r(), stream_err_NOT_AUTHORIZED, sx_auth(), sx_close(), sx_error(), sx_nad_write, and ZONE.
Referenced by _router_sx_callback().
void routes_free | ( | routes_t | routes | ) |
Definition at line 153 of file router.c.
References routes_st::comp, and routes_st::name.
Referenced by JABBER_MAIN().
|
static |
Definition at line 159 of file router.c.
References routes_st::comp, router_st::log, log_write(), routes_st::name, routes_st::ncomp, component_st::r, routes_st::rtype, xhash_get(), and xhash_put().
Referenced by _router_process_bind(), and _router_sx_callback().
|
static |
Definition at line 179 of file router.c.
References routes_st::comp, router_st::deadroutes, jqueue_push(), routes_st::ncomp, component_st::r, xhash_get(), and xhash_zap().
Referenced by _router_process_unbind(), and _router_route_unbind_walker().
|
static |
Definition at line 202 of file router.c.
References _route_add(), _router_advertise(), _router_advertise_reverse(), router_st::aci, aci_check(), router_st::aliases, _sx_st::auth_id, router_st::default_route, jid_st::domain, component_st::ip, jid_free(), jid_new(), router_st::log, log_debug, router_st::log_sinks, log_write(), NAD_AVAL, NAD_AVAL_L, NAD_ENS, nad_find_attr(), nad_find_elem(), nad_set_attr(), alias_st::name, alias_st::next, component_st::port, pstrdup(), component_st::r, route_MULTI_TO, route_SINGLE, router_st::routes, component_st::routes, component_st::s, sx_nad_write, alias_st::target, xhash_get(), xhash_pool(), xhash_put(), xhash_walk(), and ZONE.
Referenced by _router_sx_callback().
|
static |
Definition at line 331 of file router.c.
References _route_remove(), _router_advertise(), router_st::default_route, jid_st::domain, component_st::ip, jid_free(), jid_new(), router_st::log, log_debug, router_st::log_sinks, log_write(), NAD_AVAL, NAD_AVAL_L, nad_find_attr(), nad_set_attr(), component_st::port, component_st::r, router_st::routes, component_st::routes, component_st::s, sx_nad_write, xhash_get(), xhash_zap(), and ZONE.
Referenced by _router_sx_callback().
|
static |
Definition at line 374 of file router.c.
References component_st::ip, jqueue_push(), component_st::legacy, log_debug, NAD_AVAL, NAD_AVAL_L, nad_find_attr(), component_st::port, component_st::s, stanza_err_BAD_REQUEST, stanza_err_SERVICE_UNAVAILABLE, stanza_error(), sx_nad_write, sx_nad_write_elem(), component_st::tq, and ZONE.
Referenced by _router_process_route(), _router_process_throttle(), and _router_route_log_sink().
|
static |
Definition at line 402 of file router.c.
References _router_comp_write(), component_st::ip, log_debug, broadcast_st::nad, nad_copy(), nad_set_attr(), component_st::port, and ZONE.
Referenced by _router_process_route().
|
static |
Definition at line 413 of file router.c.
References jid_st::_full, _router_comp_write(), _router_route_log_sink(), _stanza_errors, jid_st::_user, routes_st::comp, xhashv::comp_val, router_st::components, router_st::default_route, jid_st::domain, router_st::filter, filter_packet(), component_st::ip, jid_free(), jid_full(), jid_new(), jid_reset(), jid_static(), jid_user(), router_st::log, log_debug, router_st::log_sinks, log_write(), message_log(), router_st::message_logging_enabled, router_st::message_logging_file, NAD_AVAL, NAD_AVAL_L, nad_copy(), NAD_ENAME, NAD_ENAME_L, nad_find_attr(), nad_free(), nad_print(), nad_set_attr(), routes_st::name, routes_st::ncomp, jid_st::node, component_st::port, component_st::r, route_MULTI_FROM, route_MULTI_TO, router_st::routes, component_st::routes, routes_st::rtype, shahash_raw(), stanza_err_BAD_REQUEST, stanza_err_REDIRECT, xhashv::val, xhash_count(), xhash_get(), xhash_iter_first(), xhash_iter_get(), xhash_iter_next(), xhash_walk(), and ZONE.
Referenced by _router_sx_callback().
|
static |
Definition at line 646 of file router.c.
References _router_comp_write(), component_st::ip, jqueue_free(), jqueue_new(), jqueue_pull(), router_st::log, log_write(), component_st::port, component_st::r, and component_st::tq.
Referenced by _router_sx_callback().
|
static |
Definition at line 671 of file router.c.
References _route_add(), _router_advertise(), _router_process_bind(), _router_process_handshake(), _router_process_route(), _router_process_throttle(), _router_process_unbind(), router_st::aliases, _sx_st::auth_id, router_st::closefd, _sx_buf_st::data, _jqueue_node_st::data, jid_st::domain, nad_st::elems, event_CLOSED, event_ERROR, event_OPEN, event_PACKET, event_READ, event_STREAM, event_WANT_READ, event_WANT_WRITE, event_WRITE, mio_fd_st::fd, component_st::fd, _jqueue_st::front, _sx_error_st::generic, component_st::ip, jid_reset(), jid_static(), jqueue_push(), component_st::legacy, _sx_buf_st::len, router_st::local_secret, router_st::log, log_debug, log_write(), router_st::mio, mio_read, MIO_WOULDBLOCK, mio_write, nad_elem_st::my_ns, nad_add_namespace(), NAD_AVAL, NAD_AVAL_L, NAD_ENAME, NAD_ENAME_L, NAD_ENS, nad_find_attr(), nad_find_namespace(), nad_free(), NAD_NURI, NAD_NURI_L, nad_set_attr(), nad_wrap_elem(), alias_st::name, nad_ns_st::next, alias_st::next, nad_elem_st::ns, _sx_st::ns, nad_st::nss, component_st::port, _jqueue_node_st::prev, pstrdup(), component_st::r, component_st::rate, rate_add(), rate_check(), rate_left(), component_st::rate_log, _sx_st::req_to, route_MULTI_FROM, router_st::routes, component_st::routes, component_st::s, nad_st::scope, _sx_error_st::specific, _sx_st::state, state_STREAM, stream_err_HOST_UNKNOWN, stream_err_INVALID_NAMESPACE, sx_close(), sx_error(), sx_kill(), alias_st::target, uri_CLIENT, uri_COMPONENT, xhash_pool(), xhash_put(), and ZONE.
Referenced by router_mio_callback().
Definition at line 977 of file router.c.
References router_st::access, access_check(), router_st::conn_rate_seconds, router_st::conn_rate_total, router_st::conn_rate_wait, router_st::conn_rates, mio_fd_st::fd, router_st::log, log_write(), pstrdup(), rate_add(), rate_check(), rate_new(), xhash_get(), xhash_pool(), and xhash_put().
Referenced by router_mio_callback().
|
static |
Definition at line 1003 of file router.c.
References _route_remove(), _router_advertise(), router_st::default_route, router_st::log, router_st::log_sinks, log_write(), component_st::r, router_st::routes, component_st::routes, xhash_getx(), and xhash_zapx().
Referenced by router_mio_callback().
int router_mio_callback | ( | mio_t | m, |
mio_action_t | a, | ||
mio_fd_t | fd, | ||
void * | data, | ||
void * | arg | ||
) |
Definition at line 1028 of file router.c.
References _router_accept_check(), _router_route_unbind_walker(), _router_sx_callback(), action_ACCEPT, action_CLOSE, action_READ, action_WRITE, router_st::byte_rate_seconds, router_st::byte_rate_total, router_st::byte_rate_wait, router_st::components, router_st::dead, mio_fd_st::fd, component_st::fd, INET6_ADDRSTRLEN, component_st::ip, component_st::ipport, j_inet_getport(), jqueue_free(), jqueue_push(), component_st::last_activity, router_st::log, log_debug, log_write(), mio_app, component_st::port, component_st::r, component_st::rate, rate_free(), rate_new(), router_mio_callback(), component_st::routes, component_st::s, sx_can_read(), sx_can_write(), router_st::sx_env, sx_kill(), sx_new(), SX_SASL_OFFER, sx_server_init(), SX_SSL_STARTTLS_OFFER, component_st::tq, xhash_free(), xhash_new(), xhash_put(), xhash_walk(), xhash_zap(), and ZONE.
Referenced by JABBER_MAIN(), and router_mio_callback().
Definition at line 1132 of file router.c.
References router_st::log, log_write(), MAX_MESSAGE, router_st::message_logging_file, NAD_CDATA, NAD_CDATA_L, NAD_ENAME, and NAD_ENAME_L.
Referenced by _router_process_route().