Changeset 849
- Timestamp:
- Dec 8, 2006 9:58:31 PM (18 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r839 r849 41 41 pj_bool_t no_tcp; 42 42 pj_bool_t no_udp; 43 pj_bool_t use_tls; 43 44 pjsua_transport_config udp_cfg; 44 45 pjsua_transport_config rtp_cfg; … … 138 139 puts (" --use-stun1=host[:port]"); 139 140 puts (" --use-stun2=host[:port] Resolve local IP with the specified STUN servers"); 141 #if defined(PJSIP_HAS_TLS_TRANSPORT) && PJSIP_HAS_TLS_TRANSPORT!=0 142 puts (" --use-tls Enable TLS transport"); 143 puts (" --tls-ca-file Specify TLS CA file"); 144 puts (" --tls-key-file Specify TLS client key file"); 145 puts (" --tls-password Specify TLS password"); 146 #endif 140 147 puts (""); 141 148 puts ("Media Options:"); … … 300 307 OPT_DURATION, OPT_NO_TCP, OPT_NO_UDP, OPT_THREAD_CNT, 301 308 OPT_NOREFERSUB, 309 OPT_USE_TLS, OPT_TLS_CA_FILE, OPT_TLS_KEY_FILE, OPT_TLS_PASSWORD, 302 310 }; 303 311 struct pj_getopt_option long_options[] = { … … 354 362 { "duration", 1, 0, OPT_DURATION}, 355 363 { "thread-cnt", 1, 0, OPT_THREAD_CNT}, 364 { "use-tls", 0, 0, OPT_USE_TLS}, 365 { "tls-ca-file",1, 0, OPT_TLS_CA_FILE}, 366 { "tls-key-file",1,0, OPT_TLS_KEY_FILE}, 367 { "tls-password",1,0, OPT_TLS_PASSWORD}, 356 368 { NULL, 0, 0, 0} 357 369 }; … … 775 787 break; 776 788 789 case OPT_USE_TLS: 790 cfg->use_tls = PJ_TRUE; 791 break; 792 793 case OPT_TLS_CA_FILE: 794 cfg->udp_cfg.tls_ca_file = pj_str(pj_optarg); 795 break; 796 797 case OPT_TLS_KEY_FILE: 798 cfg->udp_cfg.tls_key_file = pj_str(pj_optarg); 799 break; 800 801 case OPT_TLS_PASSWORD: 802 cfg->udp_cfg.tls_password = pj_str(pj_optarg); 803 break; 804 777 805 default: 778 806 PJ_LOG(1,(THIS_FILE, … … 1003 1031 } 1004 1032 1033 /* TLS */ 1034 if (config->use_tls) 1035 pj_strcat2(&cfg, "--use-tls\n"); 1036 if (config->udp_cfg.tls_ca_file.slen) { 1037 pj_ansi_sprintf(line, "--tls-ca-file %.*s\n", 1038 (int)config->udp_cfg.tls_ca_file.slen, 1039 config->udp_cfg.tls_ca_file.ptr); 1040 pj_strcat2(&cfg, line); 1041 } 1042 if (config->udp_cfg.tls_key_file.slen) { 1043 pj_ansi_sprintf(line, "--tls-key-file %.*s\n", 1044 (int)config->udp_cfg.tls_key_file.slen, 1045 config->udp_cfg.tls_key_file.ptr); 1046 pj_strcat2(&cfg, line); 1047 } 1048 if (config->udp_cfg.tls_password.slen) { 1049 pj_ansi_sprintf(line, "--tls-password %.*s\n", 1050 (int)config->udp_cfg.tls_password.slen, 1051 config->udp_cfg.tls_password.ptr); 1052 pj_strcat2(&cfg, line); 1053 } 1005 1054 1006 1055 pj_strcat2(&cfg, "\n#\n# Media settings:\n#\n"); … … 2765 2814 } 2766 2815 2767 2768 2816 /* Add UDP transport unless it's disabled. */ 2769 2817 if (!app_config.no_udp) { … … 2778 2826 pjsua_acc_set_online_status(current_acc, PJ_TRUE); 2779 2827 } 2828 2829 #if defined(PJSIP_HAS_TLS_TRANSPORT) && PJSIP_HAS_TLS_TRANSPORT!=0 2830 /* Add TLS transport when application wants one */ 2831 if (app_config.use_tls) { 2832 status = pjsua_transport_create(PJSIP_TRANSPORT_TLS, 2833 &app_config.udp_cfg, 2834 &transport_id); 2835 if (status != PJ_SUCCESS) 2836 goto on_error; 2837 } 2838 #endif 2780 2839 2781 2840 if (transport_id == -1) { -
pjproject/trunk/pjsip/build/pjsip_core.dsp
r554 r849 151 151 # Begin Source File 152 152 153 SOURCE=..\src\pjsip\sip_transport_tls_ossl.c 154 # End Source File 155 # Begin Source File 156 153 157 SOURCE=..\src\pjsip\sip_transport_udp.c 154 158 # End Source File … … 287 291 # Begin Source File 288 292 293 SOURCE=..\include\pjsip\sip_transport_tls.h 294 # End Source File 295 # Begin Source File 296 289 297 SOURCE=..\include\pjsip\sip_transport_udp.h 290 298 # End Source File -
pjproject/trunk/pjsip/include/pjsip.h
r563 r849 41 41 #include <pjsip/sip_transport_loop.h> 42 42 #include <pjsip/sip_transport_tcp.h> 43 #if defined(PJSIP_HAS_TLS_TRANSPORT) && PJSIP_HAS_TLS_TRANSPORT!=0 44 # include <pjsip/sip_transport_tls.h> 45 #endif 43 46 #include <pjsip/sip_resolve.h> 44 47 -
pjproject/trunk/pjsip/include/pjsip/sip_config.h
r753 r849 232 232 #ifndef PJSIP_MAX_RESOLVED_ADDRESSES 233 233 # define PJSIP_MAX_RESOLVED_ADDRESSES 8 234 #endif 235 236 237 /** 238 * Enable TLS SIP transport support. For most systems this means that 239 * OpenSSL must be installed. 240 * 241 * Default: 0 (for now) 242 */ 243 #ifndef PJSIP_HAS_TLS_TRANSPORT 244 # define PJSIP_HAS_TLS_TRANSPORT 0 234 245 #endif 235 246 -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r823 r849 840 840 */ 841 841 pjsua_stun_config stun_config; 842 843 /** 844 * TLS root CA file path (only used for TLS transport). 845 */ 846 pj_str_t tls_ca_file; 847 848 /** 849 * TLS client key path (only used for TLS transport). 850 */ 851 pj_str_t tls_key_file; 852 853 /** 854 * TLS password (only used for TLS transport). 855 */ 856 pj_str_t tls_password; 842 857 843 858 } pjsua_transport_config; -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r839 r849 1045 1045 pjsua_var.tpdata[id].data.factory = tcp; 1046 1046 1047 #if defined(PJSIP_HAS_TLS_TRANSPORT) && PJSIP_HAS_TLS_TRANSPORT!=0 1048 } else if (type == PJSIP_TRANSPORT_TLS) { 1049 /* 1050 * Create TLS transport. 1051 */ 1052 pjsip_tpfactory *tls; 1053 1054 status = pjsip_tls_transport_start(pjsua_var.endpt, 1055 &cfg->tls_key_file, 1056 &cfg->tls_password, 1057 &cfg->tls_ca_file, 1058 NULL, NULL, 1, &tls); 1059 if (status != PJ_SUCCESS) { 1060 pjsua_perror(THIS_FILE, "Error creating SIP TLS listener", 1061 status); 1062 goto on_return; 1063 } 1064 1065 /* Save the transport */ 1066 pjsua_var.tpdata[id].type = type; 1067 pjsua_var.tpdata[id].local_name = tls->addr_name; 1068 pjsua_var.tpdata[id].data.factory = tls; 1069 #endif 1070 1047 1071 } else { 1048 1072 status = PJSIP_EUNSUPTRANSPORT;
Note: See TracChangeset
for help on using the changeset viewer.