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