diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-07-16 09:57:52 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-07-16 09:57:52 -0400 |
commit | b0d7b100886ef14a785f6ca1de968df9a884d0a7 (patch) | |
tree | 931f94cbc9dd273a6df31ef3e93623babfc1ec2b /src/core/or/connection_edge.c | |
parent | 10d8555e7db2f4835b4fc9a0f4592e470a974c5f (diff) | |
download | tor-b0d7b100886ef14a785f6ca1de968df9a884d0a7.tar.gz tor-b0d7b100886ef14a785f6ca1de968df9a884d0a7.zip |
Improve documentation for our TO_*_CONN() cast functions.
Preliminary work for #40046.
Diffstat (limited to 'src/core/or/connection_edge.c')
-rw-r--r-- | src/core/or/connection_edge.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/core/or/connection_edge.c b/src/core/or/connection_edge.c index 8eb9f8ba0f..30cfb18f0f 100644 --- a/src/core/or/connection_edge.c +++ b/src/core/or/connection_edge.c @@ -166,8 +166,12 @@ static int connection_exit_connect_dir(edge_connection_t *exitconn); static int consider_plaintext_ports(entry_connection_t *conn, uint16_t port); static int connection_ap_supports_optimistic_data(const entry_connection_t *); -/** Convert a connection_t* to an edge_connection_t*; assert if the cast is - * invalid. */ +/** + * Cast a `connection_t *` to an `edge_connection_t *`. + * + * Exit with an assertion failure if the input is not an + * `edge_connection_t`. + **/ edge_connection_t * TO_EDGE_CONN(connection_t *c) { @@ -176,6 +180,12 @@ TO_EDGE_CONN(connection_t *c) return DOWNCAST(edge_connection_t, c); } +/** + * Cast a `connection_t *` to an `entry_connection_t *`. + * + * Exit with an assertion failure if the input is not an + * `entry_connection_t`. + **/ entry_connection_t * TO_ENTRY_CONN(connection_t *c) { @@ -183,6 +193,12 @@ TO_ENTRY_CONN(connection_t *c) return (entry_connection_t*) SUBTYPE_P(c, entry_connection_t, edge_.base_); } +/** + * Cast an `edge_connection_t *` to an `entry_connection_t *`. + * + * Exit with an assertion failure if the input is not an + * `entry_connection_t`. + **/ entry_connection_t * EDGE_TO_ENTRY_CONN(edge_connection_t *c) { |