Fix network ports datatype (unsigned int -> unsigned short). UDPSocket: fix old bug using m_port instead of m_port[x].

This commit is contained in:
Daniel Caujolle-Bert 2021-04-25 07:47:06 +02:00
parent b30d5465f5
commit ec0bc51899
No known key found for this signature in database
GPG Key ID: 51AED7171EC00614
23 changed files with 132 additions and 132 deletions

View File

@ -535,9 +535,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_UMP) {
@ -806,9 +806,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)
@ -821,9 +821,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)
@ -844,11 +844,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)
@ -859,9 +859,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)
@ -874,11 +874,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)
@ -889,11 +889,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)
@ -962,9 +962,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)
@ -982,7 +982,7 @@ bool CConf::read()
else if (::strcmp(key, "Address") == 0)
m_remoteControlAddress = value;
else if (::strcmp(key, "Port") == 0)
m_remoteControlPort = (unsigned int)::atoi(value);
m_remoteControlPort = (unsigned short)::atoi(value);
}
}
@ -1266,12 +1266,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;
}
@ -1716,12 +1716,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;
}
@ -1751,12 +1751,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;
}
@ -1806,7 +1806,7 @@ std::string CConf::getFusionNetworkMyAddress() const
return m_fusionNetworkMyAddress;
}
unsigned int CConf::getFusionNetworkMyPort() const
unsigned short CConf::getFusionNetworkMyPort() const
{
return m_fusionNetworkMyPort;
}
@ -1816,7 +1816,7 @@ std::string CConf::getFusionNetworkGatewayAddress() const
return m_fusionNetworkGatewayAddress;
}
unsigned int CConf::getFusionNetworkGatewayPort() const
unsigned short CConf::getFusionNetworkGatewayPort() const
{
return m_fusionNetworkGatewayPort;
}
@ -1841,12 +1841,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;
}
@ -1876,7 +1876,7 @@ std::string CConf::getNXDNGatewayAddress() const
return m_nxdnGatewayAddress;
}
unsigned int CConf::getNXDNGatewayPort() const
unsigned short CConf::getNXDNGatewayPort() const
{
return m_nxdnGatewayPort;
}
@ -1886,7 +1886,7 @@ std::string CConf::getNXDNLocalAddress() const
return m_nxdnLocalAddress;
}
unsigned int CConf::getNXDNLocalPort() const
unsigned short CConf::getNXDNLocalPort() const
{
return m_nxdnLocalPort;
}
@ -1911,7 +1911,7 @@ std::string CConf::getPOCSAGGatewayAddress() const
return m_pocsagGatewayAddress;
}
unsigned int CConf::getPOCSAGGatewayPort() const
unsigned short CConf::getPOCSAGGatewayPort() const
{
return m_pocsagGatewayPort;
}
@ -1921,7 +1921,7 @@ std::string CConf::getPOCSAGLocalAddress() const
return m_pocsagLocalAddress;
}
unsigned int CConf::getPOCSAGLocalPort() const
unsigned short CConf::getPOCSAGLocalPort() const
{
return m_pocsagLocalPort;
}
@ -2062,12 +2062,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;
}
@ -2112,7 +2112,7 @@ std::string CConf::getRemoteControlAddress() const
return m_remoteControlAddress;
}
unsigned int CConf::getRemoteControlPort() const
unsigned short CConf::getRemoteControlPort() const
{
return m_remoteControlPort;
}

68
Conf.h
View File

@ -100,8 +100,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 UMP section
@ -208,8 +208,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;
@ -217,8 +217,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;
@ -230,17 +230,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;
@ -248,18 +248,18 @@ 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 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,8 +298,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;
@ -311,7 +311,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;
@ -377,8 +377,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_umpEnabled;
@ -476,16 +476,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;
@ -496,33 +496,33 @@ 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_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;
@ -556,8 +556,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;
@ -567,7 +567,7 @@ private:
bool m_remoteControlEnabled;
std::string m_remoteControlAddress;
unsigned int m_remoteControlPort;
unsigned short m_remoteControlPort;
};
#endif

View File

@ -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(),

View File

@ -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;

View File

@ -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),

View File

@ -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;

View File

@ -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),

View File

@ -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();

View File

@ -96,7 +96,7 @@ const unsigned int YSF_RSSI_COUNT = 13U; // 13 * 100ms = 1300ms
const unsigned int P25_RSSI_COUNT = 7U; // 7 * 180ms = 1260ms
const unsigned int NXDN_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),

View File

@ -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();
@ -73,7 +73,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;

View File

@ -339,14 +339,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) {
@ -629,11 +629,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);
@ -1265,7 +1265,7 @@ bool CMMDVMHost::createModem()
bool cosInvert = m_conf.getFMCOSInvert();
unsigned int rfAudioBoost = m_conf.getFMRFAudioBoost();
float maxDevLevel = m_conf.getFMMaxDevLevel();
unsigned int extAudioBoost = m_conf.getFMExtAudioBoost();
//unsigned int extAudioBoost = m_conf.getFMExtAudioBoost();
LogInfo("FM Parameters");
LogInfo(" Callsign: %s", callsign.c_str());
@ -1317,15 +1317,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);
@ -1345,8 +1345,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();
@ -1362,9 +1362,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);
@ -1429,17 +1429,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);
@ -1459,15 +1459,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);
@ -1488,18 +1488,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")
@ -1522,17 +1522,17 @@ bool CMMDVMHost::createNXDNNetwork()
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);

View File

@ -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),

View File

@ -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();

View File

@ -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(),

View File

@ -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();

View File

@ -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),

View File

@ -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();

View File

@ -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),

View File

@ -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();

View File

@ -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();
}

View File

@ -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);

View File

@ -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),

View File

@ -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();