jabberd2
2.3.3
|
Go to the source code of this file.
Macros | |
#define | _GNU_SOURCE |
#define | EHL_LINE_LEN 260 |
#define | DRA_IP_LEN 16 |
Functions | |
static int | _out_mio_callback (mio_t m, mio_action_t a, mio_fd_t fd, void *data, void *arg) |
mio callback for outgoing conns More... | |
static int | _out_sx_callback (sx_t s, sx_event_t e, void *data, void *arg) |
static void | _out_result (conn_t out, nad_t nad) |
process incoming auth responses More... | |
static void | _out_verify (conn_t out, nad_t nad) |
incoming stream authenticated More... | |
static void | _dns_result_aaaa (struct dns_ctx *ctx, struct dns_rr_a6 *result, void *data) |
static void | _dns_result_a (struct dns_ctx *ctx, struct dns_rr_a4 *result, void *data) |
static void | _out_packet_queue (s2s_t s2s, pkt_t pkt) |
queue the packet More... | |
static void | _out_dialback (conn_t out, const char *rkey, int rkeylen) |
void | _out_dns_mark_bad (conn_t out) |
int | dns_select (s2s_t s2s, char *ip, int *port, time_t now, dnscache_t dns, int allow_bad) |
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... | |
void | out_pkt_free (pkt_t pkt) |
int | out_packet (s2s_t s2s, pkt_t pkt) |
send a packet out More... | |
char * | dns_make_ipport (const char *host, int port) |
static void | _dns_add_result (dnsquery_t query, const char *ip, int port, int prio, int weight, unsigned int ttl) |
static void | _dns_add_host (dnsquery_t query, const char *ip, int port, int prio, int weight, unsigned int ttl) |
static void | _dns_result_srv (struct dns_ctx *ctx, struct dns_rr_srv *result, void *data) |
static int | _etc_hosts_lookup (const char *cszName, char *szIP, const int ciMaxIPLen) |
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 | send_dialbacks (conn_t out) |
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) |
#define EHL_LINE_LEN 260 |
Referenced by _etc_hosts_lookup().
#define DRA_IP_LEN 16 |
Referenced by _dns_result_a().
|
static |
mio callback for outgoing conns
Definition at line 1285 of file out.c.
References _out_dns_mark_bad(), action_ACCEPT, action_CLOSE, action_READ, action_WRITE, conn_INPROGRESS, s2s_st::dead, s2s_st::dead_conn, mio_fd_st::fd, INET6_ADDRSTRLEN, conn_st::ip, jqueue_age(), jqueue_push(), jqueue_size(), conn_st::last_activity, s2s_st::log, log_debug, log_write(), out_bounce_route_queue(), s2s_st::out_dest, out_flush_route_queue(), s2s_st::out_host, s2s_st::out_reuse, out_route(), s2s_st::outq, conn_st::packet_count, conn_st::port, s2s_st::retry_limit, conn_st::routes, conn_st::s, conn_st::s2s, stanza_err_REMOTE_SERVER_TIMEOUT, stanza_err_SERVICE_UNAVAILABLE, conn_st::states, sx_can_read(), sx_can_write(), sx_kill(), xhash_get(), xhash_getx(), xhash_iter_first(), xhash_iter_get(), xhash_iter_next(), xhash_zap(), xhash_zapx(), and ZONE.
Referenced by out_route().
|
static |
Definition at line 1427 of file out.c.
References _out_dns_mark_bad(), _out_result(), _out_verify(), _sx_error_st::code, _sx_buf_st::data, event_CLOSED, event_ERROR, event_OPEN, event_PACKET, event_READ, event_STREAM, event_WANT_READ, event_WANT_WRITE, event_WRITE, mio_fd_st::fd, conn_st::fd, _sx_error_st::generic, conn_st::ip, conn_st::key, _sx_buf_st::len, s2s_st::local_pemfile, s2s_st::local_private_key_password, s2s_st::log, log_debug, log_write(), s2s_st::mio, mio_close, MIO_ERROR, mio_read, MIO_STRERROR, MIO_WOULDBLOCK, mio_write, NAD_ENAME, NAD_ENAME_L, NAD_ENS, nad_find_elem(), nad_find_scoped_namespace(), nad_free(), NAD_NURI, NAD_NURI_L, conn_st::online, s2s_st::packet_count, conn_st::packet_count, conn_st::port, s2s_st::require_tls, _sx_st::res_version, conn_st::s, conn_st::s2s, send_dialbacks(), _sx_error_st::specific, _sx_st::ssf, SX_ERR_STREAM, sx_kill(), s2s_st::sx_ssl, sx_ssl_client_starttls(), uri_DIALBACK, uri_DIALBACK_L, uri_STREAMS, uri_TLS, and ZONE.
Referenced by out_route().
process incoming auth responses
Definition at line 1641 of file out.c.
References _sx_st::compressed, conn_INPROGRESS, conn_VALID, jid_st::domain, mio_fd_st::fd, conn_st::fd, _sx_st::flags, conn_st::ip, jid_free(), jid_new(), s2s_st::log, log_debug, log_write(), NAD_AVAL, NAD_AVAL_L, nad_find_attr(), nad_free(), out_bounce_route_queue(), out_flush_route_queue(), conn_st::port, pstrdup(), conn_st::s, conn_st::s2s, s2s_route_key(), stanza_err_SERVICE_UNAVAILABLE, conn_st::states, stream_err_INVALID_ID, sx_close(), sx_error(), SX_SSL_WRAPPER, xhash_get(), xhash_pool(), xhash_put(), and ZONE.
Referenced by _out_sx_callback().
incoming stream authenticated
Definition at line 1710 of file out.c.
References _sx_st::compressed, conn_INPROGRESS, conn_VALID, jid_st::domain, mio_fd_st::fd, conn_st::fd, _sx_st::flags, s2s_st::in, conn_st::ip, jid_free(), jid_new(), s2s_st::log, log_debug, log_write(), nad_add_namespace(), nad_append_attr(), nad_append_elem(), NAD_AVAL, NAD_AVAL_L, nad_find_attr(), nad_free(), nad_new(), conn_st::port, pstrdup(), conn_st::s, conn_st::s2s, s2s_route_key(), conn_st::states, stream_err_INVALID_ID, sx_close(), sx_error(), sx_nad_write, SX_SSL_WRAPPER, uri_DIALBACK, conn_st::verify, xhash_get(), xhash_getx(), xhash_pool(), xhash_put(), and ZONE.
Referenced by _out_sx_callback().
|
static |
Definition at line 918 of file out.c.
References _dns_add_result(), _dns_result_a(), AF_INET6, dnsquery_st::cur_expiry, dnsquery_st::cur_host, dnsquery_st::cur_port, dnsquery_st::cur_prio, dnsquery_st::cur_weight, INET6_ADDRSTRLEN, log_debug, dnsquery_st::name, dnsquery_st::query, and ZONE.
Referenced by _dns_result_a(), and _dns_result_srv().
|
static |
Definition at line 1042 of file out.c.
References _dns_add_result(), _dns_result_aaaa(), _etc_hosts_lookup(), dnsquery_st::cur_expiry, dnsquery_st::cur_host, dnsquery_st::cur_port, dnsquery_st::cur_prio, dnsquery_st::cur_weight, s2s_st::dns_max_ttl, s2s_st::dns_min_ttl, xhashv::dnsres_val, DRA_IP_LEN, s2s_st::etc_hosts_ttl, dnsquery_st::expiry, dnsres_st::expiry, dnsquery_st::hosts, s2s_st::log, log_debug, log_write(), dnsquery_st::name, out_resolve(), dnsres_st::prio, dnsquery_st::query, s2s_st::resolve_aaaa, dnsquery_st::results, dnsquery_st::s2s, xhashv::val, dnsres_st::weight, xhash_count(), xhash_free(), xhash_iter_first(), xhash_iter_get(), xhash_iter_next(), xhash_iter_zap(), xhash_new(), and ZONE.
Referenced by _dns_result_aaaa(), and _dns_result_srv().
queue the packet
Definition at line 112 of file out.c.
References jid_st::domain, pkt_st::from, jqueue_new(), jqueue_push(), _jqueue_st::key, log_debug, s2s_st::outq, s2s_route_key(), pkt_st::to, xhash_get(), xhash_put(), and ZONE.
Referenced by out_packet().
|
static |
Definition at line 130 of file out.c.
References conn_INPROGRESS, mio_fd_st::fd, conn_st::fd, _sx_st::id, conn_st::ip, s2s_st::local_secret, s2s_st::log, log_debug, log_write(), nad_add_namespace(), nad_append_cdata(), nad_append_elem(), nad_new(), nad_set_attr(), conn_st::port, pstrdupx(), conn_st::s, conn_st::s2s, s2s_db_key(), conn_st::states, conn_st::states_time, sx_nad_write, uri_DIALBACK, xhash_pool(), xhash_put(), and ZONE.
Referenced by out_packet(), and send_dialbacks().
void _out_dns_mark_bad | ( | conn_t | out | ) |
Definition at line 173 of file out.c.
References s2s_st::dns_bad, s2s_st::dns_bad_timeout, dns_make_ipport(), dnsres_st::expiry, conn_st::ip, dnsres_st::key, conn_st::port, conn_st::s2s, xhash_get(), and xhash_put().
Referenced by _out_mio_callback(), _out_sx_callback(), 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().
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().
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().
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().
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().
|
static |
Definition at line 736 of file out.c.
References dns_make_ipport(), DNS_MAX_RESULTS, dnsquery_st::expiry, dnsres_st::expiry, dnsres_st::key, log_debug, dnsquery_st::name, pmalloc(), dnsres_st::prio, pstrdup(), dnsquery_st::results, dnsres_st::weight, xhash_count(), xhash_get(), xhash_pool(), xhash_put(), and ZONE.
Referenced by _dns_result_a(), and _dns_result_aaaa().
|
static |
Definition at line 784 of file out.c.
References dns_make_ipport(), DNS_MAX_RESULTS, dnsres_st::expiry, dnsquery_st::hosts, dnsres_st::key, log_debug, dnsquery_st::name, pmalloc(), dnsres_st::prio, pstrdup(), dnsres_st::weight, xhash_count(), xhash_get(), xhash_pool(), xhash_put(), and ZONE.
Referenced by _dns_result_srv().
|
static |
Definition at line 839 of file out.c.
References _dns_add_host(), _dns_result_a(), _dns_result_aaaa(), dnsquery_st::cur_expiry, dnsquery_st::cur_host, dnsquery_st::cur_port, dnsquery_st::cur_prio, dnsquery_st::cur_weight, dnsquery_st::hosts, log_debug, s2s_st::lookup_nsrv, s2s_st::lookup_srv, dnsquery_st::name, dnsquery_st::query, s2s_st::resolve_aaaa, dnsquery_st::s2s, dnsquery_st::srv_i, xhash_count(), and ZONE.
Referenced by dns_resolve_domain().
|
static |
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().
void send_dialbacks | ( | conn_t | out | ) |
Definition at line 1400 of file out.c.
References _out_dialback(), s2s_st::dns_bad, s2s_st::dns_bad_timeout, conn_st::key, dnsres_st::key, log_debug, conn_st::routes, conn_st::s2s, xhash_get(), xhash_iter_first(), xhash_iter_get(), xhash_iter_next(), xhash_zap(), and ZONE.
Referenced by _out_sx_callback().
int out_bounce_domain_queues | ( | s2s_t | s2s, |
const char * | domain, | ||
int | err | ||
) |
Definition at line 1796 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 1814 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 1848 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 1865 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 1883 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().