zrtp: Improve debug prints

This commit is contained in:
Joni Räsänen 2022-08-24 15:50:11 +03:00
parent 9099f4526f
commit f21a81bec4
6 changed files with 17 additions and 6 deletions

View File

@ -143,6 +143,8 @@ namespace uvgrtp {
std::string get_socket_path_string() const;
std::string sockaddr_to_string(const sockaddr_in& addr) const;
/* Get reference to the actual socket object */
socket_t& get_raw_socket();
@ -164,8 +166,6 @@ namespace uvgrtp {
private:
std::string sockaddr_to_string(const sockaddr_in& addr) const;
/* helper function for sending UPD packets, see documentation for sendto() above */
rtp_error_t __sendto(sockaddr_in& addr, uint8_t *buf, size_t buf_len, int send_flags, int *bytes_sent);
rtp_error_t __recv(uint8_t *buf, size_t buf_len, int recv_flags, int *bytes_read);

View File

@ -82,7 +82,7 @@ uvgrtp::frame::zrtp_frame *uvgrtp::frame::alloc_zrtp_frame(size_t size)
return nullptr;
}
UVG_LOG_DEBUG("Allocate ZRTP frame, packet size %zu", size);
//UVG_LOG_DEBUG("Allocate ZRTP frame, packet size %zu", size);
uvgrtp::frame::zrtp_frame *frame = (uvgrtp::frame::zrtp_frame *)new uint8_t[size];

View File

@ -308,7 +308,7 @@ rtp_error_t uvgrtp::socket::__sendtov(
#endif
#ifndef NDEBUG
sent_packets_ += buffers.size();
++sent_packets_;
#endif // !NDEBUG
set_bytes(bytes_sent, sent_bytes);

View File

@ -676,6 +676,8 @@ rtp_error_t uvgrtp::zrtp::init_dhm(uint32_t ssrc, std::shared_ptr<uvgrtp::socket
{
rtp_error_t ret = RTP_OK;
UVG_LOG_DEBUG("Starting ZRTP Diffie-Hellman negotiation with %s", socket->sockaddr_to_string(addr).c_str());
/* TODO: set all fields initially to zero */
memset(session_.hash_ctx.o_hvi, 0, sizeof(session_.hash_ctx.o_hvi));
@ -779,6 +781,8 @@ rtp_error_t uvgrtp::zrtp::init_msm(uint32_t ssrc, std::shared_ptr<uvgrtp::socket
session_.ssrc = ssrc;
session_.seq = 0;
UVG_LOG_DEBUG("Generating ZRTP keys in multistream mode");
if ((ret = begin_session()) != RTP_OK) {
UVG_LOG_ERROR("Session initialization failed, ZRTP cannot be used!");
return ret;

View File

@ -69,7 +69,7 @@ void uvgrtp::zrtp_msg::zrtp_message::set_zrtp_start_base(uvgrtp::zrtp_msg::zrtp_
start.length = length/4 - 1;
memcpy(&start.msgblock, msgblock.c_str(), 8);
UVG_LOG_DEBUG("Constructed ZRTP header. Length: %u", start.length);
UVG_LOG_DEBUG("Constructed ZRTP header. Size: %u, Length-field: %u", length, start.length);
}
void uvgrtp::zrtp_msg::zrtp_message::set_zrtp_start(uvgrtp::zrtp_msg::zrtp_msg& start,

View File

@ -49,7 +49,14 @@ rtp_error_t uvgrtp::zrtp_msg::receiver::recv_msg(std::shared_ptr<uvgrtp::socket>
int nread = 0;
rlen_ = 0;
UVG_LOG_DEBUG("Waiting for ZRTP messages with timeout of %i ms", timeout);
if (timeout > 0)
{
UVG_LOG_DEBUG("Waiting for ZRTP messages with timeout of %i ms", timeout);
}
else
{
UVG_LOG_DEBUG("Checking if there is a ZRTP message in buffer");
}
#ifdef _WIN32
if ((ret = uvgrtp::poll::blocked_recv(socket, mem_, len_, timeout, &nread)) != RTP_OK) {