Ignore:
Timestamp:
Mar 15, 2018 3:00:59 AM (6 years ago)
Author:
nanang
Message:

Close #2100:

  • Added new APIs:
    • PJMEDIA: pjmedia_srtp_enum_crypto(), pjmedia_srtp_enum_keying()
    • PJSUA: pjsua_config.srtp_opt, pjsua_acc_config.srtp_opt, pjsua_srtp_opt_default()
    • PJSUA2: AccountMediaConfig::srtpOpt, Endpoint::srtpCryptoEnum()
  • Deprecated PJSUA callback on_create_media_transport_srtp() (not removed yet, just warnings).
  • Slightly refactored SRTP code:
    • Fixed potential issue with on_create_media_transport_srtp(), some PJSUA internal values in pjmedia_srtp_setting may be overridden by app.
    • Fixed few issues in SRTP and keying mechanism, e.g: premature local SDP modification (it should be done after verification).
    • Potential minor backward compatibility issue: default value of pjmedia_srtp_setting.crypto_count is now zero, previously it was initialized with all crypto via pjmedia_srtp_setting_default(), actually zero and all cryptos in this setting semantically are the same.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r5721 r5755  
    636636 
    637637} pjsua_create_media_transport_flag; 
     638 
     639 
     640/** 
     641 * Specify SRTP media transport settings. 
     642 */ 
     643typedef struct pjsua_srtp_opt 
     644{ 
     645    /** 
     646     * Specify the number of crypto suite settings. If set to zero, all 
     647     * available cryptos will be enabled. Note that available crypto names 
     648     * can be enumerated using pjmedia_srtp_enum_crypto(). 
     649     * 
     650     * Default is zero. 
     651     */ 
     652    unsigned                     crypto_count; 
     653 
     654    /** 
     655     * Specify individual crypto suite setting and its priority order. 
     656     * 
     657     * Notes for DTLS-SRTP keying: 
     658     *  - Currently only supports these cryptos: AES_CM_128_HMAC_SHA1_80, 
     659     *    AES_CM_128_HMAC_SHA1_32, AEAD_AES_256_GCM, and AEAD_AES_128_GCM. 
     660     *  - SRTP key is not configurable. 
     661     */ 
     662    pjmedia_srtp_crypto          crypto[PJMEDIA_SRTP_MAX_CRYPTOS]; 
     663 
     664    /** 
     665     * Specify the number of enabled keying methods. If set to zero, all 
     666     * keyings will be enabled. Maximum value is PJMEDIA_SRTP_MAX_KEYINGS. 
     667     * Note that available keying methods can be enumerated using 
     668     * pjmedia_srtp_enum_keying(). 
     669     * 
     670     * Default is zero (all keyings are enabled with priority order: 
     671     * SDES, DTLS-SRTP). 
     672     */ 
     673    unsigned                     keying_count; 
     674 
     675    /** 
     676     * Specify enabled keying methods and its priority order. Keying method 
     677     * with higher priority will be given earlier chance to process the SDP, 
     678     * for example as currently only one keying is supported in the SDP offer, 
     679     * keying with first priority will be likely used in the SDP offer. 
     680     */ 
     681    pjmedia_srtp_keying_method   keying[PJMEDIA_SRTP_KEYINGS_COUNT]; 
     682 
     683} pjsua_srtp_opt; 
    638684 
    639685 
     
    15201566 
    15211567    /** 
    1522      * This callback is called when SRTP media transport is created. 
     1568     * Warning: deprecated and may be removed in future release. Application 
     1569     * can set SRTP crypto settings (including keys) and keying methods 
     1570     * via pjsua_srtp_opt in pjsua_config and pjsua_acc_config. 
     1571     * See also ticket #2100. 
     1572     * 
     1573     * This callback is called before SRTP media transport is created. 
    15231574     * Application can modify the SRTP setting \a srtp_opt to specify 
    1524      * the cryptos and keys which are going to be used. Note that 
    1525      * application should not modify the field 
    1526      * \a pjmedia_srtp_setting.close_member_tp and can only modify 
    1527      * the field \a pjmedia_srtp_setting.use for initial INVITE. 
     1575     * the cryptos & keys and keying methods which are going to be used. 
     1576     * Note that only some fields of pjmedia_srtp_setting can be overriden 
     1577     * from this callback, i.e: "crypto_count", "crypto", "keying_count", 
     1578     * "keying", and "use" (only for initial INVITE), any modification in 
     1579     * other fields will be ignored. 
    15281580     * 
    15291581     * @param call_id       Call ID 
     
    19011953     */ 
    19021954    pj_bool_t        srtp_optional_dup_offer; 
     1955 
     1956    /** 
     1957     * Specify SRTP transport setting. Application can initialize it with 
     1958     * default values using pjsua_srtp_opt_default(). 
     1959     */ 
     1960    pjsua_srtp_opt   srtp_opt; 
    19031961 
    19041962    /** 
     
    32243282} pjsua_nat64_opt; 
    32253283 
     3284 
    32263285/** 
    32273286 * This structure describes account configuration to be specified when 
     
    37413800     */ 
    37423801    pj_bool_t        srtp_optional_dup_offer; 
     3802 
     3803    /** 
     3804     * Specify SRTP transport setting. Application can initialize it with 
     3805     * default values using pjsua_srtp_opt_default(). 
     3806     */ 
     3807    pjsua_srtp_opt   srtp_opt; 
    37433808 
    37443809    /** 
     
    38913956                                    pjsua_turn_config *dst, 
    38923957                                    const pjsua_turn_config *src); 
     3958 
     3959 
     3960/** 
     3961 * Call this function to initialize SRTP config with default values. 
     3962 * 
     3963 * @param cfg       The SRTP config to be initialized. 
     3964 */ 
     3965PJ_DECL(void) pjsua_srtp_opt_default(pjsua_srtp_opt *cfg); 
     3966 
    38933967 
    38943968/** 
Note: See TracChangeset for help on using the changeset viewer.