diff options
author | David Goulet <dgoulet@torproject.org> | 2017-03-07 14:33:03 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-08-08 20:29:33 -0400 |
commit | 79e8d113d5ebfbc5ccf76f5db7bc0259a29520fc (patch) | |
tree | 51fe87267864641b0855d2ded4c7164517b876bd /src/or/hs_cell.c | |
parent | d765cf30b51dfcd58756b6b3d24a14ac2c47f3e8 (diff) | |
download | tor-79e8d113d5ebfbc5ccf76f5db7bc0259a29520fc.tar.gz tor-79e8d113d5ebfbc5ccf76f5db7bc0259a29520fc.zip |
prop224: Handle service INTRO_ESTABLISHED cell
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/hs_cell.c')
-rw-r--r-- | src/or/hs_cell.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/or/hs_cell.c b/src/or/hs_cell.c index e15f4e3e55..0d34ef5965 100644 --- a/src/or/hs_cell.c +++ b/src/or/hs_cell.c @@ -161,3 +161,25 @@ hs_cell_build_establish_intro(const char *circ_nonce, return cell_len; } +/* Parse the INTRO_ESTABLISHED cell in the payload of size payload_len. If we + * are successful at parsing it, return the length of the parsed cell else a + * negative value on error. */ +ssize_t +hs_cell_parse_intro_established(const uint8_t *payload, size_t payload_len) +{ + ssize_t ret; + trn_cell_intro_established_t *cell = NULL; + + tor_assert(payload); + + /* Try to parse the payload into a cell making sure we do actually have a + * valid cell. */ + ret = trn_cell_intro_established_parse(&cell, payload, payload_len); + if (ret >= 0) { + /* On success, we do not keep the cell, we just notify the caller that it + * was successfully parsed. */ + trn_cell_intro_established_free(cell); + } + return ret; +} + |