[or-cvs] [tor/master 16/40] Create connection_edge.h

nickm at torproject.org nickm at torproject.org
Fri Jul 30 01:56:57 UTC 2010


Author: Sebastian Hahn <sebastian at torproject.org>
Date: Thu, 22 Jul 2010 10:43:02 +0200
Subject: Create connection_edge.h
Commit: 78b6a4650b8ea90d99e49aff2a2c20df461bb127

---
 src/or/buffers.c         |    1 +
 src/or/circuitbuild.c    |    1 +
 src/or/circuitlist.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/connection_edge.h |   98 ++++++++++++++++++++++++++++++++++++++++++++++
 src/or/control.c         |    1 +
 src/or/directory.c       |    1 +
 src/or/dns.c             |    1 +
 src/or/dnsserv.c         |    1 +
 src/or/hibernate.c       |    1 +
 src/or/main.c            |    1 +
 src/or/or.h              |   80 -------------------------------------
 src/or/relay.c           |    1 +
 src/or/rendclient.c      |    1 +
 src/test/test.c          |    1 +
 18 files changed, 114 insertions(+), 80 deletions(-)
 create mode 100644 src/or/connection_edge.h

diff --git a/src/or/buffers.c b/src/or/buffers.c
index 2c1ba78..c9abddc 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -14,6 +14,7 @@
 #include "or.h"
 #include "buffers.h"
 #include "config.h"
+#include "connection_edge.h"
 #include "../common/util.h"
 #include "../common/torlog.h"
 #ifdef HAVE_UNISTD_H
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 0045080..a7b5ee1 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -17,6 +17,7 @@
 #include "circuituse.h"
 #include "config.h"
 #include "connection.h"
+#include "connection_edge.h"
 #include "router.h"
 #include "routerlist.h"
 #include "crypto.h"
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 3f06e6e..edcd194 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -15,6 +15,7 @@
 #include "circuituse.h"
 #include "connection.h"
 #include "config.h"
+#include "connection_edge.h"
 #include "rendclient.h"
 #include "rendcommon.h"
 #include "routerlist.h"
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index f9bf6fe..d8f1ec7 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -15,6 +15,7 @@
 #include "circuituse.h"
 #include "config.h"
 #include "connection.h"
+#include "connection_edge.h"
 #include "rendclient.h"
 #include "rendcommon.h"
 #include "rendservice.h"
diff --git a/src/or/config.c b/src/or/config.c
index 41716d0..07e6246 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -16,6 +16,7 @@
 #include "circuitlist.h"
 #include "config.h"
 #include "connection.h"
+#include "connection_edge.h"
 #include "geoip.h"
 #include "rendclient.h"
 #include "rendservice.h"
diff --git a/src/or/connection.c b/src/or/connection.c
index c7d7671..dc68bcf 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -17,6 +17,7 @@
 #include "circuituse.h"
 #include "config.h"
 #include "connection.h"
+#include "connection_edge.h"
 #include "dnsserv.h"
 #include "geoip.h"
 #include "rendclient.h"
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 530d8b7..d4f22fa 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -15,6 +15,7 @@
 #include "circuituse.h"
 #include "config.h"
 #include "connection.h"
+#include "connection_edge.h"
 #include "dnsserv.h"
 #include "rendclient.h"
 #include "rendcommon.h"
diff --git a/src/or/connection_edge.h b/src/or/connection_edge.h
new file mode 100644
index 0000000..c3d6098
--- /dev/null
+++ b/src/or/connection_edge.h
@@ -0,0 +1,98 @@
+/* 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 connection_edge.h
+ * \brief Header file for connection_edge.c.
+ **/
+
+#ifndef _TOR_CONNECTION_EDGE_H
+#define _TOR_CONNECTION_EDGE_H
+
+#define connection_mark_unattached_ap(conn, endreason) \
+  _connection_mark_unattached_ap((conn), (endreason), __LINE__, _SHORT_FILE_)
+
+void _connection_mark_unattached_ap(edge_connection_t *conn, int endreason,
+                                    int line, const char *file);
+int connection_edge_reached_eof(edge_connection_t *conn);
+int connection_edge_process_inbuf(edge_connection_t *conn,
+                                  int package_partial);
+int connection_edge_destroy(circid_t circ_id, edge_connection_t *conn);
+int connection_edge_end(edge_connection_t *conn, uint8_t reason);
+int connection_edge_end_errno(edge_connection_t *conn);
+int connection_edge_finished_flushing(edge_connection_t *conn);
+int connection_edge_finished_connecting(edge_connection_t *conn);
+
+int connection_ap_handshake_send_begin(edge_connection_t *ap_conn);
+int connection_ap_handshake_send_resolve(edge_connection_t *ap_conn);
+
+edge_connection_t  *connection_ap_make_link(char *address, uint16_t port,
+                                            const char *digest,
+                                            int use_begindir, int want_onehop);
+void connection_ap_handshake_socks_reply(edge_connection_t *conn, char *reply,
+                                         size_t replylen,
+                                         int endreason);
+void connection_ap_handshake_socks_resolved(edge_connection_t *conn,
+                                            int answer_type,
+                                            size_t answer_len,
+                                            const char *answer,
+                                            int ttl,
+                                            time_t expires);
+
+int connection_exit_begin_conn(cell_t *cell, circuit_t *circ);
+int connection_exit_begin_resolve(cell_t *cell, or_circuit_t *circ);
+void connection_exit_connect(edge_connection_t *conn);
+int connection_edge_is_rendezvous_stream(edge_connection_t *conn);
+int connection_ap_can_use_exit(edge_connection_t *conn, routerinfo_t *exit,
+                               int excluded_means_no);
+void connection_ap_expire_beginning(void);
+void connection_ap_attach_pending(void);
+void connection_ap_fail_onehop(const char *failed_digest,
+                               cpath_build_state_t *build_state);
+void circuit_discard_optional_exit_enclaves(extend_info_t *info);
+int connection_ap_detach_retriable(edge_connection_t *conn,
+                                   origin_circuit_t *circ,
+                                   int reason);
+int connection_ap_process_transparent(edge_connection_t *conn);
+
+int address_is_invalid_destination(const char *address, int client);
+
+void addressmap_init(void);
+void addressmap_clean(time_t now);
+void addressmap_clear_configured(void);
+void addressmap_clear_transient(void);
+void addressmap_free_all(void);
+int addressmap_rewrite(char *address, size_t maxlen, time_t *expires_out);
+int addressmap_have_mapping(const char *address, int update_timeout);
+
+void addressmap_register(const char *address, char *new_address,
+                         time_t expires, addressmap_entry_source_t source);
+int parse_virtual_addr_network(const char *val, int validate_only,
+                               char **msg);
+int client_dns_incr_failures(const char *address);
+void client_dns_clear_failures(const char *address);
+void client_dns_set_addressmap(const char *address, uint32_t val,
+                               const char *exitname, int ttl);
+const char *addressmap_register_virtual_address(int type, char *new_address);
+void addressmap_get_mappings(smartlist_t *sl, time_t min_expires,
+                             time_t max_expires, int want_expiry);
+int connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn,
+                                               origin_circuit_t *circ,
+                                               crypt_path_t *cpath);
+int hostname_is_noconnect_address(const char *address);
+
+/** Possible return values for parse_extended_hostname. */
+typedef enum hostname_type_t {
+  NORMAL_HOSTNAME, ONION_HOSTNAME, EXIT_HOSTNAME, BAD_HOSTNAME
+} hostname_type_t;
+hostname_type_t parse_extended_hostname(char *address, int allowdotexit);
+
+#if defined(HAVE_NET_IF_H) && defined(HAVE_NET_PFVAR_H)
+int get_pf_socket(void);
+#endif
+
+#endif
+
diff --git a/src/or/control.c b/src/or/control.c
index 75c4ae4..97d1b9d 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -17,6 +17,7 @@
 #include "circuituse.h"
 #include "config.h"
 #include "connection.h"
+#include "connection_edge.h"
 #include "dnsserv.h"
 #include "geoip.h"
 #include "router.h"
diff --git a/src/or/directory.c b/src/or/directory.c
index 59e6d0d..7d8d7ab 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -8,6 +8,7 @@
 #include "circuitbuild.h"
 #include "config.h"
 #include "connection.h"
+#include "connection_edge.h"
 #include "geoip.h"
 #include "rendclient.h"
 #include "rendcommon.h"
diff --git a/src/or/dns.c b/src/or/dns.c
index e8b75d5..5520a49 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -16,6 +16,7 @@
 #include "circuituse.h"
 #include "config.h"
 #include "connection.h"
+#include "connection_edge.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 6e3ccfb..4c47110 100644
--- a/src/or/dnsserv.c
+++ b/src/or/dnsserv.c
@@ -12,6 +12,7 @@
 #include "dnsserv.h"
 #include "config.h"
 #include "connection.h"
+#include "connection_edge.h"
 #ifdef HAVE_EVENT2_DNS_H
 #include <event2/dns.h>
 #include <event2/dns_compat.h>
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index 2a08899..cd7cdad 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -24,6 +24,7 @@ hibernating, phase 2:
 #include "or.h"
 #include "config.h"
 #include "connection.h"
+#include "connection_edge.h"
 #include "router.h"
 
 /** Possible values of hibernate_state */
diff --git a/src/or/main.c b/src/or/main.c
index 9b40338..7811397 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -19,6 +19,7 @@
 #include "command.h"
 #include "config.h"
 #include "connection.h"
+#include "connection_edge.h"
 #include "dnsserv.h"
 #include "geoip.h"
 #include "rendclient.h"
diff --git a/src/or/or.h b/src/or/or.h
index bbc31b6..31c5700 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -3068,61 +3068,6 @@ typedef enum setopt_err_t {
 
 /********************************* connection_edge.c *************************/
 
-#define connection_mark_unattached_ap(conn, endreason) \
-  _connection_mark_unattached_ap((conn), (endreason), __LINE__, _SHORT_FILE_)
-
-void _connection_mark_unattached_ap(edge_connection_t *conn, int endreason,
-                                    int line, const char *file);
-int connection_edge_reached_eof(edge_connection_t *conn);
-int connection_edge_process_inbuf(edge_connection_t *conn,
-                                  int package_partial);
-int connection_edge_destroy(circid_t circ_id, edge_connection_t *conn);
-int connection_edge_end(edge_connection_t *conn, uint8_t reason);
-int connection_edge_end_errno(edge_connection_t *conn);
-int connection_edge_finished_flushing(edge_connection_t *conn);
-int connection_edge_finished_connecting(edge_connection_t *conn);
-
-int connection_ap_handshake_send_begin(edge_connection_t *ap_conn);
-int connection_ap_handshake_send_resolve(edge_connection_t *ap_conn);
-
-edge_connection_t  *connection_ap_make_link(char *address, uint16_t port,
-                                            const char *digest,
-                                            int use_begindir, int want_onehop);
-void connection_ap_handshake_socks_reply(edge_connection_t *conn, char *reply,
-                                         size_t replylen,
-                                         int endreason);
-void connection_ap_handshake_socks_resolved(edge_connection_t *conn,
-                                            int answer_type,
-                                            size_t answer_len,
-                                            const char *answer,
-                                            int ttl,
-                                            time_t expires);
-
-int connection_exit_begin_conn(cell_t *cell, circuit_t *circ);
-int connection_exit_begin_resolve(cell_t *cell, or_circuit_t *circ);
-void connection_exit_connect(edge_connection_t *conn);
-int connection_edge_is_rendezvous_stream(edge_connection_t *conn);
-int connection_ap_can_use_exit(edge_connection_t *conn, routerinfo_t *exit,
-                               int excluded_means_no);
-void connection_ap_expire_beginning(void);
-void connection_ap_attach_pending(void);
-void connection_ap_fail_onehop(const char *failed_digest,
-                               cpath_build_state_t *build_state);
-void circuit_discard_optional_exit_enclaves(extend_info_t *info);
-int connection_ap_detach_retriable(edge_connection_t *conn,
-                                   origin_circuit_t *circ,
-                                   int reason);
-int connection_ap_process_transparent(edge_connection_t *conn);
-
-int address_is_invalid_destination(const char *address, int client);
-
-void addressmap_init(void);
-void addressmap_clean(time_t now);
-void addressmap_clear_configured(void);
-void addressmap_clear_transient(void);
-void addressmap_free_all(void);
-int addressmap_rewrite(char *address, size_t maxlen, time_t *expires_out);
-int addressmap_have_mapping(const char *address, int update_timeout);
 /** Enumerates possible origins of a client-side address mapping. */
 typedef enum {
   /** We're remapping this address because the controller told us to. */
@@ -3137,31 +3082,6 @@ typedef enum {
    * Tor server that told us what its value was. */
   ADDRMAPSRC_DNS,
 } addressmap_entry_source_t;
-void addressmap_register(const char *address, char *new_address,
-                         time_t expires, addressmap_entry_source_t source);
-int parse_virtual_addr_network(const char *val, int validate_only,
-                               char **msg);
-int client_dns_incr_failures(const char *address);
-void client_dns_clear_failures(const char *address);
-void client_dns_set_addressmap(const char *address, uint32_t val,
-                               const char *exitname, int ttl);
-const char *addressmap_register_virtual_address(int type, char *new_address);
-void addressmap_get_mappings(smartlist_t *sl, time_t min_expires,
-                             time_t max_expires, int want_expiry);
-int connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn,
-                                               origin_circuit_t *circ,
-                                               crypt_path_t *cpath);
-int hostname_is_noconnect_address(const char *address);
-
-/** Possible return values for parse_extended_hostname. */
-typedef enum hostname_type_t {
-  NORMAL_HOSTNAME, ONION_HOSTNAME, EXIT_HOSTNAME, BAD_HOSTNAME
-} hostname_type_t;
-hostname_type_t parse_extended_hostname(char *address, int allowdotexit);
-
-#if defined(HAVE_NET_IF_H) && defined(HAVE_NET_PFVAR_H)
-int get_pf_socket(void);
-#endif
 
 /********************************* connection_or.c ***************************/
 
diff --git a/src/or/relay.c b/src/or/relay.c
index 59d7282..21de9e9 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -17,6 +17,7 @@
 #include "circuitlist.h"
 #include "config.h"
 #include "connection.h"
+#include "connection_edge.h"
 #include "geoip.h"
 #include "mempool.h"
 #include "rendcommon.h"
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index eb971ac..3665eb1 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -13,6 +13,7 @@
 #include "circuituse.h"
 #include "config.h"
 #include "connection.h"
+#include "connection_edge.h"
 #include "rendclient.h"
 #include "rendcommon.h"
 #include "routerlist.h"
diff --git a/src/test/test.c b/src/test/test.c
index 30bb1a0..7e6bf70 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -46,6 +46,7 @@ double fabs(double x);
 #include "buffers.h"
 #include "circuitbuild.h"
 #include "config.h"
+#include "connection_edge.h"
 #include "geoip.h"
 #include "rendcommon.h"
 #include "test.h"
-- 
1.7.1




More information about the tor-commits mailing list