diff options
author | Tobias Brunner <tobias@strongswan.org> | 2014-01-28 15:20:27 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2014-02-12 14:34:32 +0100 |
commit | 1713d88278597f79df799cf24fbec34c0b9a1a02 (patch) | |
tree | 727f530b5e44b6d144b13e99b5c0e4c6aa7e7bad /src/libstrongswan/utils/settings.h | |
parent | ef72d4cc3f887f4b1dc1d84304c22564db102a48 (diff) | |
download | strongswan-1713d88278597f79df799cf24fbec34c0b9a1a02.tar.bz2 strongswan-1713d88278597f79df799cf24fbec34c0b9a1a02.tar.xz |
settings: Add method that allows to define fallback sections for other sections
The fallbacks are currently only used for single value lookups.
Enumerators are not affected by them.
Diffstat (limited to 'src/libstrongswan/utils/settings.h')
-rw-r--r-- | src/libstrongswan/utils/settings.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libstrongswan/utils/settings.h b/src/libstrongswan/utils/settings.h index df0c534e9..6154ad8b9 100644 --- a/src/libstrongswan/utils/settings.h +++ b/src/libstrongswan/utils/settings.h @@ -269,6 +269,32 @@ struct settings_t { char *section, ...); /** + * Add a fallback for the given section. + * + * Example: When the fallback 'section-two' is configured for + * 'section-one.two' any failed lookup for a section or key in + * 'section-one.two' will result in a lookup for the same section/key + * in 'section-two'. + * + * @note This has only an effect on single value lookups. Enumerators for + * sections and key/value-pairs are not affected. The reason is that it is + * rather tricky to implement such a merge without requiring allocations for + * each lookup. For instance, if charon.tls has libtls as fallback and + * charon has libstrongswan as fallback, the key/value-enumerator for + * charon.tls had to enumerate the libtls and libstrongswan.tls sections + * too, but it would have to keep track of the already enumerated keys. + * + * @note Additional arguments will be applied to both section format + * strings so they must be compatible. + * + * @param section section for which a fallback is configured, printf style + * @param fallback fallback section, printf style + * @param ... argument list for section and fallback + */ + void (*add_fallback)(settings_t *this, const char *section, + const char *fallback, ...); + + /** * Load settings from the files matching the given pattern. * * If merge is TRUE, existing sections are extended, existing values |