*/
RCSID("$Id$")
+#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/htrie.h>
+#include <freeradius-devel/util/table.h>
#define FUNC(_prefix, _op) ._op = (fr_htrie_ ##_op ## _t) fr_##_prefix##_## _op
+fr_table_num_sorted_t const fr_htrie_type_table[] = {
+ { L("auto"), FR_HTRIE_AUTO },
+ { L("hash"), FR_HTRIE_HASH },
+ { L("rb"), FR_HTRIE_RB },
+ { L("trie"), FR_HTRIE_TRIE },
+};
+size_t fr_htrie_type_table_len = NUM_ELEMENTS(fr_htrie_type_table);
+
static fr_htrie_funcs_t const default_funcs[] = {
[FR_HTRIE_HASH] = {
.match = (fr_htrie_find_t) fr_hash_table_find,
ht->funcs = default_funcs[type];
return ht;
+ case FR_HTRIE_INVALID:
+ fr_assert_msg(0, "FR_TYPE_INVALID passed as htype");
+ return NULL;
+
+ case FR_HTRIE_AUTO:
+ fr_assert_msg(0, "FR_HTRIE_AUTO must be resolved to a concrete htype value using fr_htrie_hint()");
+ return NULL;
+
default:
return NULL;
}
FR_HTRIE_HASH, //!< Data is stored in a hash.
FR_HTRIE_RB, //!< Data is stored in a rb tree.
FR_HTRIE_TRIE, //!< Data is stored in a prefix trie.
+ FR_HTRIE_AUTO, //!< Automatically choose the best type.
+ ///< Must be not be passed to fr_htrie_alloc().
+ ///< If the user selects this, you must
+ ///< call fr_htrie_hint() to determine the
+ ///< best type.
} fr_htrie_type_t;
+extern fr_table_num_sorted_t const fr_htrie_type_table[];
+extern size_t fr_htrie_type_table_len;
+
/** Which functions are used for the different operations
*
*/