jabberd2  2.3.1
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
s2s.h File Reference
#include "mio/mio.h"
#include "sx/sx.h"
#include <udns.h>

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_sthost_t
 
typedef struct s2s_sts2s_t
 
typedef struct pkt_stpkt_t
 
typedef struct conn_stconn_t
 
typedef struct dnsquery_stdnsquery_t
 
typedef struct dnscache_stdnscache_t
 
typedef struct dnsres_stdnsres_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
 

Macro Definition Documentation

#define DNS_MAX_RESULTS   50

Definition at line 282 of file s2s.h.

Referenced by _dns_add_host(), _dns_add_result(), and dns_select().

#define S2S_DB_HEADER   (1<<10)

Definition at line 381 of file s2s.h.

Referenced by _s2s_db_header(), in_mio_callback(), and out_route().

#define MAX_DOMAIN_LEN   1023

Definition at line 384 of file s2s.h.

Referenced by _s2s_populate_whitelist_domains(), and s2s_domain_in_whitelist().

Typedef Documentation

typedef struct host_st* host_t

Definition at line 38 of file s2s.h.

typedef struct s2s_st* s2s_t

Definition at line 39 of file s2s.h.

typedef struct pkt_st* pkt_t

Definition at line 40 of file s2s.h.

typedef struct conn_st* conn_t

Definition at line 41 of file s2s.h.

typedef struct dnsquery_st* dnsquery_t

Definition at line 42 of file s2s.h.

typedef struct dnscache_st* dnscache_t

Definition at line 43 of file s2s.h.

typedef struct dnsres_st* dnsres_t

Definition at line 44 of file s2s.h.

Enumeration Type Documentation

Enumerator
conn_NONE 
conn_INPROGRESS 
conn_VALID 
conn_INVALID 

Definition at line 239 of file s2s.h.

Function Documentation

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

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 
)
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().

int out_packet ( s2s_t  s2s,
pkt_t  pkt 
)
int out_route ( s2s_t  s2s,
const char *  route,
int  routelen,
conn_t out,
int  allow_bad 
)
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 
)
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 
)

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 
)
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 
)

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().

Variable Documentation

sig_atomic_t s2s_lost_router

Definition at line 27 of file main.c.

Referenced by _s2s_router_connect(), _s2s_signal(), JABBER_MAIN(), and s2s_router_mio_callback().