[sr-dev] Standalone Configuration File Parser

Daniel-Constantin Mierla miconda at gmail.com
Thu Sep 24 14:02:42 CEST 2009


Hello,

On 24.09.2009 13:52 Uhr, Jan Janak wrote:
> 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.

good to know, I think there are some modules -- iirc, some K module use 
libconfuse for own config, maybe this one fits to remove extra dependency.

Does it have support for custom memory manger? e.g., load config either 
in shm or pkg as needed.

Daniel

>  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.
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>
>   

-- 
Daniel-Constantin Mierla
* Kamailio SIP Masterclass, Nov 9-13, 2009, Berlin
* http://www.asipto.com/index.php/sip-router-masterclass/




More information about the sr-dev mailing list