Ignore:
Timestamp:
Mar 11, 2008 9:38:05 PM (14 years ago)
Author:
bennylp
Message:

Ticket #479: allow media transport framework to return transport specific info (for example, to know whether SRTP is enabled)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c

    r1810 r1860  
    126126 */ 
    127127static pj_status_t transport_get_info (pjmedia_transport *tp, 
    128                                        pjmedia_sock_info *info); 
     128                                       pjmedia_transport_info *info); 
    129129static pj_status_t transport_attach   (pjmedia_transport *tp, 
    130130                                       void *user_data, 
     
    552552 
    553553static pj_status_t transport_get_info(pjmedia_transport *tp, 
    554                                       pjmedia_sock_info *info) 
     554                                      pjmedia_transport_info *info) 
    555555{ 
    556556    transport_srtp *srtp = (transport_srtp*) tp; 
    557  
    558     /* put SRTP info as well? */ 
    559     return pjmedia_transport_get_info(srtp->real_tp, info); 
     557    pjmedia_srtp_info srtp_info; 
     558    int spc_info_idx; 
     559    pj_status_t status; 
     560 
     561    PJ_ASSERT_RETURN(tp && info, PJ_EINVAL); 
     562    PJ_ASSERT_RETURN(info->specific_info_cnt < 
     563                     PJMEDIA_TRANSPORT_SPECIFIC_INFO_MAXCNT, PJ_ETOOMANY); 
     564    PJ_ASSERT_RETURN(sizeof(pjmedia_srtp_info) <= 
     565                     PJMEDIA_TRANSPORT_SPECIFIC_INFO_MAXSIZE, PJ_ENOMEM); 
     566 
     567    status = pjmedia_transport_get_info(srtp->real_tp, info); 
     568    if (status != PJ_SUCCESS) 
     569        return status; 
     570 
     571    srtp_info.active = srtp->session_inited; 
     572    srtp_info.rx_policy = srtp->rx_policy; 
     573    srtp_info.tx_policy = srtp->tx_policy; 
     574 
     575    spc_info_idx = info->specific_info_cnt++; 
     576    info->spc_info[spc_info_idx].type = PJMEDIA_TRANSPORT_TYPE_SRTP; 
     577    info->spc_info[spc_info_idx].cbsize = sizeof(srtp_info); 
     578    pj_memcpy(&info->spc_info[spc_info_idx].buffer, &srtp_info,  
     579              sizeof(srtp_info)); 
     580 
     581    return PJ_SUCCESS; 
    560582} 
    561583 
Note: See TracChangeset for help on using the changeset viewer.