mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-26 23:36:59 -05:00
convert RSNET_NETSTATE to enum class
This commit is contained in:
parent
acda7b8cc4
commit
3f5dcecc4d
@ -1627,7 +1627,7 @@ void p3NetMgrIMPL::setIPServersEnabled(bool b)
|
|||||||
************************************** NetStateBox ******************************************
|
************************************** NetStateBox ******************************************
|
||||||
**********************************************************************************************/
|
**********************************************************************************************/
|
||||||
|
|
||||||
uint32_t p3NetMgrIMPL::getNetStateMode()
|
RsNetState p3NetMgrIMPL::getNetStateMode()
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mNetMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mNetMtx); /****** STACK LOCK MUTEX *******/
|
||||||
return mNetStateBox.getNetStateMode();
|
return mNetStateBox.getNetStateMode();
|
||||||
|
@ -103,7 +103,7 @@ virtual bool netAssistBadPeer(const struct sockaddr_storage &addr, uint32_t reas
|
|||||||
virtual bool netAssistStatusUpdate(const RsPeerId &id, int mode) = 0;
|
virtual bool netAssistStatusUpdate(const RsPeerId &id, int mode) = 0;
|
||||||
|
|
||||||
/* Get Network State */
|
/* Get Network State */
|
||||||
virtual uint32_t getNetStateMode() = 0;
|
virtual RsNetState getNetStateMode() = 0;
|
||||||
virtual RsNetworkMode getNetworkMode() = 0;
|
virtual RsNetworkMode getNetworkMode() = 0;
|
||||||
virtual RsNatTypeMode getNatTypeMode() = 0;
|
virtual RsNatTypeMode getNatTypeMode() = 0;
|
||||||
virtual RsNatHoleMode getNatHoleMode() = 0;
|
virtual RsNatHoleMode getNatHoleMode() = 0;
|
||||||
@ -154,7 +154,7 @@ virtual bool netAssistBadPeer(const struct sockaddr_storage &addr, uint32_t reas
|
|||||||
virtual bool netAssistStatusUpdate(const RsPeerId &id, int mode);
|
virtual bool netAssistStatusUpdate(const RsPeerId &id, int mode);
|
||||||
|
|
||||||
/* Get Network State */
|
/* Get Network State */
|
||||||
virtual uint32_t getNetStateMode();
|
virtual RsNetState getNetStateMode();
|
||||||
virtual RsNetworkMode getNetworkMode();
|
virtual RsNetworkMode getNetworkMode();
|
||||||
virtual RsNatTypeMode getNatTypeMode();
|
virtual RsNatTypeMode getNatTypeMode();
|
||||||
virtual RsNatHoleMode getNatHoleMode();
|
virtual RsNatHoleMode getNatHoleMode();
|
||||||
|
@ -171,7 +171,7 @@ RsConnectModes pqiNetStateBox::getConnectModes()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t pqiNetStateBox::getNetStateMode()
|
RsNetState pqiNetStateBox::getNetStateMode()
|
||||||
{
|
{
|
||||||
updateNetState();
|
updateNetState();
|
||||||
return mNetStateMode;
|
return mNetStateMode;
|
||||||
@ -196,7 +196,7 @@ void pqiNetStateBox::reset()
|
|||||||
mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||||
mNatHoleMode = RsNatHoleMode::UNKNOWN;
|
mNatHoleMode = RsNatHoleMode::UNKNOWN;
|
||||||
mConnectModes = RsConnectModes::NONE;
|
mConnectModes = RsConnectModes::NONE;
|
||||||
mNetStateMode = RSNET_NETSTATE_BAD_UNKNOWN;
|
mNetStateMode = RsNetState::BAD_UNKNOWN;
|
||||||
|
|
||||||
/* Parameters set externally */
|
/* Parameters set externally */
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ void pqiNetStateBox::determineNetworkState()
|
|||||||
// Assume these.
|
// Assume these.
|
||||||
mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||||
mNatHoleMode = RsNatHoleMode::NONE;
|
mNatHoleMode = RsNatHoleMode::NONE;
|
||||||
mNetStateMode = RSNET_NETSTATE_BAD_UNKNOWN;
|
mNetStateMode = RsNetState::BAD_UNKNOWN;
|
||||||
|
|
||||||
//mExtAddress = .... unknown;
|
//mExtAddress = .... unknown;
|
||||||
//mExtAddrStable = false;
|
//mExtAddrStable = false;
|
||||||
@ -337,7 +337,7 @@ void pqiNetStateBox::determineNetworkState()
|
|||||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||||
mNatTypeMode = RsNatTypeMode::DETERM_SYM;
|
mNatTypeMode = RsNatTypeMode::DETERM_SYM;
|
||||||
mNatHoleMode = RsNatHoleMode::NONE;
|
mNatHoleMode = RsNatHoleMode::NONE;
|
||||||
mNetStateMode = RSNET_NETSTATE_WARNING_NATTED;
|
mNetStateMode = RsNetState::WARNING_NATTED;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!mStunProxyStable)
|
else if (!mStunProxyStable)
|
||||||
@ -346,7 +346,7 @@ void pqiNetStateBox::determineNetworkState()
|
|||||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||||
mNatTypeMode = RsNatTypeMode::SYMMETRIC;
|
mNatTypeMode = RsNatTypeMode::SYMMETRIC;
|
||||||
mNatHoleMode = RsNatHoleMode::NONE;
|
mNatHoleMode = RsNatHoleMode::NONE;
|
||||||
mNetStateMode = RSNET_NETSTATE_BAD_NATSYM;
|
mNetStateMode = RsNetState::BAD_NATSYM;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -368,7 +368,7 @@ void pqiNetStateBox::determineNetworkState()
|
|||||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||||
mNatTypeMode = RsNatTypeMode::RESTRICTED_CONE;
|
mNatTypeMode = RsNatTypeMode::RESTRICTED_CONE;
|
||||||
mNatHoleMode = RsNatHoleMode::NONE;
|
mNatHoleMode = RsNatHoleMode::NONE;
|
||||||
mNetStateMode = RSNET_NETSTATE_WARNING_NATTED;
|
mNetStateMode = RsNetState::WARNING_NATTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // Dht Stable.
|
else // Dht Stable.
|
||||||
@ -394,7 +394,7 @@ void pqiNetStateBox::determineNetworkState()
|
|||||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||||
mNatTypeMode = RsNatTypeMode::DETERM_SYM;
|
mNatTypeMode = RsNatTypeMode::DETERM_SYM;
|
||||||
mNatHoleMode = RsNatHoleMode::FORWARDED;
|
mNatHoleMode = RsNatHoleMode::FORWARDED;
|
||||||
mNetStateMode = RSNET_NETSTATE_GOOD;
|
mNetStateMode = RsNetState::GOOD;
|
||||||
}
|
}
|
||||||
else if (!mStunProxyStable)
|
else if (!mStunProxyStable)
|
||||||
{
|
{
|
||||||
@ -402,7 +402,7 @@ void pqiNetStateBox::determineNetworkState()
|
|||||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||||
mNatTypeMode = RsNatTypeMode::SYMMETRIC;
|
mNatTypeMode = RsNatTypeMode::SYMMETRIC;
|
||||||
mNatHoleMode = RsNatHoleMode::FORWARDED;
|
mNatHoleMode = RsNatHoleMode::FORWARDED;
|
||||||
mNetStateMode = RSNET_NETSTATE_GOOD;
|
mNetStateMode = RsNetState::GOOD;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -410,7 +410,7 @@ void pqiNetStateBox::determineNetworkState()
|
|||||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||||
mNatTypeMode = RsNatTypeMode::FULL_CONE;
|
mNatTypeMode = RsNatTypeMode::FULL_CONE;
|
||||||
mNatHoleMode = RsNatHoleMode::NONE;
|
mNatHoleMode = RsNatHoleMode::NONE;
|
||||||
mNetStateMode = RSNET_NETSTATE_WARNING_NATTED;
|
mNetStateMode = RsNetState::WARNING_NATTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mUPnPActive)
|
if (mUPnPActive)
|
||||||
@ -420,7 +420,7 @@ void pqiNetStateBox::determineNetworkState()
|
|||||||
// Use Fallback Guess.
|
// Use Fallback Guess.
|
||||||
//mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
//mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||||
mNatHoleMode = RsNatHoleMode::UPNP;
|
mNatHoleMode = RsNatHoleMode::UPNP;
|
||||||
mNetStateMode = RSNET_NETSTATE_GOOD;
|
mNetStateMode = RsNetState::GOOD;
|
||||||
//mExtAddress = ... from UPnP, should match StunDht.
|
//mExtAddress = ... from UPnP, should match StunDht.
|
||||||
//mExtAddrStable = true;
|
//mExtAddrStable = true;
|
||||||
}
|
}
|
||||||
@ -431,7 +431,7 @@ void pqiNetStateBox::determineNetworkState()
|
|||||||
// Use Fallback Guess.
|
// Use Fallback Guess.
|
||||||
//mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
//mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||||
mNatHoleMode = RsNatHoleMode::NATPMP;
|
mNatHoleMode = RsNatHoleMode::NATPMP;
|
||||||
mNetStateMode = RSNET_NETSTATE_GOOD;
|
mNetStateMode = RsNetState::GOOD;
|
||||||
//mExtAddress = ... from NatPMP, should match NatPMP
|
//mExtAddress = ... from NatPMP, should match NatPMP
|
||||||
//mExtAddrStable = true;
|
//mExtAddrStable = true;
|
||||||
}
|
}
|
||||||
@ -444,7 +444,7 @@ void pqiNetStateBox::determineNetworkState()
|
|||||||
mNetworkMode = RsNetworkMode::EXTERNALIP;
|
mNetworkMode = RsNetworkMode::EXTERNALIP;
|
||||||
mNatTypeMode = RsNatTypeMode::NONE;
|
mNatTypeMode = RsNatTypeMode::NONE;
|
||||||
mNatHoleMode = RsNatHoleMode::NONE;
|
mNatHoleMode = RsNatHoleMode::NONE;
|
||||||
mNetStateMode = RSNET_NETSTATE_GOOD;
|
mNetStateMode = RsNetState::GOOD;
|
||||||
|
|
||||||
//mExtAddrStable = true;
|
//mExtAddrStable = true;
|
||||||
}
|
}
|
||||||
@ -454,7 +454,7 @@ void pqiNetStateBox::determineNetworkState()
|
|||||||
// Use Fallback Guess.
|
// Use Fallback Guess.
|
||||||
//mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
//mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||||
mNatHoleMode = RsNatHoleMode::FORWARDED;
|
mNatHoleMode = RsNatHoleMode::FORWARDED;
|
||||||
mNetStateMode = RSNET_NETSTATE_ADV_FORWARD;
|
mNetStateMode = RsNetState::ADV_FORWARD;
|
||||||
|
|
||||||
//mExtAddrStable = true; // Probably, makin assumption.
|
//mExtAddrStable = true; // Probably, makin assumption.
|
||||||
}
|
}
|
||||||
@ -483,7 +483,7 @@ void pqiNetStateBox::determineNetworkState()
|
|||||||
mNatHoleMode = RsNatHoleMode::UPNP;
|
mNatHoleMode = RsNatHoleMode::UPNP;
|
||||||
//mExtAddress = ... from UPnP.
|
//mExtAddress = ... from UPnP.
|
||||||
//mExtAddrStable = true;
|
//mExtAddrStable = true;
|
||||||
mNetStateMode = RSNET_NETSTATE_WARNING_NODHT;
|
mNetStateMode = RsNetState::WARNING_NODHT;
|
||||||
}
|
}
|
||||||
else if (mNatPMPActive)
|
else if (mNatPMPActive)
|
||||||
{
|
{
|
||||||
@ -493,7 +493,7 @@ void pqiNetStateBox::determineNetworkState()
|
|||||||
mNatHoleMode = RsNatHoleMode::NATPMP;
|
mNatHoleMode = RsNatHoleMode::NATPMP;
|
||||||
//mExtAddress = ... from NatPMP.
|
//mExtAddress = ... from NatPMP.
|
||||||
//mExtAddrStable = true;
|
//mExtAddrStable = true;
|
||||||
mNetStateMode = RSNET_NETSTATE_WARNING_NODHT;
|
mNetStateMode = RsNetState::WARNING_NODHT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -510,7 +510,7 @@ void pqiNetStateBox::determineNetworkState()
|
|||||||
mNatHoleMode = RsNatHoleMode::NONE;
|
mNatHoleMode = RsNatHoleMode::NONE;
|
||||||
|
|
||||||
//mExtAddrStable = true;
|
//mExtAddrStable = true;
|
||||||
mNetStateMode = RSNET_NETSTATE_WARNING_NODHT;
|
mNetStateMode = RsNetState::WARNING_NODHT;
|
||||||
}
|
}
|
||||||
else if (mPortForwardSet)
|
else if (mPortForwardSet)
|
||||||
{
|
{
|
||||||
@ -519,7 +519,7 @@ void pqiNetStateBox::determineNetworkState()
|
|||||||
mNatHoleMode = RsNatHoleMode::FORWARDED;
|
mNatHoleMode = RsNatHoleMode::FORWARDED;
|
||||||
|
|
||||||
//mExtAddrStable = true; // Probably, makin assumption.
|
//mExtAddrStable = true; // Probably, makin assumption.
|
||||||
mNetStateMode = RSNET_NETSTATE_WARNING_NODHT;
|
mNetStateMode = RsNetState::WARNING_NODHT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -530,7 +530,7 @@ void pqiNetStateBox::determineNetworkState()
|
|||||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||||
mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||||
mNatHoleMode = RsNatHoleMode::NONE;
|
mNatHoleMode = RsNatHoleMode::NONE;
|
||||||
mNetStateMode = RSNET_NETSTATE_BAD_NODHT_NAT;
|
mNetStateMode = RsNetState::BAD_NODHT_NAT;
|
||||||
|
|
||||||
//mExtAddrStable = false; // Unlikely to be stable.
|
//mExtAddrStable = false; // Unlikely to be stable.
|
||||||
}
|
}
|
||||||
@ -614,48 +614,3 @@ void pqiNetStateBox::workoutNetworkMode()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string NetStateNetStateString(uint32_t netstate)
|
|
||||||
{
|
|
||||||
std::string str;
|
|
||||||
switch(netstate)
|
|
||||||
{
|
|
||||||
case RSNET_NETSTATE_BAD_UNKNOWN:
|
|
||||||
str = "NET BAD: Unknown State";
|
|
||||||
break;
|
|
||||||
case RSNET_NETSTATE_BAD_OFFLINE:
|
|
||||||
str = "NET BAD: Offline";
|
|
||||||
break;
|
|
||||||
case RSNET_NETSTATE_BAD_NATSYM:
|
|
||||||
str = "NET BAD: Behind Symmetric NAT";
|
|
||||||
break;
|
|
||||||
case RSNET_NETSTATE_BAD_NODHT_NAT:
|
|
||||||
str = "NET BAD: Behind NAT & No DHT";
|
|
||||||
break;
|
|
||||||
case RSNET_NETSTATE_WARNING_RESTART:
|
|
||||||
str = "NET WARNING: NET Restart";
|
|
||||||
break;
|
|
||||||
case RSNET_NETSTATE_WARNING_NATTED:
|
|
||||||
str = "NET WARNING: Behind NAT";
|
|
||||||
break;
|
|
||||||
case RSNET_NETSTATE_WARNING_NODHT:
|
|
||||||
str = "NET WARNING: No DHT";
|
|
||||||
break;
|
|
||||||
case RSNET_NETSTATE_GOOD:
|
|
||||||
str = "NET STATE GOOD!";
|
|
||||||
break;
|
|
||||||
case RSNET_NETSTATE_ADV_FORWARD:
|
|
||||||
str = "CAUTION: UNVERIFABLE FORWARD!";
|
|
||||||
break;
|
|
||||||
case RSNET_NETSTATE_ADV_DARK_FORWARD:
|
|
||||||
str = "CAUTION: UNVERIFABLE FORWARD & NO DHT";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class pqiNetStateBox
|
|||||||
|
|
||||||
void setDhtState(bool dhtOn, bool dhtActive);
|
void setDhtState(bool dhtOn, bool dhtActive);
|
||||||
|
|
||||||
uint32_t getNetStateMode();
|
RsNetState getNetStateMode();
|
||||||
RsNetworkMode getNetworkMode();
|
RsNetworkMode getNetworkMode();
|
||||||
RsNatTypeMode getNatTypeMode();
|
RsNatTypeMode getNatTypeMode();
|
||||||
RsNatHoleMode getNatHoleMode();
|
RsNatHoleMode getNatHoleMode();
|
||||||
@ -78,7 +78,7 @@ class pqiNetStateBox
|
|||||||
RsNatTypeMode mNatTypeMode;
|
RsNatTypeMode mNatTypeMode;
|
||||||
RsNatHoleMode mNatHoleMode;
|
RsNatHoleMode mNatHoleMode;
|
||||||
RsConnectModes mConnectModes;
|
RsConnectModes mConnectModes;
|
||||||
uint32_t mNetStateMode;
|
RsNetState mNetStateMode;
|
||||||
|
|
||||||
/* Parameters set externally */
|
/* Parameters set externally */
|
||||||
|
|
||||||
@ -117,8 +117,4 @@ class pqiNetStateBox
|
|||||||
uint16_t mPortForwarded;
|
uint16_t mPortForwarded;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::string NetStateNetStateString(uint32_t netstate);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -78,27 +78,28 @@ enum class RsConnectModes : uint16_t
|
|||||||
};
|
};
|
||||||
RS_REGISTER_ENUM_FLAGS_TYPE(RsConnectModes)
|
RS_REGISTER_ENUM_FLAGS_TYPE(RsConnectModes)
|
||||||
|
|
||||||
// net state (good, okay, bad)
|
enum class RsNetState : uint8_t
|
||||||
// BAD. (RED)
|
{
|
||||||
#define RSNET_NETSTATE_BAD_UNKNOWN 1
|
// BAD. (RED)
|
||||||
#define RSNET_NETSTATE_BAD_OFFLINE 2
|
BAD_UNKNOWN = 1,
|
||||||
#define RSNET_NETSTATE_BAD_NATSYM 3
|
BAD_OFFLINE = 2,
|
||||||
#define RSNET_NETSTATE_BAD_NODHT_NAT 4
|
BAD_NATSYM = 3,
|
||||||
|
BAD_NODHT_NAT = 4,
|
||||||
|
|
||||||
// CAUTION. (ORANGE)
|
// CAUTION. (ORANGE)
|
||||||
#define RSNET_NETSTATE_WARNING_RESTART 5
|
WARNING_RESTART = 5,
|
||||||
#define RSNET_NETSTATE_WARNING_NATTED 6
|
WARNING_NATTED = 6,
|
||||||
#define RSNET_NETSTATE_WARNING_NODHT 7
|
WARNING_NODHT = 7,
|
||||||
|
|
||||||
// GOOD (GREEN)
|
// GOOD (GREEN)
|
||||||
// NAT with forwarded port, or EXT port.
|
// NAT with forwarded port, or EXT port.
|
||||||
#define RSNET_NETSTATE_GOOD 8
|
GOOD = 8,
|
||||||
|
|
||||||
// ADVANCED MODE (BLUE)
|
|
||||||
// If the user knows what they are doing... we cannot confirm this.
|
|
||||||
#define RSNET_NETSTATE_ADV_FORWARD 9
|
|
||||||
#define RSNET_NETSTATE_ADV_DARK_FORWARD 10
|
|
||||||
|
|
||||||
|
// ADVANCED MODE (BLUE)
|
||||||
|
// If the user knows what they are doing... we cannot confirm this.
|
||||||
|
ADV_FORWARD = 9,
|
||||||
|
ADV_DARK_FORWARD= 10
|
||||||
|
};
|
||||||
|
|
||||||
/* matched to the uPnP states */
|
/* matched to the uPnP states */
|
||||||
#define UPNP_STATE_UNINITIALISED 0
|
#define UPNP_STATE_UNINITIALISED 0
|
||||||
@ -360,7 +361,7 @@ public:
|
|||||||
|
|
||||||
virtual uint32_t getUserLevel() = 0;
|
virtual uint32_t getUserLevel() = 0;
|
||||||
|
|
||||||
virtual uint32_t getNetState() = 0;
|
virtual RsNetState getNetState() = 0;
|
||||||
virtual RsNetworkMode getNetworkMode() = 0;
|
virtual RsNetworkMode getNetworkMode() = 0;
|
||||||
virtual RsNatTypeMode getNatTypeMode() = 0;
|
virtual RsNatTypeMode getNatTypeMode() = 0;
|
||||||
virtual RsNatHoleMode getNatHoleMode() = 0;
|
virtual RsNatHoleMode getNatHoleMode() = 0;
|
||||||
|
@ -329,7 +329,7 @@ uint32_t p3ServerConfig::getUserLevel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t p3ServerConfig::getNetState()
|
RsNetState p3ServerConfig::getNetState()
|
||||||
{
|
{
|
||||||
return mNetMgr->getNetStateMode();
|
return mNetMgr->getNetStateMode();
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ virtual std::string getRetroshareDataDirectory();
|
|||||||
|
|
||||||
virtual uint32_t getUserLevel();
|
virtual uint32_t getUserLevel();
|
||||||
|
|
||||||
virtual uint32_t getNetState();
|
virtual RsNetState getNetState();
|
||||||
virtual RsNetworkMode getNetworkMode();
|
virtual RsNetworkMode getNetworkMode();
|
||||||
virtual RsNatTypeMode getNatTypeMode();
|
virtual RsNatTypeMode getNatTypeMode();
|
||||||
virtual RsNatHoleMode getNatHoleMode();
|
virtual RsNatHoleMode getNatHoleMode();
|
||||||
|
@ -281,39 +281,39 @@ void ConnectProgressDialog::stopAndClose()
|
|||||||
|
|
||||||
void ConnectProgressDialog::updateNetworkStatus()
|
void ConnectProgressDialog::updateNetworkStatus()
|
||||||
{
|
{
|
||||||
uint32_t netState = rsConfig->getNetState();
|
RsNetState netState = rsConfig->getNetState();
|
||||||
|
|
||||||
QLabel *label = ui->NetResult;
|
QLabel *label = ui->NetResult;
|
||||||
switch(netState)
|
switch(netState)
|
||||||
{
|
{
|
||||||
case RSNET_NETSTATE_BAD_UNKNOWN:
|
case RsNetState::BAD_UNKNOWN:
|
||||||
label->setText(tr("Unknown State"));
|
label->setText(tr("Unknown State"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_BAD_OFFLINE:
|
case RsNetState::BAD_OFFLINE:
|
||||||
label->setText(tr("Offline"));
|
label->setText(tr("Offline"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_BAD_NATSYM:
|
case RsNetState::BAD_NATSYM:
|
||||||
label->setText(tr("Behind Symmetric NAT"));
|
label->setText(tr("Behind Symmetric NAT"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_BAD_NODHT_NAT:
|
case RsNetState::BAD_NODHT_NAT:
|
||||||
label->setText(tr("Behind NAT & No DHT"));
|
label->setText(tr("Behind NAT & No DHT"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_WARNING_RESTART:
|
case RsNetState::WARNING_RESTART:
|
||||||
label->setText(tr("NET Restart"));
|
label->setText(tr("NET Restart"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_WARNING_NATTED:
|
case RsNetState::WARNING_NATTED:
|
||||||
label->setText(tr("Behind NAT"));
|
label->setText(tr("Behind NAT"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_WARNING_NODHT:
|
case RsNetState::WARNING_NODHT:
|
||||||
label->setText(tr("No DHT"));
|
label->setText(tr("No DHT"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_GOOD:
|
case RsNetState::GOOD:
|
||||||
label->setText(tr("NET STATE GOOD!"));
|
label->setText(tr("NET STATE GOOD!"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_ADV_FORWARD:
|
case RsNetState::ADV_FORWARD:
|
||||||
label->setText(tr("UNVERIFIABLE FORWARD!"));
|
label->setText(tr("UNVERIFIABLE FORWARD!"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_ADV_DARK_FORWARD:
|
case RsNetState::ADV_DARK_FORWARD:
|
||||||
label->setText(tr("UNVERIFIABLE FORWARD & NO DHT"));
|
label->setText(tr("UNVERIFIABLE FORWARD & NO DHT"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -241,39 +241,39 @@ void DhtWindow::updateNetStatus()
|
|||||||
|
|
||||||
label->setText(connOut);
|
label->setText(connOut);
|
||||||
|
|
||||||
uint32_t netState = rsConfig->getNetState();
|
RsNetState netState = rsConfig->getNetState();
|
||||||
|
|
||||||
label = ui.netStatusLabel;
|
label = ui.netStatusLabel;
|
||||||
switch(netState)
|
switch(netState)
|
||||||
{
|
{
|
||||||
case RSNET_NETSTATE_BAD_UNKNOWN:
|
case RsNetState::BAD_UNKNOWN:
|
||||||
label->setText(tr("NET BAD: Unknown State"));
|
label->setText(tr("NET BAD: Unknown State"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_BAD_OFFLINE:
|
case RsNetState::BAD_OFFLINE:
|
||||||
label->setText(tr("NET BAD: Offline"));
|
label->setText(tr("NET BAD: Offline"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_BAD_NATSYM:
|
case RsNetState::BAD_NATSYM:
|
||||||
label->setText(tr("NET BAD: Behind Symmetric NAT"));
|
label->setText(tr("NET BAD: Behind Symmetric NAT"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_BAD_NODHT_NAT:
|
case RsNetState::BAD_NODHT_NAT:
|
||||||
label->setText(tr("NET BAD: Behind NAT & No DHT"));
|
label->setText(tr("NET BAD: Behind NAT & No DHT"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_WARNING_RESTART:
|
case RsNetState::WARNING_RESTART:
|
||||||
label->setText(tr("NET WARNING: NET Restart"));
|
label->setText(tr("NET WARNING: NET Restart"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_WARNING_NATTED:
|
case RsNetState::WARNING_NATTED:
|
||||||
label->setText(tr("NET WARNING: Behind NAT"));
|
label->setText(tr("NET WARNING: Behind NAT"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_WARNING_NODHT:
|
case RsNetState::WARNING_NODHT:
|
||||||
label->setText(tr("NET WARNING: No DHT"));
|
label->setText(tr("NET WARNING: No DHT"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_GOOD:
|
case RsNetState::GOOD:
|
||||||
label->setText(tr("NET STATE GOOD!"));
|
label->setText(tr("NET STATE GOOD!"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_ADV_FORWARD:
|
case RsNetState::ADV_FORWARD:
|
||||||
label->setText(tr("CAUTION: UNVERIFIABLE FORWARD!"));
|
label->setText(tr("CAUTION: UNVERIFIABLE FORWARD!"));
|
||||||
break;
|
break;
|
||||||
case RSNET_NETSTATE_ADV_DARK_FORWARD:
|
case RsNetState::ADV_DARK_FORWARD:
|
||||||
label->setText(tr("CAUTION: UNVERIFIABLE FORWARD & NO DHT"));
|
label->setText(tr("CAUTION: UNVERIFIABLE FORWARD & NO DHT"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ NATStatus::NATStatus(QWidget *parent)
|
|||||||
|
|
||||||
void NATStatus::getNATStatus()
|
void NATStatus::getNATStatus()
|
||||||
{
|
{
|
||||||
uint32_t netState = rsConfig -> getNetState();
|
RsNetState netState = rsConfig -> getNetState();
|
||||||
|
|
||||||
statusNAT->setVisible(!_compactMode);
|
statusNAT->setVisible(!_compactMode);
|
||||||
QString text = _compactMode?statusNAT->text():"";
|
QString text = _compactMode?statusNAT->text():"";
|
||||||
@ -60,14 +60,14 @@ void NATStatus::getNATStatus()
|
|||||||
switch(netState)
|
switch(netState)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case RSNET_NETSTATE_BAD_UNKNOWN:
|
case RsNetState::BAD_UNKNOWN:
|
||||||
{
|
{
|
||||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_yellow_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
iconLabel->setPixmap(QPixmap(":/icons/bullet_yellow_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||||
iconLabel->setToolTip( text + tr("Network Status Unknown")) ;
|
iconLabel->setToolTip( text + tr("Network Status Unknown")) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case RSNET_NETSTATE_BAD_OFFLINE:
|
case RsNetState::BAD_OFFLINE:
|
||||||
{
|
{
|
||||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_grey_129.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
iconLabel->setPixmap(QPixmap(":/icons/bullet_grey_129.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||||
iconLabel->setToolTip( text + tr("Offline")) ;
|
iconLabel->setToolTip( text + tr("Offline")) ;
|
||||||
@ -75,14 +75,14 @@ void NATStatus::getNATStatus()
|
|||||||
break ;
|
break ;
|
||||||
|
|
||||||
// BAD. (RED)
|
// BAD. (RED)
|
||||||
case RSNET_NETSTATE_BAD_NATSYM:
|
case RsNetState::BAD_NATSYM:
|
||||||
{
|
{
|
||||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_red_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
iconLabel->setPixmap(QPixmap(":/icons/bullet_red_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||||
iconLabel->setToolTip( text + tr("Nasty Firewall")) ;
|
iconLabel->setToolTip( text + tr("Nasty Firewall")) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case RSNET_NETSTATE_BAD_NODHT_NAT:
|
case RsNetState::BAD_NODHT_NAT:
|
||||||
{
|
{
|
||||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_red_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
iconLabel->setPixmap(QPixmap(":/icons/bullet_red_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||||
iconLabel->setToolTip( text + tr("DHT Disabled and Firewalled")) ;
|
iconLabel->setToolTip( text + tr("DHT Disabled and Firewalled")) ;
|
||||||
@ -90,21 +90,21 @@ void NATStatus::getNATStatus()
|
|||||||
break ;
|
break ;
|
||||||
|
|
||||||
// CAUTION. (ORANGE)
|
// CAUTION. (ORANGE)
|
||||||
case RSNET_NETSTATE_WARNING_RESTART:
|
case RsNetState::WARNING_RESTART:
|
||||||
{
|
{
|
||||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_yellow_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
iconLabel->setPixmap(QPixmap(":/icons/bullet_yellow_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||||
iconLabel->setToolTip( text + tr("Network Restarting")) ;
|
iconLabel->setToolTip( text + tr("Network Restarting")) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case RSNET_NETSTATE_WARNING_NATTED:
|
case RsNetState::WARNING_NATTED:
|
||||||
{
|
{
|
||||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_yellow_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
iconLabel->setPixmap(QPixmap(":/icons/bullet_yellow_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||||
iconLabel->setToolTip( text + tr("Behind Firewall")) ;
|
iconLabel->setToolTip( text + tr("Behind Firewall")) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case RSNET_NETSTATE_WARNING_NODHT:
|
case RsNetState::WARNING_NODHT:
|
||||||
{
|
{
|
||||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_yellow_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
iconLabel->setPixmap(QPixmap(":/icons/bullet_yellow_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||||
iconLabel->setToolTip( text + tr("DHT Disabled")) ;
|
iconLabel->setToolTip( text + tr("DHT Disabled")) ;
|
||||||
@ -112,14 +112,14 @@ void NATStatus::getNATStatus()
|
|||||||
break ;
|
break ;
|
||||||
|
|
||||||
// GOOD (GREEN)
|
// GOOD (GREEN)
|
||||||
case RSNET_NETSTATE_GOOD:
|
case RsNetState::GOOD:
|
||||||
{
|
{
|
||||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_green_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
iconLabel->setPixmap(QPixmap(":/icons/bullet_green_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||||
iconLabel->setToolTip( text + tr("RetroShare Server")) ;
|
iconLabel->setToolTip( text + tr("RetroShare Server")) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case RSNET_NETSTATE_ADV_FORWARD:
|
case RsNetState::ADV_FORWARD:
|
||||||
{
|
{
|
||||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_green_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
iconLabel->setPixmap(QPixmap(":/icons/bullet_green_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||||
iconLabel->setToolTip( text + tr("Forwarded Port")) ;
|
iconLabel->setToolTip( text + tr("Forwarded Port")) ;
|
||||||
|
@ -60,24 +60,24 @@ void TorStatus::getTorStatus()
|
|||||||
QString text = _compactMode?statusTor->text():"";
|
QString text = _compactMode?statusTor->text():"";
|
||||||
|
|
||||||
/* check local network state. We cannot make sure that Tor is running yet. */
|
/* check local network state. We cannot make sure that Tor is running yet. */
|
||||||
uint32_t netState = rsConfig -> getNetState();
|
RsNetState netState = rsConfig -> getNetState();
|
||||||
bool online ;
|
bool online ;
|
||||||
|
|
||||||
switch(netState)
|
switch(netState)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case RSNET_NETSTATE_BAD_UNKNOWN:
|
case RsNetState::BAD_UNKNOWN:
|
||||||
case RSNET_NETSTATE_BAD_OFFLINE: online = false ;
|
case RsNetState::BAD_OFFLINE: online = false ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case RSNET_NETSTATE_WARNING_RESTART:
|
case RsNetState::WARNING_RESTART:
|
||||||
|
|
||||||
case RSNET_NETSTATE_BAD_NATSYM:
|
case RsNetState::BAD_NATSYM:
|
||||||
case RSNET_NETSTATE_BAD_NODHT_NAT:
|
case RsNetState::BAD_NODHT_NAT:
|
||||||
case RSNET_NETSTATE_WARNING_NATTED:
|
case RsNetState::WARNING_NATTED:
|
||||||
case RSNET_NETSTATE_WARNING_NODHT:
|
case RsNetState::WARNING_NODHT:
|
||||||
case RSNET_NETSTATE_GOOD:
|
case RsNetState::GOOD:
|
||||||
case RSNET_NETSTATE_ADV_FORWARD: online = true ;
|
case RsNetState::ADV_FORWARD: online = true ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user