----------------------------------------------------------------------------- Purpose: Is this IP address a broadcast address? -----------------------------------------------------------------------------
| 282 | // Purpose: Is this IP address a broadcast address? |
| 283 | //----------------------------------------------------------------------------- |
| 284 | bool CIPAddress::IsBroadcast() const |
| 285 | { |
| 286 | // The code below will be incorrect if we are a ipv4-mapped-to-ipv6 address |
| 287 | // So - unmap ourselves to a temp CIPAddress and return it |
| 288 | if ( IsMappedIPv4() ) |
| 289 | { |
| 290 | CIPAddress ipTemp = *this; |
| 291 | ipTemp.BConvertMappedToIPv4(); |
| 292 | return ipTemp.IsBroadcast(); |
| 293 | } |
| 294 | |
| 295 | switch ( m_usType ) |
| 296 | { |
| 297 | case k_EIPTypeInvalid: |
| 298 | case k_EIPTypeLoopbackDeprecated: |
| 299 | return false; |
| 300 | case k_EIPTypeBroadcastDeprecated: |
| 301 | return true; |
| 302 | case k_EIPTypeV4: |
| 303 | return m_unIPv4 == 0xffffffff; // 255.255.255.255 |
| 304 | case k_EIPTypeV6: |
| 305 | // There might other IPs than could be construed as "broadcast", |
| 306 | // but just check for the one used by SetIPV6Broadcast() |
| 307 | return memcmp( m_rgubIPv6, k_ipv6Bytes_LinkLocalAllNodes, 16 ) == 0; |
| 308 | } |
| 309 | Assert( false ); |
| 310 | return false; |
| 311 | } |
| 312 | |
| 313 | //----------------------------------------------------------------------------- |
| 314 | // Purpose: Get the ipv6 bytes (network byte order) of this address. Works even |
nothing calls this directly
no test coverage detected