aboutsummaryrefslogtreecommitdiff
path: root/src/or/policies.h
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2010-07-23 20:51:25 +0200
committerSebastian Hahn <sebastian@torproject.org>2010-07-27 10:00:45 +0200
commit7bd8dee46371063cd1e62661cd65ce9a35e776e5 (patch)
treec1e66c6bfaebfb28ebe4ba885235eff6d5515ae3 /src/or/policies.h
parentf6852fe031e066f46337ea936a40e3e2720bc5ad (diff)
downloadtor-7bd8dee46371063cd1e62661cd65ce9a35e776e5.tar.gz
tor-7bd8dee46371063cd1e62661cd65ce9a35e776e5.zip
Create policies.h
Diffstat (limited to 'src/or/policies.h')
-rw-r--r--src/or/policies.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/or/policies.h b/src/or/policies.h
new file mode 100644
index 0000000000..b99ee797f7
--- /dev/null
+++ b/src/or/policies.h
@@ -0,0 +1,60 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2010, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file policies.h
+ * \brief Header file for policy.c.
+ **/
+
+#ifndef _TOR_POLICIES_H
+#define _TOR_POLICIES_H
+
+/* (length of "accept 255.255.255.255/255.255.255.255:65535-65535\n" plus a
+ * NUL.)
+ */
+#define POLICY_BUF_LEN 52
+
+int firewall_is_fascist_or(void);
+int fascist_firewall_allows_address_or(const tor_addr_t *addr, uint16_t port);
+int fascist_firewall_allows_or(routerinfo_t *ri);
+int fascist_firewall_allows_address_dir(const tor_addr_t *addr, uint16_t port);
+int dir_policy_permits_address(const tor_addr_t *addr);
+int socks_policy_permits_address(const tor_addr_t *addr);
+int authdir_policy_permits_address(uint32_t addr, uint16_t port);
+int authdir_policy_valid_address(uint32_t addr, uint16_t port);
+int authdir_policy_baddir_address(uint32_t addr, uint16_t port);
+int authdir_policy_badexit_address(uint32_t addr, uint16_t port);
+
+int validate_addr_policies(or_options_t *options, char **msg);
+void policy_expand_private(smartlist_t **policy);
+int policies_parse_from_options(or_options_t *options);
+
+addr_policy_t *addr_policy_get_canonical_entry(addr_policy_t *ent);
+int cmp_addr_policies(smartlist_t *a, smartlist_t *b);
+addr_policy_result_t compare_tor_addr_to_addr_policy(const tor_addr_t *addr,
+ uint16_t port, const smartlist_t *policy);
+addr_policy_result_t compare_addr_to_addr_policy(uint32_t addr,
+ uint16_t port, const smartlist_t *policy);
+int policies_parse_exit_policy(config_line_t *cfg, smartlist_t **dest,
+ int rejectprivate, const char *local_address,
+ int add_default_policy);
+void policies_set_router_exitpolicy_to_reject_all(routerinfo_t *exitrouter);
+int exit_policy_is_general_exit(smartlist_t *policy);
+int policy_is_reject_star(const smartlist_t *policy);
+int getinfo_helper_policies(control_connection_t *conn,
+ const char *question, char **answer,
+ const char **errmsg);
+int policy_write_item(char *buf, size_t buflen, addr_policy_t *item,
+ int format_for_desc);
+
+void addr_policy_list_free(smartlist_t *p);
+void addr_policy_free(addr_policy_t *p);
+void policies_free_all(void);
+
+char *policy_summarize(smartlist_t *policy);
+
+#endif
+