uac Minor code cleanup, add a few doxygen headers
authorOlle E. Johansson <oej@edvina.net>
Sat, 23 Apr 2016 14:35:53 +0000 (16:35 +0200)
committerOlle E. Johansson <oej@edvina.net>
Sat, 23 Apr 2016 14:35:53 +0000 (16:35 +0200)
modules/uac/api.h
modules/uac/auth.c
modules/uac/auth_alg.c
modules/uac/auth_hdr.c
modules/uac/replace.c
modules/uac/uac.c
modules/uac/uac_reg.c
modules/uac/uac_send.c

index 689f1fe..b886469 100644 (file)
@@ -1,3 +1,21 @@
+/*
+ * 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 UAC_API_H_
 #define UAC_API_H_
 #include "../../sr_module.h"
index 7b8e6ed..6a530b7 100644 (file)
  *
  */
 
+/*!
+ * \file
+ * \brief Kamailio uac :: Authentication
+ * \ingroup uac
+ * Module: \ref uac
+ */
 
 #include <ctype.h>
 #include <string.h>
@@ -250,8 +256,7 @@ static inline struct uac_credential *lookup_realm( str *realm)
 }
 
 
-static inline struct uac_credential *get_avp_credential(struct sip_msg *msg,
-                                                                                                                               str *realm)
+static inline struct uac_credential *get_avp_credential(struct sip_msg *msg, str *realm)
 {
        static struct uac_credential crd;
        pv_value_t pv_val;
@@ -266,8 +271,9 @@ static inline struct uac_credential *get_avp_credential(struct sip_msg *msg,
                crd.realm = pv_val.rs;
                /* is it the domain we are looking for? */
                if (realm->len!=crd.realm.len ||
-                 strncmp( realm->s, crd.realm.s, realm->len)!=0 )
+                 strncmp( realm->s, crd.realm.s, realm->len)!=0 ) {
                        return 0;
+               }
        }
 
        /* get username and password */
index 608ac64..6edcbab 100644 (file)
  *
  */
 
+/*!
+ * \file
+ * \brief Kamailio uac :: Authentication
+ * \ingroup uac
+ * Module: \ref uac
+ */
+
 
 #include "../../md5.h"
 
index 62d204d..e3cb8eb 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
+/*!
+ * \file
+ * \brief Kamailio uac :: Authentication headers
+ * \ingroup uac
+ * Module: \ref uac
+ */
+
 
 #include "string.h"
 #include "ctype.h"
index 3899355..540042b 100644 (file)
  *
  */
 
+/*!
+ * \file
+ * \brief Kamailio uac :: header replacement/retrieval functions
+ * \ingroup uac
+ * Module: \ref uac
+ */
 
 #include <ctype.h>
 
index eada858..7860ebf 100644 (file)
  *
  */
 
+/*!
+ * \file
+ * \brief Kamailio uac :: The SIP UA client module
+ * \ingroup uac
+ * Module: \ref uac
+ */
+
+/*! \defgroup uac The SIP UA Client module
+ *
+ */
+
 
 #include <stdio.h>
 #include <string.h>
@@ -105,24 +116,20 @@ static cmd_export_t cmds[]={
                REQUEST_ROUTE | BRANCH_ROUTE },
        {"uac_replace_from",  (cmd_function)w_replace_from,  1, fixup_replace_uri, 0,
                REQUEST_ROUTE | BRANCH_ROUTE },
-       {"uac_restore_from",  (cmd_function)w_restore_from,  0,                  0, 0,
+       {"uac_restore_from",  (cmd_function)w_restore_from,  0,           0, 0,
                REQUEST_ROUTE },
        {"uac_replace_to",  (cmd_function)w_replace_to,  2, fixup_replace_uri, 0,
                REQUEST_ROUTE | BRANCH_ROUTE },
        {"uac_replace_to",  (cmd_function)w_replace_to,  1, fixup_replace_uri, 0,
                REQUEST_ROUTE | BRANCH_ROUTE },
-       {"uac_restore_to",  (cmd_function)w_restore_to,  0, 0, 0,
-               REQUEST_ROUTE },
-       {"uac_auth",          (cmd_function)w_uac_auth,       0,                  0, 0,
-               FAILURE_ROUTE },
-       {"uac_req_send",  (cmd_function)w_uac_req_send,       0,                  0, 0,
-               ANY_ROUTE},
+       {"uac_restore_to",  (cmd_function)w_restore_to,  0, 0, 0, REQUEST_ROUTE },
+       {"uac_auth",      (cmd_function)w_uac_auth,       0, 0, 0, FAILURE_ROUTE },
+       {"uac_req_send",  (cmd_function)w_uac_req_send,   0, 0, 0, ANY_ROUTE},
        {"uac_reg_lookup",  (cmd_function)w_uac_reg_lookup,  2, fixup_pvar_pvar,
                fixup_free_pvar_pvar, ANY_ROUTE },
        {"uac_reg_request_to",  (cmd_function)w_uac_reg_request_to,  2, fixup_pvar_uint, fixup_free_pvar_uint,
                REQUEST_ROUTE | FAILURE_ROUTE | BRANCH_ROUTE },
-       {"bind_uac", (cmd_function)bind_uac,                  1,                  0, 0,
-               0},
+       {"bind_uac", (cmd_function)bind_uac,              1,  0, 0, 0},
        {0,0,0,0,0,0}
 };
 
@@ -130,22 +137,22 @@ static cmd_export_t cmds[]={
 
 /* Exported parameters */
 static param_export_t params[] = {
-       {"rr_from_store_param", PARAM_STR,                              &rr_from_param       },
-       {"rr_to_store_param",   PARAM_STR,                              &rr_to_param       },
-       {"restore_mode",        PARAM_STRING,                           &restore_mode_str      },
-       {"restore_dlg",         INT_PARAM,                              &uac_restore_dlg       },
-       {"restore_passwd",      PARAM_STR,                              &uac_passwd          },
-       {"restore_from_avp",    PARAM_STR,                              &restore_from_avp },
-       {"restore_to_avp",              PARAM_STR,                              &restore_to_avp },
-       {"credential",        PARAM_STRING|USE_FUNC_PARAM, (void*)&add_credential },
-       {"auth_username_avp", PARAM_STRING,                &auth_username_avp     },
-       {"auth_realm_avp",    PARAM_STRING,                &auth_realm_avp        },
-       {"auth_password_avp", PARAM_STRING,                &auth_password_avp     },
-       {"reg_db_url",        PARAM_STR,                &reg_db_url          },
-       {"reg_db_table",      PARAM_STR,                &reg_db_table        },
-       {"reg_contact_addr",  PARAM_STR,                &reg_contact_addr    },
-       {"reg_timer_interval", INT_PARAM,               &reg_timer_interval     },
-       {"reg_retry_interval", INT_PARAM,               &reg_retry_interval    },
+       {"rr_from_store_param", PARAM_STR,                      &rr_from_param       },
+       {"rr_to_store_param",   PARAM_STR,                      &rr_to_param       },
+       {"restore_mode",        PARAM_STRING,                   &restore_mode_str      },
+       {"restore_dlg",         INT_PARAM,                      &uac_restore_dlg       },
+       {"restore_passwd",      PARAM_STR,                      &uac_passwd       },
+       {"restore_from_avp",    PARAM_STR,                      &restore_from_avp },
+       {"restore_to_avp",      PARAM_STR,                      &restore_to_avp },
+       {"credential",          PARAM_STRING|USE_FUNC_PARAM,    (void*)&add_credential },
+       {"auth_username_avp",   PARAM_STRING,                   &auth_username_avp     },
+       {"auth_realm_avp",      PARAM_STRING,                   &auth_realm_avp },
+       {"auth_password_avp",   PARAM_STRING,                   &auth_password_avp     },
+       {"reg_db_url",          PARAM_STR,                      &reg_db_url       },
+       {"reg_db_table",        PARAM_STR,                      &reg_db_table   },
+       {"reg_contact_addr",    PARAM_STR,                      &reg_contact_addr    },
+       {"reg_timer_interval",  INT_PARAM,                      &reg_timer_interval     },
+       {"reg_retry_interval",  INT_PARAM,                      &reg_retry_interval    },
        {0, 0, 0}
 };
 
@@ -156,10 +163,10 @@ struct module_exports exports= {
        DEFAULT_DLFLAGS, /* dlopen flags */
        cmds,       /* exported functions */
        params,     /* param exports */
-       0,          /* exported statistics */
-       0,          /* exported MI functions */
+       0,        /* exported statistics */
+       0,        /* exported MI functions */
        mod_pvs,    /* exported pseudo-variables */
-       0,          /* extra processes */
+       0,        /* extra processes */
        mod_init,   /* module initialization function */
        0,
        mod_destroy,
@@ -423,14 +430,16 @@ int w_replace_from(struct sip_msg* msg, char* p1, char* p2)
        /* p1 display , p2 uri */
 
        if ( p1!=NULL ) {
-               if(pv_printf_s( msg, (pv_elem_p)p1, &dsp_s)!=0)
+               if(pv_printf_s( msg, (pv_elem_p)p1, &dsp_s)!=0) {
                        return -1;
+               }
                dsp = &dsp_s;
        }
 
        /* compute the URI string; if empty string -> make it NULL */
-       if (pv_printf_s( msg, (pv_elem_p)p2, &uri_s)!=0)
+       if (pv_printf_s( msg, (pv_elem_p)p2, &uri_s)!=0) {
                return -1;
+       }
        uri = uri_s.len?&uri_s:NULL;
 
        if (parse_from_header(msg)<0 ) {
index 8ff63bd..c1236ae 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+/*!
+ * \file
+ * \brief Kamailio uac :: The SIP UA registration client module
+ * \ingroup uac
+ * Module: \ref uac
+ */
+
 #include <time.h>
 
 #include "../../dprint.h"
index bf4824b..34277a0 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+/*!
+ * \file
+ * \brief Kamailio uac :: UAC send functions
+ * \ingroup uac
+ * Module: \ref uac
+ */
+
 #include "../../dprint.h"
 #include "../../trim.h"
 #include "../../route.h"
@@ -794,10 +801,10 @@ int uac_req_send(void)
        }
        uac_r.callid = (_uac_req.s_callid.len <= 0) ? NULL : &_uac_req.s_callid;
        ret = tmb.t_request(&uac_r,  /* UAC Req */
-                                               &_uac_req.s_ruri,        /* Request-URI */
-                                               (_uac_req.s_turi.len<=0)?&_uac_req.s_ruri:&_uac_req.s_turi, /* To */
-                                               (_uac_req.s_furi.len<=0)?&_uac_req.s_ruri:&_uac_req.s_furi, /* From */
-                                               (_uac_req.s_ouri.len<=0)?NULL:&_uac_req.s_ouri /* outbound uri */
+                       &_uac_req.s_ruri,        /* Request-URI */
+                       (_uac_req.s_turi.len<=0)?&_uac_req.s_ruri:&_uac_req.s_turi, /* To */
+                       (_uac_req.s_furi.len<=0)?&_uac_req.s_ruri:&_uac_req.s_furi, /* From */
+                       (_uac_req.s_ouri.len<=0)?NULL:&_uac_req.s_ouri /* outbound uri */
                );
 
        if(ret<0) {