users.cc File Reference

functions for manipulating data for logged in users More...

#include "jsm.h"

Data Structures

struct  ht_count_struct

Typedefs

typedef struct ht_count_structht_count
typedef struct ht_count_struct _ht_count

Functions

void _js_users_del (xht h, const char *key, void *data, void *arg)
void _js_hosts_del (xht h, const char *key, void *data, void *arg)
result js_users_gc (void *arg)
void js_user_free_aux_data (void *arg)
udata js_user (jsmi si, jid id, xht ht)
int js_user_create (jsmi si, jid id)
int js_user_delete (jsmi si, jid id)


Detailed Description

functions for manipulating data for logged in users

Contains the garbage collector for user records we don't need in memory anymore and the function to load user records to memory.


Typedef Documentation

typedef struct ht_count_struct _ht_count

typedef struct ht_count_struct * ht_count


Function Documentation

void _js_hosts_del ( xht  h,
const char *  key,
void *  data,
void *  arg 
)

xhash_walker callback for walking the host hash tree

Parameters:
h the hash table containing all hosts
key the host for which the callback ist called
data the hashtable containing the users of this host
arg pointer to the user counter

References _js_users_del(), ht_count_struct::count, ht_count_struct::ht, log_debug2, LOGT_SESSION, xhash_walk(), and ZONE.

Referenced by js_users_gc().

void _js_users_del ( xht  h,
const char *  key,
void *  data,
void *  arg 
)

call-back for deleting user from the hash table

This function is called periodically by the user data garbage collection thread. It removes users aren't logged in from the global hashtable.

Parameters:
h the hash table containing the users of the presently cleaned host
key the user
data the user's data
arg structure holding the hashtable of hosts and the user counter

References ht_count_struct::count, xmppd::jabberid::get_node(), ht_count_struct::ht, udata_struct::id, log_debug2, LOGT_SESSION, udata_struct::p, pool_free(), udata_struct::ref, udata_struct::sessions, xhash_zap(), and ZONE.

Referenced by _js_hosts_del().

udata js_user ( jsmi  si,
jid  id,
xht  ht 
)

get the udata record for a user

js_user attempts to locate the user data record for the specifed id. First it looks in current list, if that fails, it looks in xdb and creates new list entry. If THAT fails, it returns NULL (not a user).

Parameters:
si the session manager instance data
id which user to load (some memory is allocated from this jid's pool)
ht the hash table for the host the user belongs to (may be NULL)
Returns:
the udata record for the user, NULL if no such user

References udata_struct::aux_data, xmppd::jabberid::get_domain(), xmppd::jabberid::get_node(), xmppd::jabberid_pool::get_pool(), xmppd::jabberid::has_node(), jsmi_struct::hosts, udata_struct::id, jid_full(), jid_new(), jid_user(), js_user_free_aux_data(), log_debug2, LOGT_SESSION, NS_AUTH, NS_AUTH_CRYPT, udata_struct::p, pmalloco(), pool_cleanup(), pool_heap, udata_struct::si, jsmi_struct::xc, xdb_get(), xhash_get(), xhash_new(), xhash_put(), xmlnode_free(), and ZONE.

int js_user_create ( jsmi  si,
jid  id 
)

inform registered modules of a newly created user

Parameters:
si the session manager instance
id the jid of the new user
Returns:
1 if the call was handled by a module, 0 if not

References e_CREATE, js_mapi_call(), and js_user().

Referenced by _js_routed_session_control_packet().

int js_user_delete ( jsmi  si,
jid  id 
)

inform registered modules of a deleted user

Parameters:
si the session manager instance
id the jid of the deleted user
Returns:
1 if the call was handled by a module, 0 if not

References e_DELETE, js_mapi_call(), and js_user().

Referenced by _js_routed_session_control_packet().

void js_user_free_aux_data ( void *  arg  ) 

References xhash_free().

Referenced by js_user().

result js_users_gc ( void *  arg  ) 

js_users_gc is a heartbeat that flushes old users from memory.

Parameters:
arg the session manager internal data
Returns:
always r_DONE

References _js_hosts_del(), jsmi_struct::hosts, log_debug2, log_notice(), LOGT_STATUS, r_DONE, xhash_walk(), and ZONE.

Referenced by jsm().


Generated on Wed Sep 10 01:59:48 2008 for jabberd14 by  doxygen 1.5.5