Răsfoiți Sursa

modules/usrloc Refactoring of usrloc: Moved interface declaration/definitions to one common header (usrloc.h)

Before, mostly every header was included when using usrloc, thus the private parts were not hidden to user.
Added a udomain_head_t data type which contains the first member of the udomain_t structure (this structure is different
between p_usrloc and usrloc)
Marius Zbihlei 14 ani în urmă
părinte
comite
f65d06bcda

+ 2 - 63
modules_k/usrloc/dlist.h

@@ -36,9 +36,9 @@
 #define DLIST_H
 
 #include <stdio.h>
-#include "udomain.h"
 #include "../../str.h"
-
+#include "usrloc.h"
+#include "udomain.h"
 
 /*!
  * List of all domains registered with usrloc
@@ -53,29 +53,6 @@ typedef struct dlist {
 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
- */
-typedef int (*register_udomain_t)(const char* _n, udomain_t** _d);
-int register_udomain(const char* _n, udomain_t** _d);
-
-/*!
- * \brief Find and return usrloc domain
- *
- * \param _n domain name
- * \param _d usrloc domain (location table)
- * \return 0 on success, -1 on failure
- */
-typedef int (*get_udomain_t)(const char* _n, udomain_t** _d);
-int get_udomain(const char* _n, udomain_t** _d);
-
 /*!
  * \brief Free all allocated memory for domains
  */
@@ -96,44 +73,6 @@ void print_all_udomains(FILE* _f);
 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
- */
-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);
-
-
 /*!
  * \brief Loops through all domains summing up the number of users
  * \return the number of users, could be zero

+ 1 - 78
modules_k/usrloc/ucontact.h

@@ -37,74 +37,12 @@
 
 
 #include <stdio.h>
-#include <time.h>
-#include "../../qvalue.h"
-#include "../../str.h"
+#include "usrloc.h"
 
 
-/*!
- * \brief States for in-memory contacts in regards to contact storage handler (db, in-memory, ldap etc)
- */
-typedef enum cstate {
-	CS_NEW,        /*!< New contact - not flushed yet */
-	CS_SYNC,       /*!< Synchronized contact with the database */
-	CS_DIRTY       /*!< Update contact - not flushed yet */
-} cstate_t;
-
-
-/*! \brief Flags that can be associated with a Contact */
-typedef enum flags {
-	FL_NONE        = 0,          /*!< No flags set */
-	FL_MEM         = 1 << 0,     /*!< Update memory only */
-	FL_ALL         = (int)0xFFFFFFFF  /*!< All flags set */
-} flags_t;
-
-
-/*! \brief Main structure for handling of registered Contact data */
-typedef struct ucontact {
-	str* domain;            /*!< Pointer to domain name (NULL terminated) */
-	str* aor;               /*!< Pointer to the AOR string in record structure*/
-	str c;                  /*!< Contact address */
-	str received;           /*!< IP+port+protocol we received the REGISTER from */
-	str path;               /*!< Path header */
-	time_t expires;         /*!< Expires parameter */
-	qvalue_t q;             /*!< q parameter */
-	str callid;             /*!< Call-ID header field of registration */
-	int cseq;               /*!< CSeq value */
-	cstate_t state;         /*!< State of the contact (\ref cstate) */
-	unsigned int flags;     /*!< Various flags (NAT, ping type, etc) */
-	unsigned int cflags;    /*!< Custom contact flags (from script) */
-	str user_agent;         /*!< User-Agent header field */
-	struct socket_info *sock; /*!< received socket */
-	time_t last_modified;   /*!< When the record was last modified */
-	unsigned int methods;   /*!< Supported methods */
-	struct ucontact* next;  /*!< Next contact in the linked list */
-	struct ucontact* prev;  /*!< Previous contact in the linked list */
-} ucontact_t;
-
-
-/*! \brief Informations related to a contact */
-typedef struct ucontact_info {
-	str received;             /*!< Received interface */
-	str* path;                /*!< Path informations */
-	time_t expires;           /*!< Contact expires */
-	qvalue_t q;               /*!< Q-value */
-	str* callid;              /*!< call-ID */
-	int cseq;                 /*!< CSEQ number */
-	unsigned int flags;       /*!< message flags */
-	unsigned int cflags;      /*!< contact flags */
-	str *user_agent;          /*!< user agent header */
-	struct socket_info *sock; /*!< socket informations */
-	unsigned int methods;     /*!< supported methods */
-	time_t last_modified;     /*!< last modified */
-} ucontact_info_t;
-
 /*! \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
@@ -201,19 +139,4 @@ int db_update_ucontact(ucontact_t* _c);
 int db_delete_ucontact(ucontact_t* _c);
 
 
-/* ====== Module interface ====== */
-
-struct urecord;
-
-/*!
- * \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, ucontact_t* _c,
-		ucontact_info_t* _ci);
-int update_ucontact(struct urecord* _r, ucontact_t* _c, ucontact_info_t* _ci);
-
 #endif

+ 3 - 50
modules_k/usrloc/udomain.h

@@ -42,7 +42,7 @@
 #include "../../lib/srdb1/db.h"
 #include "urecord.h"
 #include "hslot.h"
-
+#include "usrloc.h"
 
 struct hslot;   /*!< Hash table slot */
 struct urecord; /*!< Usrloc record */
@@ -51,7 +51,7 @@ struct urecord; /*!< Usrloc record */
 /*! \brief
  * The structure represents a usrloc domain
  */
-typedef struct udomain {
+struct udomain {
 	str* name;                 /*!< Domain name (NULL terminated) */
 	int size;                  /*!< Hash table size */
 	struct hslot* table;       /*!< Hash table - array of collision slots */
@@ -59,7 +59,7 @@ typedef struct udomain {
 	stat_var *users;           /*!< no of registered users */
 	stat_var *contacts;        /*!< no of registered contacts */
 	stat_var *expires;         /*!< no of expires */
-} udomain_t;
+};
 
 
 /*!
@@ -138,23 +138,6 @@ 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
- */
-typedef void (*lock_udomain_t)(udomain_t* _d, str *_aor);
-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
- */
-typedef void (*unlock_udomain_t)(udomain_t* _d, str *_aor);
-void unlock_udomain(udomain_t* _d, str *_aor);
-
-
 /*!
  * \brief  Get lock for a slot
  * \param _d domain
@@ -172,37 +155,7 @@ 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
- */
-typedef int (*insert_urecord_t)(udomain_t* _d, str* _aor, struct urecord** _r);
-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
- */
-typedef int  (*get_urecord_t)(udomain_t* _d, str* _aor, struct urecord** _r);
-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
- */
-typedef int  (*delete_urecord_t)(udomain_t* _d, str* _aor, struct urecord* _r);
-int delete_urecord(udomain_t* _d, str* _aor, struct urecord* _r);
 
 
 #endif

+ 6 - 5
modules_k/usrloc/ul_callback.h

@@ -32,8 +32,9 @@
 #ifndef _UL_CALLBACKS_H
 #define _UL_CALLBACKS_H
 
-#include "ucontact.h"
 
+/* forward declaration for ucontact_t */
+struct ucontact;
 
 #define UL_CONTACT_INSERT      (1<<0)
 #define UL_CONTACT_UPDATE      (1<<1)
@@ -42,7 +43,7 @@
 #define ULCB_MAX               ((1<<4)-1)
 
 /*! \brief callback function prototype */
-typedef void (ul_cb) (ucontact_t *c, int type, void *param);
+typedef void (ul_cb) (struct ucontact *c, int type, void *param);
 /*! \brief register callback function prototype */
 typedef int (*register_ulcb_t)( int cb_types, ul_cb f, void *param);
 
@@ -77,14 +78,14 @@ void destroy_ulcb_list(void);
 int register_ulcb( int types, ul_cb f, void *param );
 
 /*! \brief run all transaction callbacks for an event type */
-static inline void run_ul_callbacks( int type , ucontact_t *c)
+static inline void run_ul_callbacks( int type , struct ucontact *c)
 {
 	struct ul_callback *cbp;
 
 	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 );
 		}
 	}

+ 1 - 75
modules_k/usrloc/urecord.h

@@ -36,26 +36,7 @@
 #include "../../str.h"
 #include "../../qvalue.h"
 #include "ucontact.h"
-
-
-struct hslot; /*!< Hash table slot */
-
-/*! \brief
- * Basic hash table element
- */
-typedef struct urecord {
-	str* domain;                   /*!< Pointer to domain we belong to 
-                                    * ( null terminated string) */
-	str aor;                       /*!< Address of record */
-	unsigned int aorhash;          /*!< Hash over address of record */
-	ucontact_t* contacts;          /*!< One or more contact fields */
-
-	struct hslot* slot;            /*!< Collision slot in the hash table 
-                                    * array we belong to */
-	struct urecord* prev;          /*!< Next item in the hash entry */
-	struct urecord* next;          /*!< Previous item in the hash entry */
-} urecord_t;
-
+#include "usrloc.h"
 
 /*!
  * \brief Create and initialize new record structure
@@ -133,61 +114,6 @@ 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
- */
-typedef void (*release_urecord_t)(urecord_t* _r);
-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
- */
-typedef int (*insert_ucontact_t)(urecord_t* _r, str* _contact,
-		ucontact_info_t* _ci, ucontact_t** _c);
-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
- */
-typedef int (*delete_ucontact_t)(urecord_t* _r, struct ucontact* _c);
-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)
- */
-typedef int (*get_ucontact_t)(urecord_t* _r, str* _c, str* _callid,
-		str* _path, int _cseq,
-		struct ucontact** _co);
-int get_ucontact(urecord_t* _r, str* _c, str* _callid, str* _path,
-		int _cseq,
-		struct ucontact** _co);
 
 #endif

+ 251 - 7
modules_k/usrloc/usrloc.h

@@ -28,19 +28,264 @@
 #ifndef USRLOC_H
 #define USRLOC_H
 
-
-#include "dlist.h"
-#include "udomain.h"
-#include "urecord.h"
-#include "ucontact.h"
+#include <time.h>
 #include "ul_callback.h"
+#include "../../qvalue.h"
+#include "../../str.h"
 
-/* storage modes */
 #define NO_DB         0
 #define WRITE_THROUGH 1
 #define WRITE_BACK    2
 #define DB_ONLY       3
 
+/*forward declaration necessary for udomain*/
+
+struct udomain;
+typedef struct udomain udomain_t;
+
+/*!
+ * \brief States for in-memory contacts in regards to contact storage handler (db, in-memory, ldap etc)
+ */
+typedef enum cstate {
+	CS_NEW,        /*!< New contact - not flushed yet */
+	CS_SYNC,       /*!< Synchronized contact with the database */
+	CS_DIRTY       /*!< Update contact - not flushed yet */
+} cstate_t;
+
+
+/*! \brief Flags that can be associated with a Contact */
+typedef enum flags {
+	FL_NONE        = 0,          /*!< No flags set */
+	FL_MEM         = 1 << 0,     /*!< Update memory only */
+	FL_ALL         = (int)0xFFFFFFFF  /*!< All flags set */
+} flags_t;
+
+/*! \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))
+
+struct hslot; /*!< Hash table slot */
+struct socket_info;
+/*! \brief Main structure for handling of registered Contact data */
+typedef struct ucontact {
+	str* domain;            /*!< Pointer to domain name (NULL terminated) */
+	str* aor;               /*!< Pointer to the AOR string in record structure*/
+	str c;                  /*!< Contact address */
+	str received;           /*!< IP+port+protocol we received the REGISTER from */
+	str path;               /*!< Path header */
+	time_t expires;         /*!< Expires parameter */
+	qvalue_t q;             /*!< q parameter */
+	str callid;             /*!< Call-ID header field of registration */
+	int cseq;               /*!< CSeq value */
+	cstate_t state;         /*!< State of the contact (\ref cstate) */
+	unsigned int flags;     /*!< Various flags (NAT, ping type, etc) */
+	unsigned int cflags;    /*!< Custom contact flags (from script) */
+	str user_agent;         /*!< User-Agent header field */
+	struct socket_info *sock; /*!< received socket */
+	time_t last_modified;   /*!< When the record was last modified */
+	unsigned int methods;   /*!< Supported methods */
+	struct ucontact* next;  /*!< Next contact in the linked list */
+	struct ucontact* prev;  /*!< Previous contact in the linked list */
+} ucontact_t;
+
+
+/*! \brief Informations related to a contact */
+typedef struct ucontact_info {
+	str received;             /*!< Received interface */
+	str* path;                /*!< Path informations */
+	time_t expires;           /*!< Contact expires */
+	qvalue_t q;               /*!< Q-value */
+	str* callid;              /*!< call-ID */
+	int cseq;                 /*!< CSEQ number */
+	unsigned int flags;       /*!< message flags */
+	unsigned int cflags;      /*!< contact flags */
+	str *user_agent;          /*!< user agent header */
+	struct socket_info *sock; /*!< socket informations */
+	unsigned int methods;     /*!< supported methods */
+	time_t last_modified;     /*!< last modified */
+} ucontact_info_t;
+
+typedef struct udomain_head{
+    str* name;
+} udomain_head_t;
+
+/*! \brief
+ * Basic hash table element
+ */
+typedef struct urecord {
+	str* domain;                   /*!< Pointer to domain we belong to
+                                    * ( null terminated string) */
+	str aor;                       /*!< Address of record */
+	unsigned int aorhash;          /*!< Hash over address of record */
+	ucontact_t* contacts;          /*!< One or more contact fields */
+
+	struct hslot* slot;            /*!< Collision slot in the hash table
+                                    * array we belong to */
+	struct urecord* prev;          /*!< Next item in the hash entry */
+	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 {
@@ -72,5 +317,4 @@ typedef struct usrloc_api {
 /*! usrloc API export bind function */
 typedef int (*bind_usrloc_t)(usrloc_api_t* api);
 
-
 #endif