diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-10-30 10:29:43 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-11-07 07:28:43 -0500 |
commit | 52c0ab4af3ec152c4b78669acf8877ca27d66097 (patch) | |
tree | e8dc14ad0834731fd746bc22d462aae1db18ed3b /src/lib/subsys | |
parent | 7ac4f9d5ec1b31a0d4b76ab62c1afc039c8fe627 (diff) | |
download | tor-52c0ab4af3ec152c4b78669acf8877ca27d66097.tar.gz tor-52c0ab4af3ec152c4b78669acf8877ca27d66097.zip |
Add subsys functions for receiving/flushing states and options.
These functions are in the subsystem, not in the config_format_t,
since they are about how the format is _used_, not about _what it
is_.
Diffstat (limited to 'src/lib/subsys')
-rw-r--r-- | src/lib/subsys/subsys.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/lib/subsys/subsys.h b/src/lib/subsys/subsys.h index 1cb3fe94a5..29a90c049d 100644 --- a/src/lib/subsys/subsys.h +++ b/src/lib/subsys/subsys.h @@ -101,6 +101,35 @@ typedef struct subsys_fns_t { **/ const struct config_format_t *state_format; + /** + * Receive an options object as defined by options_format. Return 0 + * on success, -1 on failure. + * + * It is safe to store the pointer to the object until set_options() + * is called again. */ + int (*set_options)(void *); + + /* XXXX Add an implementation for options_act_reversible() later in this + * branch. */ + + /** + * Receive a state object as defined by state_format. Return 0 on success, + * -1 on failure. + * + * It is safe to store the pointer to the object; set_state() is only + * called on startup. + **/ + int (*set_state)(void *); + + /** + * Update any information that needs to be stored in the provided state + * object (as defined by state_format). Return 0 on success, -1 on failure. + * + * The object provided here will be the same one as provided earlier to + * set_state(). This method is called when we are about to save the state + * to disk. + **/ + int (*flush_state)(void *); } subsys_fns_t; /** |