diff --git a/BaseCommon/NetworkDestination.cpp b/BaseCommon/NetworkDestination.cpp deleted file mode 100644 index d8e5df7..0000000 --- a/BaseCommon/NetworkDestination.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - - * Copyright (c) 2021-2023 by Geoffrey Merck F4FXL / KC3FRA - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include - -#include "NetworkDestination.h" - -CNetworkDestination::CNetworkDestination(const CNetworkDestination& destination) : -m_destination(destination.m_destination) -{ - -} - -CNetworkDestination::CNetworkDestination() -{ - ::memset(&m_destination, 0, sizeof(sockaddr_storage)); -} - -void CNetworkDestination::setDestination(const sockaddr_storage & destination) -{ - m_destination = destination; -} - -sockaddr_storage CNetworkDestination::getDestination() const -{ - return m_destination; -} \ No newline at end of file diff --git a/BaseCommon/NetworkDestination.h b/BaseCommon/NetworkDestination.h deleted file mode 100644 index 92e5c7e..0000000 --- a/BaseCommon/NetworkDestination.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - - * Copyright (c) 2021-2023 by Geoffrey Merck F4FXL / KC3FRA - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#pragma once - -#include - -class CNetworkDestination { -public: - CNetworkDestination(); - CNetworkDestination(const CNetworkDestination & destination); - void setDestination(const sockaddr_storage& destination); - sockaddr_storage getDestination() const; - -private: - sockaddr_storage m_destination; -}; \ No newline at end of file diff --git a/Common/CCSProtocolHandler.cpp b/Common/CCSProtocolHandler.cpp index 83ba7c3..21a0ed4 100644 --- a/Common/CCSProtocolHandler.cpp +++ b/Common/CCSProtocolHandler.cpp @@ -74,7 +74,7 @@ bool CCCSProtocolHandler::writePoll(const CPollData& poll) CUtils::dump(wxT"Sending Poll", buffer, length); #endif - return m_socket.write(buffer, length, poll.getYourAddress(), poll.getYourPort()); + return m_socket.write(buffer, length, poll.getYourAddressAndPort()); } bool CCCSProtocolHandler::writeHeard(const CHeardData& heard) @@ -98,7 +98,7 @@ bool CCCSProtocolHandler::writeConnect(const CConnectData& connect) CUtils::dump("Sending Connect", buffer, length); #endif - return m_socket.write(buffer, length, connect.getYourAddress(), connect.getYourPort()); + return m_socket.write(buffer, length, connect.getYourAddressAndPort()); } bool CCCSProtocolHandler::writeMisc(const CCCSData& data) diff --git a/Common/ConnectData.cpp b/Common/ConnectData.cpp index be74b97..6b857b7 100644 --- a/Common/ConnectData.cpp +++ b/Common/ConnectData.cpp @@ -238,8 +238,8 @@ bool CConnectData::setDExtraData(const unsigned char* data, unsigned int length, return false; } - m_yourAddress = yourAddress; - m_yourPort = yourPort; + TOIPV4(m_yourAddressAndPort)->sin_addr = yourAddress; + SETPORT(m_yourAddressAndPort, (in_port_t)yourPort); m_myPort = myPort; return true; @@ -285,8 +285,8 @@ bool CConnectData::setDCSData(const unsigned char* data, unsigned int length, co return false; } - m_yourAddress = yourAddress; - m_yourPort = yourPort; + TOIPV4(m_yourAddressAndPort)->sin_addr = yourAddress; + SETPORT(m_yourAddressAndPort, (in_port_t)yourPort); m_myPort = myPort; return true; @@ -312,8 +312,8 @@ bool CConnectData::setCCSData(const unsigned char* data, unsigned int length, co else return false; - m_yourAddress = yourAddress; - m_yourPort = yourPort; + TOIPV4(m_yourAddressAndPort)->sin_addr = yourAddress; + SETPORT(m_yourAddressAndPort, (in_port_t)yourPort); m_myPort = myPort; return true; @@ -357,8 +357,8 @@ bool CConnectData::setDPlusData(const unsigned char* data, unsigned int length, return false; } - m_yourAddress = yourAddress; - m_yourPort = yourPort; + TOIPV4(m_yourAddressAndPort)->sin_addr = yourAddress; + SETPORT(m_yourAddressAndPort, (in_port_t)yourPort); m_myPort = myPort; return true; @@ -597,16 +597,6 @@ unsigned int CConnectData::getDPlusData(unsigned char *data, unsigned int length } } -in_addr CConnectData::getYourAddress() const -{ - return m_yourAddress; -} - -unsigned int CConnectData::getYourPort() const -{ - return m_yourPort; -} - unsigned int CConnectData::getMyPort() const { return m_myPort; diff --git a/Common/DCSHandler.cpp b/Common/DCSHandler.cpp index 4eb518b..c061842 100644 --- a/Common/DCSHandler.cpp +++ b/Common/DCSHandler.cpp @@ -727,7 +727,7 @@ bool CDCSHandler::clockInt(unsigned int ms) if (m_direction == DIR_OUTGOING) { bool reconnect = m_destination->linkFailed(DP_DCS, GET_DISP_REFLECTOR(this), true); if (reconnect) { - CConnectData reply(m_gatewayType, m_repeater, m_reflector, CT_LINK1, m_yourAddress, m_yourPort); + CConnectData reply(m_gatewayType, m_repeater, m_reflector, CT_LINK1, m_yourAddressAndPort); m_handler->writeConnect(reply); m_linkState = DCS_LINKING; m_tryTimer.start(1U); @@ -748,13 +748,13 @@ bool CDCSHandler::clockInt(unsigned int ms) if (m_pollTimer.isRunning() && m_pollTimer.hasExpired()) { m_pollTimer.start(); - CPollData poll(m_repeater, m_reflector, m_direction, m_yourAddress, m_yourPort); + CPollData poll(m_repeater, m_reflector, m_direction, m_yourAddressAndPort); m_handler->writePoll(poll); } if (m_linkState == DCS_LINKING) { if (m_tryTimer.isRunning() && m_tryTimer.hasExpired()) { - CConnectData reply(m_gatewayType, m_repeater, m_reflector, CT_LINK1, m_yourAddress, m_yourPort); + CConnectData reply(m_gatewayType, m_repeater, m_reflector, CT_LINK1, m_yourAddressAndPort); m_handler->writeConnect(reply); unsigned int timeout = calcBackoff(); @@ -764,7 +764,7 @@ bool CDCSHandler::clockInt(unsigned int ms) if (m_linkState == DCS_UNLINKING) { if (m_tryTimer.isRunning() && m_tryTimer.hasExpired()) { - CConnectData connect(m_repeater, m_reflector, CT_UNLINK, m_yourAddress, m_yourPort); + CConnectData connect(m_repeater, m_reflector, CT_UNLINK, m_yourAddressAndPort); m_handler->writeConnect(connect); unsigned int timeout = calcBackoff(); @@ -824,7 +824,7 @@ void CDCSHandler::writeAMBEInt(IReflectorCallback* handler, CAMBEData& data, DIR header.setCQCQCQ(); data.setRptSeq(m_seqNo++); - data.setDestination(m_yourAddress, m_yourPort); + data.setDestination(m_yourAddressAndPort); m_handler->writeData(data); } diff --git a/Common/DCSProtocolHandler.cpp b/Common/DCSProtocolHandler.cpp index 00d71b4..662d0a1 100644 --- a/Common/DCSProtocolHandler.cpp +++ b/Common/DCSProtocolHandler.cpp @@ -73,7 +73,7 @@ bool CDCSProtocolHandler::writePoll(const CPollData& poll) CUtils::dump("Sending Poll", buffer, length); #endif - return m_socket.write(buffer, length, poll.getYourAddress(), poll.getYourPort()); + return m_socket.write(buffer, length, poll.getYourAddressAndPort()); } bool CDCSProtocolHandler::writeConnect(const CConnectData& connect) @@ -85,7 +85,7 @@ bool CDCSProtocolHandler::writeConnect(const CConnectData& connect) CUtils::dump("Sending Connect", buffer, length); #endif - return m_socket.write(buffer, length, connect.getYourAddress(), connect.getYourPort()); + return m_socket.write(buffer, length, connect.getYourAddressAndPort()); } DCS_TYPE CDCSProtocolHandler::read() diff --git a/Common/DExtraProtocolHandler.cpp b/Common/DExtraProtocolHandler.cpp index 6963bd9..8192aa9 100644 --- a/Common/DExtraProtocolHandler.cpp +++ b/Common/DExtraProtocolHandler.cpp @@ -92,7 +92,7 @@ bool CDExtraProtocolHandler::writePoll(const CPollData& poll) CUtils::dump("Sending Poll", buffer, length); #endif - return m_socket.write(buffer, length, poll.getYourAddress(), poll.getYourPort()); + return m_socket.write(buffer, length, poll.getYourAddressAndPort()); } bool CDExtraProtocolHandler::writeConnect(const CConnectData& connect) @@ -105,7 +105,7 @@ bool CDExtraProtocolHandler::writeConnect(const CConnectData& connect) #endif for (unsigned int i = 0U; i < 2U; i++) { - bool res = m_socket.write(buffer, length, connect.getYourAddress(), connect.getYourPort()); + bool res = m_socket.write(buffer, length, connect.getYourAddressAndPort()); if (!res) return false; } diff --git a/Common/DPlusHandler.cpp b/Common/DPlusHandler.cpp index 178eefd..22b2a2c 100644 --- a/Common/DPlusHandler.cpp +++ b/Common/DPlusHandler.cpp @@ -50,8 +50,7 @@ m_repeater(repeater), m_callsign(m_dplusLogin), m_reflector(reflector), m_handler(protoHandler), -m_yourAddress(address), -m_yourPort(port), +m_yourAddressAndPort(), m_myPort(0U), m_direction(DIR_OUTGOING), m_linkState(DPLUS_LINKING), @@ -80,6 +79,45 @@ m_header(NULL) m_callsign.resize(LONG_CALLSIGN_LENGTH, ' '); auto band = m_repeater[LONG_CALLSIGN_LENGTH - 1U]; m_callsign[LONG_CALLSIGN_LENGTH - 1U] = band; + + TOIPV4(m_yourAddressAndPort)->sin_addr = address; + SETPORT(m_yourAddressAndPort, (in_port_t)port); +} + +CDPlusHandler::CDPlusHandler(IReflectorCallback* handler, const std::string& repeater, const std::string& reflector, CDPlusProtocolHandler* protoHandler, const struct sockaddr_storage& addressAndport) : +m_repeater(repeater), +m_callsign(m_dplusLogin), +m_reflector(reflector), +m_handler(protoHandler), +m_yourAddressAndPort(addressAndport), +m_myPort(0U), +m_direction(DIR_OUTGOING), +m_linkState(DPLUS_LINKING), +m_destination(handler), +m_time(), +m_pollTimer(1000U, 1U), // 1s +m_pollInactivityTimer(1000U, 30U), +m_tryTimer(1000U, 1U), +m_tryCount(0U), +m_dPlusId(0x00U), +m_dPlusSeq(0x00U), +m_inactivityTimer(1000U, NETWORK_TIMEOUT), +m_header(NULL) +{ + assert(protoHandler != NULL); + assert(handler != NULL); + assert(GETPORT(addresAndPort) > 0U); + + m_myPort = protoHandler->getPort(); + + m_pollInactivityTimer.start(); + m_tryTimer.start(); + + m_time = ::time(NULL); + + m_callsign.resize(LONG_CALLSIGN_LENGTH, ' '); + auto band = m_repeater[LONG_CALLSIGN_LENGTH - 1U]; + m_callsign[LONG_CALLSIGN_LENGTH - 1U] = band; } CDPlusHandler::CDPlusHandler(CDPlusProtocolHandler* protoHandler, const in_addr& address, unsigned int port) : @@ -87,8 +125,7 @@ m_repeater(), m_callsign(), m_reflector(), m_handler(protoHandler), -m_yourAddress(address), -m_yourPort(port), +m_yourAddressAndPort(), m_myPort(0U), m_direction(DIR_INCOMING), m_linkState(DPLUS_LINKING), @@ -112,6 +149,40 @@ m_header(NULL) m_pollInactivityTimer.start(); m_time = ::time(NULL); + + TOIPV4(m_yourAddressAndPort)->sin_addr = address; + SETPORT(m_yourAddressAndPort, (in_port_t)port); +} + +CDPlusHandler::CDPlusHandler(CDPlusProtocolHandler* protoHandler, const struct sockaddr_storage& addresAndPort) : +m_repeater(), +m_callsign(), +m_reflector(), +m_handler(protoHandler), +m_yourAddressAndPort(addresAndPort), +m_myPort(0U), +m_direction(DIR_INCOMING), +m_linkState(DPLUS_LINKING), +m_destination(NULL), +m_time(), +m_pollTimer(1000U, 1U), // 1s +m_pollInactivityTimer(1000U, 10U), // 10s +m_tryTimer(1000U), +m_tryCount(0U), +m_dPlusId(0x00U), +m_dPlusSeq(0x00U), +m_inactivityTimer(1000U, NETWORK_TIMEOUT), +m_header(NULL) +{ + assert(protoHandler != NULL); + assert(GETPORT(addresAndPort) > 0U); + + m_myPort = protoHandler->getPort(); + + m_pollTimer.start(); + m_pollInactivityTimer.start(); + + m_time = ::time(NULL); } CDPlusHandler::~CDPlusHandler() @@ -221,17 +292,15 @@ std::string CDPlusHandler::getDongles() void CDPlusHandler::process(CHeaderData& header) { - in_addr yourAddress = header.getYourAddress(); - unsigned int yourPort = header.getYourPort(); + auto yourAddressAndPort = header.getDestination(); unsigned int myPort = header.getMyPort(); for (unsigned int i = 0U; i < m_maxReflectors; i++) { CDPlusHandler* reflector = m_reflectors[i]; if (reflector != NULL) { - if (reflector->m_yourAddress.s_addr == yourAddress.s_addr && - reflector->m_yourPort == yourPort && - reflector->m_myPort == myPort) { + if (CNetUtils::match(yourAddressAndPort, reflector->m_yourAddressAndPort, IMT_ADDRESS_AND_PORT) && + reflector->m_myPort == myPort) { reflector->processInt(header); return; } @@ -241,17 +310,15 @@ void CDPlusHandler::process(CHeaderData& header) void CDPlusHandler::process(CAMBEData& data) { - in_addr yourAddress = data.getYourAddress(); - unsigned int yourPort = data.getYourPort(); + auto yourAddressAndPort = data.getDestination(); unsigned int myPort = data.getMyPort(); for (unsigned int i = 0U; i < m_maxReflectors; i++) { CDPlusHandler* reflector = m_reflectors[i]; if (reflector != NULL) { - if (reflector->m_yourAddress.s_addr == yourAddress.s_addr && - reflector->m_yourPort == yourPort && - reflector->m_myPort == myPort) { + if (CNetUtils::match(yourAddressAndPort, reflector->m_yourAddressAndPort, IMT_ADDRESS_AND_PORT) && + reflector->m_myPort == myPort) { reflector->processInt(data); return; } @@ -261,17 +328,15 @@ void CDPlusHandler::process(CAMBEData& data) void CDPlusHandler::process(const CPollData& poll) { - in_addr yourAddress = poll.getYourAddress(); - unsigned int yourPort = poll.getYourPort(); + auto yourAddressAndPort = poll.getYourAddressAndPort(); unsigned int myPort = poll.getMyPort(); for (unsigned int i = 0U; i < m_maxReflectors; i++) { CDPlusHandler* reflector = m_reflectors[i]; if (reflector != NULL) { - if (reflector->m_yourAddress.s_addr == yourAddress.s_addr && - reflector->m_yourPort == yourPort && - reflector->m_myPort == myPort) { + if (CNetUtils::match(yourAddressAndPort, reflector->m_yourAddressAndPort, IMT_ADDRESS_AND_PORT) && + reflector->m_myPort == myPort) { reflector->m_pollInactivityTimer.start(); return; } @@ -284,17 +349,15 @@ void CDPlusHandler::process(const CPollData& poll) void CDPlusHandler::process(CConnectData& connect) { - CD_TYPE type = connect.getType(); - in_addr yourAddress = connect.getYourAddress(); - unsigned int yourPort = connect.getYourPort(); - unsigned int myPort = connect.getMyPort(); + CD_TYPE type = connect.getType(); + auto yourAddressAndPort = connect.getYourAddressAndPort(); + unsigned int myPort = connect.getMyPort(); for (unsigned int i = 0U; i < m_maxReflectors; i++) { CDPlusHandler* reflector = m_reflectors[i]; if (reflector != NULL) { - if (reflector->m_yourAddress.s_addr == yourAddress.s_addr && - reflector->m_yourPort == yourPort && + if (CNetUtils::match(yourAddressAndPort, reflector->m_yourAddressAndPort, IMT_ADDRESS_AND_PORT) && reflector->m_myPort == myPort) { bool res = m_reflectors[i]->processInt(connect, type); if (res) { @@ -310,9 +373,8 @@ void CDPlusHandler::process(CConnectData& connect) CDPlusHandler* reflector = m_reflectors[i]; if (reflector != NULL) { - if (reflector->m_yourAddress.s_addr == yourAddress.s_addr && - reflector->m_yourPort == yourPort && - reflector->m_myPort == myPort) + if (CNetUtils::match(yourAddressAndPort, reflector->m_yourAddressAndPort, IMT_ADDRESS_AND_PORT) && + reflector->m_myPort== myPort) return; } } @@ -336,7 +398,7 @@ void CDPlusHandler::process(CConnectData& connect) if (count >= m_maxDongles) return; - CDPlusHandler* dplus = new CDPlusHandler(m_incoming, yourAddress, yourPort); + CDPlusHandler* dplus = new CDPlusHandler(m_incoming, yourAddressAndPort); bool found = false; @@ -349,7 +411,7 @@ void CDPlusHandler::process(CConnectData& connect) } if (found) { - CConnectData connect(CT_LINK1, yourAddress, yourPort); + CConnectData connect(CT_LINK1, yourAddressAndPort); m_incoming->writeConnect(connect); } else { CLog::logError("No space to add new D-Plus dongle, ignoring"); @@ -415,7 +477,9 @@ void CDPlusHandler::unlink(IReflectorCallback* handler, const std::string& calls CLog::logInfo("Removing outgoing D-Plus link %s, %s", reflector->m_repeater.c_str(), reflector->m_reflector.c_str()); if (reflector->m_linkState == DPLUS_LINKING || reflector->m_linkState == DPLUS_LINKED) { - CConnectData connect(CT_UNLINK, reflector->m_yourAddress, DPLUS_PORT); + auto reflYourAddressANdport = reflector->m_yourAddressAndPort; + SETPORT(reflYourAddressANdport, (in_port_t)DPLUS_PORT); + CConnectData connect(CT_UNLINK, reflYourAddressANdport); reflector->m_handler->writeConnect(connect); reflector->m_handler->writeConnect(connect); @@ -433,7 +497,9 @@ void CDPlusHandler::unlink(IReflectorCallback* handler, const std::string& calls CLog::logInfo(("Removing D-Plus link %s, %s"), reflector->m_repeater.c_str(), reflector->m_reflector.c_str()); if (reflector->m_linkState == DPLUS_LINKING || reflector->m_linkState == DPLUS_LINKED) { - CConnectData connect(CT_UNLINK, reflector->m_yourAddress, DPLUS_PORT); + auto reflYourAddressANdport = reflector->m_yourAddressAndPort; + SETPORT(reflYourAddressANdport, (in_port_t)DPLUS_PORT); + CConnectData connect(CT_UNLINK, reflYourAddressANdport); reflector->m_handler->writeConnect(connect); reflector->m_handler->writeConnect(connect); @@ -481,7 +547,7 @@ void CDPlusHandler::unlink() if (!reflector->m_reflector.empty()) CLog::logInfo(("Unlinking from D-Plus reflector or dongle %s"), reflector->m_reflector.c_str()); - CConnectData connect(CT_UNLINK, reflector->m_yourAddress, reflector->m_yourPort); + CConnectData connect(CT_UNLINK, reflector->m_yourAddressAndPort); reflector->m_handler->writeConnect(connect); reflector->m_handler->writeConnect(connect); reflector->m_tryTimer.start(1U); @@ -890,7 +956,7 @@ void CDPlusHandler::writeAMBEInt(IReflectorCallback* handler, CAMBEData& data, D switch (m_direction) { case DIR_OUTGOING: if (m_destination == handler) { - data.setDestination(m_yourAddress, m_yourPort); + data.setDestination(m_yourAddressAndPort); m_handler->writeAMBE(data); } break; diff --git a/Common/DPlusHandler.h b/Common/DPlusHandler.h index 78b5b7a..b9fdeb8 100644 --- a/Common/DPlusHandler.h +++ b/Common/DPlusHandler.h @@ -88,7 +88,9 @@ class CDPlusHandler { protected: CDPlusHandler(IReflectorCallback* handler, const std::string& repeater, const std::string& reflector, CDPlusProtocolHandler* protoHandler, const in_addr& address, unsigned int port); + CDPlusHandler(IReflectorCallback* handler, const std::string& repeater, const std::string& reflector, CDPlusProtocolHandler* protoHandler, const struct sockaddr_storage& addressAndport); CDPlusHandler(CDPlusProtocolHandler* protoHandler, const in_addr& address, unsigned int port); + CDPlusHandler(CDPlusProtocolHandler* protoHandler, const struct sockaddr_storage& addressAndport); ~CDPlusHandler(); void processInt(CHeaderData& header); @@ -122,8 +124,7 @@ class CDPlusHandler { std::string m_callsign; std::string m_reflector; CDPlusProtocolHandler* m_handler; - in_addr m_yourAddress; - unsigned int m_yourPort; + struct sockaddr_storage m_yourAddressAndPort; unsigned int m_myPort; DIRECTION m_direction; DPLUS_STATE m_linkState; diff --git a/Common/PollData.cpp b/Common/PollData.cpp index 5284b8f..019c176 100644 --- a/Common/PollData.cpp +++ b/Common/PollData.cpp @@ -291,7 +291,7 @@ bool CPollData::isDongle() const return m_dongle; } -sockaddr_storage CPollData::getYourAddressAndPort() +sockaddr_storage CPollData::getYourAddressAndPort() const { return m_yourAddressAndPort; } diff --git a/Common/PollData.h b/Common/PollData.h index 17b41a6..ba1b195 100644 --- a/Common/PollData.h +++ b/Common/PollData.h @@ -52,7 +52,7 @@ class CPollData { bool isDongle() const; - sockaddr_storage getYourAddressAndPort(); + sockaddr_storage getYourAddressAndPort() const; unsigned int getMyPort() const; DIRECTION getDirection() const; diff --git a/DStarBase/AMBEData.cpp b/DStarBase/AMBEData.cpp index 8670883..e6974da 100644 --- a/DStarBase/AMBEData.cpp +++ b/DStarBase/AMBEData.cpp @@ -45,7 +45,6 @@ m_header() } CAMBEData::CAMBEData(const CAMBEData& data) : -CNetworkDestination(data), m_rptSeq(data.m_rptSeq), m_outSeq(data.m_outSeq), m_id(data.m_id), diff --git a/DStarBase/AMBEData.h b/DStarBase/AMBEData.h index 337464d..8984405 100644 --- a/DStarBase/AMBEData.h +++ b/DStarBase/AMBEData.h @@ -24,10 +24,9 @@ #include -#include "NetworkDestination.h" #include "HeaderData.h" -class CAMBEData : public CNetworkDestination { +class CAMBEData { public: CAMBEData(); CAMBEData(const CAMBEData& data); @@ -73,7 +72,7 @@ class CAMBEData : public CNetworkDestination { void setData(const unsigned char* data, unsigned int length); unsigned int getData(unsigned char* data, unsigned int length) const; - void setDestination(const in_addr& address, unsigned int port); + void setDestination(const struct sockaddr_storage& yourAddressAndPort); void setText(const std::string& text); @@ -102,4 +101,5 @@ class CAMBEData : public CNetworkDestination { unsigned int m_errors; std::string m_text; CHeaderData m_header; + struct sockaddr_storage m_yourAddressAndPort; }; diff --git a/DStarBase/HeaderData.h b/DStarBase/HeaderData.h index d004503..7d19d3c 100644 --- a/DStarBase/HeaderData.h +++ b/DStarBase/HeaderData.h @@ -119,8 +119,7 @@ class CHeaderData { unsigned char* m_yourCall; unsigned char* m_rptCall1; unsigned char* m_rptCall2; - in_addr m_yourAddress; - unsigned int m_yourPort; + struct sockaddr_storage m_yourAddressAndport; unsigned int m_myPort; unsigned int m_errors; };