mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-07-16 10:03:14 -07:00
clang-format this branch
This commit is contained in:
parent
8b77ef538a
commit
342fa9d33f
135 changed files with 42729 additions and 42439 deletions
42
node/DNS.hpp
42
node/DNS.hpp
|
@ -28,28 +28,28 @@ namespace ZeroTier {
|
|||
*/
|
||||
class DNS {
|
||||
public:
|
||||
template <unsigned int C> static inline void serializeDNS(Buffer<C>& b, const ZT_VirtualNetworkDNS* dns)
|
||||
{
|
||||
b.append(dns->domain, 128);
|
||||
for (unsigned int j = 0; j < ZT_MAX_DNS_SERVERS; ++j) {
|
||||
InetAddress tmp(dns->server_addr[j]);
|
||||
tmp.serialize(b);
|
||||
}
|
||||
}
|
||||
template <unsigned int C> static inline void serializeDNS(Buffer<C>& b, const ZT_VirtualNetworkDNS* dns)
|
||||
{
|
||||
b.append(dns->domain, 128);
|
||||
for (unsigned int j = 0; j < ZT_MAX_DNS_SERVERS; ++j) {
|
||||
InetAddress tmp(dns->server_addr[j]);
|
||||
tmp.serialize(b);
|
||||
}
|
||||
}
|
||||
|
||||
template <unsigned int C> static inline void deserializeDNS(const Buffer<C>& b, unsigned int& p, ZT_VirtualNetworkDNS* dns)
|
||||
{
|
||||
char* d = (char*)b.data() + p;
|
||||
memset(dns, 0, sizeof(ZT_VirtualNetworkDNS));
|
||||
memcpy(dns->domain, d, 128);
|
||||
dns->domain[127] = 0;
|
||||
p += 128;
|
||||
for (unsigned int j = 0; j < ZT_MAX_DNS_SERVERS; ++j) {
|
||||
p += reinterpret_cast<InetAddress*>(&(dns->server_addr[j]))->deserialize(b, p);
|
||||
}
|
||||
}
|
||||
template <unsigned int C> static inline void deserializeDNS(const Buffer<C>& b, unsigned int& p, ZT_VirtualNetworkDNS* dns)
|
||||
{
|
||||
char* d = (char*)b.data() + p;
|
||||
memset(dns, 0, sizeof(ZT_VirtualNetworkDNS));
|
||||
memcpy(dns->domain, d, 128);
|
||||
dns->domain[127] = 0;
|
||||
p += 128;
|
||||
for (unsigned int j = 0; j < ZT_MAX_DNS_SERVERS; ++j) {
|
||||
p += reinterpret_cast<InetAddress*>(&(dns->server_addr[j]))->deserialize(b, p);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif // ZT_DNS_HPP
|
||||
#endif // ZT_DNS_HPP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue