summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
Diffstat (limited to 'src/or')
-rw-r--r--src/or/cell_queue_st.h28
-rw-r--r--src/or/cell_st.h20
-rw-r--r--src/or/channel.c2
-rw-r--r--src/or/channelpadding.c1
-rw-r--r--src/or/channeltls.c3
-rw-r--r--src/or/circpathbias.c1
-rw-r--r--src/or/circuit_st.h2
-rw-r--r--src/or/circuitbuild.c1
-rw-r--r--src/or/circuitmux.c2
-rw-r--r--src/or/command.c2
-rw-r--r--src/or/connection_edge.c1
-rw-r--r--src/or/connection_or.c3
-rw-r--r--src/or/destroy_cell_queue_st.h27
-rw-r--r--src/or/include.am4
-rw-r--r--src/or/main.c1
-rw-r--r--src/or/onion.c1
-rw-r--r--src/or/or.h59
-rw-r--r--src/or/proto_cell.c2
-rw-r--r--src/or/relay.c3
-rw-r--r--src/or/relay_crypto.c1
-rw-r--r--src/or/var_cell_st.h23
21 files changed, 134 insertions, 53 deletions
diff --git a/src/or/cell_queue_st.h b/src/or/cell_queue_st.h
new file mode 100644
index 0000000000..6c429eacce
--- /dev/null
+++ b/src/or/cell_queue_st.h
@@ -0,0 +1,28 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef PACKED_CELL_ST_H
+#define PACKED_CELL_ST_H
+
+/** A cell as packed for writing to the network. */
+struct packed_cell_t {
+ /** Next cell queued on this circuit. */
+ TOR_SIMPLEQ_ENTRY(packed_cell_t) next;
+ char body[CELL_MAX_NETWORK_SIZE]; /**< Cell as packed for network. */
+ uint32_t inserted_timestamp; /**< Time (in timestamp units) when this cell
+ * was inserted */
+};
+
+/** A queue of cells on a circuit, waiting to be added to the
+ * or_connection_t's outbuf. */
+struct cell_queue_t {
+ /** Linked list of packed_cell_t*/
+ TOR_SIMPLEQ_HEAD(cell_simpleq, packed_cell_t) head;
+ int n; /**< The number of cells in the queue. */
+};
+
+#endif
+
diff --git a/src/or/cell_st.h b/src/or/cell_st.h
new file mode 100644
index 0000000000..08ed290871
--- /dev/null
+++ b/src/or/cell_st.h
@@ -0,0 +1,20 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef CELL_ST_H
+#define CELL_ST_H
+
+/** Parsed onion routing cell. All communication between nodes
+ * is via cells. */
+struct cell_t {
+ circid_t circ_id; /**< Circuit which received the cell. */
+ uint8_t command; /**< Type of the cell: one of CELL_PADDING, CELL_CREATE,
+ * CELL_DESTROY, etc */
+ uint8_t payload[CELL_PAYLOAD_SIZE]; /**< Cell body. */
+};
+
+#endif
+
diff --git a/src/or/channel.c b/src/or/channel.c
index c30e508018..d53e0d2e3f 100644
--- a/src/or/channel.c
+++ b/src/or/channel.c
@@ -80,6 +80,8 @@
#include "networkstatus.h"
#include "rendservice.h"
+#include "cell_queue_st.h"
+
/* Global lists of channels */
/* All channel_t instances */
diff --git a/src/or/channelpadding.c b/src/or/channelpadding.c
index 7eb0cc282f..e3aa2dc103 100644
--- a/src/or/channelpadding.c
+++ b/src/or/channelpadding.c
@@ -23,6 +23,7 @@
#include "compat_time.h"
#include "rendservice.h"
+#include "cell_st.h"
#include "or_connection_st.h"
STATIC int32_t channelpadding_get_netflow_inactive_timeout_ms(
diff --git a/src/or/channeltls.c b/src/or/channeltls.c
index dd0c1628c4..e2b6cabd46 100644
--- a/src/or/channeltls.c
+++ b/src/or/channeltls.c
@@ -60,10 +60,13 @@
#include "channelpadding_negotiation.h"
#include "channelpadding.h"
+#include "cell_st.h"
+#include "cell_queue_st.h"
#include "or_connection_st.h"
#include "or_handshake_certs_st.h"
#include "or_handshake_state_st.h"
#include "routerinfo_st.h"
+#include "var_cell_st.h"
/** How many CELL_PADDING cells have we received, ever? */
uint64_t stats_n_padding_cells_processed = 0;
diff --git a/src/or/circpathbias.c b/src/or/circpathbias.c
index 9ca45df273..a36d67526d 100644
--- a/src/or/circpathbias.c
+++ b/src/or/circpathbias.c
@@ -35,6 +35,7 @@
#include "networkstatus.h"
#include "relay.h"
+#include "cell_st.h"
#include "cpath_build_state_st.h"
#include "crypt_path_st.h"
#include "origin_circuit_st.h"
diff --git a/src/or/circuit_st.h b/src/or/circuit_st.h
index 2c4f72a725..f977d542dd 100644
--- a/src/or/circuit_st.h
+++ b/src/or/circuit_st.h
@@ -9,6 +9,8 @@
#include "or.h"
+#include "cell_queue_st.h"
+
/**
* A circuit is a path over the onion routing
* network. Applications can connect to one end of the circuit, and can
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 103dd6eb9b..41afb75439 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -65,6 +65,7 @@
#include "routerset.h"
#include "transports.h"
+#include "cell_st.h"
#include "cpath_build_state_st.h"
#include "entry_connection_st.h"
#include "node_st.h"
diff --git a/src/or/circuitmux.c b/src/or/circuitmux.c
index 5f7f002f41..e073311753 100644
--- a/src/or/circuitmux.c
+++ b/src/or/circuitmux.c
@@ -75,6 +75,8 @@
#include "circuitmux.h"
#include "relay.h"
+#include "cell_queue_st.h"
+#include "destroy_cell_queue_st.h"
#include "or_circuit_st.h"
/*
diff --git a/src/or/command.c b/src/or/command.c
index 148578a26b..39136966ec 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -56,8 +56,10 @@
#include "router.h"
#include "routerlist.h"
+#include "cell_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
+#include "var_cell_st.h"
/** How many CELL_CREATE cells have we received, ever? */
uint64_t stats_n_create_cells_processed = 0;
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index e177b0ee2d..4f1b5d2d58 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -97,6 +97,7 @@
#include "routerset.h"
#include "circuitbuild.h"
+#include "cell_st.h"
#include "cpath_build_state_st.h"
#include "dir_connection_st.h"
#include "entry_connection_st.h"
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 1810c39546..bbd6fa0edc 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -61,10 +61,13 @@
#include "torcert.h"
#include "channelpadding.h"
+#include "cell_st.h"
+#include "cell_queue_st.h"
#include "or_connection_st.h"
#include "or_handshake_certs_st.h"
#include "or_handshake_state_st.h"
#include "routerinfo_st.h"
+#include "var_cell_st.h"
static int connection_tls_finish_handshake(or_connection_t *conn);
static int connection_or_launch_v3_or_handshake(or_connection_t *conn);
diff --git a/src/or/destroy_cell_queue_st.h b/src/or/destroy_cell_queue_st.h
new file mode 100644
index 0000000000..67c25935e4
--- /dev/null
+++ b/src/or/destroy_cell_queue_st.h
@@ -0,0 +1,27 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef DESTROY_CELL_QUEUE_ST_H
+#define DESTROY_CELL_QUEUE_ST_H
+
+/** A single queued destroy cell. */
+struct destroy_cell_t {
+ TOR_SIMPLEQ_ENTRY(destroy_cell_t) next;
+ circid_t circid;
+ uint32_t inserted_timestamp; /**< Time (in timestamp units) when this cell
+ * was inserted */
+ uint8_t reason;
+};
+
+/** A queue of destroy cells on a channel. */
+struct destroy_cell_queue_t {
+ /** Linked list of packed_cell_t */
+ TOR_SIMPLEQ_HEAD(dcell_simpleq, destroy_cell_t) head;
+ int n; /**< The number of cells in the queue. */
+};
+
+#endif
+
diff --git a/src/or/include.am b/src/or/include.am
index cc059ef514..ec8e275562 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -184,6 +184,8 @@ ORHEADERS = \
src/or/authority_cert_st.h \
src/or/auth_dirs.inc \
src/or/bridges.h \
+ src/or/cell_st.h \
+ src/or/cell_queue_st.h \
src/or/channel.h \
src/or/channelpadding.h \
src/or/channeltls.h \
@@ -213,6 +215,7 @@ ORHEADERS = \
src/or/crypt_path_reference_st.h \
src/or/cpuworker.h \
src/or/desc_store_st.h \
+ src/or/destroy_cell_queue_st.h \
src/or/directory.h \
src/or/dirserv.h \
src/or/dir_connection_st.h \
@@ -316,6 +319,7 @@ ORHEADERS = \
src/or/torcert.h \
src/or/tor_api_internal.h \
src/or/tor_version_st.h \
+ src/or/var_cell_st.h \
src/or/vote_microdesc_hash_st.h \
src/or/vote_routerstatus_st.h \
src/or/vote_timing_st.h \
diff --git a/src/or/main.c b/src/or/main.c
index 664105046b..bb5aaaf608 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -122,6 +122,7 @@
#include "dirauth/mode.h"
#include "dirauth/shared_random.h"
+#include "cell_st.h"
#include "entry_connection_st.h"
#include "networkstatus_st.h"
#include "or_connection_st.h"
diff --git a/src/or/onion.c b/src/or/onion.c
index 813ad265ee..ac2f40a553 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -77,6 +77,7 @@
#include "rephist.h"
#include "router.h"
+#include "cell_st.h"
#include "or_circuit_st.h"
// trunnel
diff --git a/src/or/or.h b/src/or/or.h
index 958c1e2bb5..66c863a828 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1176,26 +1176,12 @@ typedef struct channel_tls_s channel_tls_t;
typedef struct circuitmux_s circuitmux_t;
-/** Parsed onion routing cell. All communication between nodes
- * is via cells. */
-typedef struct cell_t {
- circid_t circ_id; /**< Circuit which received the cell. */
- uint8_t command; /**< Type of the cell: one of CELL_PADDING, CELL_CREATE,
- * CELL_DESTROY, etc */
- uint8_t payload[CELL_PAYLOAD_SIZE]; /**< Cell body. */
-} cell_t;
-
-/** Parsed variable-length onion routing cell. */
-typedef struct var_cell_t {
- /** Type of the cell: CELL_VERSIONS, etc. */
- uint8_t command;
- /** Circuit thich received the cell */
- circid_t circ_id;
- /** Number of bytes actually stored in <b>payload</b> */
- uint16_t payload_len;
- /** Payload of this cell */
- uint8_t payload[FLEXIBLE_ARRAY_MEMBER];
-} var_cell_t;
+typedef struct cell_t cell_t;
+typedef struct var_cell_t var_cell_t;
+typedef struct packed_cell_t packed_cell_t;
+typedef struct cell_queue_t cell_queue_t;
+typedef struct destroy_cell_t destroy_cell_t;
+typedef struct destroy_cell_queue_t destroy_cell_queue_t;
/** A parsed Extended ORPort message. */
typedef struct ext_or_cmd_t {
@@ -1204,39 +1190,6 @@ typedef struct ext_or_cmd_t {
char body[FLEXIBLE_ARRAY_MEMBER]; /** Message body */
} ext_or_cmd_t;
-/** A cell as packed for writing to the network. */
-typedef struct packed_cell_t {
- /** Next cell queued on this circuit. */
- TOR_SIMPLEQ_ENTRY(packed_cell_t) next;
- char body[CELL_MAX_NETWORK_SIZE]; /**< Cell as packed for network. */
- uint32_t inserted_timestamp; /**< Time (in timestamp units) when this cell
- * was inserted */
-} packed_cell_t;
-
-/** A queue of cells on a circuit, waiting to be added to the
- * or_connection_t's outbuf. */
-typedef struct cell_queue_t {
- /** Linked list of packed_cell_t*/
- TOR_SIMPLEQ_HEAD(cell_simpleq, packed_cell_t) head;
- int n; /**< The number of cells in the queue. */
-} cell_queue_t;
-
-/** A single queued destroy cell. */
-typedef struct destroy_cell_t {
- TOR_SIMPLEQ_ENTRY(destroy_cell_t) next;
- circid_t circid;
- uint32_t inserted_timestamp; /**< Time (in timestamp units) when this cell
- * was inserted */
- uint8_t reason;
-} destroy_cell_t;
-
-/** A queue of destroy cells on a channel. */
-typedef struct destroy_cell_queue_t {
- /** Linked list of packed_cell_t */
- TOR_SIMPLEQ_HEAD(dcell_simpleq, destroy_cell_t) head;
- int n; /**< The number of cells in the queue. */
-} destroy_cell_queue_t;
-
/** Beginning of a RELAY cell payload. */
typedef struct {
uint8_t command; /**< The end-to-end relay command. */
diff --git a/src/or/proto_cell.c b/src/or/proto_cell.c
index 75eb2a7e7f..84620ce37d 100644
--- a/src/or/proto_cell.c
+++ b/src/or/proto_cell.c
@@ -10,6 +10,8 @@
#include "connection_or.h"
+#include "var_cell_st.h"
+
/** True iff the cell command <b>command</b> is one that implies a
* variable-length cell in Tor link protocol <b>linkproto</b>. */
static inline int
diff --git a/src/or/relay.c b/src/or/relay.c
index ff97b52664..62c9204dbe 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -82,8 +82,11 @@
#include "scheduler.h"
#include "rephist.h"
+#include "cell_st.h"
+#include "cell_queue_st.h"
#include "cpath_build_state_st.h"
#include "dir_connection_st.h"
+#include "destroy_cell_queue_st.h"
#include "entry_connection_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
diff --git a/src/or/relay_crypto.c b/src/or/relay_crypto.c
index 7603d3b4e1..82ff9aca88 100644
--- a/src/or/relay_crypto.c
+++ b/src/or/relay_crypto.c
@@ -12,6 +12,7 @@
#include "relay.h"
#include "relay_crypto.h"
+#include "cell_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
diff --git a/src/or/var_cell_st.h b/src/or/var_cell_st.h
new file mode 100644
index 0000000000..1a9ea07590
--- /dev/null
+++ b/src/or/var_cell_st.h
@@ -0,0 +1,23 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef VAR_CELL_ST_H
+#define VAR_CELL_ST_H
+
+/** Parsed variable-length onion routing cell. */
+struct var_cell_t {
+ /** Type of the cell: CELL_VERSIONS, etc. */
+ uint8_t command;
+ /** Circuit thich received the cell */
+ circid_t circ_id;
+ /** Number of bytes actually stored in <b>payload</b> */
+ uint16_t payload_len;
+ /** Payload of this cell */
+ uint8_t payload[FLEXIBLE_ARRAY_MEMBER];
+};
+
+#endif
+