108 unsigned char hash[20];
115 log_write(sm->
log, LOG_ERR,
"request to start session in non-serviced domain: jid=%s",
jid_full(jid));
125 log_write(sm->
log, LOG_NOTICE,
"user not found and user.auto-create not enabled, can't start session: jid=%s",
jid_full(jid));
136 log_write(sm->
log, LOG_NOTICE,
"couldn't load user, can't start session: jid=%s",
jid_full(jid));
142 for(scan = user->
sessions; scan != NULL; scan = scan->
next)
209 for(sess = user->
sessions; sess != NULL; sess = sess->
next) {
user_t user
user this session belongs to
jid_t jid
session jid (user@host/res)
data structures and prototypes for the session manager
int nindex
counter for module instance sequence (!!! should be local to mm_new)
#define sx_nad_write(s, nad)
int pri
current priority of this session
const char * jid_user(jid_t jid)
expand and return the user
const char * jid_full(jid_t jid)
expand and return the full
jid_t rfrom
addressing of enclosing route
void mm_sess_end(mm_t mm, sess_t sess)
session ending
config_t config
config context
void log_write(log_t log, int level, const char *msgfmt,...)
jid_t A
list of jids that this session has sent directed presence to
void sm_c2s_action(sess_t dest, const char *action, const char *target)
send a new action route
void ** module_data
per-session module data
SM_API user_t user_load(sm_t sm, jid_t jid)
fetch user data
xht sessions
pointers to all connected sessions (key is random sm id)
char c2s_id[44]
remote id (for session control)
pool_t p
memory pool this session is allocated off
sess_t next
next session (in a list of sessions)
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 pool_cleanup(pool_t p, pool_cleanup_t f, void *arg)
public cleanup utils, insert in a way that they are run FIFO, before mem frees
void sess_end(sess_t sess)
sess_t sessions
list of action sessions
jid_t from
packet addressing (not used for routing)
sx_t router
SX of router connection.
packet summary data wrapper
void sha1_init(sha1_state_t *ctx)
void * pmalloco(pool_t p, int size)
easy safety utility (for creating blank mem for structs, etc)
nad_t nad
nad of the entire packet
session manager global context
void jid_free(jid_t jid)
free a jid
void datetime_out(time_t t, datetime_t type, char *date, int datelen)
void xhash_put(xht h, const char *key, void *val)
char sm_id[41]
local id (for session control)
sess_t sess_start(sm_t sm, jid_t jid)
int jid_compare_full(jid_t a, jid_t b)
compare two full jids
void sha1_finish(sha1_state_t *ctx, unsigned char hashout[20])
void xhash_zap(xht h, const char *key)
int mm_sess_start(mm_t mm, sess_t sess)
session starting
sess_t sess_match(user_t user, const char *resource)
match a session by resource
mod_ret_t mm_in_sess(mm_t mm, sess_t sess, pkt_t pkt)
packets from active session
void hex_from_raw(const unsigned char *in, int inlen, char *out)
turn raw into hex - out must be (inlen*2)+1
config_elem_t config_get(config_t c, const char *key)
get the config element for this key
SM_API void user_free(user_t user)
There is one instance of this struct per user who is logged in to this c2s instance.
int available
true if this session is available
static void _sess_end_guts(sess_t sess)
void sha1_append(sha1_state_t *ctx, const unsigned char *dataIn, int len)
jid_t jid_dup(jid_t jid)
duplicate a jid
jid_t jid
user jid (user@host)
void * xhash_get(xht h, const char *key)
int nad_append_namespace(nad_t nad, int elem, const char *uri, const char *prefix)
declare a namespace on an already-existing element
pool - base node for a pool.
pkt_t pkt_create(sm_t sm, const char *elem, const char *type, const char *to, const char *from)
int mm_user_unload(mm_t mm, user_t user)
user data is about to be unloaded
void sess_route(sess_t sess, pkt_t pkt)
send a packet to the client for this session
SM_API int user_create(sm_t sm, jid_t jid)
initialise a user