[sr-dev] Standalone Configuration File Parser

Jan Janak jan at ryngle.com
Thu Sep 24 13:52:36 CEST 2009


Hello,

I am not sure if everybody is aware of that, but the sip-router core
has inherited a standalone configuration file parser from SER. The
parser lives in files cfg_parser.[ch] and can be used to parse
configuration files of form:

# comment...
[section]
name1 = value1
name2 = value2
...

The format of section identifiers as well as the format of
configuration values are extensible it can be anything from booleans,
integers, strings, and even more complicated compound formats of your
own.

Two SER modules currently use the parser. The tls module uses it to
parse standalone configuration files with TLS related configuration.
The ldap SER module uses the parser to parse a configuration file that
maps LDAP objects to tables and columns for the database API.

Here is an example of a non-trivial configuration file the parse can parse:
http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=blob_plain;f=modules_s/ldap/ldap.cfg;hb=HEAD

Some documentation can be found in file sip_router/cfg_parser.c.
For examples how to use it have a look at the following files:
http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=blob;f=modules_s/ldap/ld_cfg.c;h=e4427581ab9be4db67170d79d06a5996d14ef00d;hb=HEAD
http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=blob;f=modules/tls/tls_config.c;h=740c9be9c8212c9420df6829867bac504bfe6020;hb=HEAD

  Jan.



More information about the sr-dev mailing list