handle outgoing server to server connections More...
#include "dialback.h"Functions | |
| void | dialback_out_read (mio m, int flags, void *arg, xmlnode x, char *unused1, int unused2) |
| void | dialback_out_connect (dboc c) |
| dboc | dialback_out_connection (db d, jid key, char *ip, db_request db_state) |
| void | dialback_out_connection_cleanup (dboc c) |
| void | dialback_out_packet (db d, xmlnode x, char *ip) |
| void | dialback_out_read_db (mio m, int flags, void *arg, xmlnode x, char *unused1, int unused2) |
| void | dialback_out_qflush (miod md, dboq q) |
| void | _dialback_out_beat_packets (xht h, const char *key, void *data, void *arg) |
| result | dialback_out_beat_packets (void *arg) |
handle outgoing server to server connections
This is where the server to server connection manager handles outgoing connections.
There might be two types of outgoing connections:
On outgoing connections, we need to send:
| void _dialback_out_beat_packets | ( | xht | h, | |
| const char * | key, | |||
| void * | data, | |||
| void * | arg | |||
| ) |
callback for walking the connecting hash tree: timing out connections that did not get authorized in time (default is 30 seconds, can be configured with <queuetimeout/> in the configuration file)
| h | the hash containing all pending connections | |
| key | destination/source address | |
| data | the dboc | |
| arg | unused/ignored |
References dboc::connect_results, dboc::connection_state, dboc::d, deliver_fail(), dpacket_new(), messages_get(), N_, dboq_struct::next, dboc::p, pstrdup(), dboc::q, dboq_struct::stamp, db_struct::timeout_packets, dboq_struct::x, and xmlnode_get_lang().
Referenced by dialback_out_beat_packets().
| result dialback_out_beat_packets | ( | void * | arg | ) |
start walking the connection hash tree, to see if connections dig not get authorizsed in time
| arg | the dialback instance |
References _dialback_out_beat_packets(), db_struct::out_connecting, r_DONE, and xhash_walk().
Referenced by dialback().
| void dialback_out_connect | ( | dboc | c | ) |
try to start a connection based upon a given connect object
Tell mio to connect to the peer and make dialback_out_read() the first mio handler
| c | the connect object |
References dboc::connect_results, connecting, dboc::connection_state, dialback_out_read(), dboc::ip, jid_full(), dboc::key, log_debug2, LOGT_IO, mio_connect(), MIO_CONNECT_XML, and ZONE.
Referenced by dialback_out_connection(), and dialback_out_read().
| dboc dialback_out_connection | ( | db | d, | |
| jid | key, | |||
| char * | ip, | |||
| db_request | db_state | |||
| ) |
make a new outgoing connect(ion) object, and start to connect to the peer
| d | the dialback instance | |
| key | destination and source for this connection | |
| ip | where to connect to (format see description to the _dboc structure) | |
| db_state | if sending a <db:result/> is requested |
References dboc::connect_results, dboc::connection_state, could_request, created, dboc::d, dboc::db_state, dialback_merlin(), dialback_out_connect(), xmppd::jabberid::get_domain(), xmppd::jabberid::get_resource(), dboc::ip, jid_full(), jid_new(), dboc::key, log_debug2, LOGT_IO, dboc::m, mio_write(), not_requested, NS_DIALBACK, NS_JABBERD_WRAPPER, db_struct::out_connecting, dboc::p, pmalloco(), pool_cleanup(), pool_heap, pstrdup(), db_struct::secret, sent_request, dboc::stamp, dboc::stream_id, dboc::verifies, want_request, xhash_get(), xhash_put(), xmlnode_insert_cdata(), xmlnode_new_tag_ns(), xmlnode_new_tag_pool_ns(), xmlnode_pool(), xmlnode_put_attrib_ns(), dboc::xmpp_version, and ZONE.
Referenced by dialback_out_packet().
| void dialback_out_connection_cleanup | ( | dboc | c | ) |
handle failed connection attempts, bounce pending stanzas and db:verify elements
either we're connected, or failed, or something like that, but the connection process is kaput
| c | the outgoing connect that failed |
References dboc::connect_results, dboc::connection_state, dboc::d, deliver_fail(), dialback_in_verify(), dpacket_new(), xmppd::jabberid::get_domain(), db_struct::i, instance_struct::id, jid_full(), jutil_tofrom(), dboc::key, log_notice(), dboc::m, messages_get(), N_, dboq_struct::next, db_struct::out_connecting, dboc::p, pool_free(), pstrdup(), dboc::q, dboc::settings_failed, dboc::verifies, dboq_struct::x, xhash_zap(), xmlnode_dup(), xmlnode_get_firstchild(), xmlnode_get_lang(), and xmlnode_get_nextsibling().
Referenced by dialback_out_read().
handle packets we receive from our router for other hosts
(packets to our instances address are not handled here, but in dialback_in_verify())
We have to:
| d | the dialback instance | |
| x | the packet | |
| ip | where to connect to (if necessary) |
References dialback_in_verify(), dialback_ip_get(), dialback_miod_write(), dialback_out_connection(), xmppd::jabberid::get_domain(), db_struct::i, instance_struct::id, j_strcmp(), jid_full(), jid_new(), JID_RESOURCE, jid_set(), jutil_tofrom(), log_debug2, log_warn(), LOGT_IO, dboc::m, mio_write(), dboq_struct::next, not_requested, NS_DIALBACK, db_struct::out_ok_db, pmalloco(), dboc::q, register_instance(), dboq_struct::stamp, dboc::verifies, want_request, dboq_struct::x, xhash_get(), xmlnode_free(), xmlnode_get_attrib_ns(), xmlnode_get_localname(), xmlnode_get_namespace(), xmlnode_hide_attrib_ns(), xmlnode_insert_tag_node(), xmlnode_pool(), xmlnode_put_attrib_ns(), xmlnode_serialize_string(), and ZONE.
Referenced by dialback_packets().
util to flush queue to mio
Take elements from the queue and send it to a miod connection.
| md | the miod connection | |
| q | the queue to flush |
References dialback_miod_write(), dboq_struct::next, and dboq_struct::x.
Referenced by dialback_out_read().
handle the early connection process
What to do:
References base64_encode(), configuration, dboc::connect_results, connected, dboc::connection_state, could_request, dboc::d, dboc::db, db_failed, dboc::db_state, db_succeeded, dialback_check_settings(), dialback_get_loopcheck_token(), dialback_in_verify(), dialback_merlin(), dialback_miod_hash(), dialback_miod_new(), dialback_out_connect(), dialback_out_connection_cleanup(), dialback_out_qflush(), dialback_out_read_db(), error, mio_st::fd, feature_lack, dboc::flags, xmppd::jabberid::get_domain(), xmppd::ns_decl_list::get_nsprefix(), xmppd::jabberid::get_resource(), got_features, got_streamroot, db_struct::hosts_auth, db_struct::hosts_tls, db_struct::hosts_xmpp, db_struct::i, instance_struct::id, db_struct::in_id, mio_st::in_root, dboc::ip, j_atoi(), j_strcasecmp(), j_strcmp(), jid_full(), dboc::key, log_alert(), log_debug2, log_error, log_notice(), log_warn(), LOGT_IO, dboc::m, mio_close(), MIO_CLOSED, mio_connect_errmsg, mio_ip, MIO_NEW, mio_reset(), mio_ssl_starttls_possible(), mio_write(), mio_write_root(), MIO_XML_NODE, mio_xml_reset(), MIO_XML_ROOT, mio_xml_starttls(), normal, not_requested, NS_DIALBACK, NS_JABBERD_LOOPCHECK, NS_STREAM, NS_XMLNS, NS_XMPP_SASL, NS_XMPP_TLS, NTYPE_TAG, db_struct::out_ok_db, xmlnode_t::p, dboc::p, pmalloco(), pstrdup(), dboc::q, sasl_fail, sasl_started, sasl_success, db_struct::secret, sent_db_request, sent_request, dboc::settings_failed, streamerr_struct::severity, db_struct::std_ns_prefixes, dboc::stream_id, unknown, dboc::verifies, waiting_features, want_request, xhash_get(), xhash_get_by_domain(), xmlnode_dup(), xmlnode_free(), xmlnode_get_attrib_ns(), xmlnode_get_data(), xmlnode_get_firstchild(), xmlnode_get_list_item(), xmlnode_get_localname(), xmlnode_get_namespace(), xmlnode_get_nextsibling(), xmlnode_get_tags(), xmlnode_get_type(), xmlnode_hide(), xmlnode_hide_attrib_ns(), xmlnode_insert_cdata(), xmlnode_new_tag_ns(), xmlnode_pool(), xmlnode_put_attrib_ns(), xmlnode_serialize_string(), dboc::xmpp_version, xstream_format_error(), xstream_header(), xstream_parse_error(), and ZONE.
Referenced by dialback_out_connect().
handle the events (incoming stanzas) on an outgoing dialback socket, which isn't much of a job
The only packets we have to expect on an outgoing dialback socket are db:verify and maybe stream:error
| m | the connection the packet has been received on | |
| flags | the mio action, we ignore anything but MIO_XML_NODE | |
| arg | the dialback instance | |
| x | the packet that has been received | |
| unused1 | unused/ignored | |
| unused2 | unused/ignored |
References configuration, dialback_in_verify(), error, feature_lack, db_struct::i, instance_struct::id, j_strcmp(), log_debug2, log_error, log_warn(), LOGT_IO, mio_close(), mio_ip, mio_write(), MIO_XML_NODE, normal, NS_DIALBACK, NS_STREAM, xmlnode_t::p, pmalloco(), streamerr_struct::severity, unknown, xmlnode_free(), xmlnode_get_localname(), xmlnode_get_namespace(), xstream_format_error(), xstream_parse_error(), and ZONE.
Referenced by dialback_out_read().
1.6.1