jabberd14  1.6.2
Namespaces | Functions
xhash.cc File Reference

implements a hashmap using STL containers More...

#include <jabberdlib.h>

Namespaces

namespace  xmppd

Functions

xht xhash_new (int prima)
void xhash_put (xht h, const char *key, void *val)
void * xhash_get (xht h, const char *key)
void * xhash_get_by_domain (xht h, const char *domain)
void xhash_zap (xht h, const char *key)
void xhash_free (xht h)
void xhash_walk (xht h, xhash_walker w, void *arg)
xmlnode xhash_to_xml (xht h)
xht xhash_from_xml (xmlnode hash, pool p)

Detailed Description

implements a hashmap using STL containers


Function Documentation

void xhash_free ( xht  h)
xht xhash_from_xml ( xmlnode  hash,
pool  p 
)

convert the xmlnode representation of an xhash back to an xhash

Note:
the result has to be freed by the caller using xhash_free()
Parameters:
hashthe xhash in xml notation
Returns:
xhash that has been created

References j_atoi(), pstrdup(), xhash_free(), xhash_new(), xhash_put(), xmlnode_get_attrib_ns(), xmlnode_get_data(), xmlnode_get_list_item(), and xmlnode_get_tags().

Referenced by xdb_file_phandler().

void* xhash_get ( xht  h,
const char *  key 
)
void* xhash_get_by_domain ( xht  h,
const char *  domain 
)

retrive a value from a xhash ... considering the key to be a domain

In contrast to xhash_get() this function interprets the key as a domain and checks all higher level domains, if the key is not found in the hash. If now higher level domains are found either, the key '*' is tried.

Example: For the domain 'a.example.com' the following lookups are done in this order until there is the first match: 'a.example.com', 'example.com', 'com', and '*'.

Parameters:
hthe xhash to get the value from
domainthe domain which should be used as the key

Referenced by dialback_check_settings(), dialback_in_read(), dialback_in_read_db(), and dialback_out_read().

xht xhash_new ( int  prima)
void xhash_put ( xht  h,
const char *  key,
void *  val 
)
xmlnode xhash_to_xml ( xht  h)

write the contents of an xhash to an xmlnode

Note:
the result has to be freed by the caller using xmlnode_free()
Parameters:
hthe xhash to be converted
Returns:
xmlnode tree containing the content of the xhash

References xhash_walk(), and xmlnode_new_tag_ns().

void xhash_walk ( xht  h,
xhash_walker  w,
void *  arg 
)

iterate over a xhash strucutre

Parameters:
hthe xhash to iterave over
wwhich function should be called for each value
argwhat to pass to the optional argument of the xhash_walker function

Referenced by _js_hosts_del(), _jsm_shutdown(), deliver(), deliver_routed_hosts(), dialback_beat_idle(), dialback_out_beat_packets(), dnsrv_beat_packets(), instance_shutdown(), js_users_gc(), jsm_serialize(), jsm_shutdown(), xdb_file_purge(), and xhash_to_xml().

void xhash_zap ( xht  h,
const char *  key 
)

remove an entry from the xhash

Parameters:
hthe xhash where a value should be removed
keythe key of the value, that should be removed

Referenced by _dialback_miod_hash_cleanup(), _dnsrv_beat_packets(), _js_users_del(), _xdb_file_purge(), dialback_in_dbic_cleanup(), dialback_out_connection_cleanup(), dnsrv_deliver(), dnsrv_process_xstream_io(), instance_shutdown(), js_session_end(), pool_free(), unregister_instance(), and xdb_file_phandler().