#include "ucontact.h"
#include <string.h>
#include "../../mem/shm_mem.h"
#include "../../ut.h"
#include "../../ip_addr.h"
#include "../../socket_info.h"
#include "../../dprint.h"
#include "../../db/db.h"
#include "ul_mod.h"
#include "ul_callback.h"
#include "urecord.h"

Go to the source code of this file.
Defines | |
| #define | update_str(_old, _new) |
Functions | |
| int | db_delete_ucontact (ucontact_t *_c) |
| Delete contact from the database. | |
| int | db_insert_ucontact (ucontact_t *_c) |
| Insert contact into the database. | |
| int | db_update_ucontact (ucontact_t *_c) |
| Update contact in the database. | |
| void | free_ucontact (ucontact_t *_c) |
| Free all memory associated with given contact structure. | |
| int | mem_update_ucontact (ucontact_t *_c, ucontact_info_t *_ci) |
| Update existing contact in memory with new values. | |
| ucontact_t * | new_ucontact (str *_dom, str *_aor, str *_contact, ucontact_info_t *_ci) |
| Create a new contact structure. | |
| void | print_ucontact (FILE *_f, ucontact_t *_c) |
| Print contact, for debugging purposes only. | |
| int | st_delete_ucontact (ucontact_t *_c) |
| Update state of the contact. | |
| int | st_expired_ucontact (ucontact_t *_c) |
| Called when the timer is about to delete an expired contact. | |
| int | st_flush_ucontact (ucontact_t *_c) |
| Called when the timer is about flushing the contact, updates contact state. | |
| void | st_update_ucontact (ucontact_t *_c) |
| Update state of the contact if we are using write-back scheme. | |
| static void | unlink_contact (struct urecord *_r, ucontact_t *_c) |
| Remove a contact from list belonging to a certain record. | |
| static void | update_contact_pos (struct urecord *_r, ucontact_t *_c) |
| Insert a new contact into the list at the correct position. | |
| int | update_ucontact (struct urecord *_r, ucontact_t *_c, ucontact_info_t *_ci) |
| Update ucontact with new values. | |
Definition in file ucontact.c.
| #define update_str | ( | _old, | |||
| _new | ) |
Referenced by mem_update_ucontact().
| int db_delete_ucontact | ( | ucontact_t * | _c | ) |
Delete contact from the database.
| _c | deleted contact |
Definition at line 660 of file ucontact.c.
References ucontact::aor, ucontact::c, ucontact::callid, callid_col, contact_col, DB_STR, db_func::delete, ucontact::domain, domain_col, FL_MEM, ucontact::flags, _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_ucontact(), wb_timer(), and wt_timer().
| int db_insert_ucontact | ( | ucontact_t * | _c | ) |
Insert contact into the database.
| _c | inserted contact |
Definition at line 387 of file ucontact.c.
References ucontact::aor, db_val_t::bitmap_val, ucontact::c, ucontact::callid, callid_col, ucontact::cflags, cflags_col, contact_col, ucontact::cseq, cseq_col, DB_BITMAP, DB_DATETIME, DB_DOUBLE, DB_INT, DB_STR, ucontact::domain, domain_col, db_val_t::double_val, ucontact::expires, expires_col, FL_MEM, ucontact::flags, flags_col, db_func::insert, db_val_t::int_val, last_mod_col, ucontact::last_modified, _str::len, LM_ERR, ucontact::methods, methods_col, db_val_t::nul, ucontact::path, path_col, ucontact::q, q2double(), q_col, ucontact::received, received_col, _str::s, ucontact::sock, sock_col, socket_info::sock_str, db_val_t::str_val, db_val_t::time_val, db_val_t::type, ul_dbf, ul_dbh, use_domain, db_func::use_table, ucontact::user_agent, user_agent_col, user_col, db_val_t::val, and vals.
Referenced by insert_ucontact(), and wb_timer().
| int db_update_ucontact | ( | ucontact_t * | _c | ) |
Update contact in the database.
| _c | updated contact |
Definition at line 525 of file ucontact.c.
References ucontact::aor, db_val_t::bitmap_val, ucontact::c, ucontact::callid, callid_col, ucontact::cflags, cflags_col, contact_col, ucontact::cseq, cseq_col, DB_BITMAP, DB_DATETIME, DB_DOUBLE, DB_INT, DB_STR, ucontact::domain, domain_col, db_val_t::double_val, ucontact::expires, expires_col, FL_MEM, ucontact::flags, flags_col, db_val_t::int_val, last_mod_col, ucontact::last_modified, _str::len, LM_ERR, ucontact::methods, methods_col, db_val_t::nul, ucontact::path, path_col, ucontact::q, q2double(), q_col, ucontact::received, received_col, _str::s, ucontact::sock, sock_col, socket_info::sock_str, db_val_t::str_val, db_val_t::time_val, db_val_t::type, ul_dbf, ul_dbh, db_func::update, use_domain, db_func::use_table, ucontact::user_agent, user_agent_col, user_col, and db_val_t::val.
Referenced by update_ucontact(), and wb_timer().
| void free_ucontact | ( | ucontact_t * | _c | ) |
Free all memory associated with given contact structure.
| _c | freed contact |
Definition at line 110 of file ucontact.c.
References ucontact::c, ucontact::callid, ucontact::path, ucontact::received, _str::s, shm_free, and ucontact::user_agent.
Referenced by free_urecord(), mem_delete_ucontact(), and preload_udomain().
| int mem_update_ucontact | ( | ucontact_t * | _c, | |
| ucontact_info_t * | _ci | |||
| ) |
Update existing contact in memory with new values.
Definition at line 183 of file ucontact.c.
References ucontact_info::cflags, ucontact::cflags, ucontact_info::cseq, ucontact::cseq, ucontact_info::expires, ucontact::expires, ucontact_info::flags, ucontact::flags, ucontact_info::last_modified, ucontact::last_modified, _str::len, ucontact_info::methods, ucontact::methods, ucontact::path, ucontact_info::path, ucontact_info::q, ucontact::q, ucontact::received, ucontact_info::received, _str::s, shm_free, ucontact_info::sock, ucontact::sock, update_str, ucontact_info::user_agent, and ucontact::user_agent.
Referenced by update_ucontact().
| ucontact_t* new_ucontact | ( | str * | _dom, | |
| str * | _aor, | |||
| str * | _contact, | |||
| ucontact_info_t * | _ci | |||
| ) |
Create a new contact structure.
Definition at line 58 of file ucontact.c.
References ucontact::aor, ucontact::c, ucontact_info::callid, ucontact::callid, ucontact_info::cflags, ucontact::cflags, CS_NEW, ucontact_info::cseq, ucontact::cseq, ucontact::domain, ucontact_info::expires, ucontact::expires, ucontact_info::flags, ucontact::flags, ucontact_info::last_modified, ucontact::last_modified, _str::len, LM_ERR, ucontact_info::methods, ucontact::methods, ucontact::path, ucontact_info::path, ucontact_info::q, ucontact::q, ucontact::received, ucontact_info::received, _str::s, shm_free, shm_malloc(), shm_str_dup(), ucontact_info::sock, ucontact::sock, ucontact::state, ucontact_info::user_agent, and ucontact::user_agent.
Referenced by mem_insert_ucontact().
| void print_ucontact | ( | FILE * | _f, | |
| ucontact_t * | _c | |||
| ) |
Print contact, for debugging purposes only.
| _f | output file | |
| _c | printed contact |
Definition at line 127 of file ucontact.c.
References ucontact::aor, ucontact::c, ucontact::callid, CS_DIRTY, CS_NEW, CS_SYNC, ucontact::cseq, ucontact::domain, ucontact::expires, ucontact::flags, _str::len, ucontact::methods, ucontact::next, ucontact::path, ucontact::prev, ucontact::q, q2str(), ucontact::received, _str::s, ucontact::sock, socket_info::sock_str, ucontact::state, UL_EXPIRED_TIME, ucontact::user_agent, and ZSW.
Referenced by print_urecord().
| int st_delete_ucontact | ( | ucontact_t * | _c | ) |
Update state of the contact.
| _c | updated contact |
Definition at line 280 of file ucontact.c.
References CS_DIRTY, CS_NEW, CS_SYNC, db_mode, ucontact::expires, ucontact::state, UL_EXPIRED_TIME, and WRITE_BACK.
Referenced by delete_ucontact().
| int st_expired_ucontact | ( | ucontact_t * | _c | ) |
Called when the timer is about to delete an expired contact.
| _c | expired contact |
Definition at line 321 of file ucontact.c.
References CS_DIRTY, CS_NEW, CS_SYNC, and ucontact::state.
Referenced by wb_timer().
| int st_flush_ucontact | ( | ucontact_t * | _c | ) |
Called when the timer is about flushing the contact, updates contact state.
| _c | flushed contact |
Definition at line 350 of file ucontact.c.
References CS_DIRTY, CS_NEW, CS_SYNC, and ucontact::state.
Referenced by wb_timer().
| void st_update_ucontact | ( | ucontact_t * | _c | ) |
Update state of the contact if we are using write-back scheme.
| _c | updated contact |
Definition at line 244 of file ucontact.c.
References CS_DIRTY, CS_NEW, CS_SYNC, db_mode, ucontact::state, WRITE_BACK, and WRITE_THROUGH.
Referenced by update_ucontact().
| static void unlink_contact | ( | struct urecord * | _r, | |
| ucontact_t * | _c | |||
| ) | [inline, static] |
Remove a contact from list belonging to a certain record.
Definition at line 720 of file ucontact.c.
References urecord::contacts, ucontact::next, and ucontact::prev.
Referenced by update_contact_pos().
| static void update_contact_pos | ( | struct urecord * | _r, | |
| ucontact_t * | _c | |||
| ) | [inline, static] |
Insert a new contact into the list at the correct position.
| _r | record that holds the sorted contacts | |
| _c | new contact |
Definition at line 741 of file ucontact.c.
References urecord::contacts, desc_time_order, ucontact::next, ucontact::prev, ucontact::q, and unlink_contact().
Referenced by update_ucontact().
| int update_ucontact | ( | struct urecord * | _r, | |
| ucontact_t * | _c, | |||
| ucontact_info_t * | _ci | |||
| ) |
Update ucontact with new values.
Definition at line 792 of file ucontact.c.
References CS_SYNC, db_mode, DB_ONLY, db_update_ucontact(), exists_ulcb_type, LM_DBG, LM_ERR, mem_update_ucontact(), run_ul_callbacks(), st_update_ucontact(), ucontact::state, UL_CONTACT_UPDATE, update_contact_pos(), and WRITE_THROUGH.
Referenced by bind_usrloc(), and mi_usrloc_add().
1.5.6