The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Functions
dict_validate.c File Reference

Validation framework to allow protocols to set custom validation rules. More...

#include <freeradius-devel/util/dict_priv.h>
+ Include dependency graph for dict_validate.c:

Go to the source code of this file.

Macros

#define ALLOW_FLAG(_flag)   do { all_flags &= ~shift_ ## _flag; } while (0)
 
#define FORBID_OTHER_FLAGS(_flag)   do { if (all_flags & ~shift_ ## _flag) { fr_strerror_printf("The '" STRINGIFY(_flag) "' flag cannot be used with any other flag"); return false; } } while (0)
 
#define SET_FLAG(_flag)   do { shift_ ## _flag = 1 << ++bit; if (flags->_flag) all_flags |= (1 << bit); } while (0)
 

Functions

bool dict_attr_fields_valid (fr_dict_t *dict, fr_dict_attr_t const *parent, char const *name, int *attr, fr_type_t type, fr_dict_attr_flags_t *flags)
 Validate a new attribute definition. More...
 
bool dict_attr_flags_valid (fr_dict_t *dict, fr_dict_attr_t const *parent, char const *name, int *attr, fr_type_t type, fr_dict_attr_flags_t *flags)
 Validate a set of flags. More...
 

Detailed Description

Validation framework to allow protocols to set custom validation rules.

Definition in file dict_validate.c.

Macro Definition Documentation

◆ ALLOW_FLAG

#define ALLOW_FLAG (   _flag)    do { all_flags &= ~shift_ ## _flag; } while (0)

◆ FORBID_OTHER_FLAGS

#define FORBID_OTHER_FLAGS (   _flag)    do { if (all_flags & ~shift_ ## _flag) { fr_strerror_printf("The '" STRINGIFY(_flag) "' flag cannot be used with any other flag"); return false; } } while (0)

◆ SET_FLAG

#define SET_FLAG (   _flag)    do { shift_ ## _flag = 1 << ++bit; if (flags->_flag) all_flags |= (1 << bit); } while (0)

Function Documentation

◆ dict_attr_fields_valid()

bool dict_attr_fields_valid ( fr_dict_t dict,
fr_dict_attr_t const *  parent,
char const *  name,
int *  attr,
fr_type_t  type,
fr_dict_attr_flags_t flags 
)

Validate a new attribute definition.

Todo:
we need to check length of none vendor attributes.
Parameters
[in]dictof protocol context we're operating in. If NULL the internal dictionary will be used.
[in]parentto add attribute under.
[in]nameof the attribute.
[in]attrnumber.
[in]typeof attribute.
[in]flagsto set in the attribute.
Returns
  • true if attribute definition is valid.
  • false if attribute definition is not valid.

Definition at line 599 of file dict_validate.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_attr_flags_valid()

bool dict_attr_flags_valid ( fr_dict_t dict,
fr_dict_attr_t const *  parent,
char const *  name,
int *  attr,
fr_type_t  type,
fr_dict_attr_flags_t flags 
)

Validate a set of flags.

Parameters
[in]dictof protocol context we're operating in. If NULL the internal dictionary will be used.
[in]parentto add attribute under.
[in]nameof the attribute.
[in]attrnumber.
[in]typeof attribute.
[in]flagsto check in the attribute.
Returns
  • true if attribute definition is valid.
  • false if attribute definition is not valid.

Definition at line 40 of file dict_validate.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: