108 static void _dns_result_aaaa(
struct dns_ctx *ctx,
struct dns_rr_a6 *result,
void *data);
109 static void _dns_result_a(
struct dns_ctx *ctx,
struct dns_rr_a4 *result,
void *data);
117 log_debug(
ZONE,
"creating new out packet queue for '%s'", rkey);
131 char *c, *dbkey, *tmp;
134 int from_len, to_len;
139 c = memchr(rkey,
'/', rkeylen);
142 to_len = rkeylen - (c - rkey);
145 tmp = strndup(c, to_len);
158 log_debug(
ZONE,
"sending auth request for %.*s (key %s)", rkeylen, rkey, dbkey);
159 log_write(out->
s2s->
log, LOG_NOTICE,
"[%d] [%s, port=%d] sending dialback auth request for route '%.*s'", out->
fd->
fd, out->
ip, out->
port, rkeylen, rkey);
200 int s_reuse = 0, s_aaaa = 0, s_a = 0, s_bad = 0;
201 int p_reuse = 0, p_aaaa = 0, p_a = 0;
202 int wt_reuse = 0, wt_aaaa = 0, wt_a = 0;
203 int c_expired_good = 0;
236 if (now > res->expiry) {
243 }
else if (bad != NULL && !(now > bad->
expiry)) {
245 l_bad[s_bad++] = res;
251 if (s_reuse == 0 || p_reuse > res->prio) {
256 log_debug(
ZONE,
"reset prio list, using prio %d", res->prio);
258 if (res->prio <= p_reuse) {
259 l_reuse[s_reuse] = res;
261 rw_reuse[s_reuse] = wt_reuse;
264 log_debug(
ZONE,
"added host with weight %d (%d), running weight %d",
265 (res->weight >> 8), res->weight, wt_reuse);
269 }
else if (memchr(ipport,
':', ipport_len) != NULL) {
272 if (s_aaaa == 0 || p_aaaa > res->prio) {
277 log_debug(
ZONE,
"reset prio list, using prio %d", res->prio);
279 if (res->prio <= p_aaaa) {
280 l_aaaa[s_aaaa] = res;
282 rw_aaaa[s_aaaa] = wt_aaaa;
285 log_debug(
ZONE,
"added host with weight %d (%d), running weight %d",
286 (res->weight >> 8), res->weight, wt_aaaa);
293 if (s_a == 0 || p_a > res->prio) {
298 log_debug(
ZONE,
"reset prio list, using prio %d", res->prio);
300 if (res->prio <= p_a) {
306 log_debug(
ZONE,
"added host with weight %d (%d), running weight %d",
307 (res->weight >> 8), res->weight, wt_a);
323 log_debug(
ZONE,
"using existing hosts, total weight %d", wt_reuse);
324 assert((wt_reuse + 1) > 0);
326 r = rand() % (wt_reuse + 1);
329 for (i = 0; i < s_reuse; i++)
330 if (rw_reuse[i] >= r) {
332 l_reuse[i]->key, rw_reuse[i]);
334 ipport = l_reuse[i]->
key;
337 }
else if (s_aaaa > 0 && (s_a == 0 || p_aaaa <= p_a)) {
340 log_debug(
ZONE,
"using IPv6 hosts, total weight %d", wt_aaaa);
341 assert((wt_aaaa + 1) > 0);
343 r = rand() % (wt_aaaa + 1);
346 for (i = 0; i < s_aaaa; i++)
347 if (rw_aaaa[i] >= r) {
349 l_aaaa[i]->key, rw_aaaa[i]);
351 ipport = l_aaaa[i]->
key;
354 }
else if (s_a > 0) {
358 assert((wt_a + 1) > 0);
360 r = rand() % (wt_a + 1);
363 for (i = 0; i < s_a; i++)
366 l_a[i]->key, rw_a[i]);
368 ipport = l_a[i]->
key;
371 }
else if (s_bad > 0) {
372 ipport = l_bad[rand() % s_bad]->
key;
377 if (c_expired_good > 0) {
378 log_debug(
ZONE,
"expiring this DNS cache entry, %d expired hosts",
389 assert(ipport != NULL);
392 ipport_len = strlen(ipport);
393 c = strchr(ipport,
'/');
394 strncpy(ip, ipport, c-ipport);
397 c_len = ipport_len - (c - ipport);
398 tmp = strndup(c, c_len);
412 int port, c_len, from_len;
414 c = memchr(route,
'/', routelen);
415 from_len = c - route;
417 c_len = routelen - (c - route);
418 dkey = strndup(c, c_len);
429 log_debug(
ZONE,
"no dns for %s, preparing for resolution", dkey);
433 strcpy(dns->
name, dkey);
440 strcpy(dns->ip,
"127.0.0.1");
442 dns->
expiry = time(NULL) + 99999999;
468 if (
dns_select(s2s, ip, &port, now, dns, allow_bad)) {
496 log_write(s2s->
log, LOG_NOTICE,
"[%d] [%s, port=%d] using connection for '%s'", (*out)->fd->fd, (*out)->ip, (*out)->port, dkey);
508 (*out)->key = strdup(ipport);
514 strcpy((*out)->ip, ip);
522 (*out)->init_time = time(NULL);
535 if (strchr(ip,
':') != NULL)
540 if ((ip_is_v6 && (strchr(s2s->
origin_ips[i],
':') != NULL)) ||
541 (! ip_is_v6 && (strchr(s2s->
origin_ips[i],
':') == NULL)))
544 if ((*out)->fd != NULL)
break;
547 if ((*out)->fd == NULL) {
561 free((
void*)(*out)->key);
562 free((
void*)(*out)->dkey);
567 return out_route(s2s, route, routelen, out, 0);
569 log_write(s2s->
log, LOG_NOTICE,
"[%d] [%s, port=%d] outgoing connection for '%s'", (*out)->fd->fd, (*out)->ip, (*out)->port, dkey);
588 log_debug(
ZONE,
"connection for '%s' found (%d %s/%d)", dkey, (*out)->fd->fd, (*out)->ip, (*out)->port);
592 if (!(*out)->online || reuse) {
593 if (
xhash_getx((*out)->routes, route, routelen) == NULL)
621 log_write(s2s->
log, LOG_NOTICE,
"sending a packet to domain not in the whitelist, dropping it");
624 if (pkt->
from != NULL)
626 if (pkt->
nad != NULL)
635 rkeylen = strlen(rkey);
638 ret =
out_route(s2s, rkey, rkeylen, &out, 1);
729 assert(port > 0 && port < 65536);
731 c = (
char *) malloc(strlen(host) + 7);
732 sprintf(c,
"%s/%d", host, port);
741 if (prio < res->prio)
744 if (prio < res->prio) {
747 }
else if (prio == res->
prio) {
750 if (res->
weight > (65535 << 8))
751 res->
weight = (65535 << 8);
760 log_debug(
ZONE,
"dns result updated for %s@%p: %s (%d/%d/%d)", query->
name, query, ipport,
774 log_debug(
ZONE,
"dns result added for %s@%p: %s (%d/%d/%d)", query->
name, query, ipport,
777 log_debug(
ZONE,
"dns result ignored for %s@%p: %s (%d/%d/%d)", query->
name, query, ipport,
778 prio, (weight >> 8), ttl);
801 if (prio < res->prio)
804 if (prio < res->prio) {
807 }
else if (prio == res->
prio) {
810 if (res->
weight > (65535 << 8))
811 res->
weight = (65535 << 8);
817 log_debug(
ZONE,
"dns host updated for %s@%p: %s (%d/%d/%d)", query->
name, query, ipport,
828 log_debug(
ZONE,
"dns host added for %s@%p: %s (%d/%d/%d)", query->
name, query, ipport,
831 log_debug(
ZONE,
"dns host ignored for %s@%p: %s (%d/%d/%d)", query->
name, query, ipport,
832 prio, (weight >> 8), ttl);
839 static void _dns_result_srv(
struct dns_ctx *ctx,
struct dns_rr_srv *result,
void *data) {
841 assert(query != NULL);
844 if (ctx != NULL && result == NULL) {
847 }
else if (result != NULL) {
851 result->dnssrv_qname, result->dnssrv_nrr, result->dnssrv_ttl);
853 for (i = 0; i < result->dnssrv_nrr; i++) {
854 if (strlen(result->dnssrv_srv[i].name) > 0
855 && result->dnssrv_srv[i].port > 0
856 && result->dnssrv_srv[i].port < 65536) {
858 query, result->dnssrv_qname, i,
859 result->dnssrv_srv[i].
name, result->dnssrv_srv[i].port,
860 result->dnssrv_srv[i].priority, result->dnssrv_srv[i].weight);
863 result->dnssrv_srv[i].port, result->dnssrv_srv[i].priority,
864 result->dnssrv_srv[i].weight, result->dnssrv_ttl);
881 if (query->
query == NULL)
898 query->
query = dns_submit_a6(NULL, query->
name,
902 if (query->
query == NULL)
907 query->
query = dns_submit_a4(NULL, query->
name,
911 if (query->
query == NULL)
922 assert(query != NULL);
925 if (ctx != NULL && result == NULL) {
928 }
else if (result != NULL) {
930 result->dnsa6_qname, result->dnsa6_nrr, result->dnsa6_ttl);
935 for (i = 0; i < result->dnsa6_nrr; i++) {
938 query, result->dnsa6_qname, i, ip, query->
cur_port);
954 if (query->
query == NULL)
958 log_debug(
ZONE,
"dns result for %s@%p: AAAA host vanished...", query->
name, query);
967 #define EHL_LINE_LEN 260
971 char *pcStart, *pcEnd;
979 if ((cszName == NULL) || (szIP == NULL) || (ciMaxIPLen <= 0))
985 pcStart = getenv(
"WINDIR");
986 if (pcStart != NULL) {
987 sprintf(szLine,
"%s\\system32\\drivers\\etc\\hosts", pcStart);
989 strcpy(szLine,
"C:\\WINDOWS\\system32\\drivers\\etc\\hosts");
992 strcpy(szLine,
"/etc/hosts");
994 fHosts = fopen(szLine,
"r");
1001 pcStart = strchr (szLine,
'#');
1002 if (pcStart != NULL)
1004 strcat(szLine,
" ");
1007 iLen = strspn(szLine,
"1234567890.");
1008 if ((iLen < 7) || (iLen > 15))
1010 pcEnd = szLine + iLen;
1015 pcStart = pcEnd + strspn(pcEnd,
" \t\n");
1016 while (*pcStart != 0) {
1017 pcEnd = pcStart + strcspn(pcStart,
" \t\n");
1021 if (strcasecmp(pcStart, cszName) == 0) {
1022 strncpy(szIP, szLine, ciMaxIPLen - 1);
1023 szIP[ciMaxIPLen - 1] =
'\0';
1028 pcStart = pcEnd + strspn(pcEnd,
" \t\n");
1042 static void _dns_result_a(
struct dns_ctx *ctx,
struct dns_rr_a4 *result,
void *data) {
1044 assert(query != NULL);
1045 query->
query = NULL;
1047 if (ctx != NULL && result == NULL) {
1048 #define DRA_IP_LEN 16
1060 }
else if (result != NULL) {
1061 char ip[INET_ADDRSTRLEN];
1065 query, result->dnsa4_qname, result->dnsa4_nrr, result->dnsa4_ttl);
1070 for (i = 0; i < result->dnsa4_nrr; i++) {
1071 if (inet_ntop(AF_INET, &result->dnsa4_addr[i], ip, INET_ADDRSTRLEN) != NULL) {
1073 query, result->dnsa4_qname, i, ip, query->
cur_port);
1085 char *ipport, *c, *tmp;
1086 int ipport_len, ip_len, port_len;
1098 c = memchr(ipport,
'/', ipport_len);
1099 ip_len = c - ipport;
1101 port_len = ipport_len - (c - ipport);
1105 query->
cur_host = strndup(ipport, ip_len);
1106 tmp = strndup(c, port_len);
1120 if (query->
query == NULL)
1128 if (query->
query == NULL)
1134 time_t now = time(NULL);
1173 query->
hosts = NULL;
1174 if (idna_to_unicode_8z8z(query->
name, &domain, 0) != IDNA_SUCCESS) {
1179 query->
expiry = time(NULL) + 99999999;
1180 domain = strdup(query->
name);
1184 free((
void*)query->
name);
1195 if (idna_to_ascii_8z(dns->
name, &name, 0) != IDNA_SUCCESS) {
1198 query->
expiry = time(NULL) + 99999999;
1209 query->
query = NULL;
1238 log_write(s2s->
log, LOG_NOTICE,
"dns lookup for %s failed", domain);
1247 log_write(s2s->
log, LOG_NOTICE,
"dns lookup for %s returned %d result%s (ttl %d)",
1256 if (idna_to_ascii_8z(domain, &punydomain, 0) == IDNA_SUCCESS) {
1263 log_write(s2s->
log, LOG_ERR,
"weird, never requested %s resolution", domain);
1297 ioctl(fd->
fd, FIONREAD, &nbytes);
1337 c = memchr(rkey,
'/', rkeylen);
1339 c_len = rkeylen - (c - rkey);
1343 log_debug(
ZONE,
"removing dest entry for '%.*s'", c_len, c);
1361 log_write(out->
s2s->
log, LOG_NOTICE,
"[%d] [%s, port=%d] retry limit reached for '%.*s' queue", fd->
fd, out->
ip, out->
port, rkeylen, rkey);
1368 log_debug(
ZONE,
"retrying connection for '%.*s' queue", rkeylen, rkey);
1372 if (retry != NULL) {
1411 free((
void*)bad->
key);
1430 int len, ns, elem, starttls = 0;
1510 (strstr(sxe->
specific,
"host-gone") ||
1511 strstr(sxe->
specific,
"host-unknown") ||
1512 strstr(sxe->
specific,
"not-authorized") ||
1513 strstr(sxe->
specific,
"see-other-host") ||
1514 strstr(sxe->
specific,
"system-shutdown") ||
1515 strstr(sxe->
specific,
"policy-violation") ||
1516 strstr(sxe->
specific,
"remote-connection-failed") ||
1517 strstr(sxe->
specific,
"unsupported-encoding") ||
1518 strstr(sxe->
specific,
"undefined-condition") ||
1519 strstr(sxe->
specific,
"internal-server-error") ||
1520 strstr(sxe->
specific,
"unsupported-version")
1544 log_debug(
ZONE,
"no stream version, sending dialbacks for %s immediately", out->
key);
1548 log_debug(
ZONE,
"outgoing conn to %s - waiting for STREAM features", out->
key);
1580 log_write(out->
s2s->
log, LOG_ERR,
"unable to establish encrypted session with peer");
1592 log_debug(
ZONE,
"No STARTTLS, dialbacks disabled for non-TLS connections, cannot complete negotiation");
1606 log_debug(
ZONE,
"got a non-dialback packet on an outgoing conn, dropping it");
1613 if(strncmp(
"result",
NAD_ENAME(nad, 0), 6) == 0) {
1618 if(strncmp(
"verify",
NAD_ENAME(nad, 0), 6) == 0) {
1630 if (out->
fd != NULL) {
1649 log_debug(
ZONE,
"missing or invalid from on db result packet");
1656 log_debug(
ZONE,
"missing or invalid to on db result packet");
1663 rkeylen = strlen(rkey);
1667 log_write(out->
s2s->
log, LOG_NOTICE,
"[%d] [%s, port=%d] outgoing route '%s' is now valid%s%s", out->
fd->
fd, out->
ip, out->
port, rkey, (out->
s->
flags &
SX_SSL_WRAPPER) ?
", TLS negotiated" :
"", out->
s->
compressed ?
", ZLIB compression enabled" :
"");
1687 log_write(out->
s2s->
log, LOG_NOTICE,
"[%d] [%s, port=%d] outgoing route '%s' is now invalid", out->
fd->
fd, out->
ip, out->
port, rkey);
1719 log_debug(
ZONE,
"missing or invalid from on db verify packet");
1726 log_debug(
ZONE,
"missing or invalid to on db verify packet");
1756 log_write(in->
s2s->
log, LOG_NOTICE,
"[%d] [%s, port=%d] incoming route '%s' is now valid%s%s", in->
fd->
fd, in->
ip, in->
port, rkey, (in->
s->
flags &
SX_SSL_WRAPPER) ?
", TLS negotiated" :
"", in->
s->
compressed ?
", ZLIB compression enabled" :
"");
1759 log_write(in->
s2s->
log, LOG_NOTICE,
"[%d] [%s, port=%d] incoming route '%s' is now invalid", in->
fd->
fd, in->
ip, in->
port, rkey);
1826 if(pkt->
nad->
ecur > 1 &&
NAD_NURI_L(pkt->
nad,
NAD_ENS(pkt->
nad, 1)) == strlen(
uri_CLIENT) && strncmp(
NAD_NURI(pkt->
nad,
NAD_ENS(pkt->
nad, 1)),
uri_CLIENT, strlen(
uri_CLIENT)) == 0 &&
nad_find_attr(pkt->
nad, 0, -1,
"error", NULL) < 0) {
1839 log_debug(
ZONE,
"deleting out packet queue for %.*s", rkeylen, rkey);
1874 c = memchr(rkey,
'/', rkeylen);
1876 c_len = rkeylen - (c - rkey);
1877 if (strncmp(domain, c, c_len) == 0)
1893 log_debug(
ZONE,
"flushing %d packets for '%.*s' to out_packet", npkt, rkeylen, rkey);
1895 for(i = 0; i < npkt; i++) {
1910 log_debug(
ZONE,
"deleting out packet queue for '%.*s'", rkeylen, rkey);
#define INET6_ADDRSTRLEN
maximum length of the string representation of an IPv6 address
struct nad_elem_st * elems
void out_flush_domain_queues(s2s_t s2s, const char *domain)
nad_t nad_new(void)
create a new nad
int nad_append_attr(nad_t nad, int ns, const char *name, const char *val)
attach new attr to the last elem
static void _out_dialback(conn_t out, const char *rkey, int rkeylen)
unsigned int packet_count
char ip[INET6_ADDRSTRLEN+1]
sx_t router
router's conn
#define sx_nad_write(s, nad)
static void _dns_add_result(dnsquery_t query, const char *ip, int port, int prio, int weight, unsigned int ttl)
void * pmalloc(pool_t p, int size)
void sx_nad_write_elem(sx_t s, nad_t nad, int elem)
app version
time_t expiry
time that this entry expires
void send_dialbacks(conn_t out)
jid_t jid_new(const char *id, int len)
make a new jid
xht hosts
srv lookup results (key host/port)
void out_resolve(s2s_t s2s, const char *domain, xht results, time_t expiry)
responses from the resolver
int nad_find_elem(nad_t nad, int elem, int ns, const char *name, int depth)
locate the next elem at a given depth with an optional matching name
jqueue_t dead
list of sx_t on the way out
struct dnsres_st * dnsres_t
void * xhash_getx(xht h, const char *key, int len)
int jqueue_size(jqueue_t q)
void nad_append_cdata(nad_t nad, const char *cdata, int len, int depth)
append new cdata to the last elem
#define stream_err_INVALID_ID
void log_write(log_t log, int level, const char *msgfmt,...)
void xhash_iter_zap(xht h)
error info for event_ERROR
sx_t sx_new(sx_env_t env, int tag, sx_callback_t cb, void *arg)
const char ** lookup_srv
srvs to lookup
int verify
number and last timestamp of outstanding db:verify requests
time_t expiry
time that all entries expire
int nad_add_namespace(nad_t nad, const char *uri, const char *prefix)
bring a new namespace into scope
static void _out_packet_queue(s2s_t s2s, pkt_t pkt)
queue the packet
int srv_i
srv lookup index
xht states
states of outgoing dialbacks (key is local/remote)
int out_bounce_route_queue(s2s_t s2s, const char *rkey, int rkeylen, int err)
void out_pkt_free(pkt_t pkt)
mio_action_t
these are the actions and a handler type assigned by the applicaiton using mio
int nad_append_elem(nad_t nad, int ns, const char *name, int depth)
create a new elem on the list
xht outq
queues of packets waiting to go out (key is route)
void nad_free(nad_t nad)
free that nad
time_t expiry
time that this entry expires
xht out_host
outgoing conns (key is ip/port)
int xhash_iter_next(xht h)
long long int packet_count
packet counter
#define mio_connect(m, port, hostip, srcip, app, arg)
for creating a new socket connected to this ip:port (returns new fd or <0, use mio_read/write first) ...
xht dnscache
dns resolution cache
int cur_port
current host lookup port
xht out_dest
outgoing conns (key is dest)
xht routes
routes that this conn handles (key is local/remote)
static int _out_sx_callback(sx_t s, sx_event_t e, void *data, void *arg)
#define mio_read(m, fd)
process read events for this fd
static void _dns_add_host(dnsquery_t query, const char *ip, int port, int prio, int weight, unsigned int ttl)
void jqueue_free(jqueue_t q)
xht dns_bad
dns resolution bad host cache
void dns_resolve_domain(s2s_t s2s, dnscache_t dns)
void nad_set_attr(nad_t nad, int elem, int ns, const char *name, const char *val, int vallen)
create, update, or zap any matching attr on this elem
#define MIO_ERROR
all MIO related routines should use those for error reporting
char * s2s_route_key(pool_t p, const char *local, const char *remote)
generate a local/remote route key
sx_env_t sx_env
sx environment
#define stanza_err_REMOTE_SERVER_TIMEOUT
int sx_can_read(sx_t s)
we can read
int etc_hosts_ttl
/etc/hosts ttl limits
int pending
set when we're waiting for a resolve response
holds the state for a single stream
jid_t from
packet addressing (not used for routing)
char * s2s_db_key(pool_t p, const char *secret, const char *remote, const char *id)
generate a dialback key
packet summary data wrapper
void sx_client_init(sx_t s, unsigned int flags, const char *ns, const char *to, const char *from, const char *version)
static void _dns_result_a(struct dns_ctx *ctx, struct dns_rr_a4 *result, void *data)
#define NAD_ENAME_L(N, E)
void jqueue_push(jqueue_t q, void *data, int priority)
char * pstrdupx(pool_t p, const char *src, int len)
use given size
#define NAD_NURI_L(N, NS)
nad_t nad
nad of the entire packet
void jid_free(jid_t jid)
free a jid
xht results
results (key ip/port)
char name[1024]
the name proper
int s2s_domain_in_whitelist(s2s_t s2s, const char *in_domain)
jqueue_t dead_conn
list of conn_t on the way out
void xhash_put(xht h, const char *key, void *val)
static void _dns_result_srv(struct dns_ctx *ctx, struct dns_rr_srv *result, void *data)
xht states_time
time of the last state change (key is local/remote)
time_t cur_expiry
current host max expiry
nad_t stanza_tofrom(nad_t nad, int elem)
flip the to and from attributes on this elem
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
xht results
host lookup results (key ip/port)
void out_flush_route_queue(s2s_t s2s, const char *rkey, int rkeylen)
const char * local_secret
dialback secret
int xhash_iter_get(xht h, const char **key, int *keylen, void **val)
#define stanza_err_REMOTE_SERVER_NOT_FOUND
void xhash_zap(xht h, const char *key)
const char * name
domain name
static void _out_result(conn_t out, nad_t nad)
process incoming auth responses
time_t jqueue_age(jqueue_t q)
int out_reuse
reuse outgoing conns keyed by ip/port
void xhash_zapx(xht h, const char *key, int len)
nad_t stanza_error(nad_t nad, int elem, int err)
error the packet
struct _sx_buf_st * sx_buf_t
utility: buffer
char * dns_make_ipport(const char *host, int port)
static void _dns_result_aaaa(struct dns_ctx *ctx, struct dns_rr_a6 *result, void *data)
void sx_error(sx_t s, int err, const char *text)
int cur_prio
current host priority
int out_route(s2s_t s2s, const char *route, int routelen, conn_t *out, int allow_bad)
find/make a connection for a route
static int _etc_hosts_lookup(const char *cszName, char *szIP, const int ciMaxIPLen)
int resolve_aaaa
if we resolve AAAA records
void * jqueue_pull(jqueue_t q)
int xhash_count(xht h)
return the total number of entries in this xht
void _out_dns_mark_bad(conn_t out)
int s2s_route_key_match(char *local, const char *remote, const char *rkey, int rkeylen)
match route key - used for searching route hash
const char ** origin_ips
ip(s) to originate connections from
struct dns_query * query
set when we're waiting for a resolve response
int xhash_iter_first(xht h)
iteration
jqueue_t jqueue_new(void)
int nad_find_namespace(nad_t nad, int elem, const char *uri, const char *prefix)
get a matching ns on this elem, both uri and optional prefix
pool_t xhash_pool(xht h)
get our pool
int out_bounce_conn_queues(conn_t out, int err)
char * pstrdup(pool_t p, const char *src)
XXX efficient: move this to const char * and then loop throug the existing heaps to see if src is wit...
xht in
incoming conns (key is stream id)
static void _out_verify(conn_t out, nad_t nad)
incoming stream authenticated
void * xhash_get(xht h, const char *key)
#define mio_close(m, fd)
request that mio close this fd
#define SX_SSL_WRAPPER
sx stream flags
const char * local_private_key_password
private key password for local pemfile, if encrypted
#define mio_write(m, fd)
mio should try the write action on this fd now
int require_tls
Apple security options.
one item in the dns resolution cache
sx_event_t
things that can happen
const char * cur_host
current host lookup name
int nad_find_attr(nad_t nad, int elem, int ns, const char *name, const char *val)
get a matching attr on this elem, both name and optional val
int cur_weight
current host weight
#define AF_INET6
address family for IPv6
int out_packet(s2s_t s2s, pkt_t pkt)
send a packet out
#define stanza_err_SERVICE_UNAVAILABLE
const char * local_pemfile
pemfile for peer connections
struct dnscache_st * dnscache_t
int sx_ssl_client_starttls(sx_plugin_t p, sx_t s, const char *pemfile, const char *private_key_password)
struct dnsquery_st * dnsquery_t
time_t last_activity
timestamps for idle timeouts
int out_bounce_domain_queues(s2s_t s2s, const char *domain, int err)
int dns_min_ttl
dns ttl limits
int nad_find_scoped_namespace(nad_t nad, const char *uri, const char *prefix)
find a namespace in scope
struct _jqueue_st * jqueue_t
int dns_select(s2s_t s2s, char *ip, int *port, time_t now, dnscache_t dns, int allow_bad)