jabberd2
2.3.6
|
Go to the source code of this file.
Data Structures | |
struct | host_st |
struct | s2s_st |
struct | pkt_st |
packet summary data wrapper More... | |
struct | conn_st |
struct | dnsquery_st |
dns query data More... | |
struct | dnscache_st |
one item in the dns resolution cache More... | |
struct | dnsres_st |
dns resolution results More... | |
union | xhashv |
session packet handling More... | |
Macros | |
#define | DNS_MAX_RESULTS 50 |
#define | S2S_DB_HEADER (1<<10) |
#define | MAX_DOMAIN_LEN 1023 |
Typedefs | |
typedef struct host_st * | host_t |
typedef struct s2s_st * | s2s_t |
typedef struct pkt_st * | pkt_t |
typedef struct conn_st * | conn_t |
typedef struct dnsquery_st * | dnsquery_t |
typedef struct dnscache_st * | dnscache_t |
typedef struct dnsres_st * | dnsres_t |
Enumerations | |
enum | conn_state_t { conn_NONE, conn_INPROGRESS, conn_VALID, conn_INVALID } |
Functions | |
int | s2s_router_mio_callback (mio_t m, mio_action_t a, mio_fd_t fd, void *data, void *arg) |
int | s2s_router_sx_callback (sx_t s, sx_event_t e, void *data, void *arg) |
our master callback More... | |
int | s2s_domain_in_whitelist (s2s_t s2s, const char *in_domain) |
char * | s2s_route_key (pool_t p, const char *local, const char *remote) |
generate a local/remote route key More... | |
int | s2s_route_key_match (char *local, const char *remote, const char *rkey, int rkeylen) |
match route key - used for searching route hash More... | |
char * | s2s_db_key (pool_t p, const char *secret, const char *remote, const char *id) |
generate a dialback key More... | |
char * | dns_make_ipport (const char *host, int port) |
int | out_packet (s2s_t s2s, pkt_t pkt) |
send a packet out More... | |
int | out_route (s2s_t s2s, const char *route, int routelen, conn_t *out, int allow_bad) |
find/make a connection for a route More... | |
int | dns_select (s2s_t s2s, char *ip, int *port, time_t now, dnscache_t dns, int allow_bad) |
void | dns_resolve_domain (s2s_t s2s, dnscache_t dns) |
void | out_resolve (s2s_t s2s, const char *domain, xht results, time_t expiry) |
responses from the resolver More... | |
void | out_dialback (s2s_t s2s, pkt_t pkt) |
int | out_bounce_domain_queues (s2s_t s2s, const char *domain, int err) |
int | out_bounce_route_queue (s2s_t s2s, const char *rkey, int rkeylen, int err) |
int | out_bounce_conn_queues (conn_t out, int err) |
void | out_flush_domain_queues (s2s_t s2s, const char *domain) |
void | out_flush_route_queue (s2s_t s2s, const char *rkey, int rkeylen) |
int | in_mio_callback (mio_t m, mio_action_t a, mio_fd_t fd, void *data, void *arg) |
int | s2s_db_init (sx_env_t env, sx_plugin_t p, va_list args) |
void | out_pkt_free (pkt_t pkt) |
Variables | |
sig_atomic_t | s2s_lost_router |
#define DNS_MAX_RESULTS 50 |
Definition at line 289 of file s2s.h.
Referenced by _dns_add_host(), _dns_add_result(), and dns_select().
#define S2S_DB_HEADER (1<<10) |
Definition at line 388 of file s2s.h.
Referenced by _s2s_db_header(), in_mio_callback(), and out_route().
#define MAX_DOMAIN_LEN 1023 |
Definition at line 391 of file s2s.h.
Referenced by _s2s_populate_whitelist_domains(), and s2s_domain_in_whitelist().
typedef struct dnsquery_st* dnsquery_t |
typedef struct dnscache_st* dnscache_t |
enum conn_state_t |
int s2s_router_mio_callback | ( | mio_t | m, |
mio_action_t | a, | ||
mio_fd_t | fd, | ||
void * | data, | ||
void * | arg | ||
) |
Definition at line 291 of file router.c.
References action_ACCEPT, action_CLOSE, action_READ, action_WRITE, mio_fd_st::fd, s2s_st::log, log_debug, log_write(), s2s_st::online, s2s_st::router, s2s_lost_router, sx_can_read(), sx_can_write(), sx_kill(), and ZONE.
Referenced by _s2s_router_connect().
int s2s_router_sx_callback | ( | sx_t | s, |
sx_event_t | e, | ||
void * | data, | ||
void * | arg | ||
) |
our master callback
Definition at line 24 of file router.c.
References _stanza_errors, _sx_error_st::code, _stanza_error_st::code, _sx_buf_st::data, pkt_st::db, event_CLOSED, event_ERROR, event_OPEN, event_PACKET, event_READ, event_STREAM, event_WANT_READ, event_WANT_WRITE, event_WRITE, s2s_st::fd, mio_fd_st::fd, pkt_st::from, _sx_error_st::generic, s2s_st::id, in_mio_callback(), jid_new(), _sx_buf_st::len, s2s_st::local_ip, s2s_st::local_port, s2s_st::log, log_debug, log_write(), s2s_st::mio, mio_close, MIO_ERROR, mio_listen, mio_read, MIO_STRERROR, MIO_WOULDBLOCK, mio_write, pkt_st::nad, nad_add_namespace(), nad_append_attr(), nad_append_elem(), NAD_AVAL, NAD_AVAL_L, NAD_ENAME, NAD_ENAME_L, NAD_ENS, nad_find_attr(), nad_find_elem(), nad_find_scoped_namespace(), nad_free(), nad_new(), NAD_NURI, NAD_NURI_L, nad_set_attr(), s2s_st::online, out_packet(), s2s_st::retry_left, s2s_st::retry_lost, s2s_st::router, s2s_st::router_default, s2s_st::router_pass, s2s_st::router_pemfile, s2s_st::router_private_key_password, s2s_st::router_user, s2s_st::server_fd, _sx_error_st::specific, _sx_st::ssf, stanza_err_BAD_REQUEST, stanza_err_REMOTE_SERVER_NOT_FOUND, stanza_error(), stanza_tofrom(), s2s_st::started, _sx_st::state, state_OPEN, state_STREAM, sx_close(), SX_ERR_AUTH, sx_kill(), sx_nad_write, s2s_st::sx_sasl, sx_sasl_auth(), s2s_st::sx_ssl, sx_ssl_client_starttls(), pkt_st::to, uri_COMPONENT, uri_DIALBACK, uri_DIALBACK_L, uri_STREAMS, uri_TLS, and ZONE.
Referenced by _s2s_router_connect().
int s2s_domain_in_whitelist | ( | s2s_t | s2s, |
const char * | in_domain | ||
) |
Definition at line 680 of file main.c.
References s2s_st::log, log_debug, log_write(), MAX_DOMAIN_LEN, s2s_st::n_whitelist_domains, s2s_st::whitelist_domains, and ZONE.
Referenced by _in_sx_callback(), and out_packet().
char* s2s_route_key | ( | pool_t | p, |
const char * | local, | ||
const char * | remote | ||
) |
generate a local/remote route key
Definition at line 27 of file util.c.
References pmalloc().
Referenced by _in_packet(), _in_result(), _out_packet_queue(), _out_result(), _out_verify(), and out_packet().
int s2s_route_key_match | ( | char * | local, |
const char * | remote, | ||
const char * | rkey, | ||
int | rkeylen | ||
) |
match route key - used for searching route hash
Definition at line 44 of file util.c.
Referenced by out_bounce_domain_queues().
char* s2s_db_key | ( | pool_t | p, |
const char * | secret, | ||
const char * | remote, | ||
const char * | id | ||
) |
generate a dialback key
Definition at line 61 of file util.c.
References _sx_debug, pstrdup(), shahash_r(), and ZONE.
Referenced by _in_verify(), and _out_dialback().
char* dns_make_ipport | ( | const char * | host, |
int | port | ||
) |
Definition at line 727 of file out.c.
Referenced by _dns_add_host(), _dns_add_result(), _out_dns_mark_bad(), and _s2s_time_checks().
send a packet out
Definition at line 610 of file out.c.
References _out_dialback(), _out_packet_queue(), conn_INPROGRESS, conn_VALID, pkt_st::db, jid_st::domain, nad_st::elems, s2s_st::enable_whitelist, mio_fd_st::fd, conn_st::fd, pkt_st::from, jid_free(), conn_st::last_packet, conn_st::last_verify, s2s_st::log, log_debug, log_write(), nad_elem_st::my_ns, pkt_st::nad, NAD_ENAME, NAD_ENAME_L, nad_find_namespace(), nad_free(), nad_elem_st::ns, conn_st::online, out_bounce_route_queue(), out_route(), s2s_st::require_tls, conn_st::s, conn_st::s2s, s2s_domain_in_whitelist(), s2s_route_key(), _sx_st::ssf, stanza_err_SERVICE_UNAVAILABLE, conn_st::states, sx_nad_write, sx_nad_write_elem(), pkt_st::to, uri_CLIENT, conn_st::verify, xhash_get(), and ZONE.
Referenced by _in_result(), out_flush_route_queue(), and s2s_router_sx_callback().
find/make a connection for a route
Definition at line 406 of file out.c.
References _out_dns_mark_bad(), _out_mio_callback(), _out_sx_callback(), dns_resolve_domain(), dns_select(), s2s_st::dnscache, dnscache_st::expiry, INET6_ADDRSTRLEN, dnscache_st::init_time, s2s_st::log, log_debug, log_write(), s2s_st::mio, mio_connect, MIO_ERROR, MIO_STRERROR, dnscache_st::name, s2s_st::origin_ips, s2s_st::origin_nips, s2s_st::out_dest, s2s_st::out_host, s2s_st::out_reuse, out_route(), dnscache_st::pending, pstrdup(), pstrdupx(), conn_st::s2s, S2S_DB_HEADER, sx_client_init(), s2s_st::sx_env, sx_new(), s2s_st::sx_ssl, uri_SERVER, xhash_free(), xhash_get(), xhash_getx(), xhash_new(), xhash_pool(), xhash_put(), xhash_zap(), and ZONE.
Referenced by _out_mio_callback(), out_packet(), and out_route().
int dns_select | ( | s2s_t | s2s, |
char * | ip, | ||
int * | port, | ||
time_t | now, | ||
dnscache_t | dns, | ||
int | allow_bad | ||
) |
Definition at line 190 of file out.c.
References s2s_st::dns_bad, s2s_st::dns_bad_timeout, DNS_MAX_RESULTS, xhashv::dnsres_val, dnscache_st::expiry, dnsres_st::expiry, dnsres_st::key, log_debug, dnscache_st::name, s2s_st::out_host, s2s_st::out_reuse, dnscache_st::results, xhashv::val, dnsres_st::weight, xhash_getx(), xhash_iter_first(), xhash_iter_get(), xhash_iter_next(), and ZONE.
Referenced by out_route().
void dns_resolve_domain | ( | s2s_t | s2s, |
dnscache_t | dns | ||
) |
Definition at line 1189 of file out.c.
References _dns_result_srv(), dnsquery_st::cur_expiry, dnsquery_st::cur_host, dnsquery_st::cur_port, dnsquery_st::expiry, dnsquery_st::hosts, s2s_st::log, log_debug, log_write(), dnsquery_st::name, dnscache_st::name, out_resolve(), dnsquery_st::query, dnscache_st::query, dnsquery_st::results, dnsquery_st::s2s, dnsquery_st::srv_i, xhash_new(), and ZONE.
Referenced by out_route().
responses from the resolver
Definition at line 1223 of file out.c.
References s2s_st::dns_cache_enabled, s2s_st::dnscache, dnscache_st::expiry, s2s_st::log, log_write(), out_bounce_domain_queues(), out_flush_domain_queues(), dnscache_st::pending, dnscache_st::query, dnscache_st::results, stanza_err_REMOTE_SERVER_NOT_FOUND, xhash_count(), xhash_free(), xhash_get(), and xhash_zap().
Referenced by _dns_result_a(), and dns_resolve_domain().
int out_bounce_domain_queues | ( | s2s_t | s2s, |
const char * | domain, | ||
int | err | ||
) |
Definition at line 1798 of file out.c.
References out_bounce_route_queue(), s2s_st::outq, s2s_route_key_match(), xhash_iter_first(), xhash_iter_get(), and xhash_iter_next().
Referenced by out_resolve().
int out_bounce_route_queue | ( | s2s_t | s2s, |
const char * | rkey, | ||
int | rkeylen, | ||
int | err | ||
) |
Definition at line 1816 of file out.c.
References nad_st::ecur, pkt_st::from, jid_free(), jqueue_free(), jqueue_pull(), _jqueue_st::key, log_debug, pkt_st::nad, NAD_ENS, nad_find_attr(), nad_free(), NAD_NURI, NAD_NURI_L, s2s_st::outq, s2s_st::router, stanza_error(), stanza_tofrom(), sx_nad_write, pkt_st::to, uri_CLIENT, xhash_getx(), xhash_zap(), and ZONE.
Referenced by _out_mio_callback(), _out_result(), _s2s_time_checks(), out_bounce_conn_queues(), out_bounce_domain_queues(), and out_packet().
int out_bounce_conn_queues | ( | conn_t | out, |
int | err | ||
) |
Definition at line 1850 of file out.c.
References out_bounce_route_queue(), conn_st::routes, conn_st::s2s, xhash_iter_first(), xhash_iter_get(), and xhash_iter_next().
Referenced by JABBER_MAIN().
void out_flush_domain_queues | ( | s2s_t | s2s, |
const char * | domain | ||
) |
Definition at line 1867 of file out.c.
References out_flush_route_queue(), s2s_st::outq, xhash_iter_first(), xhash_iter_get(), and xhash_iter_next().
Referenced by out_resolve().
void out_flush_route_queue | ( | s2s_t | s2s, |
const char * | rkey, | ||
int | rkeylen | ||
) |
Definition at line 1885 of file out.c.
References jqueue_free(), jqueue_pull(), jqueue_size(), _jqueue_st::key, log_debug, out_packet(), s2s_st::outq, xhash_getx(), xhash_zap(), and ZONE.
Referenced by _out_mio_callback(), _out_result(), and out_flush_domain_queues().
int in_mio_callback | ( | mio_t | m, |
mio_action_t | a, | ||
mio_fd_t | fd, | ||
void * | data, | ||
void * | arg | ||
) |
Definition at line 63 of file in.c.
References _in_sx_callback(), action_ACCEPT, action_CLOSE, action_READ, action_WRITE, s2s_st::compression, s2s_st::dead, s2s_st::dead_conn, mio_fd_st::fd, conn_st::fd, s2s_st::in, s2s_st::in_accept, in_mio_callback(), INET6_ADDRSTRLEN, conn_st::init_time, conn_st::ip, j_inet_getport(), jqueue_push(), conn_st::key, s2s_st::log, log_debug, log_write(), mio_app, conn_st::online, conn_st::packet_count, conn_st::port, pstrdup(), _sx_st::rbytesmax, conn_st::s, conn_st::s2s, S2S_DB_HEADER, s2s_st::server_fd, s2s_st::stanza_size_limit, conn_st::states, conn_st::states_time, sx_can_read(), sx_can_write(), SX_COMPRESS_OFFER, s2s_st::sx_env, sx_kill(), sx_new(), sx_server_init(), s2s_st::sx_ssl, SX_SSL_STARTTLS_OFFER, xhash_new(), xhash_pool(), xhash_put(), xhash_zap(), and ZONE.
Referenced by in_mio_callback(), and s2s_router_sx_callback().
int s2s_db_init | ( | sx_env_t | env, |
sx_plugin_t | p, | ||
va_list | args | ||
) |
Definition at line 55 of file db.c.
References _s2s_db_features(), _s2s_db_header(), _sx_plugin_st::features, _sx_plugin_st::header, log_debug, and ZONE.
Referenced by JABBER_MAIN().
void out_pkt_free | ( | pkt_t | pkt | ) |
Definition at line 601 of file out.c.
References pkt_st::from, jid_free(), pkt_st::nad, nad_free(), and pkt_st::to.
Referenced by JABBER_MAIN().
sig_atomic_t s2s_lost_router |
Definition at line 30 of file main.c.
Referenced by _s2s_router_connect(), _s2s_signal(), JABBER_MAIN(), and s2s_router_mio_callback().