Report only the top 10 ports in exit-port stats.
[tor/rransom.git] / src / or / policies.h
blobdd46f4de9c4bfb2c09d5dac2173a4d0df8740e99
1 /* Copyright (c) 2001 Matej Pfajfar.
2 * Copyright (c) 2001-2004, Roger Dingledine.
3 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4 * Copyright (c) 2007-2010, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
7 /**
8 * \file policies.h
9 * \brief Header file for policies.c.
10 **/
12 #ifndef _TOR_POLICIES_H
13 #define _TOR_POLICIES_H
15 /* (length of "accept 255.255.255.255/255.255.255.255:65535-65535\n" plus a
16 * NUL.)
18 #define POLICY_BUF_LEN 52
20 int firewall_is_fascist_or(void);
21 int fascist_firewall_allows_address_or(const tor_addr_t *addr, uint16_t port);
22 int fascist_firewall_allows_or(routerinfo_t *ri);
23 int fascist_firewall_allows_address_dir(const tor_addr_t *addr, uint16_t port);
24 int dir_policy_permits_address(const tor_addr_t *addr);
25 int socks_policy_permits_address(const tor_addr_t *addr);
26 int authdir_policy_permits_address(uint32_t addr, uint16_t port);
27 int authdir_policy_valid_address(uint32_t addr, uint16_t port);
28 int authdir_policy_baddir_address(uint32_t addr, uint16_t port);
29 int authdir_policy_badexit_address(uint32_t addr, uint16_t port);
31 int validate_addr_policies(or_options_t *options, char **msg);
32 void policy_expand_private(smartlist_t **policy);
33 int policies_parse_from_options(or_options_t *options);
35 addr_policy_t *addr_policy_get_canonical_entry(addr_policy_t *ent);
36 int cmp_addr_policies(smartlist_t *a, smartlist_t *b);
37 addr_policy_result_t compare_tor_addr_to_addr_policy(const tor_addr_t *addr,
38 uint16_t port, const smartlist_t *policy);
39 addr_policy_result_t compare_addr_to_addr_policy(uint32_t addr,
40 uint16_t port, const smartlist_t *policy);
41 int policies_parse_exit_policy(config_line_t *cfg, smartlist_t **dest,
42 int rejectprivate, const char *local_address,
43 int add_default_policy);
44 void policies_set_router_exitpolicy_to_reject_all(routerinfo_t *exitrouter);
45 int exit_policy_is_general_exit(smartlist_t *policy);
46 int policy_is_reject_star(const smartlist_t *policy);
47 int getinfo_helper_policies(control_connection_t *conn,
48 const char *question, char **answer,
49 const char **errmsg);
50 int policy_write_item(char *buf, size_t buflen, addr_policy_t *item,
51 int format_for_desc);
53 void addr_policy_list_free(smartlist_t *p);
54 void addr_policy_free(addr_policy_t *p);
55 void policies_free_all(void);
57 char *policy_summarize(smartlist_t *policy);
59 #endif