ucontact.c File Reference

USRLOC - Usrloc contact handling functions

More...

#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"

Include dependency graph for ucontact.c:

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_tnew_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.


Detailed Description

USRLOC - Usrloc contact handling functions

Definition in file ucontact.c.


Define Documentation

#define update_str ( _old,
_new   ) 

Referenced by mem_update_ucontact().


Function Documentation

int db_delete_ucontact ( ucontact_t _c  ) 

int db_insert_ucontact ( ucontact_t _c  ) 

int db_update_ucontact ( ucontact_t _c  ) 

void free_ucontact ( ucontact_t _c  ) 

Free all memory associated with given contact structure.

Parameters:
_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 
)

ucontact_t* new_ucontact ( str _dom,
str _aor,
str _contact,
ucontact_info_t _ci 
)

void print_ucontact ( FILE *  _f,
ucontact_t _c 
)

int st_delete_ucontact ( ucontact_t _c  ) 

Update state of the contact.

Parameters:
_c updated contact
Returns:
1 if the contact should be deleted from memory immediately, 0 otherwise

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.

Parameters:
_c expired contact
Returns:
1 if the contact should be removed from the database and 0 otherwise

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.

Parameters:
_c flushed contact
Returns:
1 if the contact should be inserted, 2 if update and 0 otherwise

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.

Parameters:
_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.

Parameters:
_r record the contact belongs
_c removed contact

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.

Parameters:
_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.

Parameters:
_r record the contact belongs to
_c updated contact
_ci new contact informations
Returns:
0 on success, -1 on failure

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().


Generated on Thu May 24 22:00:45 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6