Commit 7bd8dee4 authored by Sebastian Hahn's avatar Sebastian Hahn
Browse files

Create policies.h

parent f6852fe0
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -26,6 +26,7 @@
#include "hibernate.h"
#include "main.h"
#include "networkstatus.h"
#include "policies.h"
#include "router.h"
#include "routerlist.h"
......
......@@ -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"
......
......@@ -16,6 +16,7 @@
#include "hibernate.h"
#include "microdesc.h"
#include "networkstatus.h"
#include "policies.h"
#include "router.h"
#include "routerlist.h"
......
......@@ -11,6 +11,7 @@
#include "dirvote.h"
#include "microdesc.h"
#include "networkstatus.h"
#include "policies.h"
#include "router.h"
#include "routerlist.h"
......
......@@ -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
......
......@@ -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>
......
......@@ -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"
......
......@@ -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);
......
......@@ -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. */
......
/* 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
......@@ -24,6 +24,7 @@
#include "main.h"
#include "mempool.h"
#include "networkstatus.h"
#include "policies.h"
#include "rendcommon.h"
#include "routerlist.h"
......
......@@ -18,6 +18,7 @@
#include "geoip.h"
#include "hibernate.h"
#include "main.h"
#include "policies.h"
#include "router.h"
#include "routerlist.h"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment