mirror of
https://github.com/g4klx/ircDDBGateway.git
synced 2026-04-05 14:25:43 +00:00
Merge remote-tracking branch 'upstream/master' into openwrt
This commit is contained in:
commit
b310efa1cd
71 changed files with 1884 additions and 1450 deletions
|
|
@ -77,6 +77,10 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(Configuration)\</IntDir>
|
||||
<IncludePath>$(WXWIN)\include;$(WXWIN)\lib\vc_dll\mswu;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(WXWIN)\include;$(WXWIN)\lib\vc_x64_dll\mswu;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<PreBuildEvent>
|
||||
|
|
@ -189,6 +193,7 @@
|
|||
<ClCompile Include="IRCDDBGatewayConfig.cpp" />
|
||||
<ClCompile Include="LogEvent.cpp" />
|
||||
<ClCompile Include="Logger.cpp" />
|
||||
<ClCompile Include="NatTraversalHandler.cpp" />
|
||||
<ClCompile Include="PollData.cpp" />
|
||||
<ClCompile Include="RemoteHandler.cpp" />
|
||||
<ClCompile Include="RemoteLinkData.cpp" />
|
||||
|
|
@ -260,6 +265,7 @@
|
|||
<ClInclude Include="IRCDDBGatewayConfig.h" />
|
||||
<ClInclude Include="LogEvent.h" />
|
||||
<ClInclude Include="Logger.h" />
|
||||
<ClInclude Include="NatTraversalHandler.h" />
|
||||
<ClInclude Include="PollData.h" />
|
||||
<ClInclude Include="ReflectorCallback.h" />
|
||||
<ClInclude Include="RemoteHandler.h" />
|
||||
|
|
|
|||
|
|
@ -209,6 +209,9 @@
|
|||
<ClCompile Include="XLXHostsFileDownloader.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="NatTraversalHandler.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="AMBEData.h">
|
||||
|
|
@ -433,5 +436,8 @@
|
|||
<ClInclude Include="XLXHostsFileDownloader.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="NatTraversalHandler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -39,6 +39,8 @@ CCallsignList* CDCSHandler::m_blackList = NULL;
|
|||
|
||||
CDCSHandler::CDCSHandler(IReflectorCallback* handler, const wxString& reflector, const wxString& repeater, CDCSProtocolHandler* protoHandler, const in_addr& address, unsigned int port, DIRECTION direction) :
|
||||
m_reflector(reflector.Clone()),
|
||||
m_xlxReflector(),
|
||||
m_isXlx(false),
|
||||
m_repeater(repeater.Clone()),
|
||||
m_handler(protoHandler),
|
||||
m_yourAddress(address),
|
||||
|
|
@ -78,6 +80,11 @@ m_rptCall2()
|
|||
m_linkState = DCS_LINKED;
|
||||
} else {
|
||||
m_linkState = DCS_LINKING;
|
||||
m_isXlx = m_reflector.StartsWith(wxT("XLX"));
|
||||
if (m_isXlx) {
|
||||
m_xlxReflector = m_reflector.Clone();
|
||||
m_reflector = wxT("DCS") + m_reflector.Right(m_reflector.length() - 3);
|
||||
}
|
||||
m_tryTimer.start();
|
||||
}
|
||||
}
|
||||
|
|
@ -162,10 +169,10 @@ void CDCSHandler::getInfo(IReflectorCallback* handler, CRemoteRepeaterData& data
|
|||
if (reflector->m_destination == handler) {
|
||||
if (reflector->m_direction == DIR_INCOMING && reflector->m_repeater.IsEmpty()) {
|
||||
if (reflector->m_linkState != DCS_UNLINKING)
|
||||
data.addLink(reflector->m_reflector, PROTO_DCS, reflector->m_linkState == DCS_LINKED, DIR_INCOMING, true);
|
||||
data.addLink(GET_DISP_REFLECTOR(reflector), PROTO_DCS, reflector->m_linkState == DCS_LINKED, DIR_INCOMING, true);
|
||||
} else {
|
||||
if (reflector->m_linkState != DCS_UNLINKING)
|
||||
data.addLink(reflector->m_reflector, PROTO_DCS, reflector->m_linkState == DCS_LINKED, reflector->m_direction, false);
|
||||
data.addLink(GET_DISP_REFLECTOR(reflector), PROTO_DCS, reflector->m_linkState == DCS_LINKED, reflector->m_direction, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -634,10 +641,10 @@ bool CDCSHandler::processInt(CConnectData& connect, CD_TYPE type)
|
|||
return false;
|
||||
|
||||
if (m_linkState == DCS_LINKING) {
|
||||
wxLogMessage(wxT("DCS ACK message received from %s"), m_reflector.c_str());
|
||||
wxLogMessage(wxT("DCS ACK message received from %s"), GET_DISP_REFLECTOR(this).c_str());
|
||||
|
||||
if (m_direction == DIR_OUTGOING && m_destination != NULL)
|
||||
m_destination->linkUp(DP_DCS, m_reflector);
|
||||
m_destination->linkUp(DP_DCS, GET_DISP_REFLECTOR(this));
|
||||
|
||||
m_tryTimer.stop();
|
||||
m_stateChange = true;
|
||||
|
|
@ -651,16 +658,16 @@ bool CDCSHandler::processInt(CConnectData& connect, CD_TYPE type)
|
|||
return false;
|
||||
|
||||
if (m_linkState == DCS_LINKING) {
|
||||
wxLogMessage(wxT("DCS NAK message received from %s"), m_reflector.c_str());
|
||||
wxLogMessage(wxT("DCS NAK message received from %s"), GET_DISP_REFLECTOR(this).c_str());
|
||||
|
||||
if (m_direction == DIR_OUTGOING && m_destination != NULL)
|
||||
m_destination->linkRefused(DP_DCS, m_reflector);
|
||||
m_destination->linkRefused(DP_DCS, GET_DISP_REFLECTOR(this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m_linkState == DCS_UNLINKING) {
|
||||
wxLogMessage(wxT("DCS NAK message received from %s"), m_reflector.c_str());
|
||||
wxLogMessage(wxT("DCS NAK message received from %s"), GET_DISP_REFLECTOR(this).c_str());
|
||||
|
||||
if (m_direction == DIR_OUTGOING && m_destination != NULL)
|
||||
m_destination->linkFailed(DP_DCS, m_reflector, false);
|
||||
|
|
@ -675,10 +682,10 @@ bool CDCSHandler::processInt(CConnectData& connect, CD_TYPE type)
|
|||
return false;
|
||||
|
||||
if (m_linkState == DCS_LINKED) {
|
||||
wxLogMessage(wxT("DCS disconnect message received from %s"), m_reflector.c_str());
|
||||
wxLogMessage(wxT("DCS disconnect message received from %s"), GET_DISP_REFLECTOR(this).c_str());
|
||||
|
||||
if (m_direction == DIR_OUTGOING && m_destination != NULL)
|
||||
m_destination->linkFailed(DP_DCS, m_reflector, false);
|
||||
m_destination->linkFailed(DP_DCS, GET_DISP_REFLECTOR(this), false);
|
||||
|
||||
m_stateChange = true;
|
||||
}
|
||||
|
|
@ -706,20 +713,20 @@ bool CDCSHandler::clockInt(unsigned int ms)
|
|||
|
||||
switch (m_linkState) {
|
||||
case DCS_LINKING:
|
||||
wxLogMessage(wxT("DCS link to %s has failed to connect"), m_reflector.c_str());
|
||||
wxLogMessage(wxT("DCS link to %s has failed to connect"), GET_DISP_REFLECTOR(this).c_str());
|
||||
break;
|
||||
case DCS_LINKED:
|
||||
wxLogMessage(wxT("DCS link to %s has failed (poll inactivity)"), m_reflector.c_str());
|
||||
wxLogMessage(wxT("DCS link to %s has failed (poll inactivity)"), GET_DISP_REFLECTOR(this).c_str());
|
||||
break;
|
||||
case DCS_UNLINKING:
|
||||
wxLogMessage(wxT("DCS link to %s has failed to disconnect cleanly"), m_reflector.c_str());
|
||||
wxLogMessage(wxT("DCS link to %s has failed to disconnect cleanly"), GET_DISP_REFLECTOR(this).c_str());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_direction == DIR_OUTGOING) {
|
||||
bool reconnect = m_destination->linkFailed(DP_DCS, m_reflector, true);
|
||||
bool reconnect = m_destination->linkFailed(DP_DCS, GET_DISP_REFLECTOR(this), true);
|
||||
if (reconnect) {
|
||||
CConnectData reply(m_gatewayType, m_repeater, m_reflector, CT_LINK1, m_yourAddress, m_yourPort);
|
||||
m_handler->writeConnect(reply);
|
||||
|
|
@ -844,7 +851,7 @@ void CDCSHandler::writeStatus(wxFFile& file)
|
|||
wxString text;
|
||||
text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: DCS link - Type: Repeater Rptr: %s Refl: %s Dir: Outgoing\n"),
|
||||
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
|
||||
reflector->m_repeater.c_str(), reflector->m_reflector.c_str());
|
||||
reflector->m_repeater.c_str(), GET_DISP_REFLECTOR(reflector).c_str());
|
||||
file.Write(text);
|
||||
}
|
||||
break;
|
||||
|
|
@ -854,7 +861,7 @@ void CDCSHandler::writeStatus(wxFFile& file)
|
|||
wxString text;
|
||||
text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: DCS link - Type: Repeater Rptr: %s Refl: %s Dir: Incoming\n"),
|
||||
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
|
||||
reflector->m_repeater.c_str(), reflector->m_reflector.c_str());
|
||||
reflector->m_repeater.c_str(), GET_DISP_REFLECTOR(reflector).c_str());
|
||||
file.Write(text);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@
|
|||
#include <wx/wx.h>
|
||||
#include <wx/ffile.h>
|
||||
|
||||
#define GET_DISP_REFLECTOR(refl) (refl->m_isXlx ? refl->m_xlxReflector : refl->m_reflector)
|
||||
|
||||
enum DCS_STATE {
|
||||
DCS_LINKING,
|
||||
DCS_LINKED,
|
||||
|
|
@ -109,6 +111,8 @@ private:
|
|||
static CCallsignList* m_blackList;
|
||||
|
||||
wxString m_reflector;
|
||||
wxString m_xlxReflector;
|
||||
bool m_isXlx;
|
||||
wxString m_repeater;
|
||||
CDCSProtocolHandler* m_handler;
|
||||
in_addr m_yourAddress;
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ CDDData* CDDHandler::read()
|
|||
if (m_maxRoutes == 0U)
|
||||
return NULL;
|
||||
|
||||
#if !defined(WIN32)
|
||||
#if defined(__WINDOWS__)
|
||||
return NULL;
|
||||
#else
|
||||
// Check that the read() won't block
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2015 by Jonathan Naylor, G4KLX
|
||||
* Copyright (C) 2009-2015,2018,2019 by Jonathan Naylor, G4KLX
|
||||
*
|
||||
* 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
|
||||
|
|
@ -32,8 +32,7 @@ const bool DATA_SYNC_BITS[] = {true, false, true, false, true, false, true,
|
|||
true, false, true, true, false, true, false, false,
|
||||
false, true, true, false, true, false, false, false};
|
||||
|
||||
const unsigned char END_PATTERN_BYTES[] = {0x55, 0x55, 0x55, 0x55, 0xC8, 0x7A,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
const unsigned char END_PATTERN_BYTES[] = {0x55, 0x55, 0x55, 0x55, 0xC8, 0x7A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
const bool END_PATTERN_BITS[] = {true, false, true, false, true, false, true, false,
|
||||
true, false, true, false, true, false, true, false,
|
||||
true, false, true, false, true, false, true, false,
|
||||
|
|
@ -84,10 +83,14 @@ const unsigned int DATA_BLOCK_SIZE_BYTES = 21U * DV_FRAME_LENGTH_BYTES;
|
|||
const unsigned int LONG_CALLSIGN_LENGTH = 8U;
|
||||
const unsigned int SHORT_CALLSIGN_LENGTH = 4U;
|
||||
|
||||
const unsigned char SLOW_DATA_TYPE_MASK = 0xF0U;
|
||||
const unsigned char SLOW_DATA_TYPE_GPS = 0x30U;
|
||||
const unsigned char SLOW_DATA_TYPE_TEXT = 0x40U;
|
||||
const unsigned char SLOW_DATA_TYPE_HEADER = 0x50U;
|
||||
const unsigned char SLOW_DATA_TYPE_MASK = 0xF0U;
|
||||
const unsigned char SLOW_DATA_TYPE_GPS = 0x30U;
|
||||
const unsigned char SLOW_DATA_TYPE_TEXT = 0x40U;
|
||||
const unsigned char SLOW_DATA_TYPE_HEADER = 0x50U;
|
||||
const unsigned char SLOW_DATA_TYPE_FAST_DATA1 = 0x80U;
|
||||
const unsigned char SLOW_DATA_TYPE_FAST_DATA2 = 0x90U;
|
||||
const unsigned char SLOW_DATA_TYPE_SQUELCH = 0xC0U;
|
||||
const unsigned char SLOW_DATA_LENGTH_MASK = 0x0FU;
|
||||
|
||||
const unsigned char DATA_MASK = 0x80U;
|
||||
const unsigned char REPEATER_MASK = 0x40U;
|
||||
|
|
|
|||
|
|
@ -167,6 +167,8 @@ wxString CDTMF::translate()
|
|||
return processReflector(wxT("XRF"), command.Mid(1U));
|
||||
else if (command.GetChar(0U) == wxT('D'))
|
||||
return processReflector(wxT("DCS"), command.Mid(1U));
|
||||
else if (command.GetChar(0U) == wxT('A'))
|
||||
return processReflector(wxT("XLX"), command.Mid(1U));
|
||||
else
|
||||
return processCCS(command);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,8 @@ CAMBEData* CG2ProtocolHandler::readAMBE()
|
|||
return data;
|
||||
}
|
||||
|
||||
void CG2ProtocolHandler::punchUDPHole(const wxString& address)
|
||||
#if defined(ENABLE_NAT_TRAVERSAL)
|
||||
void CG2ProtocolHandler::traverseNat(const wxString& address)
|
||||
{
|
||||
unsigned char buffer[1];
|
||||
::memset(buffer, 0, 1);
|
||||
|
|
@ -155,6 +156,7 @@ void CG2ProtocolHandler::punchUDPHole(const wxString& address)
|
|||
|
||||
m_socket.write(buffer, 1, addr, G2_DV_PORT);
|
||||
}
|
||||
#endif
|
||||
|
||||
void CG2ProtocolHandler::close()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -52,7 +52,9 @@ public:
|
|||
CHeaderData* readHeader();
|
||||
CAMBEData* readAMBE();
|
||||
|
||||
void punchUDPHole(const wxString& addr);
|
||||
#if defined(ENABLE_NAT_TRAVERSAL)
|
||||
void traverseNat(const wxString& addr);
|
||||
#endif
|
||||
|
||||
void close();
|
||||
|
||||
|
|
|
|||
|
|
@ -141,7 +141,6 @@ const wxString KEY_DCS_ENABLED = wxT("dcsEnabled");
|
|||
const wxString KEY_CCS_ENABLED = wxT("ccsEnabled");
|
||||
const wxString KEY_CCS_HOST = wxT("ccsHost");
|
||||
const wxString KEY_XLX_ENABLED = wxT("xlxEnabled");
|
||||
const wxString KEY_XLX_OVERRIDE_LOCAL = wxT("xlxOverrideLocal");
|
||||
const wxString KEY_XLX_HOSTS_FILE_URL = wxT("xlxHostsFileUrl");
|
||||
const wxString KEY_STARNET_BAND1 = wxT("starNetBand1");
|
||||
const wxString KEY_STARNET_CALLSIGN1 = wxT("starNetCallsign1");
|
||||
|
|
@ -267,8 +266,7 @@ const bool DEFAULT_DCS_ENABLED = true;
|
|||
const bool DEFAULT_CCS_ENABLED = true;
|
||||
const wxString DEFAULT_CCS_HOST = wxT("CCS704 ");
|
||||
const bool DEFAULT_XLX_ENABLED = true;
|
||||
const bool DEFAULT_XLX_OVERRIDE_LOCAL = true;
|
||||
const wxString DEFAULT_XLX_HOSTS_FILE_URL = _T("http://xlxapi.rlx.lu/api.php?do=GetReflectorHostname");
|
||||
const wxString DEFAULT_XLX_HOSTS_FILE_URL = wxT("http://xlxapi.rlx.lu/api.php?do=GetXLXDMRMaster");//we use the XLXDMRMaster list because it starts with XLX instead of DCS, XRF etc ....
|
||||
const wxString DEFAULT_STARNET_BAND = wxEmptyString;
|
||||
const wxString DEFAULT_STARNET_CALLSIGN = wxEmptyString;
|
||||
const wxString DEFAULT_STARNET_LOGOFF = wxEmptyString;
|
||||
|
|
@ -422,7 +420,6 @@ m_dcsEnabled(DEFAULT_DCS_ENABLED),
|
|||
m_ccsEnabled(DEFAULT_CCS_ENABLED),
|
||||
m_ccsHost(DEFAULT_CCS_HOST),
|
||||
m_xlxEnabled(DEFAULT_XLX_ENABLED),
|
||||
m_xlxOverrideLocal(DEFAULT_XLX_OVERRIDE_LOCAL),
|
||||
m_xlxHostsFileUrl(DEFAULT_XLX_HOSTS_FILE_URL),
|
||||
m_starNet1Band(DEFAULT_STARNET_BAND),
|
||||
m_starNet1Callsign(DEFAULT_STARNET_CALLSIGN),
|
||||
|
|
@ -761,10 +758,10 @@ m_y(DEFAULT_WINDOW_Y)
|
|||
m_config->Read(m_name + KEY_CCS_HOST, &m_ccsHost, DEFAULT_CCS_HOST);
|
||||
|
||||
m_config->Read(m_name + KEY_XLX_ENABLED, &m_xlxEnabled, DEFAULT_XLX_ENABLED);
|
||||
|
||||
m_config->Read(m_name + KEY_XLX_OVERRIDE_LOCAL, &m_xlxOverrideLocal, DEFAULT_XLX_OVERRIDE_LOCAL);
|
||||
|
||||
|
||||
m_config->Read(m_name + KEY_XLX_HOSTS_FILE_URL, &m_xlxHostsFileUrl, DEFAULT_XLX_HOSTS_FILE_URL);
|
||||
if(m_xlxEnabled && m_xlxHostsFileUrl.Trim().IsEmpty())//To avoid support nightmare, fill the url with the default one when xlx is enabled and the url is left empty
|
||||
m_xlxHostsFileUrl = DEFAULT_XLX_HOSTS_FILE_URL;
|
||||
|
||||
m_config->Read(m_name + KEY_STARNET_BAND1, &m_starNet1Band, DEFAULT_STARNET_BAND);
|
||||
|
||||
|
|
@ -1045,7 +1042,6 @@ m_dcsEnabled(DEFAULT_DCS_ENABLED),
|
|||
m_ccsEnabled(DEFAULT_CCS_ENABLED),
|
||||
m_ccsHost(DEFAULT_CCS_HOST),
|
||||
m_xlxEnabled(DEFAULT_XLX_ENABLED),
|
||||
m_xlxOverrideLocal(DEFAULT_XLX_OVERRIDE_LOCAL),
|
||||
m_xlxHostsFileUrl(DEFAULT_XLX_HOSTS_FILE_URL),
|
||||
m_starNet1Band(DEFAULT_STARNET_BAND),
|
||||
m_starNet1Callsign(DEFAULT_STARNET_CALLSIGN),
|
||||
|
|
@ -1438,10 +1434,7 @@ m_y(DEFAULT_WINDOW_Y)
|
|||
} else if (key.IsSameAs(KEY_XLX_ENABLED)) {
|
||||
val.ToLong(&temp1);
|
||||
m_xlxEnabled = temp1 == 1L;
|
||||
} else if (key.IsSameAs(KEY_XLX_OVERRIDE_LOCAL)) {
|
||||
val.ToLong(&temp1);
|
||||
m_xlxOverrideLocal = temp1 == 1L;
|
||||
} else if (key.IsSameAs(KEY_XLX_HOSTS_FILE_URL)) {
|
||||
} else if (key.IsSameAs(KEY_XLX_HOSTS_FILE_URL) && !val.Trim().IsEmpty()) { //always load default url if the value in the config file is empty
|
||||
m_xlxHostsFileUrl = val;
|
||||
} else if (key.IsSameAs(KEY_STARNET_BAND1)) {
|
||||
m_starNet1Band = val;
|
||||
|
|
@ -1968,17 +1961,15 @@ void CIRCDDBGatewayConfig::setDCS(bool dcsEnabled, bool ccsEnabled, const wxStri
|
|||
m_ccsHost = ccsHost;
|
||||
}
|
||||
|
||||
void CIRCDDBGatewayConfig::getXLX(bool& xlxEnabled, bool& xlxOverrideLocal, wxString& xlxHostsFileUrl)
|
||||
void CIRCDDBGatewayConfig::getXLX(bool& xlxEnabled, wxString& xlxHostsFileUrl)
|
||||
{
|
||||
xlxEnabled = m_xlxEnabled;
|
||||
xlxOverrideLocal = m_xlxOverrideLocal;
|
||||
xlxHostsFileUrl = m_xlxHostsFileUrl;
|
||||
}
|
||||
|
||||
void CIRCDDBGatewayConfig::setXLX(bool xlxEnabled, bool xlxOverrideLocal, wxString xlxHostsFileUrl)
|
||||
void CIRCDDBGatewayConfig::setXLX(bool xlxEnabled, wxString xlxHostsFileUrl)
|
||||
{
|
||||
m_xlxEnabled = xlxEnabled;
|
||||
m_xlxOverrideLocal = xlxOverrideLocal;
|
||||
m_xlxHostsFileUrl = xlxHostsFileUrl;
|
||||
}
|
||||
|
||||
|
|
@ -2419,7 +2410,6 @@ bool CIRCDDBGatewayConfig::write()
|
|||
m_config->Write(m_name + KEY_CCS_ENABLED, m_ccsEnabled);
|
||||
m_config->Write(m_name + KEY_CCS_HOST, m_ccsHost);
|
||||
m_config->Write(m_name + KEY_XLX_ENABLED, m_xlxEnabled);
|
||||
m_config->Write(m_name + KEY_XLX_OVERRIDE_LOCAL, m_xlxOverrideLocal);
|
||||
m_config->Write(m_name + KEY_XLX_HOSTS_FILE_URL, m_xlxHostsFileUrl);
|
||||
m_config->Write(m_name + KEY_STARNET_BAND1, m_starNet1Band);
|
||||
m_config->Write(m_name + KEY_STARNET_CALLSIGN1, m_starNet1Callsign);
|
||||
|
|
@ -2630,7 +2620,6 @@ bool CIRCDDBGatewayConfig::write()
|
|||
buffer.Printf(wxT("%s=%d"), KEY_CCS_ENABLED.c_str(), m_ccsEnabled ? 1 : 0); file.AddLine(buffer);
|
||||
buffer.Printf(wxT("%s=%s"), KEY_CCS_HOST.c_str(), m_ccsHost.c_str()); file.AddLine(buffer);
|
||||
buffer.Printf(wxT("%s=%d"), KEY_XLX_ENABLED.c_str(), m_xlxEnabled ? 1 : 0); file.AddLine(buffer);
|
||||
buffer.Printf(wxT("%s=%d"), KEY_XLX_OVERRIDE_LOCAL.c_str(), m_xlxOverrideLocal ? 1 : 0); file.AddLine(buffer);
|
||||
buffer.Printf(wxT("%s=%s"), KEY_XLX_HOSTS_FILE_URL.c_str(), m_xlxHostsFileUrl.c_str()); file.AddLine(buffer);
|
||||
buffer.Printf(wxT("%s=%s"), KEY_STARNET_BAND1.c_str(), m_starNet1Band.c_str()); file.AddLine(buffer);
|
||||
buffer.Printf(wxT("%s=%s"), KEY_STARNET_CALLSIGN1.c_str(), m_starNet1Callsign.c_str()); file.AddLine(buffer);
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ public:
|
|||
void getDCS(bool& dcsEnabled, bool& ccsEnabled, wxString& ccsHost) const;
|
||||
void setDCS(bool dcsEnabled, bool ccsEnabled, const wxString& ccsHost);
|
||||
|
||||
void getXLX(bool& xlxEnabled, bool& xlxOverrideLocal, wxString& xlxHostsFileUrl);
|
||||
void setXLX(bool xlxEnabled, bool xlxOverrideLocal, wxString xlxHostsFileUrl);
|
||||
void getXLX(bool& xlxEnabled, wxString& xlxHostsFileUrl);
|
||||
void setXLX(bool xlxEnabled, wxString xlxHostsFileUrl);
|
||||
|
||||
#if defined(DEXTRA_LINK) || defined(DCS_LINK)
|
||||
void getStarNet1(wxString& band, wxString& callsign, wxString& logoff, wxString& info, wxString& permanent, unsigned int& userTimeout, unsigned int& groupTimeout, STARNET_CALLSIGN_SWITCH& callsignSwitch, bool& txMsgSwitch, wxString& reflector) const;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2002,2003,2009,2011,2012 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2002,2003,2009,2011,2012,2019 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* 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
|
||||
|
|
@ -66,11 +66,10 @@ CLogger::~CLogger()
|
|||
delete m_file;
|
||||
}
|
||||
|
||||
void CLogger::DoLog(wxLogLevel level, const wxChar* msg, time_t timestamp)
|
||||
void CLogger::DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info)
|
||||
{
|
||||
wxASSERT(m_file != NULL);
|
||||
wxASSERT(m_file->IsOpened());
|
||||
wxASSERT(msg != NULL);
|
||||
|
||||
wxString letter;
|
||||
|
||||
|
|
@ -94,15 +93,15 @@ void CLogger::DoLog(wxLogLevel level, const wxChar* msg, time_t timestamp)
|
|||
}
|
||||
|
||||
wxString message;
|
||||
message.Printf(wxT("%s: %04d-%02d-%02d %02d:%02d:%02d: %s\n"), letter.c_str(), tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, msg);
|
||||
message.Printf(wxT("%s: %04d-%02d-%02d %02d:%02d:%02d: %s\n"), letter.c_str(), tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, msg.c_str());
|
||||
|
||||
DoLogString(message.c_str(), timestamp);
|
||||
writeLog(message.c_str(), info.timestamp);
|
||||
|
||||
if (level == wxLOG_FatalError)
|
||||
::abort();
|
||||
}
|
||||
|
||||
void CLogger::DoLogString(const wxChar* msg, time_t timestamp)
|
||||
void CLogger::writeLog(const wxChar* msg, time_t timestamp)
|
||||
{
|
||||
wxASSERT(m_file != NULL);
|
||||
wxASSERT(m_file->IsOpened());
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2002,2003,2009,2011,2012 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2002,2003,2009,2011,2012,2019 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* 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
|
||||
|
|
@ -28,8 +28,7 @@ public:
|
|||
CLogger(const wxString& directory, const wxString& name);
|
||||
virtual ~CLogger();
|
||||
|
||||
virtual void DoLog(wxLogLevel level, const wxChar* msg, time_t timestamp);
|
||||
virtual void DoLogString(const wxChar* msg, time_t timestamp);
|
||||
virtual void DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info);
|
||||
|
||||
virtual void DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info);
|
||||
|
||||
|
|
@ -38,6 +37,8 @@ private:
|
|||
wxFFile* m_file;
|
||||
wxFileName m_fileName;
|
||||
int m_day;
|
||||
|
||||
void writeLog(const wxChar* msg, time_t timestamp);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4,19 +4,25 @@ OBJECTS = AMBEData.o AnnouncementUnit.o APRSCollector.o APRSWriter.o APRSWriterT
|
|||
DPlusAuthenticator.o DPlusHandler.o DPlusProtocolHandler.o DPlusProtocolHandlerPool.o DRATSServer.o DTMF.o \
|
||||
DummyRepeaterProtocolHandler.o DVTOOLFileReader.o EchoUnit.o G2Handler.o G2ProtocolHandler.o GatewayCache.o \
|
||||
HBRepeaterProtocolHandler.o HeaderData.o HeaderLogger.o HeardData.o HostFile.o IcomRepeaterProtocolHandler.o IRCDDBGatewayConfig.o \
|
||||
LogEvent.o Logger.o PollData.o RemoteHandler.o RemoteLinkData.o RemoteProtocolHandler.o RemoteRepeaterData.o RemoteStarNetGroup.o \
|
||||
LogEvent.o Logger.o NatTraversalHandler.o PollData.o RemoteHandler.o RemoteLinkData.o RemoteProtocolHandler.o RemoteRepeaterData.o RemoteStarNetGroup.o \
|
||||
RemoteStarNetUser.o RepeaterCache.o RepeaterHandler.o SHA256.o SlowDataEncoder.o StarNetHandler.o StatusData.o \
|
||||
TCPReaderWriterClient.o TCPReaderWriterServer.o TextCollector.o TextData.o Timer.o UDPReaderWriter.o UserCache.o Utils.o \
|
||||
VersionUnit.o XLXHostsFileDownloader.o
|
||||
|
||||
.PHONY: all
|
||||
all: Common.a
|
||||
|
||||
Common.a: $(OBJECTS)
|
||||
Common.a: $(OBJECTS) ../ircDDB/IRCDDB.a
|
||||
$(AR) rcs Common.a $(OBJECTS)
|
||||
|
||||
-include $(OBJECTS:.o=.d)
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) -DwxUSE_GUI=0 $(CFLAGS) -I../ircDDB -c -o $@ $<
|
||||
$(CXX) -MM -DwxUSE_GUI=0 $(CFLAGS) -I../ircDDB $< > $*.d
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
$(RM) Common.a *.o *.d *.bak *~
|
||||
|
||||
../ircDDB/IRCDDB.a:
|
||||
|
|
|
|||
61
Common/NatTraversalHandler.cpp
Normal file
61
Common/NatTraversalHandler.cpp
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright (C) 2010,2011,2012,2013,2014,2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#if defined(ENABLE_NAT_TRAVERSAL)
|
||||
|
||||
#include "NatTraversalHandler.h"
|
||||
|
||||
const unsigned int CACHE_SIZE = 500U;
|
||||
|
||||
CNatTraversalHandler::CNatTraversalHandler() :
|
||||
m_g2cache(CACHE_SIZE),
|
||||
m_g2Handler(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CNatTraversalHandler::~CNatTraversalHandler()
|
||||
{
|
||||
for (CNatTraversalCache_t::iterator it = m_g2cache.begin(); it != m_g2cache.end(); ++it)
|
||||
delete it->second;
|
||||
}
|
||||
|
||||
void CNatTraversalHandler::setG2Handler(CG2ProtocolHandler * handler)
|
||||
{
|
||||
m_g2Handler = handler;
|
||||
}
|
||||
|
||||
void CNatTraversalHandler::traverseNatG2(const wxString& address)
|
||||
{
|
||||
if(m_g2Handler != NULL){
|
||||
CNatTraversalRecord* record = m_g2cache[address];
|
||||
|
||||
if(record == NULL) {
|
||||
record = new CNatTraversalRecord(address);
|
||||
m_g2cache[address] = record;
|
||||
}
|
||||
|
||||
std::time_t currentTime = std::time(NULL);
|
||||
if(currentTime - record->getTimestamp() > G2_TRAVERSAL_TIMEOUT) {
|
||||
record->setTimestamp(currentTime);
|
||||
m_g2Handler->traverseNat(address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
80
Common/NatTraversalHandler.h
Normal file
80
Common/NatTraversalHandler.h
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright (C) 2010,2011,2012,2013,2014,2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#if defined(ENABLE_NAT_TRAVERSAL)
|
||||
#ifndef NatTraversalHandler_H
|
||||
#define NatTraversalHandler_H
|
||||
|
||||
#define G2_TRAVERSAL_TIMEOUT 29 //seconds
|
||||
|
||||
#include "G2ProtocolHandler.h"
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <ctime>
|
||||
|
||||
enum NAT_TRAVERSAL_TYPE {
|
||||
NTT_G2,
|
||||
//NTT_DEXTRA
|
||||
//NTT_DCS
|
||||
//NTT_DPLUS
|
||||
};
|
||||
|
||||
class CNatTraversalRecord {
|
||||
public:
|
||||
CNatTraversalRecord(const wxString& address) :
|
||||
m_address(address),
|
||||
m_timestamp(0)
|
||||
{
|
||||
}
|
||||
|
||||
std::time_t getTimestamp() const
|
||||
{
|
||||
return m_timestamp;
|
||||
}
|
||||
|
||||
void setTimestamp(std::time_t timestamp)
|
||||
{
|
||||
m_timestamp = timestamp;
|
||||
}
|
||||
|
||||
private:
|
||||
wxString m_address;
|
||||
std::time_t m_timestamp;
|
||||
};
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP(CNatTraversalRecord*, CNatTraversalCache_t);
|
||||
|
||||
/*
|
||||
* This keeps track of when we UDP punched to one destination so to avoid unnecessary traffic on each ircddb reporting
|
||||
*/
|
||||
class CNatTraversalHandler {
|
||||
public:
|
||||
CNatTraversalHandler();
|
||||
~CNatTraversalHandler();
|
||||
|
||||
void setG2Handler(CG2ProtocolHandler* handler);
|
||||
void traverseNatG2(const wxString& address);
|
||||
|
||||
private:
|
||||
CNatTraversalCache_t m_g2cache;
|
||||
CG2ProtocolHandler* m_g2Handler;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010-2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2010-2015,2018,2019 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* 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
|
||||
|
|
@ -95,6 +95,7 @@ m_flag1(0x00U),
|
|||
m_flag2(0x00U),
|
||||
m_flag3(0x00U),
|
||||
m_restricted(false),
|
||||
m_fastData(false),
|
||||
m_frames(0U),
|
||||
m_silence(0U),
|
||||
m_errors(0U),
|
||||
|
|
@ -582,6 +583,9 @@ void CRepeaterHandler::processRepeater(CHeaderData& header)
|
|||
m_silence = 0U;
|
||||
m_errors = 0U;
|
||||
|
||||
// Assume voice mode
|
||||
m_fastData = false;
|
||||
|
||||
// An RF header resets the reconnect timer
|
||||
m_linkReconnectTimer.start();
|
||||
|
||||
|
|
@ -736,32 +740,42 @@ void CRepeaterHandler::processRepeater(CAMBEData& data)
|
|||
unsigned char buffer[DV_FRAME_MAX_LENGTH_BYTES];
|
||||
data.getData(buffer, DV_FRAME_MAX_LENGTH_BYTES);
|
||||
|
||||
if (::memcmp(buffer, NULL_AMBE_DATA_BYTES, VOICE_FRAME_LENGTH_BYTES) == 0)
|
||||
m_silence++;
|
||||
// Check for the fast data signature
|
||||
if (!m_fastData) {
|
||||
unsigned char slowDataType = (buffer[VOICE_FRAME_LENGTH_BYTES] ^ SCRAMBLER_BYTE1) & SLOW_DATA_TYPE_MASK;
|
||||
if (slowDataType == SLOW_DATA_TYPE_FAST_DATA1 || slowDataType == SLOW_DATA_TYPE_FAST_DATA2)
|
||||
m_fastData = true;
|
||||
}
|
||||
|
||||
// Don't do DTMF decoding or blanking if off and not on crossband either
|
||||
if (m_dtmfEnabled && m_g2Status != G2_XBAND) {
|
||||
bool pressed = m_dtmf.decode(buffer, data.isEnd());
|
||||
if (pressed) {
|
||||
// Replace the DTMF with silence
|
||||
::memcpy(buffer, NULL_AMBE_DATA_BYTES, VOICE_FRAME_LENGTH_BYTES);
|
||||
data.setData(buffer, DV_FRAME_LENGTH_BYTES);
|
||||
}
|
||||
// Don't do AMBE processing when in Fast Data mode
|
||||
if (!m_fastData) {
|
||||
if (::memcmp(buffer, NULL_AMBE_DATA_BYTES, VOICE_FRAME_LENGTH_BYTES) == 0)
|
||||
m_silence++;
|
||||
|
||||
bool dtmfDone = m_dtmf.hasCommand();
|
||||
if (dtmfDone) {
|
||||
wxString command = m_dtmf.translate();
|
||||
// Don't do DTMF decoding or blanking if off and not on crossband either
|
||||
if (m_dtmfEnabled && m_g2Status != G2_XBAND) {
|
||||
bool pressed = m_dtmf.decode(buffer, data.isEnd());
|
||||
if (pressed) {
|
||||
// Replace the DTMF with silence
|
||||
::memcpy(buffer, NULL_AMBE_DATA_BYTES, VOICE_FRAME_LENGTH_BYTES);
|
||||
data.setData(buffer, DV_FRAME_LENGTH_BYTES);
|
||||
}
|
||||
|
||||
// Only process the DTMF command if the your call is CQCQCQ and not a restricted user
|
||||
if (!m_restricted && m_yourCall.Left(4U).IsSameAs(wxT("CQCQ"))) {
|
||||
if (command.IsEmpty()) {
|
||||
// Do nothing
|
||||
} else if (isCCSCommand(command)) {
|
||||
ccsCommandHandler(command, m_myCall1, wxT("DTMF"));
|
||||
} else if (command.IsSameAs(wxT(" I"))) {
|
||||
m_infoNeeded = true;
|
||||
} else {
|
||||
reflectorCommandHandler(command, m_myCall1, wxT("DTMF"));
|
||||
bool dtmfDone = m_dtmf.hasCommand();
|
||||
if (dtmfDone) {
|
||||
wxString command = m_dtmf.translate();
|
||||
|
||||
// Only process the DTMF command if the your call is CQCQCQ and not a restricted user
|
||||
if (!m_restricted && m_yourCall.Left(4U).IsSameAs(wxT("CQCQ"))) {
|
||||
if (command.IsEmpty()) {
|
||||
// Do nothing
|
||||
} else if (isCCSCommand(command)) {
|
||||
ccsCommandHandler(command, m_myCall1, wxT("DTMF"));
|
||||
} else if (command.IsSameAs(wxT(" I"))) {
|
||||
m_infoNeeded = true;
|
||||
} else {
|
||||
reflectorCommandHandler(command, m_myCall1, wxT("DTMF"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010-2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2010-2015,2018 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* 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
|
||||
|
|
@ -208,6 +208,7 @@ private:
|
|||
unsigned char m_flag2;
|
||||
unsigned char m_flag3;
|
||||
bool m_restricted;
|
||||
bool m_fastData;
|
||||
|
||||
// Statistics
|
||||
unsigned int m_frames;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010-2015,2018 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2010-2015,2018,2019 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* 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
|
||||
|
|
@ -24,9 +24,9 @@
|
|||
const wxString VENDOR_NAME = wxT("G4KLX");
|
||||
|
||||
#if defined(__WXDEBUG__)
|
||||
const wxString VERSION = wxT("20180719 - DEBUG");
|
||||
const wxString VERSION = wxT("20190402 - DEBUG");
|
||||
#else
|
||||
const wxString VERSION = wxT("20180719");
|
||||
const wxString VERSION = wxT("20190402");
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ wxString CXLXHostsFileDownloader::Download(const wxString & xlxHostsFileURL)
|
|||
return wxEmptyString;
|
||||
}
|
||||
|
||||
wxInputStream* in = NULL;
|
||||
if((in = http.GetInputStream(path)) && in->IsOk()) {
|
||||
wxInputStream* in = http.GetInputStream(path);
|
||||
if(in != NULL && in->IsOk()) {
|
||||
wxFile file;
|
||||
wxString xlxHostsFileName = wxFileName::CreateTempFileName(_T("XLX_Hosts_"), &file);
|
||||
wxLogMessage(_T("Created temporary file %s"), xlxHostsFileName);
|
||||
|
|
|
|||
|
|
@ -19,9 +19,13 @@
|
|||
|
||||
#ifndef XLXHostsFileDownloader_H
|
||||
#define XLXHostsFileDownloader_H
|
||||
#define XLX_USE_WGET
|
||||
|
||||
#include <wx/wx.h>
|
||||
|
||||
#if !defined (__WINDOWS__)
|
||||
#define XLX_USE_WGET //for some reason libwx is missing the net stuff on some distros, therefore always use wget if we are not compiling under windows
|
||||
#endif
|
||||
|
||||
class CXLXHostsFileDownloader {
|
||||
public:
|
||||
static wxString Download(const wxString & xlxHostsFileURL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue