[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] [tor/master 30/40] Create policies.h
Author: Sebastian Hahn <sebastian@xxxxxxxxxxxxxx>
Date: Fri, 23 Jul 2010 20:51:25 +0200
Subject: Create policies.h
Commit: 7bd8dee46371063cd1e62661cd65ce9a35e776e5
---
src/or/circuitbuild.c | 1 +
src/or/circuituse.c | 1 +
src/or/config.c | 1 +
src/or/connection.c | 1 +
src/or/connection_edge.c | 1 +
src/or/control.c | 1 +
src/or/directory.c | 1 +
src/or/dirserv.c | 1 +
src/or/dirvote.c | 1 +
src/or/dns.c | 1 +
src/or/dnsserv.c | 1 +
src/or/main.c | 1 +
src/or/or.h | 44 ---------------------------------
src/or/policies.c | 1 +
src/or/policies.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++
src/or/relay.c | 1 +
src/or/router.c | 1 +
src/or/routerlist.c | 1 +
src/or/routerparse.c | 1 +
src/test/test.c | 1 +
20 files changed, 78 insertions(+), 44 deletions(-)
create mode 100644 src/or/policies.h
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 00c9026..a70effe 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -24,6 +24,7 @@
#include "main.h"
#include "networkstatus.h"
#include "onion.h"
+#include "policies.h"
#include "router.h"
#include "routerlist.h"
#include "crypto.h"
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 07e3d0b..b13e558 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -17,6 +17,7 @@
#include "connection.h"
#include "connection_edge.h"
#include "control.h"
+#include "policies.h"
#include "rendclient.h"
#include "rendcommon.h"
#include "rendservice.h"
diff --git a/src/or/config.c b/src/or/config.c
index bfec2f4..02d2012 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -26,6 +26,7 @@
#include "hibernate.h"
#include "main.h"
#include "networkstatus.h"
+#include "policies.h"
#include "rendclient.h"
#include "rendservice.h"
#include "router.h"
diff --git a/src/or/connection.c b/src/or/connection.c
index 854a53a..e4d158a 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -27,6 +27,7 @@
#include "dnsserv.h"
#include "geoip.h"
#include "main.h"
+#include "policies.h"
#include "rendclient.h"
#include "rendcommon.h"
#include "router.h"
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 5dff479..ebc9ec5 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -23,6 +23,7 @@
#include "dirserv.h"
#include "hibernate.h"
#include "main.h"
+#include "policies.h"
#include "rendclient.h"
#include "rendcommon.h"
#include "rendservice.h"
diff --git a/src/or/control.c b/src/or/control.c
index 5f5e45f..1853048 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -26,6 +26,7 @@
#include "hibernate.h"
#include "main.h"
#include "networkstatus.h"
+#include "policies.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/directory.c b/src/or/directory.c
index 057961d..1c13cbd 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -16,6 +16,7 @@
#include "geoip.h"
#include "main.h"
#include "networkstatus.h"
+#include "policies.h"
#include "rendclient.h"
#include "rendcommon.h"
#include "router.h"
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index d23542c..38fc8f1 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -16,6 +16,7 @@
#include "hibernate.h"
#include "microdesc.h"
#include "networkstatus.h"
+#include "policies.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index 5b53267..7873e49 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -11,6 +11,7 @@
#include "dirvote.h"
#include "microdesc.h"
#include "networkstatus.h"
+#include "policies.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/dns.c b/src/or/dns.c
index 7bb2d8e..f2d3d43 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -20,6 +20,7 @@
#include "control.h"
#include "dns.h"
#include "main.h"
+#include "policies.h"
#include "router.h"
#include "ht.h"
#ifdef HAVE_EVENT2_DNS_H
diff --git a/src/or/dnsserv.c b/src/or/dnsserv.c
index 7f90294..e231b65 100644
--- a/src/or/dnsserv.c
+++ b/src/or/dnsserv.c
@@ -15,6 +15,7 @@
#include "connection_edge.h"
#include "control.h"
#include "main.h"
+#include "policies.h"
#ifdef HAVE_EVENT2_DNS_H
#include <event2/dns.h>
#include <event2/dns_compat.h>
diff --git a/src/or/main.c b/src/or/main.c
index b30a77e..60bea49 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -35,6 +35,7 @@
#include "networkstatus.h"
#include "ntmain.h"
#include "onion.h"
+#include "policies.h"
#include "rendclient.h"
#include "rendcommon.h"
#include "rendservice.h"
diff --git a/src/or/or.h b/src/or/or.h
index 8322cf3..2f2c300 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -3295,11 +3295,6 @@ typedef enum version_status_t {
/********************************* policies.c ************************/
-/* (length of "accept 255.255.255.255/255.255.255.255:65535-65535\n" plus a
- * NUL.)
- */
-#define POLICY_BUF_LEN 52
-
/** Outcome of applying an address policy to an address. */
typedef enum {
/** The address was accepted */
@@ -3314,45 +3309,6 @@ typedef enum {
ADDR_POLICY_PROBABLY_REJECTED=2
} addr_policy_result_t;
-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);
-
/********************************* reasons.c ***************************/
const char *stream_end_reason_to_control_string(int reason);
diff --git a/src/or/policies.c b/src/or/policies.c
index 72eb168..cd6307d 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -11,6 +11,7 @@
#include "or.h"
#include "config.h"
#include "dirserv.h"
+#include "policies.h"
#include "ht.h"
/** Policy that addresses for incoming SOCKS connections must match. */
diff --git a/src/or/policies.h b/src/or/policies.h
new file mode 100644
index 0000000..b99ee79
--- /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
+
diff --git a/src/or/relay.c b/src/or/relay.c
index 83f8754..f0801bf 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -24,6 +24,7 @@
#include "main.h"
#include "mempool.h"
#include "networkstatus.h"
+#include "policies.h"
#include "rendcommon.h"
#include "routerlist.h"
diff --git a/src/or/router.c b/src/or/router.c
index c9501d0..4a18916 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -18,6 +18,7 @@
#include "geoip.h"
#include "hibernate.h"
#include "main.h"
+#include "policies.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index f189943..1fb3dbc 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -23,6 +23,7 @@
#include "hibernate.h"
#include "main.h"
#include "networkstatus.h"
+#include "policies.h"
#include "rendcommon.h"
#include "rendservice.h"
#include "router.h"
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index a7df1f5..0662fd3 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -13,6 +13,7 @@
#include "config.h"
#include "dirserv.h"
#include "dirvote.h"
+#include "policies.h"
#include "rendcommon.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/test/test.c b/src/test/test.c
index a1e2868..b5c908a 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -54,6 +54,7 @@ double fabs(double x);
#include "mempool.h"
#include "memarea.h"
#include "onion.h"
+#include "policies.h"
#ifdef USE_DMALLOC
#include <dmalloc.h>
--
1.7.1