|
jabberd14
1.6.2
|
implements the XML stanza routing of jabberd More...
implements the XML stanza routing of jabberd
The jabberd execuatable is mainly a router for XML stanzas, that routes stanzas between the base handlers, that connect the components of the jabberd server to this XML routing. Inside this file the XML routing inside the jabberd server is implemented.
There are actually three routings, that are defined: One routing for <log/> stanzas (used to send log messages to a component, that logs the message to a file or the syslog), the second for <xdb/> stanzas (used to abstract database access into xdb handlers), and the third routing for other stanzas (<route/>, <message/>, <presence/>, and <iq/>).
The basic routing is defined on startup using the configuration file. <xdb/> sections in the configuration are registered in the routing for <xdb/> stanzas, <log/> sections in the configuration are registered in the routing for <log/> stanzas, <service/> sections are registered in the routing for the other stanzas.
Routing is done based on the domain part of a JID. The components can be registered to get stanzas for domains. On startup the component is registered for the domain contained in the value of the id attribute of the configuration file element as well as for all domains configured with <host/> elements inside the section of the component. Where each <host/> element contains a single additional domain, and an empty <host/> registers the component to be a default handler if no other component has explicitly registered to handle the domain. (Additionally there is the <uplink/> element, which is nearly the same as an empty <host/> element, but registers a routing not only in a single routing, but in all three XML routings. To be more precise: It is the fallback if there is even no default component for a given routing. There can be only one uplink in a single instance of jabberd.)
After a component has started, it can register for additional routings using the register_instance() function, or unregister an existing routing using the unregister_instance() function.
| typedef struct deliver_mp_st _deliver_msg |
queue item for the list of queued messages for later delivery, used while deliver__flag = 0
| typedef struct ilist_struct _ilist |
| typedef struct deliver_mp_st* deliver_msg |
| typedef struct ilist_struct * ilist |
list of all instances of instance
deliver a dpacket to an instance using the configured XML routings
| p | the packet that should be delivered (packet gets consumed) |
| i | unused/ignored (was: the instance of the sender (!) of the packet) |
References deliver(), deliver__flag, deliver__mp, filter_expressions, filter_namespaces, dpacket_struct::from_jid, greymatter__, dpacket_struct::host, jid_full(), jid_new(), log_debug2, log_notice(), LOGT_CONFIG, LOGT_DELIVER, deliver_mp_st::p, dpacket_struct::p, p_LOG, p_NORM, p_XDB, pmalloco(), pool_free(), dpacket_struct::to_jid, dpacket_struct::type, dpacket_struct::x, xhash_free(), xhash_new(), xhash_put(), xhash_walk(), xmlnode_get_attrib_ns(), xmlnode_get_data(), xmlnode_get_tags(), xmlnode_pool(), and xmlnode_serialize_string().
Referenced by _js_routed_auth_packet(), _js_routed_session_control_packet(), _js_routed_session_packet(), deliver(), deliver_fail(), dialback_in_read_db(), dialback_miod_read(), dnsrv_resend(), js_authreg(), js_deliver(), js_session_route(), log_generic(), logger(), main(), and xdb_file_phandler().
| void deliver_config_filter | ( | xmlnode | greymatter | ) |
initializes or updates the dump filters of the router
| greymatter | the parsed configuration file |
References filter_expressions, filter_namespaces, log_debug2, LOGT_DELIVER, pool_free(), pstrdup(), xhash_free(), xhash_new(), xhash_put(), xmlnode_get_attrib_ns(), xmlnode_get_data(), and xmlnode_get_tags().
Referenced by configurate().
| void deliver_fail | ( | dpacket | p, |
| const char * | err | ||
| ) |
bounce on the delivery, use the result to better gague what went wrong
References deliver(), dpacket_new(), dpacket_struct::host, j_strcmp(), jutil_error_xmpp(), jutil_tofrom(), log_debug2, log_notice(), log_warn(), LOGT_DELIVER, MAX_LOG_SIZE, messages_get(), dpacket_struct::p, p_LOG, p_NORM, p_ROUTE, p_XDB, pool_free(), dpacket_struct::type, dpacket_struct::x, xmlnode_get_attrib_ns(), xmlnode_get_firstchild(), xmlnode_get_lang(), xmlnode_get_namespace(), xmlnode_hide(), xmlnode_insert_tag_ns(), xmlnode_put_attrib_ns(), and xmlnode_serialize_string().
Referenced by _dialback_out_beat_packets(), _dnsrv_beat_packets(), _js_routed_packet(), dialback_out_connection_cleanup(), and dnsrv_lookup().
| void deliver_init | ( | pool | p | ) |
initialize the XML delivery system
| p | memory pool that can be used to register config handlers (must be available for the livetime of jabberd) |
References register_config(), and xhash_new().
Referenced by main().
| bool deliver_is_delivered_to | ( | Glib::ustring const & | host, |
| _instance const * | i | ||
| ) |
util to check and see which instance this hostname is going to get mapped to for normal packets
| host | the hostname to get checked |
References ilist_struct::i, and ilist_struct::next.
| bool deliver_is_uplink | ( | instance | i | ) |
checks if an instance is configured to be the uplink
| i | the instance to check |
References deliver__uplink.
| void deliver_pool_debug | ( | ) |
Referenced by main().
| std::set<Glib::ustring> deliver_routed_hosts | ( | ptype | type, |
| instance | i | ||
| ) |
get list of hosts with explicit routing
| type | the type to get the routing for |
| i | the instance to exclude from the result (NULL for not excluding any instance) |
References deliver_routed_hosts_walk_args::i, deliver_routed_hosts_walk_args::result, and xhash_walk().
| void deliver_shutdown | ( | void | ) |
free the delivery structures ... this is called when we already have shutdown the server therefore we cannot register it with register_shutdown()
References xhash_free().
Referenced by main().
| dpacket dpacket_copy | ( | dpacket | p | ) |
create a clone of a deliverable packet
References dpacket_new(), dpacket_struct::x, and xmlnode_dup().
| dpacket dpacket_new | ( | xmlnode | x | ) |
create a new deliverable packet out of an ::xmlnode
| x | the xmlnode to generate the deliverable packet for |
References dpacket_struct::from_jid, dpacket_struct::host, dpacket_struct::id, jid_new(), log_warn(), dpacket_struct::p, p_LOG, p_NONE, p_NORM, p_ROUTE, p_XDB, pmalloco(), pstrdup(), dpacket_struct::to_jid, dpacket_struct::type, dpacket_struct::x, xmlnode_free(), xmlnode_get_attrib_ns(), xmlnode_get_localname(), xmlnode_pool(), and xmlnode_serialize_string().
Referenced by _dialback_out_beat_packets(), _js_routed_auth_packet(), _js_routed_packet(), _js_routed_session_control_packet(), _js_routed_session_packet(), xmppd::instance_base::deliver(), deliver_fail(), dialback_in_read_db(), dialback_miod_read(), dialback_out_connection_cleanup(), dnsrv_resend(), dpacket_copy(), js_authreg(), js_deliver(), js_session_route(), log_generic(), logger(), and xdb_file_phandler().
| void register_instance | ( | instance | i, |
| char const * | host | ||
| ) |
register this instance as a possible recipient of packets to this host
| i | the instance to register |
| host | the domain to register this instance for (or "*" to register as the default routing) |
References register_notifier_struct::arg, register_notifier_struct::callback, instance_struct::id, log_debug2, LOGT_REGISTER, register_notifier_struct::next, instance_struct::p, p_LOG, p_XDB, pstrdup(), instance_struct::routing_update_callbacks, instance_struct::type, instance_struct::x, xhash_free(), xhash_get(), xhash_new(), xhash_put(), xmlnode_get_list_item(), and xmlnode_get_tags().
Referenced by dialback_miod_hash(), dialback_out_packet(), and mod_dynamic().
| void register_phandler | ( | instance | id, |
| order | o, | ||
| phandler | f, | ||
| void * | arg | ||
| ) |
register a function to handle delivery for this instance
References handel_struct::arg, handel_struct::f, instance_struct::hds, handel_struct::next, handel_struct::o, o_COND, o_DELIVER, o_PRECOND, o_PREDELIVER, handel_struct::p, and pmalloco().
Referenced by dialback(), dnsrv(), xmppd::instance_base::instance_base(), jsm(), pthsock_client(), xdb_cache(), xdb_file(), and xdb_sql().
| void register_routing_update_callback | ( | instance | i, |
| register_notify | f, | ||
| void * | arg | ||
| ) |
register a function that gets called on registering/unregistering a host for an instance
| i | the instance to get register/unregister events for (NULL for a global registration) |
| f | the callback method to call |
| arg | argument to pass to the callback |
References register_notifier_struct::arg, register_notifier_struct::callback, log_debug2, LOGT_EXECFLOW, register_notifier_struct::next, instance_struct::p, pmalloco(), and instance_struct::routing_update_callbacks.
Referenced by jsm().
| void unregister_instance | ( | instance | i, |
| char const * | host | ||
| ) |
unregister an instance as a possible recipient of packets for a domain
| i | the instance to unregister |
| host | the domain to unregister (or "*" to unregister as the default routing) |
References register_notifier_struct::arg, register_notifier_struct::callback, instance_struct::id, log_debug2, log_notice(), LOGT_REGISTER, register_notifier_struct::next, instance_struct::p, pstrdup(), instance_struct::routing_update_callbacks, instance_struct::static_hosts, instance_struct::type, xhash_get(), xhash_put(), and xhash_zap().
Referenced by _dialback_miod_hash_cleanup(), and instance_shutdown().
| int deliver__flag = 0 |
| xht deliver__hlog = NULL |
host filters for logging
| xht deliver__hnorm = NULL |
hosts for normal packets, important and most frequently used one
| xht deliver__hxdb = NULL |
host filters for xdb requests
| xht deliver__logtype = NULL |
log types, fixed set, but it's easier (wussier) to just be consistent and use a hashtable
| pth_msgport_t deliver__mp = NULL |
message port, that contains all queued messages for later delivery while deliver__flag = 0
Referenced by deliver().
| xht deliver__ns = NULL |
namespace filters for xdb
| instance deliver__uplink = NULL |
uplink instance, only one
Referenced by deliver_is_uplink().
| std::list<Glib::ustring> filter_expressions |
xpath expressions used for logging routed packets
Referenced by deliver(), and deliver_config_filter().
| xht filter_namespaces = NULL |
namespaces using in dump filters of the router
Referenced by deliver(), and deliver_config_filter().
list of callback functions, that should be called on all routing updates
| pool global_routing_update_pool = NULL |
memory pool to hold the entries in the global_routing_update_callbacks list
| xmlnode greymatter__ |
this holds the parsed configuration file
| std::set<Glib::ustring> null_sources |
source addresses that get null-routes
1.7.6.1