35 RCSIDH(ext_h,
"$Id: 8f485ee92039de1ea8fb6df5deaf0d960e8544e1 $")
37 #include <freeradius-devel/util/table.h>
49 # define FR_EXT_ALIGNMENT sizeof(uint32_t)
51 # define FR_EXT_ALIGNMENT __WORD_SIZE
54 # define FR_EXT_ALIGNMENT sizeof(uint64_t)
70 typedef void *(* fr_ext_alloc_t)(
fr_ext_t const *def, TALLOC_CTX **dst_chunk_p,
71 int ext,
void *src_ext_ptr,
size_t src_ext_len);
87 TALLOC_CTX *dst_chunk,
88 void *dst_ext_ptr,
size_t dst_ext_len,
89 TALLOC_CTX
const *src_chunk,
90 void *src_ext_ptr,
size_t src_ext_len);
107 void *ext_ptr,
size_t ext_len);
150 static inline CC_HINT(always_inline)
void *
fr_ext_ptr(TALLOC_CTX
const *chunk,
size_t offset,
bool has_hdr)
154 out = (uintptr_t)chunk;
165 void *
fr_ext_copy(
fr_ext_t const *def, TALLOC_CTX **chunk_out, TALLOC_CTX
const *chunk_in,
int ext);
bool can_copy
Copying this extension between structs is allowed.
size_t offset_of_exts
Where in the extended struct the extensions array starts.
void * fr_ext_alloc_size(fr_ext_t const *def, TALLOC_CTX **chunk_p, int ext, size_t ext_len)
void *(* fr_ext_alloc_t)(fr_ext_t const *def, TALLOC_CTX **dst_chunk_p, int ext, void *src_ext_ptr, size_t src_ext_len)
Function for pre-allocating extension memory for extensions before they're copied.
static void * fr_ext_ptr(TALLOC_CTX const *chunk, size_t offset, bool has_hdr)
Return a pointer to an extension in a chunk.
int max
The highest extension value.
size_t fr_ext_len(fr_ext_t const *def, TALLOC_CTX const *chunk_in, int ext)
Return the length of an extension.
int fr_ext_copy_all(fr_ext_t const *def, TALLOC_CTX **chunk_out, TALLOC_CTX const *chunk_in)
Copy all the extensions from one attribute to another.
bool has_hdr
Additional metadata should be allocated before the extension data to record the exact length of the e...
int(* fr_ext_copy_t)(int ext, TALLOC_CTX *dst_chunk, void *dst_ext_ptr, size_t dst_ext_len, TALLOC_CTX const *src_chunk, void *src_ext_ptr, size_t src_ext_len)
Function for re-populating extensions after they're copied.
size_t * name_table_len
How many extensions there are in the table.
fr_table_num_ordered_t const * name_table
String identifiers for the extensions.
size_t len
Length of extension data.
fr_ext_copy_t copy
Override the normal copy operation with a callback.
fr_ext_alloc_t alloc
Override the normal alloc operation with a callback.
void * fr_ext_copy(fr_ext_t const *def, TALLOC_CTX **chunk_out, TALLOC_CTX const *chunk_in, int ext)
Copy extension data from one attribute to another.
fr_ext_fixup_t fixup
Callback for fixing up internal consistency issues.
int(* fr_ext_fixup_t)(int ext, TALLOC_CTX *chunk, void *ext_ptr, size_t ext_len)
Function for re-establishing internal consistency on realloc.
#define FR_EXT_ALIGNMENT
The alignment of object extension structures.
size_t min
Minimum size of extension.
static uint8_t * fr_ext_offsets(fr_ext_t const *def, TALLOC_CTX const *chunk)
void fr_ext_debug(fr_ext_t const *def, char const *name, TALLOC_CTX const *chunk)
fr_ext_info_t const * info
Additional information about each extension.
Optional extension header struct.
Additional information for a given extension.
Structure to define a set of extensions.
An element in an arbitrarily ordered array of name to num mappings.
static size_t char ** out