Ignore:
Timestamp:
May 24, 2019 3:32:17 AM (5 years ago)
Author:
riza
Message:

Close #1017: TURN TLS transport implementation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/include/pjnath/turn_sock.h

    r5987 r6004  
    2727#include <pjnath/turn_session.h> 
    2828#include <pj/sock_qos.h> 
     29#include <pj/ssl_sock.h> 
    2930 
    3031 
     
    146147 
    147148/** 
     149 * The default enabled SSL proto to be used. 
     150 * Default is all protocol above TLSv1 (TLSv1 & TLS v1.1 & TLS v1.2). 
     151 */ 
     152#ifndef PJ_TURN_TLS_DEFAULT_PROTO 
     153#   define PJ_TURN_TLS_DEFAULT_PROTO  (PJ_SSL_SOCK_PROTO_TLS1 | \ 
     154                                       PJ_SSL_SOCK_PROTO_TLS1_1 | \ 
     155                                       PJ_SSL_SOCK_PROTO_TLS1_2) 
     156#endif 
     157 
     158/** 
     159 * TLS transport settings. 
     160 */ 
     161typedef struct pj_turn_sock_tls_cfg 
     162{ 
     163    /** 
     164     * Certificate of Authority (CA) list file. 
     165     */ 
     166    pj_str_t    ca_list_file; 
     167 
     168    /** 
     169     * Certificate of Authority (CA) list directory path. 
     170     */ 
     171    pj_str_t    ca_list_path; 
     172 
     173    /** 
     174     * Public endpoint certificate file, which will be used as client- 
     175     * side  certificate for outgoing TLS connection. 
     176     */ 
     177    pj_str_t    cert_file; 
     178 
     179    /** 
     180     * Optional private key of the endpoint certificate to be used. 
     181     */ 
     182    pj_str_t    privkey_file; 
     183 
     184    /** 
     185     * Certificate of Authority (CA) buffer. If ca_list_file, ca_list_path, 
     186     * cert_file or privkey_file are set, this setting will be ignored. 
     187     */ 
     188    pj_ssl_cert_buffer ca_buf; 
     189 
     190    /** 
     191     * Public endpoint certificate buffer, which will be used as client- 
     192     * side  certificate for outgoing TLS connection, and server-side 
     193     * certificate for incoming TLS connection. If ca_list_file, ca_list_path, 
     194     * cert_file or privkey_file are set, this setting will be ignored. 
     195     */ 
     196    pj_ssl_cert_buffer cert_buf; 
     197 
     198    /** 
     199     * Optional private key buffer of the endpoint certificate to be used.  
     200     * If ca_list_file, ca_list_path, cert_file or privkey_file are set,  
     201     * this setting will be ignored. 
     202     */ 
     203    pj_ssl_cert_buffer privkey_buf; 
     204 
     205    /** 
     206     * Password to open private key. 
     207     */ 
     208    pj_str_t    password; 
     209 
     210    /** 
     211     * The ssl socket parameter. 
     212     * These fields are used by TURN TLS: 
     213     * - proto 
     214     * - ciphers_num 
     215     * - ciphers 
     216     * - curves_num 
     217     * - curves 
     218     * - sigalgs 
     219     * - entropy_type 
     220     * - entropy_path 
     221     * - timeout 
     222     * - sockopt_params 
     223     * - sockopt_ignore_error 
     224     */ 
     225    pj_ssl_sock_param ssock_param; 
     226 
     227} pj_turn_sock_tls_cfg; 
     228 
     229/** 
     230 * Initialize TLS setting with default values. 
     231 * 
     232 * @param tls_cfg   The TLS setting to be initialized. 
     233 */ 
     234 PJ_DECL(void) pj_turn_sock_tls_cfg_default(pj_turn_sock_tls_cfg *tls_cfg); 
     235 
     236/** 
     237 * Duplicate TLS setting. 
     238 * 
     239 * @param pool      The pool to duplicate strings etc. 
     240 * @param dst       Destination structure. 
     241 * @param src       Source structure. 
     242 */ 
     243 PJ_DECL(void) pj_turn_sock_tls_cfg_dup(pj_pool_t *pool, 
     244                                        pj_turn_sock_tls_cfg *dst, 
     245                                        const pj_turn_sock_tls_cfg *src); 
     246 
     247/** 
     248 * Wipe out certificates and keys in the TLS setting. 
     249 * 
     250 * @param tls_cfg   The TLS setting. 
     251 */ 
     252PJ_DECL(void) pj_turn_sock_tls_cfg_wipe_keys(pj_turn_sock_tls_cfg *tls_cfg); 
     253 
     254 
     255/** 
    148256 * This structure describes options that can be specified when creating 
    149257 * the TURN socket. Application should call #pj_turn_sock_cfg_default() 
     
    229337     */ 
    230338    unsigned so_sndbuf_size; 
     339 
     340    /** 
     341     * This specifies TLS settings for TLS transport. It is only be used 
     342     * when this TLS is used to connect to the TURN server. 
     343     */ 
     344    pj_turn_sock_tls_cfg tls_cfg; 
    231345 
    232346} pj_turn_sock_cfg; 
Note: See TracChangeset for help on using the changeset viewer.