diff options
author | Liong Sauw Ming <ming@teluu.com> | 2011-10-24 09:28:13 +0000 |
---|---|---|
committer | Liong Sauw Ming <ming@teluu.com> | 2011-10-24 09:28:13 +0000 |
commit | 2068f13bc42cf3a47374aa2765f82724a5782028 (patch) | |
tree | 29fbeaa152ab51e59b650c0d7cd83a38111e1ecc /pjlib/src | |
parent | 1c72a42676e7aa0c2ae0734549050f738f3bdf02 (diff) |
Re #1395: Backport of PJSIP 1.x branch into PJSIP 2.0 trunk
* Backport of r3557:r3832
TODO: ticket #1268 (Option for automatic/manual sending of RTCP SDES/BYE for the stream) for video stream.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3841 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src')
-rw-r--r-- | pjlib/src/pj/ioqueue_symbian.cpp | 3 | ||||
-rw-r--r-- | pjlib/src/pj/sock_common.c | 7 | ||||
-rw-r--r-- | pjlib/src/pj/ssl_sock_ossl.c | 4 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/os.c | 72 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/sock.c | 2 |
5 files changed, 85 insertions, 3 deletions
diff --git a/pjlib/src/pj/ioqueue_symbian.cpp b/pjlib/src/pj/ioqueue_symbian.cpp index 2cd9ac96..f945b2b9 100644 --- a/pjlib/src/pj/ioqueue_symbian.cpp +++ b/pjlib/src/pj/ioqueue_symbian.cpp @@ -340,6 +340,7 @@ CPjSocket *CIoqueueCallback::HandleAcceptCompletion() // void CIoqueueCallback::RunL() { + pj_ioqueue_t *ioq = ioqueue_; Type cur_type = type_; type_ = TYPE_NONE; @@ -399,7 +400,7 @@ void CIoqueueCallback::RunL() } } - ioqueue_->eventCount++; + ioq->eventCount++; } // diff --git a/pjlib/src/pj/sock_common.c b/pjlib/src/pj/sock_common.c index 170fe5c7..948d47da 100644 --- a/pjlib/src/pj/sock_common.c +++ b/pjlib/src/pj/sock_common.c @@ -784,6 +784,8 @@ PJ_DEF(pj_status_t) pj_gethostip(int af, pj_sockaddr *addr) addr->addr.sa_family = (pj_uint16_t)af; PJ_SOCKADDR_RESET_LEN(addr); +#if !defined(PJ_GETHOSTIP_DISABLE_LOCAL_RESOLUTION) || \ + PJ_GETHOSTIP_DISABLE_LOCAL_RESOLUTION == 0 /* Get hostname's IP address */ count = 1; status = pj_getaddrinfo(af, pj_gethostname(), &count, &ai); @@ -797,7 +799,10 @@ PJ_DEF(pj_status_t) pj_gethostip(int af, pj_sockaddr *addr) TRACE_((THIS_FILE, "hostname IP is %s", pj_sockaddr_print(&ai.ai_addr, strip, sizeof(strip), 0))); } - +#else + PJ_UNUSED_ARG(ai); + PJ_UNUSED_ARG(count); +#endif /* Get default interface (interface for default route) */ if (cand_cnt < PJ_ARRAY_SIZE(cand_addr)) { diff --git a/pjlib/src/pj/ssl_sock_ossl.c b/pjlib/src/pj/ssl_sock_ossl.c index 56a6023b..6ce44ad1 100644 --- a/pjlib/src/pj/ssl_sock_ossl.c +++ b/pjlib/src/pj/ssl_sock_ossl.c @@ -310,8 +310,10 @@ static pj_status_t init_openssl(void) meth = (SSL_METHOD*)TLSv1_server_method(); if (!meth) meth = (SSL_METHOD*)SSLv3_server_method(); +#ifndef OPENSSL_NO_SSL2 if (!meth) meth = (SSL_METHOD*)SSLv2_server_method(); +#endif pj_assert(meth); ctx=SSL_CTX_new(meth); @@ -488,9 +490,11 @@ static pj_status_t create_ssl(pj_ssl_sock_t *ssock) case PJ_SSL_SOCK_PROTO_TLS1: ssl_method = (SSL_METHOD*)TLSv1_method(); break; +#ifndef OPENSSL_NO_SSL2 case PJ_SSL_SOCK_PROTO_SSL2: ssl_method = (SSL_METHOD*)SSLv2_method(); break; +#endif case PJ_SSL_SOCK_PROTO_SSL3: ssl_method = (SSL_METHOD*)SSLv3_method(); break; diff --git a/pjlib/src/pjlib-test/os.c b/pjlib/src/pjlib-test/os.c index ad630245..d5b1879c 100644 --- a/pjlib/src/pjlib-test/os.c +++ b/pjlib/src/pjlib-test/os.c @@ -22,11 +22,81 @@ #include <pj/os.h> #if INCLUDE_OS_TEST +static int endianness_test32(void) +{ + union t + { + pj_uint32_t u32; + pj_uint16_t u16[2]; + pj_uint8_t u8[4]; + } t; + + PJ_LOG(3,("", " Testing endianness..")); + + t.u32 = 0x11223344; + +#if defined(PJ_IS_LITTLE_ENDIAN) && PJ_IS_LITTLE_ENDIAN + PJ_LOG(3,("", " Library is set to little endian")); + +# if defined(PJ_IS_BIG_ENDIAN) && PJ_IS_BIG_ENDIAN +# error Error: Both PJ_IS_LITTLE_ENDIAN and PJ_IS_BIG_ENDIAN are set! +# endif + + if ((t.u16[0] & 0xFFFF) != 0x3344 || + (t.u16[1] & 0xFFFF) != 0x1122) + { + PJ_LOG(3,("", " Error: wrong 16bit values 0x%x and 0x%x", + (t.u16[0] & 0xFFFF), (t.u16[1] & 0xFFFF))); + return 10; + } + + if ((t.u8[0] & 0xFF) != 0x44 || + (t.u8[1] & 0xFF) != 0x33 || + (t.u8[2] & 0xFF) != 0x22 || + (t.u8[3] & 0xFF) != 0x11) + { + PJ_LOG(3,("", " Error: wrong 8bit values")); + return 12; + } + +#elif defined(PJ_IS_BIG_ENDIAN) && PJ_IS_BIG_ENDIAN + PJ_LOG(3,("", " Library is set to big endian")); + + if ((t.u16[0] & 0xFFFF) != 0x1122 || + (t.u16[1] & 0xFFFF) != 0x3344) + { + PJ_LOG(3,("", " Error: wrong 16bit values 0x%x and 0x%x", + (t.u16[0] & 0xFFFF), (t.u16[1] & 0xFFFF))); + return 20; + } + + if ((t.u8[0] & 0xFF) != 0x11 || + (t.u8[1] & 0xFF) != 0x22 || + (t.u8[2] & 0xFF) != 0x33 || + (t.u8[3] & 0xFF) != 0x44) + { + PJ_LOG(3,("", " Error: wrong 8bit values")); + return 22; + } + +# if defined(PJ_IS_LITTLE_ENDIAN) && PJ_IS_LITTLE_ENDIAN +# error Error: Both PJ_IS_LITTLE_ENDIAN and PJ_IS_BIG_ENDIAN are set! +# endif + + +#else +# error Error: Endianness is not set properly! +#endif + + return 0; +} + int os_test(void) { const pj_sys_info *si; int rc = 0; + PJ_LOG(3,("", " Sys info:")); si = pj_get_sys_info(); PJ_LOG(3,("", " machine: %s", si->machine.ptr)); PJ_LOG(3,("", " os_name: %s", si->os_name.ptr)); @@ -35,6 +105,8 @@ int os_test(void) PJ_LOG(3,("", " sdk_ver: 0x%x", si->sdk_ver)); PJ_LOG(3,("", " info: %s", si->info.ptr)); + rc = endianness_test32(); + return rc; } diff --git a/pjlib/src/pjlib-test/sock.c b/pjlib/src/pjlib-test/sock.c index ebb58379..35669dc0 100644 --- a/pjlib/src/pjlib-test/sock.c +++ b/pjlib/src/pjlib-test/sock.c @@ -510,7 +510,7 @@ static int send_recv_test(int sock_type, } if (srclen != addrlen) return -151; - if (pj_memcmp(&addr, srcaddr, srclen) != 0) { + if (pj_sockaddr_cmp(&addr, srcaddr) != 0) { char srcaddr_str[32], addr_str[32]; strcpy(srcaddr_str, pj_inet_ntoa(srcaddr->sin_addr)); strcpy(addr_str, pj_inet_ntoa(addr.sin_addr)); |