Ignore:
Timestamp:
Jul 5, 2017 5:37:24 AM (7 years ago)
Author:
nanang
Message:

Re #2018: Added API pjmedia_transport_srtp_dtls_start_nego() to start DTLS-SRTP nego without SDP offer/answer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/transport_srtp.h

    r5597 r5621  
    269269 
    270270/** 
     271 * This structure specifies DTLS-SRTP negotiation parameters. 
     272 */ 
     273typedef struct pjmedia_srtp_dtls_nego_param 
     274{ 
     275    /** 
     276     * Fingerprint of remote certificate, should be formatted as 
     277     * "SHA-256/1 XX:XX:XX...". If this is not set, fingerprint verification 
     278     * will not be performed. 
     279     */ 
     280    pj_str_t             rem_fingerprint; 
     281 
     282    /** 
     283     * Remote address and port. 
     284     */ 
     285    pj_sockaddr          rem_addr; 
     286 
     287    /** 
     288     * Remote RTCP address and port. 
     289     */ 
     290    pj_sockaddr          rem_rtcp; 
     291 
     292    /** 
     293     * Set to PJ_TRUE if our role is active. Active role will initiates 
     294     * the DTLS negotiation. Passive role will wait for incoming DTLS 
     295     * negotiation packet. 
     296     */ 
     297    pj_bool_t            is_role_active; 
     298 
     299} pjmedia_srtp_dtls_nego_param; 
     300 
     301 
     302 
     303/** 
    271304 * Initialize SRTP library. This function should be called before 
    272305 * any SRTP functions, however calling #pjmedia_transport_srtp_create()  
     
    308341                                       const pjmedia_srtp_setting *opt, 
    309342                                       pjmedia_transport **p_tp); 
     343 
     344/** 
     345 * Get fingerprint of local DTLS-SRTP certificate. 
     346 * 
     347 * @param srtp      The SRTP transport. 
     348 * @param hash      Fingerprint hash algorithm, currently valid values are 
     349 *                  "SHA-256" and "SHA-1". 
     350 * @param buf       Buffer for fingerprint output. The output will be 
     351 *                  formatted as "SHA-256/1 XX:XX:XX..." and null terminated. 
     352 * @param len       On input, the size of the buffer. 
     353 *                  On output, the length of the fingerprint. 
     354 * 
     355 * @return          PJ_SUCCESS on success. 
     356 */ 
     357PJ_DECL(pj_status_t) pjmedia_transport_srtp_dtls_get_fingerprint( 
     358                                pjmedia_transport *srtp, 
     359                                const char *hash, 
     360                                char *buf, pj_size_t *len); 
     361 
     362 
     363/** 
     364 * Manually start DTLS-SRTP negotiation with the given parameters. Application 
     365 * only needs to call this function when the SRTP transport is used without 
     366 * SDP offer/answer. When SDP offer/answer framework is used, the DTLS-SRTP 
     367 * negotiation will be handled by pjmedia_transport_media_create(), 
     368 * pjmedia_transport_media_start(), pjmedia_transport_media_encode_sdp(), and 
     369 * pjmedia_transport_media_stop(). 
     370 * 
     371 * When the negotiation completes, application will be notified via SRTP 
     372 * callback on_srtp_nego_complete(), if set. If the negotiation is successful, 
     373 * SRTP will be automatically started. 
     374 * 
     375 * Note that if the SRTP member transport is an ICE transport, application 
     376 * should only call this function after ICE negotiation is completed 
     377 * successfully. 
     378 * 
     379 * @param srtp      The SRTP transport. 
     380 * @param param     DTLS-SRTP nego parameter. 
     381 * 
     382 * @return          PJ_SUCCESS on success. 
     383 */ 
     384PJ_DECL(pj_status_t) pjmedia_transport_srtp_dtls_start_nego( 
     385                                pjmedia_transport *srtp, 
     386                                const pjmedia_srtp_dtls_nego_param *param); 
    310387 
    311388 
Note: See TracChangeset for help on using the changeset viewer.