From b0bf79fc21ae7c81545496635fbb8251384c0cba Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sun, 15 Nov 2020 19:57:49 +0000 Subject: [PATCH] Convert the header files to IPv6. --- Common/AMBEData.h | 50 +++++++------- Common/APRSWriter.cpp | 16 ++--- Common/APRSWriter.h | 4 +- Common/CCSData.h | 38 +++++----- Common/CCSHandler.cpp | 37 ++++------ Common/CCSHandler.h | 5 +- Common/CCSProtocolHandler.h | 6 +- Common/CacheManager.h | 69 ++++++++++++------- Common/ConnectData.h | 42 +++++------ Common/DCSHandler.h | 10 +-- Common/DCSProtocolHandler.h | 6 +- Common/DDData.h | 12 ++-- Common/DExtraHandler.h | 12 ++-- Common/DExtraProtocolHandler.h | 6 +- Common/DPlusHandler.h | 12 ++-- Common/DPlusProtocolHandler.h | 6 +- Common/Defs.h | 6 +- Common/G2Handler.h | 7 +- Common/G2ProtocolHandler.h | 6 +- Common/GatewayCache.h | 32 +++++---- Common/HBRepeaterProtocolHandler.h | 6 +- Common/HeaderData.h | 58 ++++++++-------- Common/HeardData.h | 22 +++--- Common/IcomRepeaterProtocolHandler.h | 6 +- Common/PollData.h | 38 +++++----- Common/RemoteProtocolHandler.h | 6 +- Common/RepeaterHandler.h | 9 +-- Common/StarNetHandler.h | 5 +- Common/StatusData.h | 16 ++--- Common/TCPReaderWriterServer.h | 3 +- Common/TextData.h | 22 +++--- Common/UDPReaderWriter.h | 19 ++--- .../RemoteControlRemoteControlHandler.h | 6 +- TimeServer/TimeServerThread.h | 5 +- .../TimerControlRemoteControlHandler.h | 6 +- 35 files changed, 317 insertions(+), 292 deletions(-) diff --git a/Common/AMBEData.h b/Common/AMBEData.h index 773df7c..c721099 100644 --- a/Common/AMBEData.h +++ b/Common/AMBEData.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2013 by Jonathan Naylor G4KLX + * Copyright (C) 2010-2013,2020 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 @@ -35,13 +35,13 @@ public: CAMBEData(const CAMBEData& data); ~CAMBEData(); - bool setIcomRepeaterData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort); - bool setHBRepeaterData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort); - bool setG2Data(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort); - bool setDExtraData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort); - bool setDPlusData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort); - bool setDCSData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort); - bool setCCSData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort); + bool setIcomRepeaterData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen); + bool setHBRepeaterData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen); + bool setG2Data(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen); + bool setDExtraData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort); + bool setDPlusData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort); + bool setDCSData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort); + bool setCCSData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort); unsigned int getIcomRepeaterData(unsigned char* data, unsigned int length) const; unsigned int getHBRepeaterData(unsigned char* data, unsigned int length) const; @@ -75,13 +75,13 @@ public: 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 sockaddr_storage& addr, unsigned int addrLen); void setText(const wxString& text); - in_addr getYourAddress() const; - unsigned int getYourPort() const; - unsigned int getMyPort() const; + sockaddr_storage getYourAddr() const; + unsigned int getYourAddrLen() const; + unsigned int getMyPort() const; unsigned int getErrors() const; @@ -90,19 +90,19 @@ public: CAMBEData& operator=(const CAMBEData& data); private: - unsigned int m_rptSeq; - unsigned char m_outSeq; - unsigned int m_id; - unsigned char m_band1; - unsigned char m_band2; - unsigned char m_band3; - unsigned char* m_data; - in_addr m_yourAddress; - unsigned int m_yourPort; - unsigned int m_myPort; - unsigned int m_errors; - wxString m_text; - CHeaderData m_header; + unsigned int m_rptSeq; + unsigned char m_outSeq; + unsigned int m_id; + unsigned char m_band1; + unsigned char m_band2; + unsigned char m_band3; + unsigned char* m_data; + sockaddr_storage m_yourAddr; + unsigned int m_yourAddrLen; + unsigned int m_myPort; + unsigned int m_errors; + wxString m_text; + CHeaderData m_header; }; #endif diff --git a/Common/APRSWriter.cpp b/Common/APRSWriter.cpp index e109335..81b4937 100644 --- a/Common/APRSWriter.cpp +++ b/Common/APRSWriter.cpp @@ -122,8 +122,8 @@ CAPRSWriter::CAPRSWriter(const wxString& address, unsigned int port, const wxStr m_idTimer(1000U), m_gateway(), m_array(), -m_aprsAddress(), -m_aprsPort(port), +m_aprsAddr(), +m_aprsAddrLen(), m_aprsSocket() #if defined(USE_GPSD) ,m_gpsdEnabled(false), @@ -140,7 +140,7 @@ m_gpsdData() m_gateway.Truncate(LONG_CALLSIGN_LENGTH - 1U); m_gateway.Trim(); - m_aprsAddress = CUDPReaderWriter::lookup(address); + CUDPReaderWriter::lookup(address, port, m_aprsAddr, m_aprsAddrLen); } CAPRSWriter::~CAPRSWriter() @@ -284,7 +284,7 @@ void CAPRSWriter::writeData(const wxString& callsign, const CAMBEData& data) wxLogDebug(wxT("APRS ==> %s"), output.c_str()); - m_aprsSocket.write((unsigned char*)ascii, (unsigned int)::strlen(ascii), m_aprsAddress, m_aprsPort); + m_aprsSocket.write((unsigned char*)ascii, (unsigned int)::strlen(ascii), m_aprsAddr, m_aprsAddrLen); collector->reset(); } @@ -419,7 +419,7 @@ void CAPRSWriter::sendIdFramesFixed() wxLogDebug(wxT("APRS ==> %s"), output.c_str()); - m_aprsSocket.write((unsigned char*)ascii, (unsigned int)::strlen(ascii), m_aprsAddress, m_aprsPort); + m_aprsSocket.write((unsigned char*)ascii, (unsigned int)::strlen(ascii), m_aprsAddr, m_aprsAddrLen); if (entry->getBand().Len() == 1U) { output.Printf(wxT("%s-%s>APDG02,TCPIP*,qAC,%s-%sS:!%s%cD%s%c&RNG%04.0lf/A=%06.0lf %s %s\r\n"), @@ -434,7 +434,7 @@ void CAPRSWriter::sendIdFramesFixed() wxLogDebug(wxT("APRS ==> %s"), output.c_str()); - m_aprsSocket.write((unsigned char*)ascii, (unsigned int)::strlen(ascii), m_aprsAddress, m_aprsPort); + m_aprsSocket.write((unsigned char*)ascii, (unsigned int)::strlen(ascii), m_aprsAddr, m_aprsAddrLen); } } } @@ -576,7 +576,7 @@ void CAPRSWriter::sendIdFramesMobile() wxLogDebug(wxT("APRS ==> %s%s%s"), output1.c_str(), output2.c_str(), output3.c_str()); - m_aprsSocket.write((unsigned char*)ascii, (unsigned int)::strlen(ascii), m_aprsAddress, m_aprsPort); + m_aprsSocket.write((unsigned char*)ascii, (unsigned int)::strlen(ascii), m_aprsAddr, m_aprsAddrLen); if (entry->getBand().Len() == 1U) { if (altitudeSet) @@ -602,7 +602,7 @@ void CAPRSWriter::sendIdFramesMobile() wxLogDebug(wxT("APRS ==> %s%s%s"), output1.c_str(), output2.c_str(), output3.c_str()); - m_aprsSocket.write((unsigned char*)ascii, (unsigned int)::strlen(ascii), m_aprsAddress, m_aprsPort); + m_aprsSocket.write((unsigned char*)ascii, (unsigned int)::strlen(ascii), m_aprsAddr, m_aprsAddrLen); } } } diff --git a/Common/APRSWriter.h b/Common/APRSWriter.h index b4d48c3..02f2519 100644 --- a/Common/APRSWriter.h +++ b/Common/APRSWriter.h @@ -92,8 +92,8 @@ private: CTimer m_idTimer; wxString m_gateway; CEntry_t m_array; - in_addr m_aprsAddress; - unsigned int m_aprsPort; + sockaddr_storage m_aprsAddr; + unsigned int m_aprsAddrLen; CUDPReaderWriter m_aprsSocket; #if defined(USE_GPSD) bool m_gpsdEnabled; diff --git a/Common/CCSData.h b/Common/CCSData.h index 1488dcd..dc7ba76 100644 --- a/Common/CCSData.h +++ b/Common/CCSData.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 by Jonathan Naylor G4KLX + * Copyright (C) 2013,2020 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 @@ -41,34 +41,34 @@ public: CCCSData(); ~CCCSData(); - bool setCCSData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort); + bool setCCSData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort); unsigned int getCCSData(unsigned char* data, unsigned int length) const; - void setDestination(const in_addr& address, unsigned int port); + void setDestination(const sockaddr_storage& addr, unsigned int addrLen); wxString getLocal() const; wxString getRemote() const; CC_TYPE getType() const; - in_addr getYourAddress() const; - unsigned int getYourPort() const; - unsigned int getMyPort() const; + sockaddr_storage getYourAddr() const; + unsigned int getYourAddrLen() const; + unsigned int getMyPort() const; private: - wxString m_local; - wxString m_remote; - double m_latitude; - double m_longitude; - double m_frequency; - double m_offset; - wxString m_description1; - wxString m_description2; - wxString m_url; - CC_TYPE m_type; - in_addr m_yourAddress; - unsigned int m_yourPort; - unsigned int m_myPort; + wxString m_local; + wxString m_remote; + double m_latitude; + double m_longitude; + double m_frequency; + double m_offset; + wxString m_description1; + wxString m_description2; + wxString m_url; + CC_TYPE m_type; + sockaddr_storage m_yourAddr; + unsigned int m_yourAddrLen; + unsigned int m_myPort; }; #endif diff --git a/Common/CCSHandler.cpp b/Common/CCSHandler.cpp index 470d648..a96312e 100644 --- a/Common/CCSHandler.cpp +++ b/Common/CCSHandler.cpp @@ -132,7 +132,8 @@ m_offset(offset), m_description1(description1), m_description2(description2), m_url(url), -m_ccsAddress(), +m_ccsAddr(), +m_ccsAddrLen(0U), m_protocol(localPort, m_localAddress), m_state(CS_DISABLED), m_local(), @@ -257,7 +258,7 @@ void CCCSHandler::process(CAMBEData& data) wxLogMessage(wxT("CCS: Rejecting new incoming CCS link from %s @ %s to %s"), myCall1.c_str(), rptCall1.c_str(), yourCall.c_str()); CCCSData data(yourCall, myCall1, CT_TERMINATE); - data.setDestination(m_ccsAddress, CCS_PORT); + data.setDestination(m_ccsAddr, m_ccsAddrLen); m_protocol.writeMisc(data); m_protocol.writeMisc(data); @@ -351,7 +352,7 @@ void CCCSHandler::process(CConnectData& connect) // Give our location, frequency, etc CCCSData data(m_callsign, m_latitude, m_longitude, m_frequency, m_offset, m_description1, m_description2, m_url, CT_INFO); - data.setDestination(m_ccsAddress, CCS_PORT); + data.setDestination(m_ccsAddr, m_ccsAddrLen); m_protocol.writeMisc(data); m_state = CS_CONNECTED; @@ -369,16 +370,8 @@ void CCCSHandler::process(CConnectData& connect) bool CCCSHandler::connect() { - // Is CCS disabled? - if (m_localAddress.IsSameAs(wxT("127.0.0.1"))) - return false; - // Can we resolve the CCS server address? - m_ccsAddress = CUDPReaderWriter::lookup(m_ccsHost); - if (m_ccsAddress.s_addr == INADDR_NONE) { - wxLogError(wxT("CCS: Unable to find the IP address for %s"), m_ccsHost.c_str()); - return false; - } + CUDPReaderWriter::lookup(m_ccsHost, CCS_PORT, m_ccsAddr, m_ccsAddrLen); bool res = m_protocol.open(); if (!res) @@ -396,7 +389,7 @@ bool CCCSHandler::connect() void CCCSHandler::disconnectInt() { if (m_state == CS_CONNECTED || m_state == CS_ACTIVE) { - CConnectData connect(m_callsign, CT_UNLINK, m_ccsAddress, CCS_PORT); + CConnectData connect(m_callsign, CT_UNLINK, m_ccsAddr, m_ccsAddrLen); m_protocol.writeConnect(connect); } @@ -449,7 +442,7 @@ void CCCSHandler::stopLink(const wxString& user, const wxString& type) wxLogMessage(wxT("CCS: Link to %s from %s has been terminated via %s by %s"), m_yourCall.c_str(), m_local.c_str(), type.c_str(), user.c_str()); CCCSData data(m_local, m_yourCall, CT_TERMINATE); - data.setDestination(m_ccsAddress, CCS_PORT); + data.setDestination(m_ccsAddr, m_ccsAddrLen); m_protocol.writeMisc(data); m_protocol.writeMisc(data); @@ -475,7 +468,7 @@ void CCCSHandler::unlink(const wxString& callsign) wxLogMessage(wxT("CCS: Link to %s from %s has been terminated by command"), m_yourCall.c_str(), m_local.c_str()); CCCSData data(m_local, m_yourCall, CT_TERMINATE); - data.setDestination(m_ccsAddress, CCS_PORT); + data.setDestination(m_ccsAddr, m_ccsAddrLen); m_protocol.writeMisc(data); m_protocol.writeMisc(data); @@ -496,7 +489,7 @@ void CCCSHandler::writeHeard(CHeaderData& header) return; CHeardData heard(header, m_callsign, m_reflector); - heard.setDestination(m_ccsAddress, CCS_PORT); + heard.setDestination(m_ccsAddr, m_ccsAddrLen); m_protocol.writeHeard(heard); } @@ -523,7 +516,7 @@ void CCCSHandler::writeAMBE(CAMBEData& data) header.setRptCall2(m_reflector); temp.setRptSeq(m_seqNo++); - temp.setDestination(m_ccsAddress, CCS_PORT); + temp.setDestination(m_ccsAddr, m_ccsAddrLen); m_protocol.writeData(temp); } @@ -562,7 +555,7 @@ void CCCSHandler::clockInt(unsigned int ms) } if (m_tryTimer.isRunning() && m_tryTimer.hasExpired()) { - CConnectData connect(m_callsign, CT_LINK1, m_ccsAddress, CCS_PORT); + CConnectData connect(m_callsign, CT_LINK1, m_ccsAddr, m_ccsAddrLen); if (m_latitude != 0.0 && m_longitude != 0.0) { wxString locator = CUtils::latLonToLoc(m_latitude, m_longitude); connect.setLocator(locator); @@ -574,7 +567,7 @@ void CCCSHandler::clockInt(unsigned int ms) } if (m_pollTimer.isRunning() && m_pollTimer.hasExpired()) { - CPollData poll(m_callsign, m_ccsAddress, CCS_PORT); + CPollData poll(m_callsign, m_ccsAddr, m_ccsAddrLen); m_protocol.writePoll(poll); m_pollTimer.start(); @@ -584,7 +577,7 @@ void CCCSHandler::clockInt(unsigned int ms) wxLogMessage(wxT("CCS: Activity timeout on link for %s"), m_callsign.c_str(), m_callsign.c_str()); CCCSData data(m_local, m_yourCall, CT_TERMINATE); - data.setDestination(m_ccsAddress, CCS_PORT); + data.setDestination(m_ccsAddr, m_ccsAddrLen); m_protocol.writeMisc(data); m_protocol.writeMisc(data); @@ -600,7 +593,7 @@ void CCCSHandler::clockInt(unsigned int ms) } if (m_waitTimer.isRunning() && m_waitTimer.hasExpired()) { - CConnectData connect(m_callsign, CT_LINK1, m_ccsAddress, CCS_PORT); + CConnectData connect(m_callsign, CT_LINK1, m_ccsAddr, m_ccsAddrLen); if (m_latitude != 0.0 && m_longitude != 0.0) { wxString locator = CUtils::latLonToLoc(m_latitude, m_longitude); connect.setLocator(locator); @@ -617,7 +610,7 @@ void CCCSHandler::clockInt(unsigned int ms) CHeaderData header; header.setMyCall1(m_callsign.Left(LONG_CALLSIGN_LENGTH - 1U)); CHeardData heard(header, m_callsign, wxEmptyString); - heard.setDestination(m_ccsAddress, CCS_PORT); + heard.setDestination(m_ccsAddr, m_ccsAddrLen); m_protocol.writeHeard(heard); m_announceTimer.start(3600U); diff --git a/Common/CCSHandler.h b/Common/CCSHandler.h index 81f5a1a..cd32402 100644 --- a/Common/CCSHandler.h +++ b/Common/CCSHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 by Jonathan Naylor G4KLX + * Copyright (C) 2013,2020 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 @@ -121,7 +121,8 @@ private: wxString m_description1; wxString m_description2; wxString m_url; - in_addr m_ccsAddress; + sockaddr_storage m_ccsAddr; + unsigned int m_ccsAddrLen; CCCSProtocolHandler m_protocol; CCS_STATUS m_state; wxString m_local; diff --git a/Common/CCSProtocolHandler.h b/Common/CCSProtocolHandler.h index 87bc9f1..1acd0bd 100644 --- a/Common/CCSProtocolHandler.h +++ b/Common/CCSProtocolHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 by Jonathan Naylor G4KLX + * Copyright (C) 2013,2020 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 @@ -71,8 +71,8 @@ private: CCS_TYPE m_type; unsigned char* m_buffer; unsigned int m_length; - in_addr m_yourAddress; - unsigned int m_yourPort; + sockadd_storage m_yourAddr; + unsigned int m_yourAddrLen; unsigned int m_myPort; bool readPackets(); diff --git a/Common/CacheManager.h b/Common/CacheManager.h index e8d669b..c9c55be 100644 --- a/Common/CacheManager.h +++ b/Common/CacheManager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010,2011,2012 by Jonathan Naylor G4KLX + * Copyright (C) 2010,2011,2012,2020 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 @@ -33,11 +33,12 @@ class CUserData { public: - CUserData(const wxString& user, const wxString& repeater, const wxString& gateway, in_addr address) : + CUserData(const wxString& user, const wxString& repeater, const wxString& gateway, const sockaddr_storage& addr, unsigned int addrLen) : m_user(user), m_repeater(repeater), m_gateway(gateway), - m_address(address) + m_addr(addr), + m_addrLen(addrLen) { } @@ -56,24 +57,31 @@ public: return m_gateway; } - in_addr getAddress() const + sockaddr_storage getAddr() const { - return m_address; + return m_addr; + } + + unsigned int getAddrLen() const + { + return m_addLen; } private: - wxString m_user; - wxString m_repeater; - wxString m_gateway; - in_addr m_address; + wxString m_user; + wxString m_repeater; + wxString m_gateway; + sockaddr_storage m_addr; + unsigned int m_addrLen; }; class CRepeaterData { public: - CRepeaterData(const wxString& repeater, const wxString& gateway, in_addr address, DSTAR_PROTOCOL protocol) : + CRepeaterData(const wxString& repeater, const wxString& gateway, const sockaddr_storage& addr, unsigned int addrLen, DSTAR_PROTOCOL protocol) : m_repeater(repeater), m_gateway(gateway), - m_address(address), + m_addr(addr), + m_addrLen(addrLen), m_protocol(protocol) { } @@ -88,9 +96,14 @@ public: return m_gateway; } - in_addr getAddress() const + sockaddr_storage getAddr() const { - return m_address; + return m_addr; + } + + unsigned int getAddrLen() const + { + return m_addrLen; } DSTAR_PROTOCOL getProtocol() const @@ -99,17 +112,19 @@ public: } private: - wxString m_repeater; - wxString m_gateway; - in_addr m_address; - DSTAR_PROTOCOL m_protocol; + wxString m_repeater; + wxString m_gateway; + sockaddr_storage m_addr; + unsigned int m_addrLen; + DSTAR_PROTOCOL m_protocol; }; class CGatewayData { public: - CGatewayData(const wxString& gateway, in_addr address, DSTAR_PROTOCOL protocol) : + CGatewayData(const wxString& gateway, const sockaddr_storage& addr, unsigned int addrLen, DSTAR_PROTOCOL protocol) : m_gateway(gateway), - m_address(address), + m_addr(addr), + m_addrLen(addrLen), m_protocol(protocol) { } @@ -119,9 +134,14 @@ public: return m_gateway; } - in_addr getAddress() const + sockaddr_storage getAddr() const { - return m_address; + return m_addr; + } + + unsigned int getAddrLen() const + { + return m_addrLen; } DSTAR_PROTOCOL getProtocol() const @@ -130,9 +150,10 @@ public: } private: - wxString m_gateway; - in_addr m_address; - DSTAR_PROTOCOL m_protocol; + wxString m_gateway; + sockaddr_storage m_addr; + unsigned int m_addrLen; + DSTAR_PROTOCOL m_protocol; }; class CCacheManager { diff --git a/Common/ConnectData.h b/Common/ConnectData.h index da6ea78..99927a1 100644 --- a/Common/ConnectData.h +++ b/Common/ConnectData.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010,2012,2013 by Jonathan Naylor G4KLX + * Copyright (C) 2010,2012,2013,2020 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 @@ -39,18 +39,18 @@ enum CD_TYPE { class CConnectData { public: - CConnectData(GATEWAY_TYPE gatewayType, const wxString& repeater, const wxString& reflector, CD_TYPE type, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort = 0U); - CConnectData(const wxString& repeater, const wxString& reflector, CD_TYPE type, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort = 0U); - CConnectData(const wxString& repeater, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort = 0U); - CConnectData(const wxString& repeater, CD_TYPE type, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort = 0U); - CConnectData(CD_TYPE type, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort = 0U); + CConnectData(GATEWAY_TYPE gatewayType, const wxString& repeater, const wxString& reflector, CD_TYPE type, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort = 0U); + CConnectData(const wxString& repeater, const wxString& reflector, CD_TYPE type, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort = 0U); + CConnectData(const wxString& repeater, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort = 0U); + CConnectData(const wxString& repeater, CD_TYPE type, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort = 0U); + CConnectData(CD_TYPE type, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort = 0U); CConnectData(); ~CConnectData(); - bool setDExtraData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort); - bool setDPlusData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort); - bool setDCSData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort); - bool setCCSData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort); + bool setDExtraData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort); + bool setDPlusData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort); + bool setDCSData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort); + bool setCCSData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort); unsigned int getDExtraData(unsigned char* data, unsigned int length) const; unsigned int getDPlusData(unsigned char* data, unsigned int length) const; @@ -61,21 +61,21 @@ public: wxString getReflector() const; CD_TYPE getType() const; - in_addr getYourAddress() const; - unsigned int getYourPort() const; - unsigned int getMyPort() const; + sockaddr_storage getYourAddr() const; + unsigned int getYourAddrLen() const; + unsigned int getMyPort() const; void setLocator(const wxString& locator); private: - GATEWAY_TYPE m_gatewayType; - wxString m_repeater; - wxString m_reflector; - CD_TYPE m_type; - wxString m_locator; - in_addr m_yourAddress; - unsigned int m_yourPort; - unsigned int m_myPort; + GATEWAY_TYPE m_gatewayType; + wxString m_repeater; + wxString m_reflector; + CD_TYPE m_type; + wxString m_locator; + sockaddr_storage m_yourAddress; + unsigned int m_yourAddrLen; + unsigned int m_myPort; }; #endif diff --git a/Common/DCSHandler.h b/Common/DCSHandler.h index 8cd1caa..b74daad 100644 --- a/Common/DCSHandler.h +++ b/Common/DCSHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012,2013,2015 by Jonathan Naylor G4KLX + * Copyright (C) 2012,2013,2015,2020 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 @@ -56,7 +56,7 @@ public: static void setHeaderLogger(CHeaderLogger* logger); static void setGatewayType(GATEWAY_TYPE type); - static void link(IReflectorCallback* handler, const wxString& repeater, const wxString& reflector, const in_addr& address); + static void link(IReflectorCallback* handler, const wxString& repeater, const wxString& reflector, const sockaddr_storage& addr, unsigned int addrLen); static void unlink(IReflectorCallback* handler, const wxString& reflector = wxEmptyString, bool exclude = true); static void unlink(); @@ -83,7 +83,7 @@ public: static wxString getIncoming(const wxString& callsign); protected: - CDCSHandler(IReflectorCallback* handler, const wxString& reflector, const wxString& repeater, CDCSProtocolHandler* protoHandler, const in_addr& address, unsigned int port, DIRECTION direction); + CDCSHandler(IReflectorCallback* handler, const wxString& reflector, const wxString& repeater, CDCSProtocolHandler* protoHandler, const sockaddr_storage& addr, unsigned int addrLen, DIRECTION direction); ~CDCSHandler(); void processInt(CAMBEData& data); @@ -115,8 +115,8 @@ private: bool m_isXlx; wxString m_repeater; CDCSProtocolHandler* m_handler; - in_addr m_yourAddress; - unsigned int m_yourPort; + sockaddr_storage m_yourAddr; + unsigned int m_yourAddrLen; unsigned int m_myPort; DIRECTION m_direction; DCS_STATE m_linkState; diff --git a/Common/DCSProtocolHandler.h b/Common/DCSProtocolHandler.h index c39c92f..37a43be 100644 --- a/Common/DCSProtocolHandler.h +++ b/Common/DCSProtocolHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012,2013 by Jonathan Naylor G4KLX + * Copyright (C) 2012,2013,2020 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 @@ -65,8 +65,8 @@ private: DCS_TYPE m_type; unsigned char* m_buffer; unsigned int m_length; - in_addr m_yourAddress; - unsigned int m_yourPort; + sockaddr_storage m_yourAddr; + unsigned int m_yourAddrLen; unsigned int m_myPort; bool readPackets(); diff --git a/Common/DDData.h b/Common/DDData.h index ad89902..25950de 100644 --- a/Common/DDData.h +++ b/Common/DDData.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011,2013 by Jonathan Naylor G4KLX + * Copyright (C) 2011,2013,2020 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 @@ -35,8 +35,8 @@ public: CDDData(const CDDData& data); ~CDDData(); - bool setIcomRepeaterData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort); - bool setHBRepeaterData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort); + bool setIcomRepeaterData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen); + bool setHBRepeaterData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen); unsigned int getIcomRepeaterData(unsigned char* data, unsigned int length); unsigned int getHBRepeaterData(unsigned char* data, unsigned int length); @@ -75,10 +75,10 @@ public: unsigned char* getDestinationAddress() const; void setRepeaters(const wxString& rpt1, const wxString& rpt2); - void setDestination(const in_addr& address, unsigned int port); + void setDestination(const sockaddr_storage& addr, unsigned int addrLen); - in_addr getYourAddress() const; - unsigned int getYourPort() const; + sockaddr_storage getYourAddr() const; + unsigned int getYourAddrLen() const; private: CHeaderData m_header; diff --git a/Common/DExtraHandler.h b/Common/DExtraHandler.h index 8d11676..324173a 100644 --- a/Common/DExtraHandler.h +++ b/Common/DExtraHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2013,2015 by Jonathan Naylor G4KLX + * Copyright (C) 2010-2013,2015,2020 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 @@ -56,7 +56,7 @@ public: static void setHeaderLogger(CHeaderLogger* logger); static void setMaxDongles(unsigned int maxDongles); - static void link(IReflectorCallback* handler, const wxString& repeater, const wxString& reflector, const in_addr& address); + static void link(IReflectorCallback* handler, const wxString& repeater, const wxString& reflector, const sockaddr_storage& addr, unsigned int addrLen); static void unlink(IReflectorCallback* handler, const wxString& reflector = wxEmptyString, bool exclude = true); static void unlink(); @@ -85,8 +85,8 @@ public: static wxString getDongles(); protected: - CDExtraHandler(IReflectorCallback* handler, const wxString& reflector, const wxString& repeater, CDExtraProtocolHandler* protoHandler, const in_addr& address, unsigned int port, DIRECTION direction); - CDExtraHandler(CDExtraProtocolHandler* protoHandler, const wxString& reflector, const in_addr& address, unsigned int port, DIRECTION direction); + CDExtraHandler(IReflectorCallback* handler, const wxString& reflector, const wxString& repeater, CDExtraProtocolHandler* protoHandler, const sockaddr_storage& addr, unsigned int addrLen, DIRECTION direction); + CDExtraHandler(CDExtraProtocolHandler* protoHandler, const wxString& reflector, const sockaddr_storage& addr, unsigned int addrLen, DIRECTION direction); ~CDExtraHandler(); void processInt(CHeaderData& header); @@ -117,8 +117,8 @@ private: wxString m_reflector; wxString m_repeater; CDExtraProtocolHandler* m_handler; - in_addr m_yourAddress; - unsigned int m_yourPort; + sockaddr_storage m_yourAddr; + unsigned int m_yourAddrLen; DIRECTION m_direction; DEXTRA_STATE m_linkState; IReflectorCallback* m_destination; diff --git a/Common/DExtraProtocolHandler.h b/Common/DExtraProtocolHandler.h index 5bd9cb8..1d3b79c 100644 --- a/Common/DExtraProtocolHandler.h +++ b/Common/DExtraProtocolHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2013 by Jonathan Naylor G4KLX + * Copyright (C) 2010-2013,2020 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 @@ -69,8 +69,8 @@ private: DEXTRA_TYPE m_type; unsigned char* m_buffer; unsigned int m_length; - in_addr m_yourAddress; - unsigned int m_yourPort; + sockaddr_storage m_yourAddr; + unsigned int m_yourAddrLen; unsigned int m_myPort; bool readPackets(); diff --git a/Common/DPlusHandler.h b/Common/DPlusHandler.h index 37dcf0b..cd40465 100644 --- a/Common/DPlusHandler.h +++ b/Common/DPlusHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2013,2015 by Jonathan Naylor G4KLX + * Copyright (C) 2010-2013,2015,2020 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 @@ -61,7 +61,7 @@ public: static void startAuthenticator(const wxString& address, CCacheManager* cache); - static void link(IReflectorCallback* handler, const wxString& repeater, const wxString& reflector, const in_addr& address); + static void link(IReflectorCallback* handler, const wxString& repeater, const wxString& reflector, const sockaddr_storage& addr, unsigned int addrLen); static void relink(IReflectorCallback* handler, const wxString& reflector); static void unlink(IReflectorCallback* handler, const wxString& reflector = wxEmptyString, bool exclude = true); static void unlink(); @@ -90,8 +90,8 @@ public: static wxString getDongles(); protected: - CDPlusHandler(IReflectorCallback* handler, const wxString& repeater, const wxString& reflector, CDPlusProtocolHandler* protoHandler, const in_addr& address, unsigned int port); - CDPlusHandler(CDPlusProtocolHandler* protoHandler, const in_addr& address, unsigned int port); + CDPlusHandler(IReflectorCallback* handler, const wxString& repeater, const wxString& reflector, CDPlusProtocolHandler* protoHandler, const sockaddr_storage& addr, unsigned int addrLen); + CDPlusHandler(CDPlusProtocolHandler* protoHandler, const sockaddr_storage& addr, unsigned int addrLen); ~CDPlusHandler(); void processInt(CHeaderData& header); @@ -125,8 +125,8 @@ private: wxString m_callsign; wxString m_reflector; CDPlusProtocolHandler* m_handler; - in_addr m_yourAddress; - unsigned int m_yourPort; + sockaddr_storage m_yourAddr; + unsigned int m_yourAddrLen; unsigned int m_myPort; DIRECTION m_direction; DPLUS_STATE m_linkState; diff --git a/Common/DPlusProtocolHandler.h b/Common/DPlusProtocolHandler.h index 3978f78..15e3187 100644 --- a/Common/DPlusProtocolHandler.h +++ b/Common/DPlusProtocolHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010,2011,2013 by Jonathan Naylor G4KLX + * Copyright (C) 2010,2011,2013,2020 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 @@ -69,8 +69,8 @@ private: DPLUS_TYPE m_type; unsigned char* m_buffer; unsigned int m_length; - in_addr m_yourAddress; - unsigned int m_yourPort; + sockaddr_storage m_yourAddr; + unsigned int m_yourAddrLen; unsigned int m_myPort; bool readPackets(); diff --git a/Common/Defs.h b/Common/Defs.h index f2c5c31..63ae17b 100644 --- a/Common/Defs.h +++ b/Common/Defs.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2015 by Jonathan Naylor G4KLX + * Copyright (C) 2010-2015,2020 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 @@ -136,8 +136,4 @@ enum GATEWAY_TYPE { const unsigned int TIME_PER_TIC_MS = 5U; -#if defined(__WINDOWS__) -typedef unsigned long in_addr_t; -#endif - #endif diff --git a/Common/G2Handler.h b/Common/G2Handler.h index d9e1402..cec58aa 100644 --- a/Common/G2Handler.h +++ b/Common/G2Handler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010,2012 by Jonathan Naylor G4KLX + * Copyright (C) 2010,2012,2020 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 @@ -50,7 +50,7 @@ public: static void finalise(); protected: - CG2Handler(CRepeaterHandler* repeater, const in_addr& address, unsigned int id); + CG2Handler(CRepeaterHandler* repeater, const sockaddr_storage& addr, unsigned int addrLen, unsigned int id); ~CG2Handler(); bool clockInt(unsigned int ms); @@ -64,7 +64,8 @@ private: static CHeaderLogger* m_headerLogger; CRepeaterHandler* m_repeater; - in_addr m_address; + sockaddr_storage m_addr; + unsigned int m_addrLen; unsigned int m_id; CTimer m_inactivityTimer; }; diff --git a/Common/G2ProtocolHandler.h b/Common/G2ProtocolHandler.h index 0a60896..f0870b8 100644 --- a/Common/G2ProtocolHandler.h +++ b/Common/G2ProtocolHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010,2011 by Jonathan Naylor G4KLX + * Copyright (C) 2010,2011,2020 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 @@ -63,8 +63,8 @@ private: G2_TYPE m_type; unsigned char* m_buffer; unsigned int m_length; - in_addr m_address; - unsigned int m_port; + sockaddr_storage m_addr; + unsigned int m_addrLen; bool readPackets(); }; diff --git a/Common/GatewayCache.h b/Common/GatewayCache.h index 561743c..e9f76b3 100644 --- a/Common/GatewayCache.h +++ b/Common/GatewayCache.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010,2011,2012 by Jonathan Naylor G4KLX + * Copyright (C) 2010,2011,2012,2020 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 @@ -35,9 +35,10 @@ class CGatewayRecord { public: - CGatewayRecord(const wxString& gateway, in_addr address, DSTAR_PROTOCOL protocol, bool addrLock, bool protoLock) : + CGatewayRecord(const wxString& gateway, const sockaddr_storage& addr, unsigned int addrLen, DSTAR_PROTOCOL protocol, bool addrLock, bool protoLock) : m_gateway(gateway), - m_address(address), + m_addr(addr), + m_addrLen(addrLen), m_protocol(DP_UNKNOWN), m_addrLock(addrLock), m_protoLock(false) @@ -53,9 +54,14 @@ public: return m_gateway; } - in_addr getAddress() const + sockaddr_storage getAddr() const { - return m_address; + return m_addr; + } + + unsigned int getAddrLen() const + { + return m_addrLen; } DSTAR_PROTOCOL getProtocol() const @@ -63,10 +69,11 @@ public: return m_protocol; } - void setData(in_addr address, DSTAR_PROTOCOL protocol, bool addrLock, bool protoLock) + void setData(const sockaddr_storage& addr, unsigned int addrLen, DSTAR_PROTOCOL protocol, bool addrLock, bool protoLock) { if (!m_addrLock) { - m_address = address; + m_addr = addr; + m_addrLen = addrLen; m_addrLock = addrLock; } @@ -79,11 +86,12 @@ public: } private: - wxString m_gateway; - in_addr m_address; - DSTAR_PROTOCOL m_protocol; - bool m_addrLock; - bool m_protoLock; + wxString m_gateway; + sockaddr_storage m_addr; + unsigned int m_addrLen; + DSTAR_PROTOCOL m_protocol; + bool m_addrLock; + bool m_protoLock; }; WX_DECLARE_STRING_HASH_MAP(CGatewayRecord*, CGatewayCache_t); diff --git a/Common/HBRepeaterProtocolHandler.h b/Common/HBRepeaterProtocolHandler.h index f2de49e..ef77f39 100644 --- a/Common/HBRepeaterProtocolHandler.h +++ b/Common/HBRepeaterProtocolHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2013 by Jonathan Naylor G4KLX + * Copyright (C) 2010-2013,2020 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 @@ -67,8 +67,8 @@ private: REPEATER_TYPE m_type; unsigned char* m_buffer; unsigned int m_length; - in_addr m_address; - unsigned int m_port; + sockaddr_storage m_addr; + unsigned int m_addrLen; bool readPackets(); }; diff --git a/Common/HeaderData.h b/Common/HeaderData.h index 791ec36..3d78b30 100644 --- a/Common/HeaderData.h +++ b/Common/HeaderData.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2014 by Jonathan Naylor G4KLX + * Copyright (C) 2010-2014,2020 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 @@ -36,13 +36,13 @@ public: unsigned char flag2 = 0x00, unsigned char flag3 = 0x00); ~CHeaderData(); - bool setIcomRepeaterData(const unsigned char* data, unsigned int length, bool check, const in_addr& yourAddress, unsigned int yourPort); - bool setHBRepeaterData(const unsigned char* data, unsigned int length, bool check, const in_addr& yourAddress, unsigned int yourPort); - bool setG2Data(const unsigned char* data, unsigned int length, bool check, const in_addr& yourAddress, unsigned int yourPort); - bool setDExtraData(const unsigned char* data, unsigned int length, bool check, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort); - bool setDPlusData(const unsigned char* data, unsigned int length, bool check, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort); - void setDCSData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort); - void setCCSData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort); + bool setIcomRepeaterData(const unsigned char* data, unsigned int length, bool check, const sockaddr_storage& yourAddr, unsigned int yourAddrLen); + bool setHBRepeaterData(const unsigned char* data, unsigned int length, bool check, const sockaddr_storage& yourAddr, unsigned int yourAddrLen); + bool setG2Data(const unsigned char* data, unsigned int length, bool check, const sockaddr_storage& yourAddr, unsigned int yourAddrLen); + bool setDExtraData(const unsigned char* data, unsigned int length, bool check, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort); + bool setDPlusData(const unsigned char* data, unsigned int length, bool check, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort); + void setDCSData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort); + void setCCSData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort); unsigned int getIcomRepeaterData(unsigned char* data, unsigned int length, bool check) const; unsigned int getHBRepeaterData(unsigned char* data, unsigned int length, bool check) const; @@ -90,14 +90,14 @@ public: void setCQCQCQ(); void setRepeaters(const wxString& rpt1, const wxString& rpt2); - void setDestination(const in_addr& address, unsigned int port); + void setDestination(const sockaddr_storage& addr, unsigned int addrLen); bool setData(const unsigned char* data, unsigned int length, bool check); unsigned int getData(unsigned char* data, unsigned int length, bool check) const; - in_addr getYourAddress() const; - unsigned int getYourPort() const; - unsigned int getMyPort() const; + sockaddr_storage getYourAddr() const; + unsigned int getYourAddrLen() const; + unsigned int getMyPort() const; unsigned int getErrors() const; @@ -108,23 +108,23 @@ public: CHeaderData& operator=(const CHeaderData& header); private: - unsigned int m_rptSeq; - unsigned int m_id; - unsigned char m_band1; - unsigned char m_band2; - unsigned char m_band3; - unsigned char m_flag1; - unsigned char m_flag2; - unsigned char m_flag3; - unsigned char* m_myCall1; - unsigned char* m_myCall2; - unsigned char* m_yourCall; - unsigned char* m_rptCall1; - unsigned char* m_rptCall2; - in_addr m_yourAddress; - unsigned int m_yourPort; - unsigned int m_myPort; - unsigned int m_errors; + unsigned int m_rptSeq; + unsigned int m_id; + unsigned char m_band1; + unsigned char m_band2; + unsigned char m_band3; + unsigned char m_flag1; + unsigned char m_flag2; + unsigned char m_flag3; + unsigned char* m_myCall1; + unsigned char* m_myCall2; + unsigned char* m_yourCall; + unsigned char* m_rptCall1; + unsigned char* m_rptCall2; + sockaddr_storage m_yourAddr; + unsigned int m_yourAddrLen; + unsigned int m_myPort; + unsigned int m_errors; }; #endif diff --git a/Common/HeardData.h b/Common/HeardData.h index 61010fa..3e02a22 100644 --- a/Common/HeardData.h +++ b/Common/HeardData.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012,2013 by Jonathan Naylor G4KLX + * Copyright (C) 2012,2013,2020 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 @@ -37,25 +37,25 @@ public: CHeardData(const CHeaderData& data, const wxString& repeater, const wxString& reflector); ~CHeardData(); - bool setIcomRepeaterData(const unsigned char* data, unsigned int length, const in_addr& address, unsigned int port); + bool setIcomRepeaterData(const unsigned char* data, unsigned int length, const sockaddr_storage& addr, unsigned int addrLen); unsigned int getCCSData(unsigned char* data, unsigned int length) const; wxString getRepeater() const; wxString getUser() const; - void setDestination(const in_addr& address, unsigned int port); + void setDestination(const sockaddr_storage& addr, unsigned int addrLen); - in_addr getAddress() const; - unsigned int getPort() const; + // sockaddr_storage getAddr() const; + // unsigned int getAddrLen() const; private: - wxString m_reflector; - wxString m_repeater; - wxString m_user; - wxString m_ext; - in_addr m_address; - unsigned int m_port; + wxString m_reflector; + wxString m_repeater; + wxString m_user; + wxString m_ext; + sockaddr_storage m_addr; + unsigned int m_addrLen; }; #endif diff --git a/Common/IcomRepeaterProtocolHandler.h b/Common/IcomRepeaterProtocolHandler.h index 95ee151..26fd2d4 100644 --- a/Common/IcomRepeaterProtocolHandler.h +++ b/Common/IcomRepeaterProtocolHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2013 by Jonathan Naylor G4KLX + * Copyright (C) 2010-2013,2020 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 @@ -150,8 +150,8 @@ public: private: CUDPReaderWriter m_socket; - in_addr m_icomAddress; - unsigned int m_icomPort; + sockaddr_storage m_icomAddr; + unsigned int m_icomAddrLen; bool m_over1; wxUint16 m_seqNo; unsigned int m_tries; diff --git a/Common/PollData.h b/Common/PollData.h index d85ec78..eddadd7 100644 --- a/Common/PollData.h +++ b/Common/PollData.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010,2012,2013 by Jonathan Naylor G4KLX + * Copyright (C) 2010,2012,2013,2020 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 @@ -31,16 +31,16 @@ class CPollData { public: - CPollData(const wxString& data1, const wxString& data2, DIRECTION direction, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort = 0U); - CPollData(const wxString& data, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort = 0U); - CPollData(const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort = 0U); + CPollData(const wxString& data1, const wxString& data2, DIRECTION direction, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort = 0U); + CPollData(const wxString& data, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort = 0U); + CPollData(const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort = 0U); CPollData(); ~CPollData(); - bool setDExtraData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort); - bool setDPlusData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort); - bool setDCSData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort); - bool setCCSData(const unsigned char* data, unsigned int length, const in_addr& yourAddress, unsigned int yourPort, unsigned int myPort); + bool setDExtraData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort); + bool setDPlusData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort); + bool setDCSData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort); + bool setCCSData(const unsigned char* data, unsigned int length, const sockaddr_storage& yourAddr, unsigned int yourAddrLen, unsigned int myPort); unsigned int getDExtraData(unsigned char* data, unsigned int length) const; unsigned int getDPlusData(unsigned char* data, unsigned int length) const; @@ -55,22 +55,22 @@ public: bool isDongle() const; - in_addr getYourAddress() const; - unsigned int getYourPort() const; - unsigned int getMyPort() const; + sockaddr_storage getYourAddr() const; + unsigned int getYourAddrLen() const; + unsigned int getMyPort() const; DIRECTION getDirection() const; unsigned int getLength() const; private: - wxString m_data1; - wxString m_data2; - DIRECTION m_direction; - bool m_dongle; - unsigned int m_length; - in_addr m_yourAddress; - unsigned int m_yourPort; - unsigned int m_myPort; + wxString m_data1; + wxString m_data2; + DIRECTION m_direction; + bool m_dongle; + unsigned int m_length; + sockaddr_storage m_yourAddr; + unsigned int m_yourAddrLen; + unsigned int m_myPort; }; #endif diff --git a/Common/RemoteProtocolHandler.h b/Common/RemoteProtocolHandler.h index 5355f25..dce908d 100644 --- a/Common/RemoteProtocolHandler.h +++ b/Common/RemoteProtocolHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011,2013 by Jonathan Naylor G4KLX + * Copyright (C) 2011,2013,2020 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 @@ -71,8 +71,8 @@ public: private: CUDPReaderWriter m_socket; - in_addr m_address; - unsigned int m_port; + sockaddr_storage m_addr; + unsigned int m_addrLen; bool m_loggedIn; RPH_TYPE m_type; unsigned char* m_inBuffer; diff --git a/Common/RepeaterHandler.h b/Common/RepeaterHandler.h index 05baca2..5d3d8cc 100644 --- a/Common/RepeaterHandler.h +++ b/Common/RepeaterHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2015,2018 by Jonathan Naylor G4KLX + * Copyright (C) 2010-2015,2018,2020 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 @@ -175,8 +175,8 @@ private: wxString m_rptCallsign; wxString m_gwyCallsign; unsigned char m_band; - in_addr m_address; - unsigned int m_port; + sockaddr_storage m_addr; + unsigned int m_addrLen; HW_TYPE m_hwType; IRepeaterProtocolHandler* m_repeaterHandler; double m_frequency; @@ -231,7 +231,8 @@ private: wxString m_g2Repeater; wxString m_g2Gateway; CHeaderData* m_g2Header; - in_addr m_g2Address; + sockaddr_storage m_g2Addr; + unsigned int m_g2AddrLen; // Link info LINK_STATUS m_linkStatus; diff --git a/Common/StarNetHandler.h b/Common/StarNetHandler.h index 067d6cd..c31ec08 100644 --- a/Common/StarNetHandler.h +++ b/Common/StarNetHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2014 by Jonathan Naylor G4KLX + * Copyright (C) 2011-2014,2020 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 @@ -98,7 +98,8 @@ public: wxString m_destination; wxString m_repeater; wxString m_gateway; - in_addr m_address; + sockaddr_storage m_addr; + unsigned int m_addrLen; IRepeaterCallback* m_local; }; diff --git a/Common/StatusData.h b/Common/StatusData.h index c351921..3255d96 100644 --- a/Common/StatusData.h +++ b/Common/StatusData.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011,2012 by Jonathan Naylor G4KLX + * Copyright (C) 2011,2012,2020 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 @@ -34,16 +34,16 @@ public: unsigned int getHBRepeaterData(unsigned char* data, unsigned int length) const; - void setDestination(const in_addr& address, unsigned int port); + void setDestination(const sockaddr_storage& addr, unsigned int addrLen); - in_addr getAddress() const; - unsigned int getPort() const; + sockaddr_storage getAddr() const; + unsigned int getAddrLen() const; private: - unsigned char* m_data; - unsigned int m_n; - in_addr m_address; - unsigned int m_port; + unsigned char* m_data; + unsigned int m_n; + sockaddr_storage m_addr; + unsigned int m_addrLen; }; #endif diff --git a/Common/TCPReaderWriterServer.h b/Common/TCPReaderWriterServer.h index f3d7c1d..5dcd402 100644 --- a/Common/TCPReaderWriterServer.h +++ b/Common/TCPReaderWriterServer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 by Jonathan Naylor G4KLX + * Copyright (C) 2011,2020 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 @@ -59,7 +59,6 @@ private: bool open(); int accept(); void close(); - in_addr lookup(const wxString& hostname) const; }; #endif diff --git a/Common/TextData.h b/Common/TextData.h index 4184445..0895a20 100644 --- a/Common/TextData.h +++ b/Common/TextData.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010,2011,2012,2013 by Jonathan Naylor G4KLX + * Copyright (C) 2010,2011,2012,2013,2020 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 @@ -30,22 +30,22 @@ class CTextData { public: - CTextData(LINK_STATUS status, const wxString& reflector, const wxString& text, const in_addr& address, unsigned int port, bool temporary = false); - CTextData(const wxString& text, const in_addr& address, unsigned int port, bool temporary = true); + CTextData(LINK_STATUS status, const wxString& reflector, const wxString& text, const sockaddr_storage& addr, unsigned int addrLen, bool temporary = false); + CTextData(const wxString& text, const sockaddr_storage& addr, unsigned int addrLen, bool temporary = true); virtual ~CTextData(); unsigned int getHBRepeaterData(unsigned char* data, unsigned int length) const; - in_addr getAddress() const; - unsigned int getPort() const; + // sockaddr_storage getAddr() const; + // unsigned int getAddrLen() const; private: - LINK_STATUS m_status; - unsigned char* m_reflector; - unsigned char* m_text; - in_addr m_address; - unsigned int m_port; - bool m_temporary; + LINK_STATUS m_status; + unsigned char* m_reflector; + unsigned char* m_text; + sockaddr_storage m_address; + unsigned int m_addrLen; + bool m_temporary; }; #endif diff --git a/Common/UDPReaderWriter.h b/Common/UDPReaderWriter.h index fd60c1d..5b5a7bc 100644 --- a/Common/UDPReaderWriter.h +++ b/Common/UDPReaderWriter.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2011,2013,2018 by Jonathan Naylor G4KLX + * Copyright (C) 2009-2011,2013,2018,2020 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 @@ -39,22 +39,25 @@ public: CUDPReaderWriter(); ~CUDPReaderWriter(); - static in_addr lookup(const wxString& hostName); + static int lookup(const wxString& hostName, unsigned int port, sockaddr_storage& addr, unsigned int& addrLen); + + static bool match(const sockaddr_storage& first, const sockaddr_storage& second); bool open(); - int read(unsigned char* buffer, unsigned int length, in_addr& address, unsigned int& port); - bool write(const unsigned char* buffer, unsigned int length, const in_addr& address, unsigned int port); + int read(unsigned char* buffer, unsigned int length, sockaddr_storage& addr, unsigned int& addrLen); + bool write(const unsigned char* buffer, unsigned int length, const sockaddr_storage& addr, unsigned int addrLen); void close(); unsigned int getPort() const; private: - wxString m_address; - unsigned short m_port; - in_addr m_addr; - int m_fd; + wxString m_address; + unsigned short m_port; + sockaddr_storage m_addr; + unsigned int m_addrLen; + int m_fd; }; #endif diff --git a/RemoteControl/RemoteControlRemoteControlHandler.h b/RemoteControl/RemoteControlRemoteControlHandler.h index e9d315b..e49053a 100644 --- a/RemoteControl/RemoteControlRemoteControlHandler.h +++ b/RemoteControl/RemoteControlRemoteControlHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011,2013 by Jonathan Naylor G4KLX + * Copyright (C) 2011,2013,2020 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 @@ -72,8 +72,8 @@ public: private: CUDPReaderWriter m_socket; - in_addr m_address; - unsigned int m_port; + sockaddr_storage m_addr; + unsigned int m_addrLen; bool m_loggedIn; unsigned int m_retryCount; RC_TYPE m_type; diff --git a/TimeServer/TimeServerThread.h b/TimeServer/TimeServerThread.h index eb6d26e..3ac9b18 100644 --- a/TimeServer/TimeServerThread.h +++ b/TimeServer/TimeServerThread.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012,2013 by Jonathan Naylor G4KLX + * Copyright (C) 2012,2013,2020 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 @@ -79,7 +79,8 @@ private: wxString m_callsignD; wxString m_callsignE; wxString m_callsignG; - in_addr m_address; + sockaddr_storage m_addr; + unsigned int m_addrLen; LANGUAGE m_language; FORMAT m_format; INTERVAL m_interval; diff --git a/TimerControl/TimerControlRemoteControlHandler.h b/TimerControl/TimerControlRemoteControlHandler.h index 18c576e..eb395a7 100644 --- a/TimerControl/TimerControlRemoteControlHandler.h +++ b/TimerControl/TimerControlRemoteControlHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 by Jonathan Naylor G4KLX + * Copyright (C) 2011,2020 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 @@ -62,8 +62,8 @@ public: private: CUDPReaderWriter m_socket; - in_addr m_address; - unsigned int m_port; + sockaddr_storage m_addr; + unsigned int m_addrLen; bool m_loggedIn; unsigned int m_retryCount; TC_TYPE m_type;