Skip to content

Commit

Permalink
registrar: coherent indentation and whitespacing
Browse files Browse the repository at this point in the history
(cherry picked from commit 90350e2)
  • Loading branch information
miconda committed May 2, 2016
1 parent d59d68c commit 24c6d38
Show file tree
Hide file tree
Showing 21 changed files with 146 additions and 148 deletions.
6 changes: 3 additions & 3 deletions modules/registrar/api.c
@@ -1,5 +1,5 @@
/*
* Functions that process REGISTER message
* Functions that process REGISTER message
* and store data in usrloc
*
* Copyright (C) 2010 Daniel-Constantin Mierla (asipto.com)
Expand All @@ -16,8 +16,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
*
*/
Expand Down
6 changes: 3 additions & 3 deletions modules/registrar/api.h
@@ -1,5 +1,5 @@
/*
* Functions that process REGISTER message
* Functions that process REGISTER message
* and store data in usrloc
*
* Copyright (C) 2010 Daniel-Constantin Mierla (asipto.com)
Expand All @@ -16,8 +16,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
*
*/
Expand Down
14 changes: 7 additions & 7 deletions modules/registrar/common.c
Expand Up @@ -15,10 +15,10 @@
* 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
*
*
*/

/*!
Expand All @@ -27,7 +27,7 @@
* \ingroup registrar
*/

#include <string.h>
#include <string.h>
#include "../../dprint.h"
#include "rerrno.h"
#include "reg_mod.h"
Expand All @@ -48,7 +48,7 @@ int extract_aor(str* _uri, str* _a, sip_uri_t *_pu)
int user_len;
str *uri;
str realm_prefix = {0};

memset(aor_buf, 0, MAX_AOR_LEN);
uri=_uri;

Expand All @@ -62,7 +62,7 @@ int extract_aor(str* _uri, str* _a, sip_uri_t *_pu)
LM_ERR("failed to parse AoR [%.*s]\n", uri->len, uri->s);
return -1;
}

if ( (puri->user.len + puri->host.len + 1) > MAX_AOR_LEN
|| puri->user.len > USERNAME_MAX_SIZE
|| puri->host.len > DOMAIN_MAX_SIZE ) {
Expand All @@ -86,7 +86,7 @@ int extract_aor(str* _uri, str* _a, sip_uri_t *_pu)
if (user_len)
aor_buf[_a->len++] = '@';
/* strip prefix (if defined) */
realm_prefix.len = cfg_get(registrar, registrar_cfg, realm_pref).len;
realm_prefix.len = cfg_get(registrar, registrar_cfg, realm_pref).len;
if(realm_prefix.len>0) {
realm_prefix.s = cfg_get(registrar, registrar_cfg, realm_pref).s;
LM_DBG("realm prefix is [%.*s]\n", realm_prefix.len,
Expand Down
8 changes: 4 additions & 4 deletions modules/registrar/common.h
Expand Up @@ -15,16 +15,16 @@
* 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
*/

/*!
* \file
* \brief SIP registrar module - common stuff
* \ingroup registrar
*/
* \ingroup registrar
*/


#ifndef COMMON_H
Expand Down
4 changes: 2 additions & 2 deletions modules/registrar/config.c
Expand Up @@ -18,7 +18,7 @@
*/

/*!
* \file
* \file
* \brief Registrar :: Configuration
* \ingroup Registrar
*/
Expand All @@ -41,7 +41,7 @@ struct cfg_group_registrar default_registrar_cfg = {
0, /* case_sensitive */
Q_UNSPECIFIED, /* default_q */
1 /* append_branches */
};
};

void *registrar_cfg = &default_registrar_cfg;

Expand Down
6 changes: 3 additions & 3 deletions modules/registrar/config.h
Expand Up @@ -4,13 +4,13 @@
* 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
*/

/*!
* \file
* \file
* \brief Registrar :: Configuration
* \ingroup registrar
*/
Expand Down
82 changes: 41 additions & 41 deletions modules/registrar/lookup.c
Expand Up @@ -15,16 +15,16 @@
* 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
*
*/
/*!
* \file
* \brief SIP registrar module - lookup contacts in usrloc
* \ingroup registrar
*/
* \ingroup registrar
*/


#include <string.h>
Expand Down Expand Up @@ -82,14 +82,14 @@ int reg_cmp_instances(str *i1, str *i2)
* Lookup a contact in usrloc and rewrite R-URI if found
*/
int lookup(struct sip_msg* _m, udomain_t* _d, str* _uri) {
return lookup_helper(_m, _d, _uri, 0);
return lookup_helper(_m, _d, _uri, 0);
}

/*! \brief
* Lookup a contact in usrloc and add the records to the dset structure
*/
int lookup_to_dset(struct sip_msg* _m, udomain_t* _d, str* _uri) {
return lookup_helper(_m, _d, _uri, 1);
return lookup_helper(_m, _d, _uri, 1);
}

/*! \brief
Expand Down Expand Up @@ -168,7 +168,7 @@ int lookup_helper(struct sip_msg* _m, udomain_t* _d, str* _uri, int _mode)

if (_m->new_uri.s) uri = _m->new_uri;
else uri = _m->first_line.u.request.uri;

if (extract_aor((_uri)?_uri:&uri, &aor, &puri) < 0) {
LM_ERR("failed to extract address of record\n");
return -3;
Expand Down Expand Up @@ -340,26 +340,26 @@ int lookup_helper(struct sip_msg* _m, udomain_t* _d, str* _uri, int _mode)
}

if (ptr->instance.len) {
if (set_instance(_m, &(ptr->instance)) < 0) {
if (set_instance(_m, &(ptr->instance)) < 0) {
ret = -3;
goto done;
}
}
}

_m->reg_id = ptr->reg_id;

if (ptr->ruid.len) {
if (set_ruid(_m, &(ptr->ruid)) < 0) {
if (set_ruid(_m, &(ptr->ruid)) < 0) {
ret = -3;
goto done;
}
}
}

if (ptr->user_agent.len) {
if (set_ua(_m, &(ptr->user_agent)) < 0) {
if (set_ua(_m, &(ptr->user_agent)) < 0) {
ret = -3;
goto done;
}
}
}

set_ruri_q(ptr->q);
Expand Down Expand Up @@ -422,18 +422,18 @@ int lookup_helper(struct sip_msg* _m, udomain_t* _d, str* _uri, int _mode)
path_dst.len = 0;
}

/* The same as for the first contact applies for branches
/* The same as for the first contact applies for branches
* regarding path vs. received. */
LM_DBG("instance is %.*s\n",
ptr->instance.len, ptr->instance.s);
ptr->instance.len, ptr->instance.s);
if (append_branch(_m, &ptr->c,
path_dst.len?&path_dst:&ptr->received,
path_dst.len?&path_str:0, ptr->q, ptr->cflags,
ptr->sock,
ptr->instance.len?&(ptr->instance):0,
ptr->instance.len?ptr->reg_id:0,
&ptr->ruid, &ptr->user_agent)
== -1) {
path_dst.len?&path_dst:&ptr->received,
path_dst.len?&path_str:0, ptr->q, ptr->cflags,
ptr->sock,
ptr->instance.len?&(ptr->instance):0,
ptr->instance.len?ptr->reg_id:0,
&ptr->ruid, &ptr->user_agent)
== -1) {
LM_ERR("failed to append a branch\n");
/* Also give a chance to the next branches*/
continue;
Expand Down Expand Up @@ -484,19 +484,19 @@ int clear_ruri_branch(sip_msg_t *msg)
*/
int reset_ruri_branch(sip_msg_t *msg)
{
if(msg==NULL)
return -1;

reset_dst_uri(msg);
reset_path_vector(msg);
set_ruri_q(Q_UNSPECIFIED);
reset_force_socket(msg);
setbflagsval(0, 0);
reset_instance(msg);
msg->reg_id = 0;
reset_ruid(msg);
reset_ua(msg);
return 0;
if(msg==NULL)
return -1;

reset_dst_uri(msg);
reset_path_vector(msg);
set_ruri_q(Q_UNSPECIFIED);
reset_force_socket(msg);
setbflagsval(0, 0);
reset_instance(msg);
msg->reg_id = 0;
reset_ruid(msg);
reset_ua(msg);
return 0;
}

/*! \brief
Expand Down Expand Up @@ -681,12 +681,12 @@ int registered4(struct sip_msg* _m, udomain_t* _d, str* _uri, int match_flag, in
else uri = _m->first_line.u.request.uri;
}
}

if (extract_aor(&uri, &aor, NULL) < 0) {
LM_ERR("failed to extract address of record\n");
return -1;
}

ul.lock_udomain(_d, &aor);
res = ul.get_urecord(_d, &aor, &r);

Expand Down Expand Up @@ -726,17 +726,17 @@ int registered4(struct sip_msg* _m, udomain_t* _d, str* _uri, int match_flag, in
if(!VALID_CONTACT(ptr, act_time)) continue;
if (match_callid.s && /* optionally enforce tighter matching w/ Call-ID */
match_callid.len > 0 &&
(match_callid.len != ptr->callid.len ||
(match_callid.len != ptr->callid.len ||
memcmp(match_callid.s, ptr->callid.s, match_callid.len)))
continue;
if (match_received.s && /* optionally enforce tighter matching w/ ip:port */
match_received.len > 0 &&
(match_received.len != ptr->received.len ||
(match_received.len != ptr->received.len ||
memcmp(match_received.s, ptr->received.s, match_received.len)))
continue;
if (match_contact.s && /* optionally enforce tighter matching w/ Contact */
match_contact.len > 0 &&
(match_contact.len != ptr->c.len ||
(match_contact.len != ptr->c.len ||
memcmp(match_contact.s, ptr->c.s, match_contact.len)))
continue;

Expand Down
8 changes: 4 additions & 4 deletions modules/registrar/lookup.h
Expand Up @@ -15,16 +15,16 @@
* 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
*/

/*!
* \file
* \brief SIP registrar module - lookup contacts in usrloc
* \ingroup registrar
*/
* \ingroup registrar
*/


#ifndef LOOKUP_H
Expand Down
16 changes: 8 additions & 8 deletions modules/registrar/path.c
Expand Up @@ -15,16 +15,16 @@
* 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
*
*/
/*!
* \file
* \brief SIP registrar module - Helper functions for Path support
* \ingroup registrar
*/
* \ingroup registrar
*/


#include "../../data_lump.h"
Expand Down Expand Up @@ -98,11 +98,11 @@ int build_path_vector(struct sip_msg *_m, str *path, str *received)
free_params(params);

if (hooks.contact.received) {
uri_str.s = uri_buf;
uri_str.s = uri_buf;
uri_str.len = MAX_URI_SIZE;
if (unescape_user(&(hooks.contact.received->body), &uri_str) < 0) {
LM_ERR("unescaping received failed\n");
goto error;
if (unescape_user(&(hooks.contact.received->body), &uri_str) < 0) {
LM_ERR("unescaping received failed\n");
goto error;
}
*received = uri_str;
LM_DBG("received is <%.*s>\n", received->len, received->s);
Expand Down
4 changes: 2 additions & 2 deletions modules/registrar/path.h
Expand Up @@ -23,8 +23,8 @@
/*!
* \file
* \brief SIP registrar module - helper functions for Path support
* \ingroup registrar
*/
* \ingroup registrar
*/

#ifndef REG_PATH_H
#define REG_PATH_H
Expand Down

0 comments on commit 24c6d38

Please sign in to comment.