mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-02 11:16:34 -04:00
convert RSNET_NATTYPE to enum class
This commit is contained in:
parent
0237531322
commit
f81755e320
9 changed files with 67 additions and 98 deletions
|
@ -259,7 +259,7 @@ std::string PeerConnectStateBox::connectState() const
|
|||
}
|
||||
|
||||
|
||||
uint32_t convertNetStateToInternal(RsNetworkMode netmode, uint32_t nathole, uint32_t nattype)
|
||||
uint32_t convertNetStateToInternal(RsNetworkMode netmode, uint32_t nathole, RsNatTypeMode nattype)
|
||||
{
|
||||
uint32_t connNet = CSB_NETSTATE_UNKNOWN;
|
||||
|
||||
|
@ -273,12 +273,12 @@ uint32_t convertNetStateToInternal(RsNetworkMode netmode, uint32_t nathole, uint
|
|||
}
|
||||
else if (netmode == RsNetworkMode::BEHINDNAT)
|
||||
{
|
||||
if ((nattype == RSNET_NATTYPE_RESTRICTED_CONE) ||
|
||||
(nattype == RSNET_NATTYPE_FULL_CONE))
|
||||
if ((nattype == RsNatTypeMode::RESTRICTED_CONE) ||
|
||||
(nattype == RsNatTypeMode::FULL_CONE))
|
||||
{
|
||||
connNet = CSB_NETSTATE_STABLENAT;
|
||||
}
|
||||
else if (nattype == RSNET_NATTYPE_DETERM_SYM)
|
||||
else if (nattype == RsNatTypeMode::DETERM_SYM)
|
||||
{
|
||||
connNet = CSB_NETSTATE_EXCLUSIVENAT;
|
||||
}
|
||||
|
@ -299,20 +299,20 @@ bool shouldUseProxyPortInternal(uint32_t netstate)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool PeerConnectStateBox::shouldUseProxyPort(RsNetworkMode netmode, uint32_t nathole, uint32_t nattype)
|
||||
bool PeerConnectStateBox::shouldUseProxyPort(RsNetworkMode netmode, uint32_t nathole, RsNatTypeMode nattype)
|
||||
{
|
||||
uint32_t netstate = convertNetStateToInternal(netmode, nathole, nattype);
|
||||
return shouldUseProxyPortInternal(netstate);
|
||||
}
|
||||
|
||||
uint32_t PeerConnectStateBox::calcNetState(RsNetworkMode netmode, uint32_t nathole, uint32_t nattype)
|
||||
uint32_t PeerConnectStateBox::calcNetState(RsNetworkMode netmode, uint32_t nathole, RsNatTypeMode nattype)
|
||||
{
|
||||
uint32_t netstate = convertNetStateToInternal(netmode, nathole, nattype);
|
||||
return netstate;
|
||||
}
|
||||
|
||||
|
||||
uint32_t PeerConnectStateBox::connectCb(uint32_t cbtype, RsNetworkMode netmode, uint32_t nathole, uint32_t nattype)
|
||||
uint32_t PeerConnectStateBox::connectCb(uint32_t cbtype, RsNetworkMode netmode, uint32_t 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, uint32_t nattype);
|
||||
uint32_t connectCb(uint32_t cbtype, RsNetworkMode netmode, uint32_t nathole, RsNatTypeMode nattype);
|
||||
uint32_t updateCb(uint32_t updateType);
|
||||
|
||||
bool shouldUseProxyPort(RsNetworkMode netmode, uint32_t nathole, uint32_t nattype);
|
||||
bool shouldUseProxyPort(RsNetworkMode netmode, uint32_t nathole, RsNatTypeMode nattype);
|
||||
|
||||
uint32_t calcNetState(RsNetworkMode netmode, uint32_t nathole, uint32_t nattype);
|
||||
uint32_t calcNetState(RsNetworkMode netmode, uint32_t nathole, RsNatTypeMode nattype);
|
||||
std::string connectState() const;
|
||||
|
||||
std::string mPeerId;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue