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