Module: sip-router
Branch: mariuszbihlei/p_usrloc
Commit: eee864b9cea1451ee1d3a6b6e651ad9ca6dc1350
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=eee864b…
Author: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Date: Thu Jan 20 13:23:56 2011 +0200
Further refactoring of usrloc and p_usrloc
---
modules_k/p_usrloc/udomain.h | 32 +++++++++++++++++++++++--
modules_k/p_usrloc/urecord.h | 1 +
modules_k/usrloc/dlist.h | 49 ++++++++++++++++++++++++++++++++++++++
modules_k/usrloc/ucontact.h | 11 ++++++++
modules_k/usrloc/udomain.h | 42 +++++++++++++++++++++++++++++++++
modules_k/usrloc/urecord.h | 53 ++++++++++++++++++++++++++++++++++++++++++
6 files changed, 185 insertions(+), 3 deletions(-)
diff --git a/modules_k/p_usrloc/udomain.h b/modules_k/p_usrloc/udomain.h
index e6ce0ef..7524b37 100644
--- a/modules_k/p_usrloc/udomain.h
+++ b/modules_k/p_usrloc/udomain.h
@@ -90,9 +90,6 @@ void free_udomain(udomain_t* _d);
void print_udomain(FILE* _f, udomain_t* _d);
-
-
-
/*!
* \brief Timer function to cleanup expired contacts, DB_ONLY db_mode
* \param _d cleaned domain
@@ -158,5 +155,34 @@ void unlock_udomain(udomain_t* _d, str *_aor);
+/*!
+ * \brief Create and insert a new record
+ * \param _d domain to insert the new record
+ * \param _aor address of the record
+ * \param _r new created record
+ * \return return 0 on success, -1 on failure
+ */
+int insert_urecord(udomain_t* _d, str* _aor, struct urecord** _r);
+
+
+/*!
+ * \brief Obtain a urecord pointer if the urecord exists in domain
+ * \param _d domain to search the record
+ * \param _aor address of record
+ * \param _r new created record
+ * \return 0 if a record was found, 1 if nothing could be found
+ */
+int get_urecord(udomain_t* _d, str* _aor, struct urecord** _r);
+
+
+/*!
+ * \brief Delete a urecord from domain
+ * \param _d domain where the record should be deleted
+ * \param _aor address of record
+ * \param _r deleted record
+ * \return 0 on success, -1 if the record could not be deleted
+ */
+int delete_urecord(udomain_t* _d, str* _aor, struct urecord* _r);
+
#endif
diff --git a/modules_k/p_usrloc/urecord.h b/modules_k/p_usrloc/urecord.h
index 34442d8..14bafc6 100644
--- a/modules_k/p_usrloc/urecord.h
+++ b/modules_k/p_usrloc/urecord.h
@@ -163,4 +163,5 @@ int get_ucontact(urecord_t* _r, str* _c, str* _callid, str* _path,
void release_urecord(urecord_t* _r);
+
#endif
diff --git a/modules_k/usrloc/dlist.h b/modules_k/usrloc/dlist.h
index 5602c67..87692df 100644
--- a/modules_k/usrloc/dlist.h
+++ b/modules_k/usrloc/dlist.h
@@ -54,6 +54,19 @@ extern dlist_t* root;
/*!
+ * \brief Registers a new domain with usrloc
+ *
+ * Registers a new domain with usrloc. If the domain exists,
+ * a pointer to existing structure will be returned, otherwise
+ * a new domain will be created
+ * \param _n domain name
+ * \param _d new created domain
+ * \return 0 on success, -1 on failure
+ */
+int register_udomain(const char* _n, udomain_t** _d);
+
+
+/*!
* \brief Free all allocated memory for domains
*/
void free_all_udomains(void);
@@ -74,6 +87,42 @@ int synchronize_all_udomains(void);
/*!
+ * \brief Get all contacts from the usrloc, in partitions if wanted
+ *
+ * Return list of all contacts for all currently registered
+ * users in all domains. The caller must provide buffer of
+ * sufficient length for fitting all those contacts. In the
+ * case when buffer was exhausted, the function returns
+ * estimated amount of additional space needed, in this
+ * case the caller is expected to repeat the call using
+ * this value as the hint.
+ *
+ * Information is packed into the buffer as follows:
+ *
+ * +------------+----------+-----+------+-----+
+ * |contact1.len|contact1.s|sock1|flags1|path1|
+ * +------------+----------+-----+------+-----+
+ * |contact2.len|contact2.s|sock2|flags2|path1|
+ * +------------+----------+-----+------+-----+
+ * |..........................................|
+ * +------------+----------+-----+------+-----+
+ * |contactN.len|contactN.s|sockN|flagsN|pathN|
+ * +------------+----------+-----+------+-----+
+ * |000000000000|
+ * +------------+
+ *
+ * \param buf target buffer
+ * \param len length of buffer
+ * \param flags contact flags
+ * \param part_idx part index
+ * \param part_max maximal part
+ * \return 0 on success, positive if buffer size was not sufficient, negative on failure
+ */
+int get_all_ucontacts(void *, int, unsigned int,
+ unsigned int part_idx, unsigned int part_max);
+
+
+/*!
* \brief Loops through all domains summing up the number of users
* \return the number of users, could be zero
*/
diff --git a/modules_k/usrloc/ucontact.h b/modules_k/usrloc/ucontact.h
index 9686a07..6a8a4df 100644
--- a/modules_k/usrloc/ucontact.h
+++ b/modules_k/usrloc/ucontact.h
@@ -39,6 +39,7 @@
#include <stdio.h>
#include "usrloc.h"
+
/*! \brief ancient time used for marking the contacts forced to expired */
#define UL_EXPIRED_TIME 10
@@ -137,5 +138,15 @@ int db_update_ucontact(ucontact_t* _c);
*/
int db_delete_ucontact(ucontact_t* _c);
+/* ====== Module interface ====== */
+
+/*!
+ * \brief Update ucontact with new values
+ * \param _r record the contact belongs to
+ * \param _c updated contact
+ * \param _ci new contact informations
+ * \return 0 on success, -1 on failure
+ */
+int update_ucontact(struct urecord* _r, ucontact_t* _c, ucontact_info_t* _ci);
#endif
diff --git a/modules_k/usrloc/udomain.h b/modules_k/usrloc/udomain.h
index 62509c6..b10df5d 100644
--- a/modules_k/usrloc/udomain.h
+++ b/modules_k/usrloc/udomain.h
@@ -138,6 +138,21 @@ int mem_insert_urecord(udomain_t* _d, str* _aor, struct urecord** _r);
*/
void mem_delete_urecord(udomain_t* _d, struct urecord* _r);
+
+/*! \brief
+ * Timer handler for given domain
+ */
+void lock_udomain(udomain_t* _d, str *_aor);
+
+
+/*!
+ * \brief Release lock for a domain
+ * \param _d domain
+ * \param _aor address of record, uses as hash source for the lock slot
+ */
+void unlock_udomain(udomain_t* _d, str *_aor);
+
+
/*!
* \brief Get lock for a slot
* \param _d domain
@@ -155,7 +170,34 @@ void unlock_ulslot(udomain_t* _d, int i);
/* ===== module interface ======= */
+/*!
+ * \brief Create and insert a new record
+ * \param _d domain to insert the new record
+ * \param _aor address of the record
+ * \param _r new created record
+ * \return return 0 on success, -1 on failure
+ */
+int insert_urecord(udomain_t* _d, str* _aor, struct urecord** _r);
+
+
+/*!
+ * \brief Obtain a urecord pointer if the urecord exists in domain
+ * \param _d domain to search the record
+ * \param _aor address of record
+ * \param _r new created record
+ * \return 0 if a record was found, 1 if nothing could be found
+ */
+int get_urecord(udomain_t* _d, str* _aor, struct urecord** _r);
+
+/*!
+ * \brief Delete a urecord from domain
+ * \param _d domain where the record should be deleted
+ * \param _aor address of record
+ * \param _r deleted record
+ * \return 0 on success, -1 if the record could not be deleted
+ */
+int delete_urecord(udomain_t* _d, str* _aor, struct urecord* _r);
#endif
diff --git a/modules_k/usrloc/urecord.h b/modules_k/usrloc/urecord.h
index 93231d0..5245b2a 100644
--- a/modules_k/usrloc/urecord.h
+++ b/modules_k/usrloc/urecord.h
@@ -38,6 +38,11 @@
#include "ucontact.h"
#include "usrloc.h"
+struct hslot; /*!< Hash table slot */
+
+
+
+
/*!
* \brief Create and initialize new record structure
* \param _dom domain name
@@ -114,6 +119,54 @@ void timer_urecord(urecord_t* _r);
int db_delete_urecord(urecord_t* _r);
+/* ===== Module interface ======== */
+
+
+/*!
+ * \brief Release urecord previously obtained through get_urecord
+ * \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.
+ * \param _r released record
+ */
+void release_urecord(urecord_t* _r);
+
+/*!
+ * \brief Create and insert new contact into urecord
+ * \param _r record into the new contact should be inserted
+ * \param _contact contact string
+ * \param _ci contact information
+ * \param _c new created contact
+ * \return 0 on success, -1 on failure
+ */
+int insert_ucontact(urecord_t* _r, str* _contact,
+ ucontact_info_t* _ci, ucontact_t** _c);
+
+
+/*!
+ * \brief Delete ucontact from urecord
+ * \param _r record where the contact belongs to
+ * \param _c deleted contact
+ * \return 0 on success, -1 on failure
+ */
+int delete_ucontact(urecord_t* _r, struct ucontact* _c);
+
+
+/*!
+ * \brief Get pointer to ucontact with given contact
+ * \param _r record where to search the contacts
+ * \param _c contact string
+ * \param _callid callid
+ * \param _path path
+ * \param _cseq CSEQ number
+ * \param _co found contact
+ * \return 0 - found, 1 - not found, -1 - invalid found,
+ * -2 - found, but to be skipped (same cseq)
+ */
+int get_ucontact(urecord_t* _r, str* _c, str* _callid, str* _path,
+ int _cseq,
+ struct ucontact** _co);
#endif
Module: sip-router
Branch: mariuszbihlei/p_usrloc
Commit: 75d2b1e18a265501729c0186a918b865b44af79b
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=75d2b1e…
Author: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Date: Thu Jan 20 12:06:04 2011 +0200
modules_k/usrloc Further refactoring of code
---
modules_k/usrloc/ucontact.h | 1 -
modules_k/usrloc/ul_callback.h | 5 +-
modules_k/usrloc/usrloc.c | 4 +
modules_k/usrloc/usrloc.h | 135 ----------------------------------------
4 files changed, 7 insertions(+), 138 deletions(-)
diff --git a/modules_k/usrloc/ucontact.h b/modules_k/usrloc/ucontact.h
index 8ef3491..9686a07 100644
--- a/modules_k/usrloc/ucontact.h
+++ b/modules_k/usrloc/ucontact.h
@@ -39,7 +39,6 @@
#include <stdio.h>
#include "usrloc.h"
-
/*! \brief ancient time used for marking the contacts forced to expired */
#define UL_EXPIRED_TIME 10
diff --git a/modules_k/usrloc/ul_callback.h b/modules_k/usrloc/ul_callback.h
index bb322cb..dadce6d 100644
--- a/modules_k/usrloc/ul_callback.h
+++ b/modules_k/usrloc/ul_callback.h
@@ -32,6 +32,7 @@
#ifndef _UL_CALLBACKS_H
#define _UL_CALLBACKS_H
+#include "../../dprint.h"
/* forward declaration for ucontact_t */
struct ucontact;
@@ -84,8 +85,8 @@ static inline void run_ul_callbacks( int type , struct ucontact *c)
for (cbp=ulcb_list->first; cbp; cbp=cbp->next) {
if(cbp->types&type) {
- /*LM_DBG("contact=%p, callback type %d/%d, id %d entered\n",
- c, type, cbp->types, cbp->id );*/
+ LM_DBG("contact=%p, callback type %d/%d, id %d entered\n",
+ c, type, cbp->types, cbp->id );
cbp->callback( c, type, cbp->param );
}
}
diff --git a/modules_k/usrloc/usrloc.c b/modules_k/usrloc/usrloc.c
index f5e1dde..b7a4283 100644
--- a/modules_k/usrloc/usrloc.c
+++ b/modules_k/usrloc/usrloc.c
@@ -34,6 +34,10 @@
*/
#include "usrloc.h"
+#include "dlist.h"
+#include "urecord.h"
+#include "ucontact.h"
+#include "udomain.h"
#include "../../sr_module.h"
#include "ul_mod.h"
diff --git a/modules_k/usrloc/usrloc.h b/modules_k/usrloc/usrloc.h
index f57387e..827e568 100644
--- a/modules_k/usrloc/usrloc.h
+++ b/modules_k/usrloc/usrloc.h
@@ -124,168 +124,33 @@ typedef struct urecord {
struct urecord* next; /*!< Previous item in the hash entry */
} urecord_t;
-/*!
- * \brief Create and insert a new record
- * \param _d domain to insert the new record
- * \param _aor address of the record
- * \param _r new created record
- * \return return 0 on success, -1 on failure
- */
typedef int (*insert_urecord_t)(struct udomain* _d, str* _aor, struct urecord** _r);
-int insert_urecord(struct udomain* _d, str* _aor, struct urecord** _r);
-
-/*!
- * \brief Obtain a urecord pointer if the urecord exists in domain
- * \param _d domain to search the record
- * \param _aor address of record
- * \param _r new created record
- * \return 0 if a record was found, 1 if nothing could be found
- */
typedef int (*get_urecord_t)(struct udomain* _d, str* _aor, struct urecord** _r);
-int get_urecord(struct udomain* _d, str* _aor, struct urecord** _r);
-
-/*!
- * \brief Delete a urecord from domain
- * \param _d domain where the record should be deleted
- * \param _aor address of record
- * \param _r deleted record
- * \return 0 on success, -1 if the record could not be deleted
- */
typedef int (*delete_urecord_t)(struct udomain* _d, str* _aor, struct urecord* _r);
-int delete_urecord(struct udomain* _d, str* _aor, struct urecord* _r);
-
-/*!
- * \brief Update ucontact with new values
- * \param _r record the contact belongs to
- * \param _c updated contact
- * \param _ci new contact informations
- * \return 0 on success, -1 on failure
- */
typedef int (*update_ucontact_t)(struct urecord* _r, struct ucontact* _c,
struct ucontact_info* _ci);
-int update_ucontact(struct urecord* _r, struct ucontact* _c, struct ucontact_info* _ci);
-
-/*!
- * \brief Release urecord previously obtained through get_urecord
- * \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.
- * \param _r released record
- */
typedef void (*release_urecord_t)(struct urecord* _r);
-void release_urecord(struct urecord* _r);
-
-/*!
- * \brief Create and insert new contact into urecord
- * \param _r record into the new contact should be inserted
- * \param _contact contact string
- * \param _ci contact information
- * \param _c new created contact
- * \return 0 on success, -1 on failure
- */
typedef int (*insert_ucontact_t)(struct urecord* _r, str* _contact,
struct ucontact_info* _ci, struct ucontact** _c);
-int insert_ucontact(struct urecord* _r, str* _contact,
- struct ucontact_info* _ci, struct ucontact** _c);
-
-/*!
- * \brief Delete ucontact from urecord
- * \param _r record where the contact belongs to
- * \param _c deleted contact
- * \return 0 on success, -1 on failure
- */
typedef int (*delete_ucontact_t)(struct urecord* _r, struct ucontact* _c);
-int delete_ucontact(struct urecord* _r, struct ucontact* _c);
-
-/*!
- * \brief Get pointer to ucontact with given contact
- * \param _r record where to search the contacts
- * \param _c contact string
- * \param _callid callid
- * \param _path path
- * \param _cseq CSEQ number
- * \param _co found contact
- * \return 0 - found, 1 - not found, -1 - invalid found,
- * -2 - found, but to be skipped (same cseq)
- */
typedef int (*get_ucontact_t)(struct urecord* _r, str* _c, str* _callid,
str* _path, int _cseq,
struct ucontact** _co);
-int get_ucontact(struct urecord* _r, str* _c, str* _callid, str* _path,
- int _cseq,
- struct ucontact** _co);
-/*! \brief
- * Timer handler for given domain
- */
typedef void (*lock_udomain_t)(struct udomain* _d, str *_aor);
-void lock_udomain(struct udomain* _d, str *_aor);
-
-/*!
- * \brief Release lock for a domain
- * \param _d domain
- * \param _aor address of record, uses as hash source for the lock slot
- */
typedef void (*unlock_udomain_t)(struct udomain* _d, str *_aor);
-void unlock_udomain(struct udomain* _d, str *_aor);
-/*!
- * \brief Registers a new domain with usrloc
- *
- * Registers a new domain with usrloc. If the domain exists,
- * a pointer to existing structure will be returned, otherwise
- * a new domain will be created
- * \param _n domain name
- * \param _d new created domain
- * \return 0 on success, -1 on failure
- */
typedef int (*register_udomain_t)(const char* _n, struct udomain** _d);
-int register_udomain(const char* _n, struct udomain** _d);
-/*!
- * \brief Get all contacts from the usrloc, in partitions if wanted
- *
- * Return list of all contacts for all currently registered
- * users in all domains. The caller must provide buffer of
- * sufficient length for fitting all those contacts. In the
- * case when buffer was exhausted, the function returns
- * estimated amount of additional space needed, in this
- * case the caller is expected to repeat the call using
- * this value as the hint.
- *
- * Information is packed into the buffer as follows:
- *
- * +------------+----------+-----+------+-----+
- * |contact1.len|contact1.s|sock1|flags1|path1|
- * +------------+----------+-----+------+-----+
- * |contact2.len|contact2.s|sock2|flags2|path1|
- * +------------+----------+-----+------+-----+
- * |..........................................|
- * +------------+----------+-----+------+-----+
- * |contactN.len|contactN.s|sockN|flagsN|pathN|
- * +------------+----------+-----+------+-----+
- * |000000000000|
- * +------------+
- *
- * \param buf target buffer
- * \param len length of buffer
- * \param flags contact flags
- * \param part_idx part index
- * \param part_max maximal part
- * \return 0 on success, positive if buffer size was not sufficient, negative on failure
- */
typedef int (*get_all_ucontacts_t) (void* buf, int len, unsigned int flags,
unsigned int part_idx, unsigned int part_max);
-int get_all_ucontacts(void *, int, unsigned int,
- unsigned int part_idx, unsigned int part_max);
/*! usrloc API export structure */
typedef struct usrloc_api {
Module: sip-router
Branch: mariuszbihlei/p_usrloc
Commit: a03b115c72508aed5578bd10b3c96d196fc6d693
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a03b115…
Author: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Date: Thu Jan 20 12:08:34 2011 +0200
module_k/p_usrloc Refactoring of p_usrloc (it uses the usrloc API include)
---
modules_k/p_usrloc/dlist.h | 55 +++++++++++++++++++++++++++++++++++++++++
modules_k/p_usrloc/ucontact.c | 2 +-
modules_k/p_usrloc/ucontact.h | 4 +--
modules_k/p_usrloc/udomain.h | 15 +++++++++++
modules_k/p_usrloc/urecord.h | 48 +++++++++++++++++++++++++++++++++++
modules_k/p_usrloc/usrloc.c | 4 +++
6 files changed, 124 insertions(+), 4 deletions(-)
diff --git a/modules_k/p_usrloc/dlist.h b/modules_k/p_usrloc/dlist.h
index 97bbbb3..8ba4b92 100644
--- a/modules_k/p_usrloc/dlist.h
+++ b/modules_k/p_usrloc/dlist.h
@@ -70,5 +70,60 @@ int synchronize_all_udomains(void);
unsigned long get_number_of_users(void);
+/*!
+ * \brief Registers a new domain with usrloc
+ *
+ * Registers a new domain with usrloc. If the domain exists,
+ * a pointer to existing structure will be returned, otherwise
+ * a new domain will be created
+ * \param _n domain name
+ * \param _d new created domain
+ * \return 0 on success, -1 on failure
+ */
+int register_udomain(const char* _n, udomain_t** _d);
+
+/*!
+ * \brief Get all contacts from the usrloc, in partitions if wanted
+ *
+ * Return list of all contacts for all currently registered
+ * users in all domains. The caller must provide buffer of
+ * sufficient length for fitting all those contacts. In the
+ * case when buffer was exhausted, the function returns
+ * estimated amount of additional space needed, in this
+ * case the caller is expected to repeat the call using
+ * this value as the hint.
+ *
+ * Information is packed into the buffer as follows:
+ *
+ * +------------+----------+-----+------+-----+
+ * |contact1.len|contact1.s|sock1|flags1|path1|
+ * +------------+----------+-----+------+-----+
+ * |contact2.len|contact2.s|sock2|flags2|path1|
+ * +------------+----------+-----+------+-----+
+ * |..........................................|
+ * +------------+----------+-----+------+-----+
+ * |contactN.len|contactN.s|sockN|flagsN|pathN|
+ * +------------+----------+-----+------+-----+
+ * |000000000000|
+ * +------------+
+ *
+ * \param buf target buffer
+ * \param len length of buffer
+ * \param flags contact flags
+ * \param part_idx part index
+ * \param part_max maximal part
+ * \return 0 on success, positive if buffer size was not sufficient, negative on failure
+ */
+int get_all_ucontacts(void *, int, unsigned int,
+ unsigned int part_idx, unsigned int part_max);
+
+/*!
+ * \brief Find a particular domain, small wrapper around find_dlist
+ * \param _d domain name
+ * \param _p pointer to domain if found
+ * \return 1 if domain was found, 0 otherwise
+ */
+int find_domain(str* _d, udomain_t** _p);
+
#endif
diff --git a/modules_k/p_usrloc/ucontact.c b/modules_k/p_usrloc/ucontact.c
index b97f0f1..f7c0b9e 100644
--- a/modules_k/p_usrloc/ucontact.c
+++ b/modules_k/p_usrloc/ucontact.c
@@ -46,7 +46,7 @@
#include "urecord.h"
#include "ucontact.h"
#include "ul_db_layer.h"
-
+#include "dlist.h"
/*!
* \brief Create a new contact structure
diff --git a/modules_k/p_usrloc/ucontact.h b/modules_k/p_usrloc/ucontact.h
index 3dcb126..b8cf662 100644
--- a/modules_k/p_usrloc/ucontact.h
+++ b/modules_k/p_usrloc/ucontact.h
@@ -45,9 +45,6 @@
/*! \brief ancient time used for marking the contacts forced to expired */
#define UL_EXPIRED_TIME 10
-/*! \brief Valid contact is a contact that either didn't expire yet or is permanent */
-#define VALID_CONTACT(c, t) ((c->expires>t) || (c->expires==0))
-
/*!
* \brief Create a new contact structure
@@ -149,4 +146,5 @@ int db_delete_ucontact(ucontact_t* _c);
struct urecord;
+
#endif
diff --git a/modules_k/p_usrloc/udomain.h b/modules_k/p_usrloc/udomain.h
index 6a9a7a8..e6ce0ef 100644
--- a/modules_k/p_usrloc/udomain.h
+++ b/modules_k/p_usrloc/udomain.h
@@ -40,6 +40,7 @@
#include "../../locking.h"
#include "../../str.h"
#include "../../lib/srdb1/db.h"
+#include "../usrloc/usrloc.h"
#include "urecord.h"
#include "hslot.h"
@@ -142,6 +143,20 @@ void unlock_ulslot(udomain_t* _d, int i);
/* ===== module interface ======= */
+/*! \brief
+ * Timer handler for given domain
+ */
+void lock_udomain(udomain_t* _d, str *_aor);
+
+
+/*!
+ * \brief Release lock for a domain
+ * \param _d domain
+ * \param _aor address of record, uses as hash source for the lock slot
+ */
+void unlock_udomain(udomain_t* _d, str *_aor);
+
+
#endif
diff --git a/modules_k/p_usrloc/urecord.h b/modules_k/p_usrloc/urecord.h
index dfabddc..34442d8 100644
--- a/modules_k/p_usrloc/urecord.h
+++ b/modules_k/p_usrloc/urecord.h
@@ -113,6 +113,54 @@ void timer_urecord(urecord_t* _r);
*/
int db_delete_urecord(struct udomain* _d, urecord_t* _r);
+/*!
+ * \brief Create and insert new contact into urecord
+ * \param _r record into the new contact should be inserted
+ * \param _contact contact string
+ * \param _ci contact information
+ * \param _c new created contact
+ * \return 0 on success, -1 on failure
+ */
+int insert_ucontact(urecord_t* _r, str* _contact,
+ ucontact_info_t* _ci, ucontact_t** _c);
+
+
+/*!
+ * \brief Delete ucontact from urecord
+ * \param _r record where the contact belongs to
+ * \param _c deleted contact
+ * \return 0 on success, -1 on failure
+ */
+int delete_ucontact(urecord_t* _r, struct ucontact* _c);
+
+
+/*!
+ * \brief Get pointer to ucontact with given contact
+ * \param _r record where to search the contacts
+ * \param _c contact string
+ * \param _callid callid
+ * \param _path path
+ * \param _cseq CSEQ number
+ * \param _co found contact
+ * \return 0 - found, 1 - not found, -1 - invalid found,
+ * -2 - found, but to be skipped (same cseq)
+ */
+int get_ucontact(urecord_t* _r, str* _c, str* _callid, str* _path,
+ int _cseq,
+ struct ucontact** _co);
+
+/* ===== Module interface ======== */
+
+
+/*!
+ * \brief Release urecord previously obtained through get_urecord
+ * \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.
+ * \param _r released record
+ */
+void release_urecord(urecord_t* _r);
#endif
diff --git a/modules_k/p_usrloc/usrloc.c b/modules_k/p_usrloc/usrloc.c
index b74632f..3a1b4fc 100644
--- a/modules_k/p_usrloc/usrloc.c
+++ b/modules_k/p_usrloc/usrloc.c
@@ -36,6 +36,10 @@
#include "../usrloc/usrloc.h"
#include "../../sr_module.h"
#include "p_usrloc_mod.h"
+#include "ucontact.h"
+#include "udomain.h"
+#include "dlist.h"
+#include "urecord.h"
/*! nat branch flag */
extern unsigned int nat_bflag;