Skip to content

Commit

Permalink
#35 continue ipv6 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
F4FXL committed Jul 15, 2023
1 parent acf71af commit 7242370
Show file tree
Hide file tree
Showing 14 changed files with 128 additions and 149 deletions.
43 changes: 0 additions & 43 deletions BaseCommon/NetworkDestination.cpp

This file was deleted.

33 changes: 0 additions & 33 deletions BaseCommon/NetworkDestination.h

This file was deleted.

4 changes: 2 additions & 2 deletions Common/CCSProtocolHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
26 changes: 8 additions & 18 deletions Common/ConnectData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions Common/DCSHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions Common/DCSProtocolHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions Common/DExtraProtocolHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}
Expand Down
Loading

0 comments on commit 7242370

Please sign in to comment.