util: add function for IP address hashing

Move the hashing function from find_slot() in ntp_sources to make it
available to clientlog and improve the hashing a bit.
This commit is contained in:
Miroslav Lichvar
2015-11-23 15:24:33 +01:00
parent 59a3140621
commit 8b235297a5
3 changed files with 34 additions and 15 deletions

1
util.h
View File

@@ -82,6 +82,7 @@ extern char *UTI_IPToString(IPAddr *ip);
extern int UTI_StringToIP(const char *addr, IPAddr *ip);
extern uint32_t UTI_IPToRefid(IPAddr *ip);
extern uint32_t UTI_IPToHash(IPAddr *ip);
extern void UTI_IPHostToNetwork(IPAddr *src, IPAddr *dest);
extern void UTI_IPNetworkToHost(IPAddr *src, IPAddr *dest);
extern int UTI_CompareIPs(IPAddr *a, IPAddr *b, IPAddr *mask);