[asterisk-commits] mjordan: branch 11 r374642 - in /branches/11/res/pjproject/pjlib: include/pj/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Oct 7 19:41:03 CDT 2012


Author: mjordan
Date: Sun Oct  7 19:41:01 2012
New Revision: 374642

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=374642
Log:
pjproject: Fix for Solaris builds. Do not undef s_addr.

pjproject, in order to solve build problems on Windows [1], undefines s_addr in
one of it's headers that is included in res_rtp_asterisk.c. On Solaris s_addr
is not a structure member, but defined to map to the real strucuture member,
therefore when building on Solaris it's possible to get build errors like:

    [CC] res_rtp_asterisk.c -> res_rtp_asterisk.o
    In file included from /export/home/admin/asterisk-11-svn/include/asterisk/stun.h:29,
                     from res_rtp_asterisk.c:51:
    /export/home/admin/asterisk-11-svn/include/asterisk/network.h: In function `inaddrcmp':
    /export/home/admin/asterisk-11-svn/include/asterisk/network.h:92: error: structure has no member named `s_addr'
    /export/home/admin/asterisk-11-svn/include/asterisk/network.h:92: error: structure has no member named `s_addr'
    res_rtp_asterisk.c: In function `ast_rtp_on_ice_tx_pkt':
    res_rtp_asterisk.c:706: warning: dereferencing type-punned pointer will break strict-aliasing rules
    res_rtp_asterisk.c:710: warning: dereferencing type-punned pointer will break strict-aliasing rules
    res_rtp_asterisk.c: In function `rtp_add_candidates_to_ice':
    res_rtp_asterisk.c:1085: error: structure has no member named `s_addr'
    make[2]: *** [res_rtp_asterisk.o] Error 1
    make[1]: *** [res] Error 2
    make[1]: Leaving directory `/export/home/admin/asterisk-11-svn'
    gmake: *** [_cleantest_all] Error 2

Unfortunately, in order to make this work, I also had to make sure pjproject
only used the typdef pj_in_addr and not the struct pj_in_addr so that when
building Asterisk I could "typedef struct in_addr pj_in_addr". It's possible
then that the library and users of those interfaces in Asterisk have a different
idea about the type of the argument, while on the surface it looks like they are
all 32 bit big endian values.

[1] http://trac.pjsip.org/repos/changeset/484

(issues ASTERISK-20366)
Reported by: Ben Klang
Tested by: Ben Klang, mjordan
patches:
  0001-pjproject-Fix-for-Solaris-builds.-Do-not-undef-s.patch uploaded by Shaun Ruffell (license 5417)


Modified:
    branches/11/res/pjproject/pjlib/include/pj/sock.h
    branches/11/res/pjproject/pjlib/src/pj/sock_bsd.c
    branches/11/res/pjproject/pjlib/src/pj/sock_linux_kernel.c
    branches/11/res/pjproject/pjlib/src/pj/sock_symbian.cpp

Modified: branches/11/res/pjproject/pjlib/include/pj/sock.h
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/pjproject/pjlib/include/pj/sock.h?view=diff&rev=374642&r1=374641&r2=374642
==============================================================================
--- branches/11/res/pjproject/pjlib/include/pj/sock.h (original)
+++ branches/11/res/pjproject/pjlib/include/pj/sock.h Sun Oct  7 19:41:01 2012
@@ -471,6 +471,7 @@
  */
 #define PJ_INVALID_SOCKET   (-1)
 
+#ifndef _ASTERISK_H
 /* Must undefine s_addr because of pj_in_addr below */
 #undef s_addr
 
@@ -482,6 +483,11 @@
     pj_uint32_t	s_addr;		/**< The 32bit IP address.	    */
 } pj_in_addr;
 
+#else
+#include <sys/types.h>
+#include <netinet/in.h>
+typedef struct in_addr pj_in_addr;
+#endif
 
 /**
  * Maximum length of text representation of an IPv4 address.
@@ -675,7 +681,7 @@
  *
  * @return	nonzero if the address is valid, zero if not.
  */
-PJ_DECL(int) pj_inet_aton(const pj_str_t *cp, struct pj_in_addr *inp);
+PJ_DECL(int) pj_inet_aton(const pj_str_t *cp, pj_in_addr *inp);
 
 /**
  * This function converts an address in its standard text presentation form

Modified: branches/11/res/pjproject/pjlib/src/pj/sock_bsd.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/pjproject/pjlib/src/pj/sock_bsd.c?view=diff&rev=374642&r1=374641&r2=374642
==============================================================================
--- branches/11/res/pjproject/pjlib/src/pj/sock_bsd.c (original)
+++ branches/11/res/pjproject/pjlib/src/pj/sock_bsd.c Sun Oct  7 19:41:01 2012
@@ -232,7 +232,7 @@
  * numbers-and-dots notation into binary data and stores it in the structure
  * that inp points to. 
  */
-PJ_DEF(int) pj_inet_aton(const pj_str_t *cp, struct pj_in_addr *inp)
+PJ_DEF(int) pj_inet_aton(const pj_str_t *cp, pj_in_addr *inp)
 {
     char tempaddr[PJ_INET_ADDRSTRLEN];
 

Modified: branches/11/res/pjproject/pjlib/src/pj/sock_linux_kernel.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/pjproject/pjlib/src/pj/sock_linux_kernel.c?view=diff&rev=374642&r1=374641&r2=374642
==============================================================================
--- branches/11/res/pjproject/pjlib/src/pj/sock_linux_kernel.c (original)
+++ branches/11/res/pjproject/pjlib/src/pj/sock_linux_kernel.c Sun Oct  7 19:41:01 2012
@@ -147,7 +147,7 @@
  * numbers-and-dots notation into binary data and stores it in the structure
  * that inp points to. 
  */
-PJ_DEF(int) pj_inet_aton(const pj_str_t *ccp, struct pj_in_addr *addr)
+PJ_DEF(int) pj_inet_aton(const pj_str_t *ccp, pj_in_addr *addr)
 {
     pj_uint32_t val;
     int base, n;

Modified: branches/11/res/pjproject/pjlib/src/pj/sock_symbian.cpp
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/pjproject/pjlib/src/pj/sock_symbian.cpp?view=diff&rev=374642&r1=374641&r2=374642
==============================================================================
--- branches/11/res/pjproject/pjlib/src/pj/sock_symbian.cpp (original)
+++ branches/11/res/pjproject/pjlib/src/pj/sock_symbian.cpp Sun Oct  7 19:41:01 2012
@@ -299,7 +299,7 @@
  * numbers-and-dots notation into binary data and stores it in the structure
  * that inp points to. 
  */
-PJ_DEF(int) pj_inet_aton(const pj_str_t *cp, struct pj_in_addr *inp)
+PJ_DEF(int) pj_inet_aton(const pj_str_t *cp, pj_in_addr *inp)
 {
     enum { MAXIPLEN = PJ_INET_ADDRSTRLEN };
 




More information about the asterisk-commits mailing list