From d3e5e80349747ce8cce3a85e206e51fc60e322a7 Mon Sep 17 00:00:00 2001 From: Tom Early Date: Mon, 9 Apr 2018 20:40:00 -0700 Subject: [PATCH] rename to QnetRelay --- Makefile | 26 ++++++++++++------------ QnetModem.cpp => QnetRelay.cpp | 36 +++++++++++++++++----------------- QnetModem.h => QnetRelay.h | 6 +++--- 3 files changed, 34 insertions(+), 34 deletions(-) rename QnetModem.cpp => QnetRelay.cpp (93%) rename QnetModem.h => QnetRelay.h (98%) diff --git a/Makefile b/Makefile index a2f021a..1a003ed 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ IRCOBJS = IRCDDB.o IRCClient.o IRCReceiver.o IRCMessageQueue.o IRCProtocol.o IRC SRCS = $(wildcard *.cpp) OBJS = $(SRCS:.cpp=.o) DEPS = $(SRCS:.cpp=.d) -PROGRAMS=qngateway qnlink qnmodem qndvap qndvrptr qnlinktest qnlinktestaudio +PROGRAMS=qngateway qnlink qnrelay qndvap qndvrptr qnlinktest qnlinktestaudio all : $(PROGRAMS) @@ -42,8 +42,8 @@ qngateway : $(IRCOBJS) QnetGateway.o aprs.o qnlink : QnetLink.o g++ $(CPPFLAGS) -o qnlink QnetLink.o $(LDFLAGS) -pthread -qnmodem : QnetModem.o - g++ $(CPPFLAGS) -o qnmodem QnetModem.o $(LDFLAGS) +qnrelay : QnetRelay.o + g++ $(CPPFLAGS) -o qnrelay QnetRelay.o $(LDFLAGS) qndvap : QnetDVAP.o DVAPDongle.o $(DSTROBJS) g++ $(CPPFLAGS) -o qndvap QnetDVAP.o DVAPDongle.o $(DSTROBJS) $(LDFLAGS) -pthread @@ -67,7 +67,7 @@ clean: -include $(DEPS) -install : qngateway qnlink qnmodem +install : qngateway qnlink qnrelay ######### QnetGateway ######### /bin/cp -f qngateway $(BINDIR) /bin/cp -f qn.cfg $(CFGDIR) @@ -85,11 +85,11 @@ install : qngateway qnlink qnmodem systemctl daemon-reload systemctl start qnlink.service ######### QnetModem ######### - /bin/cp -f qnmodem $(BINDIR) - /bin/cp -f service.qnmodem /lib/systemd/system/qnmodem.service - systemctl enable qnmodem.service + /bin/cp -f qnrelay $(BINDIR) + /bin/cp -f service.qnrelay /lib/systemd/system/qnrelay.service + systemctl enable qnrelay.service systemctl daemon-reload - systemctl start qnmodem.service + systemctl start qnrelay.service installdvap : qngateway qnlink qndvap ######### QnetGateway ######### @@ -178,11 +178,11 @@ uninstall : /bin/rm -f $(CFGDIR)/RPT_STATUS.txt /bin/rm -f $(CFGDIR)/gwys.txt /bin/rm -f $(CFGDIR)/exec_?.sh - ######### QnetModem ######### - systemctl stop qnmodem.service - systemctl disable qnmodem.service - /bin/rm -f /lib/systemd/system/qnmodem.service - /bin/rm -f $(BINDIR)/qnmodem + ######### QnetRelay ######### + systemctl stop qnrelay.service + systemctl disable qnrelay.service + /bin/rm -f /lib/systemd/system/qnrelay.service + /bin/rm -f $(BINDIR)/qnrelay uninstalldvap : ######### QnetGateway ######### diff --git a/QnetModem.cpp b/QnetRelay.cpp similarity index 93% rename from QnetModem.cpp rename to QnetRelay.cpp index caa3ec7..492e6cd 100644 --- a/QnetModem.cpp +++ b/QnetRelay.cpp @@ -33,28 +33,28 @@ #include #include "versions.h" -#include "QnetModem.h" +#include "QnetRelay.h" #include "QnetTypeDefs.h" -std::atomic CQnetModem::keep_running(true); +std::atomic CQnetRelay::keep_running(true); -CQnetModem::CQnetModem() : +CQnetRelay::CQnetRelay() : seed(time(NULL)), COUNTER(0) { } -CQnetModem::~CQnetModem() +CQnetRelay::~CQnetRelay() { } -bool CQnetModem::Initialize(const char *cfgfile) +bool CQnetRelay::Initialize(const char *cfgfile) { if (ReadConfig(cfgfile)) return true; struct sigaction act; - act.sa_handler = &CQnetModem::SignalCatch; + act.sa_handler = &CQnetRelay::SignalCatch; sigemptyset(&act.sa_mask); if (sigaction(SIGTERM, &act, 0) != 0) { printf("sigaction-TERM failed, error=%d\n", errno); @@ -72,7 +72,7 @@ bool CQnetModem::Initialize(const char *cfgfile) return false; } -int CQnetModem::OpenSocket(const std::string &address, unsigned short port) +int CQnetRelay::OpenSocket(const std::string &address, unsigned short port) { if (! port) { printf("ERROR: OpenSocket: non-zero port must be specified.\n"); @@ -116,7 +116,7 @@ int CQnetModem::OpenSocket(const std::string &address, unsigned short port) return fd; } -void CQnetModem::Run(const char *cfgfile) +void CQnetRelay::Run(const char *cfgfile) { if (Initialize(cfgfile)) return; @@ -213,7 +213,7 @@ void CQnetModem::Run(const char *cfgfile) ::close(gsock); } -int CQnetModem::SendTo(const int fd, const unsigned char *buf, const int size, const std::string &address, const unsigned short port) +int CQnetRelay::SendTo(const int fd, const unsigned char *buf, const int size, const std::string &address, const unsigned short port) { sockaddr_in addr; ::memset(&addr, 0, sizeof(sockaddr_in)); @@ -229,7 +229,7 @@ int CQnetModem::SendTo(const int fd, const unsigned char *buf, const int size, c return len; } -bool CQnetModem::ProcessGateway(const int len, const unsigned char *raw) +bool CQnetRelay::ProcessGateway(const int len, const unsigned char *raw) { if (29==len || 58==len) { //here is dstar data SPKT buf; @@ -275,7 +275,7 @@ bool CQnetModem::ProcessGateway(const int len, const unsigned char *raw) return false; } -bool CQnetModem::ProcessMMDVM(const int len, const unsigned char *raw) +bool CQnetRelay::ProcessMMDVM(const int len, const unsigned char *raw) { static short stream_id = 0U; SMMDVMPKT mpkt; @@ -327,7 +327,7 @@ bool CQnetModem::ProcessMMDVM(const int len, const unsigned char *raw) return false; } -bool CQnetModem::GetValue(const Config &cfg, const char *path, int &value, const int min, const int max, const int default_value) +bool CQnetRelay::GetValue(const Config &cfg, const char *path, int &value, const int min, const int max, const int default_value) { if (cfg.lookupValue(path, value)) { if (value < min || value > max) @@ -338,7 +338,7 @@ bool CQnetModem::GetValue(const Config &cfg, const char *path, int &value, const return true; } -bool CQnetModem::GetValue(const Config &cfg, const char *path, double &value, const double min, const double max, const double default_value) +bool CQnetRelay::GetValue(const Config &cfg, const char *path, double &value, const double min, const double max, const double default_value) { if (cfg.lookupValue(path, value)) { if (value < min || value > max) @@ -349,7 +349,7 @@ bool CQnetModem::GetValue(const Config &cfg, const char *path, double &value, co return true; } -bool CQnetModem::GetValue(const Config &cfg, const char *path, bool &value, const bool default_value) +bool CQnetRelay::GetValue(const Config &cfg, const char *path, bool &value, const bool default_value) { if (! cfg.lookupValue(path, value)) value = default_value; @@ -357,7 +357,7 @@ bool CQnetModem::GetValue(const Config &cfg, const char *path, bool &value, cons return true; } -bool CQnetModem::GetValue(const Config &cfg, const char *path, std::string &value, int min, int max, const char *default_value) +bool CQnetRelay::GetValue(const Config &cfg, const char *path, std::string &value, int min, int max, const char *default_value) { if (cfg.lookupValue(path, value)) { int l = value.length(); @@ -372,7 +372,7 @@ bool CQnetModem::GetValue(const Config &cfg, const char *path, std::string &valu } // process configuration file and return true if there was a problem -bool CQnetModem::ReadConfig(const char *cfgFile) +bool CQnetRelay::ReadConfig(const char *cfgFile) { Config cfg; @@ -477,7 +477,7 @@ bool CQnetModem::ReadConfig(const char *cfgFile) return false; } -void CQnetModem::SignalCatch(const int signum) +void CQnetRelay::SignalCatch(const int signum) { if ((signum == SIGTERM) || (signum == SIGINT) || (signum == SIGHUP)) keep_running = false; @@ -500,7 +500,7 @@ int main(int argc, const char **argv) return 0; } - CQnetModem qnmmdvm; + CQnetRelay qnmmdvm; qnmmdvm.Run(argv[1]); diff --git a/QnetModem.h b/QnetRelay.h similarity index 98% rename from QnetModem.h rename to QnetRelay.h index 70929aa..e20d304 100644 --- a/QnetModem.h +++ b/QnetRelay.h @@ -29,12 +29,12 @@ using namespace libconfig; #define CALL_SIZE 8 #define IP_SIZE 15 -class CQnetModem +class CQnetRelay { public: // functions - CQnetModem(); - ~CQnetModem(); + CQnetRelay(); + ~CQnetRelay(); void Run(const char *cfgfile); // data