Commit b68379b1 authored by Nick Mathewson's avatar Nick Mathewson 🌉
Browse files

Add DOCDOC entries for undocumented static and global variables.

svn:r17739
parent e5100bc6
......@@ -41,12 +41,13 @@ SKIP_FILES = [ "OpenBSD_malloc_Linux.c",
"aes.h" ]
# What names of things never need javadoc
SKIP_NAME_PATTERNS = [ r'^.*_c_id$' ]
SKIP_NAME_PATTERNS = [ r'^.*_c_id$',
r'^.*_H_ID$' ]
# Which types of things should get DOCDOC comments added if they are
# missing documentation? Recognized types are in KINDS below.
ADD_DOCDOCS_TO_TYPES = [ 'function', 'type', 'typedef' ]
# ADD_DOCDOCS_TO_TYPES += [ 'variable', 'define' ]
#ADD_DOCDOCS_TO_TYPES = [ 'function', 'type', 'typedef' ]
ADD_DOCDOCS_TO_TYPES = [ 'variable' ]
# ====================
# The rest of this should not need hacking.
......
......@@ -1829,7 +1829,9 @@ tor_get_thread_id(void)
return (unsigned long)GetCurrentThreadId();
}
#elif defined(USE_PTHREADS)
/* DOCDOC attr_reentrant */
static pthread_mutexattr_t attr_reentrant;
/* DOCDOC threads_initialized */
static int threads_initialized = 0;
/** Initialize <b>mutex</b> so it can be locked. Every mutex must be set
* up eith tor_mutex_init() or tor_mutex_new(); not both. */
......
......@@ -104,6 +104,7 @@ static tor_mutex_t *log_mutex = NULL;
/** Linked list of logfile_t. */
static logfile_t *logfiles = NULL;
#ifdef HAVE_SYSLOG_H
/* DOCDOC syslog_count */
static int syslog_count = 0;
#endif
......@@ -118,6 +119,7 @@ static int syslog_count = 0;
#endif
/* What's the lowest log level anybody cares about? */
/* DOCDOC _log_global_min_severity */
int _log_global_min_severity = LOG_NOTICE;
static void delete_log(logfile_t *victim);
......
......@@ -62,7 +62,9 @@ struct memarea_t {
};
#define MAX_FREELIST_LEN 4
/* DOCDOC freelist_len */
int freelist_len=0;
/* DOCDOC freelist */
static memarea_chunk_t *freelist = NULL;
/** Helper: allocate a new memarea chunk of around <b>chunk_size</b> bytes. */
......
......@@ -21,6 +21,7 @@
#define PRETTY_FUNCTION ""
#endif
/* DOCDOC have_failed */
extern int have_failed;
#define test_fail_msg(msg) \
......
......@@ -1054,8 +1054,10 @@ tor_timegm(struct tm *tm)
}
/* strftime is locale-specific, so we need to replace those parts */
/* DOCDOC WEEKDAY_NAMES */
static const char *WEEKDAY_NAMES[] =
{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
/* DOCDOC MONTH_NAMES */
static const char *MONTH_NAMES[] =
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
......@@ -1339,7 +1341,9 @@ update_approx_time(time_t now)
* have up to <b>ftime_slop</b> seconds of inaccuracy; IOW, our window of
* estimate for the current time is now + ftime_skew +/- ftime_slop.
*/
/* DOCDOC ftime_skew */
static int ftime_skew = 0;
/* DOCDOC ftime_slop */
static int ftime_slop = 60;
/** Set the largest amount of sloppiness we'll allow in fuzzy time
* comparisons. */
......
......@@ -22,11 +22,17 @@ const char command_c_id[] =
/** Keep statistics about how many of each type of cell we've received. */
uint64_t stats_n_padding_cells_processed = 0;
/* DOCDOC stats_n_create_cells_processed */
uint64_t stats_n_create_cells_processed = 0;
/* DOCDOC stats_n_created_cells_processed */
uint64_t stats_n_created_cells_processed = 0;
/* DOCDOC stats_n_relay_cells_processed */
uint64_t stats_n_relay_cells_processed = 0;
/* DOCDOC stats_n_destroy_cells_processed */
uint64_t stats_n_destroy_cells_processed = 0;
/* DOCDOC stats_n_versions_cells_processed */
uint64_t stats_n_versions_cells_processed = 0;
/* DOCDOC stats_n_netinfo_cells_processed */
uint64_t stats_n_netinfo_cells_processed = 0;
/* These are the main functions for processing cells */
......
......@@ -55,6 +55,7 @@ typedef struct config_abbrev_t {
#define PLURAL(tok) { #tok, #tok "s", 0, 0 }
/* A list of command-line abbreviations. */
/* DOCDOC _option_abbrevs */
static config_abbrev_t _option_abbrevs[] = {
PLURAL(ExitNode),
PLURAL(EntryNode),
......@@ -92,6 +93,7 @@ static config_abbrev_t _option_abbrevs[] = {
{ NULL, NULL, 0, 0},
};
/* A list of state-file abbreviations, for compatibility. */
/* DOCDOC _state_abbrevs */
static config_abbrev_t _state_abbrevs[] = {
{ "AccountingBytesReadInterval", "AccountingBytesReadInInterval", 0, 0 },
{ "HelperNode", "EntryGuard", 0, 0 },
......@@ -345,6 +347,7 @@ static config_var_t _option_vars[] = {
};
/* Keep defaults synchronous with man page and config value check. */
/* DOCDOC testing_tor_network_defaults */
static config_var_t testing_tor_network_defaults[] = {
V(ServerDNSAllowBrokenConfig, BOOL, "1"),
V(DirAllowPrivateAddresses, BOOL, "1"),
......@@ -369,6 +372,7 @@ static config_var_t testing_tor_network_defaults[] = {
#define VAR(name,conftype,member,initvalue) \
{ name, CONFIG_TYPE_ ## conftype, STRUCT_OFFSET(or_state_t, member), \
initvalue }
/* DOCDOC _state_vars */
static config_var_t _state_vars[] = {
V(AccountingBytesReadInInterval, MEMUNIT, NULL),
V(AccountingBytesWrittenInInterval, MEMUNIT, NULL),
......@@ -408,6 +412,7 @@ typedef struct config_var_description_t {
const char *description;
} config_var_description_t;
/* DOCDOC options_description */
static config_var_description_t options_description[] = {
/* ==== general options */
{ "AvoidDiskWrites", "If non-zero, try to write to disk less frequently than"
......@@ -579,6 +584,7 @@ static config_var_description_t options_description[] = {
{ NULL, NULL },
};
/* DOCDOC state_description */
static config_var_description_t state_description[] = {
{ "AccountingBytesReadInInterval",
"How many bytes have we read in this accounting period?" },
......@@ -808,8 +814,10 @@ set_options(or_options_t *new_val, char **msg)
return 0;
}
/* DOCDOC tor_svn_revision */
extern const char tor_svn_revision[]; /* from tor_main.c */
/* DOCDOC _version */
static char *_version = NULL;
/** Return the current Tor version, possibly */
......@@ -4609,6 +4617,7 @@ struct unit_table_t {
uint64_t multiplier;
};
/* DOCDOC memory_units */
static struct unit_table_t memory_units[] = {
{ "", 1 },
{ "b", 1<< 0 },
......@@ -4636,6 +4645,7 @@ static struct unit_table_t memory_units[] = {
{ NULL, 0 },
};
/* DOCDOC time_units */
static struct unit_table_t time_units[] = {
{ "", 1 },
{ "second", 1 },
......
......@@ -34,7 +34,9 @@ static int connection_process_inbuf(connection_t *conn, int package_partial);
static void client_check_address_changed(int sock);
static void set_constrained_socket_buffers(int sock, int size);
/* DOCDOC last_interface_ip */
static uint32_t last_interface_ip = 0;
/* DOCDOC outgoing_addrs */
static smartlist_t *outgoing_addrs = NULL;
/**************************************************************/
......
......@@ -54,7 +54,9 @@ const char control_c_id[] =
* list to find out.
**/
typedef uint32_t event_mask_t;
/* DOCDOC global_event_mask1long */
static event_mask_t global_event_mask1long = 0;
/* DOCDOC global_event_mask1short */
static event_mask_t global_event_mask1short = 0;
/** True iff we have disabled log messages from being sent to the controller */
......@@ -74,6 +76,7 @@ static int disable_log_messages = 0;
/** If true, we've set authentication_cookie to a secret code and
* stored it to disk. */
static int authentication_cookie_is_set = 0;
/* DOCDOC authentication_cookie */
static char authentication_cookie[AUTHENTICATION_COOKIE_LEN];
/** A sufficiently large size to record the last bootstrap phase string. */
......
......@@ -3268,15 +3268,19 @@ dir_networkstatus_download_failed(smartlist_t *failed, int status_code)
});
}
/* DOCDOC server_dl_schedule */
static const int server_dl_schedule[] = {
0, 0, 0, 60, 60, 60*2, 60*5, 60*15, INT_MAX
};
/* DOCDOC client_dl_schedule */
static const int client_dl_schedule[] = {
0, 0, 60, 60*5, 60*10, INT_MAX
};
/* DOCDOC server_consensus_dl_schedule */
static const int server_consensus_dl_schedule[] = {
0, 0, 60, 60*5, 60*10, 60*30, 60*30, 60*30, 60*30, 60*30, 60*60, 60*60*2
};
/* DOCDOC client_consensus_dl_schedule */
static const int client_consensus_dl_schedule[] = {
0, 0, 60, 60*5, 60*10, 60*30, 60*60, 60*60, 60*60, 60*60*3, 60*60*6, 60*60*12
};
......
......@@ -32,7 +32,9 @@ extern time_t time_of_process_start; /* from main.c */
/** Do we need to regenerate the directory when someone asks for it? */
static time_t the_directory_is_dirty = 1;
/* DOCDOC runningrouters_is_dirty */
static time_t runningrouters_is_dirty = 1;
/* DOCDOC the_v2_networkstatus_is_dirty */
static time_t the_v2_networkstatus_is_dirty = 1;
/** Most recently generated encoded signed v1 directory. (v1 auth dirservers
......@@ -1222,7 +1224,9 @@ directory_too_idle_to_fetch_descriptors(or_options_t *options, time_t now)
/* Used only by non-v1-auth dirservers: The v1 directory and
* runningrouters we'll serve when requested. */
/* DOCDOC cached_directory */
static cached_dir_t *cached_directory = NULL;
/* DOCDOC cached_runningrouters */
static cached_dir_t cached_runningrouters = { NULL, NULL, 0, 0, 0, -1 };
/** Used for other dirservers' v2 network statuses. Map from hexdigest to
......@@ -1637,15 +1641,25 @@ should_generate_v2_networkstatus(void)
* dirserv_compute_performance_thresholds, and used by
* generate_v2_networkstatus */
/* XXXX stick these all in a struct. */
/* DOCDOC stable_uptime */
static uint32_t stable_uptime = 0; /* start at a safe value */
/* DOCDOC stable_mtbf */
static double stable_mtbf = 0.0;
/* DOCDOC enough_mtbf_info */
static int enough_mtbf_info = 0;
/* DOCDOC guard_wfu */
static double guard_wfu = 0.0;
/* DOCDOC guard_tk */
static long guard_tk = 0;
/* DOCDOC fast_bandwidth */
static uint32_t fast_bandwidth = 0;
/* DOCDOC guard_bandwidth_including_exits */
static uint32_t guard_bandwidth_including_exits = 0;
/* DOCDOC guard_bandwidth_excluding_exits */
static uint32_t guard_bandwidth_excluding_exits = 0;
/* DOCDOC total_bandwidth */
static uint64_t total_bandwidth = 0;
/* DOCDOC total_exit_bandwidth */
static uint64_t total_exit_bandwidth = 0;
/** Helper: estimate the uptime of a router given its stated uptime and the
......
......@@ -106,7 +106,9 @@ static time_unit_t cfg_unit = UNIT_MONTH;
/** How many days,hours,minutes into each unit does our accounting interval
* start? */
static int cfg_start_day = 0;
/* DOCDOC cfg_start_hour */
static int cfg_start_hour = 0;
/* DOCDOC cfg_start_min */
static int cfg_start_min = 0;
static void reset_accounting(time_t now);
......
......@@ -54,6 +54,7 @@ static int stats_prev_global_write_bucket;
/* XXX we might want to keep stats about global_relayed_*_bucket too. Or not.*/
/** How many bytes have we read/written since we started the process? */
static uint64_t stats_n_bytes_read = 0;
/* DOCDOC stats_n_bytes_written */
static uint64_t stats_n_bytes_written = 0;
/** What time did this process start up? */
time_t time_of_process_start = 0;
......@@ -1860,6 +1861,7 @@ tor_init(int argc, char *argv[])
return 0;
}
/* DOCDOC lockfile */
static tor_lockfile_t *lockfile = NULL;
/** Try to grab the lock file described in <b>options</b>, if we do not
......
......@@ -39,8 +39,11 @@ static networkstatus_t *current_consensus = NULL;
/** A v3 consensus networkstatus that we've received, but which we don't
* have enough certificates to be happy about. */
static networkstatus_t *consensus_waiting_for_certs = NULL;
/* DOCDOC consensus_waiting_for_certs_body */
static char *consensus_waiting_for_certs_body = NULL;
/* DOCDOC consensus_waiting_for_certs_set_at */
static time_t consensus_waiting_for_certs_set_at = 0;
/* DOCDOC consensus_waiting_for_certs_dl_failed */
static int consensus_waiting_for_certs_dl_failed = 0;
/** The last time we tried to download a networkstatus, or 0 for "never". We
......
......@@ -1163,9 +1163,13 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
return 0; /* for forward compatibility, don't kill the circuit */
}
/* DOCDOC stats_n_data_cells_packaged */
uint64_t stats_n_data_cells_packaged = 0;
/* DOCDOC stats_n_data_bytes_packaged */
uint64_t stats_n_data_bytes_packaged = 0;
/* DOCDOC stats_n_data_cells_received */
uint64_t stats_n_data_cells_received = 0;
/* DOCDOC stats_n_data_bytes_received */
uint64_t stats_n_data_bytes_received = 0;
/** While conn->inbuf has an entire relay payload of bytes on it,
......@@ -1426,6 +1430,7 @@ circuit_consider_sending_sendme(circuit_t *circ, crypt_path_t *layer_hint)
/** The total number of cells we have allocated from the memory pool. */
static int total_cells_allocated = 0;
/* DOCDOC cell_pool */
static mp_pool_t *cell_pool = NULL;
/** Allocate structures to hold cells. */
......
......@@ -1263,7 +1263,9 @@ bw_array_new(void)
return b;
}
/* DOCDOC read_array */
static bw_array_t *read_array = NULL;
/* DOCDOC write_array */
static bw_array_t *write_array = NULL;
/** Set up read_array and write_array. */
......@@ -1731,16 +1733,27 @@ rep_hist_circbuilding_dormant(time_t now)
return 1;
}
/* DOCDOC n_signed_dir_objs */
static uint32_t n_signed_dir_objs = 0;
/* DOCDOC n_signed_routerdescs */
static uint32_t n_signed_routerdescs = 0;
/* DOCDOC n_verified_dir_objs */
static uint32_t n_verified_dir_objs = 0;
/* DOCDOC n_verified_routerdescs */
static uint32_t n_verified_routerdescs = 0;
/* DOCDOC n_onionskins_encrypted */
static uint32_t n_onionskins_encrypted = 0;
/* DOCDOC n_onionskins_decrypted */
static uint32_t n_onionskins_decrypted = 0;
/* DOCDOC n_tls_client_handshakes */
static uint32_t n_tls_client_handshakes = 0;
/* DOCDOC n_tls_server_handshakes */
static uint32_t n_tls_server_handshakes = 0;
/* DOCDOC n_rend_client_ops */
static uint32_t n_rend_client_ops = 0;
/* DOCDOC n_rend_mid_ops */
static uint32_t n_rend_mid_ops = 0;
/* DOCDOC n_rend_server_ops */
static uint32_t n_rend_server_ops = 0;
/** Increment the count of the number of times we've done <b>operation</b>. */
......@@ -1900,11 +1913,17 @@ typedef struct hs_usage_current_observation_period_t {
time_t start_of_next_period;
} hs_usage_current_observation_period_t;
/* DOCDOC current_period */
static hs_usage_current_observation_period_t *current_period = NULL;
/* DOCDOC publish_total */
static hs_usage_service_related_observation_t *publish_total = NULL;
/* DOCDOC publish_novel */
static hs_usage_service_related_observation_t *publish_novel = NULL;
/* DOCDOC fetch_total */
static hs_usage_service_related_observation_t *fetch_total = NULL;
/* DOCDOC fetch_successful */
static hs_usage_service_related_observation_t *fetch_successful = NULL;
/* DOCDOC descs */
static hs_usage_general_period_related_observations_t *descs = NULL;
/** Creates an empty ordered list element. */
......
......@@ -45,7 +45,9 @@ static crypto_pk_env_t *authority_signing_key = NULL;
* authorities. */
static authority_cert_t *authority_key_certificate = NULL;
/* DOCDOC legacy_signing_key */
static crypto_pk_env_t *legacy_signing_key = NULL;
/* DOCDOC legacy_key_certificate */
static authority_cert_t *legacy_key_certificate = NULL;
/* (Note that v3 authorities also have a separate "authority identity key",
......@@ -1604,6 +1606,7 @@ router_guess_address_from_dir_headers(uint32_t *guess)
return -1;
}
/* DOCDOC tor_svn_revision */
extern const char tor_svn_revision[]; /* from main.c */
/** Set <b>platform</b> (max length <b>len</b>) to a NUL-terminated short
......
......@@ -333,6 +333,7 @@ static token_rule_t dir_token_table[] = {
NO_ARGS, NEED_OBJ), \
T01("dir-address", K_DIR_ADDRESS, GE(1), NO_OBJ),
/* DOCDOC dir_key_certificate_table */
static token_rule_t dir_key_certificate_table[] = {
CERTIFICATE_MEMBERS
T1("fingerprint", K_FINGERPRINT, CONCAT_ARGS, NO_OBJ ),
......@@ -373,6 +374,7 @@ static token_rule_t client_keys_token_table[] = {
END_OF_TABLE
};
/* DOCDOC networkstatus_token_table */
static token_rule_t networkstatus_token_table[] = {
T1("network-status-version", K_NETWORK_STATUS_VERSION,
GE(1), NO_OBJ ),
......@@ -398,6 +400,7 @@ static token_rule_t networkstatus_token_table[] = {
END_OF_TABLE
};
/* DOCDOC networkstatus_consensus_token_table */
static token_rule_t networkstatus_consensus_token_table[] = {
T1("network-status-version", K_NETWORK_STATUS_VERSION,
GE(1), NO_OBJ ),
......@@ -429,6 +432,7 @@ static token_rule_t networkstatus_vote_footer_token_table[] = {
END_OF_TABLE
};
/* DOCDOC networkstatus_detached_signature_token_table */
static token_rule_t networkstatus_detached_signature_token_table[] = {
T1_START("consensus-digest", K_CONSENSUS_DIGEST, GE(1), NO_OBJ ),
T1("valid-after", K_VALID_AFTER, CONCAT_ARGS, NO_OBJ ),
......
......@@ -6,6 +6,7 @@
const char test_c_id[] =
"$Id$";
/* DOCDOC tor_svn_revision */
const char tor_svn_revision[] = "";
/**
......@@ -50,8 +51,10 @@ const char tor_svn_revision[] = "";
#include <openssl/crypto.h>
#endif
/* DOCDOC have_failed */
int have_failed = 0;
/* DOCDOC temp_dir */
static char temp_dir[256];
/** Select and create the temporary directory we'll use to run our unit tests.
......@@ -2257,17 +2260,25 @@ test_util_digestset(void)
}
/* stop threads running at once. */
/* DOCDOC _thread_test_mutex */
static tor_mutex_t *_thread_test_mutex = NULL;
/* make sure that threads have to run at the same time. */
/* DOCDOC _thread_test_start1 */
static tor_mutex_t *_thread_test_start1 = NULL;
/* DOCDOC _thread_test_start2 */
static tor_mutex_t *_thread_test_start2 = NULL;
/* DOCDOC _thread_test_strmap */
static strmap_t *_thread_test_strmap = NULL;
/* DOCDOC _thread1_name */
static char *_thread1_name = NULL;
/* DOCDOC _thread2_name */
static char *_thread2_name = NULL;
static void _thread_test_func(void* _s) ATTR_NORETURN;
/* DOCDOC t1_count */
static int t1_count = 0;
/* DOCDOC t2_count */
static int t2_count = 0;
/** Helper function for threading unit tests: This function runs in a
......@@ -2788,6 +2799,7 @@ test_onion_handshake(void)
crypto_free_pk_env(pk);
}
/* DOCDOC fingerprint_list */
extern smartlist_t *fingerprint_list;
/** Run unit tests for router descriptor generation logic. */
......@@ -3140,11 +3152,17 @@ test_dirutil(void)
smartlist_free(sl);
}
/* DOCDOC AUTHORITY_CERT_1 */
extern const char AUTHORITY_CERT_1[];
/* DOCDOC AUTHORITY_SIGNKEY_1 */
extern const char AUTHORITY_SIGNKEY_1[];
/* DOCDOC AUTHORITY_CERT_2 */
extern const char AUTHORITY_CERT_2[];
/* DOCDOC AUTHORITY_SIGNKEY_2 */
extern const char AUTHORITY_SIGNKEY_2[];
/* DOCDOC AUTHORITY_CERT_3 */
extern const char AUTHORITY_CERT_3[];
/* DOCDOC AUTHORITY_SIGNKEY_3 */
extern const char AUTHORITY_SIGNKEY_3[];
/** Helper: Test that two networkstatus_voter_info_t do in fact represent the
......@@ -4597,6 +4615,7 @@ static struct {
int is_subent;
int selected;
int is_default;
/* DOCDOC test_array */
} test_array[] = {
ENT(buffers),
ENT(crypto),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment