diff --git a/Knot.files b/Knot.files index b3cef48934c636f6105a5ac313a749713af99b06..860973599aba48e28d7fa8493b67c4fc1f486e3b 100644 --- a/Knot.files +++ b/Knot.files @@ -179,8 +179,8 @@ src/knot/conf/migration.c src/knot/conf/migration.h src/knot/conf/module.c src/knot/conf/module.h -src/knot/conf/scheme.c -src/knot/conf/scheme.h +src/knot/conf/schema.c +src/knot/conf/schema.h src/knot/conf/tools.c src/knot/conf/tools.h src/knot/ctl/commands.c @@ -226,9 +226,9 @@ src/knot/events/handlers/freeze_thaw.c src/knot/events/handlers/load.c src/knot/events/handlers/notify.c src/knot/events/handlers/nsec3resalt.c +src/knot/events/handlers/parent_ds_query.c src/knot/events/handlers/refresh.c src/knot/events/handlers/update.c -src/knot/events/handlers/parent_ds_query.c src/knot/events/log.c src/knot/events/log.h src/knot/events/replan.c @@ -413,8 +413,8 @@ src/libknot/yparser/ypbody.c src/libknot/yparser/ypbody.rl src/libknot/yparser/ypformat.c src/libknot/yparser/ypformat.h -src/libknot/yparser/ypscheme.c -src/libknot/yparser/ypscheme.h +src/libknot/yparser/ypschema.c +src/libknot/yparser/ypschema.h src/libknot/yparser/yptrafo.c src/libknot/yparser/yptrafo.h src/utils/common/cert.c @@ -522,7 +522,7 @@ tests/libknot/test_rrset-wire.c tests/libknot/test_rrset.c tests/libknot/test_tsig.c tests/libknot/test_yparser.c -tests/libknot/test_ypscheme.c +tests/libknot/test_ypschema.c tests/libknot/test_yptrafo.c tests/modules/test_onlinesign.c tests/modules/test_rrl.c diff --git a/src/Makefile.am b/src/Makefile.am index 5927a7e4b4cae9599da771f1b7b678966931cf26..faff0cd63342921d1138fe2436776436f5a7eafe 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -145,7 +145,7 @@ nobase_libknot_la_HEADERS = \ libknot/tsig.h \ libknot/yparser/yparser.h \ libknot/yparser/ypformat.h \ - libknot/yparser/ypscheme.h \ + libknot/yparser/ypschema.h \ libknot/yparser/yptrafo.h \ libknot/version.h @@ -186,7 +186,7 @@ libknot_la_SOURCES = \ libknot/yparser/yparser.c \ libknot/yparser/ypbody.c \ libknot/yparser/ypformat.c \ - libknot/yparser/ypscheme.c \ + libknot/yparser/ypschema.c \ libknot/yparser/yptrafo.c \ $(nobase_libknot_la_HEADERS) @@ -242,8 +242,8 @@ libknotd_la_SOURCES = \ knot/conf/migration.h \ knot/conf/module.h \ knot/conf/module.c \ - knot/conf/scheme.c \ - knot/conf/scheme.h \ + knot/conf/schema.c \ + knot/conf/schema.h \ knot/conf/tools.c \ knot/conf/tools.h \ knot/ctl/commands.c \ diff --git a/src/knot/conf/base.c b/src/knot/conf/base.c index a2f168c58f05867fe3d1475cccc131e6bb9092c7..407b1d24155fd9c350372bdd7a5d2dd65992c4c8 100644 --- a/src/knot/conf/base.c +++ b/src/knot/conf/base.c @@ -143,7 +143,7 @@ static void init_cache( int conf_new( conf_t **conf, - const yp_item_t *scheme, + const yp_item_t *schema, const char *db_dir, conf_flag_t flags) { @@ -160,8 +160,8 @@ int conf_new( // Initialize query modules list. init_list(&out->query_modules); - // Initialize config scheme. - int ret = yp_scheme_copy(&out->scheme, scheme); + // Initialize config schema. + int ret = yp_schema_copy(&out->schema, schema); if (ret != KNOT_EOK) { goto new_error; } @@ -278,8 +278,8 @@ int conf_clone( } memset(out, 0, sizeof(conf_t)); - // Initialize config scheme. - int ret = yp_scheme_copy(&out->scheme, s_conf->scheme); + // Initialize config schema. + int ret = yp_schema_copy(&out->schema, s_conf->schema); if (ret != KNOT_EOK) { free(out); return ret; @@ -293,7 +293,7 @@ int conf_clone( // Open common read-only transaction. ret = conf_refresh_txn(out); if (ret != KNOT_EOK) { - yp_scheme_free(out->scheme); + yp_schema_free(out->schema); free(out); return ret; } @@ -372,7 +372,7 @@ void conf_free( return; } - yp_scheme_free(conf->scheme); + yp_schema_free(conf->schema); free(conf->filename); free(conf->hostname); if (conf->api != NULL) { @@ -554,7 +554,7 @@ int conf_parse( } // Initialize parser check context. - yp_check_ctx_t *ctx = yp_scheme_check_init(&conf->scheme); + yp_check_ctx_t *ctx = yp_schema_check_init(&conf->schema); if (ctx == NULL) { ret = KNOT_ENOMEM; goto parse_error; @@ -571,7 +571,7 @@ int conf_parse( } } - check_ret = yp_scheme_check_parser(ctx, parser); + check_ret = yp_schema_check_parser(ctx, parser); if (check_ret != KNOT_EOK) { log_parser_err(parser, check_ret); break; @@ -610,7 +610,7 @@ int conf_parse( } conf_mod_load_purge(conf, false); - yp_scheme_check_deinit(ctx); + yp_schema_check_deinit(ctx); parse_error: yp_deinit(parser); free(parser); @@ -858,8 +858,8 @@ int conf_export( int ret; - // Iterate over the scheme. - for (yp_item_t *item = conf->scheme; item->name != NULL; item++) { + // Iterate over the schema. + for (yp_item_t *item = conf->schema; item->name != NULL; item++) { // Don't export module sections again. if (strncmp(item->name + 1, mod_prefix, mod_prefix_len) == 0) { break; diff --git a/src/knot/conf/base.h b/src/knot/conf/base.h index c578386bee73389efbbccaf4394b0020049c797e..9d9bfa5d41c2f789ed27dfe6fe8db1f16f114000 100644 --- a/src/knot/conf/base.h +++ b/src/knot/conf/base.h @@ -26,7 +26,7 @@ #pragma once #include "libknot/libknot.h" -#include "libknot/yparser/ypscheme.h" +#include "libknot/yparser/ypschema.h" #include "contrib/qp-trie/trie.h" #include "contrib/ucw/lists.h" #include "contrib/dynarray.h" @@ -88,8 +88,8 @@ typedef struct { bool is_clone; /*! Currently used namedb api. */ const struct knot_db_api *api; - /*! Configuration scheme. */ - yp_item_t *scheme; + /*! Configuration schema. */ + yp_item_t *schema; /*! Memory context. */ knot_mm_t *mm; /*! Configuration database. */ @@ -188,7 +188,7 @@ void conf_refresh_hostname( * Creates new or opens old configuration database. * * \param[out] conf Configuration. - * \param[in] scheme Configuration scheme. + * \param[in] schema Configuration schema. * \param[in] db_dir Database path or NULL. * \param[in] flags Access flags. * @@ -196,7 +196,7 @@ void conf_refresh_hostname( */ int conf_new( conf_t **conf, - const yp_item_t *scheme, + const yp_item_t *schema, const char *db_dir, conf_flag_t flags ); diff --git a/src/knot/conf/conf.h b/src/knot/conf/conf.h index 7332b231f6d78770b796d6c5cbfd3610116048de..6d5e5b1aacbf7517bd21561412f565be0ad4f798 100644 --- a/src/knot/conf/conf.h +++ b/src/knot/conf/conf.h @@ -28,7 +28,7 @@ #include <sys/socket.h> #include "knot/conf/base.h" -#include "knot/conf/scheme.h" +#include "knot/conf/schema.h" #define CONF_XFERS 10 diff --git a/src/knot/conf/confdb.c b/src/knot/conf/confdb.c index 08947178d8dccdfb6a7a78cc8678b8676302b33e..10c95fff599c92eabfbcac9e6046df269c7df5e7 100644 --- a/src/knot/conf/confdb.c +++ b/src/knot/conf/confdb.c @@ -378,9 +378,9 @@ int conf_db_set( } // Check for valid keys. - const yp_item_t *item = yp_scheme_find(key1 != NULL ? key1 : key0, + const yp_item_t *item = yp_schema_find(key1 != NULL ? key1 : key0, key1 != NULL ? key0 : NULL, - conf->scheme); + conf->schema); if (item == NULL) { return KNOT_YP_EINVAL_ITEM; } @@ -546,9 +546,9 @@ int conf_db_unset( } // Check for valid keys. - const yp_item_t *item = yp_scheme_find(key1 != NULL ? key1 : key0, + const yp_item_t *item = yp_schema_find(key1 != NULL ? key1 : key0, key1 != NULL ? key0 : NULL, - conf->scheme); + conf->schema); if (item == NULL) { return KNOT_YP_EINVAL_ITEM; } @@ -640,9 +640,9 @@ int conf_db_get( } // Check for valid keys. - out.item = yp_scheme_find(key1 != NULL ? key1 : key0, + out.item = yp_schema_find(key1 != NULL ? key1 : key0, key1 != NULL ? key0 : NULL, - conf->scheme); + conf->schema); if (out.item == NULL) { out.code = KNOT_YP_EINVAL_ITEM; goto get_error; @@ -746,8 +746,8 @@ int conf_db_iter_begin( goto iter_begin_error; } - // Look-up group id item in the scheme. - const yp_item_t *grp = yp_scheme_find(key0, NULL, conf->scheme); + // Look-up group id item in the schema. + const yp_item_t *grp = yp_schema_find(key0, NULL, conf->schema); if (grp == NULL) { out.code = KNOT_YP_EINVAL_ITEM; goto iter_begin_error; diff --git a/src/knot/conf/confdb.h b/src/knot/conf/confdb.h index d01e6a1ef7a2b80bc12f0bb42b20650fee6a84e5..3a40310ef9f38dff3d1e76c20d5771b1cea2cc98 100644 --- a/src/knot/conf/confdb.h +++ b/src/knot/conf/confdb.h @@ -30,7 +30,7 @@ #include "knot/conf/conf.h" #include "libknot/libknot.h" -#include "libknot/yparser/ypscheme.h" +#include "libknot/yparser/ypschema.h" /*! Current version of the configuration database structure. */ #define CONF_DB_VERSION 2 diff --git a/src/knot/conf/confio.c b/src/knot/conf/confio.c index ed3c1356f12cbd65067fb6fbd52acd06f674f11d..56fe993ce03c8996b5111bdcc737fdc2994ff75f 100644 --- a/src/knot/conf/confio.c +++ b/src/knot/conf/confio.c @@ -166,16 +166,16 @@ int conf_io_list( if (key0 == NULL) { io_reset_val(io, NULL, NULL, NULL, 0, false, NULL); - return list_section(conf()->scheme, &io->key0, io); + return list_section(conf()->schema, &io->key0, io); } - yp_check_ctx_t *ctx = yp_scheme_check_init(&conf()->scheme); + yp_check_ctx_t *ctx = yp_schema_check_init(&conf()->schema); if (ctx == NULL) { return KNOT_ENOMEM; } // Check the input. - int ret = yp_scheme_check_str(ctx, key0, NULL, NULL, NULL); + int ret = yp_schema_check_str(ctx, key0, NULL, NULL, NULL); if (ret != KNOT_EOK) { goto list_error; } @@ -192,7 +192,7 @@ int conf_io_list( ret = list_section(node->item->sub_items, &io->key1, io); list_error: - yp_scheme_check_deinit(ctx); + yp_schema_check_deinit(ctx); return ret; } @@ -480,7 +480,7 @@ int conf_io_diff( // Compare all sections by default. if (key0 == NULL) { - for (yp_item_t *i = conf()->scheme; i->name != NULL; i++) { + for (yp_item_t *i = conf()->schema; i->name != NULL; i++) { // Skip non-group item. if (i->type != YP_TGRP) { continue; @@ -499,13 +499,13 @@ int conf_io_diff( return KNOT_EOK; } - yp_check_ctx_t *ctx = yp_scheme_check_init(&conf()->scheme); + yp_check_ctx_t *ctx = yp_schema_check_init(&conf()->schema); if (ctx == NULL) { return KNOT_ENOMEM; } // Check the input. - int ret = yp_scheme_check_str(ctx, key0, key1, id, NULL); + int ret = yp_schema_check_str(ctx, key0, key1, id, NULL); if (ret != KNOT_EOK) { goto diff_error; } @@ -560,7 +560,7 @@ int conf_io_diff( // Compare the section with a possible identifier. ret = diff_section(io); diff_error: - yp_scheme_check_deinit(ctx); + yp_schema_check_deinit(ctx); return ret; } @@ -680,7 +680,7 @@ int conf_io_get( // List all sections by default. if (key0 == NULL) { - for (yp_item_t *i = conf()->scheme; i->name != NULL; i++) { + for (yp_item_t *i = conf()->schema; i->name != NULL; i++) { // Skip non-group item. if (i->type != YP_TGRP) { continue; @@ -698,13 +698,13 @@ int conf_io_get( return KNOT_EOK; } - yp_check_ctx_t *ctx = yp_scheme_check_init(&conf()->scheme); + yp_check_ctx_t *ctx = yp_schema_check_init(&conf()->schema); if (ctx == NULL) { return KNOT_ENOMEM; } // Check the input. - int ret = yp_scheme_check_str(ctx, key0, key1, id, NULL); + int ret = yp_schema_check_str(ctx, key0, key1, id, NULL); if (ret != KNOT_EOK) { goto get_error; } @@ -775,7 +775,7 @@ int conf_io_get( // List the section with a possible identifier. ret = get_section(txn, io); get_error: - yp_scheme_check_deinit(ctx); + yp_schema_check_deinit(ctx); return ret; } @@ -925,13 +925,13 @@ int conf_io_set( return KNOT_EINVAL; } - yp_check_ctx_t *ctx = yp_scheme_check_init(&conf()->scheme); + yp_check_ctx_t *ctx = yp_schema_check_init(&conf()->schema); if (ctx == NULL) { return KNOT_ENOMEM; } // Check the input. - int ret = yp_scheme_check_str(ctx, key0, key1, id, data); + int ret = yp_schema_check_str(ctx, key0, key1, id, data); if (ret != KNOT_EOK) { goto set_error; } @@ -1029,7 +1029,7 @@ int conf_io_set( upd_changes(&io, upd_type, upd_flags, false); } set_error: - yp_scheme_check_deinit(ctx); + yp_schema_check_deinit(ctx); return ret; } @@ -1113,7 +1113,7 @@ int conf_io_unset( // Unset all sections by default. if (key0 == NULL) { - for (yp_item_t *i = conf()->scheme; i->name != NULL; i++) { + for (yp_item_t *i = conf()->schema; i->name != NULL; i++) { // Skip non-group item. if (i->type != YP_TGRP) { continue; @@ -1132,13 +1132,13 @@ int conf_io_unset( return KNOT_EOK; } - yp_check_ctx_t *ctx = yp_scheme_check_init(&conf()->scheme); + yp_check_ctx_t *ctx = yp_schema_check_init(&conf()->schema); if (ctx == NULL) { return KNOT_ENOMEM; } // Check the input. - int ret = yp_scheme_check_str(ctx, key0, key1, id, data); + int ret = yp_schema_check_str(ctx, key0, key1, id, data); if (ret != KNOT_EOK) { goto unset_error; } @@ -1279,7 +1279,7 @@ int conf_io_unset( upd_changes(&io, upd_type, upd_flags, false); } unset_error: - yp_scheme_check_deinit(ctx); + yp_schema_check_deinit(ctx); return ret; } @@ -1462,8 +1462,8 @@ int conf_io_check( int ret; - // Iterate over the scheme. - for (yp_item_t *item = conf()->scheme; item->name != NULL; item++) { + // Iterate over the schema. + for (yp_item_t *item = conf()->schema; item->name != NULL; item++) { // Skip non-group items (include). if (item->type != YP_TGRP) { continue; diff --git a/src/knot/conf/migration.c b/src/knot/conf/migration.c index 18879f010d4031e6363bae34a1d5b98ffe24ac70..e245a50ae93a78c779743d22195925df6fc8e65f 100644 --- a/src/knot/conf/migration.c +++ b/src/knot/conf/migration.c @@ -132,7 +132,7 @@ int conf_migrate( return conf_refresh_txn(conf); } -const yp_item_t scheme_mod_online_sign[] = { +const yp_item_t schema_mod_online_sign[] = { { C_ID, YP_TSTR }, { C_POLICY, YP_TSTR }, { C_COMMENT, YP_TSTR }, @@ -147,7 +147,7 @@ int check_mod_online_sign( return KNOT_EOK; } -const yp_item_t scheme_mod_synth_record[] = { +const yp_item_t schema_mod_synth_record[] = { { C_ID, YP_TSTR }, { "\x07""network", YP_TSTR }, { "\x06""origin", YP_TSTR }, diff --git a/src/knot/conf/migration.h b/src/knot/conf/migration.h index 28de7a0c904ffc8c6345c09afb0da911440efa80..4bbdcba1fc91e262f23f3404236afaa5da92c893 100644 --- a/src/knot/conf/migration.h +++ b/src/knot/conf/migration.h @@ -30,9 +30,9 @@ int conf_migrate( ); #define C_MOD_ONLINE_SIGN "\x0f""mod-online-sign" -extern const yp_item_t scheme_mod_online_sign[]; +extern const yp_item_t schema_mod_online_sign[]; int check_mod_online_sign(knotd_conf_check_args_t *args); #define C_MOD_SYNTH_RECORD "\x10""mod-synth-record" -extern const yp_item_t scheme_mod_synth_record[]; +extern const yp_item_t schema_mod_synth_record[]; int check_mod_synth_record(knotd_conf_check_args_t *args); diff --git a/src/knot/conf/module.c b/src/knot/conf/module.c index 2e0237b3d404735c5c7991771fc6fffb1e43a739..8d97dbbb5538c0e6f6f2441d7df2b0401271d61c 100644 --- a/src/knot/conf/module.c +++ b/src/knot/conf/module.c @@ -80,9 +80,9 @@ static int mod_load( int ret; if (mod->api->config != NULL) { - ret = yp_scheme_merge(&sub_items, module_common, mod->api->config); + ret = yp_schema_merge(&sub_items, module_common, mod->api->config); } else { - ret = yp_scheme_copy(&sub_items, module_common); + ret = yp_schema_copy(&sub_items, module_common); } if (ret != KNOT_EOK) { return ret; @@ -97,21 +97,21 @@ static int mod_load( name[0] = name_len; memcpy(name + 1, mod->api->name, name_len + 1); - const yp_item_t scheme[] = { + const yp_item_t schema[] = { { name, YP_TGRP, YP_VGRP = { sub_items }, YP_FALLOC | YP_FMULTI | CONF_IO_FRLD_MOD | CONF_IO_FRLD_ZONES }, { NULL } }; yp_item_t *merged = NULL; - ret = yp_scheme_merge(&merged, conf->scheme, scheme); - yp_scheme_free(sub_items); + ret = yp_schema_merge(&merged, conf->schema, schema); + yp_schema_free(sub_items); if (ret != KNOT_EOK) { return ret; } // Update configuration schema (with lazy free). - yp_item_t **current_schema = &conf->scheme; + yp_item_t **current_schema = &conf->schema; yp_item_t *old_schema = rcu_xchg_pointer(current_schema, merged); synchronize_rcu(); old_schema_dynarray_add(&conf->old_schemas, &old_schema); @@ -288,7 +288,7 @@ void conf_mod_load_purge( // Switch the current temporary schema with the initial one. if (temporary && conf->old_schemas.size > 0) { - yp_item_t **current_schema = &conf->scheme; + yp_item_t **current_schema = &conf->schema; yp_item_t **initial = &(conf->old_schemas.arr)[0]; yp_item_t *old_schema = rcu_xchg_pointer(current_schema, *initial); @@ -297,7 +297,7 @@ void conf_mod_load_purge( } dynarray_foreach(old_schema, yp_item_t *, schema, conf->old_schemas) { - yp_scheme_free(*schema); + yp_schema_free(*schema); } old_schema_dynarray_free(&conf->old_schemas); diff --git a/src/knot/conf/scheme.c b/src/knot/conf/schema.c similarity index 98% rename from src/knot/conf/scheme.c rename to src/knot/conf/schema.c index 9803bbb9e8f6598cb5d13c10f21f78f672dfe2dc..efb35a9a17359946033d782960f1b6af0b4492e1 100644 --- a/src/knot/conf/scheme.c +++ b/src/knot/conf/schema.c @@ -19,7 +19,7 @@ #include <stdlib.h> #include <stdint.h> -#include "knot/conf/scheme.h" +#include "knot/conf/schema.h" #include "knot/conf/confio.h" #include "knot/conf/migration.h" #include "knot/conf/tools.h" @@ -300,7 +300,7 @@ static const yp_item_t desc_zone[] = { { NULL } }; -const yp_item_t conf_scheme[] = { +const yp_item_t conf_schema[] = { { C_MODULE, YP_TGRP, YP_VGRP = { desc_module }, YP_FMULTI | CONF_IO_FRLD_ALL | CONF_IO_FCHECK_ZONES, { load_module } }, { C_SRV, YP_TGRP, YP_VGRP = { desc_server }, CONF_IO_FRLD_SRV, { check_server } }, @@ -317,7 +317,7 @@ const yp_item_t conf_scheme[] = { { C_ZONE, YP_TGRP, YP_VGRP = { desc_zone }, YP_FMULTI | CONF_IO_FZONE, { check_zone } }, { C_INCL, YP_TSTR, YP_VNONE, CONF_IO_FDIFF_ZONES | CONF_IO_FRLD_ALL, { include_file } }, /* Renamed modules. */ - { C_MOD_ONLINE_SIGN, YP_TGRP, YP_VGRP = { scheme_mod_online_sign }, YP_FMULTI, { check_mod_online_sign } }, - { C_MOD_SYNTH_RECORD, YP_TGRP, YP_VGRP = { scheme_mod_synth_record }, YP_FMULTI, { check_mod_synth_record } }, + { C_MOD_ONLINE_SIGN, YP_TGRP, YP_VGRP = { schema_mod_online_sign }, YP_FMULTI, { check_mod_online_sign } }, + { C_MOD_SYNTH_RECORD, YP_TGRP, YP_VGRP = { schema_mod_synth_record }, YP_FMULTI, { check_mod_synth_record } }, { NULL } }; diff --git a/src/knot/conf/scheme.h b/src/knot/conf/schema.h similarity index 97% rename from src/knot/conf/scheme.h rename to src/knot/conf/schema.h index fa59d3cda5ed68de63074bfa7de9e0c8d0591ca5..2f9d2212947e9a24b1b444a8b1bd578c00b64c0f 100644 --- a/src/knot/conf/scheme.h +++ b/src/knot/conf/schema.h @@ -16,7 +16,7 @@ /*! * \file * - * Server configuration scheme. + * Server configuration schema. * * \addtogroup config * @@ -26,7 +26,7 @@ #pragma once #include "libknot/lookup.h" -#include "libknot/yparser/ypscheme.h" +#include "libknot/yparser/ypschema.h" #define C_ACL "\x03""acl" #define C_ACTION "\x06""action" @@ -138,6 +138,6 @@ enum { extern const knot_lookup_t acl_actions[]; -extern const yp_item_t conf_scheme[]; +extern const yp_item_t conf_schema[]; /*! @} */ diff --git a/src/knot/conf/tools.c b/src/knot/conf/tools.c index 54d4ba4b5b43f8622f117754b623d5e97fda5122..6a8833fd3c30f5c58999a1c4de1a40f3d30afcf0 100644 --- a/src/knot/conf/tools.c +++ b/src/knot/conf/tools.c @@ -33,7 +33,7 @@ #include "knot/conf/tools.h" #include "knot/conf/conf.h" #include "knot/conf/module.h" -#include "knot/conf/scheme.h" +#include "knot/conf/schema.h" #include "knot/common/log.h" #include "libknot/errcode.h" #include "libknot/yparser/yptrafo.h" @@ -565,7 +565,7 @@ int load_module( } // Update currently iterating item. - const yp_item_t *section = yp_scheme_find(C_MODULE, NULL, args->extra->conf->scheme); + const yp_item_t *section = yp_schema_find(C_MODULE, NULL, args->extra->conf->schema); assert(section); args->item = section->var.g.id; diff --git a/src/knot/conf/tools.h b/src/knot/conf/tools.h index 3d28f22f6f8dc54dcd0f662c140e0185fe6b0dd5..fcfd64384b554ba0b8a72550e22ea6dbc7436876 100644 --- a/src/knot/conf/tools.h +++ b/src/knot/conf/tools.h @@ -16,7 +16,7 @@ /*! * \file * - * Configuration scheme callbacks. + * Configuration schema callbacks. * * \addtogroup config * @@ -29,7 +29,7 @@ #include <stdint.h> #include "knot/conf/conf.h" -#include "libknot/yparser/ypscheme.h" +#include "libknot/yparser/ypschema.h" typedef struct knotd_conf_check_extra { conf_t *conf; diff --git a/src/knot/dnssec/kasp/keystore.c b/src/knot/dnssec/kasp/keystore.c index 4ccb086d3a94f4f49c519a4fcdadff689fe18585..f823cfe51f97da1c20788a73c12b19a7085583dc 100644 --- a/src/knot/dnssec/kasp/keystore.c +++ b/src/knot/dnssec/kasp/keystore.c @@ -17,7 +17,7 @@ #include <assert.h> #include <stdio.h> -#include "knot/conf/scheme.h" +#include "knot/conf/schema.h" #include "knot/dnssec/kasp/keystore.h" #include "libknot/error.h" diff --git a/src/knot/include/module.h b/src/knot/include/module.h index f52c0965f62d871299f9cdffb3012312ab1f5a3f..948f297f5b552182634b7fdf6ee6408cb8cf468a 100644 --- a/src/knot/include/module.h +++ b/src/knot/include/module.h @@ -22,7 +22,7 @@ #include <sys/socket.h> #include <libknot/libknot.h> -#include <libknot/yparser/ypscheme.h> +#include <libknot/yparser/ypschema.h> /*** Query module API. ***/ diff --git a/src/knot/modules/dnsproxy/dnsproxy.c b/src/knot/modules/dnsproxy/dnsproxy.c index ede677b97e01cc3f41d0f31bcd135b7ec5d5f232..ba5ca3201d2cbdadcb80e118d4a4ef579aa4dcfa 100644 --- a/src/knot/modules/dnsproxy/dnsproxy.c +++ b/src/knot/modules/dnsproxy/dnsproxy.c @@ -16,11 +16,10 @@ #include "contrib/net.h" #include "knot/include/module.h" -#include "knot/conf/scheme.h" +#include "knot/conf/schema.h" #include "knot/query/capture.h" // Forces static module! #include "knot/query/requestor.h" // Forces static module! -/* Module configuration scheme. */ #define MOD_REMOTE "\x06""remote" #define MOD_TIMEOUT "\x07""timeout" #define MOD_FALLBACK "\x08""fallback" diff --git a/src/knot/modules/rosedb/rosedb.c b/src/knot/modules/rosedb/rosedb.c index 37fec6cdce0cf86b7c63fe6461ae64ca8d448b80..1e480cbafbfb0476bc3fca6daac25707dc2b17ad 100644 --- a/src/knot/modules/rosedb/rosedb.c +++ b/src/knot/modules/rosedb/rosedb.c @@ -24,9 +24,8 @@ #include "contrib/sockaddr.h" #include "contrib/wire.h" #include "knot/include/module.h" -#include "knot/conf/scheme.h" +#include "knot/conf/schema.h" -/* Module configuration scheme. */ #define MOD_DBDIR "\x05""dbdir" const yp_item_t rosedb_conf[] = { diff --git a/src/knot/modules/rrl/rrl.c b/src/knot/modules/rrl/rrl.c index ac773a315e881f1a371d99d1238845f111836b40..67c38c296998d3fc31984cec53c4ad10b0e9c73c 100644 --- a/src/knot/modules/rrl/rrl.c +++ b/src/knot/modules/rrl/rrl.c @@ -19,7 +19,6 @@ #include "knot/nameserver/process_query.h" // Dependency on qdata->extra! #include "knot/modules/rrl/functions.h" -/* Module configuration scheme. */ #define MOD_RATE_LIMIT "\x0A""rate-limit" #define MOD_SLIP "\x04""slip" #define MOD_TBL_SIZE "\x0A""table-size" diff --git a/src/knot/modules/synthrecord/synthrecord.c b/src/knot/modules/synthrecord/synthrecord.c index b1ef7d983403202f07dcb67ba3aec917f3da958e..f4ba230d1249ed0d3532aa5803fc3149cbb9a3f5 100644 --- a/src/knot/modules/synthrecord/synthrecord.c +++ b/src/knot/modules/synthrecord/synthrecord.c @@ -18,7 +18,6 @@ #include "contrib/sockaddr.h" #include "knot/include/module.h" -/* Module configuration scheme. */ #define MOD_NET "\x07""network" #define MOD_ORIGIN "\x06""origin" #define MOD_PREFIX "\x06""prefix" diff --git a/src/knot/server/server.c b/src/knot/server/server.c index 7eea2e08ce16b3b45940458a4daf2967252e0b80..ae93f9528073d54e1e6bb51a7e536a4e410a8e57 100644 --- a/src/knot/server/server.c +++ b/src/knot/server/server.c @@ -21,7 +21,7 @@ #include <urcu.h> #include "libknot/errcode.h" -#include "libknot/yparser/ypscheme.h" +#include "libknot/yparser/ypschema.h" #include "knot/common/log.h" #include "knot/common/stats.h" #include "knot/conf/confio.h" @@ -540,7 +540,7 @@ void server_wait(server_t *server) static int reload_conf(conf_t *new_conf) { - yp_scheme_purge_dynamic(new_conf->scheme); + yp_schema_purge_dynamic(new_conf->schema); /* Re-load common modules. */ int ret = conf_mod_load_common(new_conf); diff --git a/src/libknot/yparser/ypformat.h b/src/libknot/yparser/ypformat.h index 0deab914782ba4baec1c5a0b33bfe38108d224a5..605d5092eb7030b4572f08a390b6701f83fa7c14 100644 --- a/src/libknot/yparser/ypformat.h +++ b/src/libknot/yparser/ypformat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> +/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,12 +24,12 @@ #pragma once -#include "libknot/yparser/ypscheme.h" +#include "libknot/yparser/ypschema.h" /*! * Formats key0 item. * - * \param[in] item Scheme item to format. + * \param[in] item Schema item to format. * \param[in] data Data to format. * \param[in] data_len Data length. * \param[out] out Output buffer. @@ -54,7 +54,7 @@ int yp_format_key0( /*! * Formats identifier item. * - * \param[in] item Scheme item to format. + * \param[in] item Schema item to format. * \param[in] data Data to format. * \param[in] data_len Data length. * \param[out] out Output buffer. @@ -75,7 +75,7 @@ int yp_format_id( /*! * Formats key1 item. * - * \param[in] item Scheme item to format. + * \param[in] item Schema item to format. * \param[in] data Data to format. * \param[in] data_len Data length. * \param[out] out Output buffer. diff --git a/src/libknot/yparser/ypscheme.c b/src/libknot/yparser/ypschema.c similarity index 83% rename from src/libknot/yparser/ypscheme.c rename to src/libknot/yparser/ypschema.c index 4f64d2a1897941180fe1395915b4a3afa3d8a4bc..7ffb7b717f371b6cc973800e0b5fdd87d1cce2df 100644 --- a/src/libknot/yparser/ypscheme.c +++ b/src/libknot/yparser/ypschema.c @@ -18,12 +18,12 @@ #include <stdlib.h> #include <string.h> -#include "libknot/yparser/ypscheme.h" +#include "libknot/yparser/ypschema.h" #include "libknot/yparser/yptrafo.h" #include "libknot/attribute.h" #include "libknot/errcode.h" -static size_t scheme_count( +static size_t schema_count( const yp_item_t *src) { size_t count = 0; @@ -37,15 +37,15 @@ static size_t scheme_count( /*! Initializes the referenced item. */ static int set_ref_item( yp_item_t *dst, - const yp_item_t *scheme) + const yp_item_t *schema) { - if (scheme == NULL) { + if (schema == NULL) { return KNOT_EINVAL; } // Get reference category. const yp_name_t *ref_name = dst->var.r.ref_name; - const yp_item_t *ref = yp_scheme_find(ref_name, NULL, scheme); + const yp_item_t *ref = yp_schema_find(ref_name, NULL, schema); if (ref == NULL) { return KNOT_YP_EINVAL_ITEM; } @@ -59,10 +59,10 @@ static int set_ref_item( static int set_grp_item( yp_item_t *dst, const yp_item_t *src, - const yp_item_t *scheme) + const yp_item_t *schema) { // Count subitems. - size_t count = scheme_count(src->var.g.sub_items); + size_t count = schema_count(src->var.g.sub_items); // Allocate space for subitems + terminal zero item. size_t memsize = (count + 1) * sizeof(yp_item_t); @@ -86,7 +86,7 @@ static int set_grp_item( int ret = KNOT_EOK; switch (dst->sub_items[i].type) { case YP_TREF: - ret = set_ref_item(dst->sub_items + i, scheme); + ret = set_ref_item(dst->sub_items + i, schema); break; case YP_TGRP: // Deeper hierarchy is not supported. ret = KNOT_ENOTSUP; @@ -121,7 +121,7 @@ static int set_grp_item( static int set_item( yp_item_t *dst, const yp_item_t *src, - const yp_item_t *scheme) + const yp_item_t *schema) { // Check maximal item name length. if ((uint8_t)src->name[0] > YP_MAX_ITEM_NAME_LEN) { @@ -143,9 +143,9 @@ static int set_item( // Item type specific preparation. switch (src->type) { case YP_TREF: - return set_ref_item(dst, scheme); + return set_ref_item(dst, schema); case YP_TGRP: - return set_grp_item(dst, src, scheme); + return set_grp_item(dst, src, schema); default: return KNOT_EOK; } @@ -167,14 +167,14 @@ static void unset_item( memset(item, 0, sizeof(yp_item_t)); } -static int scheme_copy( +static int schema_copy( yp_item_t *dst, const yp_item_t *src, - const yp_item_t *scheme) + const yp_item_t *schema) { - // Copy the scheme. + // Copy the schema. for (int i = 0; src[i].name != NULL; i++) { - int ret = set_item(dst + i, src + i, scheme); + int ret = set_item(dst + i, src + i, schema); if (ret != KNOT_EOK) { return ret; } @@ -184,7 +184,7 @@ static int scheme_copy( } _public_ -int yp_scheme_copy( +int yp_schema_copy( yp_item_t **dst, const yp_item_t *src) { @@ -192,18 +192,18 @@ int yp_scheme_copy( return KNOT_EINVAL; } - // Allocate space for new scheme (+ terminal NULL item). - size_t size = (scheme_count(src) + 1) * sizeof(yp_item_t); + // Allocate space for new schema (+ terminal NULL item). + size_t size = (schema_count(src) + 1) * sizeof(yp_item_t); *dst = malloc(size); if (*dst == NULL) { return KNOT_ENOMEM; } memset(*dst, 0, size); - // Copy the scheme. - int ret = scheme_copy(*dst, src, *dst); + // Copy the schema. + int ret = schema_copy(*dst, src, *dst); if (ret != KNOT_EOK) { - yp_scheme_free(*dst); + yp_schema_free(*dst); return ret; } @@ -211,7 +211,7 @@ int yp_scheme_copy( } _public_ -int yp_scheme_merge( +int yp_schema_merge( yp_item_t **dst, const yp_item_t *src1, const yp_item_t *src2) @@ -220,10 +220,10 @@ int yp_scheme_merge( return KNOT_EINVAL; } - size_t count1 = scheme_count(src1); - size_t count2 = scheme_count(src2); + size_t count1 = schema_count(src1); + size_t count2 = schema_count(src2); - // Allocate space for new scheme (+ terminal NULL item). + // Allocate space for new schema (+ terminal NULL item). size_t size = (count1 + count2 + 1) * sizeof(yp_item_t); *dst = malloc(size); if (*dst == NULL) { @@ -231,17 +231,17 @@ int yp_scheme_merge( } memset(*dst, 0, size); - // Copy the first scheme. - int ret = scheme_copy(*dst, src1, *dst); + // Copy the first schema. + int ret = schema_copy(*dst, src1, *dst); if (ret != KNOT_EOK) { - yp_scheme_free(*dst); + yp_schema_free(*dst); return ret; } - // Copy the second scheme. - ret = scheme_copy(*dst + count1, src2, *dst); + // Copy the second schema. + ret = schema_copy(*dst + count1, src2, *dst); if (ret != KNOT_EOK) { - yp_scheme_free(*dst); + yp_schema_free(*dst); return ret; } @@ -249,14 +249,14 @@ int yp_scheme_merge( } _public_ -void yp_scheme_purge_dynamic( - yp_item_t *scheme) +void yp_schema_purge_dynamic( + yp_item_t *schema) { - if (scheme == NULL) { + if (schema == NULL) { return; } - for (yp_item_t *item = scheme; item->name != NULL; item++) { + for (yp_item_t *item = schema; item->name != NULL; item++) { if (item->flags & YP_FALLOC) { unset_item(item); } @@ -264,30 +264,30 @@ void yp_scheme_purge_dynamic( } _public_ -void yp_scheme_free( - yp_item_t *scheme) +void yp_schema_free( + yp_item_t *schema) { - if (scheme == NULL) { + if (schema == NULL) { return; } - for (yp_item_t *item = scheme; item->name != NULL; item++) { + for (yp_item_t *item = schema; item->name != NULL; item++) { unset_item(item); } - free(scheme); + free(schema); } -/*! Search the scheme for an item with the given name. */ +/*! Search the schema for an item with the given name. */ static const yp_item_t* find_item( const char *name, size_t name_len, - const yp_item_t *scheme) + const yp_item_t *schema) { - if (name == NULL || scheme == NULL) { + if (name == NULL || schema == NULL) { return NULL; } - for (const yp_item_t *item = scheme; item->name != NULL; item++) { + for (const yp_item_t *item = schema; item->name != NULL; item++) { if (item->name[0] != name_len) { continue; } @@ -300,20 +300,20 @@ static const yp_item_t* find_item( } _public_ -const yp_item_t* yp_scheme_find( +const yp_item_t* yp_schema_find( const yp_name_t *name, const yp_name_t *parent_name, - const yp_item_t *scheme) + const yp_item_t *schema) { - if (name == NULL || scheme == NULL) { + if (name == NULL || schema == NULL) { return NULL; } if (parent_name == NULL) { - return find_item(name + 1, name[0], scheme); + return find_item(name + 1, name[0], schema); } else { const yp_item_t *parent = find_item(parent_name + 1, - parent_name[0], scheme); + parent_name[0], schema); if (parent == NULL) { return NULL; } @@ -322,10 +322,10 @@ const yp_item_t* yp_scheme_find( } _public_ -yp_check_ctx_t* yp_scheme_check_init( - yp_item_t **scheme) +yp_check_ctx_t* yp_schema_check_init( + yp_item_t **schema) { - if (scheme == NULL) { + if (schema == NULL) { return NULL; } @@ -335,7 +335,7 @@ yp_check_ctx_t* yp_scheme_check_init( } memset(ctx, 0, sizeof(yp_check_ctx_t)); - ctx->scheme = scheme; + ctx->schema = schema; return ctx; } @@ -382,7 +382,7 @@ static int check_item( // Check if valid subitem. node->item = find_item(key, key_len, parent->item->sub_items); } else { - node->item = find_item(key, key_len, *ctx->scheme); + node->item = find_item(key, key_len, *ctx->schema); } if (node->item == NULL) { return KNOT_YP_EINVAL_ITEM; @@ -439,7 +439,7 @@ static int check_item( } _public_ -int yp_scheme_check_parser( +int yp_schema_check_parser( yp_check_ctx_t *ctx, const yp_parser_t *parser) { @@ -492,7 +492,7 @@ int yp_scheme_check_parser( } _public_ -int yp_scheme_check_str( +int yp_schema_check_str( yp_check_ctx_t *ctx, const char *key0, const char *key1, @@ -568,7 +568,7 @@ int yp_scheme_check_str( } _public_ -void yp_scheme_check_deinit( +void yp_schema_check_deinit( yp_check_ctx_t* ctx) { free(ctx); diff --git a/src/libknot/yparser/ypscheme.h b/src/libknot/yparser/ypschema.h similarity index 85% rename from src/libknot/yparser/ypscheme.h rename to src/libknot/yparser/ypschema.h index cbfe72123f9de7442ea5ebc4b80d5cd2c5b6ccf7..4c7455a7b4be4068f46e27e5157f0e5194cbb21a 100644 --- a/src/libknot/yparser/ypscheme.h +++ b/src/libknot/yparser/ypschema.h @@ -16,7 +16,7 @@ /*! * \file * - * \brief Scheme layer for Yparser. + * \brief Schema layer for Yparser. * * \addtogroup yparser * @{ @@ -63,10 +63,10 @@ struct knot_lookup; #define YP_VREF .var.r #define YP_VGRP .var.g -/*! Scheme item name is a char string with a leading byte (string length). */ +/*! Schema item name is a char string with a leading byte (string length). */ typedef char yp_name_t; -/*! Scheme item type. */ +/*! Schema item type. */ typedef enum { YP_TNONE = 0, /*!< Unspecified. */ YP_TINT, /*!< Integer. */ @@ -83,7 +83,7 @@ typedef enum { YP_TGRP, /*!< Group of sub-items. */ } yp_type_t; -/*! Scheme item flags. */ +/*! Schema item flags. */ typedef enum { YP_FNONE = 0, /*!< Unspecified. */ YP_FMULTI = 1 << 0, /*!< Multivalued item. */ @@ -106,7 +106,7 @@ typedef enum { YP_FUSR16 = 1 << 20, /*!< User-defined flag16. */ } yp_flag_t; -/*! Scheme item style. */ +/*! Schema item style. */ typedef enum { YP_SNONE = 0, /*!< Unspecified. */ YP_SSIZE = 1 << 0, /*!< Size unit (B, K, M, G) (in, out). */ @@ -117,7 +117,7 @@ typedef enum { typedef struct yp_item yp_item_t; -/*! Scheme item variables (type dependent). */ +/*! Schema item variables (type dependent). */ typedef union { /*! Integer variables. */ struct { @@ -181,7 +181,7 @@ typedef union { } g; } yp_var_t; -/*! Scheme item specification. */ +/*! Schema item specification. */ struct yp_item { /*! Item name. */ const yp_name_t *name; @@ -217,8 +217,8 @@ struct yp_node { /*! Context parameters for check operations. */ typedef struct { - /*! Used scheme. */ - yp_item_t **scheme; + /*! Used schema. */ + yp_item_t **schema; /*! Index of the current node. */ size_t current; /*! Node stack. */ @@ -226,79 +226,79 @@ typedef struct { } yp_check_ctx_t; /*! - * Copies the scheme and reinitializes dynamic parameters. + * Copies the schema and reinitializes dynamic parameters. * - * \param[out] dst New copy of the scheme. - * \param[in] src Source scheme. + * \param[out] dst New copy of the schema. + * \param[in] src Source schema. * * \return Error code, KNOT_EOK if success. */ -int yp_scheme_copy( +int yp_schema_copy( yp_item_t **dst, const yp_item_t *src ); /*! - * Merges two schemes. + * Merges two schemas. * - * \param[out] dst Merged scheme. - * \param[in] src1 Source scheme1. - * \param[in] src2 Source scheme2. + * \param[out] dst Merged schema. + * \param[in] src1 Source schema1. + * \param[in] src2 Source schema2. * * \return Error code, KNOT_EOK if success. */ -int yp_scheme_merge( +int yp_schema_merge( yp_item_t **dst, const yp_item_t *src1, const yp_item_t *src2 ); /*! - * Purges dynamic items from the scheme. + * Purges dynamic items from the schema. * - * \param[in] scheme Scheme to purge. + * \param[in] schema Schema to purge. */ -void yp_scheme_purge_dynamic( - yp_item_t *scheme +void yp_schema_purge_dynamic( + yp_item_t *schema ); /*! - * Deallocates the scheme. + * Deallocates the schema. * - * \param[in] scheme A scheme returned by #yp_scheme_copy(). + * \param[in] schema A schema returned by #yp_schema_copy(). */ -void yp_scheme_free( - yp_item_t *scheme +void yp_schema_free( + yp_item_t *schema ); /*! - * Tries to find given parent_name/name in the scheme. + * Tries to find given parent_name/name in the schema. * * \param[in] name Name of the item. * \param[in] parent_name Name of the parent item (NULL if no parent). - * \param[in] scheme Scheme. + * \param[in] schema Schema. * * \return Item, NULL if not found or error. */ -const yp_item_t* yp_scheme_find( +const yp_item_t* yp_schema_find( const yp_name_t *name, const yp_name_t *parent_name, - const yp_item_t *scheme + const yp_item_t *schema ); /*! - * Prepares a context for item check against the scheme. + * Prepares a context for item check against the schema. * - * \param[in] scheme Scheme. + * \param[in] schema Schema. * * \return Context, NULL if error. */ -yp_check_ctx_t* yp_scheme_check_init( - yp_item_t **scheme +yp_check_ctx_t* yp_schema_check_init( + yp_item_t **schema ); /*! - * Checks the current parser output against the scheme. + * Checks the current parser output against the schema. * * If the item is correct, context also contains binary value of the item. * @@ -307,13 +307,13 @@ yp_check_ctx_t* yp_scheme_check_init( * * \return Error code, KNOT_EOK if success. */ -int yp_scheme_check_parser( +int yp_schema_check_parser( yp_check_ctx_t *ctx, const yp_parser_t *parser ); /*! - * Checks the string data against the scheme. + * Checks the string data against the schema. * * Description: key0[id].key1 data * @@ -327,7 +327,7 @@ int yp_scheme_check_parser( * * \return Error code, KNOT_EOK if success. */ -int yp_scheme_check_str( +int yp_schema_check_str( yp_check_ctx_t *ctx, const char *key0, const char *key1, @@ -340,7 +340,7 @@ int yp_scheme_check_str( * * \param[in,out] ctx Check context. */ -void yp_scheme_check_deinit( +void yp_schema_check_deinit( yp_check_ctx_t *ctx ); diff --git a/src/libknot/yparser/yptrafo.h b/src/libknot/yparser/yptrafo.h index 8ac0712a7371ed8acbf081f1de4b0bd0b061459b..d83021f55a4780fbae095e22175b317a08332d9d 100644 --- a/src/libknot/yparser/yptrafo.h +++ b/src/libknot/yparser/yptrafo.h @@ -24,14 +24,14 @@ #pragma once -#include "libknot/yparser/ypscheme.h" +#include "libknot/yparser/ypschema.h" struct knot_lookup; /*! * Transforms textual item value to binary form. * - * \param[in] item Scheme item to transform. + * \param[in] item Schema item to transform. * \param[in] txt Value to transform. * \param[in] txt_len Value length. * \param[out] bin Output buffer. @@ -50,7 +50,7 @@ int yp_item_to_bin( /*! * Transforms binary item value to textual form. * - * \param[in] item Scheme item to transform. + * \param[in] item Schema item to transform. * \param[in] bin Value to transform. * \param[in] bin_len Value length. * \param[out] txt Output buffer. diff --git a/src/utils/keymgr/main.c b/src/utils/keymgr/main.c index 51844c6eceabf6005d96bdcc70a371dd92233b47..f9df017505df83fafefc48c118b96a7d740eb936 100644 --- a/src/utils/keymgr/main.c +++ b/src/utils/keymgr/main.c @@ -180,7 +180,7 @@ static bool init_conf(const char *confdb) } conf_t *new_conf = NULL; - int ret = conf_new(&new_conf, conf_scheme, confdb, flags); + int ret = conf_new(&new_conf, conf_schema, confdb, flags); if (ret != KNOT_EOK) { printf("Failed opening configuration database %s (%s)\n", (confdb == NULL ? "" : confdb), knot_strerror(ret)); diff --git a/src/utils/knotc/process.c b/src/utils/knotc/process.c index 29200e08546b7a913b61d094556f1322026bfcf3..6facd78cf21148fcce17bcc3f2563d5cf80e99f2 100644 --- a/src/utils/knotc/process.c +++ b/src/utils/knotc/process.c @@ -91,7 +91,7 @@ int set_config(const cmd_desc_t *desc, params_t *params) /* Open confdb. */ conf_t *new_conf = NULL; - int ret = conf_new(&new_conf, conf_scheme, params->confdb, conf_flags); + int ret = conf_new(&new_conf, conf_schema, params->confdb, conf_flags); if (ret != KNOT_EOK) { log_error("failed to open configuration database '%s' (%s)", (params->confdb != NULL) ? params->confdb : "", diff --git a/src/utils/knotd/main.c b/src/utils/knotd/main.c index c862ff116e30bd234f63b4b3b1c5aa1f21d6f497..4750acde346745b14e7531072225043a1ba888b7 100644 --- a/src/utils/knotd/main.c +++ b/src/utils/knotd/main.c @@ -343,7 +343,7 @@ static int set_config(const char *confdb, const char *config) /* Open confdb. */ conf_t *new_conf = NULL; - int ret = conf_new(&new_conf, conf_scheme, confdb, CONF_FREQMODULES); + int ret = conf_new(&new_conf, conf_schema, confdb, CONF_FREQMODULES); if (ret != KNOT_EOK) { log_fatal("failed to open configuration database '%s' (%s)", (confdb != NULL) ? confdb : "", knot_strerror(ret)); diff --git a/tests/.gitignore b/tests/.gitignore index 0a0f14914aacfc913e705f7d3f63fe5761779f18..99fba71ba2274e295e95936a198630975750e96b 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -35,7 +35,7 @@ /libknot/test_rrset-wire /libknot/test_tsig /libknot/test_yparser -/libknot/test_ypscheme +/libknot/test_ypschema /libknot/test_yptrafo /modules/test_onlinesign diff --git a/tests/Makefile.am b/tests/Makefile.am index 66418548b70a4697d1fdfa7796221b398636feb7..4e6343073a9c68068e393a3b40788a02130a23ef 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -46,7 +46,7 @@ check_PROGRAMS += \ libknot/test_rrset-wire \ libknot/test_tsig \ libknot/test_yparser \ - libknot/test_ypscheme \ + libknot/test_ypschema \ libknot/test_yptrafo check_PROGRAMS += \ diff --git a/tests/libknot/test_ypscheme.c b/tests/libknot/test_ypschema.c similarity index 88% rename from tests/libknot/test_ypscheme.c rename to tests/libknot/test_ypschema.c index cd2266611050feb30c66f6e4acab6de1ee27f557..50d56f6d455d66a42fd5433e0da1041315773968 100644 --- a/tests/libknot/test_ypscheme.c +++ b/tests/libknot/test_ypschema.c @@ -19,7 +19,7 @@ #include <string.h> #include <tap/basic.h> -#include "libknot/yparser/ypscheme.h" +#include "libknot/yparser/ypschema.h" #include "libknot/yparser/yptrafo.h" #include "libknot/libknot.h" @@ -56,7 +56,7 @@ static const knot_lookup_t opts[] = { { 0, NULL } }; -static const yp_item_t static_scheme[] = { +static const yp_item_t static_schema[] = { { C_OPT, YP_TOPT, YP_VOPT = { opts } }, { C_BOOL, YP_TBOOL, YP_VNONE }, { C_DNAME, YP_TDNAME, YP_VNONE }, @@ -67,38 +67,38 @@ static const yp_item_t static_scheme[] = { { NULL } }; -static void scheme_find_test(void) +static void schema_find_test(void) { - yp_item_t *scheme = NULL; + yp_item_t *schema = NULL; - int ret = yp_scheme_copy(&scheme, static_scheme); - is_int(KNOT_EOK, ret, "scheme copy"); + int ret = yp_schema_copy(&schema, static_schema); + is_int(KNOT_EOK, ret, "schema copy"); - const yp_item_t *i = yp_scheme_find(C_OPT, NULL, scheme); - ok(i != NULL, "scheme find"); + const yp_item_t *i = yp_schema_find(C_OPT, NULL, schema); + ok(i != NULL, "schema find"); if (i == NULL) { - goto error_scheme; + goto error_schema; } ok(strcmp(i->name + 1, C_OPT + 1) == 0, "name check"); - i = yp_scheme_find(C_STR, C_GRP, scheme); - ok(i != NULL, "scheme find with parent"); + i = yp_schema_find(C_STR, C_GRP, schema); + ok(i != NULL, "schema find with parent"); if (i == NULL) { - goto error_scheme; + goto error_schema; } ok(strcmp(i->name + 1, C_STR + 1) == 0, "name check"); - i = yp_scheme_find(C_ADDR, NULL, scheme); - ok(i == NULL, "scheme not find"); + i = yp_schema_find(C_ADDR, NULL, schema); + ok(i == NULL, "schema not find"); - i = yp_scheme_find(C_ADDR, C_GRP, scheme); - ok(i == NULL, "scheme not find with parent"); + i = yp_schema_find(C_ADDR, C_GRP, schema); + ok(i == NULL, "schema not find with parent"); -error_scheme: - yp_scheme_free(scheme); +error_schema: + yp_schema_free(schema); } -static void scheme_merge_test(void) +static void schema_merge_test(void) { static const yp_item_t items1[] = { { "\x01""1", YP_TSTR, YP_VNONE }, @@ -112,24 +112,24 @@ static void scheme_merge_test(void) { NULL } }; - yp_item_t *scheme = NULL; + yp_item_t *schema = NULL; yp_item_t *tmp = NULL; - int ret = yp_scheme_copy(&tmp, items1); - is_int(KNOT_EOK, ret, "scheme copy"); + int ret = yp_schema_copy(&tmp, items1); + is_int(KNOT_EOK, ret, "schema copy"); - ret = yp_scheme_merge(&scheme, items1, items2); - is_int(KNOT_EOK, ret, "scheme merge"); + ret = yp_schema_merge(&schema, items1, items2); + is_int(KNOT_EOK, ret, "schema merge"); - yp_scheme_free(tmp); + yp_schema_free(tmp); for (uint8_t i = 0; i < 4; i++) { yp_name_t name[3] = { '\x01', '1' + i }; - const yp_item_t *item = yp_scheme_find(name, NULL, scheme); - ok(item != NULL, "scheme find"); + const yp_item_t *item = yp_schema_find(name, NULL, schema); + ok(item != NULL, "schema find"); } - yp_scheme_free(scheme); + yp_schema_free(schema); } #define SET_INPUT_STR(str) \ @@ -139,7 +139,7 @@ static void scheme_merge_test(void) #define PARSER_CHECK(depth) \ ret = yp_parse(yp); \ is_int(KNOT_EOK, ret, "parse"); \ - ret = yp_scheme_check_parser(ctx, yp); \ + ret = yp_schema_check_parser(ctx, yp); \ is_int(KNOT_EOK, ret, "check parser"); \ node = &ctx->nodes[ctx->current]; \ parent = node->parent; \ @@ -148,25 +148,25 @@ static void scheme_merge_test(void) #define PARSER_RET_CHECK(code) \ ret = yp_parse(yp); \ is_int(KNOT_EOK, ret, "parse"); \ - ret = yp_scheme_check_parser(ctx, yp); \ + ret = yp_schema_check_parser(ctx, yp); \ ok(ret == code, "return check parser"); static void parser_test(void) { yp_parser_t yparser; yp_parser_t *yp = &yparser; - yp_item_t *scheme = NULL; + yp_item_t *schema = NULL; yp_check_ctx_t *ctx = NULL; yp_init(yp); - int ret = yp_scheme_copy(&scheme, static_scheme); - is_int(KNOT_EOK, ret, "scheme copy"); + int ret = yp_schema_copy(&schema, static_schema); + is_int(KNOT_EOK, ret, "schema copy"); if (ret != KNOT_EOK) { goto error_parser; } - ctx = yp_scheme_check_init(&scheme); + ctx = yp_schema_check_init(&schema); ok(ctx != NULL, "create check ctx"); if (ctx == NULL) { goto error_parser; @@ -270,34 +270,34 @@ static void parser_test(void) PARSER_RET_CHECK(KNOT_YP_ENOID); error_parser: - yp_scheme_check_deinit(ctx); - yp_scheme_free(scheme); + yp_schema_check_deinit(ctx); + yp_schema_free(schema); yp_deinit(yp); } #define STR_CHECK(depth, key0, key1, id, data) \ - ret = yp_scheme_check_str(ctx, key0, key1, id, data); \ + ret = yp_schema_check_str(ctx, key0, key1, id, data); \ is_int(KNOT_EOK, ret, "check str"); \ ok(ctx->current == depth, "depth check"); \ node = &ctx->nodes[ctx->current]; \ parent = node->parent; #define STR_RET_CHECK(code, key0, key1, id, data) \ - ret = yp_scheme_check_str(ctx, key0, key1, id, data); \ + ret = yp_schema_check_str(ctx, key0, key1, id, data); \ ok(ret == code, "return check str"); static void str_test(void) { - yp_item_t *scheme; + yp_item_t *schema; yp_check_ctx_t *ctx = NULL; - int ret = yp_scheme_copy(&scheme, static_scheme); - is_int(KNOT_EOK, ret, "scheme copy"); + int ret = yp_schema_copy(&schema, static_schema); + is_int(KNOT_EOK, ret, "schema copy"); if (ret != KNOT_EOK) { goto error_str; } - ctx = yp_scheme_check_init(&scheme); + ctx = yp_schema_check_init(&schema); ok(ctx != NULL, "create check ctx"); if (ctx == NULL) { goto error_str; @@ -400,16 +400,16 @@ static void str_test(void) STR_RET_CHECK(KNOT_YP_ENOTSUP_DATA, "multi-group", "id", "idval", "data"); error_str: - yp_scheme_check_deinit(ctx); - yp_scheme_free(scheme); + yp_schema_check_deinit(ctx); + yp_schema_free(schema); } int main(int argc, char *argv[]) { plan_lazy(); - scheme_find_test(); - scheme_merge_test(); + schema_find_test(); + schema_merge_test(); parser_test(); str_test(); diff --git a/tests/test_conf.h b/tests/test_conf.h index 739567a1b7514d70eaae3e9113c2588560c47884..3e5258b8778c8a2139991885d955aaaaf7d564dd 100644 --- a/tests/test_conf.h +++ b/tests/test_conf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> +/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,15 +20,15 @@ #include "libknot/errcode.h" /* Prepare server configuration. */ -static inline int test_conf(const char *conf_str, const yp_item_t *scheme) +static inline int test_conf(const char *conf_str, const yp_item_t *schema) { - // Use default scheme if not specified. - if (scheme == NULL) { - scheme = conf_scheme; + // Use default schema if not specified. + if (schema == NULL) { + schema = conf_schema; } conf_t *new_conf = NULL; - int ret = conf_new(&new_conf, scheme, NULL, CONF_FNONE); + int ret = conf_new(&new_conf, schema, NULL, CONF_FNONE); if (ret != KNOT_EOK) { return ret; } diff --git a/tests/test_confio.c b/tests/test_confio.c index e9f709a33309d7ec91323133f42faeffb1b6c870..0b22c6b558b0fb8c81b4834b2b412a73e09d9aaf 100644 --- a/tests/test_confio.c +++ b/tests/test_confio.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2016 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> +/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -955,7 +955,7 @@ static const yp_item_t desc_zone[] = { { NULL } }; -const yp_item_t test_scheme[] = { +const yp_item_t test_schema[] = { { C_SRV, YP_TGRP, YP_VGRP = { desc_server } }, { C_CTL, YP_TGRP, YP_VGRP = { desc_control } }, { C_RMT, YP_TGRP, YP_VGRP = { desc_remote }, YP_FMULTI, { check_remote } }, @@ -969,7 +969,7 @@ int main(int argc, char *argv[]) { plan_lazy(); - ok(test_conf("", test_scheme) == KNOT_EOK, "Prepare configuration"); + ok(test_conf("", test_schema) == KNOT_EOK, "Prepare configuration"); diag("conf_io_begin"); test_conf_io_begin(); diff --git a/tests/test_server.c b/tests/test_server.c index e9663674b9212f5509f2d40ec66e432cdf46f7a5..c1cc2ad8bab1fcfadb2f1b2eeecb9fe042b84583 100644 --- a/tests/test_server.c +++ b/tests/test_server.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> +/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,7 +31,7 @@ int main(int argc, char *argv[]) server_t server; int ret = 0; - /* Some random configuration just to apply the default conf scheme */ + /* Some random configuration just to apply the default conf schema */ ret = test_conf("", NULL); assert(ret == KNOT_EOK);