21 #ifndef INCLUDE_OLA_NETWORK_NETWORKUTILS_H_
22 #define INCLUDE_OLA_NETWORK_NETWORKUTILS_H_
27 #include <arpa/inet.h>
30 #include <ola/network/Interface.h>
42 unsigned int SockAddrLen(
const struct sockaddr &sa);
47 bool StringToAddress(
const std::string &address,
struct in_addr *addr);
49 std::string AddressToString(
const struct in_addr &addr);
57 uint8_t NetworkToHost(uint8_t value);
62 uint16_t NetworkToHost(uint16_t value);
67 uint32_t NetworkToHost(uint32_t value);
68 int8_t NetworkToHost(int8_t value);
73 int16_t NetworkToHost(int16_t value);
78 int32_t NetworkToHost(int32_t value);
79 uint8_t HostToNetwork(uint8_t value);
84 uint16_t HostToNetwork(uint16_t value);
89 uint32_t HostToNetwork(uint32_t value);
90 int8_t HostToNetwork(int8_t value);
91 int16_t HostToNetwork(int16_t value);
92 int32_t HostToNetwork(int32_t value);
94 uint8_t HostToLittleEndian(uint8_t value);
95 uint16_t HostToLittleEndian(uint16_t value);
96 uint32_t HostToLittleEndian(uint32_t value);
97 int8_t HostToLittleEndian(int8_t value);
98 int16_t HostToLittleEndian(int16_t value);
99 int32_t HostToLittleEndian(int32_t value);
100 uint8_t LittleEndianToHost(uint8_t value);
101 uint16_t LittleEndianToHost(uint16_t value);
102 uint32_t LittleEndianToHost(uint32_t value);
103 int8_t LittleEndianToHost(int8_t value);
104 int16_t LittleEndianToHost(int16_t value);
105 int32_t LittleEndianToHost(int32_t value);
112 std::string HostnameFromFQDN(
const std::string &fqdn);
119 std::string DomainNameFromFQDN(
const std::string &fqdn);
149 bool NameServers(std::vector<ola::network::IPV4Address> *name_servers);
168 #endif // INCLUDE_OLA_NETWORK_NETWORKUTILS_H_