From 9a10a686c0ac92c6be57783ffff324e2c7a29294 Mon Sep 17 00:00:00 2001 From: Tom Early Date: Thu, 4 Apr 2019 10:54:02 -0700 Subject: [PATCH] logging changes --- DPlusAuthenticator.cpp | 13 ++++++++----- DPlusAuthenticator.h | 2 +- QnetLink.cpp | 11 +++++++++++ QnetLink.h | 2 +- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/DPlusAuthenticator.cpp b/DPlusAuthenticator.cpp index 4afed65..82ce9bb 100644 --- a/DPlusAuthenticator.cpp +++ b/DPlusAuthenticator.cpp @@ -51,10 +51,10 @@ bool CDPlusAuthenticator::Process(std::map &gwy_map, c fprintf(stderr, "DPlus Authorization failed: %s\n", gai_strerror(result)); return true; } - return authenticate(m_loginCallsign, gwy_map, reflectors, repeaters); + return authenticate(gwy_map, reflectors, repeaters); } -bool CDPlusAuthenticator::authenticate(const std::string &callsign, std::map &gwy_map, const bool reflectors, const bool repeaters) +bool CDPlusAuthenticator::authenticate(std::map &gwy_map, const bool reflectors, const bool repeaters) { unsigned char* buffer = new unsigned char[4096U]; ::memset(buffer, ' ', 56U); @@ -64,7 +64,7 @@ bool CDPlusAuthenticator::authenticate(const std::string &callsign, std::map0U && name.size()>0U && active) { + returned++; if (reflectors && 0==name.compare(0, 3, "REF")) gwy_map[name] = address.append(" 20001"); else if (repeaters && name.compare(0, 3, "REF")) @@ -117,8 +119,9 @@ bool CDPlusAuthenticator::authenticate(const std::string &callsign, std::map &gwy_map, const bool reflectors, const bool repeaters); + bool authenticate(std::map &gwy_map, const bool reflectors, const bool repeaters); }; diff --git a/QnetLink.cpp b/QnetLink.cpp index cf75aa5..bf9b9b1 100644 --- a/QnetLink.cpp +++ b/QnetLink.cpp @@ -585,6 +585,7 @@ bool CQnetLink::read_config(const char *cfgFile) cfg.GetValue(key+"link2gate", estr, link2gate, 1, FILENAME_MAX); cfg.GetValue("log_qso", estr, qso_details); + cfg.GetValue("log_debug", estr, log_debug); key.assign("file_"); cfg.GetValue(key+"gwys", estr, gwys, 2, FILENAME_MAX); @@ -1786,6 +1787,8 @@ void CQnetLink::Process() } /* linked repeaters request */ } else if (length==4 && buf[0]==4 && buf[1]==192 && buf[2]==5 && buf[3]==0) { + if (log_debug) + printf("Got a linked repeater request!\n"); unsigned short i_idx = 0; unsigned short j_idx = 0; unsigned short k_idx = 0; @@ -1870,6 +1873,8 @@ void CQnetLink::Process() } /* connected user list request */ } else if (length==4 && buf[0]==4 && buf[1]==192 && buf[2]==6 && buf[3]==0) { + if (log_debug) + printf("Got a linked dongle request!!\n"); unsigned short i_idx = 0; unsigned short j_idx = 0; unsigned short k_idx = 0; @@ -1949,6 +1954,8 @@ void CQnetLink::Process() } /* date request */ } else if (length== 4 && buf[0]==4 && buf[1]==192 && buf[2]==8 && buf[3]==0) { + if (log_debug) + printf("Got a dongle time request!!\n"); time_t ltime; struct tm tm; @@ -1973,6 +1980,8 @@ void CQnetLink::Process() } /* version request */ } else if (length== 4 && buf[0]==4 && buf[1]==192 && buf[2]==3 && buf[3]==0) { + if (log_debug) + printf("Got a version request!!\n"); auto pos = inbound_list.find(ip); if (pos != inbound_list.end()) { //SINBOUND *inbound = (SINBOUND *)pos->second; @@ -1986,6 +1995,8 @@ void CQnetLink::Process() } } else if (length==5 && buf[0]==5 && buf[1]==0 && buf[2]==24 && buf[3]==0 && buf[4]==0) { + if (log_debug) + printf("Got a disconnect request!!\n"); /* reply with the same DISCONNECT */ sendto(ref_g2_sock, buf, 5, 0, (struct sockaddr *)&fromDst4, sizeof(struct sockaddr_in)); diff --git a/QnetLink.h b/QnetLink.h index 75ce24f..e384a4e 100644 --- a/QnetLink.h +++ b/QnetLink.h @@ -84,7 +84,7 @@ private: /* configuration data */ std::string login_call, owner, to_g2_external_ip, my_g2_link_ip, gwys, status_file, qnvoice_file, announce_dir; - bool only_admin_login, only_link_unlink, qso_details, bool_rptr_ack, announce; + bool only_admin_login, only_link_unlink, qso_details, log_debug, bool_rptr_ack, announce; bool dplus_authorize, dplus_reflectors, dplus_repeaters, dplus_priority; int rmt_xrf_port, rmt_ref_port, rmt_dcs_port, my_g2_link_port, to_g2_external_port, delay_between, delay_before; std::string link_at_startup[3];