mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 00:19:25 -05:00
convert RSNET_NATHOLE to enum class
This commit is contained in:
parent
f81755e320
commit
d310102808
@ -259,7 +259,7 @@ std::string PeerConnectStateBox::connectState() const
|
||||
}
|
||||
|
||||
|
||||
uint32_t convertNetStateToInternal(RsNetworkMode netmode, uint32_t nathole, RsNatTypeMode nattype)
|
||||
uint32_t convertNetStateToInternal(RsNetworkMode netmode, RsNatHoleMode nathole, RsNatTypeMode nattype)
|
||||
{
|
||||
uint32_t connNet = CSB_NETSTATE_UNKNOWN;
|
||||
|
||||
@ -267,7 +267,7 @@ uint32_t convertNetStateToInternal(RsNetworkMode netmode, uint32_t nathole, RsNa
|
||||
{
|
||||
connNet = CSB_NETSTATE_FORWARD;
|
||||
}
|
||||
else if ((nathole != RSNET_NATHOLE_UNKNOWN) && (nathole != RSNET_NATHOLE_NONE))
|
||||
else if ((nathole != RsNatHoleMode::UNKNOWN) && (nathole != RsNatHoleMode::NONE))
|
||||
{
|
||||
connNet = CSB_NETSTATE_FORWARD;
|
||||
}
|
||||
@ -299,20 +299,20 @@ bool shouldUseProxyPortInternal(uint32_t netstate)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PeerConnectStateBox::shouldUseProxyPort(RsNetworkMode netmode, uint32_t nathole, RsNatTypeMode nattype)
|
||||
bool PeerConnectStateBox::shouldUseProxyPort(RsNetworkMode netmode, RsNatHoleMode nathole, RsNatTypeMode nattype)
|
||||
{
|
||||
uint32_t netstate = convertNetStateToInternal(netmode, nathole, nattype);
|
||||
return shouldUseProxyPortInternal(netstate);
|
||||
}
|
||||
|
||||
uint32_t PeerConnectStateBox::calcNetState(RsNetworkMode netmode, uint32_t nathole, RsNatTypeMode nattype)
|
||||
uint32_t PeerConnectStateBox::calcNetState(RsNetworkMode netmode, RsNatHoleMode nathole, RsNatTypeMode nattype)
|
||||
{
|
||||
uint32_t netstate = convertNetStateToInternal(netmode, nathole, nattype);
|
||||
return netstate;
|
||||
}
|
||||
|
||||
|
||||
uint32_t PeerConnectStateBox::connectCb(uint32_t cbtype, RsNetworkMode netmode, uint32_t nathole, RsNatTypeMode nattype)
|
||||
uint32_t PeerConnectStateBox::connectCb(uint32_t cbtype, RsNetworkMode netmode, RsNatHoleMode nathole, RsNatTypeMode nattype)
|
||||
{
|
||||
uint32_t netstate = convertNetStateToInternal(netmode, nathole, nattype);
|
||||
|
||||
|
@ -82,12 +82,12 @@ class PeerConnectStateBox
|
||||
public:
|
||||
PeerConnectStateBox();
|
||||
|
||||
uint32_t connectCb(uint32_t cbtype, RsNetworkMode netmode, uint32_t nathole, RsNatTypeMode nattype);
|
||||
uint32_t connectCb(uint32_t cbtype, RsNetworkMode netmode, RsNatHoleMode nathole, RsNatTypeMode nattype);
|
||||
uint32_t updateCb(uint32_t updateType);
|
||||
|
||||
bool shouldUseProxyPort(RsNetworkMode netmode, uint32_t nathole, RsNatTypeMode nattype);
|
||||
bool shouldUseProxyPort(RsNetworkMode netmode, RsNatHoleMode nathole, RsNatTypeMode nattype);
|
||||
|
||||
uint32_t calcNetState(RsNetworkMode netmode, uint32_t nathole, RsNatTypeMode nattype);
|
||||
uint32_t calcNetState(RsNetworkMode netmode, RsNatHoleMode nathole, RsNatTypeMode nattype);
|
||||
std::string connectState() const;
|
||||
|
||||
std::string mPeerId;
|
||||
|
@ -125,7 +125,7 @@ p3NetMgrIMPL::p3NetMgrIMPL() : mPeerMgr(nullptr), mLinkMgr(nullptr),
|
||||
mOldNetFlags = pqiNetStatus();
|
||||
|
||||
mOldNatType = RsNatTypeMode::UNKNOWN;
|
||||
mOldNatHole = RSNET_NATHOLE_UNKNOWN;
|
||||
mOldNatHole = RsNatHoleMode::UNKNOWN;
|
||||
sockaddr_storage_clear(mLocalAddr);
|
||||
sockaddr_storage_clear(mExtAddr);
|
||||
|
||||
@ -1645,7 +1645,7 @@ RsNatTypeMode p3NetMgrIMPL::getNatTypeMode()
|
||||
return mNetStateBox.getNatTypeMode();
|
||||
}
|
||||
|
||||
uint32_t p3NetMgrIMPL::getNatHoleMode()
|
||||
RsNatHoleMode p3NetMgrIMPL::getNatHoleMode()
|
||||
{
|
||||
RsStackMutex stack(mNetMtx); /****** STACK LOCK MUTEX *******/
|
||||
return mNetStateBox.getNatHoleMode();
|
||||
@ -1767,7 +1767,7 @@ void p3NetMgrIMPL::updateNatSetting()
|
||||
{
|
||||
bool updateRefreshRate = false;
|
||||
RsNatTypeMode natType = RsNatTypeMode::UNKNOWN;
|
||||
uint32_t natHole = RSNET_NATHOLE_UNKNOWN;
|
||||
RsNatHoleMode natHole = RsNatHoleMode::UNKNOWN;
|
||||
{
|
||||
RsStackMutex stack(mNetMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
@ -1805,7 +1805,7 @@ void p3NetMgrIMPL::updateNatSetting()
|
||||
{
|
||||
case RsNatTypeMode::RESTRICTED_CONE:
|
||||
{
|
||||
if ((natHole == RSNET_NATHOLE_NONE) || (natHole == RSNET_NATHOLE_UNKNOWN))
|
||||
if ((natHole == RsNatHoleMode::NONE) || (natHole == RsNatHoleMode::UNKNOWN))
|
||||
{
|
||||
mProxyStunner->setRefreshPeriod(NET_STUNNER_PERIOD_FAST);
|
||||
}
|
||||
@ -1832,7 +1832,7 @@ void p3NetMgrIMPL::updateNatSetting()
|
||||
* So that messages can get through.
|
||||
* We only want to be attached - if we don't have a stable DHT port.
|
||||
*/
|
||||
if ((natHole == RSNET_NATHOLE_NONE) || (natHole == RSNET_NATHOLE_UNKNOWN))
|
||||
if ((natHole == RsNatHoleMode::NONE) || (natHole == RsNatHoleMode::UNKNOWN))
|
||||
{
|
||||
switch(natType)
|
||||
{
|
||||
@ -1966,7 +1966,7 @@ void p3NetMgrIMPL::updateNetStateBox_reset()
|
||||
|
||||
mNetStateBox.reset();
|
||||
|
||||
mOldNatHole = RSNET_NATHOLE_UNKNOWN;
|
||||
mOldNatHole = RsNatHoleMode::UNKNOWN;
|
||||
mOldNatType = RsNatTypeMode::UNKNOWN;
|
||||
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ virtual bool netAssistStatusUpdate(const RsPeerId &id, int mode) = 0;
|
||||
virtual uint32_t getNetStateMode() = 0;
|
||||
virtual RsNetworkMode getNetworkMode() = 0;
|
||||
virtual RsNatTypeMode getNatTypeMode() = 0;
|
||||
virtual uint32_t getNatHoleMode() = 0;
|
||||
virtual RsNatHoleMode getNatHoleMode() = 0;
|
||||
virtual uint32_t getConnectModes() = 0;
|
||||
|
||||
/* Shut It Down! */
|
||||
@ -157,7 +157,7 @@ virtual bool netAssistStatusUpdate(const RsPeerId &id, int mode);
|
||||
virtual uint32_t getNetStateMode();
|
||||
virtual RsNetworkMode getNetworkMode();
|
||||
virtual RsNatTypeMode getNatTypeMode();
|
||||
virtual uint32_t getNatHoleMode();
|
||||
virtual RsNatHoleMode getNatHoleMode();
|
||||
virtual uint32_t getConnectModes();
|
||||
|
||||
/* Shut It Down! */
|
||||
@ -324,7 +324,7 @@ void netStatusReset_locked();
|
||||
|
||||
rstime_t mDoNotNetCheckUntilTs;
|
||||
RsNatTypeMode mOldNatType;
|
||||
uint32_t mOldNatHole;
|
||||
RsNatHoleMode mOldNatHole;
|
||||
|
||||
RS_SET_CONTEXT_DEBUG_LEVEL(2)
|
||||
};
|
||||
|
@ -158,7 +158,7 @@ RsNatTypeMode pqiNetStateBox::getNatTypeMode()
|
||||
return mNatTypeMode;
|
||||
}
|
||||
|
||||
uint32_t pqiNetStateBox::getNatHoleMode()
|
||||
RsNatHoleMode pqiNetStateBox::getNatHoleMode()
|
||||
{
|
||||
updateNetState();
|
||||
return mNatHoleMode;
|
||||
@ -194,7 +194,7 @@ void pqiNetStateBox::reset()
|
||||
|
||||
mNetworkMode = RsNetworkMode::UNKNOWN;
|
||||
mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||
mNatHoleMode = RSNET_NATHOLE_UNKNOWN;
|
||||
mNatHoleMode = RsNatHoleMode::UNKNOWN;
|
||||
mConnectModes = RSNET_CONNECT_NONE;
|
||||
mNetStateMode = RSNET_NETSTATE_BAD_UNKNOWN;
|
||||
|
||||
@ -304,7 +304,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
mNetworkMode = RsNetworkMode::UNKNOWN;
|
||||
// Assume these.
|
||||
mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||
mNatHoleMode = RSNET_NATHOLE_NONE;
|
||||
mNatHoleMode = RsNatHoleMode::NONE;
|
||||
mNetStateMode = RSNET_NETSTATE_BAD_UNKNOWN;
|
||||
|
||||
//mExtAddress = .... unknown;
|
||||
@ -336,7 +336,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
mNatTypeMode = RsNatTypeMode::DETERM_SYM;
|
||||
mNatHoleMode = RSNET_NATHOLE_NONE;
|
||||
mNatHoleMode = RsNatHoleMode::NONE;
|
||||
mNetStateMode = RSNET_NETSTATE_WARNING_NATTED;
|
||||
|
||||
}
|
||||
@ -345,7 +345,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
/* both unstable, Symmetric NAT, Firewalled, No UDP Hole */
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
mNatTypeMode = RsNatTypeMode::SYMMETRIC;
|
||||
mNatHoleMode = RSNET_NATHOLE_NONE;
|
||||
mNatHoleMode = RsNatHoleMode::NONE;
|
||||
mNetStateMode = RSNET_NETSTATE_BAD_NATSYM;
|
||||
}
|
||||
else
|
||||
@ -367,7 +367,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
mNatTypeMode = RsNatTypeMode::RESTRICTED_CONE;
|
||||
mNatHoleMode = RSNET_NATHOLE_NONE;
|
||||
mNatHoleMode = RsNatHoleMode::NONE;
|
||||
mNetStateMode = RSNET_NETSTATE_WARNING_NATTED;
|
||||
}
|
||||
}
|
||||
@ -393,7 +393,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
/* must be a forwarded port/ext or something similar */
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
mNatTypeMode = RsNatTypeMode::DETERM_SYM;
|
||||
mNatHoleMode = RSNET_NATHOLE_FORWARDED;
|
||||
mNatHoleMode = RsNatHoleMode::FORWARDED;
|
||||
mNetStateMode = RSNET_NETSTATE_GOOD;
|
||||
}
|
||||
else if (!mStunProxyStable)
|
||||
@ -401,7 +401,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
/* must be a forwarded port/ext or something similar */
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
mNatTypeMode = RsNatTypeMode::SYMMETRIC;
|
||||
mNatHoleMode = RSNET_NATHOLE_FORWARDED;
|
||||
mNatHoleMode = RsNatHoleMode::FORWARDED;
|
||||
mNetStateMode = RSNET_NETSTATE_GOOD;
|
||||
}
|
||||
else
|
||||
@ -409,7 +409,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
/* fallback is FULL CONE NAT */
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
mNatTypeMode = RsNatTypeMode::FULL_CONE;
|
||||
mNatHoleMode = RSNET_NATHOLE_NONE;
|
||||
mNatHoleMode = RsNatHoleMode::NONE;
|
||||
mNetStateMode = RSNET_NETSTATE_WARNING_NATTED;
|
||||
}
|
||||
|
||||
@ -419,7 +419,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
// Use Fallback Guess.
|
||||
//mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||
mNatHoleMode = RSNET_NATHOLE_UPNP;
|
||||
mNatHoleMode = RsNatHoleMode::UPNP;
|
||||
mNetStateMode = RSNET_NETSTATE_GOOD;
|
||||
//mExtAddress = ... from UPnP, should match StunDht.
|
||||
//mExtAddrStable = true;
|
||||
@ -430,7 +430,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
// Use Fallback Guess.
|
||||
//mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||
mNatHoleMode = RSNET_NATHOLE_NATPMP;
|
||||
mNatHoleMode = RsNatHoleMode::NATPMP;
|
||||
mNetStateMode = RSNET_NETSTATE_GOOD;
|
||||
//mExtAddress = ... from NatPMP, should match NatPMP
|
||||
//mExtAddrStable = true;
|
||||
@ -443,7 +443,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
{
|
||||
mNetworkMode = RsNetworkMode::EXTERNALIP;
|
||||
mNatTypeMode = RsNatTypeMode::NONE;
|
||||
mNatHoleMode = RSNET_NATHOLE_NONE;
|
||||
mNatHoleMode = RsNatHoleMode::NONE;
|
||||
mNetStateMode = RSNET_NETSTATE_GOOD;
|
||||
|
||||
//mExtAddrStable = true;
|
||||
@ -453,7 +453,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
// Use Fallback Guess.
|
||||
//mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||
mNatHoleMode = RSNET_NATHOLE_FORWARDED;
|
||||
mNatHoleMode = RsNatHoleMode::FORWARDED;
|
||||
mNetStateMode = RSNET_NETSTATE_ADV_FORWARD;
|
||||
|
||||
//mExtAddrStable = true; // Probably, makin assumption.
|
||||
@ -480,7 +480,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
// This Mode is OKAY.
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||
mNatHoleMode = RSNET_NATHOLE_UPNP;
|
||||
mNatHoleMode = RsNatHoleMode::UPNP;
|
||||
//mExtAddress = ... from UPnP.
|
||||
//mExtAddrStable = true;
|
||||
mNetStateMode = RSNET_NETSTATE_WARNING_NODHT;
|
||||
@ -490,7 +490,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
// This Mode is OKAY.
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||
mNatHoleMode = RSNET_NATHOLE_NATPMP;
|
||||
mNatHoleMode = RsNatHoleMode::NATPMP;
|
||||
//mExtAddress = ... from NatPMP.
|
||||
//mExtAddrStable = true;
|
||||
mNetStateMode = RSNET_NETSTATE_WARNING_NODHT;
|
||||
@ -507,7 +507,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
{
|
||||
mNetworkMode = RsNetworkMode::EXTERNALIP;
|
||||
mNatTypeMode = RsNatTypeMode::NONE;
|
||||
mNatHoleMode = RSNET_NATHOLE_NONE;
|
||||
mNatHoleMode = RsNatHoleMode::NONE;
|
||||
|
||||
//mExtAddrStable = true;
|
||||
mNetStateMode = RSNET_NETSTATE_WARNING_NODHT;
|
||||
@ -516,7 +516,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
{
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||
mNatHoleMode = RSNET_NATHOLE_FORWARDED;
|
||||
mNatHoleMode = RsNatHoleMode::FORWARDED;
|
||||
|
||||
//mExtAddrStable = true; // Probably, makin assumption.
|
||||
mNetStateMode = RSNET_NETSTATE_WARNING_NODHT;
|
||||
@ -529,7 +529,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
*/
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||
mNatHoleMode = RSNET_NATHOLE_NONE;
|
||||
mNatHoleMode = RsNatHoleMode::NONE;
|
||||
mNetStateMode = RSNET_NETSTATE_BAD_NODHT_NAT;
|
||||
|
||||
//mExtAddrStable = false; // Unlikely to be stable.
|
||||
@ -581,9 +581,9 @@ void pqiNetStateBox::workoutNetworkMode()
|
||||
mConnectModes = RSNET_CONNECT_OUTGOING_TCP;
|
||||
|
||||
/* we're okay if there's a NAT HOLE */
|
||||
if ((mNatHoleMode == RSNET_NATHOLE_UPNP) ||
|
||||
(mNatHoleMode == RSNET_NATHOLE_NATPMP) ||
|
||||
(mNatHoleMode == RSNET_NATHOLE_FORWARDED))
|
||||
if ((mNatHoleMode == RsNatHoleMode::UPNP) ||
|
||||
(mNatHoleMode == RsNatHoleMode::NATPMP) ||
|
||||
(mNatHoleMode == RsNatHoleMode::FORWARDED))
|
||||
{
|
||||
mConnectModes |= RSNET_CONNECT_ACCEPT_TCP;
|
||||
if (mDhtActive)
|
||||
@ -615,32 +615,6 @@ void pqiNetStateBox::workoutNetworkMode()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string NetStateNatHoleString(uint32_t natHole)
|
||||
{
|
||||
std::string str;
|
||||
switch(natHole)
|
||||
{
|
||||
default:
|
||||
case RSNET_NATHOLE_UNKNOWN:
|
||||
str = "UNKNOWN NAT HOLE STATUS";
|
||||
break;
|
||||
case RSNET_NATHOLE_NONE:
|
||||
str = "NO NAT HOLE";
|
||||
break;
|
||||
case RSNET_NATHOLE_UPNP:
|
||||
str = "UPNP FORWARD";
|
||||
break;
|
||||
case RSNET_NATHOLE_NATPMP:
|
||||
str = "NATPMP FORWARD";
|
||||
break;
|
||||
case RSNET_NATHOLE_FORWARDED:
|
||||
str = "MANUAL FORWARD";
|
||||
break;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
std::string NetStateConnectModesString(uint32_t connect)
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ class pqiNetStateBox
|
||||
uint32_t getNetStateMode();
|
||||
RsNetworkMode getNetworkMode();
|
||||
RsNatTypeMode getNatTypeMode();
|
||||
uint32_t getNatHoleMode();
|
||||
RsNatHoleMode getNatHoleMode();
|
||||
uint32_t getConnectModes();
|
||||
|
||||
private:
|
||||
@ -76,7 +76,7 @@ class pqiNetStateBox
|
||||
|
||||
RsNetworkMode mNetworkMode;
|
||||
RsNatTypeMode mNatTypeMode;
|
||||
uint32_t mNatHoleMode;
|
||||
RsNatHoleMode mNatHoleMode;
|
||||
uint32_t mConnectModes;
|
||||
uint32_t mNetStateMode;
|
||||
|
||||
@ -121,7 +121,6 @@ class pqiNetStateBox
|
||||
|
||||
std::string NetStateNetStateString(uint32_t netstate);
|
||||
std::string NetStateConnectModesString(uint32_t connect);
|
||||
std::string NetStateNatHoleString(uint32_t natHole);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -47,7 +47,6 @@ enum class RsNetworkMode : uint8_t
|
||||
EXTERNALIP = 6
|
||||
};
|
||||
|
||||
|
||||
enum class RsNatTypeMode : uint8_t
|
||||
{
|
||||
NONE = 1,
|
||||
@ -59,12 +58,14 @@ enum class RsNatTypeMode : uint8_t
|
||||
OTHER = 7
|
||||
};
|
||||
|
||||
// WHAT TYPE OF HOLE?
|
||||
#define RSNET_NATHOLE_UNKNOWN 0
|
||||
#define RSNET_NATHOLE_NONE 1
|
||||
#define RSNET_NATHOLE_UPNP 2
|
||||
#define RSNET_NATHOLE_NATPMP 3
|
||||
#define RSNET_NATHOLE_FORWARDED 4
|
||||
enum class RsNatHoleMode : uint8_t
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
NONE = 1,
|
||||
UPNP = 2,
|
||||
NATPMP = 3,
|
||||
FORWARDED = 4
|
||||
};
|
||||
|
||||
// Types of Connections.
|
||||
#define RSNET_CONNECT_NONE 0x0000
|
||||
@ -359,7 +360,7 @@ public:
|
||||
virtual uint32_t getNetState() = 0;
|
||||
virtual RsNetworkMode getNetworkMode() = 0;
|
||||
virtual RsNatTypeMode getNatTypeMode() = 0;
|
||||
virtual uint32_t getNatHoleMode() = 0;
|
||||
virtual RsNatHoleMode getNatHoleMode() = 0;
|
||||
virtual uint32_t getConnectModes() = 0;
|
||||
|
||||
virtual bool getConfigurationOption(uint32_t key, std::string &opt) = 0;
|
||||
|
@ -306,13 +306,13 @@ uint32_t p3ServerConfig::getUserLevel()
|
||||
/* check that the firewall is open */
|
||||
|
||||
RsNetworkMode netMode = mNetMgr->getNetworkMode();
|
||||
uint32_t firewallMode = mNetMgr->getNatHoleMode();
|
||||
RsNatHoleMode firewallMode = mNetMgr->getNatHoleMode();
|
||||
|
||||
if ((RsNetworkMode::EXTERNALIP == netMode) ||
|
||||
((RsNetworkMode::BEHINDNAT == netMode) &&
|
||||
((RSNET_NATHOLE_UPNP == firewallMode) ||
|
||||
(RSNET_NATHOLE_NATPMP == firewallMode) ||
|
||||
(RSNET_NATHOLE_FORWARDED == firewallMode))))
|
||||
(RsNatHoleMode::UPNP == firewallMode ||
|
||||
(RsNatHoleMode::NATPMP == firewallMode) ||
|
||||
(RsNatHoleMode::FORWARDED == firewallMode))))
|
||||
{
|
||||
userLevel = RSCONFIG_USER_LEVEL_POWER;
|
||||
}
|
||||
@ -344,7 +344,7 @@ RsNatTypeMode p3ServerConfig::getNatTypeMode()
|
||||
return mNetMgr->getNatTypeMode();
|
||||
}
|
||||
|
||||
uint32_t p3ServerConfig::getNatHoleMode()
|
||||
RsNatHoleMode p3ServerConfig::getNatHoleMode()
|
||||
{
|
||||
return mNetMgr->getNatHoleMode();
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ virtual uint32_t getUserLevel();
|
||||
virtual uint32_t getNetState();
|
||||
virtual RsNetworkMode getNetworkMode();
|
||||
virtual RsNatTypeMode getNatTypeMode();
|
||||
virtual uint32_t getNatHoleMode();
|
||||
virtual RsNatHoleMode getNatHoleMode();
|
||||
virtual uint32_t getConnectModes();
|
||||
|
||||
virtual bool getConfigurationOption(uint32_t key, std::string &opt);
|
||||
|
@ -164,28 +164,28 @@ void DhtWindow::updateNetStatus()
|
||||
|
||||
label = ui.natTypeLabel;
|
||||
|
||||
uint32_t natType = rsConfig->getNatTypeMode();
|
||||
RsNatTypeMode natType = rsConfig->getNatTypeMode();
|
||||
switch(natType)
|
||||
{
|
||||
case RSNET_NATTYPE_UNKNOWN:
|
||||
case RsNatTypeMode::UNKNOWN:
|
||||
label->setText(tr("UNKNOWN NAT STATE"));
|
||||
break;
|
||||
case RSNET_NATTYPE_SYMMETRIC:
|
||||
case RsNatTypeMode::SYMMETRIC:
|
||||
label->setText(tr("SYMMETRIC NAT"));
|
||||
break;
|
||||
case RSNET_NATTYPE_DETERM_SYM:
|
||||
case RsNatTypeMode::DETERM_SYM:
|
||||
label->setText(tr("DETERMINISTIC SYM NAT"));
|
||||
break;
|
||||
case RSNET_NATTYPE_RESTRICTED_CONE:
|
||||
case RsNatTypeMode::RESTRICTED_CONE:
|
||||
label->setText(tr("RESTRICTED CONE NAT"));
|
||||
break;
|
||||
case RSNET_NATTYPE_FULL_CONE:
|
||||
case RsNatTypeMode::FULL_CONE:
|
||||
label->setText(tr("FULL CONE NAT"));
|
||||
break;
|
||||
case RSNET_NATTYPE_OTHER:
|
||||
case RsNatTypeMode::OTHER:
|
||||
label->setText(tr("OTHER NAT"));
|
||||
break;
|
||||
case RSNET_NATTYPE_NONE:
|
||||
case RsNatTypeMode::NONE:
|
||||
label->setText(tr("NO NAT"));
|
||||
break;
|
||||
}
|
||||
@ -193,23 +193,23 @@ void DhtWindow::updateNetStatus()
|
||||
|
||||
|
||||
label = ui.natHoleLabel;
|
||||
uint32_t natHole = rsConfig->getNatHoleMode();
|
||||
RsNatHoleMode natHole = rsConfig->getNatHoleMode();
|
||||
|
||||
switch(natHole)
|
||||
{
|
||||
case RSNET_NATHOLE_UNKNOWN:
|
||||
case RsNatHoleMode::UNKNOWN:
|
||||
label->setText(tr("UNKNOWN NAT HOLE STATUS"));
|
||||
break;
|
||||
case RSNET_NATHOLE_NONE:
|
||||
case RsNatHoleMode::NONE:
|
||||
label->setText(tr("NO NAT HOLE"));
|
||||
break;
|
||||
case RSNET_NATHOLE_UPNP:
|
||||
case RsNatHoleMode::UPNP:
|
||||
label->setText(tr("UPNP FORWARD"));
|
||||
break;
|
||||
case RSNET_NATHOLE_NATPMP:
|
||||
case RsNatHoleMode::NATPMP:
|
||||
label->setText(tr("NATPMP FORWARD"));
|
||||
break;
|
||||
case RSNET_NATHOLE_FORWARDED:
|
||||
case RsNatHoleMode::FORWARDED:
|
||||
label->setText(tr("MANUAL FORWARD"));
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user