- Timestamp:
- Aug 15, 2018 2:44:53 AM (6 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 8 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c
r5845 r5855 267 267 pjmedia_transport *member_tp; /**< Underlying transport. */ 268 268 pj_bool_t member_tp_attached; 269 pj_bool_t started; 269 270 270 271 /* SRTP usage policy of peer. This field is updated when media is starting. … … 1051 1052 if (status != PJ_SUCCESS) 1052 1053 return status; 1054 1055 PJ_LOG(4, (srtp->pool->obj_name, 1056 "SRTP started, keying=%s, crypto=%s", 1057 (srtp->keying[0]->type==PJMEDIA_SRTP_KEYING_SDES? 1058 "SDES":"DTLS-SRTP"), 1059 srtp->tx_policy.name.ptr)); 1053 1060 } 1054 1061 … … 1579 1586 srtp->offerer_side = (sdp_remote == NULL); 1580 1587 1588 if (!srtp->offerer_side && srtp->started) { 1589 /* This is may be incoming reoffer that may change keying */ 1590 srtp->bypass_srtp = PJ_FALSE; 1591 srtp->keying_cnt = srtp->all_keying_cnt; 1592 for (i = 0; i < srtp->all_keying_cnt; ++i) 1593 srtp->keying[i] = srtp->all_keying[i]; 1594 } 1595 1581 1596 status = pjmedia_transport_encode_sdp(srtp->member_tp, sdp_pool, 1582 1597 sdp_local, sdp_remote, media_index); … … 1611 1626 keying_status = st; 1612 1627 continue; 1613 } 1614 1615 if (!srtp_crypto_empty(&srtp->tx_policy_neg) && 1616 !srtp_crypto_empty(&srtp->rx_policy_neg)) 1617 { 1618 /* SRTP nego is done */ 1628 } else if (!srtp->offerer_side) { 1629 /* Answer with one keying only */ 1630 srtp->keying[0] = srtp->keying[i]; 1619 1631 srtp->keying_cnt = 1; 1620 srtp->keying[0] = srtp->keying[i];1621 srtp->keying_pending_cnt = 0;1622 1632 break; 1623 1633 } … … 1629 1639 if (srtp->keying_cnt == 0) 1630 1640 return keying_status; 1641 1642 /* Bypass SRTP & skip keying as SRTP is disabled and verification on 1643 * remote SDP has been done. 1644 */ 1645 if (srtp->setting.use == PJMEDIA_SRTP_DISABLED) { 1646 srtp->bypass_srtp = PJ_TRUE; 1647 srtp->keying_cnt = 0; 1648 } 1649 1650 if (srtp->keying_cnt != 0) { 1651 /* At this point for now, keying count should be 1 */ 1652 pj_assert(srtp->keying_cnt == 1); 1653 PJ_LOG(4, (srtp->pool->obj_name, "SRTP uses keying method %s", 1654 (srtp->keying[0]->type==PJMEDIA_SRTP_KEYING_SDES? 1655 "SDES":"DTLS-SRTP"))); 1656 } 1631 1657 1632 1658 return PJ_SUCCESS; … … 1646 1672 1647 1673 PJ_ASSERT_RETURN(tp, PJ_EINVAL); 1674 1675 /* At this point for now, keying count should be 0 or 1 */ 1676 pj_assert(srtp->keying_cnt <= 1); 1677 1678 srtp->started = PJ_TRUE; 1648 1679 1649 1680 status = pjmedia_transport_media_start(srtp->member_tp, pool, … … 1717 1748 PJ_ASSERT_RETURN(tp, PJ_EINVAL); 1718 1749 1750 srtp->started = PJ_FALSE; 1751 1719 1752 /* Invoke media_stop() of all keying methods */ 1720 1753 for (i=0; i < srtp->keying_cnt; ++i) { -
pjproject/trunk/pjmedia/src/pjmedia/transport_srtp_dtls.c
r5852 r5855 190 190 191 191 pj_ansi_strncpy(ds->base.name, pool->obj_name, PJ_MAX_OBJ_NAME); 192 ds->base.type = PJMEDIA_ TRANSPORT_TYPE_SRTP;192 ds->base.type = PJMEDIA_SRTP_KEYING_DTLS_SRTP; 193 193 ds->base.op = &dtls_op; 194 194 ds->base.user_data = srtp; … … 1075 1075 */ 1076 1076 pjmedia_sdp_media *m_rem = sdp_remote->media[media_index]; 1077 pjmedia_sdp_attr *attr_ setup, *attr_fp;1077 pjmedia_sdp_attr *attr_fp; 1078 1078 pj_uint32_t rem_proto = 0; 1079 1079 … … 1095 1095 } 1096 1096 1097 /* Check for a=setup in remote SDP. */ 1098 attr_setup = pjmedia_sdp_media_find_attr(m_rem, &ID_SETUP, NULL); 1099 if (!attr_setup) 1100 attr_setup = pjmedia_sdp_attr_find(sdp_remote->attr_count, 1101 sdp_remote->attr, &ID_SETUP, NULL); 1097 /* Check for a=fingerprint in remote SDP. */ 1102 1098 switch (ds->srtp->setting.use) { 1103 1099 case PJMEDIA_SRTP_DISABLED: 1104 if (attr_ setup) {1100 if (attr_fp) { 1105 1101 status = PJMEDIA_SRTP_ESDPINTRANSPORT; 1106 1102 goto on_return; … … 1110 1106 break; 1111 1107 case PJMEDIA_SRTP_MANDATORY: 1112 if (!attr_setup) { 1108 if (!attr_fp) { 1109 /* Should never reach here, this is already checked */ 1113 1110 status = PJMEDIA_SRTP_ESDPINTRANSPORT; 1114 1111 goto on_return; -
pjproject/trunk/pjmedia/src/pjmedia/transport_srtp_sdes.c
r5820 r5855 79 79 pj_ansi_strncpy(sdes->name, srtp->pool->obj_name, PJ_MAX_OBJ_NAME); 80 80 pj_memcpy(sdes->name, "sdes", 4); 81 sdes->type = PJMEDIA_ TRANSPORT_TYPE_SRTP;81 sdes->type = PJMEDIA_SRTP_KEYING_SDES; 82 82 sdes->op = &sdes_op; 83 83 sdes->user_data = srtp;
Note: See TracChangeset
for help on using the changeset viewer.