The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
edit.h
Go to the documentation of this file.
1#pragma once
2/*
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16 */
17
18/**
19 * $Id: 2a5fd474dece04a0807cc5fdc5b48fed7369f810 $
20 *
21 * @file lib/util/edit.h
22 * @brief Structures and prototypes for editing lists.
23 *
24 * @copyright 2021 Network RADIUS SAS (legal@networkradius.com)
25 */
26RCSIDH(edit_h, "$Id: 2a5fd474dece04a0807cc5fdc5b48fed7369f810 $")
27
28#include <freeradius-devel/util/pair.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
35
36fr_edit_list_t *fr_edit_list_alloc(TALLOC_CTX *ctx, int hint, fr_edit_list_t *parent);
37
39
41
42/*
43 * Functions to modify #fr_pair_t
44 */
45#define fr_edit_list_insert_pair_before(_el, _list, _pos, _vp) fr_edit_list_insert_pair_after(_el, _list, fr_pair_list_prev(_list, _pos), _vp)
46
48
49#define fr_edit_list_insert_pair_head(_el, _list, _vp) fr_edit_list_insert_pair_after(_el, _list, NULL, _vp)
50
51#define fr_edit_list_insert_pair_tail(_el, _list, _vp) fr_edit_list_insert_pair_after(_el, _list, fr_pair_list_tail(_list), _vp)
52
54
56
58
60
61int fr_edit_list_replace_pair(fr_edit_list_t *el, fr_pair_list_t *list, fr_pair_t *to_replace, fr_pair_t *vp) CC_HINT(nonnull(2,3,4));
62
64
66
67/*
68 * Functions to modify #fr_pair_list_t
69 */
71
72#define fr_edit_list_insert_list_head(_el, _list, _to_insert) fr_edit_list_insert_list_after(_el, _list, NULL, _to_insert)
73
74#define fr_edit_list_insert_list_tail(_el, _list, _to_insert) fr_edit_list_insert_list_after(_el, _list, fr_pair_list_tail(_list), _to_insert)
75
77
78#ifdef __cplusplus
79}
80#endif
#define RCSIDH(h, id)
Definition build.h:484
static fr_slen_t in
Definition dict.h:823
fr_pair_t * vp
Stores an attribute, a value and various bits of other data.
Definition pair.h:68
enum fr_token fr_token_t
static fr_event_list_t * el
Track a series of edits.
Definition edit.c:102
int fr_edit_list_apply_list_assignment(fr_edit_list_t *el, fr_pair_t *dst, fr_token_t op, fr_pair_list_t *src, bool copy))
Apply operators to lists.
Definition edit.c:1487
void fr_edit_list_commit(fr_edit_list_t *el)
Commit an edit list.
Definition edit.c:841
int fr_edit_list_replace_pair(fr_edit_list_t *el, fr_pair_list_t *list, fr_pair_t *to_replace, fr_pair_t *vp))
Replace a pair with another one.
Definition edit.c:658
int fr_edit_list_insert_pair_after(fr_edit_list_t *el, fr_pair_list_t *list, fr_pair_t *pos, fr_pair_t *vp))
Insert a new VP after an existing one.
Definition edit.c:562
int fr_edit_list_pair_delete_by_da(fr_edit_list_t *el, fr_pair_list_t *list, fr_dict_attr_t const *da))
Delete VPs with a matching da.
Definition edit.c:594
int fr_edit_list_pair_delete(fr_edit_list_t *el, fr_pair_list_t *list, fr_pair_t *vp))
Delete a VP.
Definition edit.c:575
void fr_edit_list_abort(fr_edit_list_t *el)
Abort the entries in an edit list.
Definition edit.c:194
int fr_edit_list_insert_list_after(fr_edit_list_t *el, fr_pair_list_t *list, fr_pair_t *pos, fr_pair_list_t *to_insert))
Notes.
Definition edit.c:888
int fr_edit_list_apply_pair_assignment(fr_edit_list_t *el, fr_pair_t *vp, fr_token_t op, fr_value_box_t const *in)
Apply operators to pairs.
Definition edit.c:976
int fr_edit_list_replace_pair_value(fr_edit_list_t *el, fr_pair_t *vp, fr_value_box_t *box))
Write a new value to the fr_value_box_t.
Definition edit.c:635
int fr_edit_list_free_pair_children(fr_edit_list_t *el, fr_pair_t *vp))
Free children of a structural pair.
Definition edit.c:709
int fr_edit_list_save_pair_value(fr_edit_list_t *el, fr_pair_t *vp))
Record the value of a leaf fr_value_box_t.
Definition edit.c:622
fr_edit_list_t * fr_edit_list_alloc(TALLOC_CTX *ctx, int hint, fr_edit_list_t *parent)
Allocate an edit list.
Definition edit.c:790
static fr_slen_t parent
Definition pair.h:851
int nonnull(2, 5))