multiplex: In ZRTP header, use network byte order for Magic Cookie. Also detect received ZRTP messages with it.

This commit is contained in:
Heikki Tampio 2023-06-14 12:32:37 +03:00
parent e472c6c956
commit 38c12ba6d2
2 changed files with 8 additions and 1 deletions

View File

@ -674,6 +674,13 @@ void uvgrtp::reception_flow::process_packet(int rce_flags)
}
}
/* -------------------- ZRTP check -------------------- */
if (ntohl((uint32_t)ptr[4]) == 0x5a525450) {
// TODO: Add functionality
UVG_LOG_INFO("ZRTP message");
}
// Here we don't lock ring mutex because the chaging is only done above.
// NOTE: If there is a need for multiple processing threads, the read should be guarded
switch ((ret = (*handler.second.primary)(ring_buffer_[ring_read_index_].read,

View File

@ -59,7 +59,7 @@ void uvgrtp::zrtp_msg::zrtp_message::set_zrtp_start_base(uvgrtp::zrtp_msg::zrtp_
std::string msgblock)
{
start.header.version = 0;
start.header.magic = ZRTP_MAGIC;
start.header.magic = htonl(ZRTP_MAGIC);
start.preamble = ZRTP_PREAMBLE;
start.length = packet_to_header_len(len_);
memcpy(&start.msgblock, msgblock.c_str(), 8);