[sr-dev] git:mariuszbihlei/p_usrloc: modules/ usrloc Some refactoring of usrloc to allow both usrloc and p_usrloc to coexist and share structs , code etc.

Marius Zbihlei marius.zbihlei at 1and1.ro
Tue Jan 18 14:25:03 CET 2011


Module: sip-router
Branch: mariuszbihlei/p_usrloc
Commit: 0ea2d47311f4655714853a567bdd07609af4575f
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0ea2d47311f4655714853a567bdd07609af4575f

Author: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Date:   Tue Jan 18 15:03:29 2011 +0200

modules/usrloc Some refactoring of usrloc to allow both usrloc and p_usrloc to coexist and share structs, code etc.

First commit contains changes to code (.c files)
Module interface (exported to registrar) is now in a common file "usrloc.h" which is used by every user of user location modules.
P_usrloc also uses that header so changes to usrloc also affect it(changes to interface)

---

 modules_k/p_usrloc/usrloc.h    |   69 ----------------------------------------
 modules_k/usrloc/ucontact.c    |    2 +-
 modules_k/usrloc/udomain.c     |    2 +-
 modules_k/usrloc/ul_callback.c |    2 +-
 modules_k/usrloc/ul_mi.c       |    2 +-
 modules_k/usrloc/urecord.c     |    2 +-
 6 files changed, 5 insertions(+), 74 deletions(-)

diff --git a/modules_k/p_usrloc/usrloc.h b/modules_k/p_usrloc/usrloc.h
deleted file mode 100644
index 5077b52..0000000
--- a/modules_k/p_usrloc/usrloc.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * $Id: usrloc.h 5193 2008-11-13 10:21:53Z henningw $
- *
- * Copyright (C) 2001-2003 FhG Fokus
- *
- * This file is part of Kamailio, a free SIP server.
- *
- * Kamailio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version
- *
- * Kamailio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*! \file
- *  \brief USRLOC - module API exports interface
- *  \ingroup usrloc
- */
-
-#ifndef USRLOC_H
-#define USRLOC_H
-
-
-#include "dlist.h"
-#include "udomain.h"
-#include "urecord.h"
-#include "ucontact.h"
-#include "ul_callback.h"
-
-
-/*! usrloc API export structure */
-typedef struct usrloc_api {
-	int           use_domain; /*! use_domain module parameter */
-	int           db_mode;    /*! db_mode module parameter */
-	unsigned int  nat_flag;   /*! nat_flag module parameter */
-
-	register_udomain_t   register_udomain;
-	get_all_ucontacts_t  get_all_ucontacts;
-
-	insert_urecord_t     insert_urecord;
-	delete_urecord_t     delete_urecord;
-	get_urecord_t        get_urecord;
-	lock_udomain_t       lock_udomain;
-	unlock_udomain_t     unlock_udomain;
-
-	release_urecord_t    release_urecord;
-	insert_ucontact_t    insert_ucontact;
-	delete_ucontact_t    delete_ucontact;
-	get_ucontact_t       get_ucontact;
-
-	update_ucontact_t    update_ucontact;
-
-	register_ulcb_t      register_ulcb;
-} usrloc_api_t;
-
-
-/*! usrloc API export bind function */
-typedef int (*bind_usrloc_t)(usrloc_api_t* api);
-
-
-#endif
diff --git a/modules_k/usrloc/ucontact.c b/modules_k/usrloc/ucontact.c
index 170ce00..3f9639e 100644
--- a/modules_k/usrloc/ucontact.c
+++ b/modules_k/usrloc/ucontact.c
@@ -45,7 +45,7 @@
 #include "ul_callback.h"
 #include "urecord.h"
 #include "ucontact.h"
-
+#include "usrloc.h"
 
 /*!
  * \brief Create a new contact structure
diff --git a/modules_k/usrloc/udomain.c b/modules_k/usrloc/udomain.c
index 8f21e0f..58c89d7 100644
--- a/modules_k/usrloc/udomain.c
+++ b/modules_k/usrloc/udomain.c
@@ -46,7 +46,7 @@
 #include "../../lib/kcore/hash_func.h"
 #include "ul_mod.h"            /* usrloc module parameters */
 #include "utime.h"
-
+#include "usrloc.h"
 
 #ifdef STATISTICS
 static char *build_stat_name( str* domain, char *var_name)
diff --git a/modules_k/usrloc/ul_callback.c b/modules_k/usrloc/ul_callback.c
index 91c4d5e..0519919 100644
--- a/modules_k/usrloc/ul_callback.c
+++ b/modules_k/usrloc/ul_callback.c
@@ -38,7 +38,7 @@
 #include "../../error.h"
 #include "../../mem/shm_mem.h"
 #include "ul_callback.h"
-
+#include "ucontact.h"
 
 struct ulcb_head_list* ulcb_list = 0;
 
diff --git a/modules_k/usrloc/ul_mi.c b/modules_k/usrloc/ul_mi.c
index bb7d50a..62d8017 100644
--- a/modules_k/usrloc/ul_mi.c
+++ b/modules_k/usrloc/ul_mi.c
@@ -44,7 +44,7 @@
 #include "udomain.h"
 #include "utime.h"
 #include "ul_mod.h"
-
+#include "usrloc.h"
 
 /*! CSEQ nr used */
 #define MI_UL_CSEQ 1
diff --git a/modules_k/usrloc/urecord.c b/modules_k/usrloc/urecord.c
index e0ff894..5ce2813 100644
--- a/modules_k/usrloc/urecord.c
+++ b/modules_k/usrloc/urecord.c
@@ -43,7 +43,7 @@
 #include "ul_mod.h"
 #include "utime.h"
 #include "ul_callback.h"
-
+#include "usrloc.h"
 
 /*! contact matching mode */
 int matching_mode = CONTACT_ONLY;




More information about the sr-dev mailing list