jabberd2
2.3.6
|
service discovery More...
#include "sm.h"
Go to the source code of this file.
Data Structures | |
struct | service_st |
struct | disco_st |
union | xhashv |
session packet handling More... | |
Macros | |
#define | ACTIVE_SESSIONS_NAME "Active sessions" |
Typedefs | |
typedef struct service_st * | service_t |
holder for a single service More... | |
typedef struct disco_st * | disco_t |
all the current disco data More... | |
Functions | |
static void | _disco_unify_walker (const char *key, int keylen, void *val, void *arg) |
put val into arg More... | |
static void | _disco_unify_lists (disco_t d) |
unify the contents of dyn and stat More... | |
static pkt_t | _disco_items_result (module_t mod, disco_t d) |
build a disco items result, known services More... | |
static pkt_t | _disco_info_result (module_t mod, disco_t d) |
build a disco info result More... | |
static pkt_t | _disco_agents_result (module_t mod, disco_t d) |
build an agents result More... | |
static void | _disco_generate_packets (module_t mod, disco_t d) |
generate cached result packets More... | |
static mod_ret_t | _disco_pkt_sm_populate (mod_instance_t mi, pkt_t pkt) |
catch responses and populate the table More... | |
static void | _disco_sessions_result (module_t mod, disco_t d, pkt_t pkt) |
build a disco items result, active sessions More... | |
static mod_ret_t | _disco_pkt_sm (mod_instance_t mi, pkt_t pkt) |
catch responses and populate the table; respond to requests More... | |
static void | _disco_user_result (pkt_t pkt, user_t user) |
response to quering user JID More... | |
static mod_ret_t | _disco_in_sess (mod_instance_t mi, sess_t sess, pkt_t pkt) |
legacy support for agents requests from sessions More... | |
static mod_ret_t | _disco_pkt_user (mod_instance_t mi, user_t user, pkt_t pkt) |
static mod_ret_t | _disco_pkt_router (mod_instance_t mi, pkt_t pkt) |
update the table for component changes More... | |
static void | _disco_free_walker (const char *key, int keylen, void *val, void *arg) |
static void | _disco_free (module_t mod) |
DLLEXPORT int | module_init (mod_instance_t mi, const char *arg) |
#define ACTIVE_SESSIONS_NAME "Active sessions" |
Definition at line 30 of file mod_disco.c.
Referenced by _disco_pkt_sm().
typedef struct service_st* service_t |
holder for a single service
Definition at line 33 of file mod_disco.c.
all the current disco data
Definition at line 46 of file mod_disco.c.
|
static |
put val into arg
Definition at line 79 of file mod_disco.c.
References service_st::jid, jid_full(), log_debug, xhash_get(), xhash_put(), and ZONE.
Referenced by _disco_unify_lists().
|
static |
unify the contents of dyn and stat
Definition at line 93 of file mod_disco.c.
References _disco_unify_walker(), disco_st::dyn, log_debug, disco_st::stat, disco_st::un, xhash_free(), xhash_new(), xhash_walk(), and ZONE.
Referenced by _disco_pkt_router(), _disco_pkt_sm_populate(), and module_init().
build a disco items result, known services
Definition at line 107 of file mod_disco.c.
References service_st::jid, jid_full(), module_st::mm, nad_add_namespace(), nad_append_attr(), nad_append_elem(), service_st::name, pkt_create(), mm_st::sm, xhashv::svc_val, disco_st::un, uri_DISCO_ITEMS, xhashv::val, xhash_iter_first(), xhash_iter_get(), and xhash_iter_next().
Referenced by _disco_generate_packets().
build a disco info result
Definition at line 133 of file mod_disco.c.
References disco_st::category, sm_st::features, module_st::mm, mm_disco_extend(), pkt_st::nad, nad_add_namespace(), nad_append_attr(), nad_append_elem(), nad_set_attr(), disco_st::name, pkt_create(), mm_st::sm, disco_st::type, uri_DISCO_INFO, xhash_iter_first(), xhash_iter_get(), and xhash_iter_next().
Referenced by _disco_generate_packets().
build an agents result
Definition at line 166 of file mod_disco.c.
References service_st::category, service_st::features, service_st::jid, jid_full(), module_st::mm, nad_add_namespace(), nad_append_attr(), nad_append_cdata(), nad_append_elem(), service_st::name, pkt_create(), mm_st::sm, xhashv::svc_val, service_st::type, disco_st::un, uri_AGENTS, uri_GATEWAY, uri_REGISTER, uri_SEARCH, xhashv::val, xhash_get(), xhash_iter_first(), xhash_iter_get(), and xhash_iter_next().
Referenced by _disco_generate_packets().
generate cached result packets
Definition at line 212 of file mod_disco.c.
References _disco_agents_result(), _disco_info_result(), _disco_items_result(), disco_st::agents, disco_st::agents_result, disco_st::disco_info_result, disco_st::disco_items_result, log_debug, pkt_free(), and ZONE.
Referenced by _disco_in_sess(), _disco_pkt_router(), _disco_pkt_sm(), and _disco_pkt_sm_populate().
|
static |
catch responses and populate the table
Definition at line 232 of file mod_disco.c.
References _disco_generate_packets(), _disco_unify_lists(), disco_st::dyn, pkt_st::from, jid_dup(), jid_full(), log_debug, mod_instance_st::mod, mod_HANDLED, pkt_st::nad, NAD_AVAL, NAD_AVAL_L, nad_find_attr(), nad_find_elem(), nad_find_scoped_namespace(), jid_st::node, pkt_free(), module_st::private, pstrdupx(), jid_st::resource, stanza_err_BAD_REQUEST, stanza_err_NOT_ALLOWED, uri_DISCO_INFO, xhash_get(), xhash_new(), xhash_pool(), xhash_put(), and ZONE.
Referenced by _disco_pkt_sm().
build a disco items result, active sessions
Definition at line 323 of file mod_disco.c.
References sess_st::jid, jid_full(), module_st::mm, pkt_st::nad, nad_add_namespace(), nad_append_attr(), nad_append_elem(), xhashv::sess_val, sm_st::sessions, mm_st::sm, uri_DISCO_ITEMS, xhashv::val, xhash_iter_first(), xhash_iter_get(), and xhash_iter_next().
Referenced by _disco_pkt_sm().
|
static |
catch responses and populate the table; respond to requests
Definition at line 344 of file mod_disco.c.
References _disco_generate_packets(), _disco_pkt_sm_populate(), _disco_sessions_result(), aci_check(), sm_st::acls, ACTIVE_SESSIONS_NAME, disco_st::agents, disco_st::agents_result, disco_st::disco_info_result, disco_st::disco_items_result, jid_st::domain, pkt_st::from, sm_st::hosts, jid_full(), module_st::mm, mod_instance_st::mod, mod_HANDLED, mod_PASS, pkt_st::nad, nad_add_namespace(), nad_append_attr(), nad_append_elem(), NAD_AVAL, NAD_AVAL_L, NAD_ENS, nad_find_attr(), nad_set_attr(), pkt_st::ns, ns_AGENTS, ns_DISCO_INFO, ns_DISCO_ITEMS, pkt_create(), pkt_dup(), pkt_free(), pkt_id(), pkt_IQ, pkt_IQ_RESULT, pkt_router(), module_st::private, mm_st::sm, stanza_err_ITEM_NOT_FOUND, stanza_err_NOT_ALLOWED, pkt_st::to, pkt_st::type, uri_DISCO_INFO, uri_DISCO_ITEMS, and xhash_get().
Referenced by module_init().
response to quering user JID
Definition at line 475 of file mod_disco.c.
References user_st::active, user_st::jid, jid_full(), log_debug, pkt_st::nad, nad_append_attr(), nad_append_elem(), nad_set_attr(), user_st::sessions, and ZONE.
Referenced by _disco_in_sess(), and _disco_pkt_user().
|
static |
legacy support for agents requests from sessions
Definition at line 490 of file mod_disco.c.
References _disco_generate_packets(), _disco_user_result(), disco_st::agents, disco_st::agents_result, disco_st::disco_info_result, sess_st::jid, jid_full(), jid_user(), mod_instance_st::mod, mod_HANDLED, mod_PASS, pkt_st::ns, ns_AGENTS, ns_DISCO_INFO, pkt_dup(), pkt_free(), pkt_id(), pkt_IQ, pkt_sess(), pkt_tofrom(), module_st::private, stanza_err_NOT_ALLOWED, pkt_st::to, pkt_st::type, and sess_st::user.
Referenced by module_init().
|
static |
Definition at line 532 of file mod_disco.c.
References _disco_user_result(), mod_HANDLED, mod_PASS, pkt_st::ns, ns_DISCO_INFO, pkt_IQ, pkt_router(), pkt_tofrom(), and pkt_st::type.
Referenced by module_init().
|
static |
update the table for component changes
Definition at line 546 of file mod_disco.c.
References _disco_generate_packets(), _disco_unify_lists(), disco_st::dyn, pkt_st::from, sm_st::id, jid_free(), jid_full(), log_debug, module_st::mm, mod_instance_st::mod, mod_HANDLED, mod_PASS, nad_add_namespace(), nad_append_elem(), pkt_create(), pkt_free(), pkt_id_new(), pkt_router(), module_st::private, route_ADV, pkt_st::rtype, mm_st::sm, uri_DISCO_INFO, xhash_free(), xhash_get(), xhash_zap(), and ZONE.
Referenced by module_init().
|
static |
Definition at line 600 of file mod_disco.c.
References service_st::features, service_st::jid, jid_free(), and xhash_free().
Referenced by _disco_free().
|
static |
Definition at line 608 of file mod_disco.c.
References _disco_free_walker(), disco_st::agents_result, disco_st::disco_info_result, disco_st::disco_items_result, disco_st::dyn, pkt_free(), module_st::private, disco_st::stat, disco_st::un, xhash_free(), and xhash_walk().
Referenced by module_init().
DLLEXPORT int module_init | ( | mod_instance_t | mi, |
const char * | arg | ||
) |
Definition at line 625 of file mod_disco.c.
References _disco_free(), _disco_in_sess(), _disco_pkt_router(), _disco_pkt_sm(), _disco_pkt_user(), _disco_unify_lists(), disco_st::agents, service_st::category, disco_st::category, sm_st::config, config_get(), config_get_one(), disco_st::dyn, feature_register(), service_st::features, module_st::free, module_st::in_sess, module_st::init, service_st::jid, jid_full(), jid_new(), log_debug, module_st::mm, mod_instance_st::mod, config_st::nad, NAD_AVAL, NAD_AVAL_L, NAD_CDATA, NAD_CDATA_L, nad_find_attr(), nad_find_elem(), service_st::name, disco_st::name, module_st::pkt_router, module_st::pkt_sm, module_st::pkt_user, module_st::private, pstrdupx(), mm_st::sm, disco_st::stat, service_st::type, disco_st::type, uri_AGENTS, uri_DISCO_INFO, uri_DISCO_ITEMS, xhash_new(), xhash_pool(), xhash_put(), and ZONE.