Merge branch 'g4klx:master' into master

This commit is contained in:
N2WNS 2021-07-15 19:39:00 -04:00 committed by GitHub
commit 2695b6707c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 201 additions and 169 deletions

View File

@ -24,7 +24,7 @@
#include <cstring> #include <cstring>
#include <cmath> #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_idTimer(1000U),
m_callsign(callsign), m_callsign(callsign),
m_debug(debug), m_debug(debug),

View File

@ -42,7 +42,7 @@
class CAPRSWriter { class CAPRSWriter {
public: 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(); ~CAPRSWriter();
bool open(); bool open();

View File

@ -177,9 +177,9 @@ bool CConf::read()
else if (::strcmp(key, "RptAddress") == 0) else if (::strcmp(key, "RptAddress") == 0)
m_rptAddress = value; m_rptAddress = value;
else if (::strcmp(key, "RptPort") == 0) else if (::strcmp(key, "RptPort") == 0)
m_rptPort = (unsigned int)::atoi(value); m_rptPort = (unsigned short)::atoi(value);
else if (::strcmp(key, "LocalPort") == 0) else if (::strcmp(key, "LocalPort") == 0)
m_myPort = (unsigned int)::atoi(value); m_myPort = (unsigned short)::atoi(value);
else if (::strcmp(key, "Debug") == 0) else if (::strcmp(key, "Debug") == 0)
m_debug = ::atoi(value) == 1; m_debug = ::atoi(value) == 1;
else if (::strcmp(key, "Daemon") == 0) else if (::strcmp(key, "Daemon") == 0)
@ -230,14 +230,14 @@ bool CConf::read()
else if (::strcmp(key, "Address") == 0) else if (::strcmp(key, "Address") == 0)
m_aprsAddress = value; m_aprsAddress = value;
else if (::strcmp(key, "Port") == 0) else if (::strcmp(key, "Port") == 0)
m_aprsPort = (unsigned int)::atoi(value); m_aprsPort = (unsigned short)::atoi(value);
else if (::strcmp(key, "Suffix") == 0) else if (::strcmp(key, "Suffix") == 0)
m_aprsSuffix = value; m_aprsSuffix = value;
else if (::strcmp(key, "Description") == 0) else if (::strcmp(key, "Description") == 0)
m_aprsDescription = value; m_aprsDescription = value;
} else if (section == SECTION_NETWORK) { } else if (section == SECTION_NETWORK) {
if (::strcmp(key, "Port") == 0) if (::strcmp(key, "Port") == 0)
m_networkPort = (unsigned int)::atoi(value); m_networkPort = (unsigned short)::atoi(value);
else if (::strcmp(key, "HostsFile1") == 0) else if (::strcmp(key, "HostsFile1") == 0)
m_networkHosts1 = value; m_networkHosts1 = value;
else if (::strcmp(key, "HostsFile2") == 0) else if (::strcmp(key, "HostsFile2") == 0)
@ -247,11 +247,11 @@ bool CConf::read()
else if (::strcmp(key, "ParrotAddress") == 0) else if (::strcmp(key, "ParrotAddress") == 0)
m_networkParrotAddress = value; m_networkParrotAddress = value;
else if (::strcmp(key, "ParrotPort") == 0) else if (::strcmp(key, "ParrotPort") == 0)
m_networkParrotPort = (unsigned int)::atoi(value); m_networkParrotPort = (unsigned short)::atoi(value);
else if (::strcmp(key, "NXDN2DMRAddress") == 0) else if (::strcmp(key, "NXDN2DMRAddress") == 0)
m_networkNXDN2DMRAddress = value; m_networkNXDN2DMRAddress = value;
else if (::strcmp(key, "NXDN2DMRPort") == 0) else if (::strcmp(key, "NXDN2DMRPort") == 0)
m_networkNXDN2DMRPort = (unsigned int)::atoi(value); m_networkNXDN2DMRPort = (unsigned short)::atoi(value);
else if (::strcmp(key, "Static") == 0) { else if (::strcmp(key, "Static") == 0) {
char* p = ::strtok(value, ",\r\n"); char* p = ::strtok(value, ",\r\n");
while (p != NULL) { while (p != NULL) {
@ -276,7 +276,7 @@ bool CConf::read()
if (::strcmp(key, "Enable") == 0) if (::strcmp(key, "Enable") == 0)
m_remoteCommandsEnabled = ::atoi(value) == 1; m_remoteCommandsEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Port") == 0) else if (::strcmp(key, "Port") == 0)
m_remoteCommandsPort = (unsigned int)::atoi(value); m_remoteCommandsPort = (unsigned short)::atoi(value);
} }
} }
@ -305,12 +305,12 @@ std::string CConf::getRptAddress() const
return m_rptAddress; return m_rptAddress;
} }
unsigned int CConf::getRptPort() const unsigned short CConf::getRptPort() const
{ {
return m_rptPort; return m_rptPort;
} }
unsigned int CConf::getMyPort() const unsigned short CConf::getMyPort() const
{ {
return m_myPort; return m_myPort;
} }
@ -400,7 +400,7 @@ std::string CConf::getAPRSAddress() const
return m_aprsAddress; return m_aprsAddress;
} }
unsigned int CConf::getAPRSPort() const unsigned short CConf::getAPRSPort() const
{ {
return m_aprsPort; return m_aprsPort;
} }
@ -440,7 +440,7 @@ bool CConf::getLogFileRotate() const
return m_logFileRotate; return m_logFileRotate;
} }
unsigned int CConf::getNetworkPort() const unsigned short CConf::getNetworkPort() const
{ {
return m_networkPort; return m_networkPort;
} }
@ -465,7 +465,7 @@ std::string CConf::getNetworkParrotAddress() const
return m_networkParrotAddress; return m_networkParrotAddress;
} }
unsigned int CConf::getNetworkParrotPort() const unsigned short CConf::getNetworkParrotPort() const
{ {
return m_networkParrotPort; return m_networkParrotPort;
} }
@ -475,7 +475,7 @@ std::string CConf::getNetworkNXDN2DMRAddress() const
return m_networkNXDN2DMRAddress; return m_networkNXDN2DMRAddress;
} }
unsigned int CConf::getNetworkNXDN2DMRPort() const unsigned short CConf::getNetworkNXDN2DMRPort() const
{ {
return m_networkNXDN2DMRPort; return m_networkNXDN2DMRPort;
} }
@ -520,7 +520,7 @@ bool CConf::getRemoteCommandsEnabled() const
return m_remoteCommandsEnabled; return m_remoteCommandsEnabled;
} }
unsigned int CConf::getRemoteCommandsPort() const unsigned short CConf::getRemoteCommandsPort() const
{ {
return m_remoteCommandsPort; return m_remoteCommandsPort;
} }

View File

@ -35,8 +35,8 @@ public:
std::string getSuffix() const; std::string getSuffix() const;
std::string getRptProtocol() const; std::string getRptProtocol() const;
std::string getRptAddress() const; std::string getRptAddress() const;
unsigned int getRptPort() const; unsigned short getRptPort() const;
unsigned int getMyPort() const; unsigned short getMyPort() const;
bool getDebug() const; bool getDebug() const;
bool getDaemon() const; bool getDaemon() const;
@ -62,7 +62,7 @@ public:
// The APRS section // The APRS section
bool getAPRSEnabled() const; bool getAPRSEnabled() const;
std::string getAPRSAddress() const; std::string getAPRSAddress() const;
unsigned int getAPRSPort() const; unsigned short getAPRSPort() const;
std::string getAPRSSuffix() const; std::string getAPRSSuffix() const;
std::string getAPRSDescription() const; std::string getAPRSDescription() const;
@ -74,14 +74,14 @@ public:
bool getLogFileRotate() const; bool getLogFileRotate() const;
// The Network section // The Network section
unsigned int getNetworkPort() const; unsigned short getNetworkPort() const;
std::string getNetworkHosts1() const; std::string getNetworkHosts1() const;
std::string getNetworkHosts2() const; std::string getNetworkHosts2() const;
unsigned int getNetworkReloadTime() const; unsigned int getNetworkReloadTime() const;
std::string getNetworkParrotAddress() const; std::string getNetworkParrotAddress() const;
unsigned int getNetworkParrotPort() const; unsigned short getNetworkParrotPort() const;
std::string getNetworkNXDN2DMRAddress() const; std::string getNetworkNXDN2DMRAddress() const;
unsigned int getNetworkNXDN2DMRPort() const; unsigned short getNetworkNXDN2DMRPort() const;
std::vector<unsigned short> getNetworkStatic() const; std::vector<unsigned short> getNetworkStatic() const;
unsigned int getNetworkRFHangTime() const; unsigned int getNetworkRFHangTime() const;
unsigned int getNetworkNetHangTime() const; unsigned int getNetworkNetHangTime() const;
@ -94,7 +94,7 @@ public:
// The Remote Commands section // The Remote Commands section
bool getRemoteCommandsEnabled() const; bool getRemoteCommandsEnabled() const;
unsigned int getRemoteCommandsPort() const; unsigned short getRemoteCommandsPort() const;
private: private:
std::string m_file; std::string m_file;
@ -102,8 +102,8 @@ private:
std::string m_suffix; std::string m_suffix;
std::string m_rptProtocol; std::string m_rptProtocol;
std::string m_rptAddress; std::string m_rptAddress;
unsigned int m_rptPort; unsigned short m_rptPort;
unsigned int m_myPort; unsigned short m_myPort;
bool m_debug; bool m_debug;
bool m_daemon; bool m_daemon;
@ -131,18 +131,18 @@ private:
bool m_aprsEnabled; bool m_aprsEnabled;
std::string m_aprsAddress; std::string m_aprsAddress;
unsigned int m_aprsPort; unsigned short m_aprsPort;
std::string m_aprsSuffix; std::string m_aprsSuffix;
std::string m_aprsDescription; std::string m_aprsDescription;
unsigned int m_networkPort; unsigned short m_networkPort;
std::string m_networkHosts1; std::string m_networkHosts1;
std::string m_networkHosts2; std::string m_networkHosts2;
unsigned int m_networkReloadTime; unsigned int m_networkReloadTime;
std::string m_networkParrotAddress; std::string m_networkParrotAddress;
unsigned int m_networkParrotPort; unsigned short m_networkParrotPort;
std::string m_networkNXDN2DMRAddress; std::string m_networkNXDN2DMRAddress;
unsigned int m_networkNXDN2DMRPort; unsigned short m_networkNXDN2DMRPort;
std::vector<unsigned short> m_networkStatic; std::vector<unsigned short> m_networkStatic;
unsigned int m_networkRFHangTime; unsigned int m_networkRFHangTime;
unsigned int m_networkNetHangTime; unsigned int m_networkNetHangTime;
@ -153,7 +153,7 @@ private:
std::string m_gpsdPort; std::string m_gpsdPort;
bool m_remoteCommandsEnabled; bool m_remoteCommandsEnabled;
unsigned int m_remoteCommandsPort; unsigned short m_remoteCommandsPort;
}; };
#endif #endif

View File

@ -26,7 +26,7 @@
const unsigned int BUFFER_LENGTH = 200U; const unsigned int BUFFER_LENGTH = 200U;
CIcomNetwork::CIcomNetwork(unsigned int localPort, const std::string& rptAddress, unsigned int rptPort, bool debug) : CIcomNetwork::CIcomNetwork(unsigned short localPort, const std::string& rptAddress, unsigned short rptPort, bool debug) :
m_socket(localPort), m_socket(localPort),
m_addr(), m_addr(),
m_addrLen(0U), m_addrLen(0U),

View File

@ -27,7 +27,7 @@
class CIcomNetwork : public IRptNetwork { class CIcomNetwork : public IRptNetwork {
public: public:
CIcomNetwork(unsigned int localPort, const std::string& rptAddress, unsigned int rptPort, bool debug); CIcomNetwork(unsigned short localPort, const std::string& rptAddress, unsigned short rptPort, bool debug);
virtual ~CIcomNetwork(); virtual ~CIcomNetwork();
virtual bool open(); virtual bool open();

View File

@ -33,7 +33,7 @@ const unsigned char BIT_MASK_TABLE[] = { 0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04
const unsigned int BUFFER_LENGTH = 200U; const unsigned int BUFFER_LENGTH = 200U;
CKenwoodNetwork::CKenwoodNetwork(unsigned int localPort, const std::string& rptAddress, unsigned int rptPort, bool debug) : CKenwoodNetwork::CKenwoodNetwork(unsigned short localPort, const std::string& rptAddress, unsigned short rptPort, bool debug) :
m_rtpSocket(localPort + 0U), m_rtpSocket(localPort + 0U),
m_rtcpSocket(localPort + 1U), m_rtcpSocket(localPort + 1U),
m_rtcpAddr(), m_rtcpAddr(),

View File

@ -29,7 +29,7 @@
class CKenwoodNetwork : public IRptNetwork { class CKenwoodNetwork : public IRptNetwork {
public: public:
CKenwoodNetwork(unsigned int localPort, const std::string& rptAddress, unsigned int rptPort, bool debug); CKenwoodNetwork(unsigned short localPort, const std::string& rptAddress, unsigned short rptPort, bool debug);
virtual ~CKenwoodNetwork(); virtual ~CKenwoodNetwork();
virtual bool open(); virtual bool open();

View File

@ -628,7 +628,7 @@ void CNXDNGateway::createGPS()
std::string callsign = m_conf.getCallsign(); std::string callsign = m_conf.getCallsign();
std::string rptSuffix = m_conf.getSuffix(); std::string rptSuffix = m_conf.getSuffix();
std::string address = m_conf.getAPRSAddress(); std::string address = m_conf.getAPRSAddress();
unsigned int port = m_conf.getAPRSPort(); unsigned short port = m_conf.getAPRSPort();
std::string suffix = m_conf.getAPRSSuffix(); std::string suffix = m_conf.getAPRSSuffix();
bool debug = m_conf.getDebug(); bool debug = m_conf.getDebug();

View File

@ -3,6 +3,9 @@
# The format of this file is the number of the Talk Group followed by the host name or address and port # The format of this file is the number of the Talk Group followed by the host name or address and port
# #
# 138 Thailand
138 e23jwe.ddns.net 41400
# 202 HELLAS Zone # 202 HELLAS Zone
202 hellaszone.com 41400 202 hellaszone.com 41400
@ -25,40 +28,46 @@
505 43.229.63.42 41450 505 43.229.63.42 41450
# 530 New Zealand # 530 New Zealand
530 zldigitalreflectors.hopto.org 41400 530 zldigitalreflectors.hopto.org 41400
# 545 XLX545E PA # 545 XLX545E PA
545 70.44.20.24 41401 545 70.44.20.24 41401
# 707 RuralMN Reflector # 707 RuralMN Reflector
707 707nxdn.kd0ioe.com 41400 707 707nxdn.kd0ioe.com 41400
# 730 Chile NXDN Reflector to BM TG 730 # 730 Chile NXDN Reflector to BM TG 730
730 sdradio.cl 41400 730 sdradio.cl 41400
# 822 Thailand NXDN to BM TG 520822
822 nxdn.dstarthailand.com 41400
# 910 Washington DC - Virginia - Maryland
910 nxdn910.freeddns.org 41400
# 911 Cop Talk, Multimode TG for Police and First Responders # 911 Cop Talk, Multimode TG for Police and First Responders
911 nxdn.k2cop.com 41400 911 nxdn.k2cop.com 41400
# 914 Latin America # 914 Latin America
914 164.132.96.157 41400 914 80.211.94.145 41400
# 1200 Florida # 1200 Florida
1200 florida.nxref.org 41400 1200 florida.nxref.org 41400
# 2140 DMRplus BM Multi # 2140 DMRplus BM Multi
2140 94.177.235.81 41400 2140 94.177.235.81 41400
# 2225 IT Tuscany # 2225 IT Tuscany
2225 80.211.99.134 41400 2225 80.211.99.134 41400
# 2231 IT Multiprotocollo Sardegna # 2231 IT Multiprotocollo Sardegna
2231 nxdn.is0.org 41400 2231 nxdn.is0.org 41400
# 2241 IT TUSCANY MULTIP # 2241 IT TUSCANY MULTIP
2241 nxdn.grupporadiofirenze.net 41400 2241 nxdn.grupporadiofirenze.net 41400
# 2249 IT SICILIA # 2249 IT SICILIA
2249 nxdn.digitalsicilia.it 41400 2249 nxdn.digitalsicilia.it 41400
# 2263 Bucharest YO3 NXDN Network # 2263 Bucharest YO3 NXDN Network
2263 nxdn.dstar-yo.ro 41403 2263 nxdn.dstar-yo.ro 41403
@ -67,19 +76,22 @@
2265 nxdn.dstar-yo.ro 41405 2265 nxdn.dstar-yo.ro 41405
# 2503 RU DMR # 2503 RU DMR
2503 nxdn.r1ik.ru 41400 2503 nxdn.r1ik.ru 41400
# 2700 Melbourne FL # 2700 Melbourne FL
2700 2700nxdn.ddns.net 41400 2700 2700nxdn.ddns.net 41400
# 3023 Ontario Crosslink # 3023 Ontario Crosslink
3023 ontxlink.hopto.org 41400 3023 ontxlink.hopto.org 41400
# 3142 Pennsylvania # 3142 Pennsylvania
3142 3.215.215.169 41402 3142 3.215.215.169 41402
# PRadise # PRadise
3300 nxdn3300.from-pr.com 41400 3300 nxdn3300.from-pr.com 41400
# 3400 W2BTN Group
3400 w2btn.dmrnet.net 41400
# 3400 W2BTN Group # 3400 W2BTN Group
3400 w2btn.dmrnet.net 41400 3400 w2btn.dmrnet.net 41400
@ -88,16 +100,16 @@
5057 45.248.50.37 41400 5057 45.248.50.37 41400
# 7160 Peru Digital # 7160 Peru Digital
7160 nxdn.dmr-peru.pe 41400 7160 nxdn.dmr-peru.pe 41400
# 7225 Multiprotocolo Argentina # 7225 Multiprotocolo Argentina
7225 ysfarg.ddns.net 41400 7225 ysfarg.ddns.net 41400
# 7309 CHILE-LINK NXDN Reflector to BM TG 73099 # 7309 CHILE-LINK NXDN Reflector to BM TG 73099
7309 sdradio.cl 41401 7309 sdradio.cl 41401
# 9480 ICQPODCAST # 9480 ICQPODCAST
9480 xlx.icqpodcast.com 42400 9480 xlx.icqpodcast.com 42400
# 9846 NXDN Portal to WW8GM YSF network www.gmarc.org # 9846 NXDN Portal to WW8GM YSF network www.gmarc.org
9846 nxdn.dudetronics.com 41401 9846 nxdn.dudetronics.com 41401
@ -133,61 +145,67 @@
20328 nxdn.projekt-pegasus.net 41400 20328 nxdn.projekt-pegasus.net 41400
# 20330 NXDN German DE-RAMSES Project # 20330 NXDN German DE-RAMSES Project
20330 161.97.140.131 41400 20330 161.97.140.131 41400
# 20333 NXDN LausitzLink Germany
20333 nxdn02.bzsax.de 41400
# 20421 DL-Nordwest (dl-nordwest.com) by 9V1LH/DG1BGS and DK5BS # 20421 DL-Nordwest (dl-nordwest.com) by 9V1LH/DG1BGS and DK5BS
20421 9v1lh.spdns.org 41400 20421 9v1lh.spdns.org 41400
# 20945 Deutschland DL1BH # 20945 Deutschland DL1BH
20945 dl1bh.ddns.net 41400 20945 dl1bh.ddns.net 41400
# 21410 NXDN SPAIN # 21410 NXDN SPAIN
21410 nxdn21410.nxdn.es 41400 21410 nxdn21410.nxdn.es 41400
# 21401 Andalucia Room
21401 94.177.189.17 41401
# 21418 NXDN RC Veleta # 21418 NXDN RC Veleta
21418 rcveleta.xreflector.es 41400 21418 rcveleta.xreflector.es 41400
# 21430 Alcayna # 21430 Alcayna
21430 alcayna.duckdns.org 41400 21430 alcayna.duckdns.org 41400
# 21465 ADER Multimode # 21465 ADER Multimode
21465 aderdigital.ddns.net 41400 21465 aderdigital.ddns.net 41400
# 22200 IT HBLINK ITALY # 22200 IT HBLINK ITALY
22200 nxdn.hblink.it 41400 22200 nxdn.hblink.it 41400
# 22202 IT SARDINIA # 22202 IT SARDINIA
22202 87.106.152.249 41400 22202 87.106.152.249 41400
# 22221 HBLINK IT-DMR REGIONALE LOMBARDIA # 22221 HBLINK IT-DMR REGIONALE LOMBARDIA
22221 dagobah.hblink.it 41400 22221 dagobah.hblink.it 41400
# 22245 IT PIEDMONT GDO # 22245 IT PIEDMONT GDO
22245 nxdngdo.duckdns.org 41400 22245 nxdngdo.duckdns.org 41400
# 22252 IT MULTIPROTOCOL NETWORK # 22252 IT MULTIPROTOCOL NETWORK
22252 46.226.178.80 41400 22252 46.226.178.80 41400
# 22258 D2ALP HBLink Italia # 22258 D2ALP HBLink Italia
22258 94.177.173.53 41400 22258 94.177.173.53 41400
# 22292 IT MP XLX039/B BM2222 # 22292 IT MP XLX039/B BM2222
22292 hblink.dmrbrescia.it 41400 22292 hblink.dmrbrescia.it 41400
# 22825 Swiss NXDN Reflerctor # 22825 Swiss NXDN Reflerctor
22825 212.237.33.114 41400 22825 212.237.33.114 41400
# 23426 FreeSTAR NXDN Reflerctor
23426 obp.freestar.network 41400
# 23551 NXDN Scotland # 23551 NXDN Scotland
23551 nxdnscotland.ddns.net 41400 23551 nxdnscotland.ddns.net 41400
# 23595 OZ-DMR_CHAT
23595 reflector.oz-dmr.uk 41400
# 25000 NX Core # 25000 NX Core
25000 173.166.94.77 41400 25000 173.166.94.77 41400
# 25577 UA Azimuth # 25577 UA Azimuth
25577 178.136.234.51 41400 25577 178.136.234.51 41400
# 25617 Russia Kavkaz # 25617 Russia Kavkaz
25617   kavkaz.qrz.ru 41400 25617   kavkaz.qrz.ru 41400
@ -198,11 +216,14 @@
# 26000 Poland # 26000 Poland
26000 80.211.249.221 41400 26000 80.211.249.221 41400
# 26078 Poland HBLink Network
26078 nxdn.hblink.kutno.pl 41400
# 26079 NXDN Poland local Group Reflector # 26079 NXDN Poland local Group Reflector
26079 nxdn-sp7.noip.pl 41400 26079 nxdn-sp7.noip.pl 41400
# 26085 Poland DMR+ # 26085 Poland DMR+
26085 91.245.81.2 41400 26085 91.245.81.2 41400
# 26200 Deutschland # 26200 Deutschland
26200 135.125.204.81 41400 26200 135.125.204.81 41400
@ -217,7 +238,7 @@
30639 nfonorcalnxdn.dyndns.org 41400 30639 nfonorcalnxdn.dyndns.org 41400
# 31010 Alabama-Link # 31010 Alabama-Link
31010 nxdn.alabamalink.info 41400 31010 alabamalink.radiotechnology.xyz 41400
# 31031 XLX310 Multimode Reflector # 31031 XLX310 Multimode Reflector
31031 ref.xlx310.com 41400 31031 ref.xlx310.com 41400
@ -229,47 +250,50 @@
31088 54.191.50.212 41400 31088 54.191.50.212 41400
# 31092 Connecticut Chat # 31092 Connecticut Chat
31092 nxdn.alecwasserman.com 41400 31092 nxdn.alecwasserman.com 41400
# 31137 Kingsland Digital Link # 31137 Kingsland Digital Link
31137 74.91.119.94 41400 31137 74.91.119.94 41400
# 31171 Illinois # 31171 Illinois Link
31171 74.208.235.115 41400 31171 illink.radiotechnology.xyz 41400
# 31188 Southern Indiana # 31188 Southern Indiana
31188 w9windigital.org 41400 31188 w9windigital.org 41400
# 31226 WorldWide Dx System
31226 198.245.53.107 41400
# 31257 NEARC # 31257 NEARC
31257 nxdn.w0jay.com 41400 31257 nxdn.w0jay.com 41400
# 31264 XLX625 The BROniverse www.wa8bro.com # 31264 XLX625 The BROniverse www.wa8bro.com
31264 nxdn.dudetronics.com 41400 31264 nxdn.dudetronics.com 41400
# 31340 Central New Jersey # 31340 Central New Jersey
31340 cnjham.msmts.com 41400 31340 cnjham.msmts.com 41400
# 31403 Oklahoma Link # 31403 Oklahoma Link
31403 3.208.70.29 41400 31403 3.208.70.29 41400
# 31425 XLX545A Pennsylvania Cross Mode # 31425 XLX545A Pennsylvania Cross Mode
31425 70.44.20.24 41400 31425 70.44.20.24 41400
# 31426 XLX545A Pennsylvania Cross Mode (alt) # 31426 XLX545A Pennsylvania Cross Mode (alt)
31426 3.215.215.169 41400 31426 3.215.215.169 41400
# 31444 Rhode Island Digital Link # 31444 Rhode Island Digital Link
31444 18.219.32.21 41400 31444 18.219.32.21 41400
# 31581 KD2UQK Long Island, NY - NXDN Reflector
31581 kd2uqk.ham-radio-op.net 41400
# 31665 TGIF Network # 31665 TGIF Network
31665 tgif.network 41400 31665 tgif.network 41400
# 31672 Pi-Star # 31672 Pi-Star
31672 nxdn-31672.pistar.uk 41400 31672 nxdn-31672.pistar.uk 41400
# 31769 MB6NG NXDN
31769 xlx235.mb6ng.uk 41400
# 31777 DX-LINK SYSTEM, # 31777 DX-LINK SYSTEM,
31777 8.9.4.102 41400 31777 8.9.4.102 41400
@ -277,25 +301,25 @@
31983 NXDNReflector31983.K8JTK.org 41400 31983 NXDNReflector31983.K8JTK.org 41400
# 32103 CW-Ops Academy # 32103 CW-Ops Academy
32103 cwops.dyndns.org 41400 32103 cwops.dyndns.org 41400
# 33581 OMISS Group # 33581 OMISS Group
33581 omiss.dyndns.org 41400 33581 omiss.dyndns.org 41400
# 37224 Haiti NXDN # 37224 Haiti NXDN
37224 44.98.254.130 41400 37224 44.98.254.130 41400
# 40721 Fusion Canada Fr /Wires-x /Ysf /Nxdn Network # 40721 Fusion Canada Fr /Wires-x /Ysf /Nxdn Network
40721 158.69.169.205 41400 40721 158.69.169.205 41400
# 45000 Korea # 45000 Korea
45000 nxdn.dvham.com 41400 45000 nxdn.dvham.com 41400
# 46000 China # 46000 China
46000 120.234.41.144 41400 46000 120.234.41.144 41400
# 43389 SouthEast Link # 43389 SouthEast Link
43389 nxdn.lmarc.net 41400 43389 nxdn.lmarc.net 41400
# 50525 DMR TG50525 bridge # 50525 DMR TG50525 bridge
50525 50525.nxref.org 41400 50525 50525.nxref.org 41400
@ -304,7 +328,7 @@
50599 nxdn.duckdns.org 41490 50599 nxdn.duckdns.org 41490
# 52000 Thailand DTDXA XLX520N # 52000 Thailand DTDXA XLX520N
52000 nxdn.dtdxa.com 41400 52000 nxdn.dtdxa.com 41400
# 53099 New Zealand, 53099 linked to BM TG 53099 # 53099 New Zealand, 53099 linked to BM TG 53099
53099 203.86.206.49 41400 53099 203.86.206.49 41400
@ -313,7 +337,7 @@
65000 176.9.1.168 41400 65000 176.9.1.168 41400
# 65100 NXDN - 2007DXGROUP # 65100 NXDN - 2007DXGROUP
65100 89.46.75.115 41400 65100 89.46.75.115 41400
# 65208 French-Test # 65208 French-Test
65208 m55.evxonline.net 41400 65208 m55.evxonline.net 41400

View File

@ -24,7 +24,7 @@
#include <cassert> #include <cassert>
#include <cstring> #include <cstring>
CNXDNNetwork::CNXDNNetwork(unsigned int port, const std::string& callsign, bool debug) : CNXDNNetwork::CNXDNNetwork(unsigned short port, const std::string& callsign, bool debug) :
m_callsign(callsign), m_callsign(callsign),
m_socket(), m_socket(),
m_port(port), m_port(port),

View File

@ -26,7 +26,7 @@
class CNXDNNetwork { class CNXDNNetwork {
public: public:
CNXDNNetwork(unsigned int port, const std::string& callsign, bool debug); CNXDNNetwork(unsigned short port, const std::string& callsign, bool debug);
~CNXDNNetwork(); ~CNXDNNetwork();
bool open(); bool open();
@ -44,7 +44,7 @@ public:
private: private:
std::string m_callsign; std::string m_callsign;
CUDPSocket m_socket; CUDPSocket m_socket;
unsigned int m_port; unsigned short m_port;
bool m_debug; bool m_debug;
}; };

View File

@ -46,13 +46,13 @@ CReflectors::~CReflectors()
m_reflectors.clear(); m_reflectors.clear();
} }
void CReflectors::setParrot(const std::string& address, unsigned int port) void CReflectors::setParrot(const std::string& address, unsigned short port)
{ {
m_parrotAddress = address; m_parrotAddress = address;
m_parrotPort = port; m_parrotPort = port;
} }
void CReflectors::setNXDN2DMR(const std::string& address, unsigned int port) void CReflectors::setNXDN2DMR(const std::string& address, unsigned short port)
{ {
m_nxdn2dmrAddress = address; m_nxdn2dmrAddress = address;
m_nxdn2dmrPort = port; m_nxdn2dmrPort = port;
@ -79,7 +79,7 @@ bool CReflectors::load()
if (p1 != NULL && p2 != NULL && p3 != NULL) { if (p1 != NULL && p2 != NULL && p3 != NULL) {
std::string host = std::string(p2); std::string host = std::string(p2);
unsigned int port = (unsigned int)::atoi(p3); unsigned short port = (unsigned short)::atoi(p3);
sockaddr_storage addr; sockaddr_storage addr;
unsigned int addrLen; unsigned int addrLen;
@ -114,7 +114,7 @@ bool CReflectors::load()
unsigned int id = (unsigned int)::atoi(p1); unsigned int id = (unsigned int)::atoi(p1);
if (find(id) == NULL) { if (find(id) == NULL) {
std::string host = std::string(p2); std::string host = std::string(p2);
unsigned int port = (unsigned int)::atoi(p3); unsigned short port = (unsigned short)::atoi(p3);
sockaddr_storage addr; sockaddr_storage addr;
unsigned int addrLen; unsigned int addrLen;

View File

@ -44,8 +44,8 @@ public:
CReflectors(const std::string& hostsFile1, const std::string& hostsFile2, unsigned int reloadTime); CReflectors(const std::string& hostsFile1, const std::string& hostsFile2, unsigned int reloadTime);
~CReflectors(); ~CReflectors();
void setParrot(const std::string& address, unsigned int port); void setParrot(const std::string& address, unsigned short port);
void setNXDN2DMR(const std::string& address, unsigned int port); void setNXDN2DMR(const std::string& address, unsigned short port);
bool load(); bool load();
@ -57,9 +57,9 @@ private:
std::string m_hostsFile1; std::string m_hostsFile1;
std::string m_hostsFile2; std::string m_hostsFile2;
std::string m_parrotAddress; std::string m_parrotAddress;
unsigned int m_parrotPort; unsigned short m_parrotPort;
std::string m_nxdn2dmrAddress; std::string m_nxdn2dmrAddress;
unsigned int m_nxdn2dmrPort; unsigned short m_nxdn2dmrPort;
std::vector<CNXDNReflector*> m_reflectors; std::vector<CNXDNReflector*> m_reflectors;
CTimer m_timer; CTimer m_timer;
}; };

View File

@ -28,11 +28,12 @@
#if defined(HAVE_LOG_H) #if defined(HAVE_LOG_H)
#include "Log.h" #include "Log.h"
#else #else
#define LogMessage(fmt, ...) ::fprintf(stderr, fmt "\n", ## __VA_ARGS__)
#define LogError(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__) #define LogInfo(fmt, ...) ::fprintf(stderr, fmt "\n", ## __VA_ARGS__)
#endif #endif
CUDPSocket::CUDPSocket(const std::string& address, unsigned int port) : CUDPSocket::CUDPSocket(const std::string& address, unsigned short port) :
m_address_save(address), m_address_save(address),
m_port_save(port), m_port_save(port),
m_counter(0U) m_counter(0U)
@ -45,7 +46,7 @@ m_counter(0U)
} }
} }
CUDPSocket::CUDPSocket(unsigned int port) : CUDPSocket::CUDPSocket(unsigned short port) :
m_address_save(), m_address_save(),
m_port_save(port), m_port_save(port),
m_counter(0U) m_counter(0U)
@ -79,7 +80,7 @@ void CUDPSocket::shutdown()
#endif #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; struct addrinfo hints;
::memset(&hints, 0, sizeof(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); 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); std::string portstr = std::to_string(port);
struct addrinfo *res; struct addrinfo *res;
@ -170,7 +171,7 @@ bool CUDPSocket::open(unsigned int af)
return open(0, af, m_address_save, m_port_save); 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; sockaddr_storage addr;
unsigned int addrlen; unsigned int addrlen;
@ -187,6 +188,8 @@ bool CUDPSocket::open(const unsigned int index, const unsigned int af, const std
return false; return false;
} }
close(index);
int fd = ::socket(addr.ss_family, SOCK_DGRAM, 0); int fd = ::socket(addr.ss_family, SOCK_DGRAM, 0);
if (fd < 0) { if (fd < 0) {
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
@ -222,7 +225,7 @@ bool CUDPSocket::open(const unsigned int index, const unsigned int af, const std
return false; return false;
} }
LogInfo("Opening UDP port on %u", port); LogInfo("Opening UDP port on %hu", port);
} }
return true; return true;
@ -291,7 +294,7 @@ int CUDPSocket::read(unsigned char* buffer, unsigned int length, sockaddr_storag
LogError("Error returned from recvfrom, err: %d", errno); LogError("Error returned from recvfrom, err: %d", errno);
if (len == -1 && errno == ENOTSOCK) { 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(); close();
open(); open();
} }
@ -343,13 +346,13 @@ bool CUDPSocket::write(const unsigned char* buffer, unsigned int length, const s
void CUDPSocket::close() void CUDPSocket::close()
{ {
for (int i = 0; i < UDP_SOCKET_MAX; i++) for (unsigned int i = 0; i < UDP_SOCKET_MAX; i++)
close(m_fd[i]); close(i);
} }
void CUDPSocket::close(const unsigned int index) void CUDPSocket::close(const unsigned int index)
{ {
if (m_fd[index] >= 0) { if ((index < UDP_SOCKET_MAX) && (m_fd[index] >= 0)) {
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
::closesocket(m_fd[index]); ::closesocket(m_fd[index]);
#else #else

View File

@ -46,13 +46,13 @@ enum IPMATCHTYPE {
class CUDPSocket { class CUDPSocket {
public: public:
CUDPSocket(const std::string& address, unsigned int port = 0U); CUDPSocket(const std::string& address, unsigned short port = 0U);
CUDPSocket(unsigned int port = 0U); CUDPSocket(unsigned short port = 0U);
~CUDPSocket(); ~CUDPSocket();
bool open(unsigned int af = AF_UNSPEC); bool open(unsigned int af = AF_UNSPEC);
bool open(const sockaddr_storage& address); 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); 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); 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 startup();
static void shutdown(); 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 short 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, struct addrinfo& hints);
static bool match(const sockaddr_storage& addr1, const sockaddr_storage& addr2, IPMATCHTYPE type = IMT_ADDRESS_AND_PORT); static bool match(const sockaddr_storage& addr1, const sockaddr_storage& addr2, IPMATCHTYPE type = IMT_ADDRESS_AND_PORT);

View File

@ -22,7 +22,7 @@
#include <cassert> #include <cassert>
#include <cstring> #include <cstring>
CNXDNNetwork::CNXDNNetwork(unsigned int port) : CNXDNNetwork::CNXDNNetwork(unsigned short port) :
m_socket(port), m_socket(port),
m_addr(), m_addr(),
m_addrLen(0U) m_addrLen(0U)

View File

@ -26,7 +26,7 @@
class CNXDNNetwork { class CNXDNNetwork {
public: public:
CNXDNNetwork(unsigned int port); CNXDNNetwork(unsigned short port);
~CNXDNNetwork(); ~CNXDNNetwork();
bool open(); bool open();

View File

@ -35,7 +35,7 @@ int main(int argc, char** argv)
return 1; return 1;
} }
unsigned int port = ::atoi(argv[1U]); unsigned short port = (unsigned short)::atoi(argv[1U]);
if (port == 0U) { if (port == 0U) {
::fprintf(stderr, "NXDNParrot: invalid port number - %s\n", argv[1U]); ::fprintf(stderr, "NXDNParrot: invalid port number - %s\n", argv[1U]);
return 1; return 1;
@ -47,7 +47,7 @@ int main(int argc, char** argv)
return 0; return 0;
} }
CNXDNParrot::CNXDNParrot(unsigned int port) : CNXDNParrot::CNXDNParrot(unsigned short port) :
m_port(port) m_port(port)
{ {
CUDPSocket::startup(); CUDPSocket::startup();

View File

@ -22,13 +22,13 @@
class CNXDNParrot class CNXDNParrot
{ {
public: public:
CNXDNParrot(unsigned int port); CNXDNParrot(unsigned short port);
~CNXDNParrot(); ~CNXDNParrot();
void run(); void run();
private: private:
unsigned int m_port; unsigned short m_port;
}; };
#endif #endif

View File

@ -33,7 +33,7 @@
#define LogInfo(fmt, ...) ::fprintf(stderr, fmt "\n", ## __VA_ARGS__) #define LogInfo(fmt, ...) ::fprintf(stderr, fmt "\n", ## __VA_ARGS__)
#endif #endif
CUDPSocket::CUDPSocket(const std::string& address, unsigned int port) : CUDPSocket::CUDPSocket(const std::string& address, unsigned short port) :
m_address_save(address), m_address_save(address),
m_port_save(port), m_port_save(port),
m_counter(0U) m_counter(0U)
@ -46,7 +46,7 @@ m_counter(0U)
} }
} }
CUDPSocket::CUDPSocket(unsigned int port) : CUDPSocket::CUDPSocket(unsigned short port) :
m_address_save(), m_address_save(),
m_port_save(port), m_port_save(port),
m_counter(0U) m_counter(0U)
@ -80,7 +80,7 @@ void CUDPSocket::shutdown()
#endif #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; struct addrinfo hints;
::memset(&hints, 0, sizeof(hints)); ::memset(&hints, 0, sizeof(hints));
@ -88,7 +88,7 @@ int CUDPSocket::lookup(const std::string& hostname, unsigned int port, sockaddr_
return lookup(hostname, port, addr, address_length, hints); 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); std::string portstr = std::to_string(port);
struct addrinfo *res; struct addrinfo *res;
@ -171,7 +171,7 @@ bool CUDPSocket::open(unsigned int af)
return open(0, af, m_address_save, m_port_save); 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; sockaddr_storage addr;
unsigned int addrlen; unsigned int addrlen;
@ -188,6 +188,8 @@ bool CUDPSocket::open(const unsigned int index, const unsigned int af, const std
return false; return false;
} }
close(index);
int fd = ::socket(addr.ss_family, SOCK_DGRAM, 0); int fd = ::socket(addr.ss_family, SOCK_DGRAM, 0);
if (fd < 0) { if (fd < 0) {
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
@ -223,7 +225,7 @@ bool CUDPSocket::open(const unsigned int index, const unsigned int af, const std
return false; return false;
} }
LogInfo("Opening UDP port on %u", port); LogInfo("Opening UDP port on %hu", port);
} }
return true; return true;
@ -292,7 +294,7 @@ int CUDPSocket::read(unsigned char* buffer, unsigned int length, sockaddr_storag
LogError("Error returned from recvfrom, err: %d", errno); LogError("Error returned from recvfrom, err: %d", errno);
if (len == -1 && errno == ENOTSOCK) { 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(); close();
open(); open();
} }
@ -344,13 +346,13 @@ bool CUDPSocket::write(const unsigned char* buffer, unsigned int length, const s
void CUDPSocket::close() void CUDPSocket::close()
{ {
for (int i = 0; i < UDP_SOCKET_MAX; i++) for (unsigned int i = 0; i < UDP_SOCKET_MAX; i++)
close(m_fd[i]); close(i);
} }
void CUDPSocket::close(const unsigned int index) void CUDPSocket::close(const unsigned int index)
{ {
if (m_fd[index] >= 0) { if ((index < UDP_SOCKET_MAX) && (m_fd[index] >= 0)) {
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
::closesocket(m_fd[index]); ::closesocket(m_fd[index]);
#else #else

View File

@ -46,13 +46,13 @@ enum IPMATCHTYPE {
class CUDPSocket { class CUDPSocket {
public: public:
CUDPSocket(const std::string& address, unsigned int port = 0U); CUDPSocket(const std::string& address, unsigned short port = 0U);
CUDPSocket(unsigned int port = 0U); CUDPSocket(unsigned short port = 0U);
~CUDPSocket(); ~CUDPSocket();
bool open(unsigned int af = AF_UNSPEC); bool open(unsigned int af = AF_UNSPEC);
bool open(const sockaddr_storage& address); 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); 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); 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 startup();
static void shutdown(); 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 short 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, struct addrinfo& hints);
static bool match(const sockaddr_storage& addr1, const sockaddr_storage& addr2, IPMATCHTYPE type = IMT_ADDRESS_AND_PORT); static bool match(const sockaddr_storage& addr1, const sockaddr_storage& addr2, IPMATCHTYPE type = IMT_ADDRESS_AND_PORT);

View File

@ -148,7 +148,7 @@ bool CConf::read()
m_logFileRotate = ::atoi(value) == 1; m_logFileRotate = ::atoi(value) == 1;
} else if (section == SECTION_NETWORK) { } else if (section == SECTION_NETWORK) {
if (::strcmp(key, "Port") == 0) if (::strcmp(key, "Port") == 0)
m_networkPort = (unsigned int)::atoi(value); m_networkPort = (unsigned short)::atoi(value);
else if (::strcmp(key, "Debug") == 0) else if (::strcmp(key, "Debug") == 0)
m_networkDebug = ::atoi(value) == 1; m_networkDebug = ::atoi(value) == 1;
} else if (section == SECTION_ICOM_NETWORK) { } else if (section == SECTION_ICOM_NETWORK) {
@ -226,7 +226,7 @@ bool CConf::getLogFileRotate() const
return m_logFileRotate; return m_logFileRotate;
} }
unsigned int CConf::getNetworkPort() const unsigned short CConf::getNetworkPort() const
{ {
return m_networkPort; return m_networkPort;
} }

View File

@ -46,7 +46,7 @@ public:
bool getLogFileRotate() const; bool getLogFileRotate() const;
// The Network section // The Network section
unsigned int getNetworkPort() const; unsigned short getNetworkPort() const;
bool getNetworkDebug() const; bool getNetworkDebug() const;
// The Icom Network section // The Icom Network section
@ -77,7 +77,7 @@ private:
std::string m_logFileRoot; std::string m_logFileRoot;
bool m_logFileRotate; bool m_logFileRotate;
unsigned int m_networkPort; unsigned short m_networkPort;
bool m_networkDebug; bool m_networkDebug;
bool m_icomEnabled; bool m_icomEnabled;

View File

@ -24,7 +24,7 @@
#include <cassert> #include <cassert>
#include <cstring> #include <cstring>
CNXDNNetwork::CNXDNNetwork(unsigned int port, bool debug) : CNXDNNetwork::CNXDNNetwork(unsigned short port, bool debug) :
m_socket(port), m_socket(port),
m_debug(debug) m_debug(debug)
{ {

View File

@ -26,7 +26,7 @@
class CNXDNNetwork { class CNXDNNetwork {
public: public:
CNXDNNetwork(unsigned int port, bool debug); CNXDNNetwork(unsigned short port, bool debug);
~CNXDNNetwork(); ~CNXDNNetwork();
bool open(); bool open();

View File

@ -18,18 +18,18 @@ FileRotate=1
Port=41400 Port=41400
Debug=0 Debug=0
# Please visit www.nxdninfo.com if you are planning to link to the Icom NXCore server in Florida.
[Icom Network] [Icom Network]
Enabled=0 Enabled=0
# Address=208.111.3.45 Address=flicom.nxcore.org
Address=44.131.4.1
# TGEnable=1234 # TGEnable=1234
# TGDisable=3456 # TGDisable=3456
Debug=0 Debug=0
# Note that the Kenwood NXCore server in Florida is offline.
[Kenwood Network] [Kenwood Network]
Enabled=0 Enabled=0
# Address=208.111.3.45 Address=flkenwood.nxcore.org
Address=44.131.4.1
# TGEnable=1234 # TGEnable=1234
# TGDisable=3456 # TGDisable=3456
Debug=0 Debug=0

View File

@ -28,11 +28,12 @@
#if defined(HAVE_LOG_H) #if defined(HAVE_LOG_H)
#include "Log.h" #include "Log.h"
#else #else
#define LogMessage(fmt, ...) ::fprintf(stderr, fmt "\n", ## __VA_ARGS__)
#define LogError(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__) #define LogInfo(fmt, ...) ::fprintf(stderr, fmt "\n", ## __VA_ARGS__)
#endif #endif
CUDPSocket::CUDPSocket(const std::string& address, unsigned int port) : CUDPSocket::CUDPSocket(const std::string& address, unsigned short port) :
m_address_save(address), m_address_save(address),
m_port_save(port), m_port_save(port),
m_counter(0U) m_counter(0U)
@ -45,7 +46,7 @@ m_counter(0U)
} }
} }
CUDPSocket::CUDPSocket(unsigned int port) : CUDPSocket::CUDPSocket(unsigned short port) :
m_address_save(), m_address_save(),
m_port_save(port), m_port_save(port),
m_counter(0U) m_counter(0U)
@ -79,7 +80,7 @@ void CUDPSocket::shutdown()
#endif #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; struct addrinfo hints;
::memset(&hints, 0, sizeof(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); 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); std::string portstr = std::to_string(port);
struct addrinfo *res; struct addrinfo *res;
@ -171,14 +172,14 @@ char* CUDPSocket::display(const sockaddr_storage& addr, char* buffer, unsigned i
::inet_ntop(AF_INET, &in4, buffer, length); ::inet_ntop(AF_INET, &in4, buffer, length);
::sprintf(buffer + ::strlen(buffer), ":%u", in4->sin_port); ::sprintf(buffer + ::strlen(buffer), ":%u", in4->sin_port);
} }
break; break;
case AF_INET6: { case AF_INET6: {
struct sockaddr_in6* in6 = (struct sockaddr_in6*)&addr; struct sockaddr_in6* in6 = (struct sockaddr_in6*)&addr;
::inet_ntop(AF_INET6, &in6, buffer, length); ::inet_ntop(AF_INET6, &in6, buffer, length);
::sprintf(buffer + ::strlen(buffer), ":%u", in6->sin6_port); ::sprintf(buffer + ::strlen(buffer), ":%u", in6->sin6_port);
} }
break; break;
default: default:
::strcpy(buffer, "Unknown"); ::strcpy(buffer, "Unknown");
@ -198,7 +199,7 @@ bool CUDPSocket::open(unsigned int af)
return open(0, af, m_address_save, m_port_save); 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; sockaddr_storage addr;
unsigned int addrlen; unsigned int addrlen;
@ -215,6 +216,8 @@ bool CUDPSocket::open(const unsigned int index, const unsigned int af, const std
return false; return false;
} }
close(index);
int fd = ::socket(addr.ss_family, SOCK_DGRAM, 0); int fd = ::socket(addr.ss_family, SOCK_DGRAM, 0);
if (fd < 0) { if (fd < 0) {
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
@ -250,7 +253,7 @@ bool CUDPSocket::open(const unsigned int index, const unsigned int af, const std
return false; return false;
} }
LogInfo("Opening UDP port on %u", port); LogInfo("Opening UDP port on %hu", port);
} }
return true; return true;
@ -319,7 +322,7 @@ int CUDPSocket::read(unsigned char* buffer, unsigned int length, sockaddr_storag
LogError("Error returned from recvfrom, err: %d", errno); LogError("Error returned from recvfrom, err: %d", errno);
if (len == -1 && errno == ENOTSOCK) { 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(); close();
open(); open();
} }
@ -371,13 +374,13 @@ bool CUDPSocket::write(const unsigned char* buffer, unsigned int length, const s
void CUDPSocket::close() void CUDPSocket::close()
{ {
for (int i = 0; i < UDP_SOCKET_MAX; i++) for (unsigned int i = 0; i < UDP_SOCKET_MAX; i++)
close(m_fd[i]); close(i);
} }
void CUDPSocket::close(const unsigned int index) void CUDPSocket::close(const unsigned int index)
{ {
if (m_fd[index] >= 0) { if ((index < UDP_SOCKET_MAX) && (m_fd[index] >= 0)) {
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
::closesocket(m_fd[index]); ::closesocket(m_fd[index]);
#else #else

View File

@ -46,13 +46,13 @@ enum IPMATCHTYPE {
class CUDPSocket { class CUDPSocket {
public: public:
CUDPSocket(const std::string& address, unsigned int port = 0U); CUDPSocket(const std::string& address, unsigned short port = 0U);
CUDPSocket(unsigned int port = 0U); CUDPSocket(unsigned short port = 0U);
~CUDPSocket(); ~CUDPSocket();
bool open(unsigned int af = AF_UNSPEC); bool open(unsigned int af = AF_UNSPEC);
bool open(const sockaddr_storage& address); 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); 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); 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 startup();
static void shutdown(); 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 short 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, struct addrinfo& hints);
static bool match(const sockaddr_storage& addr1, const sockaddr_storage& addr2, IPMATCHTYPE type = IMT_ADDRESS_AND_PORT); static bool match(const sockaddr_storage& addr1, const sockaddr_storage& addr2, IPMATCHTYPE type = IMT_ADDRESS_AND_PORT);