e9e5e84ffb2ce2e606a24ce6d930580367562ff0Timo Sirainen#ifndef CONFIG_REQUEST_H
e9e5e84ffb2ce2e606a24ce6d930580367562ff0Timo Sirainen#define CONFIG_REQUEST_H
e9e5e84ffb2ce2e606a24ce6d930580367562ff0Timo Sirainen
a8fe899601735459641edae975c0fa08be8482e2Timo Sirainen#include "settings-parser.h"
1358e2c58ce29231485a5cfa454756d429ad3d2cTimo Sirainen#include "config-filter.h"
1358e2c58ce29231485a5cfa454756d429ad3d2cTimo Sirainen
5d03d9f439e41c90215a3c938ffebe4c2a8ae257Timo Sirainenstruct master_service_settings_output;
7a5e2e937f0f388465c2938645ee971b4fd01bf1Timo Sirainen
56439f2879ad690d9ac637e2b90b612760d2f219Timo Sirainenenum config_dump_scope {
56439f2879ad690d9ac637e2b90b612760d2f219Timo Sirainen /* Dump all settings */
56439f2879ad690d9ac637e2b90b612760d2f219Timo Sirainen CONFIG_DUMP_SCOPE_ALL,
56439f2879ad690d9ac637e2b90b612760d2f219Timo Sirainen /* Dump all that have explicitly been set */
56439f2879ad690d9ac637e2b90b612760d2f219Timo Sirainen CONFIG_DUMP_SCOPE_SET,
56439f2879ad690d9ac637e2b90b612760d2f219Timo Sirainen /* Dump only settings that differ from defaults */
56439f2879ad690d9ac637e2b90b612760d2f219Timo Sirainen CONFIG_DUMP_SCOPE_CHANGED
e9e5e84ffb2ce2e606a24ce6d930580367562ff0Timo Sirainen};
e9e5e84ffb2ce2e606a24ce6d930580367562ff0Timo Sirainen
50fe5e053d565b40b0ed2cc7a64b6b98971c0305Timo Sirainenenum config_dump_flags {
50fe5e053d565b40b0ed2cc7a64b6b98971c0305Timo Sirainen CONFIG_DUMP_FLAG_CHECK_SETTINGS = 0x01,
4383941ed43d004f34f77334a06ad14e6a305607Timo Sirainen CONFIG_DUMP_FLAG_HIDE_LIST_DEFAULTS = 0x02,
4383941ed43d004f34f77334a06ad14e6a305607Timo Sirainen /* Errors are reported using callback and they don't stop handling */
63e9db4f938bec812ec1b2b447c7de45183a4f43Aki Tuomi CONFIG_DUMP_FLAG_CALLBACK_ERRORS = 0x04,
63e9db4f938bec812ec1b2b447c7de45183a4f43Aki Tuomi /* Set if dumping a section and not top level config */
63e9db4f938bec812ec1b2b447c7de45183a4f43Aki Tuomi CONFIG_DUMP_FLAG_IN_SECTION = 0x08,
50fe5e053d565b40b0ed2cc7a64b6b98971c0305Timo Sirainen};
50fe5e053d565b40b0ed2cc7a64b6b98971c0305Timo Sirainen
d84c270231a617298088f597474a73f4a14921aeTimo Sirainenenum config_key_type {
d84c270231a617298088f597474a73f4a14921aeTimo Sirainen CONFIG_KEY_NORMAL,
d84c270231a617298088f597474a73f4a14921aeTimo Sirainen CONFIG_KEY_LIST,
4383941ed43d004f34f77334a06ad14e6a305607Timo Sirainen CONFIG_KEY_UNIQUE_KEY,
4383941ed43d004f34f77334a06ad14e6a305607Timo Sirainen /* error message is in value */
4383941ed43d004f34f77334a06ad14e6a305607Timo Sirainen CONFIG_KEY_ERROR
d84c270231a617298088f597474a73f4a14921aeTimo Sirainen};
d84c270231a617298088f597474a73f4a14921aeTimo Sirainen
e9e5e84ffb2ce2e606a24ce6d930580367562ff0Timo Sirainentypedef void config_request_callback_t(const char *key, const char *value,
d84c270231a617298088f597474a73f4a14921aeTimo Sirainen enum config_key_type type, void *context);
e9e5e84ffb2ce2e606a24ce6d930580367562ff0Timo Sirainen
7a5e2e937f0f388465c2938645ee971b4fd01bf1Timo Sirainenbool config_export_type(string_t *str, const void *value,
7a5e2e937f0f388465c2938645ee971b4fd01bf1Timo Sirainen const void *default_value,
7a5e2e937f0f388465c2938645ee971b4fd01bf1Timo Sirainen enum setting_type type, bool dump_default,
a10ed8c47534b4c6b6bf2711ccfe577e720a47b4Timo Sirainen bool *dump_r) ATTR_NULL(3);
5d03d9f439e41c90215a3c938ffebe4c2a8ae257Timo Sirainenstruct config_export_context *
633a3da9d3e9a5befd3405f6651043a6bdd327cbTimo Sirainenconfig_export_init(const char *const *modules, enum config_dump_scope scope,
5d03d9f439e41c90215a3c938ffebe4c2a8ae257Timo Sirainen enum config_dump_flags flags,
a10ed8c47534b4c6b6bf2711ccfe577e720a47b4Timo Sirainen config_request_callback_t *callback, void *context)
633a3da9d3e9a5befd3405f6651043a6bdd327cbTimo Sirainen ATTR_NULL(1, 5);
c0787d6ab19f4a17ec08699d0bbc77f13a9b02a9Timo Sirainenvoid config_export_by_filter(struct config_export_context *ctx,
c0787d6ab19f4a17ec08699d0bbc77f13a9b02a9Timo Sirainen const struct config_filter *filter);
c0787d6ab19f4a17ec08699d0bbc77f13a9b02a9Timo Sirainenvoid config_export_parsers(struct config_export_context *ctx,
c0787d6ab19f4a17ec08699d0bbc77f13a9b02a9Timo Sirainen const struct config_module_parser *parsers);
5d03d9f439e41c90215a3c938ffebe4c2a8ae257Timo Sirainenvoid config_export_get_output(struct config_export_context *ctx,
5d03d9f439e41c90215a3c938ffebe4c2a8ae257Timo Sirainen struct master_service_settings_output *output_r);
4ecee121e141083faf1db165f0ee3bc0cd232d7eTimo Sirainenconst char *
4ecee121e141083faf1db165f0ee3bc0cd232d7eTimo Sirainenconfig_export_get_import_environment(struct config_export_context *ctx);
5d03d9f439e41c90215a3c938ffebe4c2a8ae257Timo Sirainenint config_export_finish(struct config_export_context **ctx);
e9e5e84ffb2ce2e606a24ce6d930580367562ff0Timo Sirainen
e9e5e84ffb2ce2e606a24ce6d930580367562ff0Timo Sirainen#endif