OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
std::hash< C4NetIO::addr_t > Struct Template Reference

#include <C4PuncherHash.h>

Public Member Functions

size_t operator() (const C4NetIO::addr_t &addr) const
 

Detailed Description

template<>
struct std::hash< C4NetIO::addr_t >

Definition at line 63 of file C4PuncherHash.h.

Member Function Documentation

size_t std::hash< C4NetIO::addr_t >::operator() ( const C4NetIO::addr_t addr) const
inline

Definition at line 64 of file C4PuncherHash.h.

References C4NetIO::HostAddress::GetFamily(), C4NetIO::HostAddress::IPv4, C4NetIO::HostAddress::IPv6, and C4NetIO::HostAddress::UnknownFamily.

64  {
65  switch (addr.GetFamily())
66  {
68  {
69  sockaddr_in v4 = addr;
70  auto unpack = make_tuple(v4.sin_family, v4.sin_addr.s_addr, v4.sin_port);
71  return hash<decltype(unpack)>()(unpack);
72  }
74  {
75  sockaddr_in6 v6 = addr;
76  auto unpack = make_tuple(v6.sin6_family, v6.sin6_port, v6.sin6_flowinfo, std::string((char*) v6.sin6_addr.s6_addr, 16), v6.sin6_scope_id);
77  return hash<decltype(unpack)>()(unpack);
78  }
80  assert(!"Unexpected address family");
81  return 0;
82  }
83  }
AddressFamily GetFamily() const
Definition: C4NetIO.cpp:526

Here is the call graph for this function:


The documentation for this struct was generated from the following file: