瀏覽代碼

pua_usrloc: removed old svn ids

Daniel-Constantin Mierla 8 年之前
父節點
當前提交
c027c6d32f

+ 20 - 0
src/modules/pua_usrloc/api.h

@@ -1,3 +1,23 @@
+/*
+ * pua_urloc module - usrloc pua module
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
 #ifndef PUAUSRLOC_API_H
 #ifndef PUAUSRLOC_API_H
 #define PUAUSRLOC_API_H
 #define PUAUSRLOC_API_H
 #include "../../core/str.h"
 #include "../../core/str.h"

+ 10 - 10
src/modules/pua_usrloc/pua_usrloc.c

@@ -75,7 +75,7 @@ static cmd_export_t cmds[]=
 {
 {
 	{"pua_set_publish", (cmd_function)pua_set_publish, 0, 0, 0, REQUEST_ROUTE},
 	{"pua_set_publish", (cmd_function)pua_set_publish, 0, 0, 0, REQUEST_ROUTE},
 	{"bind_pua_usrloc", (cmd_function)bind_pua_usrloc, 1, 0, 0, 0},
 	{"bind_pua_usrloc", (cmd_function)bind_pua_usrloc, 1, 0, 0, 0},
-	{0, 0, 0, 0, 0, 0} 
+	{0, 0, 0, 0, 0, 0}
 };
 };
 
 
 static param_export_t params[]={
 static param_export_t params[]={
@@ -99,7 +99,7 @@ struct module_exports exports= {
 	0,							/*!< destroy function */
 	0,							/*!< destroy function */
 	0							/*!< per-child init function */
 	0							/*!< per-child init function */
 };
 };
-	
+
 /*! \brief
 /*! \brief
  * init module function
  * init module function
  */
  */
@@ -107,13 +107,13 @@ static int mod_init(void)
 {
 {
 	bind_usrloc_t bind_usrloc;
 	bind_usrloc_t bind_usrloc;
 	bind_pua_t bind_pua;
 	bind_pua_t bind_pua;
-	
+
 	if(!default_domain.s || default_domain.len<=0)
 	if(!default_domain.s || default_domain.len<=0)
-	{	
+	{
 		LM_ERR("default domain parameter not set\n");
 		LM_ERR("default domain parameter not set\n");
 		return -1;
 		return -1;
 	}
 	}
-	
+
 	if(!pres_prefix.s || pres_prefix.len<=0)
 	if(!pres_prefix.s || pres_prefix.len<=0)
 		LM_DBG("No pres_prefix configured\n");
 		LM_DBG("No pres_prefix configured\n");
 
 
@@ -146,26 +146,26 @@ static int mod_init(void)
 				" expire\n");
 				" expire\n");
 		return -1;
 		return -1;
 	}
 	}
-	
+
 	if(ul.register_ulcb(UL_CONTACT_UPDATE, ul_publish, 0)< 0)
 	if(ul.register_ulcb(UL_CONTACT_UPDATE, ul_publish, 0)< 0)
 	{
 	{
 		LM_ERR("can not register callback for update\n");
 		LM_ERR("can not register callback for update\n");
 		return -1;
 		return -1;
 	}
 	}
-	
+
 	if(ul.register_ulcb(UL_CONTACT_DELETE, ul_publish, 0)< 0)
 	if(ul.register_ulcb(UL_CONTACT_DELETE, ul_publish, 0)< 0)
 	{
 	{
 		LM_ERR("can not register callback for delete\n");
 		LM_ERR("can not register callback for delete\n");
 		return -1;
 		return -1;
 	}
 	}
-	
+
 	bind_pua= (bind_pua_t)find_export("bind_pua", 1,0);
 	bind_pua= (bind_pua_t)find_export("bind_pua", 1,0);
 	if (!bind_pua)
 	if (!bind_pua)
 	{
 	{
 		LM_ERR("Can't bind pua\n");
 		LM_ERR("Can't bind pua\n");
 		return -1;
 		return -1;
 	}
 	}
-	
+
 	if (bind_pua(&_pu_pua) < 0)
 	if (bind_pua(&_pu_pua) < 0)
 	{
 	{
 		LM_ERR("Can't bind pua\n");
 		LM_ERR("Can't bind pua\n");
@@ -182,7 +182,7 @@ static int mod_init(void)
 		LM_ERR("Could not import send_subscribe\n");
 		LM_ERR("Could not import send_subscribe\n");
 		return -1;
 		return -1;
 	}
 	}
-	
+
 	/* register post-script pua_unset_publish unset function */
 	/* register post-script pua_unset_publish unset function */
 	if(register_script_cb(pua_unset_publish, POST_SCRIPT_CB|REQUEST_CB, 0)<0)
 	if(register_script_cb(pua_unset_publish, POST_SCRIPT_CB|REQUEST_CB, 0)<0)
 	{
 	{

+ 2 - 4
src/modules/pua_usrloc/pua_usrloc.h

@@ -1,6 +1,4 @@
 /*
 /*
- * $Id$
- *
  * pua_urloc module - usrloc pua module
  * pua_urloc module - usrloc pua module
  *
  *
  * Copyright (C) 2006 Voice Sistem S.R.L.
  * Copyright (C) 2006 Voice Sistem S.R.L.
@@ -17,8 +15,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 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 
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 
 

+ 26 - 31
src/modules/pua_usrloc/ul_publish.c

@@ -1,6 +1,4 @@
 /*
 /*
- * $Id$
- *
  * pua_usrloc module - usrloc pua module
  * pua_usrloc module - usrloc pua module
  *
  *
  * Copyright (C) 2006 Voice Sistem S.R.L.
  * Copyright (C) 2006 Voice Sistem S.R.L.
@@ -17,8 +15,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 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 
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 
 
@@ -64,7 +62,7 @@ int pua_unset_publish(struct sip_msg* msg, unsigned int flags, void* param)
 	return 1;
 	return 1;
 }
 }
 
 
-	
+
 /* for debug purpose only */
 /* for debug purpose only */
 void print_publ(publ_info_t* p)
 void print_publ(publ_info_t* p)
 {
 {
@@ -72,11 +70,11 @@ void print_publ(publ_info_t* p)
 	LM_DBG("uri= %.*s\n", p->pres_uri->len, p->pres_uri->s);
 	LM_DBG("uri= %.*s\n", p->pres_uri->len, p->pres_uri->s);
 	LM_DBG("id= %.*s\n", p->id.len, p->id.s);
 	LM_DBG("id= %.*s\n", p->id.len, p->id.s);
 	LM_DBG("expires= %d\n", p->expires);
 	LM_DBG("expires= %d\n", p->expires);
-}	
+}
 
 
 str* build_pidf(ucontact_t* c)
 str* build_pidf(ucontact_t* c)
 {
 {
-	xmlDocPtr  doc = NULL; 
+	xmlDocPtr  doc = NULL;
 	xmlNodePtr root_node = NULL;
 	xmlNodePtr root_node = NULL;
 	xmlNodePtr tuple_node = NULL;
 	xmlNodePtr tuple_node = NULL;
 	xmlNodePtr status_node = NULL;
 	xmlNodePtr status_node = NULL;
@@ -120,7 +118,7 @@ str* build_pidf(ucontact_t* c)
 
 
 		pres_uri.s[pres_uri.len++]= '@';
 		pres_uri.s[pres_uri.len++]= '@';
 		memcpy(pres_uri.s+ pres_uri.len, default_domain.s, default_domain.len);
 		memcpy(pres_uri.s+ pres_uri.len, default_domain.s, default_domain.len);
-		pres_uri.len+= default_domain.len;		
+		pres_uri.len+= default_domain.len;
 	}
 	}
 	pres_uri.s[pres_uri.len]= '\0';
 	pres_uri.s[pres_uri.len]= '\0';
 
 
@@ -129,13 +127,13 @@ str* build_pidf(ucontact_t* c)
 	if(doc==0)
 	if(doc==0)
 		return NULL;
 		return NULL;
 
 
-    	root_node = xmlNewNode(NULL, BAD_CAST "presence");
+	root_node = xmlNewNode(NULL, BAD_CAST "presence");
 	if(root_node==0)
 	if(root_node==0)
 		goto error;
 		goto error;
-    
+
 	xmlDocSetRootElement(doc, root_node);
 	xmlDocSetRootElement(doc, root_node);
 
 
-    	xmlNewProp(root_node, BAD_CAST "xmlns",
+	xmlNewProp(root_node, BAD_CAST "xmlns",
 			BAD_CAST "urn:ietf:params:xml:ns:pidf");
 			BAD_CAST "urn:ietf:params:xml:ns:pidf");
 	xmlNewProp(root_node, BAD_CAST "xmlns:dm",
 	xmlNewProp(root_node, BAD_CAST "xmlns:dm",
 			BAD_CAST "urn:ietf:params:xml:ns:pidf:data-model");
 			BAD_CAST "urn:ietf:params:xml:ns:pidf:data-model");
@@ -151,23 +149,23 @@ str* build_pidf(ucontact_t* c)
 		LM_ERR("while adding child\n");
 		LM_ERR("while adding child\n");
 		goto error;
 		goto error;
 	}
 	}
-	
+
 	status_node = xmlNewChild(tuple_node, NULL, BAD_CAST "status", NULL) ;
 	status_node = xmlNewChild(tuple_node, NULL, BAD_CAST "status", NULL) ;
 	if( status_node ==NULL)
 	if( status_node ==NULL)
 	{
 	{
 		LM_ERR("while adding child\n");
 		LM_ERR("while adding child\n");
 		goto error;
 		goto error;
 	}
 	}
-	
+
 	basic_node = xmlNewChild(status_node, NULL, BAD_CAST "basic",
 	basic_node = xmlNewChild(status_node, NULL, BAD_CAST "basic",
 		BAD_CAST "open") ;
 		BAD_CAST "open") ;
-	
+
 	if( basic_node ==NULL)
 	if( basic_node ==NULL)
 	{
 	{
 		LM_ERR("while adding child\n");
 		LM_ERR("while adding child\n");
 		goto error;
 		goto error;
 	}
 	}
-	
+
 	body = (str*)pkg_malloc(sizeof(str));
 	body = (str*)pkg_malloc(sizeof(str));
 	if(body == NULL)
 	if(body == NULL)
 	{
 	{
@@ -180,9 +178,9 @@ str* build_pidf(ucontact_t* c)
 
 
 	LM_DBG("new_body:\n%.*s\n",body->len, body->s);
 	LM_DBG("new_body:\n%.*s\n",body->len, body->s);
 
 
-    	/*free the document */
+	/*free the document */
 	xmlFreeDoc(doc);
 	xmlFreeDoc(doc);
-    	xmlCleanupParser();
+	xmlCleanupParser();
 
 
 	return body;
 	return body;
 
 
@@ -196,7 +194,7 @@ error:
 	if(doc)
 	if(doc)
 		xmlFreeDoc(doc);
 		xmlFreeDoc(doc);
 	return NULL;
 	return NULL;
-}	
+}
 
 
 void ul_publish(ucontact_t* c, int type, void* param)
 void ul_publish(ucontact_t* c, int type, void* param)
 {
 {
@@ -246,7 +244,7 @@ void ul_publish(ucontact_t* c, int type, void* param)
 	}
 	}
 	else
 	else
 		body = NULL;
 		body = NULL;
-	
+
 	uri.s = (char*)pkg_malloc(sizeof(char)*(c->aor->len+default_domain.len+6));
 	uri.s = (char*)pkg_malloc(sizeof(char)*(c->aor->len+default_domain.len+6));
 	if(uri.s == NULL)
 	if(uri.s == NULL)
 		goto error;
 		goto error;
@@ -260,13 +258,13 @@ void ul_publish(ucontact_t* c, int type, void* param)
 	{
 	{
 		uri.s[uri.len++]= '@';
 		uri.s[uri.len++]= '@';
 		memcpy(uri.s+ uri.len, default_domain.s, default_domain.len);
 		memcpy(uri.s+ uri.len, default_domain.s, default_domain.len);
-		uri.len+= default_domain.len;		
+		uri.len+= default_domain.len;
 	}
 	}
 	LM_DBG("uri= %.*s\n", uri.len, uri.s);
 	LM_DBG("uri= %.*s\n", uri.len, uri.s);
-	
-	size= sizeof(publ_info_t)+ sizeof(str)+( uri.len 
-			+c->callid.len+ 12 + content_type.len)*sizeof(char); 
-	
+
+	size= sizeof(publ_info_t)+ sizeof(str)+( uri.len
+			+c->callid.len+ 12 + content_type.len)*sizeof(char);
+
 	if(body)
 	if(body)
 		size+= sizeof(str)+ body->len* sizeof(char);
 		size+= sizeof(str)+ body->len* sizeof(char);
 
 
@@ -311,7 +309,7 @@ void ul_publish(ucontact_t* c, int type, void* param)
 		publ->expires= 0;
 		publ->expires= 0;
 	else
 	else
 		publ->expires= c->expires - (int)time(NULL);
 		publ->expires= c->expires - (int)time(NULL);
-	
+
 	if(type & UL_CONTACT_INSERT)
 	if(type & UL_CONTACT_INSERT)
 		publ->flag|= INSERT_TYPE;
 		publ->flag|= INSERT_TYPE;
 	else
 	else
@@ -329,9 +327,9 @@ void ul_publish(ucontact_t* c, int type, void* param)
 			 * entry in 'pua' DB table. It can also occur if 'pua' table is cleaned externally while Kamailio
 			 * entry in 'pua' DB table. It can also occur if 'pua' table is cleaned externally while Kamailio
 			 * is stopped so cannot retrieve these entries from DB when restarting.
 			 * is stopped so cannot retrieve these entries from DB when restarting.
 			 * In these cases, when a refresh registration for that user creates an UPDATE action in pua_usrloc,
 			 * In these cases, when a refresh registration for that user creates an UPDATE action in pua_usrloc,
-			 * pua 'ul_publish()' would fail since the appropiate entry doesn't exist in pua hast table ("New 
+			 * pua 'ul_publish()' would fail since the appropiate entry doesn't exist in pua hast table ("New
 			 * PUBLISH and no body found - invalid request").
 			 * PUBLISH and no body found - invalid request").
-			 * This code solves this problem by invoking an INSERT action if an UPDATE action failed due to the 
+			 * This code solves this problem by invoking an INSERT action if an UPDATE action failed due to the
 			 * above error. It will however generate a new presentity entry in the presence server (until the
 			 * above error. It will however generate a new presentity entry in the presence server (until the
 			 * previous one expires), but this is a minor issue. */
 			 * previous one expires), but this is a minor issue. */
 			LM_ERR("UPDATE action generated a PUBLISH without body -> invoking INSERT action\n");
 			LM_ERR("UPDATE action generated a PUBLISH without body -> invoking INSERT action\n");
@@ -353,13 +351,10 @@ error:
 			xmlFree(body->s);
 			xmlFree(body->s);
 		pkg_free(body);
 		pkg_free(body);
 	}
 	}
-	
+
 	if(uri.s)
 	if(uri.s)
 		pkg_free(uri.s);
 		pkg_free(uri.s);
 	pua_ul_publish= 0;
 	pua_ul_publish= 0;
 
 
 	return;
 	return;
-
 }
 }
-
-