mirror of
https://github.com/g4klx/DMRGateway
synced 2025-12-20 13:15:37 +08:00
Fix network ports datatype (unsigned int -> unsigned short). UDPSocket: fix old bug using m_port instead of m_port[x].
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
|
||||
CAPRSWriter::CAPRSWriter(const std::string& callsign, const std::string& suffix, const std::string& address, unsigned int port, bool debug) :
|
||||
CAPRSWriter::CAPRSWriter(const std::string& callsign, const std::string& suffix, const std::string& address, unsigned short port, bool debug) :
|
||||
m_idTimer(1000U),
|
||||
m_callsign(callsign),
|
||||
m_debug(debug),
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
class CAPRSWriter {
|
||||
public:
|
||||
CAPRSWriter(const std::string& callsign, const std::string& suffix, const std::string& address, unsigned int port, bool debug);
|
||||
CAPRSWriter(const std::string& callsign, const std::string& suffix, const std::string& address, unsigned short port, bool debug);
|
||||
~CAPRSWriter();
|
||||
|
||||
bool open();
|
||||
|
||||
80
Conf.cpp
80
Conf.cpp
@@ -281,11 +281,11 @@ bool CConf::read()
|
||||
else if (::strcmp(key, "RptAddress") == 0)
|
||||
m_rptAddress = value;
|
||||
else if (::strcmp(key, "RptPort") == 0)
|
||||
m_rptPort = (unsigned int)::atoi(value);
|
||||
m_rptPort = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "LocalAddress") == 0)
|
||||
m_localAddress = value;
|
||||
else if (::strcmp(key, "LocalPort") == 0)
|
||||
m_localPort = (unsigned int)::atoi(value);
|
||||
m_localPort = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "RuleTrace") == 0)
|
||||
m_ruleTrace = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Debug") == 0)
|
||||
@@ -328,14 +328,14 @@ bool CConf::read()
|
||||
m_xlxNetworkId = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "File") == 0)
|
||||
m_xlxNetworkFile = value;
|
||||
else if (::strcmp(key, "ReloadTime") == 0)
|
||||
m_xlxNetworkReloadTime = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "Port") == 0)
|
||||
m_xlxNetworkPort = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "Password") == 0)
|
||||
m_xlxNetworkPassword = value;
|
||||
else if (::strcmp(key, "Local") == 0)
|
||||
m_xlxNetworkLocal = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "ReloadTime") == 0)
|
||||
m_xlxNetworkReloadTime = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "Port") == 0)
|
||||
m_xlxNetworkPort = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "Password") == 0)
|
||||
m_xlxNetworkPassword = value;
|
||||
else if (::strcmp(key, "Local") == 0)
|
||||
m_xlxNetworkLocal = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "Slot") == 0)
|
||||
m_xlxNetworkSlot = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "TG") == 0)
|
||||
@@ -362,9 +362,9 @@ bool CConf::read()
|
||||
else if (::strcmp(key, "Address") == 0)
|
||||
m_dmrNetwork1Address = value;
|
||||
else if (::strcmp(key, "Port") == 0)
|
||||
m_dmrNetwork1Port = (unsigned int)::atoi(value);
|
||||
m_dmrNetwork1Port = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "Local") == 0)
|
||||
m_dmrNetwork1Local = (unsigned int)::atoi(value);
|
||||
m_dmrNetwork1Local = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "Password") == 0)
|
||||
m_dmrNetwork1Password = value;
|
||||
else if (::strcmp(key, "Options") == 0)
|
||||
@@ -484,9 +484,9 @@ bool CConf::read()
|
||||
else if (::strcmp(key, "Address") == 0)
|
||||
m_dmrNetwork2Address = value;
|
||||
else if (::strcmp(key, "Port") == 0)
|
||||
m_dmrNetwork2Port = (unsigned int)::atoi(value);
|
||||
m_dmrNetwork2Port = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "Local") == 0)
|
||||
m_dmrNetwork2Local = (unsigned int)::atoi(value);
|
||||
m_dmrNetwork2Local = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "Password") == 0)
|
||||
m_dmrNetwork2Password = value;
|
||||
else if (::strcmp(key, "Options") == 0)
|
||||
@@ -606,9 +606,9 @@ bool CConf::read()
|
||||
else if (::strcmp(key, "Address") == 0)
|
||||
m_dmrNetwork3Address = value;
|
||||
else if (::strcmp(key, "Port") == 0)
|
||||
m_dmrNetwork3Port = (unsigned int)::atoi(value);
|
||||
m_dmrNetwork3Port = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "Local") == 0)
|
||||
m_dmrNetwork3Local = (unsigned int)::atoi(value);
|
||||
m_dmrNetwork3Local = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "Password") == 0)
|
||||
m_dmrNetwork3Password = value;
|
||||
else if (::strcmp(key, "Options") == 0)
|
||||
@@ -728,9 +728,9 @@ bool CConf::read()
|
||||
else if (::strcmp(key, "Address") == 0)
|
||||
m_dmrNetwork4Address = value;
|
||||
else if (::strcmp(key, "Port") == 0)
|
||||
m_dmrNetwork4Port = (unsigned int)::atoi(value);
|
||||
m_dmrNetwork4Port = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "Local") == 0)
|
||||
m_dmrNetwork4Local = (unsigned int)::atoi(value);
|
||||
m_dmrNetwork4Local = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "Password") == 0)
|
||||
m_dmrNetwork4Password = value;
|
||||
else if (::strcmp(key, "Options") == 0)
|
||||
@@ -850,9 +850,9 @@ bool CConf::read()
|
||||
else if (::strcmp(key, "Address") == 0)
|
||||
m_dmrNetwork5Address = value;
|
||||
else if (::strcmp(key, "Port") == 0)
|
||||
m_dmrNetwork5Port = (unsigned int)::atoi(value);
|
||||
m_dmrNetwork5Port = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "Local") == 0)
|
||||
m_dmrNetwork5Local = (unsigned int)::atoi(value);
|
||||
m_dmrNetwork5Local = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "Password") == 0)
|
||||
m_dmrNetwork5Password = value;
|
||||
else if (::strcmp(key, "Options") == 0)
|
||||
@@ -975,21 +975,21 @@ bool CConf::read()
|
||||
else if (::strcmp(key, "Address") == 0)
|
||||
m_aprsAddress = value;
|
||||
else if (::strcmp(key, "Port") == 0)
|
||||
m_aprsPort = (unsigned int)::atoi(value);
|
||||
m_aprsPort = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "Suffix") == 0)
|
||||
m_aprsSuffix = value;
|
||||
} else if (section == SECTION_DYNAMIC_TG_CONTROL) {
|
||||
if (::strcmp(key, "Enabled") == 0)
|
||||
m_dynamicTGControlEnabled = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Port") == 0)
|
||||
m_dynamicTGControlPort = (unsigned int)::atoi(value);
|
||||
m_dynamicTGControlPort = (unsigned short)::atoi(value);
|
||||
} else if (section == SECTION_REMOTE_CONTROL) {
|
||||
if (::strcmp(key, "Enable") == 0)
|
||||
m_remoteControlEnabled = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Address") == 0)
|
||||
m_remoteControlAddress = value;
|
||||
else if (::strcmp(key, "Port") == 0)
|
||||
m_remoteControlPort = (unsigned int)::atoi(value);
|
||||
m_remoteControlPort = (unsigned short)::atoi(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1008,7 +1008,7 @@ std::string CConf::getRptAddress() const
|
||||
return m_rptAddress;
|
||||
}
|
||||
|
||||
unsigned int CConf::getRptPort() const
|
||||
unsigned short CConf::getRptPort() const
|
||||
{
|
||||
return m_rptPort;
|
||||
}
|
||||
@@ -1018,7 +1018,7 @@ std::string CConf::getLocalAddress() const
|
||||
return m_localAddress;
|
||||
}
|
||||
|
||||
unsigned int CConf::getLocalPort() const
|
||||
unsigned short CConf::getLocalPort() const
|
||||
{
|
||||
return m_localPort;
|
||||
}
|
||||
@@ -1133,7 +1133,7 @@ unsigned int CConf::getXLXNetworkReloadTime() const
|
||||
return m_xlxNetworkReloadTime;
|
||||
}
|
||||
|
||||
unsigned int CConf::getXLXNetworkPort() const
|
||||
unsigned short CConf::getXLXNetworkPort() const
|
||||
{
|
||||
return m_xlxNetworkPort;
|
||||
}
|
||||
@@ -1143,7 +1143,7 @@ std::string CConf::getXLXNetworkPassword() const
|
||||
return m_xlxNetworkPassword;
|
||||
}
|
||||
|
||||
unsigned int CConf::getXLXNetworkLocal() const
|
||||
unsigned short CConf::getXLXNetworkLocal() const
|
||||
{
|
||||
return m_xlxNetworkLocal;
|
||||
}
|
||||
@@ -1209,12 +1209,12 @@ std::string CConf::getDMRNetwork1Address() const
|
||||
return m_dmrNetwork1Address;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDMRNetwork1Port() const
|
||||
unsigned short CConf::getDMRNetwork1Port() const
|
||||
{
|
||||
return m_dmrNetwork1Port;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDMRNetwork1Local() const
|
||||
unsigned short CConf::getDMRNetwork1Local() const
|
||||
{
|
||||
return m_dmrNetwork1Local;
|
||||
}
|
||||
@@ -1302,12 +1302,12 @@ std::string CConf::getDMRNetwork2Address() const
|
||||
return m_dmrNetwork2Address;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDMRNetwork2Port() const
|
||||
unsigned short CConf::getDMRNetwork2Port() const
|
||||
{
|
||||
return m_dmrNetwork2Port;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDMRNetwork2Local() const
|
||||
unsigned short CConf::getDMRNetwork2Local() const
|
||||
{
|
||||
return m_dmrNetwork2Local;
|
||||
}
|
||||
@@ -1395,12 +1395,12 @@ std::string CConf::getDMRNetwork3Address() const
|
||||
return m_dmrNetwork3Address;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDMRNetwork3Port() const
|
||||
unsigned short CConf::getDMRNetwork3Port() const
|
||||
{
|
||||
return m_dmrNetwork3Port;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDMRNetwork3Local() const
|
||||
unsigned short CConf::getDMRNetwork3Local() const
|
||||
{
|
||||
return m_dmrNetwork3Local;
|
||||
}
|
||||
@@ -1488,12 +1488,12 @@ std::string CConf::getDMRNetwork4Address() const
|
||||
return m_dmrNetwork4Address;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDMRNetwork4Port() const
|
||||
unsigned short CConf::getDMRNetwork4Port() const
|
||||
{
|
||||
return m_dmrNetwork4Port;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDMRNetwork4Local() const
|
||||
unsigned short CConf::getDMRNetwork4Local() const
|
||||
{
|
||||
return m_dmrNetwork4Local;
|
||||
}
|
||||
@@ -1581,12 +1581,12 @@ std::string CConf::getDMRNetwork5Address() const
|
||||
return m_dmrNetwork5Address;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDMRNetwork5Port() const
|
||||
unsigned short CConf::getDMRNetwork5Port() const
|
||||
{
|
||||
return m_dmrNetwork5Port;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDMRNetwork5Local() const
|
||||
unsigned short CConf::getDMRNetwork5Local() const
|
||||
{
|
||||
return m_dmrNetwork5Local;
|
||||
}
|
||||
@@ -1676,7 +1676,7 @@ std::string CConf::getAPRSAddress() const
|
||||
return m_aprsAddress;
|
||||
}
|
||||
|
||||
unsigned int CConf::getAPRSPort() const
|
||||
unsigned short CConf::getAPRSPort() const
|
||||
{
|
||||
return m_aprsPort;
|
||||
}
|
||||
@@ -1696,7 +1696,7 @@ bool CConf::getDynamicTGControlEnabled() const
|
||||
return m_dynamicTGControlEnabled;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDynamicTGControlPort() const
|
||||
unsigned short CConf::getDynamicTGControlPort() const
|
||||
{
|
||||
return m_dynamicTGControlPort;
|
||||
}
|
||||
@@ -1711,7 +1711,7 @@ std::string CConf::getRemoteControlAddress() const
|
||||
return m_remoteControlAddress;
|
||||
}
|
||||
|
||||
unsigned int CConf::getRemoteControlPort() const
|
||||
unsigned short CConf::getRemoteControlPort() const
|
||||
{
|
||||
return m_remoteControlPort;
|
||||
}
|
||||
|
||||
84
Conf.h
84
Conf.h
@@ -82,9 +82,9 @@ public:
|
||||
unsigned int getRFTimeout() const;
|
||||
unsigned int getNetTimeout() const;
|
||||
std::string getRptAddress() const;
|
||||
unsigned int getRptPort() const;
|
||||
unsigned short getRptPort() const;
|
||||
std::string getLocalAddress() const;
|
||||
unsigned int getLocalPort() const;
|
||||
unsigned short getLocalPort() const;
|
||||
bool getRuleTrace() const;
|
||||
bool getDebug() const;
|
||||
|
||||
@@ -113,8 +113,8 @@ public:
|
||||
std::string getDMRNetwork1Name() const;
|
||||
unsigned int getDMRNetwork1Id() const;
|
||||
std::string getDMRNetwork1Address() const;
|
||||
unsigned int getDMRNetwork1Port() const;
|
||||
unsigned int getDMRNetwork1Local() const;
|
||||
unsigned short getDMRNetwork1Port() const;
|
||||
unsigned short getDMRNetwork1Local() const;
|
||||
std::string getDMRNetwork1Password() const;
|
||||
std::string getDMRNetwork1Options() const;
|
||||
bool getDMRNetwork1Location() const;
|
||||
@@ -133,8 +133,8 @@ public:
|
||||
std::string getDMRNetwork2Name() const;
|
||||
unsigned int getDMRNetwork2Id() const;
|
||||
std::string getDMRNetwork2Address() const;
|
||||
unsigned int getDMRNetwork2Port() const;
|
||||
unsigned int getDMRNetwork2Local() const;
|
||||
unsigned short getDMRNetwork2Port() const;
|
||||
unsigned short getDMRNetwork2Local() const;
|
||||
std::string getDMRNetwork2Password() const;
|
||||
std::string getDMRNetwork2Options() const;
|
||||
bool getDMRNetwork2Location() const;
|
||||
@@ -153,8 +153,8 @@ public:
|
||||
std::string getDMRNetwork3Name() const;
|
||||
unsigned int getDMRNetwork3Id() const;
|
||||
std::string getDMRNetwork3Address() const;
|
||||
unsigned int getDMRNetwork3Port() const;
|
||||
unsigned int getDMRNetwork3Local() const;
|
||||
unsigned short getDMRNetwork3Port() const;
|
||||
unsigned short getDMRNetwork3Local() const;
|
||||
std::string getDMRNetwork3Password() const;
|
||||
std::string getDMRNetwork3Options() const;
|
||||
bool getDMRNetwork3Location() const;
|
||||
@@ -173,8 +173,8 @@ public:
|
||||
std::string getDMRNetwork4Name() const;
|
||||
unsigned int getDMRNetwork4Id() const;
|
||||
std::string getDMRNetwork4Address() const;
|
||||
unsigned int getDMRNetwork4Port() const;
|
||||
unsigned int getDMRNetwork4Local() const;
|
||||
unsigned short getDMRNetwork4Port() const;
|
||||
unsigned short getDMRNetwork4Local() const;
|
||||
std::string getDMRNetwork4Password() const;
|
||||
std::string getDMRNetwork4Options() const;
|
||||
bool getDMRNetwork4Location() const;
|
||||
@@ -193,8 +193,8 @@ public:
|
||||
std::string getDMRNetwork5Name() const;
|
||||
unsigned int getDMRNetwork5Id() const;
|
||||
std::string getDMRNetwork5Address() const;
|
||||
unsigned int getDMRNetwork5Port() const;
|
||||
unsigned int getDMRNetwork5Local() const;
|
||||
unsigned short getDMRNetwork5Port() const;
|
||||
unsigned short getDMRNetwork5Local() const;
|
||||
std::string getDMRNetwork5Password() const;
|
||||
std::string getDMRNetwork5Options() const;
|
||||
bool getDMRNetwork5Location() const;
|
||||
@@ -212,18 +212,18 @@ public:
|
||||
bool getXLXNetworkEnabled() const;
|
||||
unsigned int getXLXNetworkId() const;
|
||||
std::string getXLXNetworkFile() const;
|
||||
unsigned int getXLXNetworkReloadTime() const;
|
||||
unsigned int getXLXNetworkPort() const;
|
||||
std::string getXLXNetworkPassword() const;
|
||||
unsigned int getXLXNetworkLocal() const;
|
||||
unsigned int getXLXNetworkReloadTime() const;
|
||||
unsigned short getXLXNetworkPort() const;
|
||||
std::string getXLXNetworkPassword() const;
|
||||
unsigned short getXLXNetworkLocal() const;
|
||||
unsigned int getXLXNetworkSlot() const;
|
||||
unsigned int getXLXNetworkTG() const;
|
||||
unsigned int getXLXNetworkBase() const;
|
||||
unsigned int getXLXNetworkStartup() const;
|
||||
unsigned int getXLXNetworkRelink() const;
|
||||
bool getXLXNetworkDebug() const;
|
||||
bool getXLXNetworkUserControl() const;
|
||||
char getXLXNetworkModule() const;
|
||||
bool getXLXNetworkUserControl() const;
|
||||
char getXLXNetworkModule() const;
|
||||
|
||||
// The GPSD section
|
||||
bool getGPSDEnabled() const;
|
||||
@@ -233,26 +233,26 @@ public:
|
||||
// The APRS section
|
||||
bool getAPRSEnabled() const;
|
||||
std::string getAPRSAddress() const;
|
||||
unsigned int getAPRSPort() const;
|
||||
unsigned short getAPRSPort() const;
|
||||
std::string getAPRSSuffix() const;
|
||||
std::string getAPRSDescription() const;
|
||||
|
||||
// The Dynamic TG Control section
|
||||
bool getDynamicTGControlEnabled() const;
|
||||
unsigned int getDynamicTGControlPort() const;
|
||||
unsigned short getDynamicTGControlPort() const;
|
||||
|
||||
// The Remote Control section
|
||||
bool getRemoteControlEnabled() const;
|
||||
std::string getRemoteControlAddress() const;
|
||||
unsigned int getRemoteControlPort() const;
|
||||
unsigned short getRemoteControlPort() const;
|
||||
|
||||
private:
|
||||
std::string m_file;
|
||||
bool m_daemon;
|
||||
std::string m_rptAddress;
|
||||
unsigned int m_rptPort;
|
||||
unsigned short m_rptPort;
|
||||
std::string m_localAddress;
|
||||
unsigned int m_localPort;
|
||||
unsigned short m_localPort;
|
||||
unsigned int m_rfTimeout;
|
||||
unsigned int m_netTimeout;
|
||||
bool m_ruleTrace;
|
||||
@@ -279,8 +279,8 @@ private:
|
||||
std::string m_dmrNetwork1Name;
|
||||
unsigned int m_dmrNetwork1Id;
|
||||
std::string m_dmrNetwork1Address;
|
||||
unsigned int m_dmrNetwork1Port;
|
||||
unsigned int m_dmrNetwork1Local;
|
||||
unsigned short m_dmrNetwork1Port;
|
||||
unsigned short m_dmrNetwork1Local;
|
||||
std::string m_dmrNetwork1Password;
|
||||
std::string m_dmrNetwork1Options;
|
||||
bool m_dmrNetwork1Location;
|
||||
@@ -298,8 +298,8 @@ private:
|
||||
std::string m_dmrNetwork2Name;
|
||||
unsigned int m_dmrNetwork2Id;
|
||||
std::string m_dmrNetwork2Address;
|
||||
unsigned int m_dmrNetwork2Port;
|
||||
unsigned int m_dmrNetwork2Local;
|
||||
unsigned short m_dmrNetwork2Port;
|
||||
unsigned short m_dmrNetwork2Local;
|
||||
std::string m_dmrNetwork2Password;
|
||||
std::string m_dmrNetwork2Options;
|
||||
bool m_dmrNetwork2Location;
|
||||
@@ -317,8 +317,8 @@ private:
|
||||
std::string m_dmrNetwork3Name;
|
||||
unsigned int m_dmrNetwork3Id;
|
||||
std::string m_dmrNetwork3Address;
|
||||
unsigned int m_dmrNetwork3Port;
|
||||
unsigned int m_dmrNetwork3Local;
|
||||
unsigned short m_dmrNetwork3Port;
|
||||
unsigned short m_dmrNetwork3Local;
|
||||
std::string m_dmrNetwork3Password;
|
||||
std::string m_dmrNetwork3Options;
|
||||
bool m_dmrNetwork3Location;
|
||||
@@ -336,8 +336,8 @@ private:
|
||||
std::string m_dmrNetwork4Name;
|
||||
unsigned int m_dmrNetwork4Id;
|
||||
std::string m_dmrNetwork4Address;
|
||||
unsigned int m_dmrNetwork4Port;
|
||||
unsigned int m_dmrNetwork4Local;
|
||||
unsigned short m_dmrNetwork4Port;
|
||||
unsigned short m_dmrNetwork4Local;
|
||||
std::string m_dmrNetwork4Password;
|
||||
std::string m_dmrNetwork4Options;
|
||||
bool m_dmrNetwork4Location;
|
||||
@@ -355,8 +355,8 @@ private:
|
||||
std::string m_dmrNetwork5Name;
|
||||
unsigned int m_dmrNetwork5Id;
|
||||
std::string m_dmrNetwork5Address;
|
||||
unsigned int m_dmrNetwork5Port;
|
||||
unsigned int m_dmrNetwork5Local;
|
||||
unsigned short m_dmrNetwork5Port;
|
||||
unsigned short m_dmrNetwork5Local;
|
||||
std::string m_dmrNetwork5Password;
|
||||
std::string m_dmrNetwork5Options;
|
||||
bool m_dmrNetwork5Location;
|
||||
@@ -373,18 +373,18 @@ private:
|
||||
bool m_xlxNetworkEnabled;
|
||||
unsigned int m_xlxNetworkId;
|
||||
std::string m_xlxNetworkFile;
|
||||
unsigned int m_xlxNetworkReloadTime;
|
||||
unsigned int m_xlxNetworkPort;
|
||||
std::string m_xlxNetworkPassword;
|
||||
unsigned int m_xlxNetworkLocal;
|
||||
unsigned int m_xlxNetworkReloadTime;
|
||||
unsigned short m_xlxNetworkPort;
|
||||
std::string m_xlxNetworkPassword;
|
||||
unsigned short m_xlxNetworkLocal;
|
||||
unsigned int m_xlxNetworkSlot;
|
||||
unsigned int m_xlxNetworkTG;
|
||||
unsigned int m_xlxNetworkBase;
|
||||
unsigned int m_xlxNetworkStartup;
|
||||
unsigned int m_xlxNetworkRelink;
|
||||
bool m_xlxNetworkDebug;
|
||||
bool m_xlxNetworkUserControl;
|
||||
char m_xlxNetworkModule;
|
||||
bool m_xlxNetworkUserControl;
|
||||
char m_xlxNetworkModule;
|
||||
|
||||
bool m_gpsdEnabled;
|
||||
std::string m_gpsdAddress;
|
||||
@@ -392,16 +392,16 @@ private:
|
||||
|
||||
bool m_aprsEnabled;
|
||||
std::string m_aprsAddress;
|
||||
unsigned int m_aprsPort;
|
||||
unsigned short m_aprsPort;
|
||||
std::string m_aprsSuffix;
|
||||
std::string m_aprsDescription;
|
||||
|
||||
bool m_dynamicTGControlEnabled;
|
||||
unsigned int m_dynamicTGControlPort;
|
||||
unsigned short m_dynamicTGControlPort;
|
||||
|
||||
bool m_remoteControlEnabled;
|
||||
std::string m_remoteControlAddress;
|
||||
unsigned int m_remoteControlPort;
|
||||
unsigned short m_remoteControlPort;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -451,11 +451,11 @@ int CDMRGateway::run()
|
||||
bool remoteControlEnabled = m_conf.getRemoteControlEnabled();
|
||||
if (remoteControlEnabled) {
|
||||
std::string address = m_conf.getRemoteControlAddress();
|
||||
unsigned int port = m_conf.getRemoteControlPort();
|
||||
unsigned short port = m_conf.getRemoteControlPort();
|
||||
|
||||
LogInfo("Remote Control Parameters");
|
||||
LogInfo(" Address: %s", address.c_str());
|
||||
LogInfo(" Port: %u", port);
|
||||
LogInfo(" Port: %hu", port);
|
||||
|
||||
m_remoteControl = new CRemoteControl(this, address, port);
|
||||
|
||||
@@ -1345,16 +1345,16 @@ int CDMRGateway::run()
|
||||
bool CDMRGateway::createMMDVM()
|
||||
{
|
||||
std::string rptAddress = m_conf.getRptAddress();
|
||||
unsigned int rptPort = m_conf.getRptPort();
|
||||
unsigned short rptPort = m_conf.getRptPort();
|
||||
std::string localAddress = m_conf.getLocalAddress();
|
||||
unsigned int localPort = m_conf.getLocalPort();
|
||||
unsigned short localPort = m_conf.getLocalPort();
|
||||
bool debug = m_conf.getDebug();
|
||||
|
||||
LogInfo("MMDVM Network Parameters");
|
||||
LogInfo(" Rpt Address: %s", rptAddress.c_str());
|
||||
LogInfo(" Rpt Port: %u", rptPort);
|
||||
LogInfo(" Rpt Port: %hu", rptPort);
|
||||
LogInfo(" Local Address: %s", localAddress.c_str());
|
||||
LogInfo(" Local Port: %u", localPort);
|
||||
LogInfo(" Local Port: %hu", localPort);
|
||||
|
||||
m_repeater = new CMMDVMNetwork(rptAddress, rptPort, localAddress, localPort, debug);
|
||||
|
||||
@@ -1371,8 +1371,8 @@ bool CDMRGateway::createMMDVM()
|
||||
bool CDMRGateway::createDMRNetwork1()
|
||||
{
|
||||
std::string address = m_conf.getDMRNetwork1Address();
|
||||
unsigned int port = m_conf.getDMRNetwork1Port();
|
||||
unsigned int local = m_conf.getDMRNetwork1Local();
|
||||
unsigned short port = m_conf.getDMRNetwork1Port();
|
||||
unsigned short local = m_conf.getDMRNetwork1Local();
|
||||
unsigned int id = m_conf.getDMRNetwork1Id();
|
||||
std::string password = m_conf.getDMRNetwork1Password();
|
||||
bool location = m_conf.getDMRNetwork1Location();
|
||||
@@ -1386,9 +1386,9 @@ bool CDMRGateway::createDMRNetwork1()
|
||||
LogInfo(" Name: %s", m_dmr1Name.c_str());
|
||||
LogInfo(" Id: %u", id);
|
||||
LogInfo(" Address: %s", address.c_str());
|
||||
LogInfo(" Port: %u", port);
|
||||
LogInfo(" Port: %hu", port);
|
||||
if (local > 0U)
|
||||
LogInfo(" Local: %u", local);
|
||||
LogInfo(" Local: %hu", local);
|
||||
else
|
||||
LogInfo(" Local: random");
|
||||
LogInfo(" Location Data: %s", location ? "yes" : "no");
|
||||
@@ -1540,8 +1540,8 @@ bool CDMRGateway::createDMRNetwork1()
|
||||
bool CDMRGateway::createDMRNetwork2()
|
||||
{
|
||||
std::string address = m_conf.getDMRNetwork2Address();
|
||||
unsigned int port = m_conf.getDMRNetwork2Port();
|
||||
unsigned int local = m_conf.getDMRNetwork2Local();
|
||||
unsigned short port = m_conf.getDMRNetwork2Port();
|
||||
unsigned short local = m_conf.getDMRNetwork2Local();
|
||||
unsigned int id = m_conf.getDMRNetwork2Id();
|
||||
std::string password = m_conf.getDMRNetwork2Password();
|
||||
bool location = m_conf.getDMRNetwork2Location();
|
||||
@@ -1555,9 +1555,9 @@ bool CDMRGateway::createDMRNetwork2()
|
||||
LogInfo(" Name: %s", m_dmr2Name.c_str());
|
||||
LogInfo(" Id: %u", id);
|
||||
LogInfo(" Address: %s", address.c_str());
|
||||
LogInfo(" Port: %u", port);
|
||||
LogInfo(" Port: %hu", port);
|
||||
if (local > 0U)
|
||||
LogInfo(" Local: %u", local);
|
||||
LogInfo(" Local: %hu", local);
|
||||
else
|
||||
LogInfo(" Local: random");
|
||||
LogInfo(" Location Data: %s", location ? "yes" : "no");
|
||||
@@ -1709,8 +1709,8 @@ bool CDMRGateway::createDMRNetwork2()
|
||||
bool CDMRGateway::createDMRNetwork3()
|
||||
{
|
||||
std::string address = m_conf.getDMRNetwork3Address();
|
||||
unsigned int port = m_conf.getDMRNetwork3Port();
|
||||
unsigned int local = m_conf.getDMRNetwork3Local();
|
||||
unsigned short port = m_conf.getDMRNetwork3Port();
|
||||
unsigned short local = m_conf.getDMRNetwork3Local();
|
||||
unsigned int id = m_conf.getDMRNetwork3Id();
|
||||
std::string password = m_conf.getDMRNetwork3Password();
|
||||
bool location = m_conf.getDMRNetwork3Location();
|
||||
@@ -1724,9 +1724,9 @@ bool CDMRGateway::createDMRNetwork3()
|
||||
LogInfo(" Name: %s", m_dmr3Name.c_str());
|
||||
LogInfo(" Id: %u", id);
|
||||
LogInfo(" Address: %s", address.c_str());
|
||||
LogInfo(" Port: %u", port);
|
||||
LogInfo(" Port: %hu", port);
|
||||
if (local > 0U)
|
||||
LogInfo(" Local: %u", local);
|
||||
LogInfo(" Local: %hu", local);
|
||||
else
|
||||
LogInfo(" Local: random");
|
||||
LogInfo(" Location Data: %s", location ? "yes" : "no");
|
||||
@@ -1878,8 +1878,8 @@ bool CDMRGateway::createDMRNetwork3()
|
||||
bool CDMRGateway::createDMRNetwork4()
|
||||
{
|
||||
std::string address = m_conf.getDMRNetwork4Address();
|
||||
unsigned int port = m_conf.getDMRNetwork4Port();
|
||||
unsigned int local = m_conf.getDMRNetwork4Local();
|
||||
unsigned short port = m_conf.getDMRNetwork4Port();
|
||||
unsigned short local = m_conf.getDMRNetwork4Local();
|
||||
unsigned int id = m_conf.getDMRNetwork4Id();
|
||||
std::string password = m_conf.getDMRNetwork4Password();
|
||||
bool location = m_conf.getDMRNetwork4Location();
|
||||
@@ -1893,9 +1893,9 @@ bool CDMRGateway::createDMRNetwork4()
|
||||
LogInfo(" Name: %s", m_dmr4Name.c_str());
|
||||
LogInfo(" Id: %u", id);
|
||||
LogInfo(" Address: %s", address.c_str());
|
||||
LogInfo(" Port: %u", port);
|
||||
LogInfo(" Port: %hu", port);
|
||||
if (local > 0U)
|
||||
LogInfo(" Local: %u", local);
|
||||
LogInfo(" Local: %hu", local);
|
||||
else
|
||||
LogInfo(" Local: random");
|
||||
LogInfo(" Location Data: %s", location ? "yes" : "no");
|
||||
@@ -2047,8 +2047,8 @@ bool CDMRGateway::createDMRNetwork4()
|
||||
bool CDMRGateway::createDMRNetwork5()
|
||||
{
|
||||
std::string address = m_conf.getDMRNetwork5Address();
|
||||
unsigned int port = m_conf.getDMRNetwork5Port();
|
||||
unsigned int local = m_conf.getDMRNetwork5Local();
|
||||
unsigned short port = m_conf.getDMRNetwork5Port();
|
||||
unsigned short local = m_conf.getDMRNetwork5Local();
|
||||
unsigned int id = m_conf.getDMRNetwork5Id();
|
||||
std::string password = m_conf.getDMRNetwork5Password();
|
||||
bool location = m_conf.getDMRNetwork5Location();
|
||||
@@ -2062,9 +2062,9 @@ bool CDMRGateway::createDMRNetwork5()
|
||||
LogInfo(" Name: %s", m_dmr5Name.c_str());
|
||||
LogInfo(" Id: %u", id);
|
||||
LogInfo(" Address: %s", address.c_str());
|
||||
LogInfo(" Port: %u", port);
|
||||
LogInfo(" Port: %hu", port);
|
||||
if (local > 0U)
|
||||
LogInfo(" Local: %u", local);
|
||||
LogInfo(" Local: %hu", local);
|
||||
else
|
||||
LogInfo(" Local: random");
|
||||
LogInfo(" Location Data: %s", location ? "yes" : "no");
|
||||
@@ -2249,10 +2249,10 @@ bool CDMRGateway::createXLXNetwork()
|
||||
LogInfo(" Hosts file: %s", fileName.c_str());
|
||||
LogInfo(" Reload time: %u minutes", reloadTime);
|
||||
if (m_xlxLocal > 0U)
|
||||
LogInfo(" Local: %u", m_xlxLocal);
|
||||
LogInfo(" Local: %hu", m_xlxLocal);
|
||||
else
|
||||
LogInfo(" Local: random");
|
||||
LogInfo(" Port: %u", m_xlxPort);
|
||||
LogInfo(" Port: %hu", m_xlxPort);
|
||||
LogInfo(" Slot: %u", m_xlxSlot);
|
||||
LogInfo(" TG: %u", m_xlxTG);
|
||||
LogInfo(" Base: %u", m_xlxBase);
|
||||
@@ -2286,7 +2286,7 @@ bool CDMRGateway::createXLXNetwork()
|
||||
|
||||
bool CDMRGateway::createDynamicTGControl()
|
||||
{
|
||||
unsigned int port = m_conf.getDynamicTGControlPort();
|
||||
unsigned short port = m_conf.getDynamicTGControlPort();
|
||||
|
||||
m_socket = new CUDPSocket(port);
|
||||
|
||||
@@ -2511,7 +2511,7 @@ void CDMRGateway::createAPRS()
|
||||
return;
|
||||
|
||||
std::string address = m_conf.getAPRSAddress();
|
||||
unsigned int port = m_conf.getAPRSPort();
|
||||
unsigned short port = m_conf.getAPRSPort();
|
||||
std::string suffix = m_conf.getAPRSSuffix();
|
||||
bool debug = m_conf.getDebug();
|
||||
|
||||
|
||||
@@ -81,8 +81,8 @@ private:
|
||||
unsigned int m_xlxSlot;
|
||||
unsigned int m_xlxTG;
|
||||
unsigned int m_xlxBase;
|
||||
unsigned int m_xlxLocal;
|
||||
unsigned int m_xlxPort;
|
||||
unsigned short m_xlxLocal;
|
||||
unsigned short m_xlxPort;
|
||||
std::string m_xlxPassword;
|
||||
unsigned int m_xlxStartup;
|
||||
unsigned int m_xlxRoom;
|
||||
|
||||
@@ -31,7 +31,7 @@ const unsigned int BUFFER_LENGTH = 500U;
|
||||
const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U;
|
||||
|
||||
|
||||
CDMRNetwork::CDMRNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, const std::string& name, bool location, bool debug) :
|
||||
CDMRNetwork::CDMRNetwork(const std::string& address, unsigned short port, unsigned short local, unsigned int id, const std::string& password, const std::string& name, bool location, bool debug) :
|
||||
m_addr(),
|
||||
m_addrLen(0U),
|
||||
m_id(NULL),
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
class CDMRNetwork
|
||||
{
|
||||
public:
|
||||
CDMRNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, const std::string& name, bool location, bool debug);
|
||||
CDMRNetwork(const std::string& address, unsigned short port, unsigned short local, unsigned int id, const std::string& password, const std::string& name, bool location, bool debug);
|
||||
~CDMRNetwork();
|
||||
|
||||
void setOptions(const std::string& options);
|
||||
|
||||
@@ -30,7 +30,7 @@ const unsigned int BUFFER_LENGTH = 500U;
|
||||
const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U;
|
||||
|
||||
|
||||
CMMDVMNetwork::CMMDVMNetwork(const std::string& rptAddress, unsigned int rptPort, const std::string& localAddress, unsigned int localPort, bool debug) :
|
||||
CMMDVMNetwork::CMMDVMNetwork(const std::string& rptAddress, unsigned short rptPort, const std::string& localAddress, unsigned short localPort, bool debug) :
|
||||
m_rptAddr(),
|
||||
m_rptAddrLen(0U),
|
||||
m_id(0U),
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
class CMMDVMNetwork
|
||||
{
|
||||
public:
|
||||
CMMDVMNetwork(const std::string& rptAddress, unsigned int rptPort, const std::string& localAddress, unsigned int localPort, bool debug);
|
||||
CMMDVMNetwork(const std::string& rptAddress, unsigned short rptPort, const std::string& localAddress, unsigned short localPort, bool debug);
|
||||
~CMMDVMNetwork();
|
||||
|
||||
unsigned int getShortConfig(unsigned char* config) const;
|
||||
|
||||
@@ -30,7 +30,7 @@ const unsigned int DISABLE_ARGS = 2U;
|
||||
|
||||
const unsigned int BUFFER_LENGTH = 100U;
|
||||
|
||||
CRemoteControl::CRemoteControl(CDMRGateway* host, const std::string address, unsigned int port) :
|
||||
CRemoteControl::CRemoteControl(CDMRGateway* host, const std::string address, unsigned short port) :
|
||||
m_host(host),
|
||||
m_socket(address, port),
|
||||
m_command(RCD_NONE),
|
||||
|
||||
@@ -46,7 +46,7 @@ class CDMRNetwork;
|
||||
|
||||
class CRemoteControl {
|
||||
public:
|
||||
CRemoteControl(CDMRGateway* host, const std::string address, unsigned int port);
|
||||
CRemoteControl(CDMRGateway* host, const std::string address, unsigned short port);
|
||||
~CRemoteControl();
|
||||
|
||||
bool open();
|
||||
|
||||
@@ -28,11 +28,12 @@
|
||||
#if defined(HAVE_LOG_H)
|
||||
#include "Log.h"
|
||||
#else
|
||||
#define LogMessage(fmt, ...) ::fprintf(stderr, fmt "\n", ## __VA_ARGS__)
|
||||
#define LogError(fmt, ...) ::fprintf(stderr, fmt "\n", ## __VA_ARGS__)
|
||||
#define LogInfo(fmt, ...) ::fprintf(stderr, fmt "\n", ## __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
CUDPSocket::CUDPSocket(const std::string& address, unsigned int port) :
|
||||
CUDPSocket::CUDPSocket(const std::string& address, unsigned short port) :
|
||||
m_address_save(address),
|
||||
m_port_save(port),
|
||||
m_counter(0U)
|
||||
@@ -45,7 +46,7 @@ m_counter(0U)
|
||||
}
|
||||
}
|
||||
|
||||
CUDPSocket::CUDPSocket(unsigned int port) :
|
||||
CUDPSocket::CUDPSocket(unsigned short port) :
|
||||
m_address_save(),
|
||||
m_port_save(port),
|
||||
m_counter(0U)
|
||||
@@ -79,7 +80,7 @@ void CUDPSocket::shutdown()
|
||||
#endif
|
||||
}
|
||||
|
||||
int CUDPSocket::lookup(const std::string& hostname, unsigned int port, sockaddr_storage& addr, unsigned int& address_length)
|
||||
int CUDPSocket::lookup(const std::string& hostname, unsigned short port, sockaddr_storage& addr, unsigned int& address_length)
|
||||
{
|
||||
struct addrinfo hints;
|
||||
::memset(&hints, 0, sizeof(hints));
|
||||
@@ -87,7 +88,7 @@ int CUDPSocket::lookup(const std::string& hostname, unsigned int port, sockaddr_
|
||||
return lookup(hostname, port, addr, address_length, hints);
|
||||
}
|
||||
|
||||
int CUDPSocket::lookup(const std::string& hostname, unsigned int port, sockaddr_storage& addr, unsigned int& address_length, struct addrinfo& hints)
|
||||
int CUDPSocket::lookup(const std::string& hostname, unsigned short port, sockaddr_storage& addr, unsigned int& address_length, struct addrinfo& hints)
|
||||
{
|
||||
std::string portstr = std::to_string(port);
|
||||
struct addrinfo *res;
|
||||
@@ -170,7 +171,7 @@ bool CUDPSocket::open(unsigned int af)
|
||||
return open(0, af, m_address_save, m_port_save);
|
||||
}
|
||||
|
||||
bool CUDPSocket::open(const unsigned int index, const unsigned int af, const std::string& address, const unsigned int port)
|
||||
bool CUDPSocket::open(const unsigned int index, const unsigned int af, const std::string& address, const unsigned short port)
|
||||
{
|
||||
sockaddr_storage addr;
|
||||
unsigned int addrlen;
|
||||
@@ -224,7 +225,7 @@ bool CUDPSocket::open(const unsigned int index, const unsigned int af, const std
|
||||
return false;
|
||||
}
|
||||
|
||||
LogInfo("Opening UDP port on %u", port);
|
||||
LogInfo("Opening UDP port on %hu", port);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -293,7 +294,7 @@ int CUDPSocket::read(unsigned char* buffer, unsigned int length, sockaddr_storag
|
||||
LogError("Error returned from recvfrom, err: %d", errno);
|
||||
|
||||
if (len == -1 && errno == ENOTSOCK) {
|
||||
LogMessage("Re-opening UDP port on %u", m_port);
|
||||
LogMessage("Re-opening UDP port on %hu", m_port[index]);
|
||||
close();
|
||||
open();
|
||||
}
|
||||
@@ -351,7 +352,7 @@ void CUDPSocket::close()
|
||||
|
||||
void CUDPSocket::close(const unsigned int index)
|
||||
{
|
||||
if ((index < UDP_SOCKET_MAX) && (m_fd[index] >= 0)) {
|
||||
if ((index < UDP_SOCKET_MAX) && (m_fd[index] >= 0)) {
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
::closesocket(m_fd[index]);
|
||||
#else
|
||||
|
||||
10
UDPSocket.h
10
UDPSocket.h
@@ -46,13 +46,13 @@ enum IPMATCHTYPE {
|
||||
|
||||
class CUDPSocket {
|
||||
public:
|
||||
CUDPSocket(const std::string& address, unsigned int port = 0U);
|
||||
CUDPSocket(unsigned int port = 0U);
|
||||
CUDPSocket(const std::string& address, unsigned short port = 0U);
|
||||
CUDPSocket(unsigned short port = 0U);
|
||||
~CUDPSocket();
|
||||
|
||||
bool open(unsigned int af = AF_UNSPEC);
|
||||
bool open(const sockaddr_storage& address);
|
||||
bool open(const unsigned int index, const unsigned int af, const std::string& address, const unsigned int port);
|
||||
bool open(const unsigned int index, const unsigned int af, const std::string& address, const unsigned short port);
|
||||
|
||||
int read(unsigned char* buffer, unsigned int length, sockaddr_storage& address, unsigned int &address_length);
|
||||
bool write(const unsigned char* buffer, unsigned int length, const sockaddr_storage& address, unsigned int address_length);
|
||||
@@ -63,8 +63,8 @@ public:
|
||||
static void startup();
|
||||
static void shutdown();
|
||||
|
||||
static int lookup(const std::string& hostName, unsigned int port, sockaddr_storage& address, unsigned int& address_length);
|
||||
static int lookup(const std::string& hostName, unsigned int port, sockaddr_storage& address, unsigned int& address_length, struct addrinfo& hints);
|
||||
static int lookup(const std::string& hostName, unsigned short port, sockaddr_storage& address, unsigned int& address_length);
|
||||
static int lookup(const std::string& hostName, unsigned short port, sockaddr_storage& address, unsigned int& address_length, struct addrinfo& hints);
|
||||
|
||||
static bool match(const sockaddr_storage& addr1, const sockaddr_storage& addr2, IPMATCHTYPE type = IMT_ADDRESS_AND_PORT);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user