MCPcopy Create free account
hub / github.com/ValveSoftware/GameNetworkingSockets / GetIPV6

Method GetIPV6

src/tier1/netadr.cpp:317–354  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Purpose: Get the ipv6 bytes (network byte order) of this address. Works even if this is an m_IPv4Bytes address, it will return a "mapped" ipv6 address. -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

315// if this is an m_IPv4Bytes address, it will return a "mapped" ipv6 address.
316//-----------------------------------------------------------------------------
317void CIPAddress::GetIPV6( byte *result ) const
318{
319 switch ( m_usType )
320 {
321 default:
322 Assert( false );
323 // FALLTHROUGH
324 case k_EIPTypeInvalid:
325 // ::
326 memset( result, 0, 16 );
327 break;
328
329 case k_EIPTypeLoopbackDeprecated:
330 // ::1
331 memset( result, 0, 16 );
332 result[15] = 1;
333 return;
334
335 case k_EIPTypeBroadcastDeprecated:
336 memcpy( result, k_ipv6Bytes_LinkLocalAllNodes, 16 );
337 break;
338
339 case k_EIPTypeV4:
340 // ::ffff:aabb.ccdd
341 memset( result, 0, 10 );
342 result[10] = 0xff;
343 result[11] = 0xff;
344 result[12] = m_IPv4Bytes.b1;
345 result[13] = m_IPv4Bytes.b2;
346 result[14] = m_IPv4Bytes.b3;
347 result[15] = m_IPv4Bytes.b4;
348 break;
349
350 case k_EIPTypeV6:
351 memcpy( result, m_rgubIPv6, 16 );
352 break;
353 }
354}
355
356
357//-----------------------------------------------------------------------------

Callers 5

GenerateChallengeMethod · 0.80
Received_ConnectOKMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected