Functions to iterate over collections of VALUE_PAIRs. More...
#include <freeradius-devel/libradius.h>
Go to the source code of this file.
Functions | |
void | fr_cursor_copy (vp_cursor_t *out, vp_cursor_t *in) |
Copy a cursor. More... | |
VALUE_PAIR * | fr_cursor_current (vp_cursor_t *cursor) |
Return the VALUE_PAIR the cursor current points to. More... | |
void | fr_cursor_end (vp_cursor_t *cursor) |
Moves cursor past the last attribute to the end. More... | |
VALUE_PAIR * | fr_cursor_first (vp_cursor_t *cursor) |
Rewind cursor to the start of the list. More... | |
void | fr_cursor_free (vp_cursor_t *cursor) |
Free the current pair and all pairs after it. More... | |
VALUE_PAIR * | fr_cursor_init (vp_cursor_t *cursor, VALUE_PAIR *const *const_vp) |
Setup a cursor to iterate over attribute pairs. More... | |
void | fr_cursor_insert (vp_cursor_t *cursor, VALUE_PAIR *vp) |
Insert a single VALUE_PAIR at the end of the list. More... | |
VALUE_PAIR * | fr_cursor_last (vp_cursor_t *cursor) |
Wind cursor to the last pair in the list. More... | |
void | fr_cursor_merge (vp_cursor_t *cursor, VALUE_PAIR *add) |
Merges multiple VALUE_PAIR into the cursor. More... | |
VALUE_PAIR * | fr_cursor_next (vp_cursor_t *cursor) |
Advanced the cursor to the next VALUE_PAIR. More... | |
VALUE_PAIR * | fr_cursor_next_by_da (vp_cursor_t *cursor, fr_dict_attr_t const *da, int8_t tag) |
Iterate over attributes of a given DA in the pairlist. More... | |
VALUE_PAIR * | fr_cursor_next_by_num (vp_cursor_t *cursor, unsigned int vendor, unsigned int attr, int8_t tag) |
Iterate over a collection of VALUE_PAIRs of a given type in the pairlist. More... | |
VALUE_PAIR * | fr_cursor_next_peek (vp_cursor_t *cursor) |
Return the next VALUE_PAIR without advancing the cursor. More... | |
VALUE_PAIR * | fr_cursor_remove (vp_cursor_t *cursor) |
Remove the current pair. More... | |
VALUE_PAIR * | fr_cursor_replace (vp_cursor_t *cursor, VALUE_PAIR *new) |
Replace the current pair. More... | |
static VALUE_PAIR * | fr_cursor_update (vp_cursor_t *cursor, VALUE_PAIR *vp) |
Internal function to update cursor state. More... | |
Functions to iterate over collections of VALUE_PAIRs.
Definition in file cursor.c.
void fr_cursor_copy | ( | vp_cursor_t * | out, |
vp_cursor_t * | in | ||
) |
VALUE_PAIR* fr_cursor_current | ( | vp_cursor_t * | cursor | ) |
Return the VALUE_PAIR the cursor current points to.
cursor | to operate on. |
Definition at line 304 of file cursor.c.
void fr_cursor_end | ( | vp_cursor_t * | cursor | ) |
Moves cursor past the last attribute to the end.
Primarily useful for setting up the cursor for freeing attributes added during the execution of a function, which later errors out, requiring only the attribute(s) that it added to be freed, and the attributes already present in the list to remain untouched.
cursor | to operate on. |
Definition at line 164 of file cursor.c.
VALUE_PAIR* fr_cursor_first | ( | vp_cursor_t * | cursor | ) |
Rewind cursor to the start of the list.
cursor | to operate on. |
Definition at line 105 of file cursor.c.
void fr_cursor_free | ( | vp_cursor_t * | cursor | ) |
Free the current pair and all pairs after it.
Will move the cursor back one, then free the current pair and all VALUE_PAIRs after it.
Usually used in conjunction with fr_cursor_end and fr_cursor_insert.
cursor | to free pairs in. |
Definition at line 528 of file cursor.c.
VALUE_PAIR* fr_cursor_init | ( | vp_cursor_t * | cursor, |
VALUE_PAIR *const * | const_vp | ||
) |
void fr_cursor_insert | ( | vp_cursor_t * | cursor, |
VALUE_PAIR * | vp | ||
) |
Insert a single VALUE_PAIR at the end of the list.
Insert a VALUE_PAIR at the end of the list.
cursor | to operate on. |
vp | to insert. |
Definition at line 321 of file cursor.c.
VALUE_PAIR* fr_cursor_last | ( | vp_cursor_t * | cursor | ) |
Wind cursor to the last pair in the list.
cursor | to operate on. |
Definition at line 126 of file cursor.c.
void fr_cursor_merge | ( | vp_cursor_t * | cursor, |
VALUE_PAIR * | add | ||
) |
Merges multiple VALUE_PAIR into the cursor.
Add multiple VALUE_PAIR from add to cursor.
cursor | to insert VALUE_PAIRs with |
add | one or more VALUE_PAIRs (may be NULL, which results in noop). |
Definition at line 394 of file cursor.c.
VALUE_PAIR* fr_cursor_next | ( | vp_cursor_t * | cursor | ) |
Advanced the cursor to the next VALUE_PAIR.
cursor | to operate on. |
Definition at line 263 of file cursor.c.
VALUE_PAIR* fr_cursor_next_by_da | ( | vp_cursor_t * | cursor, |
fr_dict_attr_t const * | da, | ||
int8_t | tag | ||
) |
Iterate over attributes of a given DA in the pairlist.
Find the next attribute of a given type. If no fr_cursor_next_by_* function has been called on a cursor before, or the previous call returned NULL, the search will start with the current attribute. Subsequent calls to fr_cursor_next_by_* functions will start the search from the previously matched attribute.
cursor | to operate on. |
da | to match. |
tag | to match. Either a tag number or TAG_ANY to match any tagged or untagged attribute, TAG_NONE to match attributes without tags. |
Definition at line 237 of file cursor.c.
VALUE_PAIR* fr_cursor_next_by_num | ( | vp_cursor_t * | cursor, |
unsigned int | vendor, | ||
unsigned int | attr, | ||
int8_t | tag | ||
) |
Iterate over a collection of VALUE_PAIRs of a given type in the pairlist.
Find the next attribute of a given type. If no fr_cursor_next_by_* function has been called on a cursor before, or the previous call returned NULL, the search will start with the current attribute. Subsequent calls to fr_cursor_next_by_* functions will start the search from the previously matched attribute.
cursor | to operate on. |
attr | number to match. |
vendor | number to match (0 for none vendor attribute). |
tag | to match. Either a tag number or TAG_ANY to match any tagged or untagged attribute, TAG_NONE to match attributes without tags. |
Definition at line 200 of file cursor.c.
VALUE_PAIR* fr_cursor_next_peek | ( | vp_cursor_t * | cursor | ) |
Return the next VALUE_PAIR without advancing the cursor.
cursor | to operate on. |
Definition at line 294 of file cursor.c.
VALUE_PAIR* fr_cursor_remove | ( | vp_cursor_t * | cursor | ) |
Remove the current pair.
The current VP will be set to the one before the VP being removed, this is so the commonly used check and remove loop (below) works as expected.
cursor | to remove the current pair from. |
Definition at line 433 of file cursor.c.
VALUE_PAIR* fr_cursor_replace | ( | vp_cursor_t * | cursor, |
VALUE_PAIR * | new | ||
) |
Replace the current pair.
cursor | to replace the current pair in. |
new | VALUE_PAIR to insert. |
Definition at line 491 of file cursor.c.
|
inlinestatic |
Internal function to update cursor state.
cursor | to operate on. |
vp | to set current and found positions to. |
Definition at line 38 of file cursor.c.