[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Rename cross-format config.c stuff to config_* and or_optio...
Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv15481/src/or
Modified Files:
config.c control.c main.c or.h router.c test.c
Log Message:
Rename cross-format config.c stuff to config_* and or_options_t-specific stuff to option[s]_*
Index: config.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.373
retrieving revision 1.374
diff -u -d -r1.373 -r1.374
--- config.c 22 Jul 2005 21:12:10 -0000 1.373
+++ config.c 23 Jul 2005 01:58:05 -0000 1.374
@@ -371,7 +371,7 @@
return 0;
mark_logs_temp(); /* Close current logs once new logs are open. */
- if (config_init_logs(options, 0)<0) /* Configure the log(s) */
+ if (options_init_logs(options, 0)<0) /* Configure the log(s) */
return -1;
/* Close the temporary log we used while starting up, if it isn't already
@@ -741,7 +741,7 @@
/** Return true iff key is a valid configuration option. */
int
-config_option_is_recognized(const char *key)
+option_is_recognized(const char *key)
{
config_var_t *var = config_find_option(&config_format, key);
return (var != NULL);
@@ -749,7 +749,7 @@
/** Return the canonical name of a configuration option. */
const char *
-config_option_get_canonical_name(const char *key)
+option_get_canonical_name(const char *key)
{
config_var_t *var = config_find_option(&config_format, key);
return var->name;
@@ -758,7 +758,7 @@
/** Return a canonicalized list of the options assigned for key.
*/
config_line_t *
-config_get_assigned_option(or_options_t *options, const char *key)
+option_get_assignment(or_options_t *options, const char *key)
{
return get_assigned_option(&config_format, options, key);
}
@@ -904,7 +904,7 @@
* keys, -2 on bad values, -3 on bad transition.
*/
int
-config_trial_assign(config_line_t *list, int reset)
+options_trial_assign(config_line_t *list, int reset)
{
int r;
or_options_t *trial_options = options_dup(&config_format, get_options());
@@ -1300,7 +1300,7 @@
* include options that are the same as Tor's defaults.
*/
char *
-config_dump_options(or_options_t *options, int minimal)
+options_dump(or_options_t *options, int minimal)
{
return config_dump(&config_format, options, minimal);
}
@@ -1386,7 +1386,7 @@
config_line_append(&options->Logs, "Log", "notice stdout");
}
- if (config_init_logs(options, 1)<0) /* Validate the log(s) */
+ if (options_init_logs(options, 1)<0) /* Validate the log(s) */
return -1;
if (server_mode(options)) {
@@ -1672,7 +1672,7 @@
log_fn(LOG_WARN, "Error in Exit Policy entry.");
result = -1;
}
- config_append_default_exit_policy(&addr_policy);
+ options_append_default_exit_policy(&addr_policy);
if (server_mode(options)) {
exit_policy_implicitly_allows_local_networks(addr_policy, 1);
}
@@ -1853,7 +1853,7 @@
* validate them for consistency, then take actions based on them.
* Return 0 if success, -1 if failure. */
int
-init_from_config(int argc, char **argv)
+options_init_from_torrc(int argc, char **argv)
{
or_options_t *oldoptions, *newoptions;
config_line_t *cl;
@@ -2117,7 +2117,7 @@
* Initialize the logs based on the configuration file.
*/
int
-config_init_logs(or_options_t *options, int validate_only)
+options_init_logs(or_options_t *options, int validate_only)
{
config_line_t *opt;
int ok;
@@ -2277,7 +2277,7 @@
/** Add the default exit policy entries to <b>policy</b>
*/
void
-config_append_default_exit_policy(addr_policy_t **policy)
+options_append_default_exit_policy(addr_policy_t **policy)
{
config_line_t tmp;
addr_policy_t *ap;
@@ -2552,7 +2552,7 @@
}
}
- if (!(new_conf = config_dump_options(options, 1))) {
+ if (!(new_conf = options_dump(options, 1))) {
log_fn(LOG_WARN, "Couldn't get configuration string");
goto err;
}
@@ -2599,7 +2599,7 @@
* success, -1 on failure.
**/
int
-save_current_config(void)
+options_save_current(void)
{
char *fn;
if (config_fname) {
Index: control.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/control.c,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- control.c 22 Jul 2005 21:12:10 -0000 1.110
+++ control.c 23 Jul 2005 01:58:05 -0000 1.111
@@ -657,7 +657,7 @@
}
}
- if ((r=config_trial_assign(lines, 1)) < 0) {
+ if ((r=options_trial_assign(lines, 1)) < 0) {
log_fn(LOG_WARN,"Controller gave us config lines that didn't validate.");
if (r==-1) {
if (v0)
@@ -709,7 +709,7 @@
unrecognized = smartlist_create();
SMARTLIST_FOREACH(questions, char *, q,
{
- if (!config_option_is_recognized(q)) {
+ if (!option_is_recognized(q)) {
if (v0) {
send_control0_error(conn, ERR_UNRECOGNIZED_CONFIG_KEY, q);
goto done;
@@ -717,9 +717,9 @@
smartlist_add(unrecognized, q);
}
} else {
- config_line_t *answer = config_get_assigned_option(options,q);
+ config_line_t *answer = option_get_assignment(options,q);
if (!v0 && !answer) {
- const char *name = config_option_get_canonical_name(q);
+ const char *name = option_get_canonical_name(q);
size_t alen = strlen(name)+8;
char *astr = tor_malloc(alen);
tor_snprintf(astr, alen, "250-%s\r\n", name);
@@ -959,7 +959,7 @@
handle_control_saveconf(connection_t *conn, uint32_t len,
const char *body)
{
- if (save_current_config()<0) {
+ if (options_save_current()<0) {
if (STATE_IS_V0(conn->state))
send_control0_error(conn, ERR_INTERNAL,
"Unable to write configuration to disk.");
Index: main.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.529
retrieving revision 1.530
diff -u -d -r1.529 -r1.530
--- main.c 18 Jul 2005 19:16:17 -0000 1.529
+++ main.c 23 Jul 2005 01:58:05 -0000 1.530
@@ -911,7 +911,7 @@
addressmap_clear_transient();
/* first, reload config variables, in case they've changed */
/* no need to provide argc/v, they've been cached inside init_from_config */
- if (init_from_config(0, NULL) < 0) {
+ if (options_init_from_torrc(0, NULL) < 0) {
log_fn(LOG_ERR,"Reading config failed--see warnings above. For usage, try -h.");
return -1;
}
@@ -1303,7 +1303,7 @@
}
atexit(exit_function);
- if (init_from_config(argc,argv) < 0) {
+ if (options_init_from_torrc(argc,argv) < 0) {
log_fn(LOG_ERR,"Reading config failed--see warnings above. For usage, try -h.");
return -1;
}
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.630
retrieving revision 1.631
diff -u -d -r1.630 -r1.631
--- or.h 22 Jul 2005 21:12:10 -0000 1.630
+++ or.h 23 Jul 2005 01:58:05 -0000 1.631
@@ -1333,21 +1333,21 @@
int config_get_lines(char *string, config_line_t **result);
void config_free_lines(config_line_t *front);
-int config_trial_assign(config_line_t *list, int reset);
+int options_trial_assign(config_line_t *list, int reset);
int resolve_my_address(or_options_t *options, uint32_t *addr);
void options_init(or_options_t *options);
-int init_from_config(int argc, char **argv);
-int config_init_logs(or_options_t *options, int validate_only);
+int options_init_from_torrc(int argc, char **argv);
+int options_init_logs(or_options_t *options, int validate_only);
int config_parse_addr_policy(config_line_t *cfg,
addr_policy_t **dest);
-void config_append_default_exit_policy(addr_policy_t **policy);
+void options_append_default_exit_policy(addr_policy_t **policy);
void addr_policy_free(addr_policy_t *p);
-int config_option_is_recognized(const char *key);
-const char *config_option_get_canonical_name(const char *key);
-config_line_t *config_get_assigned_option(or_options_t *options,
- const char *key);
-char *config_dump_options(or_options_t *options, int minimal);
-int save_current_config(void);
+int option_is_recognized(const char *key);
+const char *option_get_canonical_name(const char *key);
+config_line_t *option_get_assignment(or_options_t *options,
+ const char *key);
+char *options_dump(or_options_t *options, int minimal);
+int options_save_current(void);
/********************************* connection.c ***************************/
Index: router.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/router.c,v
retrieving revision 1.183
retrieving revision 1.184
diff -u -d -r1.183 -r1.184
--- router.c 15 Jul 2005 18:49:35 -0000 1.183
+++ router.c 23 Jul 2005 01:58:05 -0000 1.184
@@ -752,7 +752,7 @@
ri->bandwidthrate = (int)options->MaxAdvertisedBandwidth;
config_parse_addr_policy(get_options()->ExitPolicy, &ri->exit_policy);
- config_append_default_exit_policy(&ri->exit_policy);
+ options_append_default_exit_policy(&ri->exit_policy);
if (desc_routerinfo) /* inherit values */
ri->is_verified = desc_routerinfo->is_verified;
Index: test.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/test.c,v
retrieving revision 1.187
retrieving revision 1.188
diff -u -d -r1.187 -r1.188
--- test.c 22 Jul 2005 21:12:10 -0000 1.187
+++ test.c 23 Jul 2005 01:58:05 -0000 1.188
@@ -1406,7 +1406,7 @@
/* Copied from router.c */
policy = NULL;
- config_append_default_exit_policy(&policy);
+ options_append_default_exit_policy(&policy);
test_assert(policy);
test_assert(!exit_policy_implicitly_allows_local_networks(policy, 1));