UDPC_LoggingType::UDPC_ERROR,
"Failed to init ConnectionData instance (libsodium "
"init fail) while client establishing connection with ",
- conditional_atostr(UDPC_LoggingType::UDPC_ERROR,
- event.conId.addr),
+ event.conId.addr,
" port ",
event.conId.port);
continue;
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_INFO,
"Client initiating connection to ",
- conditional_atostr(UDPC_LoggingType::UDPC_INFO,
- event.conId.addr),
+ event.conId.addr,
" port ",
event.conId.port,
" ...");
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_WARNING,
"Client initiate connection, already connected to peer ",
- conditional_atostr(UDPC_LoggingType::UDPC_WARNING,
- event.conId.addr),
+ event.conId.addr,
" port ",
event.conId.port);
}
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_VERBOSE,
"Timed out connection with ",
- conditional_atostr(UDPC_LoggingType::UDPC_VERBOSE,
- iter->first.addr),
+ iter->first.addr,
", port = ",
iter->second.port);
continue;
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_VERBOSE,
"Switching to bad mode in connection with ",
- conditional_atostr(UDPC_LoggingType::UDPC_VERBOSE,
- iter->first.addr),
+ iter->first.addr,
", port = ",
iter->second.port);
iter->second.flags.reset(1);
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_VERBOSE,
"Switching to good mode in connection with ",
- conditional_atostr(UDPC_LoggingType::UDPC_VERBOSE,
- iter->first.addr),
+ iter->first.addr,
", port = ",
iter->second.port);
iter->second.flags.set(1);
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_DEBUG,
"Not queueing packet to ",
- conditional_atostr(UDPC_LoggingType::UDPC_DEBUG,
- next->receiver.addr),
+ next->receiver.addr,
", port = ",
next->receiver.port,
", connection's queue reached max size");
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_WARNING,
"Dropped queued packets to ",
- conditional_atostr(UDPC_LoggingType::UDPC_WARNING,
- next->receiver.addr),
+ next->receiver.addr,
", port = ",
next->receiver.port,
" due to connection not existing");
iter->second.sk) != 0) {
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_ERROR,
"Failed to sign packet for peer ",
- conditional_atostr(UDPC_LoggingType::UDPC_ERROR,
- iter->first.addr),
+ iter->first.addr,
", port ",
iter->second.port);
continue;
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_ERROR,
"Failed to send disconnect packet to ",
- conditional_atostr(UDPC_LoggingType::UDPC_ERROR,
- iter->first.addr),
+ iter->first.addr,
", port = ",
iter->second.port);
continue;
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_ERROR,
"Failed to send packet to initiate connection to ",
- conditional_atostr(UDPC_LoggingType::UDPC_ERROR,
- iter->first.addr),
+ iter->first.addr,
", port = ",
iter->second.port);
continue;
this,
UDPC_LoggingType::UDPC_INFO,
"Sent initiate connection to ",
- conditional_atostr(UDPC_LoggingType::UDPC_INFO,
- iter->first.addr),
+ iter->first.addr,
", port = ",
iter->second.port,
flags.test(2) && iter->second.flags.test(6) ?
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_ERROR,
"Failed to send packet to initiate connection to ",
- conditional_atostr(UDPC_LoggingType::UDPC_ERROR,
- iter->first.addr),
+ iter->first.addr,
", port = ",
iter->second.port);
continue;
}
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_DEBUG,
"Sent init pkt to client ",
- conditional_atostr(UDPC_LoggingType::UDPC_DEBUG,
- destinationInfo.sin6_addr),
+ destinationInfo.sin6_addr,
", port ", iter->second.port);
}
continue;
iter->second.sk) != 0) {
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_ERROR,
"Failed to sign packet for peer ",
- conditional_atostr(UDPC_LoggingType::UDPC_ERROR,
- iter->first.addr),
+ iter->first.addr,
", port ",
iter->second.port);
continue;
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_ERROR,
"Failed to send heartbeat packet to ",
- conditional_atostr(UDPC_LoggingType::UDPC_ERROR,
- iter->first.addr),
+ iter->first.addr,
", port = ",
iter->second.port);
continue;
iter->second.sk) != 0) {
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_ERROR,
"Failed to sign packet for peer ",
- conditional_atostr(UDPC_LoggingType::UDPC_ERROR,
- iter->first.addr),
+ iter->first.addr,
", port ",
iter->second.port);
std::free(pInfo.data);
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_ERROR,
"Failed to send packet to ",
- conditional_atostr(UDPC_LoggingType::UDPC_ERROR,
- iter->first.addr),
+ iter->first.addr,
", port = ",
iter->second.port);
std::free(pInfo.data);
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_VERBOSE,
"Received packet is smaller than header, ignoring packet from ",
- conditional_atostr(UDPC_LoggingType::UDPC_VERBOSE,
- receivedData.sin6_addr),
+ receivedData.sin6_addr,
", port = ",
ntohs(receivedData.sin6_port));
continue;
UDPC_LoggingType::UDPC_VERBOSE,
"Received packet has invalid protocol id, ignoring packet "
"from ",
- conditional_atostr(UDPC_LoggingType::UDPC_VERBOSE,
- receivedData.sin6_addr),
+ receivedData.sin6_addr,
", port = ",
ntohs(receivedData.sin6_port));
continue;
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_VERBOSE,
"Got connect packet of invalid size from ",
- conditional_atostr(UDPC_LoggingType::UDPC_VERBOSE,
- receivedData.sin6_addr),
+ receivedData.sin6_addr,
", port = ",
ntohs(receivedData.sin6_port),
", ignoring");
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_VERBOSE,
"Got non-connect packet of invalid size from ",
- conditional_atostr(UDPC_LoggingType::UDPC_VERBOSE,
- receivedData.sin6_addr),
+ receivedData.sin6_addr,
", port = ",
ntohs(receivedData.sin6_port),
", ignoring");
default:
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_WARNING,
"Got invalid connect pktType from ",
- conditional_atostr(UDPC_LoggingType::UDPC_WARNING,
- receivedData.sin6_addr),
+ receivedData.sin6_addr,
", port ", ntohs(receivedData.sin6_port));
continue;
}
} else {
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_WARNING,
"Got invalid pktType from ",
- conditional_atostr(UDPC_LoggingType::UDPC_WARNING,
- receivedData.sin6_addr),
+ receivedData.sin6_addr,
", port ", ntohs(receivedData.sin6_port));
continue;
}
== UDPC_AuthPolicy::UDPC_AUTH_POLICY_STRICT) {
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_ERROR,
"Client peer ",
- conditional_atostr(UDPC_LoggingType::UDPC_ERROR,
- receivedData.sin6_addr),
+ receivedData.sin6_addr,
" port ",
ntohs(receivedData.sin6_port),
" attempted connection with packet authentication "
== UDPC_AuthPolicy::UDPC_AUTH_POLICY_STRICT) {
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_ERROR,
"Client peer ",
- conditional_atostr(UDPC_LoggingType::UDPC_ERROR,
- receivedData.sin6_addr),
+ receivedData.sin6_addr,
" port ",
ntohs(receivedData.sin6_port),
" attempted connection with packet authentication "
UDPC_LoggingType::UDPC_ERROR,
"Failed to init ConnectionData instance (libsodium init"
" fail) while server establishing connection with ",
- conditional_atostr(UDPC_LoggingType::UDPC_ERROR,
- receivedData.sin6_addr),
+ receivedData.sin6_addr,
", port = ",
ntohs(receivedData.sin6_port));
continue;
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_INFO,
"Establishing connection with client ",
- conditional_atostr(UDPC_LoggingType::UDPC_INFO,
- receivedData.sin6_addr),
+ receivedData.sin6_addr,
", port = ",
ntohs(receivedData.sin6_port),
", giving client id = ", newConnection.id,
if(iter == conMap.end() || !iter->second.flags.test(3)) {
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_DEBUG,
"client dropped pkt from ",
- conditional_atostr(UDPC_LoggingType::UDPC_DEBUG,
- receivedData.sin6_addr),
+ receivedData.sin6_addr,
", port ", ntohs(receivedData.sin6_port));
continue;
}
// without auth (if fallback).
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_ERROR,
"Server peer ",
- conditional_atostr(UDPC_LoggingType::UDPC_ERROR,
- receivedData.sin6_addr),
+ receivedData.sin6_addr,
" port ",
ntohs(receivedData.sin6_port),
" attempted connection with packet authentication "
== UDPC_AuthPolicy::UDPC_AUTH_POLICY_STRICT) {
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_ERROR,
"Server peer ",
- conditional_atostr(UDPC_LoggingType::UDPC_ERROR,
- receivedData.sin6_addr),
+ receivedData.sin6_addr,
" port ",
ntohs(receivedData.sin6_port),
" attempted connection with packet authentication "
iter->second.peer_pk) != 0) {
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_WARNING,
"Failed to verify peer (server) ",
- conditional_atostr(UDPC_LoggingType::UDPC_WARNING,
- receivedData.sin6_addr),
+ receivedData.sin6_addr,
", port = ",
ntohs(receivedData.sin6_port));
continue;
iter->second.flags.set(4);
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_INFO,
"Established connection with server ",
- conditional_atostr(UDPC_LoggingType::UDPC_INFO,
- receivedData.sin6_addr),
+ receivedData.sin6_addr,
", port = ",
ntohs(receivedData.sin6_port),
", got id = ", conID,
this,
UDPC_LoggingType::UDPC_INFO,
"Failed to verify received packet from",
- conditional_atostr(UDPC_LoggingType::UDPC_INFO,
- receivedData.sin6_addr),
+ receivedData.sin6_addr,
", port = ",
ntohs(receivedData.sin6_port),
", ignoring");
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_VERBOSE,
"Received valid packet from ",
- conditional_atostr(UDPC_LoggingType::UDPC_VERBOSE,
- receivedData.sin6_addr),
+ receivedData.sin6_addr,
", port = ",
ntohs(receivedData.sin6_port),
", packet id = ", seqID,
} while (true);
}
-const char *UDPC::Context::conditional_atostr(UDPC_LoggingType logType,
- UDPC_IPV6_ADDR_TYPE addr) {
- if (willLog(logType)) {
- return UDPC_atostr((UDPC_HContext)this, addr);
- } else {
- return "";
- }
-}
-
UDPC::Context *UDPC::verifyContext(UDPC_HContext ctx) {
if(ctx == nullptr) {
return nullptr;
ctx->authPolicy.exchange(UDPC_AuthPolicy::UDPC_AUTH_POLICY_FALLBACK);
UDPC_CHECK_LOG(ctx, UDPC_LoggingType::UDPC_INFO, "Got listen addr ",
- ctx->conditional_atostr(UDPC_LoggingType::UDPC_INFO, listenId.addr));
+ listenId.addr);
if(isUsingLibsodium) {
#ifdef UDPC_LIBSODIUM_ENABLED