|
|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2010-2015 by Jonathan Naylor G4KLX
|
|
|
|
|
* Copyright (c) 2017,2018 by Thomas A. Early N7TAE
|
|
|
|
|
* Copyright (C) 2010-2015,2018 by Jonathan Naylor G4KLX
|
|
|
|
|
* copyright (c) 2021 by Geoffrey F4FXL / KC3FRA
|
|
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
@ -17,60 +17,152 @@
|
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
#ifndef IRCDDBGatewayThread_H
|
|
|
|
|
#define IRCDDBGatewayThread_H
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
#include "DExtraProtocolHandlerPool.h" // DEXTRA_LINK
|
|
|
|
|
#include "DCSProtocolHandlerPool.h" // DCS_LINK
|
|
|
|
|
#include "DummyRepeaterProtocolHandler.h"
|
|
|
|
|
#include "IcomRepeaterProtocolHandler.h"
|
|
|
|
|
#include "HBRepeaterProtocolHandler.h"
|
|
|
|
|
#include "DExtraProtocolHandlerPool.h"
|
|
|
|
|
#include "DPlusProtocolHandlerPool.h"
|
|
|
|
|
#include "RepeaterProtocolHandler.h"
|
|
|
|
|
#include "DStarGatewayStatusData.h"
|
|
|
|
|
#include "DCSProtocolHandlerPool.h"
|
|
|
|
|
#include "G2ProtocolHandler.h"
|
|
|
|
|
#include "RemoteHandler.h"
|
|
|
|
|
#include "CacheManager.h"
|
|
|
|
|
#include "CallsignList.h"
|
|
|
|
|
#include "APRSWriter.h"
|
|
|
|
|
#include "IRCDDB.h"
|
|
|
|
|
#include "Timer.h"
|
|
|
|
|
#include "Defs.h"
|
|
|
|
|
#include "Thread.h"
|
|
|
|
|
#if defined(ENABLE_NAT_TRAVERSAL)
|
|
|
|
|
#include "NatTraversalHandler.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
class CDStarGatewayThread {
|
|
|
|
|
class CDStarGatewayThread : public CThread{
|
|
|
|
|
public:
|
|
|
|
|
CDStarGatewayThread(unsigned int countDExtra, unsigned int countDCS);
|
|
|
|
|
CDStarGatewayThread(const std::string& logDir, const std::string& name);
|
|
|
|
|
virtual ~CDStarGatewayThread();
|
|
|
|
|
|
|
|
|
|
virtual void setCallsign(const std::string& callsign);
|
|
|
|
|
virtual void setAddress(const std::string& address);
|
|
|
|
|
|
|
|
|
|
virtual void addGroup(const std::string& callsign, const std::string& logoff, const std::string& repeater, const std::string& infoText, const std::string& permanent,
|
|
|
|
|
unsigned int userTimeout, CALLSIGN_SWITCH callsignSwitch, bool txMsgSwitch, const std::string& reflector);
|
|
|
|
|
|
|
|
|
|
virtual void setRemote(bool enabled, const std::string& password, unsigned int port);
|
|
|
|
|
virtual void setGateway(GATEWAY_TYPE type, const std::string& callsign, const std::string& address);
|
|
|
|
|
virtual void addRepeater(const std::string& callsign, const std::string& band, const std::string& address, unsigned int port, HW_TYPE hwType, const std::string& reflector, bool atStartup, RECONNECT reconnect, bool dratsEnabled, double frequency, double offset, double range, double latitude, double longitude, double agl, const std::string& description1, const std::string& description2, const std::string& url, IRepeaterProtocolHandler* handler, unsigned char band1 = 0x00U, unsigned char band2 = 0x00U, unsigned char band3 = 0x00U);
|
|
|
|
|
#ifdef USE_STARNET
|
|
|
|
|
#if defined(DEXTRA_LINK) || defined(DCS_LINK)
|
|
|
|
|
virtual void addStarNet(const std::string& callsign, const std::string& logoff, const std::string& repeater, const std::string& infoText, const std::string& permanent, unsigned int userTimeout, unsigned int groupTimeout, STARNET_CALLSIGN_SWITCH callsignSwitch, bool txMsgSwitch, const std::string& reflector);
|
|
|
|
|
#else
|
|
|
|
|
virtual void addStarNet(const std::string& callsign, const std::string& logoff, const std::string& repeater, const std::string& infoText, const std::string& permanent, unsigned int userTimeout, unsigned int groupTimeout, STARNET_CALLSIGN_SWITCH callsignSwitch, bool txMsgSwitch);
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
virtual void setIcomRepeaterHandler(CIcomRepeaterProtocolHandler* handler);
|
|
|
|
|
virtual void setHBRepeaterHandler(CHBRepeaterProtocolHandler* handler);
|
|
|
|
|
virtual void setDummyRepeaterHandler(CDummyRepeaterProtocolHandler* handler);
|
|
|
|
|
virtual void setIRC(CIRCDDB* irc);
|
|
|
|
|
virtual void setLanguage(TEXT_LANG language);
|
|
|
|
|
virtual void setDExtra(bool enabled, unsigned int maxDongles);
|
|
|
|
|
virtual void setDPlus(bool enabled, unsigned int maxDongles, const std::string& login);
|
|
|
|
|
virtual void setDCS(bool enabled);
|
|
|
|
|
virtual void setXLX(bool enabled, const std::string& fileName);
|
|
|
|
|
#ifdef USE_CCS
|
|
|
|
|
virtual void setCCS(bool enabled, const std::string& host);
|
|
|
|
|
#endif
|
|
|
|
|
virtual void setLog(bool enabled);
|
|
|
|
|
virtual void setAPRSWriter(CAPRSWriter* writer);
|
|
|
|
|
virtual void setInfoEnabled(bool enabled);
|
|
|
|
|
virtual void setEchoEnabled(bool enabled);
|
|
|
|
|
virtual void setDTMFEnabled(bool enabled);
|
|
|
|
|
virtual void setDDModeEnabled(bool enabled);
|
|
|
|
|
virtual void setRemote(bool enabled, const std::string& password, unsigned int port);
|
|
|
|
|
virtual void setLocation(double latitude, double longitude);
|
|
|
|
|
virtual void setWhiteList(CCallsignList* list);
|
|
|
|
|
virtual void setBlackList(CCallsignList* list);
|
|
|
|
|
virtual void setRestrictList(CCallsignList* list);
|
|
|
|
|
|
|
|
|
|
virtual CIRCDDBGatewayStatusData* getStatus() const;
|
|
|
|
|
|
|
|
|
|
virtual void run();
|
|
|
|
|
virtual void kill();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
unsigned int m_countDExtra;
|
|
|
|
|
unsigned int m_countDCS;
|
|
|
|
|
bool m_killed;
|
|
|
|
|
bool m_stopped;
|
|
|
|
|
std::string m_callsign;
|
|
|
|
|
std::string m_address;
|
|
|
|
|
|
|
|
|
|
CG2ProtocolHandler *m_g2Handler;
|
|
|
|
|
CIRCDDB *m_irc;
|
|
|
|
|
CCacheManager m_cache;
|
|
|
|
|
bool m_logEnabled;
|
|
|
|
|
CTimer m_statusTimer;
|
|
|
|
|
IRCDDB_STATUS m_lastStatus;
|
|
|
|
|
bool m_remoteEnabled;
|
|
|
|
|
std::string m_remotePassword;
|
|
|
|
|
unsigned int m_remotePort;
|
|
|
|
|
CRemoteHandler *m_remote;
|
|
|
|
|
void* Entry();
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::string m_logDir;
|
|
|
|
|
std::string m_name;
|
|
|
|
|
bool m_killed;
|
|
|
|
|
bool m_stopped;
|
|
|
|
|
GATEWAY_TYPE m_gatewayType;
|
|
|
|
|
std::string m_gatewayCallsign;
|
|
|
|
|
std::string m_gatewayAddress;
|
|
|
|
|
CIcomRepeaterProtocolHandler* m_icomRepeaterHandler;
|
|
|
|
|
CHBRepeaterProtocolHandler* m_hbRepeaterHandler;
|
|
|
|
|
CDummyRepeaterProtocolHandler* m_dummyRepeaterHandler;
|
|
|
|
|
CDExtraProtocolHandlerPool* m_dextraPool;
|
|
|
|
|
CDPlusProtocolHandlerPool* m_dplusPool;
|
|
|
|
|
CDCSProtocolHandlerPool* m_dcsPool;
|
|
|
|
|
CG2ProtocolHandler* m_g2Handler;
|
|
|
|
|
#if defined(ENABLE_NAT_TRAVERSAL)
|
|
|
|
|
CNatTraversalHandler* m_natTraversal;
|
|
|
|
|
#endif
|
|
|
|
|
CAPRSWriter* m_aprsWriter;
|
|
|
|
|
CIRCDDB* m_irc;
|
|
|
|
|
CCacheManager m_cache;
|
|
|
|
|
TEXT_LANG m_language;
|
|
|
|
|
bool m_dextraEnabled;
|
|
|
|
|
unsigned int m_dextraMaxDongles;
|
|
|
|
|
bool m_dplusEnabled;
|
|
|
|
|
unsigned int m_dplusMaxDongles;
|
|
|
|
|
std::string m_dplusLogin;
|
|
|
|
|
bool m_dcsEnabled;
|
|
|
|
|
bool m_xlxEnabled;
|
|
|
|
|
std::string m_xlxHostsFileName;
|
|
|
|
|
bool m_ccsEnabled;
|
|
|
|
|
std::string m_ccsHost;
|
|
|
|
|
bool m_infoEnabled;
|
|
|
|
|
bool m_echoEnabled;
|
|
|
|
|
bool m_dtmfEnabled;
|
|
|
|
|
bool m_logEnabled;
|
|
|
|
|
bool m_ddModeEnabled;
|
|
|
|
|
IRCDDB_STATUS m_lastStatus;
|
|
|
|
|
CTimer m_statusTimer1;
|
|
|
|
|
CTimer m_statusTimer2;
|
|
|
|
|
bool m_remoteEnabled;
|
|
|
|
|
std::string m_remotePassword;
|
|
|
|
|
unsigned int m_remotePort;
|
|
|
|
|
CRemoteHandler* m_remote;
|
|
|
|
|
CTimer m_statusFileTimer;
|
|
|
|
|
std::string m_status1;
|
|
|
|
|
std::string m_status2;
|
|
|
|
|
std::string m_status3;
|
|
|
|
|
std::string m_status4;
|
|
|
|
|
std::string m_status5;
|
|
|
|
|
double m_latitude;
|
|
|
|
|
double m_longitude;
|
|
|
|
|
CCallsignList* m_whiteList;
|
|
|
|
|
CCallsignList* m_blackList;
|
|
|
|
|
CCallsignList* m_restrictList;
|
|
|
|
|
|
|
|
|
|
void processIrcDDB();
|
|
|
|
|
void processRepeater(IRepeaterProtocolHandler* handler);
|
|
|
|
|
void processDExtra();
|
|
|
|
|
void processDPlus();
|
|
|
|
|
void processDCS();
|
|
|
|
|
void processG2();
|
|
|
|
|
void loadReflectors(const std::string fname, DSTAR_PROTOCOL dstarProtocol);
|
|
|
|
|
void processDD();
|
|
|
|
|
|
|
|
|
|
void loadGateways();
|
|
|
|
|
void loadAllReflectors();
|
|
|
|
|
void loadReflectors(std::string hostFileName, DSTAR_PROTOCOL proto);
|
|
|
|
|
void loadDExtraReflectors(const std::string& fileName);
|
|
|
|
|
void loadDPlusReflectors(const std::string& fileName);
|
|
|
|
|
void loadDCSReflectors(const std::string& fileName);
|
|
|
|
|
void loadXLXReflectors();
|
|
|
|
|
|
|
|
|
|
void writeStatus();
|
|
|
|
|
|
|
|
|
|
void processDExtra(CDExtraProtocolHandlerPool *dextraPool);
|
|
|
|
|
void processDCS(CDCSProtocolHandlerPool *dcsPool);
|
|
|
|
|
void readStatusFiles();
|
|
|
|
|
void readStatusFile(const std::string& filename, unsigned int n, std::string& var);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|