Functions | Variables

modules_k/p_usrloc/urecord.c File Reference

USRLOC - Usrloc record structure

More...

#include "../usrloc/usrloc.h"
#include "urecord.h"
#include <string.h>
#include "../../mem/shm_mem.h"
#include "../../dprint.h"
#include "../../ut.h"
#include "../../hashes.h"
#include "p_usrloc_mod.h"
#include "utime.h"
#include "../usrloc/ul_callback.h"
#include "ul_db_layer.h"
Include dependency graph for modules_k/p_usrloc/urecord.c:

Go to the source code of this file.

Functions

Variables


Detailed Description

Definition in file modules_k/p_usrloc/urecord.c.


Function Documentation

static struct ucontact* contact_callid_match ( ucontact_t ptr,
str _c,
str _callid 
) [static, read]
Parameters:
ptr contact record
_c contact string
_callid callid
Returns:
ptr on successfull match, 0 when they not match

Definition at line 535 of file modules_k/p_usrloc/urecord.c.

References ucontact::c, ucontact::callid, _str::len, ucontact::next, and _str::s.

Referenced by get_ucontact().

Here is the caller graph for this function:

static struct ucontact* contact_match ( ucontact_t ptr,
str _c 
) [static, read]
Parameters:
ptr contact record
_c contact string
Returns:
ptr on successfull match, 0 when they not match

Definition at line 515 of file modules_k/p_usrloc/urecord.c.

References ucontact::c, _str::len, ucontact::next, and _str::s.

Referenced by contact_path_match(), and get_ucontact().

Here is the caller graph for this function:

static struct ucontact* contact_path_match ( ucontact_t ptr,
str _c,
str _path 
) [static, read]

Match a contact record to a contact string and path + *

Parameters:
ptr contact record + *
_c contact string + *
_path path + *
Returns:
ptr on successfull match, 0 when they not match +

Definition at line 559 of file modules_k/p_usrloc/urecord.c.

References ucontact::c, contact_match(), _str::len, ucontact::next, ucontact::path, and _str::s.

Referenced by get_ucontact().

Here is the call graph for this function:

Here is the caller graph for this function:

int db_delete_urecord ( udomain_t _d,
urecord_t _r 
)
Parameters:
_r deleted record
Returns:
0 on success, -1 on failure

Definition at line 398 of file modules_k/p_usrloc/urecord.c.

References urecord::aor, domain_col, _str::len, db_val_t::nul, _str::s, db_val_t::str_val, db_val_t::type, use_domain, user_col, and db_val_t::val.

Referenced by delete_urecord().

Here is the caller graph for this function:

int delete_ucontact ( urecord_t _r,
struct ucontact _c 
)
Parameters:
_r record where the contact belongs to
_c deleted contact
Returns:
0 on success, -1 on failure

Definition at line 486 of file modules_k/p_usrloc/urecord.c.

Referenced by delete_urecord(), and mi_usrloc_rm_contact().

Here is the caller graph for this function:

void free_urecord ( urecord_t _r  ) 

Free all memory used by the given structure. The structure must be removed from all linked lists first

Parameters:
_r freed record list

Definition at line 94 of file modules_k/p_usrloc/urecord.c.

Referenced by db_load_urecord(), db_load_urecord_by_ruid(), deinit_slot(), delete_urecord(), mem_delete_urecord(), and release_urecord().

Here is the caller graph for this function:

int get_ucontact ( urecord_t _r,
str _c,
str _callid,
str _path,
int  _cseq,
struct ucontact **  _co 
)
Parameters:
_r record where to search the contacts
_c contact string
_callid callid
_cseq CSEQ number
_co found contact
Returns:
0 - found, 1 - not found, -1 - invalid found, -2 - found, but to be skipped (same cseq)

Definition at line 588 of file modules_k/p_usrloc/urecord.c.

Referenced by get_ucontact_by_instance(), mi_usrloc_add(), and mi_usrloc_rm_contact().

Here is the caller graph for this function:

int insert_ucontact ( urecord_t _r,
str _contact,
ucontact_info_t _ci,
ucontact_t **  _c 
)
Parameters:
_r record into the new contact should be inserted
_contact contact string
_ci contact information
_c new created contact
Returns:
0 on success, -1 on failure

Definition at line 455 of file modules_k/p_usrloc/urecord.c.

Referenced by mi_usrloc_add().

Here is the caller graph for this function:

void mem_delete_ucontact ( urecord_t _r,
ucontact_t _c 
)
Parameters:
_r record this contact belongs to
_c deleted contact

Definition at line 218 of file modules_k/p_usrloc/urecord.c.

Referenced by delete_ucontact(), nodb_timer(), wb_timer(), and wt_timer().

Here is the caller graph for this function:

ucontact_t* mem_insert_ucontact ( urecord_t _r,
str _c,
ucontact_info_t _ci 
)

Add a new contact in memory, contacts are ordered by: 1) q value, 2) descending modification time

Parameters:
_r record this contact belongs to
_c contact
_ci contact information
Returns:
pointer to new created contact on success, 0 on failure

Definition at line 149 of file modules_k/p_usrloc/urecord.c.

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

Here is the caller graph for this function:

void mem_remove_ucontact ( urecord_t _r,
ucontact_t _c 
)
Parameters:
_r record this contact belongs to
_c removed contact

Definition at line 197 of file modules_k/p_usrloc/urecord.c.

Referenced by mem_delete_ucontact().

Here is the caller graph for this function:

int new_urecord ( str _dom,
str _aor,
urecord_t **  _r 
)

Hash table slot.

Parameters:
_dom domain name
_aor address of record
_r pointer to the new record
Returns:
0 on success, negative on failure

Definition at line 62 of file modules_k/p_usrloc/urecord.c.

Referenced by mem_insert_urecord().

Here is the caller graph for this function:

static void nodb_timer ( urecord_t _r  )  [inline, static]

Expires timer for NO_DB db_mode, process all contacts from the record, delete the expired ones from memory.

Parameters:
_r processed record

Definition at line 233 of file modules_k/p_usrloc/urecord.c.

References ucontact::aor, ucontact::c, urecord::contacts, _str::len, mem_delete_ucontact(), ucontact::next, run_ul_callbacks(), _str::s, urecord::slot, and VALID_CONTACT.

Referenced by timer_urecord().

Here is the call graph for this function:

Here is the caller graph for this function:

void print_urecord ( FILE *  _f,
urecord_t _r 
)
Parameters:
_f print output
_r printed record

Definition at line 117 of file modules_k/p_usrloc/urecord.c.

Referenced by print_udomain().

Here is the caller graph for this function:

void release_urecord ( urecord_t _r  ) 
Warning:
Failing to calls this function after get_urecord will result in a memory leak when the DB_ONLY mode is used. When the records is later deleted, e.g. with delete_urecord, then its not necessary, as this function already releases the record.
Parameters:
_r released record

Definition at line 437 of file modules_k/p_usrloc/urecord.c.

Referenced by delete_urecord(), mi_usrloc_add(), and mi_usrloc_rm_contact().

Here is the caller graph for this function:

void timer_urecord ( urecord_t _r  ) 

Helper function that run the appropriate timer function, depending on the db_mode setting.

Parameters:
_r processed record

Definition at line 378 of file modules_k/p_usrloc/urecord.c.

Referenced by mem_timer_udomain().

Here is the caller graph for this function:

static void wb_timer ( urecord_t _r  )  [inline, static]

Write-back timer, used for WRITE_BACK db_mode. Process all contacts from the record, delete expired ones from the DB. Furthermore it updates changed contacts, and also insert new ones in the DB.

Parameters:
_r processed record

Definition at line 310 of file modules_k/p_usrloc/urecord.c.

References ucontact::aor, ucontact::c, urecord::contacts, db_delete_ucontact(), db_insert_ucontact(), db_update_ucontact(), _str::len, mem_delete_ucontact(), ucontact::next, run_ul_callbacks(), _str::s, urecord::slot, st_expired_ucontact(), st_flush_ucontact(), ucontact::state, and VALID_CONTACT.

Referenced by timer_urecord().

Here is the call graph for this function:

Here is the caller graph for this function:

static void wt_timer ( urecord_t _r  )  [inline, static]

Write through timer, used for WRITE_THROUGH db_mode. Process all contacts from the record, delete all expired ones from the DB.

Parameters:
_r processed record
Note:
currently unused, this mode is also handled by the wb_timer

Definition at line 269 of file modules_k/p_usrloc/urecord.c.

References ucontact::aor, ucontact::c, urecord::contacts, db_delete_ucontact(), _str::len, mem_delete_ucontact(), ucontact::next, run_ul_callbacks(), _str::s, urecord::slot, and VALID_CONTACT.

Here is the call graph for this function: