24 RCSID(
"$Id: a8184ef5af35c13d9707c99902b9e42e322260b5 $")
26 #include <freeradius-devel/util/table.h>
27 #include <freeradius-devel/util/misc.h>
40 if (!str_val)
return NULL;
int strcasecmp(char *s1, char *s2)
char const * _fr_table_ptr_by_str_value(fr_table_ptr_sorted_t const *table, size_t table_len, char const *str_val, char const *def)
Brute force search a sorted or ordered ptr table, assuming the pointers are strings.
#define TABLE_TYPE_VALUE_FUNC(_our_table_type, _our_name, _our_value_type)
Create a type-specific value-to-name function.
char const * str
Literal string.
int fr_table_ordered_num_by_substr(fr_table_num_ordered_t const *table, size_t table_len, char const *name, ssize_t name_len, int def)
#define TABLE_TYPE_VALUE_INDEX_BIT_FIELD_FUNC(_our_table_type, _our_name, _our_value_type)
Create a type-specific value-to-name function, which uses the highest bit set in the value as an inde...
static void const * table_ordered_value_by_longest_prefix(size_t *match_len, void const *table, size_t table_len, size_t element_size, char const *name, ssize_t name_len)
Find the longest string match using an arbitrarily ordered table.
#define TABLE_TYPE_NAME_FUNC(_func, _our_table_type, _our_name, _our_def_type, _our_return_type)
Create a type-specific name-to-value function.
#define TABLE_TYPE_NAME_MATCH_LEN_FUNC(_func, _our_table_type, _our_name, _our_def_type, _our_return_type)
Create a type-specific name-to-value function that can perform substring matching with a 'name_len' a...
char const * fr_table_sorted_str_by_ptr(fr_table_ptr_sorted_t const *table, size_t table_len, void const *ptr, char const *def)
int fr_table_ordered_num_by_longest_prefix(size_t *match_len, fr_table_num_ordered_t const *table, size_t table_len, char const *name, ssize_t name_len, int def)
void * fr_table_ordered_ptr_by_str(fr_table_ptr_ordered_t const *table, size_t table_len, char const *name, void const *def)
void * fr_table_ordered_ptr_by_longest_prefix(size_t *match_len, fr_table_ptr_ordered_t const *table, size_t table_len, char const *name, ssize_t name_len, void const *def)
static void const * table_sorted_value_by_longest_prefix(size_t *match_len, void const *table, size_t table_len, size_t element_size, char const *name, ssize_t name_len)
Find the longest string match using a lexicographically sorted table.
static void const * table_ordered_value_by_substr(void const *table, size_t table_len, size_t element_size, char const *name, ssize_t name_len)
Convert a string matching part of name to an integer using an arbitrarily ordered table.
int fr_table_sorted_num_by_substr(fr_table_num_sorted_t const *table, size_t table_len, char const *name, ssize_t name_len, int def)
char const * fr_table_ordered_str_by_num(fr_table_num_ordered_t const *table, size_t table_len, int number, char const *def)
#define TABLE_TYPE_VALUE_INDEX_FUNC(_our_table_type, _our_name, _our_value_type)
Create a type-specific value-to-name function, which uses the value as an index into the table.
void * fr_table_sorted_ptr_by_str(fr_table_ptr_sorted_t const *table, size_t table_len, char const *name, void const *def)
fr_table_elem_name_t name
char const * fr_table_ordered_str_by_ptr(fr_table_ptr_ordered_t const *table, size_t table_len, void const *ptr, char const *def)
void * fr_table_sorted_ptr_by_substr(fr_table_ptr_sorted_t const *table, size_t table_len, char const *name, ssize_t name_len, void const *def)
char const * fr_table_sorted_str_by_num(fr_table_num_sorted_t const *table, size_t table_len, int number, char const *def)
int fr_table_sorted_num_by_str(fr_table_num_sorted_t const *table, size_t table_len, char const *name, int def)
char const * fr_table_indexed_str_by_num(fr_table_num_indexed_t const *table, size_t table_len, unsigned int number, char const *def)
void * fr_table_ordered_ptr_by_substr(fr_table_ptr_ordered_t const *table, size_t table_len, char const *name, ssize_t name_len, void const *def)
int fr_table_ordered_num_by_str(fr_table_num_ordered_t const *table, size_t table_len, char const *name, int def)
static void const * table_sorted_value_by_str(void const *table, size_t table_len, size_t element_size, char const *name)
Convert a string to a value using a lexicographically sorted table.
void * fr_table_sorted_ptr_by_longest_prefix(size_t *match_len, fr_table_ptr_sorted_t const *table, size_t table_len, char const *name, ssize_t name_len, void const *def)
static void const * table_ordered_value_by_str(void const *table, size_t table_len, size_t element_size, char const *name)
Convert a string to a value using an arbitrarily ordered table.
#define TABLE_TYPE_NAME_LEN_FUNC(_func, _our_table_type, _our_name, _our_def_type, _our_return_type)
Create a type-specific name-to-value function that can perform substring matching with a 'name_len' a...
char const * fr_table_indexed_str_by_bit_field(fr_table_num_indexed_bit_pos_t const *table, size_t table_len, uint64_t number, char const *def)
int fr_table_sorted_num_by_longest_prefix(size_t *match_len, fr_table_num_sorted_t const *table, size_t table_len, char const *name, ssize_t name_len, int def)
static void const * table_sorted_value_by_substr(void const *table, size_t table_len, size_t element_size, char const *name, ssize_t name_len)
Convert a string matching part of name to an integer using a lexicographically sorted table.
An element in a table indexed by bit position.
An element in a table indexed by numeric value.
An element in an arbitrarily ordered array of name to num mappings.
An element in a lexicographically sorted array of name to num mappings.
An element in an arbitrarily ordered array of name to ptr mappings.
An element in a lexicographically sorted array of name to ptr mappings.