Ignore:
Timestamp:
Jan 23, 2008 8:39:07 PM (16 years ago)
Author:
bennylp
Message:

Ticket #61: Implement SRTP support in PJMEDIA and PJSUA-LIB, and updated applications because of the changes. This is a major modification back ported from SRTP branch. See ticket #61 for changelog detail of this commit

File:
1 edited

Legend:

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

    r1098 r1735  
    167167PJ_BEGIN_DECL 
    168168 
     169#include <pjmedia/sdp.h> 
    169170 
    170171/* 
     
    243244                             const void *pkt, 
    244245                             pj_size_t size); 
     246 
     247    /** 
     248     * This function is called by application to generate the SDP parts 
     249     * related to transport type, e.g: ICE, SRTP. 
     250     * 
     251     * Application should call #pjmedia_transport_media_create() instead of  
     252     * calling this function directly. 
     253     */ 
     254    pj_status_t (*media_create)(pjmedia_transport *tp, 
     255                                pj_pool_t *pool, 
     256                                pjmedia_sdp_session *sdp_local, 
     257                                const pjmedia_sdp_session *sdp_remote, 
     258                                unsigned media_index); 
     259 
     260    /** 
     261     * This function is called by application to start the transport 
     262     * based on SDP negotiation result. 
     263     * 
     264     * Application should call #pjmedia_transport_media_start() instead of  
     265     * calling this function directly. 
     266     */ 
     267    pj_status_t (*media_start) (pjmedia_transport *tp, 
     268                                pj_pool_t *pool, 
     269                                pjmedia_sdp_session *sdp_local, 
     270                                const pjmedia_sdp_session *sdp_remote, 
     271                                unsigned media_index); 
     272 
     273    /** 
     274     * This function is called by application to stop the transport. 
     275     * 
     276     * Application should call #pjmedia_transport_media_stop() instead of  
     277     * calling this function directly. 
     278     */ 
     279    pj_status_t (*media_stop)  (pjmedia_transport *tp); 
     280 
     281    /** 
     282     * This function can be called to simulate packet lost. 
     283     * 
     284     * Application should call #pjmedia_transport_simulate_lost() instead of  
     285     * calling this function directly. 
     286     */ 
     287    pj_status_t (*simulate_lost)(pjmedia_transport *tp, 
     288                                 pjmedia_dir dir, 
     289                                 unsigned pct_lost); 
    245290 
    246291    /** 
     
    411456 
    412457/** 
     458 * Generate local SDP parts that are related to the specified media transport. 
     459 * Remote SDP might be needed as reference when application is in deciding 
     460 * side of negotiation (callee side), otherwise it should be NULL. 
     461 * This is just a simple wrapper which calls <tt>media_create()</tt> member  
     462 * of the transport. 
     463 * 
     464 * @param tp            The media transport. 
     465 * @param pool          The memory pool. 
     466 * @param sdp_local     Local SDP. 
     467 * @param sdp_remote    Remote SDP. 
     468 * 
     469 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     470 */ 
     471PJ_INLINE(pj_status_t) pjmedia_transport_media_create(pjmedia_transport *tp, 
     472                                    pj_pool_t *pool, 
     473                                    pjmedia_sdp_session *sdp_local, 
     474                                    const pjmedia_sdp_session *sdp_remote, 
     475                                    unsigned media_index) 
     476{ 
     477    return (*tp->op->media_create)(tp, pool, sdp_local, sdp_remote,  
     478                                   media_index); 
     479} 
     480 
     481/** 
     482 * Start the transport with regards to SDP negotiation result.  
     483 * This is just a simple wrapper which calls <tt>media_start()</tt> member  
     484 * of the transport. 
     485 * 
     486 * @param tp            The media transport. 
     487 * @param pool          The memory pool. 
     488 * @param sdp_local     Local SDP. 
     489 * @param sdp_remote    Remote SDP. 
     490 * @param media_index   Media index to start. 
     491 * 
     492 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     493 */ 
     494PJ_INLINE(pj_status_t) pjmedia_transport_media_start(pjmedia_transport *tp, 
     495                                    pj_pool_t *pool, 
     496                                    pjmedia_sdp_session *sdp_local, 
     497                                    const pjmedia_sdp_session *sdp_remote, 
     498                                    unsigned media_index) 
     499{ 
     500    return (*tp->op->media_start)(tp, pool, sdp_local, sdp_remote, media_index); 
     501} 
     502 
     503 
     504/** 
     505 * Stop the transport.  
     506 * This is just a simple wrapper which calls <tt>media_stop()</tt> member  
     507 * of the transport. 
     508 * 
     509 * @param tp            The media transport. 
     510 * 
     511 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     512 */ 
     513PJ_INLINE(pj_status_t) pjmedia_transport_media_stop(pjmedia_transport *tp) 
     514{ 
     515    return (*tp->op->media_stop)(tp); 
     516} 
     517 
     518/** 
    413519 * Close media transport. This is just a simple wrapper which calls  
    414520 * <tt>destroy()</tt> member of the transport. This function will free 
     
    427533} 
    428534 
     535/** 
     536 * Simulate packet lost in the specified direction (for testing purposes). 
     537 * When enabled, the transport will randomly drop packets to the specified 
     538 * direction. 
     539 * 
     540 * @param tp        The media transport. 
     541 * @param dir       Media direction to which packets will be randomly dropped. 
     542 * @param pct_lost  Percent lost (0-100). Set to zero to disable packet 
     543 *                  lost simulation. 
     544 * 
     545 * @return          PJ_SUCCESS on success. 
     546 */ 
     547PJ_INLINE(pj_status_t) pjmedia_transport_simulate_lost(pjmedia_transport *tp, 
     548                                                       pjmedia_dir dir, 
     549                                                       unsigned pct_lost) 
     550{ 
     551    return (*tp->op->simulate_lost)(tp, dir, pct_lost); 
     552} 
     553 
    429554 
    430555PJ_END_DECL 
Note: See TracChangeset for help on using the changeset viewer.