本文整理汇总了C++中CNetworkInterface::GetCurrentNetmask方法的典型用法代码示例。如果您正苦于以下问题:C++ CNetworkInterface::GetCurrentNetmask方法的具体用法?C++ CNetworkInterface::GetCurrentNetmask怎么用?C++ CNetworkInterface::GetCurrentNetmask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNetworkInterface
的用法示例。
在下文中一共展示了CNetworkInterface::GetCurrentNetmask方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsInSubNet
static bool IsInSubNet(CURL url)
{
bool rtn = false;
CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
in_addr_t localMask = ntohl(inet_addr(iface->GetCurrentNetmask().c_str()));
in_addr_t testAddress = ntohl(inet_addr(url.GetHostName().c_str()));
in_addr_t localAddress = ntohl(inet_addr(iface->GetCurrentIPAddress().c_str()));
in_addr_t temp1 = testAddress & localMask;
in_addr_t temp2 = localAddress & localMask;
if (temp1 == temp2)
{
// we are on the same subnet
// now make sure it is a plex server
rtn = CPlexUtils::GetIdentity(url, 1);
}
return rtn;
}
示例2: GetLabel
//.........这里部分代码省略.........
value = g_langInfo.GetTemperatureUnitString();
return true;
case SYSTEM_FRIENDLY_NAME:
value = CSysInfo::GetDeviceName();
return true;
case SYSTEM_STEREOSCOPIC_MODE:
{
int iStereoMode = CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(CSettings::SETTING_VIDEOSCREEN_STEREOSCOPICMODE);
value = StringUtils::Format("%i", iStereoMode);
return true;
}
case SYSTEM_GET_CORE_USAGE:
value = StringUtils::Format("%4.2f", g_cpuInfo.GetCoreInfo(std::atoi(info.GetData3().c_str())).m_fPct);
return true;
case SYSTEM_RENDER_VENDOR:
value = CServiceBroker::GetRenderSystem()->GetRenderVendor();
return true;
case SYSTEM_RENDER_RENDERER:
value = CServiceBroker::GetRenderSystem()->GetRenderRenderer();
return true;
case SYSTEM_RENDER_VERSION:
value = CServiceBroker::GetRenderSystem()->GetRenderVersionString();
return true;
///////////////////////////////////////////////////////////////////////////////////////////////
// NETWORK_*
///////////////////////////////////////////////////////////////////////////////////////////////
case NETWORK_IP_ADDRESS:
{
CNetworkInterface* iface = CServiceBroker::GetNetwork().GetFirstConnectedInterface();
if (iface)
{
value = iface->GetCurrentIPAddress();
return true;
}
break;
}
case NETWORK_SUBNET_MASK:
{
CNetworkInterface* iface = CServiceBroker::GetNetwork().GetFirstConnectedInterface();
if (iface)
{
value = iface->GetCurrentNetmask();
return true;
}
break;
}
case NETWORK_GATEWAY_ADDRESS:
{
CNetworkInterface* iface = CServiceBroker::GetNetwork().GetFirstConnectedInterface();
if (iface)
{
value = iface->GetCurrentDefaultGateway();
return true;
}
break;
}
case NETWORK_DNS1_ADDRESS:
{
const std::vector<std::string> nss = CServiceBroker::GetNetwork().GetNameServers();
if (nss.size() >= 1)
{
value = nss[0];
return true;
}
break;
}
case NETWORK_DNS2_ADDRESS:
{
const std::vector<std::string> nss = CServiceBroker::GetNetwork().GetNameServers();
if (nss.size() >= 2)
{
value = nss[1];
return true;
}
break;
}
case NETWORK_DHCP_ADDRESS:
{
// wtf?
std::string dhcpserver;
value = dhcpserver;
return true;
}
case NETWORK_LINK_STATE:
{
std::string linkStatus = g_localizeStrings.Get(151);
linkStatus += " ";
CNetworkInterface* iface = CServiceBroker::GetNetwork().GetFirstConnectedInterface();
if (iface && iface->IsConnected())
linkStatus += g_localizeStrings.Get(15207);
else
linkStatus += g_localizeStrings.Get(15208);
value = linkStatus;
return true;
}
}
return false;
}