Module: sip-router
Branch: master
Commit: 7450805ac0c8dbe620f146ddf14eba7bee69171e
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7450805ac0c8dbe620f146ddf14eba7bee69171e

Author: Richard Good <[email protected]>
Committer: Richard Good <[email protected]>
Date:   Mon Aug 25 15:03:11 2014 +0200

modules/ims_registrar_pcscf: Replaced deprecated STR_PARAM with PARAM_STR

---

 modules/ims_registrar_pcscf/reg_mod.c     |    9 +++++----
 modules/ims_registrar_pcscf/subscribe.c   |   20 +++++++++-----------
 modules/ims_registrar_pcscf/ul_callback.c |    9 ++++-----
 3 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/modules/ims_registrar_pcscf/reg_mod.c 
b/modules/ims_registrar_pcscf/reg_mod.c
index 06febf9..1b9103e 100644
--- a/modules/ims_registrar_pcscf/reg_mod.c
+++ b/modules/ims_registrar_pcscf/reg_mod.c
@@ -81,8 +81,9 @@ int ignore_contact_rxport_check = 0;                          
   /**!< ignore po
                                                                  * this is 
useful for example if you register with UDP but possibly send invite over TCP 
(message too big)*/
 
 time_t time_now;
-char * pcscf_uri = "sip:pcscf.ims.smilecoms.com:4060";
-char * force_icscf_uri = "";
+
+str pcscf_uri = str_init("sip:pcscf.ims.smilecoms.com:4060");
+str force_icscf_uri = str_init("");
 
 unsigned int pending_reg_expires = 30;                 /**!< parameter for 
expiry time of a pending registration before receiving confirmation from SCSCF 
*/
 
@@ -150,7 +151,7 @@ static cmd_export_t cmds[] = {
  * Exported parameters
  */
 static param_export_t params[] = {
-       {"pcscf_uri",                   STR_PARAM, &pcscf_uri                   
        },
+       {"pcscf_uri",                   PARAM_STR, &pcscf_uri                   
        },
        {"pending_reg_expires",         INT_PARAM, &pending_reg_expires         
        },
        {"received_avp",                STR_PARAM, &rcv_avp_param               
        },
        {"is_registered_fallback2ip",   INT_PARAM, &is_registered_fallback2ip   
        },
@@ -158,7 +159,7 @@ static param_export_t params[] = {
         {"subscribe_to_reginfo",        INT_PARAM, &subscribe_to_reginfo       
         },
         {"subscription_expires",        INT_PARAM, &subscription_expires       
         },
         {"ignore_contact_rxport_check", INT_PARAM, 
&ignore_contact_rxport_check         },
-       {"force_icscf_uri",             STR_PARAM, &force_icscf_uri             
        },
+       {"force_icscf_uri",             PARAM_STR, &force_icscf_uri             
        },
 //     {"store_profile_dereg", INT_PARAM, &store_data_on_dereg},
        {0, 0, 0}
 };
diff --git a/modules/ims_registrar_pcscf/subscribe.c 
b/modules/ims_registrar_pcscf/subscribe.c
index cc2065d..9c859df 100644
--- a/modules/ims_registrar_pcscf/subscribe.c
+++ b/modules/ims_registrar_pcscf/subscribe.c
@@ -35,8 +35,8 @@
 
 
 extern pua_api_t pua;
-extern char* pcscf_uri;
-extern char * force_icscf_uri;
+extern str pcscf_uri;
+extern str force_icscf_uri;
 
 #define P_ASSERTED_IDENTITY_HDR_PREFIX "P-Asserted-Identity: <"
 
@@ -45,11 +45,9 @@ int reginfo_subscribe_real(struct sip_msg* msg, pv_elem_t* 
uri, str* service_rou
        char uri_buf[512];
        int uri_buf_len = 512;
        subs_info_t subs;
-       str server_address = {pcscf_uri, strlen(pcscf_uri)};
-       str outbound_proxy = {force_icscf_uri, strlen (force_icscf_uri)};
        str p_asserted_identity_header;
        
-       int len = strlen(P_ASSERTED_IDENTITY_HDR_PREFIX) + server_address.len + 
1 + CRLF_LEN;
+       int len = strlen(P_ASSERTED_IDENTITY_HDR_PREFIX) + pcscf_uri.len + 1 + 
CRLF_LEN;
        p_asserted_identity_header.s = (char *)pkg_malloc( len );
        if ( p_asserted_identity_header.s == NULL ) {
            LM_ERR( "insert_asserted_identity: pkg_malloc %d bytes failed", len 
);
@@ -58,8 +56,8 @@ int reginfo_subscribe_real(struct sip_msg* msg, pv_elem_t* 
uri, str* service_rou
 
        memcpy(p_asserted_identity_header.s, P_ASSERTED_IDENTITY_HDR_PREFIX, 
strlen(P_ASSERTED_IDENTITY_HDR_PREFIX));
        p_asserted_identity_header.len = strlen(P_ASSERTED_IDENTITY_HDR_PREFIX);
-       memcpy(p_asserted_identity_header.s + p_asserted_identity_header.len, 
server_address.s, server_address.len);
-       p_asserted_identity_header.len += server_address.len;
+       memcpy(p_asserted_identity_header.s + p_asserted_identity_header.len, 
pcscf_uri.s, pcscf_uri.len);
+       p_asserted_identity_header.len += pcscf_uri.len;
        *(p_asserted_identity_header.s + p_asserted_identity_header.len) = '>';
        p_asserted_identity_header.len ++;
        memcpy( p_asserted_identity_header.s + p_asserted_identity_header.len, 
CRLF, CRLF_LEN );
@@ -83,16 +81,16 @@ int reginfo_subscribe_real(struct sip_msg* msg, pv_elem_t* 
uri, str* service_rou
 
        subs.remote_target = &uri_str;
        subs.pres_uri= &uri_str;
-       subs.watcher_uri= &server_address;
+       subs.watcher_uri= &pcscf_uri;
        subs.expires = expires;
 
        subs.source_flag= REGINFO_SUBSCRIBE;
        subs.event= REGINFO_EVENT;
-       subs.contact= &server_address;
+       subs.contact= &pcscf_uri;
        subs.extra_headers = &p_asserted_identity_header;
        
-       if(outbound_proxy.s && outbound_proxy.len) {
-           subs.outbound_proxy= &outbound_proxy;
+       if(force_icscf_uri.s && force_icscf_uri.len) {
+           subs.outbound_proxy= &force_icscf_uri;
        }
        
        subs.flag|= UPDATE_TYPE;
diff --git a/modules/ims_registrar_pcscf/ul_callback.c 
b/modules/ims_registrar_pcscf/ul_callback.c
index 1a78931..119f3c9 100644
--- a/modules/ims_registrar_pcscf/ul_callback.c
+++ b/modules/ims_registrar_pcscf/ul_callback.c
@@ -74,7 +74,7 @@ Call-ID: 9ad9f89f-164d-bb86-1072-52e7e9eb5025.
 </reginfo> */
 
 extern pua_api_t pua;
-extern char* pcscf_uri;
+extern str pcscf_uri;
 extern int publish_reginfo;
 
 /* methods for building reg publish */
@@ -189,13 +189,12 @@ int send_partial_publish(ppublic_t *impu, struct pcontact 
*c, int type)
        str content_type;
        int id_buf_len;
        char id_buf[512];
-       str server_address = {pcscf_uri, strlen(pcscf_uri)};
        str p_asserted_identity_header;
 
        content_type.s = "application/reginfo+xml";
        content_type.len = 23;
        
-       int len = strlen(P_ASSERTED_IDENTITY_HDR_PREFIX) + server_address.len + 
1 + CRLF_LEN;
+       int len = strlen(P_ASSERTED_IDENTITY_HDR_PREFIX) + pcscf_uri.len + 1 + 
CRLF_LEN;
        p_asserted_identity_header.s = (char *)pkg_malloc( len );
        if ( p_asserted_identity_header.s == NULL ) {
            LM_ERR( "insert_asserted_identity: pkg_malloc %d bytes failed", len 
);
@@ -204,8 +203,8 @@ int send_partial_publish(ppublic_t *impu, struct pcontact 
*c, int type)
        
        memcpy(p_asserted_identity_header.s, P_ASSERTED_IDENTITY_HDR_PREFIX, 
strlen(P_ASSERTED_IDENTITY_HDR_PREFIX));
        p_asserted_identity_header.len = strlen(P_ASSERTED_IDENTITY_HDR_PREFIX);
-       memcpy(p_asserted_identity_header.s + p_asserted_identity_header.len, 
server_address.s, server_address.len);
-       p_asserted_identity_header.len += server_address.len;
+       memcpy(p_asserted_identity_header.s + p_asserted_identity_header.len, 
pcscf_uri.s, pcscf_uri.len);
+       p_asserted_identity_header.len += pcscf_uri.len;
        *(p_asserted_identity_header.s + p_asserted_identity_header.len) = '>';
        p_asserted_identity_header.len ++;
        memcpy( p_asserted_identity_header.s + p_asserted_identity_header.len, 
CRLF, CRLF_LEN );


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to