mirror of
https://github.com/g4klx/ircDDBGateway.git
synced 2026-01-28 19:04:18 +01:00
Allow to compile without NAT traversal, disabled by default
This commit is contained in:
parent
5eafed9454
commit
1e48be71dd
|
|
@ -147,6 +147,7 @@ CAMBEData* CG2ProtocolHandler::readAMBE(in_addr remoteAddress, unsigned int remo
|
|||
return data;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_NAT_TRAVERSAL)
|
||||
void CG2ProtocolHandler::traverseNat(const wxString& address)
|
||||
{
|
||||
unsigned char buffer[1];
|
||||
|
|
@ -158,6 +159,7 @@ void CG2ProtocolHandler::traverseNat(const wxString& address)
|
|||
|
||||
m_socket.write(buffer, 1, addr, G2_DV_PORT);
|
||||
}
|
||||
#endif
|
||||
|
||||
void CG2ProtocolHandler::close()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -52,7 +52,9 @@ public:
|
|||
CHeaderData* readHeader(in_addr incomingAddress, unsigned int incomingPort);
|
||||
CAMBEData* readAMBE(in_addr incomingAddress, unsigned int incomingPort);
|
||||
|
||||
#if defined(ENABLE_NAT_TRAVERSAL)
|
||||
void traverseNat(const wxString& addr);
|
||||
#endif
|
||||
|
||||
void close();
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#if defined(ENABLE_NAT_TRAVERSAL)
|
||||
|
||||
#include "NatTraversalHandler.h"
|
||||
|
||||
const unsigned int CACHE_SIZE = 500U;
|
||||
|
|
@ -54,4 +56,6 @@ void CNatTraversalHandler::traverseNatG2(const wxString& address)
|
|||
m_g2Handler->traverseNat(address);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#if defined(ENABLE_NAT_TRAVERSAL)
|
||||
#ifndef NatTraversalHandler_H
|
||||
#define NatTraversalHandler_H
|
||||
|
||||
|
|
@ -74,4 +75,6 @@ private:
|
|||
CG2ProtocolHandler* m_g2Handler;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -72,7 +72,9 @@ m_dextraPool(NULL),
|
|||
m_dplusPool(NULL),
|
||||
m_dcsPool(NULL),
|
||||
m_g2Handler(NULL),
|
||||
#if defined(ENABLE_NAT_TRAVERSAL)
|
||||
m_natTraversal(NULL),
|
||||
#endif
|
||||
m_aprsWriter(NULL),
|
||||
m_irc(NULL),
|
||||
m_cache(),
|
||||
|
|
@ -218,10 +220,12 @@ void CIRCDDBGatewayThread::run()
|
|||
m_g2Handler = NULL;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_NAT_TRAVERSAL)
|
||||
if(m_g2Handler != NULL) {
|
||||
m_natTraversal = new CNatTraversalHandler();
|
||||
m_natTraversal->setG2Handler(m_g2Handler);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Wait here until we have the essentials to run
|
||||
while (!m_killed && (m_dextraPool == NULL || m_dplusPool == NULL || m_dcsPool == NULL || m_g2Handler == NULL || (m_icomRepeaterHandler == NULL && m_hbRepeaterHandler == NULL && m_dummyRepeaterHandler == NULL) || m_gatewayCallsign.IsEmpty()))
|
||||
|
|
@ -725,7 +729,9 @@ void CIRCDDBGatewayThread::processIrcDDB()
|
|||
if (!address.IsEmpty()) {
|
||||
wxLogMessage(wxT("USER: %s %s %s %s"), user.c_str(), repeater.c_str(), gateway.c_str(), address.c_str());
|
||||
m_cache.updateUser(user, repeater, gateway, address, timestamp, DP_DEXTRA, false, false);
|
||||
#if defined(ENABLE_NAT_TRAVERSAL)
|
||||
m_natTraversal->traverseNatG2(address);
|
||||
#endif
|
||||
} else {
|
||||
wxLogMessage(wxT("USER: %s NOT FOUND"), user.c_str());
|
||||
}
|
||||
|
|
@ -741,7 +747,9 @@ void CIRCDDBGatewayThread::processIrcDDB()
|
|||
if (!address.IsEmpty()) {
|
||||
wxLogMessage(wxT("REPEATER: %s %s %s"), repeater.c_str(), gateway.c_str(), address.c_str());
|
||||
m_cache.updateRepeater(repeater, gateway, address, DP_DEXTRA, false, false);
|
||||
#if defined(ENABLE_NAT_TRAVERSAL)
|
||||
m_natTraversal->traverseNatG2(address);
|
||||
#endif
|
||||
} else {
|
||||
wxLogMessage(wxT("REPEATER: %s NOT FOUND"), repeater.c_str());
|
||||
}
|
||||
|
|
@ -762,7 +770,9 @@ void CIRCDDBGatewayThread::processIrcDDB()
|
|||
if (!address.IsEmpty()) {
|
||||
wxLogMessage(wxT("GATEWAY: %s %s"), gateway.c_str(), address.c_str());
|
||||
m_cache.updateGateway(gateway, address, DP_DEXTRA, false, false);
|
||||
#if defined(ENABLE_NAT_TRAVERSAL)
|
||||
m_natTraversal->traverseNatG2(address);
|
||||
#endif
|
||||
} else {
|
||||
wxLogMessage(wxT("GATEWAY: %s NOT FOUND"), gateway.c_str());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,9 @@ private:
|
|||
CDPlusProtocolHandlerPool* m_dplusPool;
|
||||
CDCSProtocolHandlerPool* m_dcsPool;
|
||||
CG2ProtocolHandler* m_g2Handler;
|
||||
#if defined(ENABLE_NAT_TRAVERSAL)
|
||||
CNatTraversalHandler* m_natTraversal;
|
||||
#endif
|
||||
CAPRSWriter* m_aprsWriter;
|
||||
CIRCDDB* m_irc;
|
||||
CCacheManager m_cache;
|
||||
|
|
|
|||
Loading…
Reference in a new issue