- Timestamp:
- Nov 21, 2005 1:55:47 AM (19 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 283 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/build/cc-gcc.mak
- Property svn:eol-style set to native
-
pjproject/trunk/build/cc-vc.mak
- Property svn:eol-style set to native
-
pjproject/trunk/build/common.mak
- Property svn:eol-style set to native
-
pjproject/trunk/build/host-mingw.mak
- Property svn:eol-style set to native
-
pjproject/trunk/build/host-unix.mak
- Property svn:eol-style set to native
-
pjproject/trunk/build/host-win32.mak
- Property svn:eol-style set to native
-
pjproject/trunk/build/m-alpha.mak
- Property svn:eol-style set to native
-
pjproject/trunk/build/m-i386.mak
- Property svn:eol-style set to native
-
pjproject/trunk/build/m-m68k.mak
- Property svn:eol-style set to native
-
pjproject/trunk/build/m-sparc.mak
- Property svn:eol-style set to native
-
pjproject/trunk/build/os-linux-kernel.mak
- Property svn:eol-style set to native
-
pjproject/trunk/build/os-linux.mak
- Property svn:eol-style set to native
-
pjproject/trunk/build/os-palmos.mak
- Property svn:eol-style set to native
-
pjproject/trunk/build/os-sunos.mak
- Property svn:eol-style set to native
-
pjproject/trunk/build/os-win32.mak
- Property svn:eol-style set to native
-
pjproject/trunk/build/pjproject.dsw
- Property svn:eol-style set to CRLF
-
pjproject/trunk/build/pjproject.sln
- Property svn:eol-style set to CRLF
-
pjproject/trunk/build/rules.mak
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib-util/build/Makefile
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib-util/build/pjlib_util.dsp
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjlib-util/build/pjlib_util.dsw
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjlib-util/build/pjlib_util_test.dsp
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjlib-util/include/pjlib-util/md5.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib-util/include/pjlib-util/scanner.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib-util/include/pjlib-util/string.h
- Property svn:eol-style set to native
r63 r65 1 /* $Id :$ */1 /* $Id$ */ 2 2 /* 3 3 * Copyright (C)2003-2006 Benny Prijono <benny@prijono.org> … … 31 31 32 32 /** 33 * Unescape string. 33 * Unescape string. If source string does not contain any escaped 34 * characters, the function would simply return the original string. 35 * Otherwise a new string will be allocated. 34 36 * 35 * @param str The string to unescape. 37 * @param pool Pool to allocate the string. 38 * @param src Source string to unescape. 39 * 40 * @return String with no escaped characters. 36 41 */ 37 PJ_DECL( void) pj_str_unescape(pj_str_t *str);42 PJ_DECL(pj_str_t) pj_str_unescape( pj_pool_t *pool, const pj_str_t *src); 38 43 39 44 /** -
pjproject/trunk/pjlib-util/include/pjlib-util/stun.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib-util/include/pjlib-util/xml.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib-util/src/pjlib-util-test/main.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib-util/src/pjlib-util-test/test.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib-util/src/pjlib-util-test/test.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib-util/src/pjlib-util-test/xml.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib-util/src/pjlib-util/md5.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib-util/src/pjlib-util/scanner.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib-util/src/pjlib-util/string.c
- Property svn:eol-style set to native
r63 r65 1 /* $Id :$ */1 /* $Id$ */ 2 2 /* 3 3 * Copyright (C)2003-2006 Benny Prijono <benny@prijono.org> … … 19 19 #include <pjlib-util/string.h> 20 20 #include <pj/ctype.h> 21 #include <pj/string.h> 22 #include <pj/pool.h> 21 23 22 PJ_DEF( void) pj_str_unescape(pj_str_t *str)24 PJ_DEF(pj_str_t) pj_str_unescape( pj_pool_t *pool, const pj_str_t *src_str) 23 25 { 24 char *src = str->ptr; 25 char *dst = str->ptr; 26 char *end = src + str->slen; 26 char *src = src_str->ptr; 27 char *end = src + src_str->slen; 28 pj_str_t dst_str; 29 char *dst; 27 30 31 if (pj_strchr(src_str, '%')==NULL) 32 return *src_str; 33 34 dst = dst_str.ptr = pj_pool_alloc(pool, src_str->slen); 35 28 36 while (src != end) { 29 37 if (*src == '%' && src < end-2) { … … 33 41 src += 3; 34 42 } else { 35 ++src; 36 ++dst; 43 *dst++ = *src++; 37 44 } 38 45 } 39 str->slen = dst - str->ptr; 46 dst_str.slen = dst - dst_str.ptr; 47 return dst_str; 40 48 } 41 49 -
pjproject/trunk/pjlib-util/src/pjlib-util/stun.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib-util/src/pjlib-util/stun_client.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib-util/src/pjlib-util/symbols.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib-util/src/pjlib-util/xml.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/build/Makefile
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/build/os-linux-kernel.mak
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/build/os-linux.mak
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/build/os-sunos.mak
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/build/os-win32.mak
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/build/pjlib++-test.dsp
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjlib/build/pjlib++.dsp
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjlib/build/pjlib++.vcproj
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjlib/build/pjlib.dsp
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjlib/build/pjlib.dsw
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjlib/build/pjlib.sln
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjlib/build/pjlib.vcproj
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjlib/build/pjlib_samples.dsp
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjlib/build/pjlib_samples.vcproj
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjlib/build/pjlib_test.dsp
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjlib/build/pjlib_test.vcproj
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjlib/include/pj++/file.hpp
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj++/hash.hpp
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj++/list.hpp
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj++/lock.hpp
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj++/os.hpp
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj++/pool.hpp
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj++/proactor.hpp
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj++/scanner.hpp
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj++/sock.hpp
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj++/string.hpp
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj++/timer.hpp
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj++/tree.hpp
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj++/types.hpp
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/addr_resolv.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/array.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/assert.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/assert.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/cc_gcc.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/cc_msvc.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/ctype.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/errno.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/high_precision.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/m_alpha.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/m_i386.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/m_m68k.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/m_sparc.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/malloc.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/os_linux.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/os_linux_kernel.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/os_palmos.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/os_sunos.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/os_win32.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/rand.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/setjmp.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/size_t.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/socket.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/sprintf.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/stdarg.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/stdfileio.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/string.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/time.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/compat/vsprintf.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/include/pj/os.h
r51 r65 867 867 868 868 /** 869 * Add timestamp t2 to t1. 870 * @param t1 t1. 871 * @param t2 t2. 872 */ 873 PJ_INLINE(void) pj_add_timestamp(pj_timestamp *t1, const pj_timestamp *t2) 874 { 875 #if PJ_HAS_INT64 876 t1->u64 += t2->u64; 877 #else 878 pj_uint32_t old = t1->u32.lo; 879 t1->u32.hi += t2->u32.hi; 880 t1->u32.lo += t2->u32.lo; 881 if (t1->u32.lo < old) 882 ++t1->u32.hi; 883 #endif 884 } 885 886 /** 887 * Substract timestamp t2 from t1. 888 * @param t1 t1. 889 * @param t2 t2. 890 */ 891 PJ_INLINE(void) pj_sub_timestamp(pj_timestamp *t1, const pj_timestamp *t2) 892 { 893 #if PJ_HAS_INT64 894 t1->u64 -= t2->u64; 895 #else 896 t1->u32.hi -= t2->u32.hi; 897 if (t1->u32.lo >= t2->u32.lo) 898 t1->u32.lo -= t2->u32.lo; 899 else { 900 t1->u32.lo -= t2->u32.lo; 901 --t1->u32.hi; 902 } 903 #endif 904 } 905 906 /** 869 907 * Calculate the elapsed time, and store it in pj_time_val. 870 908 * This function calculates the elapsed time using highest precision -
pjproject/trunk/pjlib/include/pj/string.h
r62 r65 399 399 * @return the pointer to first character found, or NULL. 400 400 */ 401 PJ_INLINE(char*) pj_strchr( pj_str_t *str, int chr)401 PJ_INLINE(char*) pj_strchr( const pj_str_t *str, int chr) 402 402 { 403 403 return (char*) memchr(str->ptr, chr, str->slen); -
pjproject/trunk/pjlib/src/pj/addr_resolv_linux_kernel.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pj/addr_resolv_sock.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pj/array.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pj/compat/longjmp_i386.S
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pj/compat/setjmp_i386.S
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pj/compat/sigjmp.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pj/compat/string.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib++-test/main.cpp
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-samples/except.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-samples/list.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-samples/log.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/atomic.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/echo_clt.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/errno.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/exception.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/fifobuf.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/file.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/ioq_perf.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/ioq_tcp.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/ioq_udp.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/list.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/main.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/main_mod.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/mutex.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/os.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/pool.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/pool_perf.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/rand.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/rbtree.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/select.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/sleep.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/sock.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/sock_perf.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/string.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/test.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/test.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/thread.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/timer.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/timestamp.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/udp_echo_srv_ioqueue.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/udp_echo_srv_sync.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjlib/src/pjlib-test/util.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/build/Jbtest.dat
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/build/Makefile
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/build/make-linux-i386.inc
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/build/make-mingw.inc
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/build/make-rules
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/build/pjmedia.dsp
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjmedia/build/pjmedia.dsw
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjmedia/build/pjmedia.sln
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjmedia/build/pjmedia.vcproj
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjmedia/build/pjmedia_audio_tool.dsp
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjmedia/build/pjmedia_audio_tool.vcproj
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjmedia/build/pjmedia_test.dsp
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjmedia/build/pjmedia_test.vcproj
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjmedia/src/pjmedia/codec.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/codec.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/config.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/dsound.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/g711.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/jbuf.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/jbuf.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/mediamgr.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/mediamgr.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/nullsound.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/pasound.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/LICENSE.txt
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/README.txt
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/V19-devel-readme.txt
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/dsound_wrapper.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/dsound_wrapper.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_allocation.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_allocation.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_converters.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_converters.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_cpuload.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_cpuload.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_dither.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_dither.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_endianness.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_front.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_hostapi.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_linux_alsa.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_linux_alsa.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_process.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_process.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_skeleton.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_stream.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_stream.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_trace.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_trace.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_types.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_unix_hostapis.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_unix_oss.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_unix_util.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_unix_util.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_util.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_win_ds.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_win_hostapis.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_win_util.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_win_wmme.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_win_wmme.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_x86_plain_converters.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/pa_x86_plain_converters.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/pjmedia/portaudio/portaudio.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/test/audio_tool.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/test/jbuf_test.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/test/main.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/test/rtp_test.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/test/sdptest.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjmedia/src/test/session_test.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/build/Makefile
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/build/make-linux-i386.inc
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/build/make-mingw.inc
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/build/make-optimize.inc
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/build/make-rules
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/build/pjsip.dsw
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjsip/build/pjsip.sln
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjsip/build/pjsip_auth_lib.dsp
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjsip/build/pjsip_core.dsp
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjsip/build/pjsip_simple.dsp
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjsip/build/pjsip_ua.dsp
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjsip/build/pjsua.dsp
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjsip/build/test_pjsip.dsp
- Property svn:eol-style set to CRLF
-
pjproject/trunk/pjsip/include/pjsip-simple/event_notify.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip-simple/event_notify_msg.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip-simple/messaging.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip-simple/pidf.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip-simple/presence.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip-simple/xpidf.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip-ua/sip_dialog.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip-ua/sip_regc.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip-ua/sip_ua.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip/print_util.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip/sip_auth.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip/sip_auth_msg.h
- Property svn:eol-style set to native
r60 r65 37 37 { 38 38 pj_str_t realm; 39 pjsip_param other_param; 39 40 }; 40 41 … … 49 50 { 50 51 pj_str_t realm; 52 pjsip_param other_param; 51 53 pj_str_t username; 52 54 pj_str_t nonce; … … 58 60 pj_str_t qop; 59 61 pj_str_t nc; 60 pj_str_t other_param;61 62 }; 62 63 … … 70 71 { 71 72 pj_str_t realm; 73 pjsip_param other_param; 72 74 pj_str_t version; 73 75 pj_str_t signature; … … 130 132 { 131 133 pj_str_t realm; 134 pjsip_param other_param; 132 135 }; 133 136 … … 141 144 { 142 145 pj_str_t realm; 146 pjsip_param other_param; 143 147 pj_str_t domain; 144 148 pj_str_t nonce; … … 147 151 pj_str_t algorithm; 148 152 pj_str_t qop; 149 pj_str_t other_param;150 153 }; 151 154 … … 159 162 { 160 163 pj_str_t realm; 164 pjsip_param other_param; 161 165 pj_str_t version; 162 166 pj_str_t micalgorithm; -
pjproject/trunk/pjsip/include/pjsip/sip_auth_parser.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip/sip_config.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip/sip_endpoint.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip/sip_errno.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip/sip_event.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip/sip_module.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip/sip_msg.h
- Property svn:eol-style set to native
r60 r65 995 995 PJSIP_DECL_HDR_MEMBER(struct pjsip_contact_hdr); 996 996 int star; /**< The contact contains only a '*' character */ 997 pjsip_uri *uri; /**< URI in the contact. */997 pjsip_uri *uri; /**< URI in the contact. */ 998 998 int q1000; /**< The "q" value times 1000 (to avoid float) */ 999 999 pj_int32_t expires; /**< Expires parameter, otherwise -1 if not present. */ 1000 pj _str_tother_param; /**< Other parameters, concatenated in a single string. */1000 pjsip_param other_param; /**< Other parameters, concatenated in a single string. */ 1001 1001 } pjsip_contact_hdr; 1002 1002 … … 1078 1078 { 1079 1079 PJSIP_DECL_HDR_MEMBER(struct pjsip_fromto_hdr); 1080 pjsip_uri *uri; /**< URI in From/To header. */1080 pjsip_uri *uri; /**< URI in From/To header. */ 1081 1081 pj_str_t tag; /**< Header "tag" parameter. */ 1082 pj _str_tother_param; /**< Other params, concatenated as a single string. */1082 pjsip_param other_param; /**< Other params, concatenated as a single string. */ 1083 1083 } pjsip_fromto_hdr; 1084 1084 … … 1188 1188 PJSIP_DECL_HDR_MEMBER(struct pjsip_routing_hdr); /**< Generic header fields. */ 1189 1189 pjsip_name_addr name_addr; /**< The URL in the Route/Record-Route header. */ 1190 pj _str_tother_param; /** Other parameter. */1190 pjsip_param other_param; /** Other parameter. */ 1191 1191 } pjsip_routing_hdr; 1192 1192 … … 1352 1352 pj_str_t recvd_param; /**< "received" parameter. */ 1353 1353 pj_str_t branch_param; /**< "branch" parameter. */ 1354 pj _str_tother_param; /**< Other parameters, concatenated as single string. */1354 pjsip_param other_param; /**< Other parameters, concatenated as single string. */ 1355 1355 pj_str_t comment; /**< Comment. */ 1356 1356 } pjsip_via_hdr; -
pjproject/trunk/pjsip/include/pjsip/sip_msg_i.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip/sip_parser.h
- Property svn:eol-style set to native
r64 r65 337 337 }; 338 338 339 void pjsip_parse_param_imp( pj_scanner *scanner, 339 void pjsip_parse_param_imp( pj_scanner *scanner, pj_pool_t *pool, 340 340 pj_str_t *pname, pj_str_t *pvalue, 341 341 unsigned opt); -
pjproject/trunk/pjsip/include/pjsip/sip_private.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip/sip_resolve.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip/sip_transaction.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip/sip_transport.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip/sip_transport_udp.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip/sip_types.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/include/pjsip/sip_uri.h
- Property svn:eol-style set to native
r64 r65 85 85 PJ_DECL(void) pjsip_param_clone(pj_pool_t *pool, pjsip_param *dst_list, 86 86 const pjsip_param *src_list); 87 88 /** 89 * Duplicate the parameters. 90 * 91 * @param pool Pool to allocate memory from. 92 * @param dst_list Destination list. 93 * @param src_list Source list. 94 */ 95 PJ_DECL(void) pjsip_param_shallow_clone(pj_pool_t *pool, 96 pjsip_param *dst_list, 97 const pjsip_param *src_list); 98 99 /** 100 * Print parameters. 101 * 102 * @param param_list The parameter list. 103 * @param buf Buffer. 104 * @param size Size of buffer. 105 * @param sep Separator character (either ';' or ','). 106 * 107 * @return The number of bytes printed, or -1 on errr. 108 */ 109 PJ_DECL(pj_ssize_t) pjsip_param_print_on(const pjsip_param *param_list, 110 char *buf, pj_size_t size, 111 int sep); 87 112 88 113 /** -
pjproject/trunk/pjsip/include/pjsip/sip_util.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip-simple/event_notify.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip-simple/event_notify_msg.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip-simple/messaging.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip-simple/pidf.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip-simple/presence.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip-simple/xpidf.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip-ua/sip_dialog.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip-ua/sip_ua.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip-ua/sip_ua_private.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip/sip_auth.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip/sip_auth_msg.c
- Property svn:eol-style set to native
r51 r65 48 48 pjsip_authorization_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); 49 49 init_hdr(hdr, PJSIP_H_AUTHORIZATION, &authorization_hdr_vptr); 50 pj_list_init(&hdr->credential.common.other_param); 50 51 return hdr; 51 52 } … … 55 56 pjsip_proxy_authorization_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); 56 57 init_hdr(hdr, PJSIP_H_PROXY_AUTHORIZATION, &authorization_hdr_vptr); 58 pj_list_init(&hdr->credential.common.other_param); 57 59 return hdr; 58 60 } … … 77 79 copy_advance_pair(buf, ", qop=", 6, cred->qop); 78 80 copy_advance_pair(buf, ", nc=", 5, cred->nc); 79 copy_advance(buf, cred->other_param); 81 82 printed = pjsip_param_print_on(&cred->other_param, buf, endbuf-buf, ','); 83 if (printed < 0) 84 return -1; 85 buf += printed; 80 86 81 87 return (int) (buf-startbuf); … … 148 154 pj_strdup(pool, &hdr->credential.digest.qop, &rhs->credential.digest.qop); 149 155 pj_strdup(pool, &hdr->credential.digest.nc, &rhs->credential.digest.nc); 150 pj _strdup(pool, &hdr->credential.digest.other_param, &rhs->credential.digest.other_param);156 pjsip_param_clone(pool, &hdr->credential.digest.other_param, &rhs->credential.digest.other_param); 151 157 } else if (pj_stricmp2(&hdr->scheme, "pgp") == 0) { 152 158 pj_assert(0); … … 166 172 pjsip_authorization_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 167 173 pj_memcpy(hdr, rhs, sizeof(*hdr)); 174 pjsip_param_shallow_clone(pool, &hdr->credential.common.other_param, 175 &rhs->credential.common.other_param); 168 176 return hdr; 169 177 } … … 193 201 pjsip_www_authenticate_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); 194 202 init_hdr(hdr, PJSIP_H_WWW_AUTHENTICATE, &www_authenticate_hdr_vptr); 203 pj_list_init(&hdr->challenge.common.other_param); 195 204 return hdr; 196 205 } … … 201 210 pjsip_proxy_authenticate_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); 202 211 init_hdr(hdr, PJSIP_H_PROXY_AUTHENTICATE, &www_authenticate_hdr_vptr); 212 pj_list_init(&hdr->challenge.common.other_param); 203 213 return hdr; 204 214 } … … 221 231 copy_advance_pair(buf, ",algorithm=", 11, chal->algorithm); 222 232 copy_advance_pair_quote_cond(buf, ",qop=", 5, chal->qop, '"', '"'); 223 copy_advance(buf, chal->other_param); 233 234 printed = pjsip_param_print_on(&chal->other_param, buf, endbuf-buf, ','); 235 if (printed < 0) 236 return -1; 237 buf += printed; 224 238 225 239 return (int)(buf-startbuf); … … 286 300 pj_strdup(pool, &hdr->challenge.digest.algorithm, &rhs->challenge.digest.algorithm); 287 301 pj_strdup(pool, &hdr->challenge.digest.qop, &rhs->challenge.digest.qop); 288 pj_strdup(pool, &hdr->challenge.digest.other_param, &rhs->challenge.digest.other_param); 302 pjsip_param_clone(pool, &hdr->challenge.digest.other_param, 303 &rhs->challenge.digest.other_param); 289 304 } else if (pj_stricmp2(&hdr->scheme, "pgp") == 0) { 290 305 pj_assert(0); … … 305 320 pjsip_www_authenticate_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 306 321 pj_memcpy(hdr, rhs, sizeof(*hdr)); 307 return hdr; 308 } 309 310 322 pjsip_param_shallow_clone(pool, &hdr->challenge.common.other_param, 323 &rhs->challenge.common.other_param); 324 return hdr; 325 } 326 327 -
pjproject/trunk/pjsip/src/pjsip/sip_auth_parser.c
- Property svn:eol-style set to native
r51 r65 23 23 #include <pj/string.h> 24 24 #include <pj/except.h> 25 #include <pj/pool.h> 25 26 26 27 static pjsip_hdr* parse_hdr_authorization ( pjsip_parse_ctx *ctx ); … … 67 68 pjsip_digest_credential *cred) 68 69 { 70 pj_list_init(&cred->other_param); 71 69 72 for (;;) { 70 73 pj_str_t name, value; 71 74 72 pjsip_parse_param_imp(scanner, &name, &value,PJSIP_PARSE_REMOVE_QUOTE); 75 pjsip_parse_param_imp(scanner, pool, &name, &value, 76 PJSIP_PARSE_REMOVE_QUOTE); 73 77 74 78 if (!pj_stricmp(&name, &pjsip_USERNAME_STR)) { … … 103 107 104 108 } else { 105 pjsip_concat_param_imp(&cred->other_param,pool,&name,&value, ','); 109 pjsip_param *p = pj_pool_alloc(pool, sizeof(pjsip_param)); 110 p->name = name; 111 p->value = value; 112 pj_list_insert_before(&cred->other_param, p); 106 113 } 107 114 … … 127 134 pjsip_digest_challenge *chal) 128 135 { 136 pj_list_init(&chal->other_param); 137 129 138 for (;;) { 130 139 pj_str_t name, value; 131 140 132 pjsip_parse_param_imp(scanner, &name, &value,PJSIP_PARSE_REMOVE_QUOTE); 141 pjsip_parse_param_imp(scanner, pool, &name, &value, 142 PJSIP_PARSE_REMOVE_QUOTE); 133 143 134 144 if (!pj_stricmp(&name, &pjsip_REALM_STR)) { … … 159 169 160 170 } else { 161 pjsip_concat_param_imp(&chal->other_param, pool, 162 &name, &value, ','); 171 pjsip_param *p = pj_pool_alloc(pool, sizeof(pjsip_param)); 172 p->name = name; 173 p->value = value; 174 pj_list_insert_before(&chal->other_param, p); 163 175 } 164 176 -
pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip/sip_errno.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip/sip_msg.c
- Property svn:eol-style set to native
r51 r65 869 869 init_hdr(hdr, PJSIP_H_CONTACT, &contact_hdr_vptr); 870 870 hdr->expires = -1; 871 pj_list_init(&hdr->other_param); 871 872 return hdr; 872 873 } … … 884 885 *p++ = ' '; 885 886 *p++ = '*'; 886 *p = '\0';887 887 return p - buf; 888 888 … … 928 928 } 929 929 930 if (hdr->other_param.slen) {931 copy_advance(buf, hdr->other_param);932 }933 934 *buf = '\0'; 930 printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf,';'); 931 if (printed < 0) 932 return printed; 933 buf += printed; 934 935 935 return buf-startbuf; 936 936 } 937 937 } 938 938 939 static pjsip_contact_hdr* pjsip_contact_hdr_clone( 940 939 static pjsip_contact_hdr* pjsip_contact_hdr_clone(pj_pool_t *pool, 940 const pjsip_contact_hdr *rhs) 941 941 { 942 942 pjsip_contact_hdr *hdr = pjsip_contact_hdr_create(pool); … … 949 949 hdr->q1000 = rhs->q1000; 950 950 hdr->expires = rhs->expires; 951 pj_strdup(pool, &hdr->other_param, &rhs->other_param); 952 return hdr; 953 } 954 955 static pjsip_contact_hdr* pjsip_contact_hdr_shallow_clone( pj_pool_t *pool, 956 const pjsip_contact_hdr *rhs) 951 pjsip_param_clone(pool, &hdr->other_param, &rhs->other_param); 952 return hdr; 953 } 954 955 static pjsip_contact_hdr* 956 pjsip_contact_hdr_shallow_clone( pj_pool_t *pool, 957 const pjsip_contact_hdr *rhs) 957 958 { 958 959 pjsip_contact_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 959 960 pj_memcpy(hdr, rhs, sizeof(*hdr)); 961 pjsip_param_shallow_clone(pool, &hdr->other_param, &rhs->other_param); 960 962 return hdr; 961 963 } … … 965 967 * Content-Type header.. 966 968 */ 967 static int pjsip_ctype_hdr_print( pjsip_ctype_hdr *hdr, char *buf, pj_size_t size); 968 static pjsip_ctype_hdr* pjsip_ctype_hdr_clone( pj_pool_t *pool, const pjsip_ctype_hdr *hdr); 969 static int pjsip_ctype_hdr_print( pjsip_ctype_hdr *hdr, char *buf, 970 pj_size_t size); 971 static pjsip_ctype_hdr* pjsip_ctype_hdr_clone(pj_pool_t *pool, 972 const pjsip_ctype_hdr *hdr); 969 973 #define pjsip_ctype_hdr_shallow_clone pjsip_ctype_hdr_clone 970 974 … … 1071 1075 pjsip_from_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); 1072 1076 init_hdr(hdr, PJSIP_H_FROM, &fromto_hdr_vptr); 1077 pj_list_init(&hdr->other_param); 1073 1078 return hdr; 1074 1079 } … … 1078 1083 pjsip_to_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); 1079 1084 init_hdr(hdr, PJSIP_H_TO, &fromto_hdr_vptr); 1085 pj_list_init(&hdr->other_param); 1080 1086 return hdr; 1081 1087 } … … 1106 1112 *buf++ = ' '; 1107 1113 1108 printed = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, hdr->uri, buf, endbuf-buf); 1114 printed = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, hdr->uri, 1115 buf, endbuf-buf); 1109 1116 if (printed < 1) 1110 1117 return -1; … … 1113 1120 1114 1121 copy_advance_pair(buf, ";tag=", 5, hdr->tag); 1115 if (hdr->other_param.slen) 1116 copy_advance(buf, hdr->other_param); 1122 1123 printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf, ';'); 1124 if (printed < 0) 1125 return -1; 1126 buf += printed; 1117 1127 1118 1128 return buf-startbuf; … … 1129 1139 hdr->uri = pjsip_uri_clone(pool, rhs->uri); 1130 1140 pj_strdup( pool, &hdr->tag, &rhs->tag); 1131 pj_strdup( pool, &hdr->other_param, &rhs->other_param); 1132 1133 return hdr; 1134 } 1135 1136 static pjsip_fromto_hdr* pjsip_fromto_hdr_shallow_clone( pj_pool_t *pool, 1137 const pjsip_fromto_hdr *rhs) 1141 pjsip_param_clone( pool, &hdr->other_param, &rhs->other_param); 1142 1143 return hdr; 1144 } 1145 1146 static pjsip_fromto_hdr* 1147 pjsip_fromto_hdr_shallow_clone( pj_pool_t *pool, 1148 const pjsip_fromto_hdr *rhs) 1138 1149 { 1139 1150 pjsip_fromto_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 1140 1151 pj_memcpy(hdr, rhs, sizeof(*hdr)); 1152 pjsip_param_shallow_clone( pool, &hdr->other_param, &rhs->other_param); 1141 1153 return hdr; 1142 1154 } … … 1188 1200 init_hdr(hdr, PJSIP_H_RECORD_ROUTE, &routing_hdr_vptr); 1189 1201 pjsip_name_addr_init(&hdr->name_addr); 1190 pj_ memset(&hdr->other_param, 0, sizeof(hdr->other_param));1202 pj_list_init(&hdr->other_param); 1191 1203 return hdr; 1192 1204 } … … 1197 1209 init_hdr(hdr, PJSIP_H_ROUTE, &routing_hdr_vptr); 1198 1210 pjsip_name_addr_init(&hdr->name_addr); 1199 pj_ memset(&hdr->other_param, 0, sizeof(hdr->other_param));1211 pj_list_init(&hdr->other_param); 1200 1212 return hdr; 1201 1213 } … … 1226 1238 *buf++ = ' '; 1227 1239 1228 printed = pjsip_uri_print(PJSIP_URI_IN_ROUTING_HDR, &hdr->name_addr, buf, endbuf-buf); 1240 printed = pjsip_uri_print(PJSIP_URI_IN_ROUTING_HDR, &hdr->name_addr, buf, 1241 endbuf-buf); 1229 1242 if (printed < 1) 1230 1243 return -1; 1231 1244 buf += printed; 1232 1245 1233 if (hdr->other_param.slen) { 1234 copy_advance(buf, hdr->other_param); 1235 } 1246 printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf, ';'); 1247 if (printed < 0) 1248 return -1; 1249 buf += printed; 1236 1250 1237 1251 return buf-startbuf; … … 1246 1260 pjsip_name_addr_init(&hdr->name_addr); 1247 1261 pjsip_name_addr_assign(pool, &hdr->name_addr, &rhs->name_addr); 1248 pj _strdup( pool, &hdr->other_param, &rhs->other_param);1262 pjsip_param_clone( pool, &hdr->other_param, &rhs->other_param); 1249 1263 return hdr; 1250 1264 } … … 1255 1269 pjsip_routing_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 1256 1270 pj_memcpy(hdr, rhs, sizeof(*hdr)); 1271 pjsip_param_shallow_clone( pool, &hdr->other_param, &rhs->other_param); 1257 1272 return hdr; 1258 1273 } … … 1331 1346 hdr->ttl_param = -1; 1332 1347 hdr->rport_param = -1; 1348 pj_list_init(&hdr->other_param); 1333 1349 return hdr; 1334 1350 } … … 1390 1406 copy_advance_pair(buf, ";received=", 10, hdr->recvd_param); 1391 1407 copy_advance_pair(buf, ";branch=", 8, hdr->branch_param); 1392 copy_advance(buf, hdr->other_param);1393 1408 1394 *buf = '\0'; 1409 printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf, ';'); 1410 if (printed < 0) 1411 return -1; 1412 buf += printed; 1413 1395 1414 return buf-startbuf; 1396 1415 } … … 1408 1427 pj_strdup(pool, &hdr->recvd_param, &rhs->recvd_param); 1409 1428 pj_strdup(pool, &hdr->branch_param, &rhs->branch_param); 1410 pj _strdup(pool, &hdr->other_param, &rhs->other_param);1429 pjsip_param_clone(pool, &hdr->other_param, &rhs->other_param); 1411 1430 return hdr; 1412 1431 } … … 1417 1436 pjsip_via_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 1418 1437 pj_memcpy(hdr, rhs, sizeof(*hdr)); 1438 pjsip_param_shallow_clone(pool, &hdr->other_param, &rhs->other_param); 1419 1439 return hdr; 1420 1440 } -
pjproject/trunk/pjsip/src/pjsip/sip_parser.c
- Property svn:eol-style set to native
r64 r65 114 114 pjsip_parser_err_report *err_list); 115 115 static void int_parse_param( pj_scanner *scanner, 116 pj_pool_t *pool, 116 117 pj_str_t *pname, 117 118 pj_str_t *pvalue); 118 119 static void int_parse_hparam( pj_scanner *scanner, 120 pj_pool_t *pool, 119 121 pj_str_t *hname, 120 122 pj_str_t *hvalue ); … … 126 128 pjsip_status_line *line); 127 129 static void int_parse_user_pass( pj_scanner *scanner, 130 pj_pool_t *pool, 128 131 pj_str_t *user, 129 132 pj_str_t *pass); … … 287 290 status = pj_cis_dup(&pjsip_USER_SPEC, &pjsip_ALNUM_SPEC); 288 291 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 289 pj_cis_add_str( &pjsip_USER_SPEC, ESCAPED USER_UNRESERVED );292 pj_cis_add_str( &pjsip_USER_SPEC, UNRESERVED ESCAPED USER_UNRESERVED ); 290 293 291 294 status = pj_cis_dup(&pjsip_PASSWD_SPEC, &pjsip_ALNUM_SPEC); 292 295 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 293 pj_cis_add_str( &pjsip_PASSWD_SPEC, MARKESCAPED PASS);296 pj_cis_add_str( &pjsip_PASSWD_SPEC, UNRESERVED ESCAPED PASS); 294 297 295 298 status = pj_cis_init(&cis_buf, &pjsip_PROBE_USER_HOST_SPEC); … … 866 869 867 870 /* Parse parameter (pname ["=" pvalue]). */ 868 void pjsip_parse_param_imp( pj_scanner *scanner, 871 void pjsip_parse_param_imp( pj_scanner *scanner, pj_pool_t *pool, 869 872 pj_str_t *pname, pj_str_t *pvalue, 870 873 unsigned option) … … 872 875 /* pname */ 873 876 pj_scan_get(scanner, &pjsip_PARAM_CHAR_SPEC, pname); 874 pj_str_unescape(pname);877 *pname = pj_str_unescape(pool, pname); 875 878 876 879 /* pvalue, if any */ … … 886 889 } else { 887 890 pj_scan_get(scanner, &pjsip_PARAM_CHAR_SPEC, pvalue); 888 pj_str_unescape(pvalue);891 *pvalue = pj_str_unescape(pool, pvalue); 889 892 } 890 893 } else { … … 895 898 896 899 /* Parse parameter (";" pname ["=" pvalue]). */ 897 static void int_parse_param( pj_scanner *scanner, 900 static void int_parse_param( pj_scanner *scanner, pj_pool_t *pool, 898 901 pj_str_t *pname, pj_str_t *pvalue) 899 902 { … … 902 905 903 906 /* Get pname and optionally pvalue */ 904 pjsip_parse_param_imp(scanner, pname, pvalue, 0); 907 pjsip_parse_param_imp(scanner, pool, pname, pvalue, 908 PJSIP_PARSE_REMOVE_QUOTE); 905 909 } 906 910 907 911 /* Parse header parameter. */ 908 static void int_parse_hparam( pj_scanner *scanner, 912 static void int_parse_hparam( pj_scanner *scanner, pj_pool_t *pool, 909 913 pj_str_t *hname, pj_str_t *hvalue ) 910 914 { … … 914 918 /* hname */ 915 919 pj_scan_get(scanner, &pjsip_HDR_CHAR_SPEC, hname); 916 pj_str_unescape(hname);920 *hname = pj_str_unescape(pool, hname); 917 921 918 922 /* pvalue, if any */ … … 920 924 pj_scan_get_char(scanner); 921 925 pj_scan_get(scanner, &pjsip_HDR_CHAR_SPEC, hvalue); 922 pj_str_unescape(hvalue);926 *hvalue = pj_str_unescape(pool, hvalue); 923 927 } else { 924 928 hvalue->ptr = NULL; … … 937 941 pj_scan_get_char(scanner); 938 942 pj_scan_get(scanner, &pjsip_DIGIT_SPEC, &port); 939 pj_str_unescape(&port);940 943 *p_port = pj_strtoul(&port); 941 944 } else { … … 962 965 963 966 /* Parse user:pass tokens in an URI. */ 964 static void int_parse_user_pass( pj_scanner *scanner, 967 static void int_parse_user_pass( pj_scanner *scanner, pj_pool_t *pool, 965 968 pj_str_t *user, pj_str_t *pass) 966 969 { 967 970 pj_scan_get( scanner, &pjsip_USER_SPEC, user); 968 pj_str_unescape(user);971 *user = pj_str_unescape(pool, user); 969 972 970 973 if ( *scanner->curptr == ':') { 971 974 pj_scan_get_char( scanner ); 972 975 pj_scan_get( scanner, &pjsip_PASSWD_SPEC, pass); 973 pj_str_unescape(pass);976 *pass = pj_str_unescape(pool, pass); 974 977 } else { 975 978 pass->ptr = NULL; … … 1105 1108 1106 1109 if (int_is_next_user(scanner)) { 1107 int_parse_user_pass(scanner, &url->user, &url->passwd);1110 int_parse_user_pass(scanner, pool, &url->user, &url->passwd); 1108 1111 } 1109 1112 … … 1115 1118 pj_str_t pname, pvalue; 1116 1119 1117 int_parse_param( scanner, &pname, &pvalue);1120 int_parse_param( scanner, pool, &pname, &pvalue); 1118 1121 1119 1122 if (!parser_stricmp(pname, pjsip_USER_STR) && pvalue.slen) { … … 1147 1150 pjsip_param *param; 1148 1151 param = pj_pool_alloc(pool, sizeof(pjsip_param)); 1149 int_parse_hparam(scanner, ¶m->name, ¶m->value);1152 int_parse_hparam(scanner, pool, ¶m->name, ¶m->value); 1150 1153 pj_list_insert_before(&url->header_param, param); 1151 1154 hsep = '&'; … … 1168 1171 if (*scanner->curptr == '"') { 1169 1172 pj_scan_get_quote( scanner, '"', '"', &name_addr->display); 1173 /* Trim the leading and ending quote */ 1174 name_addr->display.ptr++; 1175 name_addr->display.slen -= 2; 1170 1176 1171 1177 } else if (*scanner->curptr != '<') { … … 1324 1330 pj_str_t pname, pvalue; 1325 1331 1326 int_parse_param( scanner, &pname, &pvalue);1332 int_parse_param( scanner, pool, &pname, &pvalue); 1327 1333 if (!parser_stricmp(pname, pjsip_Q_STR) && pvalue.slen) { 1328 1334 char *dot_pos = memchr(pvalue.ptr, '.', pvalue.slen); … … 1338 1344 1339 1345 } else { 1340 concat_param(&hdr->other_param, pool, &pname, &pvalue); 1346 pjsip_param *p = pj_pool_alloc(pool, sizeof(pjsip_param)); 1347 p->name = pname; 1348 p->value = pvalue; 1349 pj_list_insert_before(&hdr->other_param, p); 1341 1350 } 1342 1351 } … … 1413 1422 while (*scanner->curptr == ';') { 1414 1423 pj_str_t pname, pvalue; 1415 int_parse_param(scanner, &pname, &pvalue);1424 int_parse_param(scanner, ctx->pool, &pname, &pvalue); 1416 1425 concat_param(&hdr->media.param, ctx->pool, &pname, &pvalue); 1417 1426 } … … 1466 1475 pj_str_t pname, pvalue; 1467 1476 1468 int_parse_param( scanner, &pname, &pvalue);1477 int_parse_param( scanner, pool, &pname, &pvalue); 1469 1478 1470 1479 if (!parser_stricmp(pname, pjsip_TAG_STR)) { … … 1472 1481 1473 1482 } else { 1474 concat_param(&hdr->other_param, pool, &pname, &pvalue); 1483 pjsip_param *p = pj_pool_alloc(pool, sizeof(pjsip_param)); 1484 p->name = pname; 1485 p->value = pvalue; 1486 pj_list_insert_before(&hdr->other_param, p); 1475 1487 } 1476 1488 } … … 1547 1559 pj_str_t pname, pvalue; 1548 1560 1549 int_parse_param( scanner, &pname, &pvalue);1561 int_parse_param( scanner, pool, &pname, &pvalue); 1550 1562 1551 1563 if (!parser_stricmp(pname, pjsip_BRANCH_STR) && pvalue.slen) { … … 1567 1579 hdr->rport_param = 0; 1568 1580 } else { 1569 concat_param( &hdr->other_param, pool, &pname, &pvalue); 1570 } 1571 } 1572 1581 pjsip_param *p = pj_pool_alloc(pool, sizeof(pjsip_param)); 1582 p->name = pname; 1583 p->value = pvalue; 1584 pj_list_insert_before(&hdr->other_param, p); 1585 } 1586 } 1573 1587 } 1574 1588 … … 1603 1617 1604 1618 pj_memcpy(&hdr->name_addr, temp, sizeof(*temp)); 1605 if (*scanner->curptr == ';') { 1606 pj_scan_get_until(scanner, &pjsip_NEWLINE_OR_EOF_SPEC, 1607 &hdr->other_param); 1619 1620 while (*scanner->curptr == ';') { 1621 pjsip_param *p = pj_pool_alloc(pool, sizeof(pjsip_param)); 1622 int_parse_param(scanner, pool, &p->name, &p->value); 1623 pj_list_insert_before(&hdr->other_param, p); 1608 1624 } 1609 1625 } -
pjproject/trunk/pjsip/src/pjsip/sip_resolve.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip/sip_transport.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip/sip_transport_udp.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsip/sip_uri.c
- Property svn:eol-style set to native
r64 r65 69 69 } 70 70 71 72 PJ_DEF(void) pjsip_param_shallow_clone( pj_pool_t *pool, 73 pjsip_param *dst_list, 74 const pjsip_param *src_list) 75 { 76 const pjsip_param *p = src_list->next; 77 78 pj_list_init(dst_list); 79 while (p != src_list) { 80 pjsip_param *new_param = pj_pool_alloc(pool, sizeof(pjsip_param)); 81 new_param->name = p->name; 82 new_param->value = p->value; 83 pj_list_insert_before(dst_list, new_param); 84 p = p->next; 85 } 86 } 87 88 PJ_DEF(pj_ssize_t) pjsip_param_print_on( const pjsip_param *param_list, 89 char *buf, pj_size_t size, 90 int sep) 91 { 92 const pjsip_param *p = param_list->next; 93 char *startbuf = buf; 94 char *endbuf = buf + size; 95 96 while (p != param_list) { 97 *buf++ = (char)sep; 98 copy_advance_escape(buf, p->name, pjsip_PARAM_CHAR_SPEC); 99 if (p->value.slen) { 100 *buf++ = '='; 101 copy_advance_escape(buf, p->value, pjsip_PARAM_CHAR_SPEC); 102 } 103 p = p->next; 104 } 105 return buf-startbuf; 106 } 107 108 71 109 /* 72 110 * URI stuffs … … 255 293 256 294 /* Other param. */ 257 param = url->other_param.next; 258 while (param != &url->other_param) { 259 *buf++ = ';'; 260 copy_advance_escape(buf, param->name, pjsip_PARAM_CHAR_SPEC); 261 if (param->value.slen) { 262 *buf++ = '='; 263 copy_advance_escape(buf, param->value, pjsip_PARAM_CHAR_SPEC); 264 } 265 param = param->next; 266 } 295 printed = pjsip_param_print_on(&url->other_param, buf, endbuf-buf, ';'); 296 if (printed < 0) 297 return -1; 298 buf += printed; 267 299 268 300 /* Header param. */ … … 473 505 474 506 if (context != PJSIP_URI_IN_REQ_URI) { 475 copy_advance(buf, name->display);476 507 if (name->display.slen) { 508 if (endbuf-buf < 8) return -1; 509 *buf++ = '"'; 510 copy_advance(buf, name->display); 511 *buf++ = '"'; 477 512 *buf++ = ' '; 478 513 } -
pjproject/trunk/pjsip/src/pjsip/sip_util.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsua/getopt.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsua/getopt.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsua/main.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/pjsua/misc.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/test-pjsip/main.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/test-pjsip/msg.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/test-pjsip/test.c
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/test-pjsip/test.h
- Property svn:eol-style set to native
-
pjproject/trunk/pjsip/src/test-pjsip/uri.c
- Property svn:eol-style set to native
r64 r65 26 26 "0123456789" 27 27 #define MARK "-_.!~*'()" 28 #define USER "&=+$,;?/%" 29 #define PASS "&=+$,%" 30 #define PARAM_CHAR "[]/:&+$" MARK "%" 31 32 #define POOL_SIZE 4096 33 34 static pj_uint32_t parse_len, parse_time, print_time; 28 #define USER_CHAR ALPHANUM MARK "&=+$,;?/" 29 #define PASS_CHAR ALPHANUM MARK "&=+$," 30 #define PARAM_CHAR ALPHANUM MARK "[]/:&+$" 31 32 #define POOL_SIZE 4000 33 #define LOOP_COUNT 1000 34 #define AVERAGE_URL_LEN 80 35 #define THREAD_COUNT 4 36 37 static pj_uint32_t parse_len; 38 static pj_timestamp parse_time, print_time; 35 39 36 40 37 41 /* URI creator functions. */ 42 static pjsip_uri *create_uri0( pj_pool_t *pool ); 38 43 static pjsip_uri *create_uri1( pj_pool_t *pool ); 39 44 static pjsip_uri *create_uri2( pj_pool_t *pool ); … … 53 58 static pjsip_uri *create_uri16( pj_pool_t *pool ); 54 59 static pjsip_uri *create_uri17( pj_pool_t *pool ); 55 static pjsip_uri *create_uri18( pj_pool_t *pool );56 static pjsip_uri *create_uri19( pj_pool_t *pool );57 60 static pjsip_uri *create_dummy( pj_pool_t *pool ); 58 61 … … 71 74 PJ_SUCCESS, 72 75 "sip:localhost", 76 &create_uri0 77 }, 78 { 79 PJ_SUCCESS, 80 "sip:user@localhost", 73 81 &create_uri1 74 82 }, 75 83 { 76 84 PJ_SUCCESS, 77 "sip:user@localhost",78 &create_uri279 },80 {81 PJ_SUCCESS,82 85 "sip:user:password@localhost:5060", 83 &create_uri 3,86 &create_uri2, 84 87 }, 85 88 { … … 87 90 ERR_NOT_EQUAL, 88 91 "sip:localhost:5060", 92 &create_uri3 93 }, 94 { 95 /* All recognized parameters. */ 96 PJ_SUCCESS, 97 "sip:localhost;transport=tcp;user=ip;ttl=255;lr;maddr=127.0.0.1;method=ACK", 89 98 &create_uri4 90 },91 {92 /* All recognized parameters. */93 PJ_SUCCESS,94 "sip:localhost;transport=tcp;user=ip;ttl=255;lr;maddr=127.0.0.1;method=ACK",95 &create_uri596 99 }, 97 100 { … … 100 103 "sip:localhost;pickup=hurry;user=phone;message=I%20am%20sorry" 101 104 "?Subject=Hello%20There&Server=SIP%20Server", 102 &create_uri 6105 &create_uri5 103 106 }, 104 107 { … … 106 109 PJ_SUCCESS, 107 110 "sips:localhost", 108 &create_uri 7,111 &create_uri6, 109 112 }, 110 113 { … … 112 115 PJ_SUCCESS, 113 116 "<sip:localhost>", 114 &create_uri 8117 &create_uri7 115 118 }, 116 119 { … … 120 123 PJ_SUCCESS, 121 124 " Power Administrator <sips:localhost>", 125 &create_uri8 126 }, 127 { 128 /* Name address. */ 129 PJ_SUCCESS, 130 " \"User\" <sip:user@localhost:5071>", 122 131 &create_uri9 123 132 }, 124 133 { 125 /* Name address. */126 PJ_SUCCESS,127 " \"User\" <sip:user@localhost:5071>",128 &create_uri10129 },130 {131 134 /* Escaped sequence in display name (display=Strange User\"\\\"). */ 132 135 PJ_SUCCESS, 133 136 " \"Strange User\\\"\\\\\\\"\" <sip:localhost>", 137 &create_uri10, 138 }, 139 { 140 /* Errorneous escaping in display name. */ 141 ERR_SYNTAX_ERR, 142 " \"Rogue User\\\" <sip:localhost>", 134 143 &create_uri11, 135 144 }, 136 145 { 137 /* Errorneous escaping in display name. */138 ERR_SYNTAX_ERR,139 " \"Rogue User\\\" <sip:localhost>",146 /* Dangling quote in display name, but that should be OK. */ 147 PJ_SUCCESS, 148 "Strange User\" <sip:localhost>", 140 149 &create_uri12, 141 150 }, 142 151 { 143 /* Dangling quote in display name, but that should be OK. */144 PJ_SUCCESS, 145 " Strange User\" <sip:localhost>",152 /* Special characters in parameter value must be quoted. */ 153 PJ_SUCCESS, 154 "sip:localhost;pvalue=\"hello world\"", 146 155 &create_uri13, 147 },148 {149 /* Special characters in parameter value must be quoted. */150 PJ_SUCCESS,151 "sip:localhost;pvalue=\"hello world\"",152 &create_uri14,153 156 }, 154 157 { … … 157 160 */ 158 161 PJ_SUCCESS, 159 "This is -. !% *_+`'~ me <sip:a19A&=+$,;?/%2c:% 09a&Zz=+$,@"162 "This is -. !% *_+`'~ me <sip:a19A&=+$,;?/%2c:%40a&Zz=+$,@" 160 163 "my_proxy09.MY-domain.com:9801>", 164 &create_uri14, 165 }, 166 { 167 /* Another excercise to the allowed character sets to the hostname. */ 168 PJ_SUCCESS, 169 "sip:" ALPHANUM "-_.com", 161 170 &create_uri15, 162 },163 {164 /* Another excercise to the allowed character sets to the hostname. */165 PJ_SUCCESS,166 "sip:" ALPHANUM "-_.com",167 &create_uri16,168 171 }, 169 172 { … … 172 175 */ 173 176 PJ_SUCCESS, 174 "sip:" ALPHANUM USER ":" ALPHANUM PASS"@host",175 &create_uri1 7,177 "sip:" USER_CHAR ":" PASS_CHAR "@host", 178 &create_uri16, 176 179 }, 177 180 { … … 180 183 */ 181 184 PJ_SUCCESS, 182 "sip:host;user=ip;" ALPHANUM PARAM_CHAR "=" ALPHANUM PARAM_CHAR185 "sip:host;user=ip;" PARAM_CHAR "%21=" PARAM_CHAR "%21" 183 186 ";lr;other=1;transport=sctp;other2", 184 &create_uri1 8,185 }, 186 { 187 /* This should trigger syntax error. */187 &create_uri17, 188 }, 189 { 190 /* 18: This should trigger syntax error. */ 188 191 ERR_SYNTAX_ERR, 189 192 "sip:", … … 191 194 }, 192 195 { 193 /* Syntax error: whitespace after scheme. */196 /* 19: Syntax error: whitespace after scheme. */ 194 197 ERR_SYNTAX_ERR, 195 198 "sip :host", … … 197 200 }, 198 201 { 199 /* Syntax error: whitespace before hostname. */202 /* 20: Syntax error: whitespace before hostname. */ 200 203 ERR_SYNTAX_ERR, 201 204 "sip: host", … … 203 206 }, 204 207 { 205 /* Syntax error: invalid port. */208 /* 21: Syntax error: invalid port. */ 206 209 ERR_SYNTAX_ERR, 207 210 "sip:user:password", … … 209 212 }, 210 213 { 211 /* Syntax error: no host. */214 /* 22: Syntax error: no host. */ 212 215 ERR_SYNTAX_ERR, 213 216 "sip:user@", … … 215 218 }, 216 219 { 217 /* Syntax error: no user/host. */220 /* 23: Syntax error: no user/host. */ 218 221 ERR_SYNTAX_ERR, 219 222 "sip:@", … … 221 224 }, 222 225 { 223 /* Syntax error: empty string. */226 /* 24: Syntax error: empty string. */ 224 227 ERR_SYNTAX_ERR, 225 228 "", … … 228 231 }; 229 232 230 static pjsip_uri *create_uri 1(pj_pool_t *pool)233 static pjsip_uri *create_uri0(pj_pool_t *pool) 231 234 { 232 235 /* "sip:localhost" */ … … 237 240 } 238 241 239 static pjsip_uri *create_uri 2(pj_pool_t *pool)242 static pjsip_uri *create_uri1(pj_pool_t *pool) 240 243 { 241 244 /* "sip:user@localhost" */ … … 248 251 } 249 252 250 static pjsip_uri *create_uri 3(pj_pool_t *pool)253 static pjsip_uri *create_uri2(pj_pool_t *pool) 251 254 { 252 255 /* "sip:user:password@localhost:5060" */ … … 261 264 } 262 265 263 static pjsip_uri *create_uri 4(pj_pool_t *pool)266 static pjsip_uri *create_uri3(pj_pool_t *pool) 264 267 { 265 268 /* Like: "sip:localhost:5060", but without the port. */ … … 270 273 } 271 274 272 static pjsip_uri *create_uri 5(pj_pool_t *pool)275 static pjsip_uri *create_uri4(pj_pool_t *pool) 273 276 { 274 277 /* "sip:localhost;transport=tcp;user=ip;ttl=255;lr;maddr=127.0.0.1;method=ACK" */ … … 286 289 } 287 290 288 static pjsip_uri *create_uri6(pj_pool_t *pool) 291 #define param_add(list,pname,pvalue) \ 292 do { \ 293 pjsip_param *param; \ 294 param=pj_pool_alloc(pool, sizeof(pjsip_param)); \ 295 param->name = pj_str(pname); \ 296 param->value = pj_str(pvalue); \ 297 pj_list_insert_before(&list, param); \ 298 } while (0) 299 300 static pjsip_uri *create_uri5(pj_pool_t *pool) 289 301 { 290 302 /* "sip:localhost;pickup=hurry;user=phone;message=I%20am%20sorry" … … 295 307 pj_strdup2(pool, &url->host, "localhost"); 296 308 pj_strdup2(pool, &url->user_param, "phone"); 297 pj_strdup2(pool, &url->other_param, ";pickup=hurry;message=I%20am%20sorry"); 298 pj_strdup2(pool, &url->header_param, "?Subject=Hello%20There&Server=SIP%20Server"); 299 return (pjsip_uri*)url; 300 301 } 302 303 static pjsip_uri *create_uri7(pj_pool_t *pool) 309 310 //pj_strdup2(pool, &url->other_param, ";pickup=hurry;message=I%20am%20sorry"); 311 param_add(url->other_param, "pickup", "hurry"); 312 param_add(url->other_param, "message", "I am sorry"); 313 314 //pj_strdup2(pool, &url->header_param, "?Subject=Hello%20There&Server=SIP%20Server"); 315 param_add(url->header_param, "Subject", "Hello There"); 316 param_add(url->header_param, "Server", "SIP Server"); 317 return (pjsip_uri*)url; 318 319 } 320 321 static pjsip_uri *create_uri6(pj_pool_t *pool) 304 322 { 305 323 /* "sips:localhost" */ … … 310 328 } 311 329 312 static pjsip_uri *create_uri 8(pj_pool_t *pool)330 static pjsip_uri *create_uri7(pj_pool_t *pool) 313 331 { 314 332 /* "<sip:localhost>" */ … … 323 341 } 324 342 325 static pjsip_uri *create_uri 9(pj_pool_t *pool)343 static pjsip_uri *create_uri8(pj_pool_t *pool) 326 344 { 327 345 /* " Power Administrator <sips:localhost>" */ … … 337 355 } 338 356 339 static pjsip_uri *create_uri 10(pj_pool_t *pool)357 static pjsip_uri *create_uri9(pj_pool_t *pool) 340 358 { 341 359 /* " \"User\" <sip:user@localhost:5071>" */ … … 346 364 name_addr->uri = (pjsip_uri*) url; 347 365 348 pj_strdup2(pool, &name_addr->display, " \"User\"");366 pj_strdup2(pool, &name_addr->display, "User"); 349 367 pj_strdup2(pool, &url->user, "user"); 350 368 pj_strdup2(pool, &url->host, "localhost"); … … 353 371 } 354 372 355 static pjsip_uri *create_uri1 1(pj_pool_t *pool)373 static pjsip_uri *create_uri10(pj_pool_t *pool) 356 374 { 357 375 /* " \"Strange User\\\"\\\\\\\"\" <sip:localhost>" */ … … 362 380 name_addr->uri = (pjsip_uri*) url; 363 381 364 pj_strdup2(pool, &name_addr->display, " \"Strange User\\\"\\\\\\\"\"");382 pj_strdup2(pool, &name_addr->display, "Strange User\\\"\\\\\\\""); 365 383 pj_strdup2(pool, &url->host, "localhost"); 366 384 return (pjsip_uri*)name_addr; 367 385 } 368 386 369 static pjsip_uri *create_uri1 2(pj_pool_t *pool)387 static pjsip_uri *create_uri11(pj_pool_t *pool) 370 388 { 371 389 /* " \"Rogue User\\\" <sip:localhost>" */ … … 376 394 name_addr->uri = (pjsip_uri*) url; 377 395 378 pj_strdup2(pool, &name_addr->display, " \"Rogue User\\\"");396 pj_strdup2(pool, &name_addr->display, "Rogue User\\"); 379 397 pj_strdup2(pool, &url->host, "localhost"); 380 398 return (pjsip_uri*)name_addr; 381 399 } 382 400 383 static pjsip_uri *create_uri1 3(pj_pool_t *pool)401 static pjsip_uri *create_uri12(pj_pool_t *pool) 384 402 { 385 403 /* "Strange User\" <sip:localhost>" */ … … 395 413 } 396 414 415 static pjsip_uri *create_uri13(pj_pool_t *pool) 416 { 417 /* "sip:localhost;pvalue=\"hello world\"" */ 418 pjsip_url *url; 419 url = pjsip_url_create(pool, 0); 420 pj_strdup2(pool, &url->host, "localhost"); 421 //pj_strdup2(pool, &url->other_param, ";pvalue=\"hello world\""); 422 param_add(url->other_param, "pvalue", "hello world"); 423 return (pjsip_uri*)url; 424 } 425 397 426 static pjsip_uri *create_uri14(pj_pool_t *pool) 398 427 { 399 /* "sip:localhost;pvalue=\"hello world\"" */ 400 pjsip_url *url; 401 url = pjsip_url_create(pool, 0); 402 pj_strdup2(pool, &url->host, "localhost"); 403 pj_strdup2(pool, &url->other_param, ";pvalue=\"hello world\""); 404 return (pjsip_uri*)url; 405 } 406 407 static pjsip_uri *create_uri15(pj_pool_t *pool) 408 { 409 /* "This is -. !% *_+`'~ me <sip:a19A&=+$,;?/%2c:%09a&Zz=+$,@my_proxy09.my-domain.com:9801>" */ 428 /* "This is -. !% *_+`'~ me <sip:a19A&=+$,;?/%2c:%40a&Zz=+$,@my_proxy09.my-domain.com:9801>" */ 410 429 pjsip_name_addr *name_addr = pjsip_name_addr_create(pool); 411 430 pjsip_url *url; … … 415 434 416 435 pj_strdup2(pool, &name_addr->display, "This is -. !% *_+`'~ me"); 417 pj_strdup2(pool, &url->user, "a19A&=+$,;?/ %2c");418 pj_strdup2(pool, &url->passwd, " %09a&Zz=+$,");436 pj_strdup2(pool, &url->user, "a19A&=+$,;?/,"); 437 pj_strdup2(pool, &url->passwd, "@a&Zz=+$,"); 419 438 pj_strdup2(pool, &url->host, "my_proxy09.MY-domain.com"); 420 439 url->port = 9801; … … 422 441 } 423 442 443 static pjsip_uri *create_uri15(pj_pool_t *pool) 444 { 445 /* "sip:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.com" */ 446 pjsip_url *url; 447 url = pjsip_url_create(pool, 0); 448 pj_strdup2(pool, &url->host, ALPHANUM "-_.com"); 449 return (pjsip_uri*)url; 450 } 451 424 452 static pjsip_uri *create_uri16(pj_pool_t *pool) 425 453 { 426 /* "sip:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.com" */ 427 pjsip_url *url; 428 url = pjsip_url_create(pool, 0); 429 pj_strdup2(pool, &url->host, ALPHANUM "-_.com"); 454 /* "sip:" USER_CHAR ":" PASS_CHAR "@host" */ 455 pjsip_url *url; 456 url = pjsip_url_create(pool, 0); 457 pj_strdup2(pool, &url->user, USER_CHAR); 458 pj_strdup2(pool, &url->passwd, PASS_CHAR); 459 pj_strdup2(pool, &url->host, "host"); 430 460 return (pjsip_uri*)url; 431 461 } … … 433 463 static pjsip_uri *create_uri17(pj_pool_t *pool) 434 464 { 435 /* "sip:" ALPHANUM USER ":" ALPHANUM PASS "@host" */ 436 pjsip_url *url; 437 url = pjsip_url_create(pool, 0); 438 pj_strdup2(pool, &url->user, ALPHANUM USER); 439 pj_strdup2(pool, &url->passwd, ALPHANUM PASS); 440 pj_strdup2(pool, &url->host, "host"); 441 return (pjsip_uri*)url; 442 } 443 444 static pjsip_uri *create_uri18(pj_pool_t *pool) 445 { 446 /* "sip:host;user=ip;" ALPHANUM PARAM_CHAR "=" ALPHANUM PARAM_CHAR ";lr;other=1;transport=sctp;other2" */ 465 /* "sip:host;user=ip;" PARAM_CHAR "%21=" PARAM_CHAR "%21;lr;other=1;transport=sctp;other2" */ 447 466 pjsip_url *url; 448 467 url = pjsip_url_create(pool, 0); … … 450 469 pj_strdup2(pool, &url->user_param, "ip"); 451 470 pj_strdup2(pool, &url->transport_param, "sctp"); 452 pj_strdup2(pool, &url->other_param, ";" ALPHANUM PARAM_CHAR "=" ALPHANUM PARAM_CHAR ";other=1;other2"); 471 param_add(url->other_param, PARAM_CHAR "!", PARAM_CHAR "!"); 472 param_add(url->other_param, "other", "1"); 473 param_add(url->other_param, "other2", ""); 453 474 url->lr_param = 1; 454 475 return (pjsip_uri*)url; … … 485 506 */ 486 507 status = entry->status==ERR_SYNTAX_ERR ? PJ_SUCCESS : -10; 508 if (status != 0) { 509 PJ_LOG(3,("", " uri parse error!\n" 510 " uri='%s'\n", 511 entry->str)); 512 } 487 513 goto on_return; 488 514 } 489 515 pj_get_timestamp(&t2); 490 parse_time += t2.u32.lo - t1.u32.lo; 516 pj_sub_timestamp(&t2, &t1); 517 pj_add_timestamp(&parse_time, &t2); 491 518 492 519 /* Create the reference URI. */ … … 503 530 goto on_return; 504 531 } 532 s1.ptr[len] = '\0'; 505 533 s1.slen = len; 534 535 pj_get_timestamp(&t2); 536 pj_sub_timestamp(&t2, &t1); 537 pj_add_timestamp(&print_time, &t2); 506 538 507 539 len = pjsip_uri_print( PJSIP_URI_IN_OTHER, ref_uri, s2.ptr, PJSIP_MAX_URL_SIZE); … … 510 542 goto on_return; 511 543 } 544 s2.ptr[len] = '\0'; 512 545 s2.slen = len; 513 pj_get_timestamp(&t2);514 print_time += t2.u32.lo - t1.u32.lo;515 546 516 547 /* Full comparison of parsed URI with reference URI. */ 517 if (pjsip_uri_cmp(PJSIP_URI_IN_OTHER, parsed_uri, ref_uri) != 0) { 548 status = pjsip_uri_cmp(PJSIP_URI_IN_OTHER, parsed_uri, ref_uri); 549 if (status != 0) { 518 550 /* Not equal. See if this is the expected status. */ 519 551 status = entry->status==ERR_NOT_EQUAL ? PJ_SUCCESS : -40; 552 if (status != 0) { 553 PJ_LOG(3,("", " uri comparison mismatch, status=%d:\n" 554 " uri1='%s'\n" 555 " uri2='%s'", 556 status, s1.ptr, s2.ptr)); 557 } 520 558 goto on_return; 521 559 … … 540 578 pj_status_t uri_test() 541 579 { 542 unsigned i ;580 unsigned i, loop; 543 581 pj_pool_t *pool; 544 582 pj_status_t status; 545 546 pool = pjsip_endpt_create_pool(endpt, "", 4000, 4000); 547 583 pj_timestamp zero; 584 pj_highprec_t avg_parse, avg_print; 585 586 zero.u32.hi = zero.u32.lo = 0; 587 588 PJ_LOG(3,("", " simple test")); 589 pool = pjsip_endpt_create_pool(endpt, "", POOL_SIZE, POOL_SIZE); 548 590 for (i=0; i<PJ_ARRAY_SIZE(uri_test_array); ++i) { 549 591 status = do_uri_test(pool, &uri_test_array[i]); … … 551 593 PJ_LOG(3,("uri_test", " error %d when testing entry %d", 552 594 status, i)); 553 break;595 goto on_return; 554 596 } 555 597 } 556 598 pjsip_endpt_destroy_pool(endpt, pool); 599 600 PJ_LOG(3,("", " benchmarking...")); 601 parse_len = 0; 602 parse_time.u32.hi = parse_time.u32.lo = 0; 603 print_time.u32.hi = print_time.u32.lo = 0; 604 pool = pjsip_endpt_create_pool(endpt, "", POOL_SIZE, POOL_SIZE); 605 for (loop=0; loop<LOOP_COUNT; ++loop) { 606 for (i=0; i<PJ_ARRAY_SIZE(uri_test_array); ++i) { 607 status = do_uri_test(pool, &uri_test_array[i]); 608 if (status != PJ_SUCCESS) { 609 PJ_LOG(3,("uri_test", " error %d when testing entry %d", 610 status, i)); 611 goto on_return; 612 } 613 } 614 } 615 616 avg_parse = pj_elapsed_usec(&zero, &parse_time); 617 pj_highprec_mul(avg_parse, AVERAGE_URL_LEN); 618 pj_highprec_div(avg_parse, parse_len); 619 avg_parse = 1000000 / avg_parse; 620 621 avg_print = pj_elapsed_usec(&zero, &print_time); 622 pj_highprec_mul(avg_print, AVERAGE_URL_LEN); 623 pj_highprec_div(avg_print, parse_len); 624 avg_print = 1000000 / avg_print; 625 626 PJ_LOG(3,("", " done. Average parse=%d url/sec, print=%d url/sec", 627 (unsigned)avg_parse, (unsigned)avg_print)); 628 629 PJ_LOG(3,("", " multithreaded test")); 630 631 632 on_return: 557 633 pjsip_endpt_destroy_pool(endpt, pool); 558 634 return status;
Note: See TracChangeset
for help on using the changeset viewer.