Functions

modules_k/usrloc/udomain.c File Reference

USRLOC - Userloc domain handling functions

More...

#include "udomain.h"
#include <string.h>
#include "../../parser/parse_methods.h"
#include "../../mem/shm_mem.h"
#include "../../dprint.h"
#include "../../lib/srdb1/db.h"
#include "../../socket_info.h"
#include "../../ut.h"
#include "../../hashes.h"
#include "ul_mod.h"
#include "usrloc.h"
#include "utime.h"
Include dependency graph for modules_k/usrloc/udomain.c:

Go to the source code of this file.

Functions


Detailed Description

Definition in file modules_k/usrloc/udomain.c.


Function Documentation

urecord_t* db_load_urecord ( db1_con_t _c,
udomain_t _d,
str _aor 
)
Parameters:
_c database connection
_d domain
_aor address of record
Returns:
pointer to the record on success, 0 on errors or if nothing is found

Definition at line 529 of file modules_k/usrloc/udomain.c.

References callid_col, contact, contact_col, cseq_col, dbrow2info(), desc_time_order, domain_col, expires_col, flags_col, free_urecord(), get_static_urecord(), instance_col, last_mod_col, _str::len, mem_insert_ucontact(), methods_col, udomain::name, db_val_t::nul, path_col, q_col, received_col, reg_id_col, RES_ROW_N, RES_ROWS, ROW_VALUES, ruid_col, _str::s, sock_col, ucontact::state, db_val_t::str_val, db_val_t::type, use_domain, user_agent_col, user_col, and db_val_t::val.

Here is the call graph for this function:

urecord_t* db_load_urecord_by_ruid ( db1_con_t _c,
udomain_t _d,
str _ruid 
)
Parameters:
_c database connection
_d domain
_aor address of record
Returns:
pointer to the record on success, 0 on errors or if nothing is found

Definition at line 640 of file modules_k/usrloc/udomain.c.

References urecord::aor, callid_col, contact, contact_col, cseq_col, dbrow2info(), desc_time_order, domain_col, expires_col, flags_col, free_urecord(), get_static_urecord(), instance_col, last_mod_col, _str::len, mem_insert_ucontact(), methods_col, udomain::name, db_val_t::nul, path_col, q_col, received_col, reg_id_col, RES_ROW_N, RES_ROWS, ROW_VALUES, ruid_col, _str::s, sock_col, ucontact::state, db_val_t::str_val, db_val_t::type, use_domain, user_agent_col, user_col, db_val_t::val, VAL_NULL, and VAL_STRING.

Referenced by get_urecord_by_ruid().

Here is the call graph for this function:

Here is the caller graph for this function:

int db_timer_udomain ( udomain_t _d  ) 
Parameters:
_d cleaned domain
Returns:
0 on success, -1 on failure

Definition at line 762 of file modules_k/usrloc/udomain.c.

References expires_col, udomain::name, db_val_t::nul, _str::s, db_val_t::time_val, db_val_t::type, and db_val_t::val.

static ucontact_info_t* dbrow2info ( db_val_t vals,
str contact 
) [inline, static]

Convert database values into ucontact_info, expects 12 rows (contact, expirs, q, callid, cseq, flags, ua, received, path, socket, methods, last_modified)

Parameters:
vals database values
contact contact
Returns:
pointer to the ucontact_info on success, 0 on failure

Definition at line 228 of file modules_k/usrloc/udomain.c.

References ucontact_info::callid, ucontact_info::cflags, ucontact_info::cseq, ucontact_info::expires, ucontact_info::flags, ucontact_info::instance, ucontact_info::last_modified, _str::len, ucontact_info::methods, parse_phostport(), ucontact_info::path, ucontact_info::q, ucontact_info::received, ucontact_info::reg_id, ucontact_info::ruid, _str::s, ucontact_info::sock, ucontact_info::user_agent, VAL_BITMAP, VAL_DOUBLE, VAL_INT, VAL_NULL, VAL_STRING, VAL_TIME, and VAL_UINT.

Referenced by db_load_urecord(), db_load_urecord_by_ruid(), and preload_udomain().

Here is the call graph for this function:

Here is the caller graph for this function:

int delete_urecord ( udomain_t _d,
str _aor,
struct urecord _r 
)
Parameters:
_d domain where the record should be deleted
_aor address of record
_r deleted record
Returns:
0 on success, -1 if the record could not be deleted

Definition at line 1093 of file modules_k/usrloc/udomain.c.

References ucontact::c, urecord::contacts, db_delete_urecord(), db_mode, DB_ONLY, delete_ucontact(), free_urecord(), get_static_urecord(), get_urecord(), ucontact::next, and release_urecord().

Here is the call graph for this function:

void free_udomain ( udomain_t _d  ) 
Parameters:
_d freed domain

Definition at line 151 of file modules_k/usrloc/udomain.c.

References deinit_slot(), lock_ulslot(), udomain::size, udomain::table, and unlock_ulslot().

Here is the call graph for this function:

static void get_static_urecord ( udomain_t _d,
str _aor,
struct urecord **  _r 
) [inline, static]
Parameters:
_d domain (needed for the name)
_aor address of record
_r new created urecord

Definition at line 173 of file modules_k/usrloc/udomain.c.

References urecord::aor, urecord::aorhash, urecord::domain, and udomain::name.

Referenced by db_load_urecord(), db_load_urecord_by_ruid(), delete_urecord(), and insert_urecord().

Here is the caller graph for this function:

int get_urecord ( udomain_t _d,
str _aor,
struct urecord **  _r 
)
Parameters:
_d domain to search the record
_aor address of record
_r new created record
Returns:
0 if a record was found, 1 if nothing could be found

Definition at line 995 of file modules_k/usrloc/udomain.c.

References urecord::aorhash, db_load_urecord(), db_mode, DB_ONLY, _str::len, urecord::next, _str::s, udomain::size, and udomain::table.

Here is the call graph for this function:

int get_urecord_by_ruid ( udomain_t _d,
unsigned int  _aorhash,
str _ruid,
struct urecord **  _r,
struct ucontact **  _c 
)
Parameters:
_d domain to search the record
_aorhash hash id for address of record
_ruid record internal unique id
_r store pointer to location record
_c store pointer to contact structure
Returns:
0 if a record was found, 1 if nothing could be found

Definition at line 1036 of file modules_k/usrloc/udomain.c.

References urecord::aorhash, urecord::contacts, db_load_urecord_by_ruid(), db_mode, DB_ONLY, _str::len, lock_ulslot(), urecord::next, ucontact::ruid, _str::s, udomain::size, udomain::table, and unlock_ulslot().

Here is the call graph for this function:

int insert_urecord ( udomain_t _d,
str _aor,
struct urecord **  _r 
)
Parameters:
_d domain to insert the new record
_aor address of the record
_r new created record
Returns:
return 0 on success, -1 on failure

Definition at line 974 of file modules_k/usrloc/udomain.c.

References db_mode, DB_ONLY, get_static_urecord(), and mem_insert_urecord().

Here is the call graph for this function:

void lock_udomain ( udomain_t _d,
str _aor 
)

Timer handler for given domain.

Parameters:
_d domain
_aor adress of record, used as hash source for the lock slot

Definition at line 899 of file modules_k/usrloc/udomain.c.

References db_mode, DB_ONLY, udomain::size, udomain::table, and ul_lock_idx().

Here is the call graph for this function:

void lock_ulslot ( udomain_t _d,
int  i 
)
Parameters:
_d domain
i slot number

Definition at line 939 of file modules_k/usrloc/udomain.c.

References db_mode, DB_ONLY, udomain::table, and ul_lock_idx().

Here is the call graph for this function:

void mem_delete_urecord ( udomain_t _d,
struct urecord _r 
)
Parameters:
_d domain the record belongs to
_r deleted record

Definition at line 855 of file modules_k/usrloc/udomain.c.

References free_urecord(), urecord::slot, slot_rem(), and udomain::users.

Here is the call graph for this function:

int mem_insert_urecord ( udomain_t _d,
str _aor,
struct urecord **  _r 
)
Parameters:
_d domain the record belongs to
_aor address of record
_r new created record
Returns:
0 on success, -1 on failure

Definition at line 834 of file modules_k/usrloc/udomain.c.

References udomain::name, new_urecord(), udomain::size, slot_add(), udomain::table, and udomain::users.

Here is the call graph for this function:

void mem_timer_udomain ( udomain_t _d,
int  istart,
int  istep 
)
Parameters:
_d domain

Definition at line 867 of file modules_k/usrloc/udomain.c.

References urecord::contacts, lock_ulslot(), mem_delete_urecord(), urecord::next, udomain::size, udomain::table, timer_urecord(), and unlock_ulslot().

Here is the call graph for this function:

int new_udomain ( str _n,
int  _s,
udomain_t **  _d 
)
Parameters:
_n is pointer to str representing name of the domain, the string is not copied, it should point to str structure stored in domain list
_s is hash table size
_d new created domain
Returns:
0 on success, -1 on failure

Definition at line 84 of file modules_k/usrloc/udomain.c.

References init_slot().

Here is the call graph for this function:

int preload_udomain ( db1_con_t _c,
udomain_t _d 
)

Load all records from a udomain, useful to populate the memory cache on startup.

Parameters:
_c database connection
_d loaded domain
Returns:
0 on success, -1 on failure

Definition at line 367 of file modules_k/usrloc/udomain.c.

References callid_col, contact, contact_col, cseq_col, DB_CAP_FETCH, DB_CAPABILITY, dbrow2info(), domain_col, expires_col, flags_col, free_ucontact(), get_urecord(), instance_col, last_mod_col, _str::len, lock_udomain(), MAX_URI_SIZE, mem_insert_ucontact(), mem_insert_urecord(), methods_col, udomain::name, path_col, q_col, received_col, reg_id_col, RES_ROW_N, RES_ROWS, ROW_VALUES, ruid_col, _str::s, sock_col, ucontact::state, ul_fetch_rows, unlock_udomain(), use_domain, user_agent_col, user_col, VAL_NULL, and VAL_STRING.

Referenced by child_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void print_udomain ( FILE *  _f,
udomain_t _d 
)

Print udomain, debugging helper function.

Definition at line 189 of file modules_k/usrloc/udomain.c.

References _str::len, udomain::name, urecord::next, print_urecord(), _str::s, udomain::size, urecord::slot, table, and udomain::table.

Here is the call graph for this function:

int testdb_udomain ( db1_con_t con,
udomain_t d 
)
Parameters:
con database connection
d domain

Definition at line 799 of file modules_k/usrloc/udomain.c.

References udomain::name, user_col, VAL_NULL, VAL_STRING, and VAL_TYPE.

Referenced by register_udomain().

Here is the caller graph for this function:

void unlock_udomain ( udomain_t _d,
str _aor 
)
Parameters:
_d domain
_aor address of record, uses as hash source for the lock slot

Definition at line 920 of file modules_k/usrloc/udomain.c.

References db_mode, DB_ONLY, udomain::size, udomain::table, and ul_release_idx().

Here is the call graph for this function:

void unlock_ulslot ( udomain_t _d,
int  i 
)
Parameters:
_d domain
i slot number

Definition at line 955 of file modules_k/usrloc/udomain.c.

References db_mode, DB_ONLY, udomain::table, and ul_release_idx().

Here is the call graph for this function: