]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Create buffers.h
authorSebastian Hahn <sebastian@torproject.org>
Wed, 21 Jul 2010 22:46:18 +0000 (00:46 +0200)
committerSebastian Hahn <sebastian@torproject.org>
Tue, 27 Jul 2010 05:56:26 +0000 (07:56 +0200)
13 files changed:
src/or/buffers.c
src/or/buffers.h [new file with mode: 0644]
src/or/connection.c
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/main.c
src/or/or.h
src/or/relay.c
src/test/test.c

index c4ebc8135f2e10c86c90b29f8e2ad5202636ea4e..807ca5076d827e588687a7c6584f4b0cf86debd1 100644 (file)
@@ -12,6 +12,7 @@
  **/
 #define BUFFERS_PRIVATE
 #include "or.h"
+#include "buffers.h"
 #include "../common/util.h"
 #include "../common/torlog.h"
 #ifdef HAVE_UNISTD_H
diff --git a/src/or/buffers.h b/src/or/buffers.h
new file mode 100644 (file)
index 0000000..42d92dd
--- /dev/null
@@ -0,0 +1,59 @@
+/* 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 buffers.h
+ * \brief Header file for buffers.c.
+ **/
+
+#ifndef _TOR_BUFFERS_H
+#define _TOR_BUFFERS_H
+
+buf_t *buf_new(void);
+buf_t *buf_new_with_capacity(size_t size);
+void buf_free(buf_t *buf);
+void buf_clear(buf_t *buf);
+void buf_shrink(buf_t *buf);
+void buf_shrink_freelists(int free_all);
+void buf_dump_freelist_sizes(int severity);
+
+size_t buf_datalen(const buf_t *buf);
+size_t buf_allocation(const buf_t *buf);
+size_t buf_slack(const buf_t *buf);
+const char *_buf_peek_raw_buffer(const buf_t *buf);
+
+int read_to_buf(int s, size_t at_most, buf_t *buf, int *reached_eof,
+                int *socket_error);
+int read_to_buf_tls(tor_tls_t *tls, size_t at_most, buf_t *buf);
+
+int flush_buf(int s, buf_t *buf, size_t sz, size_t *buf_flushlen);
+int flush_buf_tls(tor_tls_t *tls, buf_t *buf, size_t sz, size_t *buf_flushlen);
+
+int write_to_buf(const char *string, size_t string_len, buf_t *buf);
+int write_to_buf_zlib(buf_t *buf, tor_zlib_state_t *state,
+                      const char *data, size_t data_len, int done);
+int move_buf_to_buf(buf_t *buf_out, buf_t *buf_in, size_t *buf_flushlen);
+int fetch_from_buf(char *string, size_t string_len, buf_t *buf);
+int fetch_var_cell_from_buf(buf_t *buf, var_cell_t **out, int linkproto);
+int fetch_from_buf_http(buf_t *buf,
+                        char **headers_out, size_t max_headerlen,
+                        char **body_out, size_t *body_used, size_t max_bodylen,
+                        int force_complete);
+int fetch_from_buf_socks(buf_t *buf, socks_request_t *req,
+                         int log_sockstype, int safe_socks);
+int fetch_from_buf_socks_client(buf_t *buf, int state, char **reason);
+int fetch_from_buf_line(buf_t *buf, char *data_out, size_t *data_len);
+
+int peek_buf_has_control0_command(buf_t *buf);
+
+void assert_buf_ok(buf_t *buf);
+
+#ifdef BUFFERS_PRIVATE
+int buf_find_string_offset(const buf_t *buf, const char *s, size_t n);
+#endif
+
+#endif
+
index e8b78eab54791277dc17f4e1944806e8212131a3..0f0d4e152019db91f983ca82ffb86b948a14d976 100644 (file)
@@ -11,6 +11,7 @@
  **/
 
 #include "or.h"
+#include "buffers.h"
 #include "dnsserv.h"
 #include "geoip.h"
 #include "rendclient.h"
index 44e366b60ce233949e9eb3ebd0368db3d369416c..84752f15b7de9d26ff6529d0211f547d4860eed7 100644 (file)
@@ -10,6 +10,7 @@
  **/
 
 #include "or.h"
+#include "buffers.h"
 #include "dnsserv.h"
 #include "rendclient.h"
 #include "rendcommon.h"
index b1ed1744946e79472dd0ae3e2434decca0db219d..d7958cb4e408490cfea9b571f1ab93a5cc28d240 100644 (file)
@@ -11,6 +11,7 @@
  **/
 
 #include "or.h"
+#include "buffers.h"
 #include "geoip.h"
 #include "router.h"
 #include "routerlist.h"
index b99451327d907d729a25fe920b4c71e837ec55aa..1c61a08c039194731be160852ba240d00775d11e 100644 (file)
@@ -11,6 +11,7 @@
 #define CONTROL_PRIVATE
 
 #include "or.h"
+#include "buffers.h"
 #include "dnsserv.h"
 #include "geoip.h"
 #include "router.h"
index b3514af608d85733d6443c86e2cc0782081d7614..e5e4a3ea683cafbeec636b952041112d43f036b7 100644 (file)
@@ -13,6 +13,7 @@
  **/
 
 #include "or.h"
+#include "buffers.h"
 #include "router.h"
 
 /** The maximum number of cpuworker processes we will keep around. */
index d1bb78f20f60e564f95b5f790261441ac403c459..591377acab13ab809cfecb5526ccddcdc5b940ad 100644 (file)
@@ -4,6 +4,7 @@
 /* See LICENSE for licensing information */
 
 #include "or.h"
+#include "buffers.h"
 #include "geoip.h"
 #include "rendclient.h"
 #include "rendcommon.h"
index 59a8fdc88173361fc75ccbe7df70964eddf95ebc..d24fca027a73f532d3408898a41386c204035ccc 100644 (file)
@@ -5,6 +5,7 @@
 
 #define DIRSERV_PRIVATE
 #include "or.h"
+#include "buffers.h"
 #include "router.h"
 #include "routerlist.h"
 
index 4bd3b0a0fcb1bbdf56c8fc6fc05027529eb483e5..f206a463e0ca7dcad5146d8bb8e1e2ecfcd151f0 100644 (file)
@@ -12,6 +12,7 @@
 
 #define MAIN_PRIVATE
 #include "or.h"
+#include "buffers.h"
 #include "dnsserv.h"
 #include "geoip.h"
 #include "rendclient.h"
index ef2a3030064dbffe03cafcb4b00291e8c9199f31..e3d6543ff5a038837717fb1dbdd553cea680f7c0 100644 (file)
@@ -2911,51 +2911,6 @@ struct socks_request_t {
 
 /* all the function prototypes go here */
 
-/********************************* buffers.c ***************************/
-
-buf_t *buf_new(void);
-buf_t *buf_new_with_capacity(size_t size);
-void buf_free(buf_t *buf);
-void buf_clear(buf_t *buf);
-void buf_shrink(buf_t *buf);
-void buf_shrink_freelists(int free_all);
-void buf_dump_freelist_sizes(int severity);
-
-size_t buf_datalen(const buf_t *buf);
-size_t buf_allocation(const buf_t *buf);
-size_t buf_slack(const buf_t *buf);
-const char *_buf_peek_raw_buffer(const buf_t *buf);
-
-int read_to_buf(int s, size_t at_most, buf_t *buf, int *reached_eof,
-                int *socket_error);
-int read_to_buf_tls(tor_tls_t *tls, size_t at_most, buf_t *buf);
-
-int flush_buf(int s, buf_t *buf, size_t sz, size_t *buf_flushlen);
-int flush_buf_tls(tor_tls_t *tls, buf_t *buf, size_t sz, size_t *buf_flushlen);
-
-int write_to_buf(const char *string, size_t string_len, buf_t *buf);
-int write_to_buf_zlib(buf_t *buf, tor_zlib_state_t *state,
-                      const char *data, size_t data_len, int done);
-int move_buf_to_buf(buf_t *buf_out, buf_t *buf_in, size_t *buf_flushlen);
-int fetch_from_buf(char *string, size_t string_len, buf_t *buf);
-int fetch_var_cell_from_buf(buf_t *buf, var_cell_t **out, int linkproto);
-int fetch_from_buf_http(buf_t *buf,
-                        char **headers_out, size_t max_headerlen,
-                        char **body_out, size_t *body_used, size_t max_bodylen,
-                        int force_complete);
-int fetch_from_buf_socks(buf_t *buf, socks_request_t *req,
-                         int log_sockstype, int safe_socks);
-int fetch_from_buf_socks_client(buf_t *buf, int state, char **reason);
-int fetch_from_buf_line(buf_t *buf, char *data_out, size_t *data_len);
-
-int peek_buf_has_control0_command(buf_t *buf);
-
-void assert_buf_ok(buf_t *buf);
-
-#ifdef BUFFERS_PRIVATE
-int buf_find_string_offset(const buf_t *buf, const char *s, size_t n);
-#endif
-
 /********************************* circuitbuild.c **********************/
 
 /** How many hops does a general-purpose circuit have by default? */
index 2b0a7d3ae54d6eebc32ad41f232cf247bdfb105d..c7d6edaed924cdf83aea4c564b571beb5caa02b0 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <math.h>
 #include "or.h"
+#include "buffers.h"
 #include "geoip.h"
 #include "mempool.h"
 #include "rendcommon.h"
index 6cf9ea075fd276a49c737ae3bbacbde236721cc6..baffd9e3c0219684b8077148aaa05d31bfddb0d7 100644 (file)
@@ -43,6 +43,7 @@ long int lround(double x);
 double fabs(double x);
 
 #include "or.h"
+#include "buffers.c"
 #include "geoip.h"
 #include "rendcommon.h"
 #include "test.h"