g_slice_free1 (sizeof (*tree), tree);
}
+uintptr_t
+radix_find_compressed_addr (radix_compressed_t *tree, rspamd_inet_addr_t *addr)
+{
+ if (addr == NULL) {
+ return RADIX_NO_VALUE;
+ }
+
+ if (addr->af == AF_INET) {
+ return radix_find_compressed (tree, (guint8 *)&addr->addr.s4.sin_addr,
+ sizeof (addr->addr.s4.sin_addr));
+ }
+ else if (addr->af == AF_INET6) {
+ return radix_find_compressed (tree, (guint8 *)&addr->addr.s6.sin6_addr,
+ sizeof (addr->addr.s6.sin6_addr));
+ }
+
+ return RADIX_NO_VALUE;
+}
+
/*
* vi:ts=4
*/
*/
uintptr_t radix32_tree_find_addr (radix_tree_t *tree, rspamd_inet_addr_t *addr);
+/**
+ * Find specified address in tree (works for any address)
+ * @param tree
+ * @param addr
+ * @return
+ */
+uintptr_t radix_find_compressed_addr (radix_compressed_t *tree,
+ rspamd_inet_addr_t *addr);
+
/**
* Traverse via the whole tree calling specified callback
*/