[OpenSIPS-Devel] [PATCH] add find_udomain() to usrloc API

John Khvatov ivaxer at dev.sgu.ru
Thu Apr 9 14:29:35 CEST 2009


Hello,

This patch adds the find_udomain() function to usrloc API, which needed to
adding or deleting a contact from external module code (without using usrloc
mi). Can anyone please apply this patch to upstream?

Thanks.

---
 modules/usrloc/dlist.h  |    1 +
 modules/usrloc/usrloc.c |    1 +
 modules/usrloc/usrloc.h |    2 ++
 3 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/modules/usrloc/dlist.h b/modules/usrloc/dlist.h
index 1c18b62..97c0af4 100644
--- a/modules/usrloc/dlist.h
+++ b/modules/usrloc/dlist.h
@@ -138,6 +138,7 @@ unsigned long get_number_of_users(void);
  * \param _p pointer to domain if found
  * \return 1 if domain was found, 0 otherwise
  */
+typedef int(*find_udomain_t) (str* _d, udomain_t** _p);
 int find_domain(str* _d, udomain_t** _p);
 
 
diff --git a/modules/usrloc/usrloc.c b/modules/usrloc/usrloc.c
index f5e1dde..8c92f85 100644
--- a/modules/usrloc/usrloc.c
+++ b/modules/usrloc/usrloc.c
@@ -67,6 +67,7 @@ int bind_usrloc(usrloc_api_t* api)
 	api->get_urecord        = get_urecord;
 	api->lock_udomain       = lock_udomain;
 	api->unlock_udomain     = unlock_udomain;
+	api->find_udomain       = find_domain;
 	api->release_urecord    = release_urecord;
 	api->insert_ucontact    = insert_ucontact;
 	api->delete_ucontact    = delete_ucontact;
diff --git a/modules/usrloc/usrloc.h b/modules/usrloc/usrloc.h
index 690508c..44044a5 100644
--- a/modules/usrloc/usrloc.h
+++ b/modules/usrloc/usrloc.h
@@ -51,6 +51,8 @@ typedef struct usrloc_api {
 	lock_udomain_t       lock_udomain;
 	unlock_udomain_t     unlock_udomain;
 
+	find_udomain_t       find_udomain;
+
 	release_urecord_t    release_urecord;
 	insert_ucontact_t    insert_ucontact;
 	delete_ucontact_t    delete_ucontact;
-- 
1.6.0.6


-- 
John Khvatov



More information about the Devel mailing list