aboutsummaryrefslogtreecommitdiff
path: root/src/feature/dirparse/ns_parse.h
blob: 10a6f9cefce59367bfdd6cfaf3578863e77c4482 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* Copyright (c) 2001 Matej Pfajfar.
 * Copyright (c) 2001-2004, Roger Dingledine.
 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
 * Copyright (c) 2007-2019, The Tor Project, Inc. */
/* See LICENSE for licensing information */

/**
 * \file ns_parse.h
 * \brief Header file for ns_parse.c.
 **/

#ifndef TOR_NS_PARSE_H
#define TOR_NS_PARSE_H

int router_get_networkstatus_v3_hashes(const char *s,
                                       common_digests_t *digests);
int router_get_networkstatus_v3_signed_boundaries(const char *s,
                                                  const char **start_out,
                                                  const char **end_out);
int router_get_networkstatus_v3_sha3_as_signed(uint8_t *digest_out,
                                               const char *s);
int compare_vote_routerstatus_entries(const void **_a, const void **_b);

int networkstatus_verify_bw_weights(networkstatus_t *ns, int);
enum networkstatus_type_t;
networkstatus_t *networkstatus_parse_vote_from_string(const char *s,
                                           const char **eos_out,
                                           enum networkstatus_type_t ns_type);

#ifdef NS_PARSE_PRIVATE
STATIC int routerstatus_parse_guardfraction(const char *guardfraction_str,
                                            networkstatus_t *vote,
                                            vote_routerstatus_t *vote_rs,
                                            routerstatus_t *rs);
struct memarea_t;
STATIC routerstatus_t *routerstatus_parse_entry_from_string(
                                     struct memarea_t *area,
                                     const char **s, smartlist_t *tokens,
                                     networkstatus_t *vote,
                                     vote_routerstatus_t *vote_rs,
                                     int consensus_method,
                                     consensus_flavor_t flav);
#endif

#endif