[Devel] [patch] registrar module

Bogdan-Andrei Iancu bogdan at voice-system.ro
Tue Oct 17 19:05:04 CEST 2006


Hi Alfred,

the strlen is necessary - indeed the rcv_param has default value, but it 
may be overwritten via module parameters (and only the .s is updated, so 
you need to recalculate the .len).

I will apply your fixes in the docs and comments.

Thanks and regards,
Bogdan

Alfred E. Heggestad wrote:

> hi
>
> I was reviewing the registrar module today, and found some small
> issues that are fixed in the attached patch.
>
> please look carefully at the comment in:
>
>
> -    rcv_param.len = strlen(rcv_param.s);
> +    rcv_param.len = strlen(rcv_param.s); /* TODO - is this really 
> needed ? */
>
>
> I am not sure if this line is needed, since the variable is initialised
> when declared, but someone else should double-check this..
>
> (the patch builds ok, but is not tested)
>
>
> /alfred
>
>------------------------------------------------------------------------
>
>Index: modules/registrar/reg_mod.c
>===================================================================
>RCS file: /cvsroot/openser/sip-server/modules/registrar/reg_mod.c,v
>retrieving revision 1.17
>diff -u -3 -r1.17 reg_mod.c
>--- modules/registrar/reg_mod.c	10 Oct 2006 18:46:03 -0000	1.17
>+++ modules/registrar/reg_mod.c	11 Oct 2006 12:25:09 -0000
>@@ -76,7 +76,7 @@
> /* Minimum expires the phones are allowed to use in seconds
>  * use 0 to switch expires checking off */
> int min_expires     = 60;
>-/* Minimum expires the phones are allowed to use in seconds,
>+/* Maximum expires the phones are allowed to use in seconds,
>  * use 0 to switch expires checking off */
> int max_expires     = 0;
> /* Maximum number of contacts per AOR */
>@@ -211,7 +211,7 @@
> 	realm_prefix.s = realm_pref;
> 	realm_prefix.len = strlen(realm_pref);
> 	
>-	rcv_param.len = strlen(rcv_param.s);
>+	rcv_param.len = strlen(rcv_param.s); /* TODO - is this really needed ? */
> 	rcv_avp.n = rcv_avp_no;
> 
> 	bind_usrloc = (bind_usrloc_t)find_export("ul_bind_usrloc", 1, 0);
>Index: modules/registrar/reply.c
>===================================================================
>RCS file: /cvsroot/openser/sip-server/modules/registrar/reply.c,v
>retrieving revision 1.8
>diff -u -3 -r1.8 reply.c
>--- modules/registrar/reply.c	7 Mar 2006 10:31:07 -0000	1.8
>+++ modules/registrar/reply.c	11 Oct 2006 12:25:09 -0000
>@@ -73,7 +73,7 @@
>  * Calculate the length of buffer needed to
>  * print contacts
>  */
>-static inline unsigned int calc_buf_len(ucontact_t* c)
>+static inline unsigned int calc_buf_len(const ucontact_t* c)
> {
> 	unsigned int len;
> 	int qlen;
>@@ -108,7 +108,7 @@
>  * Allocate a memory buffer and print Contact
>  * header fields into it
>  */
>-int build_contact(ucontact_t* c)
>+int build_contact(const ucontact_t* c)
> {
> 	char *p, *cp;
> 	int fl, len;
>Index: modules/registrar/reply.h
>===================================================================
>RCS file: /cvsroot/openser/sip-server/modules/registrar/reply.h,v
>retrieving revision 1.2
>diff -u -3 -r1.2 reply.h
>--- modules/registrar/reply.h	19 Sep 2006 08:32:47 -0000	1.2
>+++ modules/registrar/reply.h	11 Oct 2006 12:25:09 -0000
>@@ -38,7 +38,7 @@
> /*
>  * Build Contact HF for reply
>  */
>-int build_contact(ucontact_t* c);
>+int build_contact(const ucontact_t* c);
> 
> 
> /*
>Index: modules/registrar/doc/registrar_user.sgml
>===================================================================
>RCS file: /cvsroot/openser/sip-server/modules/registrar/doc/registrar_user.sgml,v
>retrieving revision 1.14
>diff -u -3 -r1.14 registrar_user.sgml
>--- modules/registrar/doc/registrar_user.sgml	6 Oct 2006 15:58:06 -0000	1.14
>+++ modules/registrar/doc/registrar_user.sgml	11 Oct 2006 12:25:09 -0000
>@@ -419,7 +419,7 @@
> 	</section>
> 
> 	<section>
>-		<title><varname>received_param</varname> (integer)</title>
>+		<title><varname>received_param</varname> (string)</title>
> 		<para>
> 		The name of the parameter that will be appended to Contacts of 
> 		200 OK when the received URI was set by nathelper module.
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Devel mailing list
>Devel at openser.org
>http://openser.org/cgi-bin/mailman/listinfo/devel
>  
>




More information about the Devel mailing list