From c027c6d32f1c0add72ab00c14885d46bd1b7d485 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Mon, 20 Feb 2017 16:47:11 +0100 Subject: [PATCH] pua_usrloc: removed old svn ids --- src/modules/pua_usrloc/api.h | 20 ++++++++++ src/modules/pua_usrloc/pua_usrloc.c | 20 +++++----- src/modules/pua_usrloc/pua_usrloc.h | 6 +-- src/modules/pua_usrloc/ul_publish.c | 57 +++++++++++++---------------- 4 files changed, 58 insertions(+), 45 deletions(-) diff --git a/src/modules/pua_usrloc/api.h b/src/modules/pua_usrloc/api.h index 61147065b37..84f5cfd12de 100644 --- a/src/modules/pua_usrloc/api.h +++ b/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 #define PUAUSRLOC_API_H #include "../../core/str.h" diff --git a/src/modules/pua_usrloc/pua_usrloc.c b/src/modules/pua_usrloc/pua_usrloc.c index 2b843ff98c7..b393ef2928f 100644 --- a/src/modules/pua_usrloc/pua_usrloc.c +++ b/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}, {"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[]={ @@ -99,7 +99,7 @@ struct module_exports exports= { 0, /*!< destroy function */ 0 /*!< per-child init function */ }; - + /*! \brief * init module function */ @@ -107,13 +107,13 @@ static int mod_init(void) { bind_usrloc_t bind_usrloc; bind_pua_t bind_pua; - + if(!default_domain.s || default_domain.len<=0) - { + { LM_ERR("default domain parameter not set\n"); return -1; } - + if(!pres_prefix.s || pres_prefix.len<=0) LM_DBG("No pres_prefix configured\n"); @@ -146,26 +146,26 @@ static int mod_init(void) " expire\n"); return -1; } - + if(ul.register_ulcb(UL_CONTACT_UPDATE, ul_publish, 0)< 0) { LM_ERR("can not register callback for update\n"); return -1; } - + if(ul.register_ulcb(UL_CONTACT_DELETE, ul_publish, 0)< 0) { LM_ERR("can not register callback for delete\n"); return -1; } - + bind_pua= (bind_pua_t)find_export("bind_pua", 1,0); if (!bind_pua) { LM_ERR("Can't bind pua\n"); return -1; } - + if (bind_pua(&_pu_pua) < 0) { LM_ERR("Can't bind pua\n"); @@ -182,7 +182,7 @@ static int mod_init(void) LM_ERR("Could not import send_subscribe\n"); return -1; } - + /* register post-script pua_unset_publish unset function */ if(register_script_cb(pua_unset_publish, POST_SCRIPT_CB|REQUEST_CB, 0)<0) { diff --git a/src/modules/pua_usrloc/pua_usrloc.h b/src/modules/pua_usrloc/pua_usrloc.h index 66371e9cff2..89ceee5d26d 100644 --- a/src/modules/pua_usrloc/pua_usrloc.h +++ b/src/modules/pua_usrloc/pua_usrloc.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * pua_urloc module - usrloc pua module * * Copyright (C) 2006 Voice Sistem S.R.L. @@ -17,8 +15,8 @@ * 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 + * 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 */ diff --git a/src/modules/pua_usrloc/ul_publish.c b/src/modules/pua_usrloc/ul_publish.c index ea33118ff1c..af135a83e5e 100644 --- a/src/modules/pua_usrloc/ul_publish.c +++ b/src/modules/pua_usrloc/ul_publish.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * pua_usrloc module - usrloc pua module * * Copyright (C) 2006 Voice Sistem S.R.L. @@ -17,8 +15,8 @@ * 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 + * 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 */ @@ -64,7 +62,7 @@ int pua_unset_publish(struct sip_msg* msg, unsigned int flags, void* param) return 1; } - + /* for debug purpose only */ 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("id= %.*s\n", p->id.len, p->id.s); LM_DBG("expires= %d\n", p->expires); -} +} str* build_pidf(ucontact_t* c) { - xmlDocPtr doc = NULL; + xmlDocPtr doc = NULL; xmlNodePtr root_node = NULL; xmlNodePtr tuple_node = NULL; xmlNodePtr status_node = NULL; @@ -120,7 +118,7 @@ str* build_pidf(ucontact_t* c) pres_uri.s[pres_uri.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'; @@ -129,13 +127,13 @@ str* build_pidf(ucontact_t* c) if(doc==0) return NULL; - root_node = xmlNewNode(NULL, BAD_CAST "presence"); + root_node = xmlNewNode(NULL, BAD_CAST "presence"); if(root_node==0) goto error; - + xmlDocSetRootElement(doc, root_node); - xmlNewProp(root_node, BAD_CAST "xmlns", + xmlNewProp(root_node, BAD_CAST "xmlns", BAD_CAST "urn:ietf:params:xml:ns:pidf"); xmlNewProp(root_node, BAD_CAST "xmlns:dm", 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"); goto error; } - + status_node = xmlNewChild(tuple_node, NULL, BAD_CAST "status", NULL) ; if( status_node ==NULL) { LM_ERR("while adding child\n"); goto error; } - + basic_node = xmlNewChild(status_node, NULL, BAD_CAST "basic", BAD_CAST "open") ; - + if( basic_node ==NULL) { LM_ERR("while adding child\n"); goto error; } - + body = (str*)pkg_malloc(sizeof(str)); if(body == NULL) { @@ -180,9 +178,9 @@ str* build_pidf(ucontact_t* c) LM_DBG("new_body:\n%.*s\n",body->len, body->s); - /*free the document */ + /*free the document */ xmlFreeDoc(doc); - xmlCleanupParser(); + xmlCleanupParser(); return body; @@ -196,7 +194,7 @@ str* build_pidf(ucontact_t* c) if(doc) xmlFreeDoc(doc); return NULL; -} +} 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 body = NULL; - + uri.s = (char*)pkg_malloc(sizeof(char)*(c->aor->len+default_domain.len+6)); if(uri.s == NULL) goto error; @@ -260,13 +258,13 @@ void ul_publish(ucontact_t* c, int type, void* param) { uri.s[uri.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); - - 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) size+= sizeof(str)+ body->len* sizeof(char); @@ -311,7 +309,7 @@ void ul_publish(ucontact_t* c, int type, void* param) publ->expires= 0; else publ->expires= c->expires - (int)time(NULL); - + if(type & UL_CONTACT_INSERT) publ->flag|= INSERT_TYPE; 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 * 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, - * 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"). - * 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 * previous one expires), but this is a minor issue. */ LM_ERR("UPDATE action generated a PUBLISH without body -> invoking INSERT action\n"); @@ -353,13 +351,10 @@ void ul_publish(ucontact_t* c, int type, void* param) xmlFree(body->s); pkg_free(body); } - + if(uri.s) pkg_free(uri.s); pua_ul_publish= 0; return; - } - -