aboutsummaryrefslogtreecommitdiff
path: root/src/or/policies.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-07-01 13:43:11 -0400
committerNick Mathewson <nickm@torproject.org>2018-07-01 15:20:37 -0400
commit6da0311d2cc71d6d0732c8432eea38cd1819aa86 (patch)
tree98ce8cdfc60f6bf4c57885b0f1fe43369d15b492 /src/or/policies.h
parent1743dac078f2e060f3f6c7194deae90a2175fe92 (diff)
downloadtor-6da0311d2cc71d6d0732c8432eea38cd1819aa86.tar.gz
tor-6da0311d2cc71d6d0732c8432eea38cd1819aa86.zip
Extract various enums and tiny structs from or.h
These all have a logical header to go in.
Diffstat (limited to 'src/or/policies.h')
-rw-r--r--src/or/policies.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/or/policies.h b/src/or/policies.h
index fa55f1cb12..ff0b54499c 100644
--- a/src/or/policies.h
+++ b/src/or/policies.h
@@ -34,6 +34,39 @@ typedef enum firewall_connection_t {
typedef int exit_policy_parser_cfg_t;
+/** Outcome of applying an address policy to an address. */
+typedef enum {
+ /** The address was accepted */
+ ADDR_POLICY_ACCEPTED=0,
+ /** The address was rejected */
+ ADDR_POLICY_REJECTED=-1,
+ /** Part of the address was unknown, but as far as we can tell, it was
+ * accepted. */
+ ADDR_POLICY_PROBABLY_ACCEPTED=1,
+ /** Part of the address was unknown, but as far as we can tell, it was
+ * rejected. */
+ ADDR_POLICY_PROBABLY_REJECTED=2,
+} addr_policy_result_t;
+
+/** A single entry in a parsed policy summary, describing a range of ports. */
+typedef struct short_policy_entry_t {
+ uint16_t min_port, max_port;
+} short_policy_entry_t;
+
+/** A short_poliy_t is the parsed version of a policy summary. */
+typedef struct short_policy_t {
+ /** True if the members of 'entries' are port ranges to accept; false if
+ * they are port ranges to reject */
+ unsigned int is_accept : 1;
+ /** The actual number of values in 'entries'. */
+ unsigned int n_entries : 31;
+ /** An array of 0 or more short_policy_entry_t values, each describing a
+ * range of ports that this policy accepts or rejects (depending on the
+ * value of is_accept).
+ */
+ short_policy_entry_t entries[FLEXIBLE_ARRAY_MEMBER];
+} short_policy_t;
+
int firewall_is_fascist_or(void);
int firewall_is_fascist_dir(void);
int fascist_firewall_use_ipv6(const or_options_t *options);