multiplex: Add add_zrtp_ctx() function
This commit is contained in:
parent
954e85f481
commit
0f2cdf55f8
|
@ -76,7 +76,7 @@ namespace uvgrtp {
|
||||||
* Other error return codes are defined in {conn,writer,reader,srtp}.hh */
|
* Other error return codes are defined in {conn,writer,reader,srtp}.hh */
|
||||||
rtp_error_t init(std::shared_ptr<uvgrtp::zrtp> zrtp);
|
rtp_error_t init(std::shared_ptr<uvgrtp::zrtp> zrtp);
|
||||||
/// \endcond
|
/// \endcond
|
||||||
|
rtp_error_t add_zrtp_ctx();
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* \brief Add keying information for user-managed SRTP session
|
* \brief Add keying information for user-managed SRTP session
|
||||||
|
|
|
@ -324,7 +324,6 @@ rtp_error_t uvgrtp::media_stream::init()
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
||||||
if (rce_flags_ & RCE_RTCP) {
|
if (rce_flags_ & RCE_RTCP) {
|
||||||
|
|
||||||
reception_flow_->new_install_handler(
|
reception_flow_->new_install_handler(
|
||||||
6, remote_ssrc_,
|
6, remote_ssrc_,
|
||||||
std::bind(&uvgrtp::rtcp::new_recv_packet_handler_common, rtcp_, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
|
std::bind(&uvgrtp::rtcp::new_recv_packet_handler_common, rtcp_, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
|
||||||
|
@ -337,6 +336,15 @@ rtp_error_t uvgrtp::media_stream::init()
|
||||||
std::bind(&uvgrtp::rtcp::new_recv_packet_handler, rtcp_, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
|
std::bind(&uvgrtp::rtcp::new_recv_packet_handler, rtcp_, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
|
||||||
std::placeholders::_4, std::placeholders::_5), nullptr);
|
std::placeholders::_4, std::placeholders::_5), nullptr);
|
||||||
}
|
}
|
||||||
|
if (rce_flags_ & RCE_SRTP) {
|
||||||
|
srtp_ = std::shared_ptr<uvgrtp::srtp>(new uvgrtp::srtp(rce_flags_));
|
||||||
|
srtcp_ = std::shared_ptr<uvgrtp::srtcp>(new uvgrtp::srtcp());
|
||||||
|
|
||||||
|
reception_flow_->new_install_handler(
|
||||||
|
4, remote_ssrc_,
|
||||||
|
std::bind(&uvgrtp::srtp::new_recv_packet_handler, srtp_, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
|
||||||
|
std::placeholders::_4, std::placeholders::_5), srtp_.get());
|
||||||
|
}
|
||||||
|
|
||||||
return start_components();
|
return start_components();
|
||||||
}
|
}
|
||||||
|
@ -371,7 +379,7 @@ rtp_error_t uvgrtp::media_stream::init(std::shared_ptr<uvgrtp::zrtp> zrtp)
|
||||||
}
|
}
|
||||||
|
|
||||||
reception_flow_->new_install_handler(
|
reception_flow_->new_install_handler(
|
||||||
1, remote_ssrc_,
|
3, remote_ssrc_,
|
||||||
std::bind(&uvgrtp::zrtp::new_packet_handler, zrtp, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
|
std::bind(&uvgrtp::zrtp::new_packet_handler, zrtp, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
|
||||||
std::placeholders::_4, std::placeholders::_5),
|
std::placeholders::_4, std::placeholders::_5),
|
||||||
nullptr);
|
nullptr);
|
||||||
|
@ -425,7 +433,10 @@ rtp_error_t uvgrtp::media_stream::init(std::shared_ptr<uvgrtp::zrtp> zrtp)
|
||||||
|
|
||||||
return start_components();
|
return start_components();
|
||||||
}
|
}
|
||||||
|
rtp_error_t uvgrtp::media_stream::add_zrtp_ctx()
|
||||||
|
{
|
||||||
|
return RTP_OK;
|
||||||
|
}
|
||||||
rtp_error_t uvgrtp::media_stream::add_srtp_ctx(uint8_t *key, uint8_t *salt)
|
rtp_error_t uvgrtp::media_stream::add_srtp_ctx(uint8_t *key, uint8_t *salt)
|
||||||
{
|
{
|
||||||
if (!key || !salt)
|
if (!key || !salt)
|
||||||
|
@ -445,7 +456,7 @@ rtp_error_t uvgrtp::media_stream::add_srtp_ctx(uint8_t *key, uint8_t *salt)
|
||||||
|
|
||||||
rtp_ = std::shared_ptr<uvgrtp::rtp> (new uvgrtp::rtp(fmt_, ssrc_, ipv6_));
|
rtp_ = std::shared_ptr<uvgrtp::rtp> (new uvgrtp::rtp(fmt_, ssrc_, ipv6_));
|
||||||
|
|
||||||
srtp_ = std::shared_ptr<uvgrtp::srtp> (new uvgrtp::srtp(rce_flags_));
|
//srtp_ = std::shared_ptr<uvgrtp::srtp> (new uvgrtp::srtp(rce_flags_));
|
||||||
|
|
||||||
// why are they local and remote key/salt the same?
|
// why are they local and remote key/salt the same?
|
||||||
if ((ret = srtp_->init(SRTP, rce_flags_, key, key, salt, salt)) != RTP_OK) {
|
if ((ret = srtp_->init(SRTP, rce_flags_, key, key, salt, salt)) != RTP_OK) {
|
||||||
|
@ -453,7 +464,7 @@ rtp_error_t uvgrtp::media_stream::add_srtp_ctx(uint8_t *key, uint8_t *salt)
|
||||||
return free_resources(ret);
|
return free_resources(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
srtcp_ = std::shared_ptr<uvgrtp::srtcp> (new uvgrtp::srtcp());
|
// srtcp_ = std::shared_ptr<uvgrtp::srtcp> (new uvgrtp::srtcp());
|
||||||
|
|
||||||
if ((ret = srtcp_->init(SRTCP, rce_flags_, key, key, salt, salt)) != RTP_OK) {
|
if ((ret = srtcp_->init(SRTCP, rce_flags_, key, key, salt, salt)) != RTP_OK) {
|
||||||
UVG_LOG_WARN("Failed to initialize SRTCP for media stream!");
|
UVG_LOG_WARN("Failed to initialize SRTCP for media stream!");
|
||||||
|
@ -485,12 +496,12 @@ rtp_error_t uvgrtp::media_stream::add_srtp_ctx(uint8_t *key, uint8_t *salt)
|
||||||
std::bind(&uvgrtp::rtcp::new_recv_packet_handler, rtcp_, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
|
std::bind(&uvgrtp::rtcp::new_recv_packet_handler, rtcp_, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
|
||||||
std::placeholders::_4, std::placeholders::_5), nullptr);
|
std::placeholders::_4, std::placeholders::_5), nullptr);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
reception_flow_->new_install_handler(
|
reception_flow_->new_install_handler(
|
||||||
4, remote_ssrc_,
|
4, remote_ssrc_,
|
||||||
std::bind(&uvgrtp::srtp::new_recv_packet_handler, srtp_, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
|
std::bind(&uvgrtp::srtp::new_recv_packet_handler, srtp_, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
|
||||||
std::placeholders::_4, std::placeholders::_5), srtp_.get());
|
std::placeholders::_4, std::placeholders::_5), srtp_.get());
|
||||||
|
*/
|
||||||
return start_components();
|
return start_components();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,7 @@ namespace uvgrtp {
|
||||||
/* Derive new key using s0 as HMAC key */
|
/* Derive new key using s0 as HMAC key */
|
||||||
void derive_key(const char *label, uint32_t key_len, uint8_t *key);
|
void derive_key(const char *label, uint32_t key_len, uint8_t *key);
|
||||||
|
|
||||||
|
rtp_error_t new_begin_session();
|
||||||
/* Being the ZRTP session by sending a Hello message to remote,
|
/* Being the ZRTP session by sending a Hello message to remote,
|
||||||
* and responding to remote's Hello message using HelloAck message
|
* and responding to remote's Hello message using HelloAck message
|
||||||
*
|
*
|
||||||
|
@ -194,6 +195,7 @@ namespace uvgrtp {
|
||||||
|
|
||||||
bool dh_finished_ = false;
|
bool dh_finished_ = false;
|
||||||
int state_;
|
int state_;
|
||||||
|
std::mutex state_mutex_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue