diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-02-09 00:56:53 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-02-09 00:56:53 -0500 |
commit | 076654ce8423d2b8ab7285b22c13d4002942bd8b (patch) | |
tree | 2e4eef960efa18ca461a8f846acd8f921746441a /src/or/or.h | |
parent | 8e8c0674c4729a6aa39ded658e800baa654fe289 (diff) | |
download | tor-076654ce8423d2b8ab7285b22c13d4002942bd8b.tar.gz tor-076654ce8423d2b8ab7285b22c13d4002942bd8b.zip |
Replace magic constants for wide_circ_ids with inline function calls
Diffstat (limited to 'src/or/or.h')
-rw-r--r-- | src/or/or.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/or/or.h b/src/or/or.h index 736438e6e7..356953b436 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -869,6 +869,23 @@ typedef enum { /** Maximum length of a header on a variable-length cell. */ #define VAR_CELL_MAX_HEADER_SIZE 7 +static int get_cell_network_size(int wide_circ_ids); +static INLINE int get_cell_network_size(int wide_circ_ids) +{ + return wide_circ_ids ? CELL_MAX_NETWORK_SIZE : CELL_MAX_NETWORK_SIZE - 2; +} +static int get_var_cell_header_size(int wide_circ_ids); +static INLINE int get_var_cell_header_size(int wide_circ_ids) +{ + return wide_circ_ids ? VAR_CELL_MAX_HEADER_SIZE : + VAR_CELL_MAX_HEADER_SIZE - 2; +} +static int get_circ_id_size(int wide_circ_ids); +static INLINE int get_circ_id_size(int wide_circ_ids) +{ + return wide_circ_ids ? 4 : 2; +} + /** Number of bytes in a relay cell's header (not including general cell * header). */ #define RELAY_HEADER_SIZE (1+2+2+4+2) |