summaryrefslogtreecommitdiff
path: root/src/app/config/confparse.c
AgeCommit message (Collapse)Author
2019-09-11Move confparse.[ch] into src/lib/confmgt/Nick Mathewson
This commit only does code movement, and does not clean up after itself. As such, it will break compilation. I'm separating it for ease of review.
2019-09-11Document inconsistent usage of config_var_is_listable()Nick Mathewson
See also ticket 31654.
2019-09-11Clarify documentation on config_var_is_listable()Nick Mathewson
Here we make it clear we're only looking at listable variable names, not at whether the variables themselves are gettable. Also, remove an extraneous h. (This commit is not a fixup, because of rebase conflicts.)
2019-09-11confparse, conftypes: Replace flags with their new names.Nick Mathewson
The old names remain as #defines that cause variables to get one or more flags. Now every flag-testing function in confparse.c tests exactly one flag.
2019-09-11Replace low-level {var_type,struct_var}_is_*() with flag inspectionNick Mathewson
Since the flags are now stored with compatible numbering, we can just OR them together and see whether the flag we want is in the result. (Net code removal!)
2019-09-11config: make config_var_is_dumpable static.Nick Mathewson
2019-09-11config: rename "contained" to "derived", and explain it better.Nick Mathewson
Don't use "derived" directly, but check its implications for listing and copying.
2019-09-11config: Introduce the concept of an "ungettable" variable.Nick Mathewson
We had though to make all obsolete and invisible variables ungettable, so that GETCONF would reject them. But it turns out that this isn't the current behavior of GETCONF with those variables. So for now, I'm leaving the current behavior unchanged. (See ticket 31647 for a proposal to change the behavior.)
2019-09-11Document config_var_is_dumpable and config_var_is_settable.Nick Mathewson
2019-09-05config: Invert sense of _is_invisible, and rename to is_listable()Nick Mathewson
2019-09-05config: replace config_var_is_cumulative with is_replaced_on_set()Nick Mathewson
This change replaces the higher-level property check to match our intended flag factoring.
2019-09-05Merge branch 'tor-github/pr/1294'George Kadianakis
2019-09-05config: note that some arguments are required.Nick Mathewson
2019-09-04Document warn_deprecated_option().Nick Mathewson
2019-09-04Document return value of config_mgr_add_format().Nick Mathewson
2019-09-04config: Make CLEAR with a nonempty value into a nonfatal assertion.Nick Mathewson
When we parse a CLEAR line (e.g., "/OrPort" or /OrPort blah blah"), we always suppress the value, even if one exists. That means that the block of code was meant to handle CLEAR lines didn't actually do anything, since we previously handled them the same way as with other empty values. Closes ticket 31529.
2019-08-28Merge branch 'ticket31240v2' into ticket31240v2_merged_2Nick Mathewson
2019-08-28Fix typo in a comment on config_mgr_get_obj_mutable()Nick Mathewson
2019-08-28Simple tests for nested configuration formatsNick Mathewson
One test makes sure that the toplevel magic numbers are distinct. One test makes sure that we can parse a configuration object with two sub-objects.
2019-08-28Tests for config_find_option_name()Nick Mathewson
Fix a bug in config_find_option_name() where it did not consider the abbreviations table.
2019-08-28Add tests for variable-listing functions.Nick Mathewson
This discovered a bug related to an extra & in config_mgr_list_deprecated_vars(): fix that.
2019-08-28document return lifespans for config_mgr_list_vars()Nick Mathewson
2019-08-28Document types for config_get_changes()Nick Mathewson
2019-08-28finish a comment explaining all_abbrevsNick Mathewson
2019-08-28Partial support for multiplicity in configuration objectsNick Mathewson
A configuration manager, in addition to a top-level format object, may now also know about a suite of sub-formats. Top-level configuration objects, in turn, may now have a suite of sub-objects.
2019-08-28Make a config_suite_t type to hold multiple config sub-objectsNick Mathewson
Right now, it doesn't do anything; this patch is meant to make sure that we're doing memory management correctly.
2019-08-28Refactor config free logic to use a single path.Nick Mathewson
The right way to free a config object is now to wrap config_free(), always. Instead of creating an alternative free function, objects should provide an alternative clear callback to free any fields that the configuration manager doesn't manage. This lets us simplify our code a little, and lets us extend the confparse.c code to manage additional fields in config_free.
2019-08-28Use special magic to enforce manager/object connection.Nick Mathewson
Every time we finalize a config manager, we now generate a new magic number for it, so that we'll get an assertion failure if we ever try to use an object with a different configuration manager than the one that generated it.
2019-08-24Make a function for NODUMP.Nick Mathewson
2019-08-24Make config_var_is_invisible a function.Nick Mathewson
2019-07-24Remove src/core/ and src/feature dependencies from confparse.cNick Mathewson
This C file will eventually belong in lib/confmgt, so it needs to have only low-level dependencies. Now that it no longers needs routerset.c, we can adjust its includes accordingly. I'm not moving the file yet, since it would make fixup commits on earlier branches here really hard to do.
2019-07-24Sort variables in config_mgr_t.all_vars alphabeticallyNick Mathewson
2019-07-24Make config_var and config_fmt const.Nick Mathewson
Now that we have a reasonable implementation for overriding the default options for TestingTorNetwork, we don't need to modify config_var_t structs any more. And therefore, we can have constant format options, like reasonable people.
2019-07-24Add a "freeze" function for config_mgr_t objects.Nick Mathewson
It's important to make sure that we don't change a config_mgr_t after we start using it to make objects, or we could get into inconsistent states. This feature is the start of a safety mechanism to prevent this problem.
2019-07-24Change CONFIG_CHECK() macro to not need a config_format_tNick Mathewson
We'll want it to check all the subsidiary structures of the options object.
2019-07-24Fix every place in config.c that knew about option_vars_.Nick Mathewson
Iterating over this array was once a good idea, but now that we are going to have a separate structure for each submodule's configuration variables, we should indirect through the config_mgr_t object.
2019-07-24Lower responsibility for listing changed options into confparse.cNick Mathewson
2019-07-24Replace config_find_option with a variant that exposes lessNick Mathewson
2019-07-24Start teaching config_mgr_t to handle sub-objects and sub-formatsNick Mathewson
The eventual design here will be that multiple config_format_t objects get registered with a single config_mgr_t. That config_mgr_t manages a "top-level" object, which has a pointer to the other objects. I had earlier thought of a different design, where there would be no top-level object, and config_mgr_t would deal with a container instead. But this would require a bunch of invasive refactoring that I don't think we should do just yet.
2019-07-24Add a config_mgr_t type to wrap config_format_tNick Mathewson
Remember that our goal in the present refactoring is to allow each subsystem to declare its own configuration structure and variables. To do this, each module will get its own config_format_t, and so we'll want a different structure that wraps several config_format_t objects. This is a "config_mgr_t".
2019-06-25Make "invisibility" and "undumpability" properties of variables.Nick Mathewson
Previously, these were magical things that we detected by checking whether a variable's name was prefixed with two or three underscores.
2019-06-25Turn several properties of types or variables into flags.Nick Mathewson
"unsettable" is a property of types. LINELIST_V and OBSOLETE are unsettable, meaning that they cannot be set by name. "contained" is a property of types. I'm hoping to find a better name here. LINELIST_S is "contained" because it always appears within a LINELIST_V, and as such doesn't need to be dumped ore copied independently. "cumulative" is a property of types. Cumulative types can appear more than once in a torrc without causing a warning, because they add to each other rather than replacing each other. "obsolete" is a property of variables. "marking fragile" is now a command that struct members can accept. With these changes, confparse and config no longer ever need to mention CONFIG_TYPE_XYZ values by name.
2019-06-25Add a function to make sure all values in a config object are okNick Mathewson
2019-06-25Use struct_var_{copy,eq} in confparse.c.Nick Mathewson
2019-06-25Use struct_magic_decl to verify magic numbers in config objectsNick Mathewson
2019-06-25Port confparse to use struct_var in place of typed_var.Nick Mathewson
This requires changes to config_var_t, causing corresponding changes throughout its users.
2019-06-24Partially port routerset to being a full-fledged config type again.Nick Mathewson
2019-06-24Add a "typed_var" abstraction to implement lvalue access in C.Nick Mathewson
Right now, this has been done at a high level by confparse.c, but it makes more sense to lower it. This API is radically un-typesafe as it stands; we'll be wrapping it in a safer API as we do #30914 and lower the struct manipulation code as well. Closes ticket 30864.
2019-06-24Move unit-parsing code to src/lib/confmgtNick Mathewson
lib/confmgt is at a higher level than lib/conf, since it needs to call down to logging and similar modules.
2019-06-15Merge branch 'bug30894_035' into ticket30893Nick Mathewson