From 294498c8439563c8463258f7c7950dcce0764b8d Mon Sep 17 00:00:00 2001 From: Tom Early Date: Tue, 26 Oct 2021 06:04:31 -0700 Subject: [PATCH] it compiles --- src/BMClient.cpp | 2 +- src/BMPeer.cpp | 2 +- src/{CBPTC19696.cpp => BPTC19696.cpp} | 2 +- src/{CBPTC19696.h => BPTC19696.h} | 0 src/DExtraProtocol.cpp | 12 +-- src/DExtraProtocol.h | 4 +- src/DMRMMDVMProtocol.cpp | 8 +- src/DMRMMDVMProtocol.h | 2 +- src/DMRPlusProtocol.cpp | 8 +- src/DMRPlusProtocol.h | 2 +- src/Makefile | 105 ++++++++++++++++++++++++++ 11 files changed, 126 insertions(+), 21 deletions(-) rename src/{CBPTC19696.cpp => BPTC19696.cpp} (99%) rename src/{CBPTC19696.h => BPTC19696.h} (100%) create mode 100644 src/Makefile diff --git a/src/BMClient.cpp b/src/BMClient.cpp index b220ec7..4167c71 100644 --- a/src/BMClient.cpp +++ b/src/BMClient.cpp @@ -43,5 +43,5 @@ CBmClient::CBmClient(const CBmClient &client) bool CBmClient::IsAlive(void) const { - return (m_LastKeepaliveTime.DurationSinceNow() < XLX_KEEPALIVE_TIMEOUT); + return (m_LastKeepaliveTime.time() < XLX_KEEPALIVE_TIMEOUT); } diff --git a/src/BMPeer.cpp b/src/BMPeer.cpp index baf98f1..89e33bc 100644 --- a/src/BMPeer.cpp +++ b/src/BMPeer.cpp @@ -50,7 +50,7 @@ CBmPeer::CBmPeer(const CCallsign &callsign, const CIp &ip, const char *modules, bool CBmPeer::IsAlive(void) const { - return (m_LastKeepaliveTime.DurationSinceNow() < XLX_KEEPALIVE_TIMEOUT); + return (m_LastKeepaliveTime.time() < XLX_KEEPALIVE_TIMEOUT); } //////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/CBPTC19696.cpp b/src/BPTC19696.cpp similarity index 99% rename from src/CBPTC19696.cpp rename to src/BPTC19696.cpp index db537c6..fe9d0bb 100644 --- a/src/CBPTC19696.cpp +++ b/src/BPTC19696.cpp @@ -21,7 +21,7 @@ #include #include -#include "CBPTC19696.h" +#include "BPTC19696.h" #include "Hamming.h" #include "Utils.h" diff --git a/src/CBPTC19696.h b/src/BPTC19696.h similarity index 100% rename from src/CBPTC19696.h rename to src/BPTC19696.h diff --git a/src/DExtraProtocol.cpp b/src/DExtraProtocol.cpp index 6b4799e..2df1414 100644 --- a/src/DExtraProtocol.cpp +++ b/src/DExtraProtocol.cpp @@ -35,8 +35,8 @@ bool CDextraProtocol::Initialize(const char *type, int ptype, const uint16_t por return false; // update time - m_LastKeepaliveTime.Now(); - m_LastPeersLinkTime.Now(); + m_LastKeepaliveTime.start(); + m_LastPeersLinkTime.start(); // done return true; @@ -194,23 +194,23 @@ void CDextraProtocol::Task(void) HandleQueue(); // keep alive - if ( m_LastKeepaliveTime.DurationSinceNow() > DEXTRA_KEEPALIVE_PERIOD ) + if ( m_LastKeepaliveTime.time() > DEXTRA_KEEPALIVE_PERIOD ) { // handle keep alives HandleKeepalives(); // update time - m_LastKeepaliveTime.Now(); + m_LastKeepaliveTime.start(); } // peer connections - if ( m_LastPeersLinkTime.DurationSinceNow() > DEXTRA_RECONNECT_PERIOD ) + if ( m_LastPeersLinkTime.time() > DEXTRA_RECONNECT_PERIOD ) { // handle remote peers connections HandlePeerLinks(); // update time - m_LastPeersLinkTime.Now(); + m_LastPeersLinkTime.start(); } } diff --git a/src/DExtraProtocol.h b/src/DExtraProtocol.h index 844ce88..41b1b8e 100644 --- a/src/DExtraProtocol.h +++ b/src/DExtraProtocol.h @@ -89,6 +89,6 @@ protected: protected: // time - CTimePoint m_LastKeepaliveTime; - CTimePoint m_LastPeersLinkTime; + CTimer m_LastKeepaliveTime; + CTimer m_LastPeersLinkTime; }; diff --git a/src/DMRMMDVMProtocol.cpp b/src/DMRMMDVMProtocol.cpp index 9542b87..df71382 100644 --- a/src/DMRMMDVMProtocol.cpp +++ b/src/DMRMMDVMProtocol.cpp @@ -22,7 +22,7 @@ #include "DMRMMDVMProtocol.h" #include "Reflector.h" #include "GateKeeper.h" -#include "CBPTC19696.h" +#include "BPTC19696.h" #include "RS129.h" #include "Golay2087.h" #include "QR1676.h" @@ -54,7 +54,7 @@ bool CDmrmmdvmProtocol::Initialize(const char *type, const int ptype, const uint return false; // update time - m_LastKeepaliveTime.Now(); + m_LastKeepaliveTime.start(); // random number generator time_t t; @@ -240,13 +240,13 @@ void CDmrmmdvmProtocol::Task(void) // keep client alive - if ( m_LastKeepaliveTime.DurationSinceNow() > DMRMMDVM_KEEPALIVE_PERIOD ) + if ( m_LastKeepaliveTime.time() > DMRMMDVM_KEEPALIVE_PERIOD ) { // HandleKeepalives(); // update time - m_LastKeepaliveTime.Now(); + m_LastKeepaliveTime.start(); } } diff --git a/src/DMRMMDVMProtocol.h b/src/DMRMMDVMProtocol.h index 3694350..4aee151 100644 --- a/src/DMRMMDVMProtocol.h +++ b/src/DMRMMDVMProtocol.h @@ -111,7 +111,7 @@ protected: protected: // for keep alive - CTimePoint m_LastKeepaliveTime; + CTimer m_LastKeepaliveTime; // for stream id uint16_t m_uiStreamId; diff --git a/src/DMRPlusProtocol.cpp b/src/DMRPlusProtocol.cpp index 18e9fd3..abdfbb0 100644 --- a/src/DMRPlusProtocol.cpp +++ b/src/DMRPlusProtocol.cpp @@ -23,7 +23,7 @@ #include "Reflector.h" #include "GateKeeper.h" #include "DMRIdDir.h" -#include "CBPTC19696.h" +#include "BPTC19696.h" #include "RS129.h" #include "Golay2087.h" #include "QR1676.h" @@ -47,7 +47,7 @@ bool CDmrplusProtocol::Initialize(const char *type, const int ptype, const uint1 return false; // update time - m_LastKeepaliveTime.Now(); + m_LastKeepaliveTime.start(); // random number generator time_t t; @@ -165,13 +165,13 @@ void CDmrplusProtocol::Task(void) // keep client alive - if ( m_LastKeepaliveTime.DurationSinceNow() > DMRPLUS_KEEPALIVE_PERIOD ) + if ( m_LastKeepaliveTime.time() > DMRPLUS_KEEPALIVE_PERIOD ) { // HandleKeepalives(); // update time - m_LastKeepaliveTime.Now(); + m_LastKeepaliveTime.start(); } } diff --git a/src/DMRPlusProtocol.h b/src/DMRPlusProtocol.h index 612d6a5..039aec2 100644 --- a/src/DMRPlusProtocol.h +++ b/src/DMRPlusProtocol.h @@ -97,7 +97,7 @@ protected: protected: // for keep alive - CTimePoint m_LastKeepaliveTime; + CTimer m_LastKeepaliveTime; // for queue header caches std::array m_StreamsCache; diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..9c7ff3e --- /dev/null +++ b/src/Makefile @@ -0,0 +1,105 @@ +# Copyright (c) 2021 by Thomas A. Early N7TAE +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# locations for the executibles and other files are set here +# NOTE: IF YOU CHANGE THESE, YOU WILL NEED TO UPDATE THE service.* FILES AND +# if you change these locations, make sure the sgs.service file is updated! +# you will also break hard coded paths in the dashboard file, index.php. + +include configure.mk + +# if you make changed in these two variable, you'll need to change things +# in the main.h file as well as the systemd service file. +BINDIR = /usr/local/bin +CFGDIR = /usr/local/etc +DATADIR = /var/lib/xlxd + +CC = g++ + +ifeq ($(debug), true) +CFLAGS = -ggdb3 -W -Werror -c -std=c++11 -MMD -MD -c +else +CFLAGS = -c -W -Werror -std=c++11 -MMD -MD -c +endif + +LDFLAGS=-pthread + +XRFSRCS = Buffer.cpp Callsign.cpp CallsignList.cpp CallsignListItem.cpp Client.cpp Clients.cpp DCSClient.cpp DCSProtocol.cpp DExtraClient.cpp DExtraPeer.cpp DExtraProtocol.cpp DPlusClient.cpp DPlusProtocol.cpp DVFramePacket.cpp DVHeaderPacket.cpp DVLastFramePacket.cpp GateKeeper.cpp IP.cpp Notification.cpp Packet.cpp PacketStream.cpp PeerCallsignList.cpp Peer.cpp Peers.cpp ProtoAddress.cpp Protocol.cpp Protocols.cpp Reflector.cpp UDPSocket.cpp User.cpp Users.cpp Version.cpp Main.cpp +XLXSRCS = BMClient.cpp BMPeer.cpp BPTC19696.cpp CRC.cpp DMRIdDir.cpp DMRIdDirFile.cpp DMRIdDirHttp.cpp DMRMMDVMClient.cpp DMRMMDVMProtocol.cpp DMRPlusClient.cpp DMRPlusProtocol.cpp Golay2087.cpp Golay24128.cpp Hamming.cpp QR1676.cpp RS129.cpp Semaphore.cpp Utils.cpp WiresXCmd.cpp WiresXCmdHandler.cpp WiresXInfo.cpp ULXClient.cpp ULXProtocol.cpp ULXPeer.cpp YSFClient.cpp YSFConvolution.cpp YSFFich.cpp YSFNode.cpp YSFNodeDir.cpp YSFNodeDirFile.cpp YSFNodeDirHttp.cpp YSFPayload.cpp YSFProtocol.cpp YSFUtils.cpp +G3SRCS = G3Client.cpp G3Protocol.cpp RawSocket.cpp UDPMsgSocket.cpp + +SRCS = $(XRFSRCS) + +ifeq ($(is_xlx), true) +SRCS += $(XLXSRCS) +ifeq ($(ysf_db), true) +LDFLAGS += `mysql_config --libs` +endif +endif + +ifdef tc_ip +SRCS += Transcoder.cpp CodecStream.cpp +endif + +ifeq ($(use_g3), true) +SRCS += $(G3SRCS) +endif + +OBJS = $(SRCS:.cpp=.o) +DEPS = $(SRCS:.cpp=.d) + +ifeq ($(is_xlx), true) +EXE=ulxd +else +EXE=xrfd +endif + +all : $(EXE) + +$(EXE) : $(OBJS) + $(CC) $^ -o $@ $(LDFLAGS) + +%.o : %.cpp + g++ $(CFLAGS) $< -o $@ + +clean : + $(RM) *.o *.d ulxd xrfd + +-include $(DEPS) + +install : + ln -s $(shell pwd)/$(EXE).blacklist $(CFGDIR)/$(EXE).blacklist + ln -s $(shell pwd)/$(EXE).whitelist $(CFGDIR)/$(EXE).whitelist + ln -s $(shell pwd)/$(EXE).interlink $(CFGDIR)/$(EXE).interlink +ifeq ($(use_g3), true) + ln -s $(shell pwd)/$(EXE).terminal $(CFGDIR)/$(EXE).terminal +endif + cp -f ../systemd/$(EXE).service /etc/systemd/system/ + cp -f $(EXE) $(BINDIR) + mkdir -p $(DATADIR) + systemctl enable $(EXE).service + systemctl daemon-reload + systemctl start $(EXE) + +uninstall : + rm -f $(CFGDIR)/$(EXE).blacklist + rm -f $(CFGDIR)/$(EXE).whitelist + rm -f $(CFGDIR)/$(EXE).interlink + rm -f $(CFGDIR)/$(EXE).terminal + systemctl stop $(EXE).service + rm -f $(CFGDIR)/dmrid.dat + systemctl disable $(EXE).service + rm -f /etc/systemd/system/$(EXE).service + systemctl daemon-reload