diff --git a/Conf.cpp b/Conf.cpp index 3530ec9..6c5c01c 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -535,9 +535,9 @@ bool CConf::read() else if (::strcmp(key, "ModemAddress") == 0) m_modemModemAddress = value; else if (::strcmp(key, "ModemPort") == 0) - m_modemModemPort = (unsigned int)::atoi(value); + m_modemModemPort = (unsigned short)::atoi(value); else if (::strcmp(key, "LocalPort") == 0) - m_modemLocalPort = (unsigned int)::atoi(value); + m_modemLocalPort = (unsigned short)::atoi(value); else if (::strcmp(key, "RXInvert") == 0) m_modemRXInvert = ::atoi(value) == 1; else if (::strcmp(key, "TXInvert") == 0) @@ -594,9 +594,9 @@ bool CConf::read() else if (::strcmp(key, "RemoteAddress") == 0) m_transparentRemoteAddress = value; else if (::strcmp(key, "RemotePort") == 0) - m_transparentRemotePort = (unsigned int)::atoi(value); + m_transparentRemotePort = (unsigned short)::atoi(value); else if (::strcmp(key, "LocalPort") == 0) - m_transparentLocalPort = (unsigned int)::atoi(value); + m_transparentLocalPort = (unsigned short)::atoi(value); else if (::strcmp(key, "SendFrameType") == 0) m_transparentSendFrameType = (unsigned int)::atoi(value); } else if (section == SECTION_DSTAR) { @@ -896,9 +896,9 @@ bool CConf::read() else if (::strcmp(key, "GatewayAddress") == 0) m_dstarGatewayAddress = value; else if (::strcmp(key, "GatewayPort") == 0) - m_dstarGatewayPort = (unsigned int)::atoi(value); + m_dstarGatewayPort = (unsigned short)::atoi(value); else if (::strcmp(key, "LocalPort") == 0) - m_dstarLocalPort = (unsigned int)::atoi(value); + m_dstarLocalPort = (unsigned short)::atoi(value); else if (::strcmp(key, "ModeHang") == 0) m_dstarNetworkModeHang = (unsigned int)::atoi(value); else if (::strcmp(key, "Debug") == 0) @@ -911,9 +911,9 @@ bool CConf::read() else if (::strcmp(key, "Address") == 0) m_dmrNetworkAddress = value; else if (::strcmp(key, "Port") == 0) - m_dmrNetworkPort = (unsigned int)::atoi(value); + m_dmrNetworkPort = (unsigned short)::atoi(value); else if (::strcmp(key, "Local") == 0) - m_dmrNetworkLocal = (unsigned int)::atoi(value); + m_dmrNetworkLocal = (unsigned short)::atoi(value); else if (::strcmp(key, "Password") == 0) m_dmrNetworkPassword = value; else if (::strcmp(key, "Options") == 0) @@ -934,11 +934,11 @@ bool CConf::read() else if (::strcmp(key, "LocalAddress") == 0) m_fusionNetworkMyAddress = value; else if (::strcmp(key, "LocalPort") == 0) - m_fusionNetworkMyPort = (unsigned int)::atoi(value); + m_fusionNetworkMyPort = (unsigned short)::atoi(value); else if (::strcmp(key, "GatewayAddress") == 0) m_fusionNetworkGatewayAddress = value; else if (::strcmp(key, "GatewayPort") == 0) - m_fusionNetworkGatewayPort = (unsigned int)::atoi(value); + m_fusionNetworkGatewayPort = (unsigned short)::atoi(value); else if (::strcmp(key, "ModeHang") == 0) m_fusionNetworkModeHang = (unsigned int)::atoi(value); else if (::strcmp(key, "Debug") == 0) @@ -949,9 +949,9 @@ bool CConf::read() else if (::strcmp(key, "GatewayAddress") == 0) m_p25GatewayAddress = value; else if (::strcmp(key, "GatewayPort") == 0) - m_p25GatewayPort = (unsigned int)::atoi(value); + m_p25GatewayPort = (unsigned short)::atoi(value); else if (::strcmp(key, "LocalPort") == 0) - m_p25LocalPort = (unsigned int)::atoi(value); + m_p25LocalPort = (unsigned short)::atoi(value); else if (::strcmp(key, "ModeHang") == 0) m_p25NetworkModeHang = (unsigned int)::atoi(value); else if (::strcmp(key, "Debug") == 0) @@ -962,11 +962,11 @@ bool CConf::read() else if (::strcmp(key, "LocalAddress") == 0) m_nxdnLocalAddress = value; else if (::strcmp(key, "LocalPort") == 0) - m_nxdnLocalPort = (unsigned int)::atoi(value); + m_nxdnLocalPort = (unsigned short)::atoi(value); else if (::strcmp(key, "GatewayAddress") == 0) m_nxdnGatewayAddress = value; else if (::strcmp(key, "GatewayPort") == 0) - m_nxdnGatewayPort = (unsigned int)::atoi(value); + m_nxdnGatewayPort = (unsigned short)::atoi(value); else if (::strcmp(key, "ModeHang") == 0) m_nxdnNetworkModeHang = (unsigned int)::atoi(value); else if (::strcmp(key, "Debug") == 0) @@ -975,11 +975,11 @@ bool CConf::read() if (::strcmp(key, "Enable") == 0) m_m17NetworkEnabled = ::atoi(value) == 1; else if (::strcmp(key, "LocalPort") == 0) - m_m17LocalPort = (unsigned int)::atoi(value); + m_m17LocalPort = (unsigned short)::atoi(value); else if (::strcmp(key, "GatewayAddress") == 0) m_m17GatewayAddress = value; else if (::strcmp(key, "GatewayPort") == 0) - m_m17GatewayPort = (unsigned int)::atoi(value); + m_m17GatewayPort = (unsigned short)::atoi(value); else if (::strcmp(key, "ModeHang") == 0) m_m17NetworkModeHang = (unsigned int)::atoi(value); else if (::strcmp(key, "Debug") == 0) @@ -990,11 +990,11 @@ bool CConf::read() else if (::strcmp(key, "LocalAddress") == 0) m_pocsagLocalAddress = value; else if (::strcmp(key, "LocalPort") == 0) - m_pocsagLocalPort = (unsigned int)::atoi(value); + m_pocsagLocalPort = (unsigned short)::atoi(value); else if (::strcmp(key, "GatewayAddress") == 0) m_pocsagGatewayAddress = value; else if (::strcmp(key, "GatewayPort") == 0) - m_pocsagGatewayPort = (unsigned int)::atoi(value); + m_pocsagGatewayPort = (unsigned short)::atoi(value); else if (::strcmp(key, "ModeHang") == 0) m_pocsagNetworkModeHang = (unsigned int)::atoi(value); else if (::strcmp(key, "Debug") == 0) @@ -1007,11 +1007,11 @@ bool CConf::read() else if (::strcmp(key, "LocalAddress") == 0) m_fmLocalAddress = value; else if (::strcmp(key, "LocalPort") == 0) - m_fmLocalPort = (unsigned int)::atoi(value); + m_fmLocalPort = (unsigned short)::atoi(value); else if (::strcmp(key, "GatewayAddress") == 0) m_fmGatewayAddress = value; else if (::strcmp(key, "GatewayPort") == 0) - m_fmGatewayPort = (unsigned int)::atoi(value); + m_fmGatewayPort = (unsigned short)::atoi(value); else if (::strcmp(key, "PreEmphasis") == 0) m_fmPreEmphasis = ::atoi(value) == 1; else if (::strcmp(key, "DeEmphasis") == 0) @@ -1097,9 +1097,9 @@ bool CConf::read() if (::strcmp(key, "Address") == 0) m_lcdprocAddress = value; else if (::strcmp(key, "Port") == 0) - m_lcdprocPort = (unsigned int)::atoi(value); + m_lcdprocPort = (unsigned short)::atoi(value); else if (::strcmp(key, "LocalPort") == 0) - m_lcdprocLocalPort = (unsigned int)::atoi(value); + m_lcdprocLocalPort = (unsigned short)::atoi(value); else if (::strcmp(key, "DisplayClock") == 0) m_lcdprocDisplayClock = ::atoi(value) == 1; else if (::strcmp(key, "UTC") == 0) @@ -1115,7 +1115,7 @@ bool CConf::read() if (::strcmp(key, "Enable") == 0) m_remoteControlEnabled = ::atoi(value) == 1; else if (::strcmp(key, "Port") == 0) - m_remoteControlPort = (unsigned int)::atoi(value); + m_remoteControlPort = (unsigned short)::atoi(value); } } @@ -1289,12 +1289,12 @@ std::string CConf::getModemModemAddress() const return m_modemModemAddress; } -unsigned int CConf::getModemModemPort() const +unsigned short CConf::getModemModemPort() const { return m_modemModemPort; } -unsigned int CConf::getModemLocalPort() const +unsigned short CConf::getModemLocalPort() const { return m_modemLocalPort; } @@ -1434,12 +1434,12 @@ std::string CConf::getTransparentRemoteAddress() const return m_transparentRemoteAddress; } -unsigned int CConf::getTransparentRemotePort() const +unsigned short CConf::getTransparentRemotePort() const { return m_transparentRemotePort; } -unsigned int CConf::getTransparentLocalPort() const +unsigned short CConf::getTransparentLocalPort() const { return m_transparentLocalPort; } @@ -1954,12 +1954,12 @@ std::string CConf::getDStarGatewayAddress() const return m_dstarGatewayAddress; } -unsigned int CConf::getDStarGatewayPort() const +unsigned short CConf::getDStarGatewayPort() const { return m_dstarGatewayPort; } -unsigned int CConf::getDStarLocalPort() const +unsigned short CConf::getDStarLocalPort() const { return m_dstarLocalPort; } @@ -1989,12 +1989,12 @@ std::string CConf::getDMRNetworkAddress() const return m_dmrNetworkAddress; } -unsigned int CConf::getDMRNetworkPort() const +unsigned short CConf::getDMRNetworkPort() const { return m_dmrNetworkPort; } -unsigned int CConf::getDMRNetworkLocal() const +unsigned short CConf::getDMRNetworkLocal() const { return m_dmrNetworkLocal; } @@ -2044,7 +2044,7 @@ std::string CConf::getFusionNetworkMyAddress() const return m_fusionNetworkMyAddress; } -unsigned int CConf::getFusionNetworkMyPort() const +unsigned short CConf::getFusionNetworkMyPort() const { return m_fusionNetworkMyPort; } @@ -2054,7 +2054,7 @@ std::string CConf::getFusionNetworkGatewayAddress() const return m_fusionNetworkGatewayAddress; } -unsigned int CConf::getFusionNetworkGatewayPort() const +unsigned short CConf::getFusionNetworkGatewayPort() const { return m_fusionNetworkGatewayPort; } @@ -2079,12 +2079,12 @@ std::string CConf::getP25GatewayAddress() const return m_p25GatewayAddress; } -unsigned int CConf::getP25GatewayPort() const +unsigned short CConf::getP25GatewayPort() const { return m_p25GatewayPort; } -unsigned int CConf::getP25LocalPort() const +unsigned short CConf::getP25LocalPort() const { return m_p25LocalPort; } @@ -2114,7 +2114,7 @@ std::string CConf::getNXDNGatewayAddress() const return m_nxdnGatewayAddress; } -unsigned int CConf::getNXDNGatewayPort() const +unsigned short CConf::getNXDNGatewayPort() const { return m_nxdnGatewayPort; } @@ -2124,7 +2124,7 @@ std::string CConf::getNXDNLocalAddress() const return m_nxdnLocalAddress; } -unsigned int CConf::getNXDNLocalPort() const +unsigned short CConf::getNXDNLocalPort() const { return m_nxdnLocalPort; } @@ -2149,12 +2149,12 @@ std::string CConf::getM17GatewayAddress() const return m_m17GatewayAddress; } -unsigned int CConf::getM17GatewayPort() const +unsigned short CConf::getM17GatewayPort() const { return m_m17GatewayPort; } -unsigned int CConf::getM17LocalPort() const +unsigned short CConf::getM17LocalPort() const { return m_m17LocalPort; } @@ -2179,7 +2179,7 @@ std::string CConf::getPOCSAGGatewayAddress() const return m_pocsagGatewayAddress; } -unsigned int CConf::getPOCSAGGatewayPort() const +unsigned short CConf::getPOCSAGGatewayPort() const { return m_pocsagGatewayPort; } @@ -2189,7 +2189,7 @@ std::string CConf::getPOCSAGLocalAddress() const return m_pocsagLocalAddress; } -unsigned int CConf::getPOCSAGLocalPort() const +unsigned short CConf::getPOCSAGLocalPort() const { return m_pocsagLocalPort; } @@ -2219,7 +2219,7 @@ std::string CConf::getFMGatewayAddress() const return m_fmGatewayAddress; } -unsigned int CConf::getFMGatewayPort() const +unsigned short CConf::getFMGatewayPort() const { return m_fmGatewayPort; } @@ -2229,7 +2229,7 @@ std::string CConf::getFMLocalAddress() const return m_fmLocalAddress; } -unsigned int CConf::getFMLocalPort() const +unsigned short CConf::getFMLocalPort() const { return m_fmLocalPort; } @@ -2409,12 +2409,12 @@ std::string CConf::getLCDprocAddress() const return m_lcdprocAddress; } -unsigned int CConf::getLCDprocPort() const +unsigned short CConf::getLCDprocPort() const { return m_lcdprocPort; } -unsigned int CConf::getLCDprocLocalPort() const +unsigned short CConf::getLCDprocLocalPort() const { return m_lcdprocLocalPort; } @@ -2459,7 +2459,7 @@ std::string CConf::getRemoteControlAddress() const return m_remoteControlAddress; } -unsigned int CConf::getRemoteControlPort() const +unsigned short CConf::getRemoteControlPort() const { return m_remoteControlPort; } diff --git a/Conf.h b/Conf.h index d422669..5140a5b 100644 --- a/Conf.h +++ b/Conf.h @@ -76,8 +76,8 @@ public: std::string getModemI2CPort() const; unsigned int getModemI2CAddress() const; std::string getModemModemAddress() const; - unsigned int getModemModemPort() const; - unsigned int getModemLocalPort() const; + unsigned short getModemModemPort() const; + unsigned short getModemLocalPort() const; bool getModemRXInvert() const; bool getModemTXInvert() const; bool getModemPTTInvert() const; @@ -107,8 +107,8 @@ public: // The Transparent Data section bool getTransparentEnabled() const; std::string getTransparentRemoteAddress() const; - unsigned int getTransparentRemotePort() const; - unsigned int getTransparentLocalPort() const; + unsigned short getTransparentRemotePort() const; + unsigned short getTransparentLocalPort() const; unsigned int getTransparentSendFrameType() const; // The D-Star section @@ -231,8 +231,8 @@ public: // The D-Star Network section bool getDStarNetworkEnabled() const; std::string getDStarGatewayAddress() const; - unsigned int getDStarGatewayPort() const; - unsigned int getDStarLocalPort() const; + unsigned short getDStarGatewayPort() const; + unsigned short getDStarLocalPort() const; unsigned int getDStarNetworkModeHang() const; bool getDStarNetworkDebug() const; @@ -240,8 +240,8 @@ public: bool getDMRNetworkEnabled() const; std::string getDMRNetworkType() const; std::string getDMRNetworkAddress() const; - unsigned int getDMRNetworkPort() const; - unsigned int getDMRNetworkLocal() const; + unsigned short getDMRNetworkPort() const; + unsigned short getDMRNetworkLocal() const; std::string getDMRNetworkPassword() const; std::string getDMRNetworkOptions() const; bool getDMRNetworkDebug() const; @@ -253,17 +253,17 @@ public: // The System Fusion Network section bool getFusionNetworkEnabled() const; std::string getFusionNetworkMyAddress() const; - unsigned int getFusionNetworkMyPort() const; + unsigned short getFusionNetworkMyPort() const; std::string getFusionNetworkGatewayAddress() const; - unsigned int getFusionNetworkGatewayPort() const; + unsigned short getFusionNetworkGatewayPort() const; unsigned int getFusionNetworkModeHang() const; bool getFusionNetworkDebug() const; // The P25 Network section bool getP25NetworkEnabled() const; std::string getP25GatewayAddress() const; - unsigned int getP25GatewayPort() const; - unsigned int getP25LocalPort() const; + unsigned short getP25GatewayPort() const; + unsigned short getP25LocalPort() const; unsigned int getP25NetworkModeHang() const; bool getP25NetworkDebug() const; @@ -271,26 +271,26 @@ public: bool getNXDNNetworkEnabled() const; std::string getNXDNNetworkProtocol() const; std::string getNXDNGatewayAddress() const; - unsigned int getNXDNGatewayPort() const; + unsigned short getNXDNGatewayPort() const; std::string getNXDNLocalAddress() const; - unsigned int getNXDNLocalPort() const; + unsigned short getNXDNLocalPort() const; unsigned int getNXDNNetworkModeHang() const; bool getNXDNNetworkDebug() const; // The M17 Network section bool getM17NetworkEnabled() const; std::string getM17GatewayAddress() const; - unsigned int getM17GatewayPort() const; - unsigned int getM17LocalPort() const; + unsigned short getM17GatewayPort() const; + unsigned short getM17LocalPort() const; unsigned int getM17NetworkModeHang() const; bool getM17NetworkDebug() const; // The POCSAG Network section bool getPOCSAGNetworkEnabled() const; std::string getPOCSAGGatewayAddress() const; - unsigned int getPOCSAGGatewayPort() const; + unsigned short getPOCSAGGatewayPort() const; std::string getPOCSAGLocalAddress() const; - unsigned int getPOCSAGLocalPort() const; + unsigned short getPOCSAGLocalPort() const; unsigned int getPOCSAGNetworkModeHang() const; bool getPOCSAGNetworkDebug() const; @@ -298,9 +298,9 @@ public: bool getFMNetworkEnabled() const; std::string getFMNetworkProtocol() const; std::string getFMGatewayAddress() const; - unsigned int getFMGatewayPort() const; + unsigned short getFMGatewayPort() const; std::string getFMLocalAddress() const; - unsigned int getFMLocalPort() const; + unsigned short getFMLocalPort() const; bool getFMPreEmphasis() const; bool getFMDeEmphasis() const; float getFMTXAudioGain() const; @@ -349,8 +349,8 @@ public: // The LCDproc section std::string getLCDprocAddress() const; - unsigned int getLCDprocPort() const; - unsigned int getLCDprocLocalPort() const; + unsigned short getLCDprocPort() const; + unsigned short getLCDprocLocalPort() const; bool getLCDprocDisplayClock() const; bool getLCDprocUTC() const; bool getLCDprocDimOnIdle() const; @@ -362,7 +362,7 @@ public: // The Remote Control section bool getRemoteControlEnabled() const; std::string getRemoteControlAddress() const; - unsigned int getRemoteControlPort() const; + unsigned short getRemoteControlPort() const; private: std::string m_file; @@ -405,8 +405,8 @@ private: std::string m_modemI2CPort; unsigned int m_modemI2CAddress; std::string m_modemModemAddress; - unsigned int m_modemModemPort; - unsigned int m_modemLocalPort; + unsigned short m_modemModemPort; + unsigned short m_modemLocalPort; bool m_modemRXInvert; bool m_modemTXInvert; bool m_modemPTTInvert; @@ -435,8 +435,8 @@ private: bool m_transparentEnabled; std::string m_transparentRemoteAddress; - unsigned int m_transparentRemotePort; - unsigned int m_transparentLocalPort; + unsigned short m_transparentRemotePort; + unsigned short m_transparentLocalPort; unsigned int m_transparentSendFrameType; bool m_dstarEnabled; @@ -549,16 +549,16 @@ private: bool m_dstarNetworkEnabled; std::string m_dstarGatewayAddress; - unsigned int m_dstarGatewayPort; - unsigned int m_dstarLocalPort; + unsigned short m_dstarGatewayPort; + unsigned short m_dstarLocalPort; unsigned int m_dstarNetworkModeHang; bool m_dstarNetworkDebug; bool m_dmrNetworkEnabled; std::string m_dmrNetworkType; std::string m_dmrNetworkAddress; - unsigned int m_dmrNetworkPort; - unsigned int m_dmrNetworkLocal; + unsigned short m_dmrNetworkPort; + unsigned short m_dmrNetworkLocal; std::string m_dmrNetworkPassword; std::string m_dmrNetworkOptions; bool m_dmrNetworkDebug; @@ -569,49 +569,49 @@ private: bool m_fusionNetworkEnabled; std::string m_fusionNetworkMyAddress; - unsigned int m_fusionNetworkMyPort; + unsigned short m_fusionNetworkMyPort; std::string m_fusionNetworkGatewayAddress; - unsigned int m_fusionNetworkGatewayPort; + unsigned short m_fusionNetworkGatewayPort; unsigned int m_fusionNetworkModeHang; bool m_fusionNetworkDebug; bool m_p25NetworkEnabled; std::string m_p25GatewayAddress; - unsigned int m_p25GatewayPort; - unsigned int m_p25LocalPort; + unsigned short m_p25GatewayPort; + unsigned short m_p25LocalPort; unsigned int m_p25NetworkModeHang; bool m_p25NetworkDebug; bool m_nxdnNetworkEnabled; std::string m_nxdnNetworkProtocol; std::string m_nxdnGatewayAddress; - unsigned int m_nxdnGatewayPort; + unsigned short m_nxdnGatewayPort; std::string m_nxdnLocalAddress; - unsigned int m_nxdnLocalPort; + unsigned short m_nxdnLocalPort; unsigned int m_nxdnNetworkModeHang; bool m_nxdnNetworkDebug; bool m_m17NetworkEnabled; std::string m_m17GatewayAddress; - unsigned int m_m17GatewayPort; - unsigned int m_m17LocalPort; + unsigned short m_m17GatewayPort; + unsigned short m_m17LocalPort; unsigned int m_m17NetworkModeHang; bool m_m17NetworkDebug; bool m_pocsagNetworkEnabled; std::string m_pocsagGatewayAddress; - unsigned int m_pocsagGatewayPort; + unsigned short m_pocsagGatewayPort; std::string m_pocsagLocalAddress; - unsigned int m_pocsagLocalPort; + unsigned short m_pocsagLocalPort; unsigned int m_pocsagNetworkModeHang; bool m_pocsagNetworkDebug; bool m_fmNetworkEnabled; std::string m_fmNetworkProtocol; std::string m_fmGatewayAddress; - unsigned int m_fmGatewayPort; + unsigned short m_fmGatewayPort; std::string m_fmLocalAddress; - unsigned int m_fmLocalPort; + unsigned short m_fmLocalPort; bool m_fmPreEmphasis; bool m_fmDeEmphasis; float m_fmTXAudioGain; @@ -654,8 +654,8 @@ private: bool m_oledLogoScreensaver; std::string m_lcdprocAddress; - unsigned int m_lcdprocPort; - unsigned int m_lcdprocLocalPort; + unsigned short m_lcdprocPort; + unsigned short m_lcdprocLocalPort; bool m_lcdprocDisplayClock; bool m_lcdprocUTC; bool m_lcdprocDimOnIdle; @@ -665,7 +665,7 @@ private: bool m_remoteControlEnabled; std::string m_remoteControlAddress; - unsigned int m_remoteControlPort; + unsigned short m_remoteControlPort; }; #endif diff --git a/DMRDirectNetwork.cpp b/DMRDirectNetwork.cpp index a27a646..04886c1 100644 --- a/DMRDirectNetwork.cpp +++ b/DMRDirectNetwork.cpp @@ -30,7 +30,7 @@ const unsigned int BUFFER_LENGTH = 500U; const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U; -CDMRDirectNetwork::CDMRDirectNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, bool duplex, const char* version, bool slot1, bool slot2, HW_TYPE hwType, bool debug) : +CDMRDirectNetwork::CDMRDirectNetwork(const std::string& address, unsigned short port, unsigned short local, unsigned int id, const std::string& password, bool duplex, const char* version, bool slot1, bool slot2, HW_TYPE hwType, bool debug) : m_address(address), m_port(port), m_addr(), diff --git a/DMRDirectNetwork.h b/DMRDirectNetwork.h index 6df82cc..6ebff40 100644 --- a/DMRDirectNetwork.h +++ b/DMRDirectNetwork.h @@ -32,7 +32,7 @@ class CDMRDirectNetwork : public IDMRNetwork { public: - CDMRDirectNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, bool duplex, const char* version, bool slot1, bool slot2, HW_TYPE hwType, bool debug); + CDMRDirectNetwork(const std::string& address, unsigned short port, unsigned short local, unsigned int id, const std::string& password, bool duplex, const char* version, bool slot1, bool slot2, HW_TYPE hwType, bool debug); virtual ~CDMRDirectNetwork(); virtual void setOptions(const std::string& options); @@ -61,7 +61,7 @@ public: private: std::string m_address; - unsigned int m_port; + unsigned short m_port; sockaddr_storage m_addr; unsigned int m_addrLen; uint8_t* m_id; diff --git a/DMRGatewayNetwork.cpp b/DMRGatewayNetwork.cpp index f6dfe47..fe4cda8 100644 --- a/DMRGatewayNetwork.cpp +++ b/DMRGatewayNetwork.cpp @@ -31,7 +31,7 @@ const unsigned int BUFFER_LENGTH = 500U; const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U; -CDMRGatewayNetwork::CDMRGatewayNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, bool duplex, const char* version, bool slot1, bool slot2, HW_TYPE hwType, bool debug) : +CDMRGatewayNetwork::CDMRGatewayNetwork(const std::string& address, unsigned short port, unsigned short local, unsigned int id, bool duplex, const char* version, bool slot1, bool slot2, HW_TYPE hwType, bool debug) : m_addressStr(address), m_addr(), m_addrLen(0U), diff --git a/DMRGatewayNetwork.h b/DMRGatewayNetwork.h index 7bca94f..5979a3a 100644 --- a/DMRGatewayNetwork.h +++ b/DMRGatewayNetwork.h @@ -33,7 +33,7 @@ class CDMRGatewayNetwork : public IDMRNetwork { public: - CDMRGatewayNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, bool duplex, const char* version, bool slot1, bool slot2, HW_TYPE hwType, bool debug); + CDMRGatewayNetwork(const std::string& address, unsigned short port, unsigned short local, unsigned int id, bool duplex, const char* version, bool slot1, bool slot2, HW_TYPE hwType, bool debug); virtual ~CDMRGatewayNetwork(); virtual void setOptions(const std::string& options); @@ -64,7 +64,7 @@ private: std::string m_addressStr; sockaddr_storage m_addr; unsigned int m_addrLen; - unsigned int m_port; + unsigned short m_port; uint8_t* m_id; bool m_duplex; const char* m_version; diff --git a/DStarNetwork.cpp b/DStarNetwork.cpp index eae4f8f..96c826b 100644 --- a/DStarNetwork.cpp +++ b/DStarNetwork.cpp @@ -30,7 +30,7 @@ const unsigned int BUFFER_LENGTH = 100U; -CDStarNetwork::CDStarNetwork(const std::string& gatewayAddress, unsigned int gatewayPort, unsigned int localPort, bool duplex, const char* version, bool debug) : +CDStarNetwork::CDStarNetwork(const std::string& gatewayAddress, unsigned short gatewayPort, unsigned short localPort, bool duplex, const char* version, bool debug) : m_socket(localPort), m_addr(), m_addrLen(0U), diff --git a/DStarNetwork.h b/DStarNetwork.h index cb41b78..8ecd5ac 100644 --- a/DStarNetwork.h +++ b/DStarNetwork.h @@ -30,7 +30,7 @@ class CDStarNetwork { public: - CDStarNetwork(const std::string& gatewayAddress, unsigned int gatewayPort, unsigned int localPort, bool duplex, const char* version, bool debug); + CDStarNetwork(const std::string& gatewayAddress, unsigned short gatewayPort, unsigned short localPort, bool duplex, const char* version, bool debug); ~CDStarNetwork(); bool open(); diff --git a/FMNetwork.cpp b/FMNetwork.cpp index 09828e7..48d2382 100644 --- a/FMNetwork.cpp +++ b/FMNetwork.cpp @@ -27,7 +27,7 @@ const unsigned int BUFFER_LENGTH = 1500U; -CFMNetwork::CFMNetwork(const std::string& callsign, const std::string& protocol, const std::string& localAddress, unsigned int localPort, const std::string& gatewayAddress, unsigned int gatewayPort, bool debug) : +CFMNetwork::CFMNetwork(const std::string& callsign, const std::string& protocol, const std::string& localAddress, unsigned short localPort, const std::string& gatewayAddress, unsigned short gatewayPort, bool debug) : m_callsign(callsign), m_protocol(FMNP_USRP), m_socket(localAddress, localPort), diff --git a/FMNetwork.h b/FMNetwork.h index e3f58de..dd2a8e6 100644 --- a/FMNetwork.h +++ b/FMNetwork.h @@ -31,7 +31,7 @@ enum FM_NETWORK_PROTOCOL { class CFMNetwork { public: - CFMNetwork(const std::string& callsign, const std::string& protocol, const std::string& myAddress, unsigned int myPort, const std::string& gatewayAddress, unsigned int gatewayPort, bool debug); + CFMNetwork(const std::string& callsign, const std::string& protocol, const std::string& myAddress, unsigned short myPort, const std::string& gatewayAddress, unsigned short gatewayPort, bool debug); ~CFMNetwork(); bool open(); diff --git a/LCDproc.cpp b/LCDproc.cpp index 0ef66eb..43595a8 100644 --- a/LCDproc.cpp +++ b/LCDproc.cpp @@ -97,7 +97,7 @@ const unsigned int P25_RSSI_COUNT = 7U; // 7 * 180ms = 1260ms const unsigned int NXDN_RSSI_COUNT = 28U; // 28 * 40ms = 1120ms const unsigned int M17_RSSI_COUNT = 28U; // 28 * 40ms = 1120ms -CLCDproc::CLCDproc(std::string address, unsigned int port, unsigned int localPort, const std::string& callsign, unsigned int dmrid, bool displayClock, bool utc, bool duplex, bool dimOnIdle) : +CLCDproc::CLCDproc(std::string address, unsigned int port, unsigned short localPort, const std::string& callsign, unsigned int dmrid, bool displayClock, bool utc, bool duplex, bool dimOnIdle) : CDisplay(), m_address(address), m_port(port), diff --git a/LCDproc.h b/LCDproc.h index 553968a..aee8214 100644 --- a/LCDproc.h +++ b/LCDproc.h @@ -28,7 +28,7 @@ class CLCDproc : public CDisplay { public: - CLCDproc(std::string address, unsigned int port, unsigned int localPort, const std::string& callsign, unsigned int dmrid, bool displayClock, bool utc, bool duplex, bool dimOnIdle); + CLCDproc(std::string address, unsigned int port, unsigned short localPort, const std::string& callsign, unsigned int dmrid, bool displayClock, bool utc, bool duplex, bool dimOnIdle); virtual ~CLCDproc(); virtual bool open(); @@ -77,7 +77,7 @@ protected: private: std::string m_address; unsigned int m_port; - unsigned int m_localPort; + unsigned short m_localPort; std::string m_callsign; unsigned int m_dmrid; bool m_displayClock; diff --git a/M17Network.cpp b/M17Network.cpp index 2fd213d..3578252 100644 --- a/M17Network.cpp +++ b/M17Network.cpp @@ -29,7 +29,7 @@ const unsigned int BUFFER_LENGTH = 200U; -CM17Network::CM17Network(unsigned int localPort, const std::string& gwyAddress, unsigned int gwyPort, bool debug) : +CM17Network::CM17Network(unsigned short localPort, const std::string& gwyAddress, unsigned short gwyPort, bool debug) : m_socket(localPort), m_addr(), m_addrLen(0U), diff --git a/M17Network.h b/M17Network.h index 9fc555a..6b002e0 100644 --- a/M17Network.h +++ b/M17Network.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 by Jonathan Naylor G4KLX + * Copyright (C) 2020,2021 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 @@ -29,7 +29,7 @@ class CM17Network { public: - CM17Network(unsigned int localPort, const std::string& gwyAddress, unsigned int gwyPort, bool debug); + CM17Network(unsigned short localPort, const std::string& gwyAddress, unsigned short gwyPort, bool debug); ~CM17Network(); bool open(); diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 6fa7034..0edb12a 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -359,14 +359,14 @@ int CMMDVMHost::run() unsigned int sendFrameType = 0U; if (m_conf.getTransparentEnabled()) { std::string remoteAddress = m_conf.getTransparentRemoteAddress(); - unsigned int remotePort = m_conf.getTransparentRemotePort(); - unsigned int localPort = m_conf.getTransparentLocalPort(); + unsigned short remotePort = m_conf.getTransparentRemotePort(); + unsigned short localPort = m_conf.getTransparentLocalPort(); sendFrameType = m_conf.getTransparentSendFrameType(); LogInfo("Transparent Data"); LogInfo(" Remote Address: %s", remoteAddress.c_str()); - LogInfo(" Remote Port: %u", remotePort); - LogInfo(" Local Port: %u", localPort); + LogInfo(" Remote Port: %hu", remotePort); + LogInfo(" Local Port: %hu", localPort); LogInfo(" Send Frame Type: %u", sendFrameType); if (CUDPSocket::lookup(remoteAddress, remotePort, transparentAddress, transparentAddrLen) != 0) { @@ -693,11 +693,11 @@ int CMMDVMHost::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); @@ -1539,15 +1539,15 @@ bool CMMDVMHost::createModem() bool CMMDVMHost::createDStarNetwork() { std::string gatewayAddress = m_conf.getDStarGatewayAddress(); - unsigned int gatewayPort = m_conf.getDStarGatewayPort(); - unsigned int localPort = m_conf.getDStarLocalPort(); + unsigned short gatewayPort = m_conf.getDStarGatewayPort(); + unsigned short localPort = m_conf.getDStarLocalPort(); bool debug = m_conf.getDStarNetworkDebug(); m_dstarNetModeHang = m_conf.getDStarNetworkModeHang(); LogInfo("D-Star Network Parameters"); LogInfo(" Gateway Address: %s", gatewayAddress.c_str()); - LogInfo(" Gateway Port: %u", gatewayPort); - LogInfo(" Local Port: %u", localPort); + LogInfo(" Gateway Port: %hu", gatewayPort); + LogInfo(" Local Port: %hu", localPort); LogInfo(" Mode Hang: %us", m_dstarNetModeHang); m_dstarNetwork = new CDStarNetwork(gatewayAddress, gatewayPort, localPort, m_duplex, VERSION, debug); @@ -1567,8 +1567,8 @@ bool CMMDVMHost::createDStarNetwork() bool CMMDVMHost::createDMRNetwork() { std::string address = m_conf.getDMRNetworkAddress(); - unsigned int port = m_conf.getDMRNetworkPort(); - unsigned int local = m_conf.getDMRNetworkLocal(); + unsigned short port = m_conf.getDMRNetworkPort(); + unsigned short local = m_conf.getDMRNetworkLocal(); unsigned int id = m_conf.getDMRId(); std::string password = m_conf.getDMRNetworkPassword(); bool debug = m_conf.getDMRNetworkDebug(); @@ -1584,9 +1584,9 @@ bool CMMDVMHost::createDMRNetwork() LogInfo("DMR Network Parameters"); LogInfo(" Type: %s", type.c_str()); 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(" Jitter: %ums", jitter); @@ -1651,17 +1651,17 @@ bool CMMDVMHost::createDMRNetwork() bool CMMDVMHost::createYSFNetwork() { std::string myAddress = m_conf.getFusionNetworkMyAddress(); - unsigned int myPort = m_conf.getFusionNetworkMyPort(); + unsigned short myPort = m_conf.getFusionNetworkMyPort(); std::string gatewayAddress = m_conf.getFusionNetworkGatewayAddress(); - unsigned int gatewayPort = m_conf.getFusionNetworkGatewayPort(); + unsigned short gatewayPort = m_conf.getFusionNetworkGatewayPort(); m_ysfNetModeHang = m_conf.getFusionNetworkModeHang(); bool debug = m_conf.getFusionNetworkDebug(); LogInfo("System Fusion Network Parameters"); LogInfo(" Local Address: %s", myAddress.c_str()); - LogInfo(" Local Port: %u", myPort); + LogInfo(" Local Port: %hu", myPort); LogInfo(" Gateway Address: %s", gatewayAddress.c_str()); - LogInfo(" Gateway Port: %u", gatewayPort); + LogInfo(" Gateway Port: %hu", gatewayPort); LogInfo(" Mode Hang: %us", m_ysfNetModeHang); m_ysfNetwork = new CYSFNetwork(myAddress, myPort, gatewayAddress, gatewayPort, m_callsign, debug); @@ -1681,15 +1681,15 @@ bool CMMDVMHost::createYSFNetwork() bool CMMDVMHost::createP25Network() { std::string gatewayAddress = m_conf.getP25GatewayAddress(); - unsigned int gatewayPort = m_conf.getP25GatewayPort(); - unsigned int localPort = m_conf.getP25LocalPort(); + unsigned short gatewayPort = m_conf.getP25GatewayPort(); + unsigned short localPort = m_conf.getP25LocalPort(); m_p25NetModeHang = m_conf.getP25NetworkModeHang(); bool debug = m_conf.getP25NetworkDebug(); LogInfo("P25 Network Parameters"); LogInfo(" Gateway Address: %s", gatewayAddress.c_str()); - LogInfo(" Gateway Port: %u", gatewayPort); - LogInfo(" Local Port: %u", localPort); + LogInfo(" Gateway Port: %hu", gatewayPort); + LogInfo(" Local Port: %hu", localPort); LogInfo(" Mode Hang: %us", m_p25NetModeHang); m_p25Network = new CP25Network(gatewayAddress, gatewayPort, localPort, debug); @@ -1710,18 +1710,18 @@ bool CMMDVMHost::createNXDNNetwork() { std::string protocol = m_conf.getNXDNNetworkProtocol(); std::string gatewayAddress = m_conf.getNXDNGatewayAddress(); - unsigned int gatewayPort = m_conf.getNXDNGatewayPort(); + unsigned short gatewayPort = m_conf.getNXDNGatewayPort(); std::string localAddress = m_conf.getNXDNLocalAddress(); - unsigned int localPort = m_conf.getNXDNLocalPort(); + unsigned short localPort = m_conf.getNXDNLocalPort(); m_nxdnNetModeHang = m_conf.getNXDNNetworkModeHang(); bool debug = m_conf.getNXDNNetworkDebug(); LogInfo("NXDN Network Parameters"); LogInfo(" Protocol: %s", protocol.c_str()); LogInfo(" Gateway Address: %s", gatewayAddress.c_str()); - LogInfo(" Gateway Port: %u", gatewayPort); + LogInfo(" Gateway Port: %hu", gatewayPort); LogInfo(" Local Address: %s", localAddress.c_str()); - LogInfo(" Local Port: %u", localPort); + LogInfo(" Local Port: %hu", localPort); LogInfo(" Mode Hang: %us", m_nxdnNetModeHang); if (protocol == "Kenwood") @@ -1744,15 +1744,15 @@ bool CMMDVMHost::createNXDNNetwork() bool CMMDVMHost::createM17Network() { std::string gatewayAddress = m_conf.getM17GatewayAddress(); - unsigned int gatewayPort = m_conf.getM17GatewayPort(); - unsigned int localPort = m_conf.getM17LocalPort(); + unsigned short gatewayPort = m_conf.getM17GatewayPort(); + unsigned short localPort = m_conf.getM17LocalPort(); m_m17NetModeHang = m_conf.getM17NetworkModeHang(); bool debug = m_conf.getM17NetworkDebug(); LogInfo("M17 Network Parameters"); LogInfo(" Gateway Address: %s", gatewayAddress.c_str()); - LogInfo(" Gateway Port: %u", gatewayPort); - LogInfo(" Local Port: %u", localPort); + LogInfo(" Gateway Port: %hu", gatewayPort); + LogInfo(" Local Port: %hu", localPort); LogInfo(" Mode Hang: %us", m_m17NetModeHang); m_m17Network = new CM17Network(localPort, gatewayAddress, gatewayPort, debug); @@ -1771,17 +1771,17 @@ bool CMMDVMHost::createM17Network() bool CMMDVMHost::createPOCSAGNetwork() { std::string gatewayAddress = m_conf.getPOCSAGGatewayAddress(); - unsigned int gatewayPort = m_conf.getPOCSAGGatewayPort(); + unsigned short gatewayPort = m_conf.getPOCSAGGatewayPort(); std::string localAddress = m_conf.getPOCSAGLocalAddress(); - unsigned int localPort = m_conf.getPOCSAGLocalPort(); + unsigned short localPort = m_conf.getPOCSAGLocalPort(); m_pocsagNetModeHang = m_conf.getPOCSAGNetworkModeHang(); bool debug = m_conf.getPOCSAGNetworkDebug(); LogInfo("POCSAG Network Parameters"); LogInfo(" Gateway Address: %s", gatewayAddress.c_str()); - LogInfo(" Gateway Port: %u", gatewayPort); + LogInfo(" Gateway Port: %hu", gatewayPort); LogInfo(" Local Address: %s", localAddress.c_str()); - LogInfo(" Local Port: %u", localPort); + LogInfo(" Local Port: %hu", localPort); LogInfo(" Mode Hang: %us", m_pocsagNetModeHang); m_pocsagNetwork = new CPOCSAGNetwork(localAddress, localPort, gatewayAddress, gatewayPort, debug); @@ -1803,9 +1803,9 @@ bool CMMDVMHost::createFMNetwork() std::string callsign = m_conf.getFMCallsign(); std::string protocol = m_conf.getFMNetworkProtocol(); std::string gatewayAddress = m_conf.getFMGatewayAddress(); - unsigned int gatewayPort = m_conf.getFMGatewayPort(); + unsigned short gatewayPort = m_conf.getFMGatewayPort(); std::string localAddress = m_conf.getFMLocalAddress(); - unsigned int localPort = m_conf.getFMLocalPort(); + unsigned short localPort = m_conf.getFMLocalPort(); bool preEmphasis = m_conf.getFMPreEmphasis(); bool deEmphasis = m_conf.getFMDeEmphasis(); float txAudioGain = m_conf.getFMTXAudioGain(); @@ -1816,9 +1816,9 @@ bool CMMDVMHost::createFMNetwork() LogInfo("FM Network Parameters"); LogInfo(" Protocol: %s", protocol.c_str()); LogInfo(" Gateway Address: %s", gatewayAddress.c_str()); - LogInfo(" Gateway Port: %u", gatewayPort); + LogInfo(" Gateway Port: %hu", gatewayPort); LogInfo(" Local Address: %s", localAddress.c_str()); - LogInfo(" Local Port: %u", localPort); + LogInfo(" Local Port: %hu", localPort); LogInfo(" Pre-Emphasis: %s", preEmphasis ? "yes" : "no"); LogInfo(" De-Emphasis: %s", deEmphasis ? "yes" : "no"); LogInfo(" TX Audio Gain: %.2f", txAudioGain); diff --git a/NXDNIcomNetwork.cpp b/NXDNIcomNetwork.cpp index 730f445..adc4ec6 100644 --- a/NXDNIcomNetwork.cpp +++ b/NXDNIcomNetwork.cpp @@ -28,7 +28,7 @@ const unsigned int BUFFER_LENGTH = 200U; -CNXDNIcomNetwork::CNXDNIcomNetwork(const std::string& localAddress, unsigned int localPort, const std::string& gatewayAddress, unsigned int gatewayPort, bool debug) : +CNXDNIcomNetwork::CNXDNIcomNetwork(const std::string& localAddress, unsigned short localPort, const std::string& gatewayAddress, unsigned short gatewayPort, bool debug) : m_socket(localAddress, localPort), m_addr(), m_addrLen(0U), diff --git a/NXDNIcomNetwork.h b/NXDNIcomNetwork.h index 9f74710..f417574 100644 --- a/NXDNIcomNetwork.h +++ b/NXDNIcomNetwork.h @@ -30,7 +30,7 @@ class CNXDNIcomNetwork : public INXDNNetwork { public: - CNXDNIcomNetwork(const std::string& localAddress, unsigned int localPort, const std::string& gatewayAddress, unsigned int gatewayPort, bool debug); + CNXDNIcomNetwork(const std::string& localAddress, unsigned short localPort, const std::string& gatewayAddress, unsigned short gatewayPort, bool debug); virtual ~CNXDNIcomNetwork(); virtual bool open(); diff --git a/NXDNKenwoodNetwork.cpp b/NXDNKenwoodNetwork.cpp index bed3316..1b7432b 100644 --- a/NXDNKenwoodNetwork.cpp +++ b/NXDNKenwoodNetwork.cpp @@ -33,7 +33,7 @@ const unsigned char BIT_MASK_TABLE[] = { 0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04 const unsigned int BUFFER_LENGTH = 200U; -CNXDNKenwoodNetwork::CNXDNKenwoodNetwork(const std::string& localAddress, unsigned int localPort, const std::string& gwyAddress, unsigned int gwyPort, bool debug) : +CNXDNKenwoodNetwork::CNXDNKenwoodNetwork(const std::string& localAddress, unsigned short localPort, const std::string& gwyAddress, unsigned short gwyPort, bool debug) : m_rtpSocket(localAddress, localPort + 0U), m_rtcpSocket(localAddress, localPort + 1U), m_rtcpAddr(), diff --git a/NXDNKenwoodNetwork.h b/NXDNKenwoodNetwork.h index dc7bf1d..216176e 100644 --- a/NXDNKenwoodNetwork.h +++ b/NXDNKenwoodNetwork.h @@ -29,7 +29,7 @@ class CNXDNKenwoodNetwork : public INXDNNetwork { public: - CNXDNKenwoodNetwork(const std::string& localAddress, unsigned int localPort, const std::string& gwyAddress, unsigned int gwyPort, bool debug); + CNXDNKenwoodNetwork(const std::string& localAddress, unsigned short localPort, const std::string& gwyAddress, unsigned short gwyPort, bool debug); virtual ~CNXDNKenwoodNetwork(); virtual bool open(); diff --git a/P25Network.cpp b/P25Network.cpp index 77a9a7d..2db60d4 100644 --- a/P25Network.cpp +++ b/P25Network.cpp @@ -87,7 +87,7 @@ const unsigned char REC80[] = { const unsigned int BUFFER_LENGTH = 100U; -CP25Network::CP25Network(const std::string& gatewayAddress, unsigned int gatewayPort, unsigned int localPort, bool debug) : +CP25Network::CP25Network(const std::string& gatewayAddress, unsigned short gatewayPort, unsigned short localPort, bool debug) : m_socket(localPort), m_addr(), m_addrLen(0U), diff --git a/P25Network.h b/P25Network.h index 6b8407c..0724310 100644 --- a/P25Network.h +++ b/P25Network.h @@ -30,7 +30,7 @@ class CP25Network { public: - CP25Network(const std::string& gatewayAddress, unsigned int gatewayPort, unsigned int localPort, bool debug); + CP25Network(const std::string& gatewayAddress, unsigned short gatewayPort, unsigned short localPort, bool debug); ~CP25Network(); bool open(); diff --git a/POCSAGNetwork.cpp b/POCSAGNetwork.cpp index c0437bd..0fc1322 100644 --- a/POCSAGNetwork.cpp +++ b/POCSAGNetwork.cpp @@ -28,7 +28,7 @@ const unsigned int BUFFER_LENGTH = 200U; -CPOCSAGNetwork::CPOCSAGNetwork(const std::string& myAddress, unsigned int myPort, const std::string& gatewayAddress, unsigned int gatewayPort, bool debug) : +CPOCSAGNetwork::CPOCSAGNetwork(const std::string& myAddress, unsigned short myPort, const std::string& gatewayAddress, unsigned short gatewayPort, bool debug) : m_socket(myAddress, myPort), m_addr(), m_addrLen(0U), diff --git a/POCSAGNetwork.h b/POCSAGNetwork.h index 693f5ac..b14ae73 100644 --- a/POCSAGNetwork.h +++ b/POCSAGNetwork.h @@ -29,7 +29,7 @@ class CPOCSAGNetwork { public: - CPOCSAGNetwork(const std::string& myAddress, unsigned int myPort, const std::string& gatewayAddress, unsigned int gatewayPort, bool debug); + CPOCSAGNetwork(const std::string& myAddress, unsigned short myPort, const std::string& gatewayAddress, unsigned short gatewayPort, bool debug); ~CPOCSAGNetwork(); bool open(); diff --git a/UDPSocket.cpp b/UDPSocket.cpp index 7b819fe..0792863 100644 --- a/UDPSocket.cpp +++ b/UDPSocket.cpp @@ -33,7 +33,7 @@ #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) @@ -46,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) @@ -80,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)); @@ -88,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; @@ -171,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; @@ -225,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; @@ -294,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(); } diff --git a/UDPSocket.h b/UDPSocket.h index 6e3846c..3e75554 100644 --- a/UDPSocket.h +++ b/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); diff --git a/YSFNetwork.cpp b/YSFNetwork.cpp index 525ebbe..b9bd0d2 100644 --- a/YSFNetwork.cpp +++ b/YSFNetwork.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2014,2016,2019,2020 by Jonathan Naylor G4KLX + * Copyright (C) 2009-2014,2016,2019,2020,2021 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,7 +28,7 @@ const unsigned int BUFFER_LENGTH = 200U; -CYSFNetwork::CYSFNetwork(const std::string& myAddress, unsigned int myPort, const std::string& gatewayAddress, unsigned int gatewayPort, const std::string& callsign, bool debug) : +CYSFNetwork::CYSFNetwork(const std::string& myAddress, unsigned short myPort, const std::string& gatewayAddress, unsigned short gatewayPort, const std::string& callsign, bool debug) : m_socket(myAddress, myPort), m_addr(), m_addrLen(0U), diff --git a/YSFNetwork.h b/YSFNetwork.h index 0fdbb67..ecc3a91 100644 --- a/YSFNetwork.h +++ b/YSFNetwork.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2014,2016,2020 by Jonathan Naylor G4KLX + * Copyright (C) 2009-2014,2016,2020,2021 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 @@ -29,7 +29,7 @@ class CYSFNetwork { public: - CYSFNetwork(const std::string& myAddress, unsigned int myPort, const std::string& gatewayAddress, unsigned int gatewayPort, const std::string& callsign, bool debug); + CYSFNetwork(const std::string& myAddress, unsigned short myPort, const std::string& gatewayAddress, unsigned short gatewayPort, const std::string& callsign, bool debug); ~CYSFNetwork(); bool open();