MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / IsLoopback

Method IsLoopback

src/Nazara/Network/IpAddress.cpp:72–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70 */
71
72 bool IpAddress::IsLoopback() const
73 {
74 if (!m_isValid)
75 return false;
76
77 NazaraAssert(m_protocol <= NetProtocol_Max, "Protocol has value out of enum");
78 switch (m_protocol)
79 {
80 case NetProtocol_Any:
81 case NetProtocol_Unknown:
82 break;
83
84 case NetProtocol_IPv4:
85 return m_ipv4[0] == 127;
86
87 case NetProtocol_IPv6:
88 return m_ipv6 == LoopbackIpV6.m_ipv6; // Only compare the ip value
89 }
90
91 NazaraInternalError("Invalid protocol for IpAddress (0x" + String::Number(m_protocol) + ')');
92 return false;
93 }
94
95 /*!
96 * \brief Gives a string representation

Callers 3

CreateMethod · 0.80
InitSocketMethod · 0.80
IpAddress.cppFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected