Commit Graph

278 Commits

Author SHA1 Message Date
Nick Mathewson a90d1918af Update #includes to point to confparse.h in its new location.
This commit was automatically generated by running
scripts/maint/rectify_include_paths.py .
2019-09-11 10:17:20 -04:00
Nick Mathewson 87ca9e4d2a Move confparse.[ch] into src/lib/confmgt/
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-11 10:16:10 -04:00
David Goulet 41261c3b5c Merge branch 'tor-github/pr/1296' 2019-09-11 09:42:31 -04:00
Nick Mathewson 478141e617 Document inconsistent usage of config_var_is_listable()
See also ticket 31654.
2019-09-11 09:42:19 -04:00
Nick Mathewson fe5033d3b0 Clarify documentation on config_var_is_listable()
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-11 09:42:19 -04:00
Nick Mathewson 0d6d96396c Remove all CVFLAG_* usage. 2019-09-11 09:42:19 -04:00
Nick Mathewson 9b571d4729 confparse, conftypes: Replace flags with their new names.
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-11 09:42:19 -04:00
Nick Mathewson 1b3b6d9f2d Replace low-level {var_type,struct_var}_is_*() with flag inspection
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-11 09:42:19 -04:00
Nick Mathewson 7171ce2a2a config: make config_var_is_dumpable static. 2019-09-11 09:42:19 -04:00
Nick Mathewson 8d685aee7c config: rename "contained" to "derived", and explain it better.
Don't use "derived" directly, but check its implications for listing
and copying.
2019-09-11 09:42:19 -04:00
Nick Mathewson 668e3a7709 config: Introduce the concept of an "ungettable" variable.
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-11 09:42:19 -04:00
Nick Mathewson 3bf38ffff5 Document config_var_is_dumpable and config_var_is_settable. 2019-09-11 09:42:19 -04:00
teor 39c7f46d36 main: add some newlines to the subsystem list, for readability 2019-09-10 09:06:36 +10:00
teor 5fa75a6cd4 main: remove level number comments from the subsystem list (master)
Part of 31615.
2019-09-10 09:04:38 +10:00
teor 987768b077 Merge branch 'bug31615_041' into bug31615_master
Merged modified lines from bug31615_041, and unmodified lines
from master.
2019-09-10 09:03:37 +10:00
teor f1c57cd1e5 main: remove level number comments from the subsystem list (0.4.1)
Part of 31615.
2019-09-10 08:44:35 +10:00
teor 7e22d99346 Merge branch 'bug31615_040' into bug31615_041
Merged modified lines from bug31615_040, and unmodified lines
from maint-0.4.1.
2019-09-10 08:43:13 +10:00
teor 2e2a35b694 main: remove level number comments from the subsystem list (0.4.0)
These levels get out of date really easily: we'll implement a level
dump command in tor in 31614.

They also cause conflicts and inconsistencies when merging forward
level changes.

Part of 31615.
2019-09-10 08:35:56 +10:00
Nick Mathewson a642a4cbd7 Merge branch 'ticket30924_042_04_squashed' into ticket30924_042_04_squashed_merged 2019-09-09 11:10:53 -04:00
Nick Mathewson 16cf9424c1 config: Invert sense of _is_invisible, and rename to is_listable() 2019-09-05 11:32:32 -04:00
Nick Mathewson 22e7d33735 config: replace config_var_is_cumulative with is_replaced_on_set()
This change replaces the higher-level property check to match our
intended flag factoring.
2019-09-05 11:32:32 -04:00
George Kadianakis ddd01541b9 Merge branch 'tor-github/pr/1294' 2019-09-05 17:12:19 +03:00
George Kadianakis c750ec20ab Merge branch 'tor-github/pr/1291' 2019-09-05 17:09:20 +03:00
Nick Mathewson eb909c4e43 config: note that some arguments are required. 2019-09-05 07:57:36 -04:00
Nick Mathewson 3db56aeeb8 Document warn_deprecated_option(). 2019-09-04 14:23:19 -04:00
Nick Mathewson 39316da9b6 Document return value of config_mgr_add_format(). 2019-09-04 14:23:19 -04:00
Nick Mathewson 39dd2e2aa8 Document validate_fn_t as it stands.
Also document that it will be changed in a later branch.
2019-09-04 14:23:19 -04:00
Nick Mathewson aeda598fd5 config_assign: Document CAL_* options.
These were sort of described in config_assign() documentation, but
not so well.
2019-09-04 14:23:19 -04:00
Nick Mathewson 577ea20b3a Document configuration and abbreviation types. 2019-09-04 14:23:19 -04:00
Nick Mathewson 870874fec8 config: Make CLEAR with a nonempty value into a nonfatal assertion.
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-09-04 11:28:21 -04:00
Nick Mathewson 539158f2be config: use ptrdiff_t for all field-offset members.
Previously we used int here, but it is more correct to use
ptrdiff_t.  (This never actually matters for our code in practice,
since the structure we are managing here never exceed INT_MAX in
size.)
2019-09-04 10:50:09 -04:00
teor a52a5e0099 Merge branch 'maint-0.3.5' into maint-0.4.0 2019-08-30 23:33:01 +10:00
teor 4662cbec7b Merge remote-tracking branch 'tor-github/pr/1114' into maint-0.3.5 2019-08-30 23:20:59 +10:00
Nick Mathewson c281fa0da2 Describe clear_cfg_fn_t better. 2019-08-29 09:14:51 -04:00
Nick Mathewson b1d7ddfb02 Merge branch 'ticket31240v2' into ticket31240v2_merged_2 2019-08-28 09:46:59 -04:00
Nick Mathewson 577e628743 Fix typo in a comment on config_mgr_get_obj_mutable() 2019-08-28 09:42:17 -04:00
Nick Mathewson 8db3859cc6 Simple tests for nested configuration formats
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-28 09:42:17 -04:00
Nick Mathewson cb5f8ace79 Tests for config_find_option_name()
Fix a bug in config_find_option_name() where it did not consider
the abbreviations table.
2019-08-28 09:42:17 -04:00
Nick Mathewson aa3f0c4788 Add tests for variable-listing functions.
This discovered a bug related to an extra & in
config_mgr_list_deprecated_vars(): fix that.
2019-08-28 09:42:17 -04:00
Nick Mathewson 380d3ee168 Better explain config_clear_fn_t 2019-08-28 09:42:17 -04:00
Nick Mathewson 06da2c0d28 Document or_state_t.substates_ 2019-08-28 09:42:17 -04:00
Nick Mathewson 3af1cee6d9 Document or_options_t.subconfigs_ 2019-08-28 09:42:17 -04:00
Nick Mathewson 12d980027a document return lifespans for config_mgr_list_vars() 2019-08-28 09:42:17 -04:00
Nick Mathewson 9cfc811c37 Fix typo in comment about FallbackDir handling 2019-08-28 09:42:17 -04:00
Nick Mathewson 3a530ae535 Document types for config_get_changes() 2019-08-28 09:42:17 -04:00
Nick Mathewson 760d0c056f finish a comment explaining all_abbrevs 2019-08-28 09:42:17 -04:00
Nick Mathewson 638e58379a Partial support for multiplicity in configuration objects
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-28 09:40:53 -04:00
Nick Mathewson 38b770bbbb Make a config_suite_t type to hold multiple config sub-objects
Right now, it doesn't do anything; this patch is meant to make sure
that we're doing memory management correctly.
2019-08-28 09:40:53 -04:00
Nick Mathewson 47654d3249 Refactor config free logic to use a single path.
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-28 09:40:53 -04:00
Nick Mathewson 3d1f9f583a Use special magic to enforce manager/object connection.
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-28 09:40:46 -04:00