#include "urecord.h"
#include <string.h>
#include "../../mem/shm_mem.h"
#include "../../dprint.h"
#include "../../ut.h"
#include "../../hash_func.h"
#include "ul_mod.h"
#include "utime.h"
#include "ul_callback.h"

Go to the source code of this file.
Functions | |
| static struct ucontact * | contact_callid_match (ucontact_t *ptr, str *_c, str *_callid) |
| Match a contact record to a contact string and callid. | |
| static struct ucontact * | contact_match (ucontact_t *ptr, str *_c) |
| Match a contact record to a contact string. | |
| int | db_delete_urecord (urecord_t *_r) |
| Delete a record from the database. | |
| int | delete_ucontact (urecord_t *_r, struct ucontact *_c) |
| Delete ucontact from urecord. | |
| void | free_urecord (urecord_t *_r) |
| Free all memory used by the given structure. | |
| int | get_ucontact (urecord_t *_r, str *_c, str *_callid, int _cseq, struct ucontact **_co) |
| Get pointer to ucontact with given contact. | |
| int | insert_ucontact (urecord_t *_r, str *_contact, ucontact_info_t *_ci, ucontact_t **_c) |
| Create and insert new contact into urecord. | |
| void | mem_delete_ucontact (urecord_t *_r, ucontact_t *_c) |
| Remove contact in memory from the list and delete it. | |
| ucontact_t * | mem_insert_ucontact (urecord_t *_r, str *_c, ucontact_info_t *_ci) |
| Add a new contact in memory. | |
| void | mem_remove_ucontact (urecord_t *_r, ucontact_t *_c) |
| Remove the contact from lists in memory. | |
| int | new_urecord (str *_dom, str *_aor, urecord_t **_r) |
| Create and initialize new record structure. | |
| static void | nodb_timer (urecord_t *_r) |
| Expires timer for NO_DB db_mode. | |
| void | print_urecord (FILE *_f, urecord_t *_r) |
| Print a record, useful for debugging. | |
| void | release_urecord (urecord_t *_r) |
| Release urecord previously obtained through get_urecord. | |
| void | timer_urecord (urecord_t *_r) |
| Run timer functions depending on the db_mode setting. | |
| static void | wb_timer (urecord_t *_r) |
| Write-back timer, used for WRITE_BACK db_mode. | |
| static void | wt_timer (urecord_t *_r) |
| Write through timer, used for WRITE_THROUGH db_mode. | |
Variables | |
| int | cseq_delay = 20 |
| int | matching_mode = CONTACT_ONLY |
Definition in file urecord.c.
| static struct ucontact* contact_callid_match | ( | ucontact_t * | ptr, | |
| str * | _c, | |||
| str * | _callid | |||
| ) | [static, read] |
Match a contact record to a contact string and callid.
Definition at line 539 of file urecord.c.
References ucontact::c, ucontact::callid, _str::len, ucontact::next, and _str::s.
Referenced by get_ucontact().
| static struct ucontact* contact_match | ( | ucontact_t * | ptr, | |
| str * | _c | |||
| ) | [static, read] |
Match a contact record to a contact string.
Definition at line 519 of file urecord.c.
References ucontact::c, _str::len, ucontact::next, and _str::s.
Referenced by get_ucontact().
| int db_delete_urecord | ( | urecord_t * | _r | ) |
Delete a record from the database.
| _r | deleted record |
Definition at line 396 of file urecord.c.
References urecord::aor, DB_STR, db_func::delete, urecord::domain, domain_col, _str::len, LM_ERR, db_val_t::nul, _str::s, db_val_t::str_val, db_val_t::type, ul_dbf, ul_dbh, use_domain, db_func::use_table, user_col, db_val_t::val, and vals.
Referenced by delete_urecord().
Definition at line 490 of file urecord.c.
References db_delete_ucontact(), db_mode, DB_ONLY, exists_ulcb_type, LM_ERR, mem_delete_ucontact(), run_ul_callbacks(), st_delete_ucontact(), UL_CONTACT_DELETE, and WRITE_THROUGH.
Referenced by bind_usrloc(), delete_urecord(), and mi_usrloc_rm_contact().
| void free_urecord | ( | urecord_t * | _r | ) |
Free all memory used by the given structure.
Free all memory used by the given structure. The structure must be removed from all linked lists first
| _r | freed record list |
Definition at line 92 of file urecord.c.
References urecord::aor, urecord::contacts, db_mode, DB_ONLY, free_ucontact(), ucontact::next, _str::s, and shm_free.
Referenced by db_load_urecord(), deinit_slot(), delete_urecord(), mem_delete_urecord(), and release_urecord().
Get pointer to ucontact with given contact.
| _r | record where to search the contacts | |
| _c | contact string | |
| _callid | callid | |
| _cseq | CSEQ number | |
| _co | found contact |
Definition at line 566 of file urecord.c.
References act_time, ucontact::callid, CONTACT_CALLID, contact_callid_match(), contact_match(), CONTACT_ONLY, urecord::contacts, ucontact::cseq, cseq_delay, get_act_time(), ucontact::last_modified, _str::len, LM_CRIT, matching_mode, and _str::s.
Referenced by bind_usrloc(), mi_usrloc_add(), and mi_usrloc_rm_contact().
| int insert_ucontact | ( | urecord_t * | _r, | |
| str * | _contact, | |||
| ucontact_info_t * | _ci, | |||
| ucontact_t ** | _c | |||
| ) |
Create and insert new contact into urecord.
| _r | record into the new contact should be inserted | |
| _contact | contact string | |
| _ci | contact information | |
| _c | new created contact |
Definition at line 459 of file urecord.c.
References CS_SYNC, db_insert_ucontact(), db_mode, DB_ONLY, exists_ulcb_type, LM_ERR, mem_insert_ucontact(), run_ul_callbacks(), UL_CONTACT_INSERT, and WRITE_THROUGH.
Referenced by bind_usrloc(), and mi_usrloc_add().
| void mem_delete_ucontact | ( | urecord_t * | _r, | |
| ucontact_t * | _c | |||
| ) |
Remove contact in memory from the list and delete it.
Definition at line 216 of file urecord.c.
References udomain::contacts, hslot::d, free_ucontact(), if_update_stat, mem_remove_ucontact(), and urecord::slot.
Referenced by delete_ucontact(), nodb_timer(), wb_timer(), and wt_timer().
| ucontact_t* mem_insert_ucontact | ( | urecord_t * | _r, | |
| str * | _c, | |||
| ucontact_info_t * | _ci | |||
| ) |
Add a new contact in memory.
Add a new contact in memory, contacts are ordered by: 1) q value, 2) descending modification time
Definition at line 147 of file urecord.c.
References urecord::aor, urecord::contacts, udomain::contacts, hslot::d, desc_time_order, urecord::domain, if_update_stat, LM_ERR, new_ucontact(), ucontact::next, ucontact::prev, ucontact::q, and urecord::slot.
Referenced by db_load_urecord(), insert_ucontact(), and preload_udomain().
| void mem_remove_ucontact | ( | urecord_t * | _r, | |
| ucontact_t * | _c | |||
| ) |
Remove the contact from lists in memory.
Definition at line 195 of file urecord.c.
References urecord::contacts, ucontact::next, and ucontact::prev.
Referenced by mem_delete_ucontact().
Create and initialize new record structure.
| _dom | domain name | |
| _aor | address of record | |
| _r | pointer to the new record |
Definition at line 60 of file urecord.c.
References core_hash(), _str::len, LM_ERR, _str::s, shm_free, and shm_malloc().
Referenced by mem_insert_urecord().
| static void nodb_timer | ( | urecord_t * | _r | ) | [inline, static] |
Expires timer for NO_DB db_mode.
Expires timer for NO_DB db_mode, process all contacts from the record, delete the expired ones from memory.
| _r | processed record |
Definition at line 231 of file urecord.c.
References act_time, ucontact::aor, ucontact::c, urecord::contacts, hslot::d, exists_ulcb_type, udomain::expires, _str::len, LM_DBG, mem_delete_ucontact(), ucontact::next, run_ul_callbacks(), _str::s, urecord::slot, UL_CONTACT_EXPIRE, update_stat, VALID_CONTACT, and ZSW.
Referenced by timer_urecord().
| void print_urecord | ( | FILE * | _f, | |
| urecord_t * | _r | |||
| ) |
Print a record, useful for debugging.
| _f | print output | |
| _r | printed record |
Definition at line 115 of file urecord.c.
References urecord::aor, urecord::aorhash, urecord::contacts, hslot::d, urecord::domain, _str::len, ucontact::next, print_ucontact(), _str::s, udomain::size, urecord::slot, and ZSW.
Referenced by print_udomain().
| void release_urecord | ( | urecord_t * | _r | ) |
Release urecord previously obtained through get_urecord.
| _r | released record |
Definition at line 441 of file urecord.c.
References urecord::contacts, hslot::d, db_mode, DB_ONLY, free_urecord(), mem_delete_urecord(), and urecord::slot.
Referenced by bind_usrloc(), delete_urecord(), mi_usrloc_add(), and mi_usrloc_rm_contact().
| void timer_urecord | ( | urecord_t * | _r | ) |
Run timer functions depending on the db_mode setting.
Helper function that run the appropriate timer function, depending on the db_mode setting.
| _r | processed record |
Definition at line 376 of file urecord.c.
References db_mode, NO_DB, nodb_timer(), wb_timer(), WRITE_BACK, and WRITE_THROUGH.
Referenced by mem_timer_udomain().
| static void wb_timer | ( | urecord_t * | _r | ) | [inline, static] |
Write-back timer, used for WRITE_BACK db_mode.
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.
| _r | processed record |
Definition at line 308 of file urecord.c.
References act_time, ucontact::aor, ucontact::c, urecord::contacts, hslot::d, db_delete_ucontact(), db_insert_ucontact(), db_update_ucontact(), exists_ulcb_type, udomain::expires, _str::len, LM_DBG, LM_ERR, mem_delete_ucontact(), ucontact::next, run_ul_callbacks(), _str::s, urecord::slot, st_expired_ucontact(), st_flush_ucontact(), ucontact::state, UL_CONTACT_EXPIRE, update_stat, VALID_CONTACT, and ZSW.
Referenced by timer_urecord().
| static void wt_timer | ( | urecord_t * | _r | ) | [inline, static] |
Write through timer, used for WRITE_THROUGH db_mode.
Write through timer, used for WRITE_THROUGH db_mode. Process all contacts from the record, delete all expired ones from the DB.
| _r | processed record |
Definition at line 267 of file urecord.c.
References act_time, ucontact::aor, ucontact::c, urecord::contacts, hslot::d, db_delete_ucontact(), exists_ulcb_type, udomain::expires, _str::len, LM_DBG, LM_ERR, mem_delete_ucontact(), ucontact::next, run_ul_callbacks(), _str::s, urecord::slot, UL_CONTACT_EXPIRE, update_stat, VALID_CONTACT, and ZSW.
| int cseq_delay = 20 |
retransmission detection interval in seconds
Definition at line 51 of file urecord.c.
Referenced by get_ucontact().
| int matching_mode = CONTACT_ONLY |
contact matching mode
Definition at line 49 of file urecord.c.
Referenced by get_ucontact(), and mod_init().
1.5.6