54 int ns, iq, elem, attr;
94 if(jid == NULL || sess == NULL) {
114 if(!strncmp(
"PBX", sess->
c2s_id, 3)) {
pkt_t pkt_error(pkt_t pkt, int err)
pkt_type_t type
packet type
data structures and prototypes for the session manager
SM_API void user_delete(sm_t sm, jid_t jid)
trash a user
const char * id
component id
#define sx_nad_write(s, nad)
const char * jid_full(jid_t jid)
expand and return the full
jid_t rfrom
addressing of enclosing route
jid_t jid_new(const char *id, int len)
make a new jid
single instance of a module in a chain
int nad_find_elem(nad_t nad, int elem, int ns, const char *name, int depth)
locate the next elem at a given depth with an optional matching name
void * xhash_getx(xht h, const char *key, int len)
int init
number of times the module intialiser has been called
void sm_c2s_action(sess_t dest, const char *action, const char *target)
send a new action route
#define stanza_err_FEATURE_NOT_IMPLEMENTED
int xhash_iter_next(xht h)
xht sessions
pointers to all connected sessions (key is random sm id)
char c2s_id[44]
remote id (for session control)
void nad_set_attr(nad_t nad, int elem, int ns, const char *name, const char *val, int vallen)
create, update, or zap any matching attr on this elem
void sess_end(sess_t sess)
module_t mod
module that this is an instance of
jid_t from
packet addressing (not used for routing)
sx_t router
SX of router connection.
packet summary data wrapper
nad_t nad
nad of the entire packet
session manager global context
void jid_free(jid_t jid)
free a jid
advertisement (available)
static mod_ret_t _session_in_router(mod_instance_t mi, pkt_t pkt)
DLLEXPORT int module_init(mod_instance_t mi, const char *arg)
char sm_id[41]
local id (for session control)
nad_t stanza_tofrom(nad_t nad, int elem)
flip the to and from attributes on this elem
sess_t sess_start(sm_t sm, jid_t jid)
int xhash_iter_get(xht h, const char **key, int *keylen, void **val)
packet was unhandled, should be passed to the next module
mod_ret_t mm_in_sess(mm_t mm, sess_t sess, pkt_t pkt)
packets from active session
packet was handled (and freed)
There is one instance of this struct per user who is logged in to this c2s instance.
int xhash_iter_first(xht h)
iteration
int fake
true if session is fake (ie.
static mod_ret_t _session_pkt_router(mod_instance_t mi, pkt_t pkt)
int nad_find_namespace(nad_t nad, int elem, const char *uri, const char *prefix)
get a matching ns on this elem, both uri and optional prefix
void nad_drop_elem(nad_t nad, int elem)
remove an element (and its subelements)
mod_ret_t(* in_router)(mod_instance_t mi, pkt_t pkt)
in-router handler
advertisement (unavailable)
int nad_find_attr(nad_t nad, int elem, int ns, const char *name, const char *val)
get a matching attr on this elem, both name and optional val
mod_ret_t(* pkt_router)(mod_instance_t mi, pkt_t pkt)
pkt-router handler
mod_ret_t
module return values
sess_t source
session this packet came from
void pkt_sess(pkt_t pkt, sess_t sess)
SM_API int user_create(sm_t sm, jid_t jid)
initialise a user
int nad_find_scoped_namespace(nad_t nad, const char *uri, const char *prefix)
find a namespace in scope
session request failed (mask)
route_type_t rtype
type of enclosing route