Confused - discrepancy between documentation and code

Alan DeKok aland at deployingradius.com
Tue Nov 28 19:18:34 CET 2017


On Nov 28, 2017, at 12:51 PM, Jonathan Anthony <jonathan.anthony at siliconsafe.com> wrote:
> I am somewhat confused for according to documentation in doc.freeradius.org/conffile_8h.htm I read:
> static CONF_PARSER module_config[] = {      { FR_CONF_OFFSET("example", PW_TYPE_STRING | PW_TYPE_NOT_EMPTY, example_instance_t, example), .dflt = "default_value" },      CONF_PARSER_TERMINATOR}
> #define FR_CONF_POINTER (   _n,  _t,  _s,  _f )
> 
> In my downloaded conffile.h:
> # define FR_CONF_OFFSET(_t, _s, _f) .....

  There is a lot of C pre-processor magic going on.

> + some other differences.
> I have down loaded radius 3.0.16 ( from radiusd -v)
> 
> I would appreciate some help.

  Look at the other code.  There are literally hundreds of examples of using CONF_PARSER structures and macros.

> In the module_config[], I would like to have an entry for a variable var: uint8_t var[64]

  You can put any C data type you want into the module instance.  But the configuration parser will handle only a limited set of types.

> I see in radius.h that there is a PW_TYPE_BYTE but how to have an array?  ( I did try this with PW_TYPE_MULTI but I think I have misunderstood this)
> PW_TYPE_STRING is no good as there may be nulls in the array.

  PW_TYPE_MULTI isn't really used for much in the config file parser.  You can't use it to define an array of types.

  Perhaps you could explain what you want to do, instead of asking why it doesn't work the way you want.

  Alan DeKok.




More information about the Freeradius-Devel mailing list