#include <stdio.h>
#include <time.h>
#include "../../qvalue.h"
#include "../../str.h"


Go to the source code of this file.
Data Structures | |
| struct | ucontact |
| Main structure for handling of registered Contact data. More... | |
| struct | ucontact_info |
| Informations related to a contact. More... | |
Defines | |
| #define | UL_EXPIRED_TIME 10 |
| ancient time used for marking the contacts forced to expired | |
| #define | VALID_CONTACT(c, t) ((c->expires>t) || (c->expires==0)) |
| Valid contact is a contact that either didn't expire yet or is permanent. | |
Typedefs | |
| typedef enum cstate | cstate_t |
| States for in-memory contacts in regards to contact storage handler (db, in-memory, ldap etc). | |
| typedef enum flags | flags_t |
| Flags that can be associated with a Contact. | |
| typedef struct ucontact_info | ucontact_info_t |
| Informations related to a contact. | |
| typedef struct ucontact | ucontact_t |
| Main structure for handling of registered Contact data. | |
| typedef int(* | update_ucontact_t )(struct urecord *_r, ucontact_t *_c, ucontact_info_t *_ci) |
| Update ucontact with new values. | |
Enumerations | |
| enum | cstate { CS_NEW, CS_SYNC, CS_DIRTY } |
| States for in-memory contacts in regards to contact storage handler (db, in-memory, ldap etc). More... | |
| enum | flags { FL_NONE = 0, FL_MEM = 1 << 0, FL_ALL = (int)0xFFFFFFFF } |
| Flags that can be associated with a Contact. More... | |
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. | |
| int | update_ucontact (struct urecord *_r, ucontact_t *_c, ucontact_info_t *_ci) |
| Update ucontact with new values. | |
Definition in file ucontact.h.
| #define UL_EXPIRED_TIME 10 |
ancient time used for marking the contacts forced to expired
Definition at line 103 of file ucontact.h.
Referenced by mi_add_aor_node(), print_ucontact(), and st_delete_ucontact().
| #define VALID_CONTACT | ( | c, | |||
| t | ) | ((c->expires>t) || (c->expires==0)) |
Valid contact is a contact that either didn't expire yet or is permanent.
Definition at line 106 of file ucontact.h.
Referenced by build_contact(), calc_buf_len(), lookup(), mi_usrloc_show_contact(), nodb_timer(), registered(), test_max_contacts(), wb_timer(), and wt_timer().
States for in-memory contacts in regards to contact storage handler (db, in-memory, ldap etc).
| typedef struct ucontact_info ucontact_info_t |
Informations related to a contact.
| typedef struct ucontact ucontact_t |
Main structure for handling of registered Contact data.
| typedef int(* update_ucontact_t)(struct urecord *_r, ucontact_t *_c, ucontact_info_t *_ci) |
| enum cstate |
| enum flags |
| 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().
| 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