Back to index

tor  0.2.3.18-rc
networkstatus.h
Go to the documentation of this file.
00001 /* Copyright (c) 2001 Matej Pfajfar.
00002  * Copyright (c) 2001-2004, Roger Dingledine.
00003  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
00004  * Copyright (c) 2007-2012, The Tor Project, Inc. */
00005 /* See LICENSE for licensing information */
00006 
00012 #ifndef _TOR_NETWORKSTATUS_H
00013 #define _TOR_NETWORKSTATUS_H
00014 
00017 #define MAX_NETWORKSTATUS_AGE (10*24*60*60)
00018 
00019 void networkstatus_reset_warnings(void);
00020 void networkstatus_reset_download_failures(void);
00021 int router_reload_v2_networkstatus(void);
00022 int router_reload_consensus_networkstatus(void);
00023 void routerstatus_free(routerstatus_t *rs);
00024 void networkstatus_v2_free(networkstatus_v2_t *ns);
00025 void networkstatus_vote_free(networkstatus_t *ns);
00026 networkstatus_voter_info_t *networkstatus_get_voter_by_id(
00027                                        networkstatus_t *vote,
00028                                        const char *identity);
00029 int networkstatus_check_consensus_signature(networkstatus_t *consensus,
00030                                             int warn);
00031 int networkstatus_check_document_signature(const networkstatus_t *consensus,
00032                                            document_signature_t *sig,
00033                                            const authority_cert_t *cert);
00034 char *networkstatus_get_cache_filename(const char *identity_digest);
00035 int router_set_networkstatus_v2(const char *s, time_t arrived_at,
00036                              v2_networkstatus_source_t source,
00037                              smartlist_t *requested_fingerprints);
00038 void networkstatus_v2_list_clean(time_t now);
00039 int compare_digest_to_routerstatus_entry(const void *_key,
00040                                          const void **_member);
00041 const routerstatus_t *networkstatus_v2_find_entry(networkstatus_v2_t *ns,
00042                                          const char *digest);
00043 const routerstatus_t *networkstatus_vote_find_entry(networkstatus_t *ns,
00044                                               const char *digest);
00045 routerstatus_t *networkstatus_v2_find_mutable_entry(networkstatus_v2_t *ns,
00046                                         const char *digest);
00047 routerstatus_t *networkstatus_vote_find_mutable_entry(networkstatus_t *ns,
00048                                               const char *digest);
00049 int networkstatus_vote_find_entry_idx(networkstatus_t *ns,
00050                                       const char *digest, int *found_out);
00051 const smartlist_t *networkstatus_get_v2_list(void);
00052 download_status_t *router_get_dl_status_by_descriptor_digest(const char *d);
00053 const routerstatus_t *router_get_consensus_status_by_id(const char *digest);
00054 routerstatus_t *router_get_mutable_consensus_status_by_id(
00055                                    const char *digest);
00056 const routerstatus_t *router_get_consensus_status_by_descriptor_digest(
00057                                    networkstatus_t *consensus,
00058                                    const char *digest);
00059 routerstatus_t *router_get_mutable_consensus_status_by_descriptor_digest(
00060                                    networkstatus_t *consensus,
00061                                    const char *digest);
00062 const routerstatus_t *router_get_consensus_status_by_nickname(
00063                                    const char *nickname,
00064                                    int warn_if_unnamed);
00065 const char *networkstatus_get_router_digest_by_nickname(const char *nickname);
00066 int networkstatus_nickname_is_unnamed(const char *nickname);
00067 void networkstatus_consensus_download_failed(int status_code,
00068                                              const char *flavname);
00069 void update_consensus_networkstatus_fetch_time(time_t now);
00070 int should_delay_dir_fetches(const or_options_t *options);
00071 void update_networkstatus_downloads(time_t now);
00072 void update_certificate_downloads(time_t now);
00073 int consensus_is_waiting_for_certs(void);
00074 networkstatus_v2_t *networkstatus_v2_get_by_digest(const char *digest);
00075 networkstatus_t *networkstatus_get_latest_consensus(void);
00076 networkstatus_t *networkstatus_get_latest_consensus_by_flavor(
00077                                                   consensus_flavor_t f);
00078 networkstatus_t *networkstatus_get_live_consensus(time_t now);
00079 networkstatus_t *networkstatus_get_reasonably_live_consensus(time_t now,
00080                                                              int flavor);
00081 #define NSSET_FROM_CACHE 1
00082 #define NSSET_WAS_WAITING_FOR_CERTS 2
00083 #define NSSET_DONT_DOWNLOAD_CERTS 4
00084 #define NSSET_ACCEPT_OBSOLETE 8
00085 #define NSSET_REQUIRE_FLAVOR 16
00086 int networkstatus_set_current_consensus(const char *consensus,
00087                                         const char *flavor,
00088                                         unsigned flags);
00089 void networkstatus_note_certs_arrived(void);
00090 void routers_update_all_from_networkstatus(time_t now, int dir_version);
00091 void routers_update_status_from_consensus_networkstatus(smartlist_t *routers,
00092                                                         int reset_failures);
00093 void signed_descs_update_status_from_consensus_networkstatus(
00094                                                          smartlist_t *descs);
00095 
00096 char *networkstatus_getinfo_helper_single(const routerstatus_t *rs);
00097 char *networkstatus_getinfo_by_purpose(const char *purpose_string, time_t now);
00098 void networkstatus_dump_bridge_status_to_file(time_t now);
00099 int32_t networkstatus_get_param(const networkstatus_t *ns,
00100                                 const char *param_name,
00101                                 int32_t default_val, int32_t min_val,
00102                                 int32_t max_val);
00103 int getinfo_helper_networkstatus(control_connection_t *conn,
00104                                  const char *question, char **answer,
00105                                  const char **errmsg);
00106 int32_t networkstatus_get_bw_weight(networkstatus_t *ns, const char *weight,
00107                                     int32_t default_val);
00108 const char *networkstatus_get_flavor_name(consensus_flavor_t flav);
00109 int networkstatus_parse_flavor_name(const char *flavname);
00110 void document_signature_free(document_signature_t *sig);
00111 document_signature_t *document_signature_dup(const document_signature_t *sig);
00112 void networkstatus_free_all(void);
00113 
00114 #endif
00115