format log wrt [ip]:port

pull/14/head
Tom Early 7 years ago
parent 99f97e98b3
commit 04a620dbe1

@ -1050,7 +1050,7 @@ void CQnetGateway::ProcessG2(const ssize_t g2buflen, const SDSVT &g2buf, const b
if (LOG_QSO) { if (LOG_QSO) {
printf("id=%04x flags=%02x:%02x:%02x ur=%.8s r1=%.8s r2=%.8s my=%.8s/%.4s ", ntohs(g2buf.streamid), g2buf.hdr.flag[0], g2buf.hdr.flag[1], g2buf.hdr.flag[2], g2buf.hdr.urcall, g2buf.hdr.rpt1, g2buf.hdr.rpt2, g2buf.hdr.mycall, g2buf.hdr.sfx); printf("id=%04x flags=%02x:%02x:%02x ur=%.8s r1=%.8s r2=%.8s my=%.8s/%.4s ", ntohs(g2buf.streamid), g2buf.hdr.flag[0], g2buf.hdr.flag[1], g2buf.hdr.flag[2], g2buf.hdr.urcall, g2buf.hdr.rpt1, g2buf.hdr.rpt2, g2buf.hdr.mycall, g2buf.hdr.sfx);
if (is_from_g2) if (is_from_g2)
printf("IP=%s-%u\n", fromDstar.GetAddress(), fromDstar.GetPort()); printf("IP=[%s]:%u\n", fromDstar.GetAddress(), fromDstar.GetPort());
else else
printf("UnixSock=%s\n", link2gate.c_str()); printf("UnixSock=%s\n", link2gate.c_str());
} }
@ -1370,7 +1370,7 @@ void CQnetGateway::ProcessModem()
for (int j=0; j<5; j++) for (int j=0; j<5; j++)
sendto(g2_sock, dsvt.title, 56, 0, to_remote_g2[i].toDstar.GetPointer(), to_remote_g2[i].toDstar.GetSize()); sendto(g2_sock, dsvt.title, 56, 0, to_remote_g2[i].toDstar.GetPointer(), to_remote_g2[i].toDstar.GetSize());
printf("id=%04x zone route to IP=%s on port %u ur=%.8s r1=%.8s r2=%.8s my=%.8s/%.4s\n", printf("id=%04x zone route to [%s]:%u ur=%.8s r1=%.8s r2=%.8s my=%.8s/%.4s\n",
ntohs(dsvt.streamid), to_remote_g2[i].toDstar.GetAddress(), to_remote_g2[i].toDstar.GetPort(), ntohs(dsvt.streamid), to_remote_g2[i].toDstar.GetAddress(), to_remote_g2[i].toDstar.GetPort(),
dsvt.hdr.urcall, dsvt.hdr.rpt1, dsvt.hdr.rpt2, dsvt.hdr.mycall, dsvt.hdr.sfx); dsvt.hdr.urcall, dsvt.hdr.rpt1, dsvt.hdr.rpt2, dsvt.hdr.mycall, dsvt.hdr.sfx);
@ -1424,7 +1424,7 @@ void CQnetGateway::ProcessModem()
for (int j=0; j<5; j++) for (int j=0; j<5; j++)
sendto(g2_sock, dsvt.title, 56, 0, to_remote_g2[i].toDstar.GetPointer(), to_remote_g2[i].toDstar.GetSize()); sendto(g2_sock, dsvt.title, 56, 0, to_remote_g2[i].toDstar.GetPointer(), to_remote_g2[i].toDstar.GetSize());
printf("CS route to IP=%s on port %u id=%04x my=%.8s/%.4s ur=%.8s rpt1=%.8s rpt2=%.8s\n", to_remote_g2[i].toDstar.GetAddress(), to_remote_g2[i].toDstar.GetPort(), ntohs(dsvt.streamid), dsvt.hdr.mycall, dsvt.hdr.sfx, dsvt.hdr.urcall, dsvt.hdr.rpt1, dsvt.hdr.rpt2); printf("Callsign route to [%s]:%u id=%04x my=%.8s/%.4s ur=%.8s rpt1=%.8s rpt2=%.8s\n", to_remote_g2[i].toDstar.GetAddress(), to_remote_g2[i].toDstar.GetPort(), ntohs(dsvt.streamid), dsvt.hdr.mycall, dsvt.hdr.sfx, dsvt.hdr.urcall, dsvt.hdr.rpt1, dsvt.hdr.rpt2);
time(&(to_remote_g2[i].last_time)); time(&(to_remote_g2[i].last_time));
} }

@ -57,7 +57,7 @@ bool CTCPReaderWriterClient::Open()
} }
if (0 == m_address.size() || 0 == m_port.size() || 0 == std::stoul(m_port)) { if (0 == m_address.size() || 0 == m_port.size() || 0 == std::stoul(m_port)) {
fprintf(stderr, "ERROR: '%s:%s' is malformed!\n", m_address.c_str(), m_port.c_str()); fprintf(stderr, "ERROR: '[%s]:%s' is malformed!\n", m_address.c_str(), m_port.c_str());
return true; return true;
} }
@ -106,7 +106,7 @@ bool CTCPReaderWriterClient::Open()
addr = &(addr6->sin6_addr); addr = &(addr6->sin6_addr);
} }
if (inet_ntop(rp->ai_family, addr, buf, INET6_ADDRSTRLEN)) if (inet_ntop(rp->ai_family, addr, buf, INET6_ADDRSTRLEN))
fprintf(stderr, "Successfully connected to %s at %s on port %s\n", m_address.c_str(), buf, m_port.c_str()); fprintf(stderr, "Successfully connected to %s at [%s]:%s\n", m_address.c_str(), buf, m_port.c_str());
break; break;
} }
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.