zrtp: Improve debug prints
This commit is contained in:
parent
9099f4526f
commit
f21a81bec4
|
@ -143,6 +143,8 @@ namespace uvgrtp {
|
||||||
|
|
||||||
std::string get_socket_path_string() const;
|
std::string get_socket_path_string() const;
|
||||||
|
|
||||||
|
std::string sockaddr_to_string(const sockaddr_in& addr) const;
|
||||||
|
|
||||||
/* Get reference to the actual socket object */
|
/* Get reference to the actual socket object */
|
||||||
socket_t& get_raw_socket();
|
socket_t& get_raw_socket();
|
||||||
|
|
||||||
|
@ -164,8 +166,6 @@ namespace uvgrtp {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::string sockaddr_to_string(const sockaddr_in& addr) const;
|
|
||||||
|
|
||||||
/* helper function for sending UPD packets, see documentation for sendto() above */
|
/* 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 __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);
|
rtp_error_t __recv(uint8_t *buf, size_t buf_len, int recv_flags, int *bytes_read);
|
||||||
|
|
|
@ -82,7 +82,7 @@ uvgrtp::frame::zrtp_frame *uvgrtp::frame::alloc_zrtp_frame(size_t size)
|
||||||
return nullptr;
|
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];
|
uvgrtp::frame::zrtp_frame *frame = (uvgrtp::frame::zrtp_frame *)new uint8_t[size];
|
||||||
|
|
||||||
|
|
|
@ -308,7 +308,7 @@ rtp_error_t uvgrtp::socket::__sendtov(
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
sent_packets_ += buffers.size();
|
++sent_packets_;
|
||||||
#endif // !NDEBUG
|
#endif // !NDEBUG
|
||||||
|
|
||||||
set_bytes(bytes_sent, sent_bytes);
|
set_bytes(bytes_sent, sent_bytes);
|
||||||
|
|
|
@ -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;
|
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 */
|
/* TODO: set all fields initially to zero */
|
||||||
memset(session_.hash_ctx.o_hvi, 0, sizeof(session_.hash_ctx.o_hvi));
|
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_.ssrc = ssrc;
|
||||||
session_.seq = 0;
|
session_.seq = 0;
|
||||||
|
|
||||||
|
UVG_LOG_DEBUG("Generating ZRTP keys in multistream mode");
|
||||||
|
|
||||||
if ((ret = begin_session()) != RTP_OK) {
|
if ((ret = begin_session()) != RTP_OK) {
|
||||||
UVG_LOG_ERROR("Session initialization failed, ZRTP cannot be used!");
|
UVG_LOG_ERROR("Session initialization failed, ZRTP cannot be used!");
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -69,7 +69,7 @@ void uvgrtp::zrtp_msg::zrtp_message::set_zrtp_start_base(uvgrtp::zrtp_msg::zrtp_
|
||||||
start.length = length/4 - 1;
|
start.length = length/4 - 1;
|
||||||
memcpy(&start.msgblock, msgblock.c_str(), 8);
|
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,
|
void uvgrtp::zrtp_msg::zrtp_message::set_zrtp_start(uvgrtp::zrtp_msg::zrtp_msg& start,
|
||||||
|
|
|
@ -49,7 +49,14 @@ rtp_error_t uvgrtp::zrtp_msg::receiver::recv_msg(std::shared_ptr<uvgrtp::socket>
|
||||||
int nread = 0;
|
int nread = 0;
|
||||||
rlen_ = 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
|
#ifdef _WIN32
|
||||||
if ((ret = uvgrtp::poll::blocked_recv(socket, mem_, len_, timeout, &nread)) != RTP_OK) {
|
if ((ret = uvgrtp::poll::blocked_recv(socket, mem_, len_, timeout, &nread)) != RTP_OK) {
|
||||||
|
|
Loading…
Reference in New Issue