convert RSNET_NATTYPE to enum class

This commit is contained in:
sehraf 2020-02-09 21:11:49 +01:00
parent 0237531322
commit f81755e320
No known key found for this signature in database
GPG key ID: DF09F6EAE356B2C6
9 changed files with 67 additions and 98 deletions

View file

@ -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);

View file

@ -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;