jabberd2
2.2.16
|
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... | |
Defines | |
#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 | |
int | s2s_domain_in_whitelist (s2s_t s2s, char *in_domain) |
char * | s2s_route_key (pool_t p, char *local, char *remote) |
generate a local/remote route key | |
int | s2s_route_key_match (char *local, char *remote, char *rkey, int rkeylen) |
match route key - used for searching route hash | |
char * | s2s_db_key (pool_t p, char *secret, char *remote, char *id) |
generate a dialback key | |
char * | dns_make_ipport (char *host, int port) |
int | out_packet (s2s_t s2s, pkt_t pkt) |
send a packet out | |
int | out_route (s2s_t s2s, char *route, int routelen, conn_t *out, int allow_bad) |
find/make a connection for a route | |
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, char *domain, xht results, time_t expiry) |
responses from the resolver | |
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, 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, 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 274 of file s2s.h.
Referenced by dns_select(), _dns_add_result(), and _dns_add_host().
#define S2S_DB_HEADER (1<<10) |
Definition at line 373 of file s2s.h.
Referenced by _s2s_db_header(), in_mio_callback(), and out_route().
#define MAX_DOMAIN_LEN 1023 |
Definition at line 376 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_READ, log_debug, ZONE, mio_fd_st::fd, sx_kill(), s2s_st::router, sx_can_read(), action_WRITE, sx_can_write(), action_CLOSE, log_write(), s2s_st::log, s2s_lost_router, s2s_st::online, and action_ACCEPT.
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 event_WANT_READ, log_debug, ZONE, mio_read, s2s_st::mio, s2s_st::fd, event_WANT_WRITE, mio_write, event_READ, mio_fd_st::fd, _sx_buf_st::data, _sx_buf_st::len, MIO_WOULDBLOCK, log_write(), s2s_st::log, MIO_STRERROR, MIO_ERROR, sx_kill(), event_WRITE, event_ERROR, _sx_error_st::generic, _sx_error_st::specific, _sx_error_st::code, SX_ERR_AUTH, sx_close(), event_STREAM, event_OPEN, s2s_st::retry_left, s2s_st::retry_lost, nad_new(), nad_add_namespace(), uri_COMPONENT, nad_append_elem(), nad_append_attr(), s2s_st::id, s2s_st::router_default, sx_nad_write, s2s_st::router, event_PACKET, NAD_ENS, nad_free(), _sx_st::state, state_STREAM, NAD_NURI_L, uri_STREAMS, NAD_NURI, NAD_ENAME_L, NAD_ENAME, s2s_st::sx_ssl, s2s_st::router_pemfile, _sx_st::ssf, nad_find_scoped_namespace(), uri_TLS, nad_find_elem(), sx_ssl_client_starttls(), sx_sasl_auth(), s2s_st::sx_sasl, s2s_st::router_user, s2s_st::router_pass, state_OPEN, s2s_st::online, nad_find_attr(), NAD_AVAL_L, NAD_AVAL, s2s_st::server_fd, s2s_st::local_port, mio_listen, s2s_st::local_ip, in_mio_callback(), s2s_st::started, stanza_err_REMOTE_SERVER_NOT_FOUND, _stanza_errors, _stanza_error_st::code, stanza_err_BAD_REQUEST, stanza_tofrom(), stanza_error(), nad_set_attr(), pkt_st::nad, pkt_st::from, jid_new(), pkt_st::to, uri_DIALBACK_L, uri_DIALBACK, pkt_st::db, out_packet(), event_CLOSED, and mio_close.
Referenced by _s2s_router_connect().
int s2s_domain_in_whitelist | ( | s2s_t | s2s, |
char * | in_domain | ||
) |
Definition at line 652 of file main.c.
References MAX_DOMAIN_LEN, log_write(), s2s_st::log, s2s_st::n_whitelist_domains, s2s_st::whitelist_domains, log_debug, and ZONE.
Referenced by _in_sx_callback(), and out_packet().
char* s2s_route_key | ( | pool_t | p, |
char * | local, | ||
char * | remote | ||
) |
generate a local/remote route key
Definition at line 27 of file util.c.
References pmalloc().
Referenced by _in_result(), _in_packet(), _out_packet_queue(), out_packet(), _out_result(), and _out_verify().
int s2s_route_key_match | ( | char * | local, |
char * | remote, | ||
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, |
char * | secret, | ||
char * | remote, | ||
char * | id | ||
) |
generate a dialback key
Definition at line 61 of file util.c.
References _sx_debug, ZONE, shahash_r(), and pstrdup().
Referenced by _in_verify(), and _out_dialback().
char* dns_make_ipport | ( | char * | host, |
int | port | ||
) |
Definition at line 732 of file out.c.
Referenced by _s2s_time_checks(), _out_dns_mark_bad(), _dns_add_result(), and _dns_add_host().
send a packet out
Definition at line 615 of file out.c.
References s2s_st::enable_whitelist, pkt_st::to, jid_st::domain, s2s_domain_in_whitelist(), log_write(), s2s_st::log, jid_free(), pkt_st::from, pkt_st::nad, nad_free(), s2s_route_key(), out_route(), _out_packet_queue(), out_bounce_route_queue(), stanza_err_SERVICE_UNAVAILABLE, conn_st::online, log_debug, ZONE, xhash_get(), conn_st::states, conn_VALID, pkt_st::db, conn_st::fd, mio_fd_st::fd, NAD_ENAME_L, NAD_ENAME, conn_st::verify, conn_st::last_verify, sx_nad_write, conn_st::s, nad_find_namespace(), uri_CLIENT, nad_st::elems, nad_elem_st::ns, nad_elem_st::my_ns, sx_nad_write_elem(), conn_st::last_packet, conn_INPROGRESS, conn_st::s2s, s2s_st::require_tls, _sx_st::ssf, and _out_dialback().
Referenced by s2s_router_sx_callback(), _in_result(), and out_flush_route_queue().
find/make a connection for a route
Definition at line 411 of file out.c.
References INET6_ADDRSTRLEN, log_debug, ZONE, xhash_get(), s2s_st::out_dest, s2s_st::dnscache, dnscache_st::name, xhash_put(), dnscache_st::pending, dnscache_st::expiry, dnscache_st::init_time, dns_resolve_domain(), dns_select(), s2s_st::out_reuse, s2s_st::out_host, log_write(), s2s_st::log, pstrdup(), xhash_pool(), conn_st::s2s, xhash_new(), pstrdupx(), s2s_st::origin_nips, s2s_st::origin_ips, mio_connect, s2s_st::mio, _out_mio_callback(), MIO_STRERROR, MIO_ERROR, _out_dns_mark_bad(), xhash_zap(), xhash_free(), out_route(), sx_new(), s2s_st::sx_env, _out_sx_callback(), s2s_st::sx_ssl, sx_client_init(), S2S_DB_HEADER, uri_SERVER, and xhash_getx().
Referenced by out_route(), out_packet(), and _out_mio_callback().
int dns_select | ( | s2s_t | s2s, |
char * | ip, | ||
int * | port, | ||
time_t | now, | ||
dnscache_t | dns, | ||
int | allow_bad | ||
) |
Definition at line 195 of file out.c.
References DNS_MAX_RESULTS, dnscache_st::results, log_debug, ZONE, dnscache_st::name, xhashv::dnsres_val, xhash_iter_first(), xhash_iter_get(), xhashv::val, s2s_st::dns_bad_timeout, xhash_getx(), s2s_st::dns_bad, dnsres_st::expiry, s2s_st::out_reuse, s2s_st::out_host, dnsres_st::weight, xhash_iter_next(), dnsres_st::key, and dnscache_st::expiry.
Referenced by out_route().
void dns_resolve_domain | ( | s2s_t | s2s, |
dnscache_t | dns | ||
) |
Definition at line 1194 of file out.c.
References dnsquery_st::s2s, dnsquery_st::results, xhash_new(), dnscache_st::name, dnsquery_st::name, log_write(), s2s_st::log, dnsquery_st::expiry, out_resolve(), dnsquery_st::hosts, dnsquery_st::srv_i, dnsquery_st::cur_host, dnsquery_st::cur_port, dnsquery_st::cur_expiry, dnsquery_st::query, dnscache_st::query, log_debug, ZONE, and _dns_result_srv().
Referenced by out_route().
responses from the resolver
Definition at line 1226 of file out.c.
References xhash_count(), xhash_get(), s2s_st::dnscache, xhash_free(), dnscache_st::results, dnscache_st::query, dnscache_st::expiry, dnscache_st::pending, log_write(), s2s_st::log, out_bounce_domain_queues(), stanza_err_REMOTE_SERVER_NOT_FOUND, out_flush_domain_queues(), s2s_st::dns_cache_enabled, 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 1799 of file out.c.
References xhash_iter_first(), s2s_st::outq, xhash_iter_get(), s2s_route_key_match(), out_bounce_route_queue(), and xhash_iter_next().
Referenced by out_resolve().
int out_bounce_route_queue | ( | s2s_t | s2s, |
char * | rkey, | ||
int | rkeylen, | ||
int | err | ||
) |
Definition at line 1817 of file out.c.
References xhash_getx(), s2s_st::outq, jqueue_pull(), pkt_st::nad, nad_st::ecur, NAD_NURI_L, NAD_ENS, uri_CLIENT, NAD_NURI, nad_find_attr(), sx_nad_write, s2s_st::router, stanza_tofrom(), stanza_error(), nad_free(), jid_free(), pkt_st::to, pkt_st::from, log_debug, ZONE, _jqueue_st::key, jqueue_free(), and xhash_zap().
Referenced by _s2s_time_checks(), out_packet(), _out_mio_callback(), _out_result(), out_bounce_domain_queues(), and out_bounce_conn_queues().
int out_bounce_conn_queues | ( | conn_t | out, |
int | err | ||
) |
Definition at line 1851 of file out.c.
References xhash_iter_first(), conn_st::routes, xhash_iter_get(), out_bounce_route_queue(), conn_st::s2s, and xhash_iter_next().
Referenced by JABBER_MAIN().
void out_flush_domain_queues | ( | s2s_t | s2s, |
const char * | domain | ||
) |
Definition at line 1868 of file out.c.
References xhash_iter_first(), s2s_st::outq, xhash_iter_get(), out_flush_route_queue(), and xhash_iter_next().
Referenced by out_resolve().
void out_flush_route_queue | ( | s2s_t | s2s, |
char * | rkey, | ||
int | rkeylen | ||
) |
Definition at line 1886 of file out.c.
References xhash_getx(), s2s_st::outq, jqueue_size(), log_debug, ZONE, jqueue_pull(), out_packet(), _jqueue_st::key, jqueue_free(), and xhash_zap().
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 INET6_ADDRSTRLEN, action_READ, log_debug, ZONE, mio_fd_st::fd, sx_kill(), conn_st::s, sx_can_read(), action_WRITE, sx_can_write(), action_CLOSE, s2s_st::server_fd, log_write(), conn_st::s2s, s2s_st::log, conn_st::ip, conn_st::port, conn_st::packet_count, jqueue_push(), s2s_st::dead, conn_st::online, xhash_zap(), s2s_st::in, conn_st::key, s2s_st::in_accept, s2s_st::dead_conn, action_ACCEPT, j_inet_getport(), xhash_new(), sx_new(), s2s_st::sx_env, _in_sx_callback(), mio_app, in_mio_callback(), s2s_st::stanza_size_limit, xhash_put(), pstrdup(), xhash_pool(), S2S_DB_HEADER, s2s_st::sx_ssl, SX_SSL_STARTTLS_OFFER, s2s_st::compression, SX_COMPRESS_OFFER, and sx_server_init().
Referenced by s2s_router_sx_callback(), and in_mio_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 log_debug, ZONE, _sx_plugin_st::header, _s2s_db_header(), _sx_plugin_st::features, and _s2s_db_features().
Referenced by JABBER_MAIN().
void out_pkt_free | ( | pkt_t | pkt | ) |
Definition at line 606 of file out.c.
References nad_free(), pkt_st::nad, jid_free(), pkt_st::from, and pkt_st::to.
Referenced by JABBER_MAIN().
sig_atomic_t s2s_lost_router |
Definition at line 26 of file main.c.
Referenced by _s2s_signal(), _s2s_router_connect(), JABBER_MAIN(), and s2s_router_mio_callback().