along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "siphash24.h"
+
#include "resolved-dns-server.h"
int dns_server_new(
return NULL;
}
+
+unsigned long dns_server_hash_func(const void *p, const uint8_t hash_key[HASH_KEY_SIZE]) {
+ const DnsServer *s = p;
+ uint64_t u;
+
+ siphash24((uint8_t*) &u, &s->address, FAMILY_ADDRESS_SIZE(s->family), hash_key);
+ u = u * hash_key[0] + u + s->family;
+
+ return u;
+}
+
+int dns_server_compare_func(const void *a, const void *b) {
+ const DnsServer *x = a, *y = b;
+
+ if (x->family < y->family)
+ return -1;
+ if (x->family > y->family)
+ return 1;
+
+ return memcmp(&x->address, &y->address, FAMILY_ADDRESS_SIZE(x->family));
+}