Changeset 5532 for pjproject


Ignore:
Timestamp:
Jan 18, 2017 10:55:35 AM (7 years ago)
Author:
nanang
Message:

Re #1900: Merged changes from trunk.

Location:
pjproject/branches/projects/uwp
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/uwp

  • pjproject/branches/projects/uwp/aconfigure

    r5513 r5532  
    642642ac_no_opencore_amrwb 
    643643ac_no_opencore_amrnb 
    644 ec_curve_present 
    645 set_curve_present 
    646644libcrypto_present 
    647645libssl_present 
    648646openssl_h_present 
    649 ac_ssl_has_sigalg 
    650 ac_ssl_has_ec 
    651647ac_ssl_has_aes_gcm 
    652648ac_no_ssl 
     
    760756oldincludedir 
    761757includedir 
     758runstatedir 
    762759localstatedir 
    763760sharedstatedir 
     
    882879sharedstatedir='${prefix}/com' 
    883880localstatedir='${prefix}/var' 
     881runstatedir='${localstatedir}/run' 
    884882includedir='${prefix}/include' 
    885883oldincludedir='/usr/include' 
     
    11341132    silent=yes ;; 
    11351133 
     1134  -runstatedir | --runstatedir | --runstatedi | --runstated \ 
     1135  | --runstate | --runstat | --runsta | --runst | --runs \ 
     1136  | --run | --ru | --r) 
     1137    ac_prev=runstatedir ;; 
     1138  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ 
     1139  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ 
     1140  | --run=* | --ru=* | --r=*) 
     1141    runstatedir=$ac_optarg ;; 
     1142 
    11361143  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) 
    11371144    ac_prev=sbindir ;; 
     
    12711278                datadir sysconfdir sharedstatedir localstatedir includedir \ 
    12721279                oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ 
    1273                 libdir localedir mandir 
     1280                libdir localedir mandir runstatedir 
    12741281do 
    12751282  eval ac_val=\$$ac_var 
     
    14241431  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com] 
    14251432  --localstatedir=DIR     modifiable single-machine data [PREFIX/var] 
     1433  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run] 
    14261434  --libdir=DIR            object code libraries [EPREFIX/lib] 
    14271435  --includedir=DIR        C header files [PREFIX/include] 
     
    23452353$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    23462354as_fn_error $? "failed to load site script $ac_site_file 
    2347 See \`config.log' for more details" "$LINENO" 5 ; } 
     2355See \`config.log' for more details" "$LINENO" 5; } 
    23482356  fi 
    23492357done 
     
    24882496case $ac_cv_build in 
    24892497*-*-*) ;; 
    2490 *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;; 
     2498*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; 
    24912499esac 
    24922500build=$ac_cv_build 
     
    25212529case $ac_cv_host in 
    25222530*-*-*) ;; 
    2523 *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;; 
     2531*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; 
    25242532esac 
    25252533host=$ac_cv_host 
     
    25542562case $ac_cv_target in 
    25552563*-*-*) ;; 
    2556 *) as_fn_error $? "invalid value of canonical target" "$LINENO" 5 ;; 
     2564*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; 
    25572565esac 
    25582566target=$ac_cv_target 
     
    28912899$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    28922900as_fn_error $? "no acceptable C compiler found in \$PATH 
    2893 See \`config.log' for more details" "$LINENO" 5 ; } 
     2901See \`config.log' for more details" "$LINENO" 5; } 
    28942902 
    28952903# Provide some information about the compiler. 
     
    30063014$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    30073015as_fn_error 77 "C compiler cannot create executables 
    3008 See \`config.log' for more details" "$LINENO" 5 ; } 
     3016See \`config.log' for more details" "$LINENO" 5; } 
    30093017else 
    30103018  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 
     
    30493057$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    30503058as_fn_error $? "cannot compute suffix of executables: cannot compile and link 
    3051 See \`config.log' for more details" "$LINENO" 5 ; } 
     3059See \`config.log' for more details" "$LINENO" 5; } 
    30523060fi 
    30533061rm -f conftest conftest$ac_cv_exeext 
     
    31083116as_fn_error $? "cannot run C compiled programs. 
    31093117If you meant to cross compile, use \`--host'. 
    3110 See \`config.log' for more details" "$LINENO" 5 ; } 
     3118See \`config.log' for more details" "$LINENO" 5; } 
    31113119    fi 
    31123120  fi 
     
    31603168$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    31613169as_fn_error $? "cannot compute suffix of object files: cannot compile 
    3162 See \`config.log' for more details" "$LINENO" 5 ; } 
     3170See \`config.log' for more details" "$LINENO" 5; } 
    31633171fi 
    31643172rm -f conftest.$ac_cv_objext conftest.$ac_ext 
     
    45544562$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    45554563as_fn_error $? "C preprocessor \"$CPP\" fails sanity check 
    4556 See \`config.log' for more details" "$LINENO" 5 ; } 
     4564See \`config.log' for more details" "$LINENO" 5; } 
    45574565fi 
    45584566 
     
    50445052   *) 
    50455053     as_fn_error $? "unknown endianness 
    5046  presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5  ;; 
     5054 presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; 
    50475055 esac 
    50485056 
     
    76177625$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    76187626as_fn_error $? "Error: unable to recognize your IPP installation. Make sure the paths and ARCH suffix are set correctly, run with --help for more info 
    7619 See \`config.log' for more details" "$LINENO" 5 ; } 
     7627See \`config.log' for more details" "$LINENO" 5; } 
    76207628fi 
    76217629rm -f core conftest.err conftest.$ac_objext \ 
     
    76737681$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    76747682as_fn_error $? "Unable to find to find built binaries under $IPPSAMPLES/speech-codecs/{bin,_bin}. Have you built the IPP samples? 
    7675 See \`config.log' for more details" "$LINENO" 5 ; } 
     7683See \`config.log' for more details" "$LINENO" 5; } 
    76767684            fi 
    76777685        else 
     
    76797687$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    76807688as_fn_error $? "unable to find $IPPSAMPLES/speech-codecs/bin/*gcc*/lib or $IPPSAMPLES/speech-codecs/_bin/*gcc*/lib directory. Have you built the samples? 
    7681 See \`config.log' for more details" "$LINENO" 5 ; } 
     7689See \`config.log' for more details" "$LINENO" 5; } 
    76827690        fi 
    76837691 
     
    76877695$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    76887696as_fn_error $? "There's something wrong with this script, directory $IPPSAMP_DIR does not exist 
    7689 See \`config.log' for more details" "$LINENO" 5 ; } 
     7697See \`config.log' for more details" "$LINENO" 5; } 
    76907698            exit 1; 
    76917699        fi 
     
    77017709$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    77027710as_fn_error $? "bug in this script: unsupported IPP version 
    7703 See \`config.log' for more details" "$LINENO" 5 ; } 
     7711See \`config.log' for more details" "$LINENO" 5; } 
    77047712        fi 
    77057713 
     
    77087716$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    77097717as_fn_error $? "$IPPSAMP_LIBS doesn't exist in $IPPSAMP_DIR 
    7710 See \`config.log' for more details" "$LINENO" 5 ; } 
     7718See \`config.log' for more details" "$LINENO" 5; } 
    77117719        fi 
    77127720 
     
    77447752$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    77457753as_fn_error $? "no 
    7746 See \`config.log' for more details" "$LINENO" 5 ; } 
     7754See \`config.log' for more details" "$LINENO" 5; } 
    77477755fi 
    77487756rm -f core conftest.err conftest.$ac_objext \ 
     
    77897797 
    77907798ac_ssl_has_aes_gcm=0 
    7791  
    7792 ac_ssl_has_ec=0 
    7793  
    7794 ac_ssl_has_sigalg=0 
    77957799 
    77967800# Check whether --enable-ssl was given. 
     
    79557959$as_echo "OpenSSL AES GCM support not found, SRTP will only support AES CM cryptos" >&6; } 
    79567960                        fi 
    7957  
    7958                         # Check if OpenSSL supports setting curve algorithm 
    7959                         # and has elliptic curve 
    7960  
    7961                         { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenSSL setting curve functions" >&5 
    7962 $as_echo_n "checking OpenSSL setting curve functions... " >&6; } 
    7963                         set_curve_present=0 
    7964  
    7965                         ec_curve_present=0 
    7966  
    7967                         cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
    7968 /* end confdefs.h.  */ 
    7969 #include <openssl/ssl.h> 
    7970  
    7971 int 
    7972 main () 
    7973 { 
    7974  SSL_set1_curves(NULL, NULL, 0); 
    7975  
    7976   ; 
    7977   return 0; 
    7978 } 
    7979 _ACEOF 
    7980 if ac_fn_c_try_link "$LINENO"; then : 
    7981    set_curve_present=1 
    7982                                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 
    7983 $as_echo "ok" >&6; } 
    7984  
    7985 else 
    7986  
    7987                                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 
    7988 $as_echo "no" >&6; } 
    7989  
    7990 fi 
    7991 rm -f core conftest.err conftest.$ac_objext \ 
    7992     conftest$ac_exeext conftest.$ac_ext 
    7993  
    7994                         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EC_curve_nid2nist in -lssl" >&5 
    7995 $as_echo_n "checking for EC_curve_nid2nist in -lssl... " >&6; } 
    7996 if ${ac_cv_lib_ssl_EC_curve_nid2nist+:} false; then : 
    7997   $as_echo_n "(cached) " >&6 
    7998 else 
    7999   ac_check_lib_save_LIBS=$LIBS 
    8000 LIBS="-lssl  $LIBS" 
    8001 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
    8002 /* end confdefs.h.  */ 
    8003  
    8004 /* Override any GCC internal prototype to avoid an error. 
    8005    Use char because int might match the return type of a GCC 
    8006    builtin and then its argument prototype would still apply.  */ 
    8007 #ifdef __cplusplus 
    8008 extern "C" 
    8009 #endif 
    8010 char EC_curve_nid2nist (); 
    8011 int 
    8012 main () 
    8013 { 
    8014 return EC_curve_nid2nist (); 
    8015   ; 
    8016   return 0; 
    8017 } 
    8018 _ACEOF 
    8019 if ac_fn_c_try_link "$LINENO"; then : 
    8020   ac_cv_lib_ssl_EC_curve_nid2nist=yes 
    8021 else 
    8022   ac_cv_lib_ssl_EC_curve_nid2nist=no 
    8023 fi 
    8024 rm -f core conftest.err conftest.$ac_objext \ 
    8025     conftest$ac_exeext conftest.$ac_ext 
    8026 LIBS=$ac_check_lib_save_LIBS 
    8027 fi 
    8028 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_EC_curve_nid2nist" >&5 
    8029 $as_echo "$ac_cv_lib_ssl_EC_curve_nid2nist" >&6; } 
    8030 if test "x$ac_cv_lib_ssl_EC_curve_nid2nist" = xyes; then : 
    8031   ec_curve_present=1 
    8032 fi 
    8033  
    8034                         if test "x$set_curve_present" = "x1" -a "x$ec_curve_present" = "x1"; then 
    8035                                 ac_ssl_has_ec=1 
    8036                                 { $as_echo "$as_me:${as_lineno-$LINENO}: result: OpenSSL has elliptic curve support" >&5 
    8037 $as_echo "OpenSSL has elliptic curve support" >&6; } 
    8038                         else 
    8039                                 { $as_echo "$as_me:${as_lineno-$LINENO}: result: OpenSSL elliptic curve algorithm unsupported" >&5 
    8040 $as_echo "OpenSSL elliptic curve algorithm unsupported" >&6; } 
    8041                         fi 
    8042  
    8043                         { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenSSL setting sigalg" >&5 
    8044 $as_echo_n "checking OpenSSL setting sigalg... " >&6; } 
    8045                         cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
    8046 /* end confdefs.h.  */ 
    8047 #include <openssl/ssl.h> 
    8048  
    8049 int 
    8050 main () 
    8051 { 
    8052 SSL_set1_sigalgs_list(NULL, NULL); 
    8053  
    8054   ; 
    8055   return 0; 
    8056 } 
    8057 _ACEOF 
    8058 if ac_fn_c_try_link "$LINENO"; then : 
    8059    ac_ssl_has_sigalg=1 
    8060                                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 
    8061 $as_echo "ok" >&6; } 
    8062  
    8063 else 
    8064  
    8065                                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 
    8066 $as_echo "no" >&6; } 
    8067  
    8068 fi 
    8069 rm -f core conftest.err conftest.$ac_objext \ 
    8070     conftest$ac_exeext conftest.$ac_ext 
    80717961 
    80727962                        # PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK 
     
    94009290    "third_party/build/os-auto.mak") CONFIG_FILES="$CONFIG_FILES third_party/build/os-auto.mak" ;; 
    94019291 
    9402   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; 
     9292  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; 
    94039293  esac 
    94049294done 
     
    97179607  case $ac_mode$ac_tag in 
    97189608  :[FHL]*:*);; 
    9719   :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; 
     9609  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; 
    97209610  :[FH]-) ac_tag=-:-;; 
    97219611  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; 
     
    97459635           *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; 
    97469636           esac || 
    9747            as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; 
     9637           as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; 
    97489638      esac 
    97499639      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac 
     
    97729662    case $ac_tag in 
    97739663    *:-:* | *:-) cat >"$ac_tmp/stdin" \ 
    9774       || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;; 
     9664      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; 
    97759665    esac 
    97769666    ;; 
  • pjproject/branches/projects/uwp/aconfigure.ac

    r5513 r5532  
    15341534AC_SUBST(ac_no_ssl) 
    15351535AC_SUBST(ac_ssl_has_aes_gcm,0) 
    1536 AC_SUBST(ac_ssl_has_ec,0) 
    1537 AC_SUBST(ac_ssl_has_sigalg,0) 
    15381536AC_ARG_ENABLE(ssl, 
    15391537              AS_HELP_STRING([--disable-ssl], 
     
    15701568                                AC_MSG_RESULT([OpenSSL AES GCM support not found, SRTP will only support AES CM cryptos]) 
    15711569                        fi 
    1572  
    1573                         # Check if OpenSSL supports setting curve algorithm 
    1574                         # and has elliptic curve 
    1575                          
    1576                         AC_MSG_CHECKING([OpenSSL setting curve functions]) 
    1577                         AC_SUBST(set_curve_present,0) 
    1578                         AC_SUBST(ec_curve_present,0) 
    1579                         AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h> 
    1580                                                   ]], 
    1581                                                   [ SSL_set1_curves(NULL, NULL, 0);] 
    1582                                                  )], 
    1583                                  [ set_curve_present=1 
    1584                                    AC_MSG_RESULT(ok) 
    1585                                   ], 
    1586                                  [ 
    1587                                    AC_MSG_RESULT(no) 
    1588                                  ]) 
    1589  
    1590                         AC_CHECK_LIB(ssl,EC_curve_nid2nist,[ec_curve_present=1]) 
    1591                         if test "x$set_curve_present" = "x1" -a "x$ec_curve_present" = "x1"; then 
    1592                                 [ac_ssl_has_ec=1] 
    1593                                 AC_MSG_RESULT([OpenSSL has elliptic curve support]) 
    1594                         else 
    1595                                 AC_MSG_RESULT([OpenSSL elliptic curve algorithm unsupported]) 
    1596                         fi 
    1597  
    1598                         AC_MSG_CHECKING([OpenSSL setting sigalg]) 
    1599                         AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h> 
    1600                                                   ]], 
    1601                                                   [SSL_set1_sigalgs_list(NULL, NULL);] 
    1602                                                  )], 
    1603                                  [ ac_ssl_has_sigalg=1 
    1604                                    AC_MSG_RESULT(ok) 
    1605                                   ], 
    1606                                  [ 
    1607                                    AC_MSG_RESULT(no) 
    1608                                  ]) 
    16091570 
    16101571                        # PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK 
  • pjproject/branches/projects/uwp/pjlib/build/os-auto.mak.in

    r5513 r5532  
    3333export TARGETS      =   $(PJLIB_LIB) $(PJLIB_SONAME) 
    3434export TARGETS_EXE  =   $(TEST_EXE) 
    35  
    36 ifeq (@ac_ssl_has_ec@,1) 
    37 export PJLIB_CFLAGS += -DPJ_SSL_SOCK_OSSL_HAS_EC=1 
    38 endif 
    39  
    40 ifeq (@ac_ssl_has_sigalg@,1) 
    41 export PJLIB_CFLAGS += -DPJ_SSL_SOCK_OSSL_HAS_SIGALG=1 
    42 endif 
  • pjproject/branches/projects/uwp/pjlib/include/pj/config_site_sample.h

    r5513 r5532  
    393393    #define PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY 5 
    394394     
    395     /* Increase number of video device's supported formats */ 
    396     #define PJMEDIA_VID_DEV_INFO_FMT_CNT        128 
    397  
    398395    /* 
    399396     * PJSIP settings. 
  • pjproject/branches/projects/uwp/pjlib/include/pj/string.h

    r5513 r5532  
    475475} 
    476476 
     477 
     478/** 
     479 * Find the first index of character, in a string, that does not belong to a  
     480 * set of characters. 
     481 * 
     482 * @param str       The string. 
     483 * @param set_char  The string containing the set of characters.  
     484 * 
     485 * @return the index of the first character in the str that doesn't belong to  
     486 * set_char. If str starts with a character not in set_char, return 0. 
     487 */ 
     488PJ_DECL(pj_ssize_t) pj_strspn(const pj_str_t *str, const pj_str_t *set_char); 
     489 
     490 
     491/** 
     492 * Find the first index of character, in a string, that does not belong to a 
     493 * set of characters. 
     494 * 
     495 * @param str       The string. 
     496 * @param set_char  The string containing the set of characters. 
     497 * 
     498 * @return the index of the first character in the str that doesn't belong to 
     499 * set_char. If str starts with a character not in set_char, return 0. 
     500 */ 
     501PJ_DECL(pj_ssize_t) pj_strspn2(const pj_str_t *str, const char *set_char); 
     502 
     503 
     504/** 
     505 * Find the first index of character, in a string, that belong to a set of  
     506 * characters. 
     507 * 
     508 * @param str       The string. 
     509 * @param set_char  The string containing the set of characters. 
     510 * 
     511 * @return the index of the first character in the str that belong to 
     512 * set_char. If no match is found, return the length of str. 
     513 */ 
     514PJ_DECL(pj_ssize_t) pj_strcspn(const pj_str_t *str, const pj_str_t *set_char); 
     515 
     516 
     517/** 
     518 * Find the first index of character, in a string, that belong to a set of 
     519 * characters. 
     520 * 
     521 * @param str       The string. 
     522 * @param set_char  The string containing the set of characters. 
     523 * 
     524 * @return the index of the first character in the str that belong to 
     525 * set_char. If no match is found, return the length of str. 
     526 */ 
     527PJ_DECL(pj_ssize_t) pj_strcspn2(const pj_str_t *str, const char *set_char); 
     528 
     529 
     530/** 
     531 * Find tokens from a string using the delimiter. 
     532 * 
     533 * @param str       The string. 
     534 * @param delim     The string containing the delimiter. It might contain  
     535 *                  multiple character treated as unique set. If same character 
     536 *                  was found on the set, it will be skipped. 
     537 * @param tok       The string containing the token. 
     538 * @param start_idx The search will start from this index. 
     539 * 
     540 * @return the index of token from the str, or the length of the str 
     541 * if the token is not found. 
     542 */ 
     543PJ_DECL(pj_ssize_t) pj_strtok(const pj_str_t *str, const pj_str_t *delim, 
     544                              pj_str_t *tok, pj_size_t start_idx); 
     545 
     546 
     547/** 
     548 * Find tokens from a string using the delimiter. 
     549 * 
     550 * @param str       The string. 
     551 * @param delim     The string containing the delimiter. It might contain 
     552 *                  multiple character treated as unique set. If same character 
     553 *                  was found on the set, it will be skipped. 
     554 * @param tok       The string containing the token. 
     555 * @param start_idx The search will start from this index. 
     556 * 
     557 * @return the index of token from the str, or the length of the str 
     558 * if the token is not found. 
     559 */ 
     560PJ_DECL(pj_ssize_t) pj_strtok2(const pj_str_t *str, const char *delim, 
     561                               pj_str_t *tok, pj_size_t start_idx); 
     562 
     563 
    477564/** 
    478565 * Find the occurence of a substring substr in string str. 
  • pjproject/branches/projects/uwp/pjlib/src/pj/os_info.c

    r5515 r5532  
    9999 
    100100static pj_uint32_t parse_version(char *str) 
    101 { 
    102     char *tok; 
    103     int i, maxtok; 
     101{     
     102    int i, maxtok, found_idx; 
    104103    pj_uint32_t version = 0; 
     104    pj_str_t in_str = pj_str(str); 
     105    pj_str_t token, delim; 
    105106     
    106107    while (*str && !pj_isdigit(*str)) 
     
    108109 
    109110    maxtok = 4; 
    110     for (tok = strtok(str, ".-"), i=0; tok && i<maxtok; 
    111          ++i, tok=strtok(NULL, ".-")) 
     111    delim = pj_str(".-"); 
     112    for (found_idx = pj_strtok(&in_str, &delim, &token, 0), i=0;  
     113         found_idx != in_str.slen && i < maxtok; 
     114         ++i, found_idx = pj_strtok(&in_str, &delim, &token,  
     115                                    found_idx + token.slen)) 
    112116    { 
    113117        int n; 
    114118 
    115         if (!pj_isdigit(*tok)) 
    116             break; 
    117          
    118         n = atoi(tok); 
     119        if (!pj_isdigit(*token.ptr)) 
     120            break; 
     121         
     122        n = atoi(token.ptr); 
    119123        version |= (n << ((3-i)*8)); 
    120124    } 
  • pjproject/branches/projects/uwp/pjlib/src/pj/ssl_sock_ossl.c

    r5513 r5532  
    5252#include <openssl/rand.h> 
    5353#include <openssl/engine.h> 
    54  
    55 #if defined(PJ_SSL_SOCK_OSSL_HAS_EC) && PJ_SSL_SOCK_OSSL_HAS_EC==1 
    56    extern int tls1_ec_nid2curve_id(int nid); 
    57    extern int tls1_ec_curve_id2nid(int curve_id); 
     54#include <openssl/opensslconf.h> 
     55 
     56#if !defined(OPENSSL_NO_EC) && OPENSSL_VERSION_NUMBER >= 0x1000200fL 
     57 
     58#   include <openssl/obj_mac.h> 
     59 
     60static const unsigned nid_cid_map[] = { 
     61    NID_sect163k1,              /* sect163k1 (1) */ 
     62    NID_sect163r1,              /* sect163r1 (2) */ 
     63    NID_sect163r2,              /* sect163r2 (3) */ 
     64    NID_sect193r1,              /* sect193r1 (4) */ 
     65    NID_sect193r2,              /* sect193r2 (5) */ 
     66    NID_sect233k1,              /* sect233k1 (6) */ 
     67    NID_sect233r1,              /* sect233r1 (7) */ 
     68    NID_sect239k1,              /* sect239k1 (8) */ 
     69    NID_sect283k1,              /* sect283k1 (9) */ 
     70    NID_sect283r1,              /* sect283r1 (10) */ 
     71    NID_sect409k1,              /* sect409k1 (11) */ 
     72    NID_sect409r1,              /* sect409r1 (12) */ 
     73    NID_sect571k1,              /* sect571k1 (13) */ 
     74    NID_sect571r1,              /* sect571r1 (14) */ 
     75    NID_secp160k1,              /* secp160k1 (15) */ 
     76    NID_secp160r1,              /* secp160r1 (16) */ 
     77    NID_secp160r2,              /* secp160r2 (17) */ 
     78    NID_secp192k1,              /* secp192k1 (18) */ 
     79    NID_X9_62_prime192v1,       /* secp192r1 (19) */ 
     80    NID_secp224k1,              /* secp224k1 (20) */ 
     81    NID_secp224r1,              /* secp224r1 (21) */ 
     82    NID_secp256k1,              /* secp256k1 (22) */ 
     83    NID_X9_62_prime256v1,       /* secp256r1 (23) */ 
     84    NID_secp384r1,              /* secp384r1 (24) */ 
     85    NID_secp521r1,              /* secp521r1 (25) */ 
     86    NID_brainpoolP256r1,        /* brainpoolP256r1 (26) */ 
     87    NID_brainpoolP384r1,        /* brainpoolP384r1 (27) */ 
     88    NID_brainpoolP512r1         /* brainpoolP512r1 (28) */ 
     89}; 
     90 
     91static unsigned get_cid_from_nid(unsigned nid) 
     92{ 
     93    unsigned i, cid = 0; 
     94    for (i=0; i<PJ_ARRAY_SIZE(nid_cid_map); ++i) { 
     95        if (nid == nid_cid_map[i]) { 
     96            cid = i+1; 
     97            break; 
     98        } 
     99    } 
     100    return cid; 
     101}; 
     102 
     103static unsigned get_nid_from_cid(unsigned cid) 
     104{ 
     105    if ((cid == 0) || (cid > PJ_ARRAY_SIZE(nid_cid_map))) 
     106        return 0; 
     107 
     108    return nid_cid_map[cid-1]; 
     109} 
     110 
    58111#endif 
    59112 
     
    386439        ssl->session = SSL_SESSION_new(); 
    387440 
    388 #if defined(PJ_SSL_SOCK_OSSL_HAS_EC) && PJ_SSL_SOCK_OSSL_HAS_EC==1 
     441#if !defined(OPENSSL_NO_EC) && OPENSSL_VERSION_NUMBER >= 0x1000200fL 
    389442        openssl_curves_num = SSL_get_shared_curve(ssl,-1); 
    390443        if (openssl_curves_num > PJ_ARRAY_SIZE(openssl_curves)) 
     
    403456            } 
    404457 
    405             openssl_curves[i].id   = tls1_ec_nid2curve_id(nid); 
     458            openssl_curves[i].id   = get_cid_from_nid(nid); 
    406459            openssl_curves[i].name = cname; 
    407460        } 
     
    10021055static pj_status_t set_curves_list(pj_ssl_sock_t *ssock) 
    10031056{ 
    1004 #if defined(PJ_SSL_SOCK_OSSL_HAS_EC) && PJ_SSL_SOCK_OSSL_HAS_EC==1 
     1057#if !defined(OPENSSL_NO_EC) && OPENSSL_VERSION_NUMBER >= 0x1000200fL 
    10051058    int ret; 
    10061059    int curves[PJ_SSL_SOCK_MAX_CURVES]; 
    1007     int cnt; 
     1060    unsigned cnt; 
    10081061 
    10091062    if (ssock->param.curves_num == 0) 
     
    10111064 
    10121065    for (cnt = 0; cnt < ssock->param.curves_num; cnt++) { 
    1013         curves[cnt] = tls1_ec_curve_id2nid(ssock->param.curves[cnt]); 
     1066        curves[cnt] = get_nid_from_cid(ssock->param.curves[cnt]); 
    10141067    } 
    10151068 
     
    10281081    PJ_UNUSED_ARG(ssock); 
    10291082#endif 
    1030  
    10311083    return PJ_SUCCESS; 
    10321084} 
     
    10341086static pj_status_t set_sigalgs(pj_ssl_sock_t *ssock) 
    10351087{ 
    1036 #if defined(PJ_SSL_SOCK_OSSL_HAS_SIGALG) && PJ_SSL_SOCK_OSSL_HAS_SIGALG==1 
     1088#if OPENSSL_VERSION_NUMBER >= 0x1000200fL 
    10371089    int ret; 
    10381090 
     
    10521104    PJ_UNUSED_ARG(ssock); 
    10531105#endif 
    1054  
    10551106    return PJ_SUCCESS; 
    10561107} 
  • pjproject/branches/projects/uwp/pjlib/src/pj/string.c

    r4704 r5532  
    2929#endif 
    3030 
     31PJ_DEF(pj_ssize_t) pj_strspn(const pj_str_t *str, const pj_str_t *set_char) 
     32{ 
     33    pj_ssize_t i, j, count = 0; 
     34    for (i = 0; i < str->slen; i++) { 
     35        if (count != i)  
     36            break; 
     37 
     38        for (j = 0; j < set_char->slen; j++) { 
     39            if (str->ptr[i] == set_char->ptr[j]) 
     40                count++; 
     41        } 
     42    } 
     43    return count; 
     44} 
     45 
     46 
     47PJ_DEF(pj_ssize_t) pj_strspn2(const pj_str_t *str, const char *set_char) 
     48{ 
     49    pj_ssize_t i, j, count = 0; 
     50    for (i = 0; i < str->slen; i++) { 
     51        if (count != i) 
     52            break; 
     53 
     54        for (j = 0; set_char[j] != 0; j++) { 
     55            if (str->ptr[i] == set_char[j]) 
     56                count++; 
     57        } 
     58    } 
     59    return count; 
     60} 
     61 
     62 
     63PJ_DEF(pj_ssize_t) pj_strcspn(const pj_str_t *str, const pj_str_t *set_char) 
     64{ 
     65    pj_ssize_t i, j; 
     66    for (i = 0; i < str->slen; i++) { 
     67        for (j = 0; j < set_char->slen; j++) { 
     68            if (str->ptr[i] == set_char->ptr[j]) 
     69                return i; 
     70        } 
     71    } 
     72    return i; 
     73} 
     74 
     75 
     76PJ_DECL(pj_ssize_t) pj_strcspn2(const pj_str_t *str, const char *set_char) 
     77{ 
     78    pj_ssize_t i, j; 
     79    for (i = 0; i < str->slen; i++) { 
     80        for (j = 0; set_char[j] != 0; j++) { 
     81            if (str->ptr[i] == set_char[j]) 
     82                return i; 
     83        } 
     84    } 
     85    return i; 
     86} 
     87 
     88 
     89PJ_DEF(pj_ssize_t) pj_strtok(const pj_str_t *str, const pj_str_t *delim, 
     90                             pj_str_t *tok, pj_size_t start_idx) 
     91{     
     92    pj_ssize_t str_idx; 
     93 
     94    tok->slen = 0; 
     95    if ((str->slen == 0) || ((pj_size_t)str->slen < start_idx)) { 
     96        return str->slen; 
     97    } 
     98     
     99    tok->ptr = str->ptr + start_idx; 
     100    tok->slen = str->slen - start_idx; 
     101 
     102    str_idx = pj_strspn(tok, delim); 
     103    if (start_idx+str_idx == (pj_size_t)str->slen) { 
     104        return str->slen; 
     105    }     
     106    tok->ptr += str_idx; 
     107    tok->slen -= str_idx; 
     108 
     109    tok->slen = pj_strcspn(tok, delim); 
     110    return start_idx + str_idx; 
     111} 
     112 
     113 
     114PJ_DECL(pj_ssize_t) pj_strtok2(const pj_str_t *str, const char *delim, 
     115                               pj_str_t *tok, pj_size_t start_idx) 
     116{ 
     117    pj_ssize_t str_idx; 
     118 
     119    tok->slen = 0; 
     120    if ((str->slen == 0) || ((pj_size_t)str->slen < start_idx)) { 
     121        return str->slen; 
     122    } 
     123 
     124    tok->ptr = str->ptr + start_idx; 
     125    tok->slen = str->slen - start_idx; 
     126 
     127    str_idx = pj_strspn2(tok, delim); 
     128    if (start_idx + str_idx == (pj_size_t)str->slen) { 
     129        return str->slen; 
     130    } 
     131    tok->ptr += str_idx; 
     132    tok->slen -= str_idx; 
     133 
     134    tok->slen = pj_strcspn2(tok, delim); 
     135    return start_idx + str_idx; 
     136} 
     137 
    31138 
    32139PJ_DEF(char*) pj_strstr(const pj_str_t *str, const pj_str_t *substr) 
  • pjproject/branches/projects/uwp/pjmedia/include/pjmedia-videodev/config.h

    r5513 r5532  
    4646 * supported by a video device. 
    4747 * 
    48  * Default: 64 
     48 * Default: 128 (for Android), 64 (for others) 
    4949 */ 
    5050#ifndef PJMEDIA_VID_DEV_INFO_FMT_CNT 
    51 #   define PJMEDIA_VID_DEV_INFO_FMT_CNT 64 
     51#   if defined(PJ_ANDROID) && PJ_ANDROID != 0 
     52#       define PJMEDIA_VID_DEV_INFO_FMT_CNT 128 
     53#   else 
     54#       define PJMEDIA_VID_DEV_INFO_FMT_CNT 64 
     55#   endif 
    5256#endif 
    5357 
  • pjproject/branches/projects/uwp/pjmedia/src/pjmedia/transport_ice.c

    r5513 r5532  
    672672                              pj_ice_sess_cand *cand) 
    673673{ 
    674     pj_str_t input; 
    675     char *token, *host; 
    676     int af; 
    677     pj_str_t s; 
     674    pj_str_t token, delim, host; 
     675    int af, found_idx;     
    678676    pj_status_t status = PJNATH_EICEINCANDSDP; 
    679677 
    680678    pj_bzero(cand, sizeof(*cand)); 
    681     pj_strdup_with_null(pool, &input, orig_input); 
    682679 
    683680    PJ_UNUSED_ARG(obj_name); 
    684681 
    685682    /* Foundation */ 
    686     token = strtok(input.ptr, " "); 
    687     if (!token) { 
     683    delim = pj_str(" "); 
     684    found_idx = pj_strtok(orig_input, &delim, &token, 0); 
     685    if (found_idx == orig_input->slen) { 
    688686        TRACE__((obj_name, "Expecting ICE foundation in candidate")); 
    689687        goto on_return; 
    690688    } 
    691     pj_strdup2(pool, &cand->foundation, token); 
     689    pj_strdup(pool, &cand->foundation, &token); 
    692690 
    693691    /* Component ID */ 
    694     token = strtok(NULL, " "); 
    695     if (!token) { 
     692    found_idx = pj_strtok(orig_input, &delim, &token, found_idx + token.slen); 
     693    if (found_idx == orig_input->slen) { 
    696694        TRACE__((obj_name, "Expecting ICE component ID in candidate")); 
    697695        goto on_return; 
    698696    } 
    699     cand->comp_id = (pj_uint8_t) atoi(token); 
     697    cand->comp_id = (pj_uint8_t)pj_strtoul(&token); 
    700698 
    701699    /* Transport */ 
    702     token = strtok(NULL, " "); 
    703     if (!token) { 
     700    found_idx = pj_strtok(orig_input, &delim, &token, found_idx + token.slen); 
     701    if (found_idx == orig_input->slen) { 
    704702        TRACE__((obj_name, "Expecting ICE transport in candidate")); 
    705703        goto on_return; 
    706704    } 
    707     if (pj_ansi_stricmp(token, "UDP") != 0) { 
     705    if (pj_stricmp2(&token, "UDP") != 0) { 
    708706        TRACE__((obj_name,  
    709707                 "Expecting ICE UDP transport only in candidate")); 
     
    712710 
    713711    /* Priority */ 
    714     token = strtok(NULL, " "); 
    715     if (!token) { 
     712    found_idx = pj_strtok(orig_input, &delim, &token, found_idx + token.slen); 
     713    if (found_idx == orig_input->slen) { 
    716714        TRACE__((obj_name, "Expecting ICE priority in candidate")); 
    717715        goto on_return; 
    718716    } 
    719     cand->prio = atoi(token); 
     717    cand->prio = pj_strtoul(&token); 
    720718 
    721719    /* Host */ 
    722     host = strtok(NULL, " "); 
    723     if (!host) { 
     720    found_idx = pj_strtok(orig_input, &delim, &host, found_idx + token.slen); 
     721    if (found_idx == orig_input->slen) { 
    724722        TRACE__((obj_name, "Expecting ICE host in candidate")); 
    725723        goto on_return; 
    726724    } 
    727725    /* Detect address family */ 
    728     if (pj_ansi_strchr(host, ':')) 
     726    if (pj_strchr(&host, ':')) 
    729727        af = pj_AF_INET6(); 
    730728    else 
    731729        af = pj_AF_INET(); 
    732730    /* Assign address */ 
    733     if (pj_sockaddr_init(af, &cand->addr, pj_cstr(&s, host), 0)) { 
     731    if (pj_sockaddr_init(af, &cand->addr, &host, 0)) { 
    734732        TRACE__((obj_name, "Invalid ICE candidate address")); 
    735733        goto on_return; 
     
    737735 
    738736    /* Port */ 
    739     token = strtok(NULL, " "); 
    740     if (!token) { 
     737    found_idx = pj_strtok(orig_input, &delim, &token, found_idx + host.slen); 
     738    if (found_idx == orig_input->slen) { 
    741739        TRACE__((obj_name, "Expecting ICE port number in candidate")); 
    742740        goto on_return; 
    743741    } 
    744     pj_sockaddr_set_port(&cand->addr, (pj_uint16_t)atoi(token)); 
     742    pj_sockaddr_set_port(&cand->addr, (pj_uint16_t)pj_strtoul(&token)); 
    745743 
    746744    /* typ */ 
    747     token = strtok(NULL, " "); 
    748     if (!token) { 
     745    found_idx = pj_strtok(orig_input, &delim, &token, found_idx + token.slen); 
     746    if (found_idx == orig_input->slen) { 
    749747        TRACE__((obj_name, "Expecting ICE \"typ\" in candidate")); 
    750748        goto on_return; 
    751749    } 
    752     if (pj_ansi_stricmp(token, "typ") != 0) { 
     750    if (pj_stricmp2(&token, "typ") != 0) { 
    753751        TRACE__((obj_name, "Expecting ICE \"typ\" in candidate")); 
    754752        goto on_return; 
     
    756754 
    757755    /* candidate type */ 
    758     token = strtok(NULL, " "); 
    759     if (!token) { 
     756    found_idx = pj_strtok(orig_input, &delim, &token, found_idx + token.slen); 
     757    if (found_idx == orig_input->slen) { 
    760758        TRACE__((obj_name, "Expecting ICE candidate type in candidate")); 
    761759        goto on_return; 
    762760    } 
    763761 
    764     if (pj_ansi_stricmp(token, "host") == 0) { 
     762    if (pj_stricmp2(&token, "host") == 0) { 
    765763        cand->type = PJ_ICE_CAND_TYPE_HOST; 
    766764 
    767     } else if (pj_ansi_stricmp(token, "srflx") == 0) { 
     765    } else if (pj_stricmp2(&token, "srflx") == 0) { 
    768766        cand->type = PJ_ICE_CAND_TYPE_SRFLX; 
    769767 
    770     } else if (pj_ansi_stricmp(token, "relay") == 0) { 
     768    } else if (pj_stricmp2(&token, "relay") == 0) { 
    771769        cand->type = PJ_ICE_CAND_TYPE_RELAYED; 
    772770 
    773     } else if (pj_ansi_stricmp(token, "prflx") == 0) { 
     771    } else if (pj_stricmp2(&token, "prflx") == 0) { 
    774772        cand->type = PJ_ICE_CAND_TYPE_PRFLX; 
    775773 
    776774    } else { 
    777         PJ_LOG(5,(obj_name, "Invalid ICE candidate type %s in candidate",  
    778                   token)); 
     775        PJ_LOG(5,(obj_name, "Invalid ICE candidate type %.*s in candidate",  
     776                  token.slen, token.ptr)); 
    779777        goto on_return; 
    780778    } 
     
    18391837    tp_ice = (struct transport_ice*) pj_ice_strans_get_user_data(ice_st); 
    18401838 
     1839    pj_perror(5, tp_ice->base.name, result, "ICE operation complete" 
     1840              " (op=%d%s)", op, 
     1841              (op==PJ_ICE_STRANS_OP_INIT? "/initialization" : 
     1842              (op==PJ_ICE_STRANS_OP_NEGOTIATION? "/negotiation":""))); 
     1843 
    18411844    /* Notify application */ 
    18421845    if (tp_ice->cb.on_ice_complete) 
  • pjproject/branches/projects/uwp/pjmedia/src/pjmedia/transport_srtp.c

    r5513 r5532  
    12171217                                     int *tag) 
    12181218{ 
    1219     pj_str_t input; 
    1220     char *token; 
    1221     pj_str_t tmp; 
     1219    pj_str_t token, delim; 
    12221220    pj_status_t status; 
    1223     int itmp, token_len; 
     1221    int itmp, found_idx; 
    12241222 
    12251223    pj_bzero(crypto, sizeof(*crypto)); 
    1226     pj_strdup_with_null(pool, &input, &attr->value); 
    12271224 
    12281225    /* Tag */ 
    1229     token = strtok(input.ptr, " "); 
    1230     if (!token) { 
     1226    delim = pj_str(" "); 
     1227    found_idx = pj_strtok(&attr->value, &delim, &token, 0); 
     1228    if (found_idx == attr->value.slen) { 
    12311229        PJ_LOG(4,(THIS_FILE, "Attribute crypto expecting tag")); 
    12321230        return PJMEDIA_SDP_EINATTR; 
    12331231    } 
    1234     token_len = pj_ansi_strlen(token); 
    12351232 
    12361233    /* Tag must not use leading zeroes. */ 
    1237     if (token_len > 1 && *token == '0') 
     1234    if (token.slen > 1 && *token.ptr == '0') 
    12381235        return PJMEDIA_SDP_EINATTR; 
    12391236 
    12401237    /* Tag must be decimal, i.e: contains only digit '0'-'9'. */ 
    1241     for (itmp = 0; itmp < token_len; ++itmp) 
    1242         if (!pj_isdigit(token[itmp])) 
     1238    for (itmp = 0; itmp < token.slen; ++itmp) 
     1239        if (!pj_isdigit(token.ptr[itmp])) 
    12431240            return PJMEDIA_SDP_EINATTR; 
    12441241 
    12451242    /* Get tag value. */ 
    1246     *tag = atoi(token); 
     1243    *tag = pj_strtoul(&token); 
    12471244 
    12481245    /* Crypto-suite */ 
    1249     token = strtok(NULL, " "); 
    1250     if (!token) { 
     1246    found_idx = pj_strtok(&attr->value, &delim, &token, found_idx+token.slen); 
     1247    if (found_idx == attr->value.slen) { 
    12511248        PJ_LOG(4,(THIS_FILE, "Attribute crypto expecting crypto suite")); 
    12521249        return PJMEDIA_SDP_EINATTR; 
    12531250    } 
    1254     crypto->name = pj_str(token); 
     1251    crypto->name = token; 
    12551252 
    12561253    /* Key method */ 
    1257     token = strtok(NULL, ":"); 
    1258     if (!token) { 
     1254    delim = pj_str(": "); 
     1255    found_idx = pj_strtok(&attr->value, &delim, &token, found_idx+token.slen); 
     1256    if (found_idx == attr->value.slen) { 
    12591257        PJ_LOG(4,(THIS_FILE, "Attribute crypto expecting key method")); 
    12601258        return PJMEDIA_SDP_EINATTR; 
    12611259    } 
    1262     if (pj_ansi_stricmp(token, "inline")) { 
    1263         PJ_LOG(4,(THIS_FILE, "Attribute crypto key method '%s' not supported!", 
    1264                   token)); 
     1260    if (pj_stricmp2(&token, "inline")) { 
     1261        PJ_LOG(4,(THIS_FILE, "Attribute crypto key method '%.*s' " 
     1262                  "not supported!", token.slen, token.ptr)); 
    12651263        return PJMEDIA_SDP_EINATTR; 
    12661264    } 
    12671265 
    1268     /* Key */ 
    1269     token = strtok(NULL, "| "); 
    1270     if (!token) { 
     1266    /* Key */     
     1267    delim = pj_str("| "); 
     1268    found_idx = pj_strtok(&attr->value, &delim, &token, found_idx+token.slen); 
     1269    if (found_idx == attr->value.slen) { 
    12711270        PJ_LOG(4,(THIS_FILE, "Attribute crypto expecting key")); 
    12721271        return PJMEDIA_SDP_EINATTR; 
    12731272    } 
    1274     tmp = pj_str(token); 
    1275     if (PJ_BASE64_TO_BASE256_LEN(tmp.slen) > MAX_KEY_LEN) { 
     1273     
     1274    if (PJ_BASE64_TO_BASE256_LEN(token.slen) > MAX_KEY_LEN) { 
    12761275        PJ_LOG(4,(THIS_FILE, "Key too long")); 
    12771276        return PJMEDIA_SRTP_EINKEYLEN; 
     
    12811280    crypto->key.ptr = (char*) pj_pool_zalloc(pool, MAX_KEY_LEN); 
    12821281    itmp = MAX_KEY_LEN; 
    1283     status = pj_base64_decode(&tmp, (pj_uint8_t*)crypto->key.ptr, 
     1282    status = pj_base64_decode(&token, (pj_uint8_t*)crypto->key.ptr, 
    12841283                              &itmp); 
    12851284    if (status != PJ_SUCCESS) { 
  • pjproject/branches/projects/uwp/pjmedia/src/pjmedia/vid_stream.c

    r5513 r5532  
    823823    unsigned pkt_cnt = 0; 
    824824    pj_timestamp initial_time; 
    825     pj_timestamp null_ts ={0}; 
     825    pj_timestamp null_ts ={{0}}; 
    826826 
    827827#if defined(PJMEDIA_STREAM_ENABLE_KA) && PJMEDIA_STREAM_ENABLE_KA != 0 
  • pjproject/branches/projects/uwp/pjnath/include/pjnath/stun_msg.h

    r3553 r5532  
    324324    PJ_STUN_ATTR_XOR_RELAYED_ADDR   = 0x0016,/**< TURN XOR-RELAYED-ADDRESS  */ 
    325325    PJ_STUN_ATTR_REQ_ADDR_TYPE      = 0x0017,/**< REQUESTED-ADDRESS-TYPE    */ 
     326    PJ_STUN_ATTR_REQ_ADDR_FAMILY    = 0x0017,/**< REQUESTED-ADDRESS-FAMILY  */ 
    326327    PJ_STUN_ATTR_EVEN_PORT          = 0x0018,/**< TURN EVEN-PORT            */ 
    327328    PJ_STUN_ATTR_REQ_TRANSPORT      = 0x0019,/**< TURN REQUESTED-TRANSPORT  */ 
     
    964965 
    965966/** 
    966  * This describes the REQUESTED-ADDRESS-TYPE attribute. 
    967  * The REQUESTED-ADDRESS-TYPE attribute is used by clients to request 
     967 * According to RFC 6156, this describes the REQUESTED-ADDRESS-FAMILY 
     968 * attribute (formerly known as REQUESTED-ADDRESS-TYPE in the draft). 
     969 * The REQUESTED-ADDRESS-FAMILY attribute is used by clients to request 
    968970 * the allocation of a specific address type from a server.  The 
    969  * following is the format of the REQUESTED-ADDRESS-TYPE attribute. 
     971 * following is the format of the REQUESTED-ADDRESS-FAMILY attribute. 
    970972 
    971973 \verbatim 
  • pjproject/branches/projects/uwp/pjnath/src/pjnath/ice_strans.c

    r5513 r5532  
    377377        cand->status = PJ_EPENDING; 
    378378        cand->local_pref = RELAY_PREF; 
    379         cand->transport_id = CREATE_TP_ID(TP_TURN, idx); 
     379        cand->transport_id = tp_id; 
    380380        cand->comp_id = (pj_uint8_t) comp->comp_id; 
    381381    } 
     
    414414 
    415415    PJ_LOG(4,(ice_st->obj_name, 
    416                   "Comp %d: TURN relay candidate waiting for allocation", 
    417                   comp->comp_id)); 
     416                  "Comp %d/%d: TURN relay candidate (tpid=%d) " 
     417                  "waiting for allocation", 
     418                  comp->comp_id, comp->cand_cnt-1, cand->transport_id)); 
    418419 
    419420    return PJ_SUCCESS; 
     
    516517 
    517518        PJ_LOG(4,(ice_st->obj_name, 
    518                   "Comp %d: srflx candidate starts Binding discovery", 
    519                   comp->comp_id)); 
     519                  "Comp %d: srflx candidate (tpid=%d) starts " 
     520                  "Binding discovery", 
     521                  comp->comp_id, cand->transport_id)); 
    520522 
    521523        pj_log_push_indent(); 
     
    623625            if (cand_duplicate) { 
    624626                PJ_LOG(4, (ice_st->obj_name, 
    625                        "Comp %d: host candidate %s is a duplicate", 
     627                       "Comp %d: host candidate %s (tpid=%d) is a duplicate", 
    626628                       comp->comp_id, pj_sockaddr_print(&cand->addr, addrinfo, 
    627                        sizeof(addrinfo), 3))); 
     629                       sizeof(addrinfo), 3), cand->transport_id)); 
    628630 
    629631                pj_bzero(&cand->addr, sizeof(cand->addr)); 
     
    638640 
    639641            PJ_LOG(4,(ice_st->obj_name, 
    640                       "Comp %d: host candidate %s added", 
    641                       comp->comp_id, pj_sockaddr_print(&cand->addr, addrinfo, 
    642                                                       sizeof(addrinfo), 3))); 
     642                      "Comp %d/%d: host candidate %s (tpid=%d) added", 
     643                      comp->comp_id, comp->cand_cnt-1,  
     644                      pj_sockaddr_print(&cand->addr, addrinfo, 
     645                                        sizeof(addrinfo), 3), 
     646                                        cand->transport_id)); 
    643647        } 
    644648    } 
     
    941945         * have not been created. 
    942946         */ 
    943         if (!comp || comp->creating) return; 
     947        if (!comp || comp->creating) { 
     948            PJ_LOG(5, (ice_st->obj_name, "ICE init update: creating comp %d", 
     949                       (comp?comp->comp_id:(i+1)) )); 
     950            return; 
     951        } 
    944952 
    945953        for (j=0; j<comp->cand_cnt; ++j) { 
    946954            pj_ice_sess_cand *cand = &comp->cand_list[j]; 
    947955 
    948             if (cand->status == PJ_EPENDING) 
     956            if (cand->status == PJ_EPENDING) { 
     957                PJ_LOG(5, (ice_st->obj_name, "ICE init update: " 
     958                           "comp %d/%d[%s] is pending", 
     959                           comp->comp_id, j, 
     960                           pj_ice_get_cand_type_name(cand->type))); 
    949961                return; 
     962            } 
    950963        } 
    951964    } 
     
    19571970        char ipaddr[PJ_INET6_ADDRSTRLEN+8]; 
    19581971        pj_ice_sess_cand *cand = NULL; 
    1959         unsigned i; 
     1972        unsigned i, cand_idx = 0xFF; 
    19601973 
    19611974        comp->turn[tp_idx].err_cnt = 0; 
     
    19731986            { 
    19741987                cand = &comp->cand_list[i]; 
     1988                cand_idx = i; 
    19751989                break; 
    19761990            } 
     
    20082022 
    20092023        PJ_LOG(4,(comp->ice_st->obj_name, 
    2010                   "Comp %d: TURN allocation complete, relay address is %s", 
    2011                   comp->comp_id, 
     2024                  "Comp %d/%d: TURN allocation (tpid=%d) complete, " 
     2025                  "relay address is %s", 
     2026                  comp->comp_id, cand_idx, cand->transport_id, 
    20122027                  pj_sockaddr_print(&rel_info.relay_addr, ipaddr, 
    20132028                                     sizeof(ipaddr), 3))); 
     
    20202035    { 
    20212036        pj_ice_sess_cand *cand = NULL; 
    2022         unsigned i; 
     2037        unsigned i, cand_idx = 0xFF; 
    20232038 
    20242039        /* DNS resolution or TURN transport creation/allocation 
     
    20402055            { 
    20412056                cand = &comp->cand_list[i]; 
     2057                cand_idx = i; 
    20422058                break; 
    20432059            } 
     
    20502066         * to the list. 
    20512067         */ 
    2052         if (cand) cand->status = PJ_ERESOLVE; 
     2068        if (cand) { 
     2069            cand->status = PJ_ERESOLVE; 
     2070            PJ_LOG(4,(comp->ice_st->obj_name, 
     2071                      "Comp %d/%d: TURN resolving (tpid=%d) failed", 
     2072                      comp->comp_id, cand_idx, cand->transport_id)); 
     2073        } 
    20532074 
    20542075        sess_init_update(comp->ice_st); 
  • pjproject/branches/projects/uwp/pjnath/src/pjnath/nat_detect.c

    r5513 r5532  
    181181 
    182182    addr_len = pj_sockaddr_get_len(server); 
    183     pj_bzero(&local, sizeof(pj_sockaddr)); 
     183    pj_sockaddr_init(server->addr.sa_family, &local, NULL, 0); 
    184184    status = pj_sock_bind(sock, &local, addr_len); 
    185185    if (status != PJ_SUCCESS) { 
     
    281281     * Bind to any. 
    282282     */ 
    283     pj_bzero(&sess->local_addr, sizeof(pj_sockaddr)); 
    284283    addr_len = pj_sockaddr_get_len(server); 
     284    pj_sockaddr_init(server->addr.sa_family, &sess->local_addr, NULL, 0); 
    285285    status = pj_sock_bind(sess->sock, &sess->local_addr, addr_len); 
    286286    if (status != PJ_SUCCESS) 
  • pjproject/branches/projects/uwp/pjnath/src/pjnath/stun_msg.c

    r4895 r5532  
    344344    }, 
    345345    { 
    346         /* PJ_STUN_ATTR_REQUESTED_ADDR_TYPE, */ 
    347         "REQUESTED-ADDRESS-TYPE", 
     346        /* PJ_STUN_ATTR_REQUESTED_ADDR_FAMILY, */ 
     347        "REQUESTED-ADDRESS-FAMILY", 
    348348        &decode_uint_attr, 
    349349        &encode_uint_attr, 
  • pjproject/branches/projects/uwp/pjnath/src/pjnath/turn_sock.c

    r5513 r5532  
    429429        pj_grp_lock_release(turn_sock->grp_lock); 
    430430        return status; 
     431    } else if (!turn_sock->sess) { 
     432        /* TURN session may have been destroyed here, i.e: when DNS resolution 
     433         * completed synchronously and TURN allocation failed. 
     434         */ 
     435        PJ_LOG(4,(turn_sock->obj_name, "TURN session destroyed in setting " 
     436                                       "TURN server")); 
     437        pj_grp_lock_release(turn_sock->grp_lock); 
     438        return PJ_EGONE; 
    431439    } 
    432440 
  • pjproject/branches/projects/uwp/pjsip-apps/src/pjsua/android/app/src/main/java/MainActivity.java

    r5508 r5532  
    139139            } 
    140140        } 
     141 
     142        @Override 
     143        public void onCallVideoStart() { 
     144            MainActivity ma = ((MyHandler)ui_handler.get()).mTarget.get(); 
     145            SurfaceView surfaceView = (SurfaceView) 
     146                ma.findViewById(R.id.surfaceViewIncomingCall); 
     147 
     148            WindowHandle wh = new WindowHandle(); 
     149            wh.setWindow(surfaceView.getHolder().getSurface()); 
     150            pjsua.setVideoWindow(wh); 
     151        } 
    141152    } 
    142153 
     
    262273    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) 
    263274    { 
    264         pjsua.setIncomingVideoRenderer(holder.getSurface()); 
     275        WindowHandle wh = new WindowHandle(); 
     276        wh.setWindow(holder.getSurface()); 
     277        pjsua.setVideoWindow(wh); 
    265278    } 
    266279 
    267280    public void surfaceCreated(SurfaceHolder holder) 
    268281    { 
    269         pjsua.setIncomingVideoRenderer(holder.getSurface()); 
     282 
    270283    } 
    271284 
    272285    public void surfaceDestroyed(SurfaceHolder holder) 
    273286    { 
    274         pjsua.setIncomingVideoRenderer(null); 
     287        WindowHandle wh = new WindowHandle(); 
     288        wh.setWindow(null); 
     289        pjsua.setVideoWindow(wh); 
    275290    } 
    276291     
  • pjproject/branches/projects/uwp/pjsip-apps/src/pjsua/android/app/src/main/java/org/pjsip/pjsua

    • Property svn:ignore
      •  

        old new  
        11Pjsua*.java 
        22pjsua*.java 
         3SWIG*.java 
         4WindowHandle.java 
         5 
  • pjproject/branches/projects/uwp/pjsip-apps/src/pjsua/android/jni/pjsua.i

    r5513 r5532  
    1515%feature("director") PjsuaAppCallback; 
    1616 
    17 /* Convert Surface object to ANativeWindow for setIncomingVideoRenderer() */ 
     17/* Convert Surface object to ANativeWindow */ 
    1818%typemap(in) jobject surface { 
    1919    $1 = $input? (jobject)ANativeWindow_fromSurface(jenv, $input) : NULL; 
    2020} 
    2121 
     22%extend WindowHandle { 
     23    void setWindow(jobject surface) { $self->window = surface; } 
     24} 
     25 
    2226%include "pjsua_app_callback.h" 
  • pjproject/branches/projects/uwp/pjsip-apps/src/pjsua/android/jni/pjsua_app_callback.cpp

    r5030 r5532  
    3131static char **restart_argv; 
    3232static pjsua_callback pjsua_cb_orig; 
    33 static jobject callVideoSurface; 
     33static pjsua_vid_win_id winId = PJSUA_INVALID_ID; 
     34 
     35void setVideoWindow(const WindowHandle& win) 
     36{ 
     37    pjmedia_vid_dev_hwnd vhwnd; 
     38    
     39    vhwnd.info.window = win.window; 
     40    if (winId != PJSUA_INVALID_ID) 
     41        pjsua_vid_win_set_win(winId, &vhwnd); 
     42} 
    3443 
    3544extern const char *pjsua_app_def_argv[]; 
     
    5867            med_info->stream.vid.win_in != PJSUA_INVALID_ID) 
    5968        { 
    60             pjmedia_vid_dev_hwnd vhwnd; 
    61  
    62             /* Setup renderer surface */ 
    63             pj_bzero(&vhwnd, sizeof(vhwnd)); 
    64             vhwnd.type = PJMEDIA_VID_DEV_HWND_TYPE_ANDROID; 
    65             vhwnd.info.window = callVideoSurface; 
    66             pjsua_vid_win_set_win(med_info->stream.vid.win_in, &vhwnd); 
     69            winId = med_info->stream.vid.win_in; 
     70            registeredCallbackObject->onCallVideoStart(); 
    6771            break; 
    6872        } 
     
    163167} 
    164168 
    165  
    166 void setIncomingVideoRenderer(jobject surface) 
    167 { 
    168     callVideoSurface = surface; 
    169 } 
    170  
    171169#endif 
  • pjproject/branches/projects/uwp/pjsip-apps/src/pjsua/android/jni/pjsua_app_callback.h

    r5014 r5532  
    2020#define __PJSUA_APP_CALLBACK_H__ 
    2121 
    22 #include <jni.h> 
    23  
    2422class PjsuaAppCallback { 
    2523public: 
     
    2725    virtual void onStarted(const char *msg) {} 
    2826    virtual void onStopped(int restart) {} 
     27    virtual void onCallVideoStart() {} 
    2928}; 
     29 
     30typedef struct WindowHandle { 
     31    void        *window; 
     32} WindowHandle; 
     33 
     34void setVideoWindow(const WindowHandle& win); 
    3035 
    3136extern "C" { 
     
    3439int pjsuaRestart(); 
    3540void setCallbackObject(PjsuaAppCallback* callback); 
    36 void setIncomingVideoRenderer(jobject surface); 
    3741} 
    3842 
  • pjproject/branches/projects/uwp/pjsip-apps/src/swig/java/android/app/src/main/java/org/pjsip/pjsua2/app/MyApp.java

    r5502 r5532  
    386386        } 
    387387 
     388        try { 
     389            sipTpConfig.setPort(SIP_PORT+1); 
     390            ep.transportCreate(pjsip_transport_type_e.PJSIP_TRANSPORT_TLS, 
     391                               sipTpConfig); 
     392        } catch (Exception e) { 
     393            System.out.println(e); 
     394        } 
     395 
     396        /* Set SIP port back to default for JSON saved config */ 
     397        sipTpConfig.setPort(SIP_PORT); 
     398 
    388399        /* Create accounts. */ 
    389400        for (int i = 0; i < accCfgs.size(); i++) { 
  • pjproject/branches/projects/uwp/pjsip-apps/src/swig/symbols.i

    r5513 r5532  
    3434 
    3535typedef enum pj_ssl_sock_proto {PJ_SSL_SOCK_PROTO_DEFAULT = 0, PJ_SSL_SOCK_PROTO_SSL2 = 1 << 0, PJ_SSL_SOCK_PROTO_SSL3 = 1 << 1, PJ_SSL_SOCK_PROTO_TLS1 = 1 << 2, PJ_SSL_SOCK_PROTO_TLS1_1 = 1 << 3, PJ_SSL_SOCK_PROTO_TLS1_2 = 1 << 4, PJ_SSL_SOCK_PROTO_SSL23 = (1 << 16) - 1, PJ_SSL_SOCK_PROTO_DTLS1 = 1 << 16} pj_ssl_sock_proto; 
     36 
     37typedef enum pj_ssl_cert_name_type {PJ_SSL_CERT_NAME_UNKNOWN = 0, PJ_SSL_CERT_NAME_RFC822, PJ_SSL_CERT_NAME_DNS, PJ_SSL_CERT_NAME_URI, PJ_SSL_CERT_NAME_IP} pj_ssl_cert_name_type; 
     38 
     39typedef enum pj_ssl_cert_verify_flag_t {PJ_SSL_CERT_ESUCCESS = 0, PJ_SSL_CERT_EISSUER_NOT_FOUND = (1 << 0), PJ_SSL_CERT_EUNTRUSTED = (1 << 1), PJ_SSL_CERT_EVALIDITY_PERIOD = (1 << 2), PJ_SSL_CERT_EINVALID_FORMAT = (1 << 3), PJ_SSL_CERT_EINVALID_PURPOSE = (1 << 4), PJ_SSL_CERT_EISSUER_MISMATCH = (1 << 5), PJ_SSL_CERT_ECRL_FAILURE = (1 << 6), PJ_SSL_CERT_EREVOKED = (1 << 7), PJ_SSL_CERT_ECHAIN_TOO_LONG = (1 << 8), PJ_SSL_CERT_EIDENTITY_NOT_MATCH = (1 << 30), PJ_SSL_CERT_EUNKNOWN = (1 << 31)} pj_ssl_cert_verify_flag_t; 
    3640 
    3741typedef enum pj_stun_nat_type {PJ_STUN_NAT_TYPE_UNKNOWN, PJ_STUN_NAT_TYPE_ERR_UNKNOWN, PJ_STUN_NAT_TYPE_OPEN, PJ_STUN_NAT_TYPE_BLOCKED, PJ_STUN_NAT_TYPE_SYMMETRIC_UDP, PJ_STUN_NAT_TYPE_FULL_CONE, PJ_STUN_NAT_TYPE_SYMMETRIC, PJ_STUN_NAT_TYPE_RESTRICTED, PJ_STUN_NAT_TYPE_PORT_RESTRICTED} pj_stun_nat_type; 
  • pjproject/branches/projects/uwp/pjsip-apps/src/swig/symbols.lst

    r5513 r5532  
    33pj/log.h                        pj_log_decoration 
    44pj/sock_qos.h                   pj_qos_type pj_qos_flag pj_qos_wmm_prio pj_qos_params 
    5 pj/ssl_sock.h                   pj_ssl_cipher pj_ssl_sock_proto 
     5pj/ssl_sock.h                   pj_ssl_cipher pj_ssl_sock_proto pj_ssl_cert_name_type pj_ssl_cert_verify_flag_t 
    66 
    77pjnath/nat_detect.h             pj_stun_nat_type 
  • pjproject/branches/projects/uwp/pjsip/include/pjsua2/endpoint.hpp

    r5513 r5532  
    125125 
    126126/** 
     127 * SSL certificate type and name structure. 
     128 */ 
     129struct SslCertName 
     130{ 
     131    pj_ssl_cert_name_type  type;            /**< Name type              */ 
     132    string                 name;            /**< The name               */ 
     133}; 
     134 
     135/** 
     136 * SSL certificate information. 
     137 */ 
     138struct SslCertInfo 
     139{ 
     140    unsigned            version;            /**< Certificate version    */ 
     141    unsigned char       serialNo[20];       /**< Serial number, array 
     142                                                 of octets, first index 
     143                                                 is MSB                 */ 
     144    string              subjectCn;          /**< Subject common name    */ 
     145    string              subjectInfo;        /**< One line subject, fields 
     146                                                 are separated by slash, e.g: 
     147                                                 "CN=sample.org/OU=HRD" */ 
     148 
     149    string              issuerCn;           /**< Issuer common name     */ 
     150    string              issuerInfo;         /**< One line subject, fields 
     151                                                 are separated by slash */ 
     152 
     153    TimeVal             validityStart;      /**< Validity start         */ 
     154    TimeVal             validityEnd;        /**< Validity end           */ 
     155    bool                validityGmt;        /**< Flag if validity  
     156                                                 date/time use GMT      */ 
     157 
     158    vector<SslCertName> subjectAltName;     /**< Subject alternative 
     159                                                 name extension         */ 
     160 
     161    string              raw;                /**< Raw certificate in PEM 
     162                                                 format, only available 
     163                                                 for remote certificate */ 
     164 
     165public: 
     166    /** 
     167     * Constructor. 
     168     */ 
     169    SslCertInfo(); 
     170 
     171    /** 
     172     * Check if the info is set with empty values. 
     173     * 
     174     * @return          True if the info is empty. 
     175     */ 
     176    bool isEmpty() const; 
     177 
     178    /** 
     179     * Convert from pjsip 
     180     */ 
     181    void fromPj(const pj_ssl_cert_info &info); 
     182     
     183private: 
     184    bool empty; 
     185}; 
     186 
     187/** 
     188 * TLS transport information. 
     189 */ 
     190struct TlsInfo 
     191{ 
     192    /** 
     193     * Describes whether secure socket connection is established, i.e: TLS/SSL  
     194     * handshaking has been done successfully. 
     195     */ 
     196    bool                established; 
     197 
     198    /** 
     199     * Describes secure socket protocol being used, see #pj_ssl_sock_proto.  
     200     * Use bitwise OR operation to combine the protocol type. 
     201     */ 
     202    unsigned            protocol; 
     203 
     204    /** 
     205     * Describes cipher suite being used, this will only be set when connection 
     206     * is established. 
     207     */ 
     208    pj_ssl_cipher       cipher; 
     209 
     210    /** 
     211     * Describes cipher name being used, this will only be set when connection 
     212     * is established. 
     213     */ 
     214    string              cipherName; 
     215 
     216    /** 
     217     * Describes local address. 
     218     */ 
     219    SocketAddress       localAddr; 
     220 
     221    /** 
     222     * Describes remote address. 
     223     */ 
     224    SocketAddress       remoteAddr; 
     225    
     226    /** 
     227     * Describes active local certificate info. Use SslCertInfo.isEmpty() 
     228     * to check if the local cert info is available. 
     229     */ 
     230    SslCertInfo         localCertInfo; 
     231    
     232    /** 
     233     * Describes active remote certificate info. Use SslCertInfo.isEmpty() 
     234     * to check if the remote cert info is available. 
     235     */ 
     236    SslCertInfo         remoteCertInfo; 
     237 
     238    /** 
     239     * Status of peer certificate verification. 
     240     */ 
     241    unsigned            verifyStatus; 
     242 
     243    /** 
     244     * Error messages (if any) of peer certificate verification, based on 
     245     * the field verifyStatus above. 
     246     */ 
     247    StringVector        verifyMsgs; 
     248 
     249public: 
     250    /** 
     251     * Constructor. 
     252     */ 
     253    TlsInfo(); 
     254 
     255    /** 
     256     * Check if the info is set with empty values. 
     257     * 
     258     * @return          True if the info is empty. 
     259     */ 
     260    bool isEmpty() const; 
     261 
     262    /** 
     263     * Convert from pjsip 
     264     */ 
     265    void fromPj(const pjsip_tls_state_info &info); 
     266 
     267private: 
     268    bool empty; 
     269}; 
     270 
     271/** 
    127272 * Parameter of Endpoint::onTransportState() callback. 
    128273 */ 
     
    133278     */ 
    134279    TransportHandle     hnd; 
     280     
     281    /** 
     282     * The transport type. 
     283     */ 
     284    string              type; 
    135285 
    136286    /** 
     
    143293     */ 
    144294    pj_status_t         lastError; 
     295     
     296    /** 
     297     * TLS transport info, only used if transport type is TLS. Use  
     298     * TlsInfo.isEmpty() to check if this info is available. 
     299     */ 
     300    TlsInfo             tlsInfo; 
    145301}; 
    146302 
     
    10301186     */ 
    10311187    void transportClose(TransportId id) throw(Error); 
     1188     
     1189    /** 
     1190     * Start graceful shutdown procedure for this transport handle. After 
     1191     * graceful shutdown has been initiated, no new reference can be 
     1192     * obtained for the transport. However, existing objects that currently 
     1193     * uses the transport may still use this transport to send and receive 
     1194     * packets. After all objects release their reference to this transport, 
     1195     * the transport will be destroyed immediately. 
     1196     * 
     1197     * Note: application normally uses this API after obtaining the handle 
     1198     * from onTransportState() callback. 
     1199     * 
     1200     * @param tp                The transport. 
     1201     */ 
     1202    void transportShutdown(TransportHandle tp) throw(Error); 
    10321203 
    10331204    /************************************************************************* 
  • pjproject/branches/projects/uwp/pjsip/src/pjsip/sip_transport_udp.c

    r5513 r5532  
    7777    int                 is_closing; 
    7878    pj_bool_t           is_paused; 
     79    int                 read_loop_spin; 
    7980 
    8081    /* Group lock to be used by UDP transport and ioqueue key */ 
     
    130131    pj_status_t status; 
    131132 
     133    ++tp->read_loop_spin; 
     134 
    132135    /* Don't do anything if transport is closing. */ 
    133136    if (tp->is_closing) { 
    134137        tp->is_closing++; 
    135         return; 
     138        goto on_return; 
    136139    } 
    137140 
    138141    /* Don't do anything if transport is being paused. */ 
    139142    if (tp->is_paused) 
    140         return; 
     143        goto on_return; 
    141144 
    142145    /* 
     
    228231         */ 
    229232        if (tp->is_paused) 
    230             return; 
     233            break; 
    231234 
    232235        /* Read next packet. */ 
     
    244247 
    245248        } else if (status == PJ_EPENDING) { 
     249            break; 
     250 
     251        } else if (status == PJ_ECANCELLED) { 
     252            /* Socket is closing, quit loop */ 
    246253            break; 
    247254 
     
    277284        } 
    278285    } 
     286 
     287on_return: 
     288    --tp->read_loop_spin; 
    279289} 
    280290 
     
    624634        return PJ_SUCCESS; 
    625635 
    626     /* Create group lock */ 
    627     status = pj_grp_lock_create(tp->base.pool, NULL, &tp->grp_lock); 
    628     if (status != PJ_SUCCESS) 
    629         return status; 
    630  
    631     pj_grp_lock_add_ref(tp->grp_lock); 
    632     pj_grp_lock_add_handler(tp->grp_lock, tp->base.pool, tp, &udp_on_destroy); 
     636    /* Create group lock if not yet (don't need to do so on UDP restart) */ 
     637    if (!tp->grp_lock) { 
     638        status = pj_grp_lock_create(tp->base.pool, NULL, &tp->grp_lock); 
     639        if (status != PJ_SUCCESS) 
     640            return status; 
     641 
     642        pj_grp_lock_add_ref(tp->grp_lock); 
     643        pj_grp_lock_add_handler(tp->grp_lock, tp->base.pool, tp, 
     644                                &udp_on_destroy); 
     645    } 
    633646     
    634647    /* Register to ioqueue. */ 
     
    10761089    tp = (struct udp_transport*) transport; 
    10771090 
     1091    /* Pause the transport first, so that any active read loop spin will 
     1092     * quit as soon as possible. 
     1093     */ 
     1094    tp->is_paused = PJ_TRUE; 
     1095 
    10781096    if (option & PJSIP_UDP_TRANSPORT_DESTROY_SOCKET) { 
    10791097        char addr_buf[PJ_INET6_ADDRSTRLEN]; 
     
    11391157    } 
    11401158 
     1159    /* Make sure all udp_on_read_complete() loop spin are stopped */ 
     1160    do { 
     1161        pj_thread_sleep(1); 
     1162    } while (tp->read_loop_spin); 
     1163 
    11411164    /* Re-register new or existing socket to ioqueue. */ 
    11421165    status = register_to_ioqueue(tp); 
  • pjproject/branches/projects/uwp/pjsip/src/pjsua-lib/pjsua_media.c

    r5513 r5532  
    17421742        call->med_ch_mutex = NULL; 
    17431743    } 
     1744 
     1745    PJ_PERROR(5,(THIS_FILE, status, 
     1746                 "Call %d: media transport initialization complete", call_id)); 
    17441747 
    17451748    if (status != PJ_SUCCESS) { 
  • pjproject/branches/projects/uwp/pjsip/src/pjsua2/endpoint.cpp

    r5513 r5532  
    4545/////////////////////////////////////////////////////////////////////////////// 
    4646 
     47TlsInfo::TlsInfo() 
     48        : empty(true) 
     49{ 
     50} 
     51 
     52bool TlsInfo::isEmpty() const 
     53{ 
     54    return empty; 
     55} 
     56 
     57void TlsInfo::fromPj(const pjsip_tls_state_info &info) 
     58{ 
     59#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0 
     60    pj_ssl_sock_info *ssock_info = info.ssl_sock_info; 
     61    char straddr[PJ_INET6_ADDRSTRLEN+10]; 
     62    const char *verif_msgs[32]; 
     63    unsigned verif_msg_cnt; 
     64     
     65    empty       = false; 
     66    established = PJ2BOOL(ssock_info->established); 
     67    protocol    = ssock_info->proto; 
     68    cipher      = ssock_info->cipher; 
     69    cipherName  = pj_ssl_cipher_name(ssock_info->cipher); 
     70    pj_sockaddr_print(&ssock_info->local_addr, straddr, sizeof(straddr), 3); 
     71    localAddr   = straddr; 
     72    pj_sockaddr_print(&ssock_info->remote_addr, straddr, sizeof(straddr),3); 
     73    remoteAddr  = straddr; 
     74    verifyStatus = ssock_info->verify_status; 
     75    if (ssock_info->local_cert_info) 
     76        localCertInfo.fromPj(*ssock_info->local_cert_info); 
     77    if (ssock_info->remote_cert_info) 
     78        remoteCertInfo.fromPj(*ssock_info->remote_cert_info); 
     79     
     80    /* Dump server TLS certificate verification result */ 
     81    verif_msg_cnt = PJ_ARRAY_SIZE(verif_msgs); 
     82    pj_ssl_cert_get_verify_status_strings(ssock_info->verify_status, 
     83                                          verif_msgs, &verif_msg_cnt); 
     84    for (unsigned i = 0; i < verif_msg_cnt; ++i) { 
     85        verifyMsgs.push_back(verif_msgs[i]); 
     86    } 
     87#endif 
     88} 
     89 
     90SslCertInfo::SslCertInfo() 
     91        : empty(true) 
     92{ 
     93} 
     94 
     95bool SslCertInfo::isEmpty() const 
     96{ 
     97    return empty; 
     98} 
     99 
     100void SslCertInfo::fromPj(const pj_ssl_cert_info &info) 
     101{ 
     102    empty       = false; 
     103    version     = info.version; 
     104    pj_memcpy(serialNo, info.serial_no, sizeof(info.serial_no)); 
     105    subjectCn   = pj2Str(info.subject.cn); 
     106    subjectInfo = pj2Str(info.subject.info); 
     107    issuerCn    = pj2Str(info.issuer.cn); 
     108    issuerInfo  = pj2Str(info.issuer.info); 
     109    validityStart.fromPj(info.validity.start); 
     110    validityEnd.fromPj(info.validity.end); 
     111    validityGmt = PJ2BOOL(info.validity.gmt); 
     112    raw         = pj2Str(info.raw); 
     113 
     114    for (unsigned i = 0; i < info.subj_alt_name.cnt; i++) { 
     115        SslCertName cname; 
     116        cname.type = info.subj_alt_name.entry[i].type; 
     117        cname.name = pj2Str(info.subj_alt_name.entry[i].name); 
     118        subjectAltName.push_back(cname); 
     119    } 
     120} 
     121 
     122/////////////////////////////////////////////////////////////////////////////// 
     123 
    47124UaConfig::UaConfig() 
    48125: mainThreadOnly(false) 
     
    559636 
    560637    prm.hnd = (TransportHandle)tp; 
     638    prm.type = tp->type_name; 
    561639    prm.state = state; 
    562640    prm.lastError = info ? info->status : PJ_SUCCESS; 
     641 
     642#if defined(PJSIP_HAS_TLS_TRANSPORT) && PJSIP_HAS_TLS_TRANSPORT!=0 
     643    if (!pj_ansi_stricmp(tp->type_name, "tls") && info->ext_info && 
     644        (state == PJSIP_TP_STATE_CONNECTED ||  
     645         ((pjsip_tls_state_info*)info->ext_info)-> 
     646                                 ssl_sock_info->verify_status != PJ_SUCCESS)) 
     647    { 
     648        prm.tlsInfo.fromPj(*((pjsip_tls_state_info*)info->ext_info)); 
     649    } 
     650#endif 
    563651 
    564652    ep.onTransportState(prm); 
     
    16951783} 
    16961784 
     1785void Endpoint::transportShutdown(TransportHandle tp) throw(Error) 
     1786{ 
     1787    PJSUA2_CHECK_EXPR( pjsip_transport_shutdown((pjsip_transport *)tp) ); 
     1788} 
     1789 
    16971790/////////////////////////////////////////////////////////////////////////////// 
    16981791/* 
Note: See TracChangeset for help on using the changeset viewer.