Map internal data structures to statistics.
More...
#include <freeradius-devel/util/stats.h>
Go to the source code of this file.
|
| int | fr_stats_from_pairs (TALLOC_CTX *ctx, fr_stats_instance_t *inst, fr_pair_list_t const *list) |
| | Convert a statistics structure to fr_pair_t.
|
| |
| int | fr_stats_index_to_value_box (TALLOC_CTX *ctx, fr_value_box_t **out, fr_stats_instance_t const *inst, unsigned int index) |
| | Convert the statistic at an index to a value-box.
|
| |
| void | fr_stats_iter_init (fr_stats_instance_t const *inst, fr_stats_iter_t *iter) |
| | Initialize an iterator over a structure.
|
| |
| bool | fr_stats_iter_next (fr_stats_iter_t *iter) |
| | Go to the next entry in a structure.
|
| |
| int | fr_stats_iter_to_value_box (TALLOC_CTX *ctx, fr_value_box_t **out, fr_stats_iter_t *iter) |
| | Convert the statistic at the current iterator to a value-box.
|
| |
| int | fr_stats_merge_instance (fr_stats_instance_t *out, fr_stats_instance_t const *in) |
| | Public API for merging two statistics structures.
|
| |
| int | fr_stats_merge_value_box (fr_value_box_t *dst, fr_value_box_t const *src) |
| | Public API for merging two value-boxes based on their enums.
|
| |
| int | fr_stats_name_to_value_box (TALLOC_CTX *ctx, fr_value_box_t **out, fr_stats_instance_t const *inst, char const *name) |
| | Convert the statistic of a given name to a value-box.
|
| |
| int | fr_stats_to_pairs (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_stats_instance_t const *inst) |
| | Convert a statistics structure to fr_pair_t.
|
| |
| static int | stats_merge_internal (fr_stats_link_t const *def, void *out, void const *in) |
| | Merge to statistics structures.
|
| |
Map internal data structures to statistics.
- Copyright
- 2022 Network RADIUS SAS (legal.nosp@m.@net.nosp@m.workr.nosp@m.adiu.nosp@m.s.com)
Definition in file stats.c.
◆ add
| #define add |
( |
|
_type, |
|
|
|
_out, |
|
|
|
_in |
|
) |
| |
Value:do { \
_type _a, _b, _sum; \
memcpy(&_a, &_out, sizeof(_a)); \
memcpy(&_b, &_in, sizeof(_b)); \
_sum = _a + _b; \
memcpy(&_out, &_sum, sizeof(_sum)); \
} while (0)
Definition at line 187 of file stats.c.
◆ COPY
| #define COPY |
( |
|
_type, |
|
|
|
_field |
|
) |
| |
Value: case _type: \
memcpy(field, &
vp->vp_ ## _field,
sizeof(
vp->vp_ ##_field)); \
break
◆ fr_stats_from_pairs()
Convert a statistics structure to fr_pair_t.
- Parameters
-
| [in] | ctx | talloc ctx |
| [out] | inst | where the output pairs will be stored |
| [in] | list | pairs where we read the pairs from |
Definition at line 114 of file stats.c.
◆ fr_stats_index_to_value_box()
Convert the statistic at an index to a value-box.
- Parameters
-
| [in] | ctx | the talloc context |
| [out] | out | the value-box to return |
| [in] | inst | data structure defining this instance of the statistics |
| [in] | index | the field index of the structure to use |
- Returns
- 0 for success, and *out is non-NULL
- <0 for error (memory allocation failed, index is invalid, etc), and *out is NULL
Definition at line 343 of file stats.c.
◆ fr_stats_iter_init()
Initialize an iterator over a structure.
- Parameters
-
| [in] | inst | data structure defining this instance of the statistics |
| [out] | iter | the initialized iterator |
Definition at line 309 of file stats.c.
◆ fr_stats_iter_next()
Go to the next entry in a structure.
- Parameters
-
- Returns
- true for continue the iteration
- false for the iteration is done
Definition at line 322 of file stats.c.
◆ fr_stats_iter_to_value_box()
Convert the statistic at the current iterator to a value-box.
- Parameters
-
| [in] | ctx | the talloc context |
| [out] | out | the value-box to return |
| [in] | iter | the iterator, which points to the current entry. |
- Returns
- 0 for success, and *out is non-NULL
- <0 for error (memory allocation failed, index is invalid, etc), and *out is NULL
Definition at line 416 of file stats.c.
◆ fr_stats_merge_instance()
Public API for merging two statistics structures.
- Parameters
-
| [out] | out | where the merged stats are written to |
| [in] | in | source stats to merge into out |
- Returns
- 0 on success
- <0 on the two instances are not compatible.
Definition at line 241 of file stats.c.
◆ fr_stats_merge_value_box()
Public API for merging two value-boxes based on their enums.
- Parameters
-
| [in,out] | dst | where the merged stats are written to |
| [in] | src | source stats to merge into dst |
- Returns
- 0 on success
- <0 on the two boxes are not compatible, or we cannot merge the given data type
Definition at line 260 of file stats.c.
◆ fr_stats_name_to_value_box()
Convert the statistic of a given name to a value-box.
- Parameters
-
| [in] | ctx | the talloc context |
| [out] | out | the value-box to return |
| [in] | inst | data structure defining this instance of the statistics |
| [in] | name | the field name in the structure |
- Returns
- 0 for success, and *out is non-NULL
- <0 for error (memory allocation failed, name is invalid, etc), and *out is NULL
Definition at line 435 of file stats.c.
◆ fr_stats_to_pairs()
Convert a statistics structure to fr_pair_t.
- Parameters
-
| [in] | ctx | talloc ctx |
| [out] | out | where the output pairs will be stored |
| [in] | inst | data structure defining this instance of the statistics |
Definition at line 33 of file stats.c.
◆ stats_merge_internal()
| static int stats_merge_internal |
( |
fr_stats_link_t const * |
def, |
|
|
void * |
out, |
|
|
void const * |
in |
|
) |
| |
|
static |
Merge to statistics structures.
- Todo:
- ensure that the struct magic is the same as the def magic
Definition at line 201 of file stats.c.