]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Create connection.h
authorSebastian Hahn <sebastian@torproject.org>
Thu, 22 Jul 2010 08:32:52 +0000 (10:32 +0200)
committerSebastian Hahn <sebastian@torproject.org>
Tue, 27 Jul 2010 05:58:14 +0000 (07:58 +0200)
23 files changed:
src/or/circuitbuild.c
src/or/circuitlist.c
src/or/circuituse.c
src/or/command.c
src/or/config.c
src/or/connection.c
src/or/connection.h [new file with mode: 0644]
src/or/connection_edge.c
src/or/connection_or.c
src/or/control.c
src/or/cpuworker.c
src/or/directory.c
src/or/dirserv.c
src/or/dns.c
src/or/dnsserv.c
src/or/hibernate.c
src/or/main.c
src/or/networkstatus.c
src/or/or.h
src/or/relay.c
src/or/rendclient.c
src/or/router.c
src/or/routerlist.c

index 041aed3a0ab4274849916e611f56b3485d135aa0..0045080fa45ad365ba7966a3acd8e7d06254d611 100644 (file)
@@ -16,6 +16,7 @@
 #include "circuitlist.h"
 #include "circuituse.h"
 #include "config.h"
+#include "connection.h"
 #include "router.h"
 #include "routerlist.h"
 #include "crypto.h"
index a4ec4c06a454b85bc123c19469600e1b3387a04b..3f06e6ea6027b1be8c11a7c835979707c6d6953b 100644 (file)
@@ -13,6 +13,7 @@
 #include "circuitbuild.h"
 #include "circuitlist.h"
 #include "circuituse.h"
+#include "connection.h"
 #include "config.h"
 #include "rendclient.h"
 #include "rendcommon.h"
index 70def3d480e9bd22dc628e503d5aced051d914e3..f9bf6fe147eb13d20e1b47ebe53237302dc75023 100644 (file)
@@ -14,6 +14,7 @@
 #include "circuitlist.h"
 #include "circuituse.h"
 #include "config.h"
+#include "connection.h"
 #include "rendclient.h"
 #include "rendcommon.h"
 #include "rendservice.h"
index 96c5fca59bd8f1e2080aae6163f10d62f931162d..22f36fff592c49f3065af22d6e34df18936dc969 100644 (file)
@@ -19,6 +19,7 @@
 #include "circuitbuild.h"
 #include "circuitlist.h"
 #include "command.h"
+#include "connection.h"
 #include "config.h"
 #include "router.h"
 #include "routerlist.h"
index a87238bec16e596f35eb7e7c8ff5a7a7f2d1e991..41716d0dc82e1243d9919c03169a0b3f01495f87 100644 (file)
@@ -15,6 +15,7 @@
 #include "circuitbuild.h"
 #include "circuitlist.h"
 #include "config.h"
+#include "connection.h"
 #include "geoip.h"
 #include "rendclient.h"
 #include "rendservice.h"
index 5265430ac1bcd492df4b93e21eb84cb70611e900..c7d76712637b6581da72d73197a8c4431a1099cb 100644 (file)
@@ -16,6 +16,7 @@
 #include "circuitlist.h"
 #include "circuituse.h"
 #include "config.h"
+#include "connection.h"
 #include "dnsserv.h"
 #include "geoip.h"
 #include "rendclient.h"
diff --git a/src/or/connection.h b/src/or/connection.h
new file mode 100644 (file)
index 0000000..f38927e
--- /dev/null
@@ -0,0 +1,100 @@
+/* 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.h
+ * \brief Header file for connection.c.
+ **/
+
+#ifndef _TOR_CONNECTION_H
+#define _TOR_CONNECTION_H
+
+const char *conn_type_to_string(int type);
+const char *conn_state_to_string(int type, int state);
+
+dir_connection_t *dir_connection_new(int socket_family);
+or_connection_t *or_connection_new(int socket_family);
+edge_connection_t *edge_connection_new(int type, int socket_family);
+control_connection_t *control_connection_new(int socket_family);
+connection_t *connection_new(int type, int socket_family);
+
+void connection_link_connections(connection_t *conn_a, connection_t *conn_b);
+void connection_free(connection_t *conn);
+void connection_free_all(void);
+void connection_about_to_close_connection(connection_t *conn);
+void connection_close_immediate(connection_t *conn);
+void _connection_mark_for_close(connection_t *conn,int line, const char *file);
+
+#define connection_mark_for_close(c) \
+  _connection_mark_for_close((c), __LINE__, _SHORT_FILE_)
+
+void connection_expire_held_open(void);
+
+int connection_connect(connection_t *conn, const char *address,
+                       const tor_addr_t *addr,
+                       uint16_t port, int *socket_error);
+
+int connection_proxy_connect(connection_t *conn, int type);
+int connection_read_proxy_handshake(connection_t *conn);
+
+int retry_all_listeners(smartlist_t *replaced_conns,
+                        smartlist_t *new_conns);
+
+ssize_t connection_bucket_write_limit(connection_t *conn, time_t now);
+int global_write_bucket_low(connection_t *conn, size_t attempt, int priority);
+void connection_bucket_init(void);
+void connection_bucket_refill(int seconds_elapsed, time_t now);
+
+int connection_handle_read(connection_t *conn);
+
+int connection_fetch_from_buf(char *string, size_t len, connection_t *conn);
+
+int connection_wants_to_flush(connection_t *conn);
+int connection_outbuf_too_full(connection_t *conn);
+int connection_handle_write(connection_t *conn, int force);
+void _connection_write_to_buf_impl(const char *string, size_t len,
+                                   connection_t *conn, int zlib);
+static void connection_write_to_buf(const char *string, size_t len,
+                                    connection_t *conn);
+static void connection_write_to_buf_zlib(const char *string, size_t len,
+                                         dir_connection_t *conn, int done);
+static INLINE void
+connection_write_to_buf(const char *string, size_t len, connection_t *conn)
+{
+  _connection_write_to_buf_impl(string, len, conn, 0);
+}
+static INLINE void
+connection_write_to_buf_zlib(const char *string, size_t len,
+                             dir_connection_t *conn, int done)
+{
+  _connection_write_to_buf_impl(string, len, TO_CONN(conn), done ? -1 : 1);
+}
+
+connection_t *connection_get_by_global_id(uint64_t id);
+
+connection_t *connection_get_by_type(int type);
+connection_t *connection_get_by_type_purpose(int type, int purpose);
+connection_t *connection_get_by_type_addr_port_purpose(int type,
+                                                   const tor_addr_t *addr,
+                                                   uint16_t port, int purpose);
+connection_t *connection_get_by_type_state(int type, int state);
+connection_t *connection_get_by_type_state_rendquery(int type, int state,
+                                                     const char *rendquery);
+
+#define connection_speaks_cells(conn) ((conn)->type == CONN_TYPE_OR)
+int connection_is_listener(connection_t *conn);
+int connection_state_is_open(connection_t *conn);
+int connection_state_is_connecting(connection_t *conn);
+
+char *alloc_http_authenticator(const char *authenticator);
+
+void assert_connection_ok(connection_t *conn, time_t now);
+int connection_or_nonopen_was_started_here(or_connection_t *conn);
+void connection_dump_buffer_mem_stats(int severity);
+void remove_file_if_very_old(const char *fname, time_t now);
+
+#endif
+
index ec49d6632a0be8f4c7cebee17ced38312ffe9a03..530d8b7310b3b50cf7f8f724301a1d9e5beca2e3 100644 (file)
@@ -14,6 +14,7 @@
 #include "circuitlist.h"
 #include "circuituse.h"
 #include "config.h"
+#include "connection.h"
 #include "dnsserv.h"
 #include "rendclient.h"
 #include "rendcommon.h"
index f9fda6553f9eb96af3fb8a945aa43051e3251000..e8633c10c1ef9aaa445884c54239e483ba9bcc4c 100644 (file)
@@ -15,6 +15,7 @@
 #include "circuitbuild.h"
 #include "command.h"
 #include "config.h"
+#include "connection.h"
 #include "geoip.h"
 #include "router.h"
 #include "routerlist.h"
index f6363e522e28d3039ffa2a7388c78f9bf8377b90..75c4ae4f3057cb476aefc4fbbff8906dceaee577 100644 (file)
@@ -16,6 +16,7 @@
 #include "circuitlist.h"
 #include "circuituse.h"
 #include "config.h"
+#include "connection.h"
 #include "dnsserv.h"
 #include "geoip.h"
 #include "router.h"
index babc6d67ba002199531baa921bd5cc973884f471..9f49e2e36e14f403d74bbec08be621b9f3e7ee21 100644 (file)
@@ -17,6 +17,7 @@
 #include "circuitbuild.h"
 #include "circuitlist.h"
 #include "config.h"
+#include "connection.h"
 #include "router.h"
 
 /** The maximum number of cpuworker processes we will keep around. */
index fa340c1266e0eccd062c2cd2757b5a0a608222ff..59e6d0d0f5bb84c38c1fb3e4e1f0682ff21b1e3d 100644 (file)
@@ -7,6 +7,7 @@
 #include "buffers.h"
 #include "circuitbuild.h"
 #include "config.h"
+#include "connection.h"
 #include "geoip.h"
 #include "rendclient.h"
 #include "rendcommon.h"
index 2177344878a7575b56cd8160b5d3a87bc121549b..dc07e802f48aa0b4a4fcd3daf5c3de5fecf8f3ab 100644 (file)
@@ -7,6 +7,7 @@
 #include "or.h"
 #include "buffers.h"
 #include "config.h"
+#include "connection.h"
 #include "router.h"
 #include "routerlist.h"
 
index 905be3ef9be2d16acc60582c7d93c69fcd100c22..e8b75d51804514ff4d35c6df4eeb68d8ae853219 100644 (file)
@@ -15,6 +15,7 @@
 #include "circuitlist.h"
 #include "circuituse.h"
 #include "config.h"
+#include "connection.h"
 #include "router.h"
 #include "ht.h"
 #ifdef HAVE_EVENT2_DNS_H
index 68d8122f82bf2eac12ab18fbc1980a988421a300..6e3ccfbdf0ebc4ffbdc33f478601f670c0000206 100644 (file)
@@ -11,6 +11,7 @@
 #include "or.h"
 #include "dnsserv.h"
 #include "config.h"
+#include "connection.h"
 #ifdef HAVE_EVENT2_DNS_H
 #include <event2/dns.h>
 #include <event2/dns_compat.h>
index 74b1d85ded06d58e9ef4b93980269e5cbe949f7c..2a08899cc4ba477ad9ab6896b555c5c3f82f9a40 100644 (file)
@@ -23,6 +23,7 @@ hibernating, phase 2:
 
 #include "or.h"
 #include "config.h"
+#include "connection.h"
 #include "router.h"
 
 /** Possible values of hibernate_state */
index 4af66c356097fb1fc2074e261db1532e51ae2262..9b40338507eae1b77181524690bd623591d607e7 100644 (file)
@@ -18,6 +18,7 @@
 #include "circuituse.h"
 #include "command.h"
 #include "config.h"
+#include "connection.h"
 #include "dnsserv.h"
 #include "geoip.h"
 #include "rendclient.h"
index 34ead6f30dad267cecf062bbfa96ac062aa90b50..c73a30bc3b74fae5a7b7d49b5c67dfd55516c7dc 100644 (file)
@@ -13,6 +13,7 @@
 #include "or.h"
 #include "circuitbuild.h"
 #include "config.h"
+#include "connection.h"
 #include "router.h"
 #include "routerlist.h"
 
index d2b6dd8bc74a7dfa4ddd0ccc7b55d5f990b17e8c..bbc31b6713dd3342cdbafa70e809e6d3a201c2fa 100644 (file)
@@ -3066,92 +3066,6 @@ typedef enum setopt_err_t {
   SETOPT_ERR_SETTING = -4,
 } setopt_err_t;
 
-/********************************* connection.c ***************************/
-
-const char *conn_type_to_string(int type);
-const char *conn_state_to_string(int type, int state);
-
-dir_connection_t *dir_connection_new(int socket_family);
-or_connection_t *or_connection_new(int socket_family);
-edge_connection_t *edge_connection_new(int type, int socket_family);
-control_connection_t *control_connection_new(int socket_family);
-connection_t *connection_new(int type, int socket_family);
-
-void connection_link_connections(connection_t *conn_a, connection_t *conn_b);
-void connection_free(connection_t *conn);
-void connection_free_all(void);
-void connection_about_to_close_connection(connection_t *conn);
-void connection_close_immediate(connection_t *conn);
-void _connection_mark_for_close(connection_t *conn,int line, const char *file);
-
-#define connection_mark_for_close(c) \
-  _connection_mark_for_close((c), __LINE__, _SHORT_FILE_)
-
-void connection_expire_held_open(void);
-
-int connection_connect(connection_t *conn, const char *address,
-                       const tor_addr_t *addr,
-                       uint16_t port, int *socket_error);
-
-int connection_proxy_connect(connection_t *conn, int type);
-int connection_read_proxy_handshake(connection_t *conn);
-
-int retry_all_listeners(smartlist_t *replaced_conns,
-                        smartlist_t *new_conns);
-
-ssize_t connection_bucket_write_limit(connection_t *conn, time_t now);
-int global_write_bucket_low(connection_t *conn, size_t attempt, int priority);
-void connection_bucket_init(void);
-void connection_bucket_refill(int seconds_elapsed, time_t now);
-
-int connection_handle_read(connection_t *conn);
-
-int connection_fetch_from_buf(char *string, size_t len, connection_t *conn);
-
-int connection_wants_to_flush(connection_t *conn);
-int connection_outbuf_too_full(connection_t *conn);
-int connection_handle_write(connection_t *conn, int force);
-void _connection_write_to_buf_impl(const char *string, size_t len,
-                                   connection_t *conn, int zlib);
-static void connection_write_to_buf(const char *string, size_t len,
-                                    connection_t *conn);
-static void connection_write_to_buf_zlib(const char *string, size_t len,
-                                         dir_connection_t *conn, int done);
-static INLINE void
-connection_write_to_buf(const char *string, size_t len, connection_t *conn)
-{
-  _connection_write_to_buf_impl(string, len, conn, 0);
-}
-static INLINE void
-connection_write_to_buf_zlib(const char *string, size_t len,
-                             dir_connection_t *conn, int done)
-{
-  _connection_write_to_buf_impl(string, len, TO_CONN(conn), done ? -1 : 1);
-}
-
-connection_t *connection_get_by_global_id(uint64_t id);
-
-connection_t *connection_get_by_type(int type);
-connection_t *connection_get_by_type_purpose(int type, int purpose);
-connection_t *connection_get_by_type_addr_port_purpose(int type,
-                                                   const tor_addr_t *addr,
-                                                   uint16_t port, int purpose);
-connection_t *connection_get_by_type_state(int type, int state);
-connection_t *connection_get_by_type_state_rendquery(int type, int state,
-                                                     const char *rendquery);
-
-#define connection_speaks_cells(conn) ((conn)->type == CONN_TYPE_OR)
-int connection_is_listener(connection_t *conn);
-int connection_state_is_open(connection_t *conn);
-int connection_state_is_connecting(connection_t *conn);
-
-char *alloc_http_authenticator(const char *authenticator);
-
-void assert_connection_ok(connection_t *conn, time_t now);
-int connection_or_nonopen_was_started_here(or_connection_t *conn);
-void connection_dump_buffer_mem_stats(int severity);
-void remove_file_if_very_old(const char *fname, time_t now);
-
 /********************************* connection_edge.c *************************/
 
 #define connection_mark_unattached_ap(conn, endreason) \
index 53631ab412daa5e513abae50d7233d341d33d30c..59d7282dc000fab5a84c00f72afe7e4dc8a2a6b2 100644 (file)
@@ -16,6 +16,7 @@
 #include "circuitbuild.h"
 #include "circuitlist.h"
 #include "config.h"
+#include "connection.h"
 #include "geoip.h"
 #include "mempool.h"
 #include "rendcommon.h"
index 5e1f81ee4f31bc839e991b9ef5bdccdd031ecda5..eb971ac63abc9746b0f3ef912874f4ff44a34a8f 100644 (file)
@@ -12,6 +12,7 @@
 #include "circuitlist.h"
 #include "circuituse.h"
 #include "config.h"
+#include "connection.h"
 #include "rendclient.h"
 #include "rendcommon.h"
 #include "routerlist.h"
index 20990b2dd872233ae3476f1a7464230a6f66120d..9cb7ad4f8f3c4de08d840417a52ffcc021d44e51 100644 (file)
@@ -10,6 +10,7 @@
 #include "circuitlist.h"
 #include "circuituse.h"
 #include "config.h"
+#include "connection.h"
 #include "geoip.h"
 #include "router.h"
 #include "routerlist.h"
index 5cf698aaa2c785d37818245dac9b9552cc2861bb..df296006567e80f414dbb6eebbcf6f2a99a43a49 100644 (file)
@@ -14,6 +14,7 @@
 #include "or.h"
 #include "circuitbuild.h"
 #include "config.h"
+#include "connection.h"
 #include "geoip.h"
 #include "rendcommon.h"
 #include "rendservice.h"