summaryrefslogtreecommitdiff
path: root/src/trunnel/hs/cell_establish_intro.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-04-11 13:46:41 -0400
committerDavid Goulet <dgoulet@torproject.org>2017-04-11 13:46:41 -0400
commit6bacc3c7a88509043613d3bc29534c0ecf8803b1 (patch)
treef8216478ca43bf5988d57b7df5065d9496fa0114 /src/trunnel/hs/cell_establish_intro.c
parent01fc93ffef3843a86710718c12ba9be67dcca2bc (diff)
downloadtor-6bacc3c7a88509043613d3bc29534c0ecf8803b1.tar.gz
tor-6bacc3c7a88509043613d3bc29534c0ecf8803b1.zip
hs: Change trunnel prop224 cell's namespace
One of the goals of this change is to have trunnel API/ABI being more explicit so we namespace them with "trn_*". Furthermore, we can now create hs_cells.[ch] without having to confuse it with trunnel which used to be "hs_cell_*" before that change. Here are the perl line that were used for this rename: perl -i -pe 's/cell_extension/trn_cell_extension/g;' src/*/*.[ch] perl -i -pe 's/cell_extension/trn_cell_extension/g;' src/trunnel/hs/*.trunnel perl -i -pe 's/hs_cell_/trn_cell_/g;' src/*/*.[ch] perl -i -pe 's/hs_cell_/trn_cell_/g;' src/trunnel/hs/*.trunnel And then "./scripts/codegen/run_trunnel.sh" with trunnel commit id 613fb1b98e58504e2b84ef56b1602b6380629043. Fixes #21919 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/trunnel/hs/cell_establish_intro.c')
-rw-r--r--src/trunnel/hs/cell_establish_intro.c242
1 files changed, 121 insertions, 121 deletions
diff --git a/src/trunnel/hs/cell_establish_intro.c b/src/trunnel/hs/cell_establish_intro.c
index 633bd7c214..22e198c369 100644
--- a/src/trunnel/hs/cell_establish_intro.c
+++ b/src/trunnel/hs/cell_establish_intro.c
@@ -28,18 +28,18 @@ int cellestablishintro_deadcode_dummy__ = 0;
} \
} while (0)
-typedef struct cell_extension_st cell_extension_t;
-cell_extension_t *cell_extension_new(void);
-void cell_extension_free(cell_extension_t *victim);
-ssize_t cell_extension_parse(cell_extension_t **output, const uint8_t *input, const size_t len_in);
-ssize_t cell_extension_encoded_len(const cell_extension_t *obj);
-ssize_t cell_extension_encode(uint8_t *output, size_t avail, const cell_extension_t *input);
-const char *cell_extension_check(const cell_extension_t *obj);
-int cell_extension_clear_errors(cell_extension_t *obj);
-hs_cell_establish_intro_t *
-hs_cell_establish_intro_new(void)
-{
- hs_cell_establish_intro_t *val = trunnel_calloc(1, sizeof(hs_cell_establish_intro_t));
+typedef struct trn_cell_extension_st trn_cell_extension_t;
+trn_cell_extension_t *trn_cell_extension_new(void);
+void trn_cell_extension_free(trn_cell_extension_t *victim);
+ssize_t trn_cell_extension_parse(trn_cell_extension_t **output, const uint8_t *input, const size_t len_in);
+ssize_t trn_cell_extension_encoded_len(const trn_cell_extension_t *obj);
+ssize_t trn_cell_extension_encode(uint8_t *output, size_t avail, const trn_cell_extension_t *input);
+const char *trn_cell_extension_check(const trn_cell_extension_t *obj);
+int trn_cell_extension_clear_errors(trn_cell_extension_t *obj);
+trn_cell_establish_intro_t *
+trn_cell_establish_intro_new(void)
+{
+ trn_cell_establish_intro_t *val = trunnel_calloc(1, sizeof(trn_cell_establish_intro_t));
if (NULL == val)
return NULL;
return val;
@@ -48,39 +48,39 @@ hs_cell_establish_intro_new(void)
/** Release all storage held inside 'obj', but do not free 'obj'.
*/
static void
-hs_cell_establish_intro_clear(hs_cell_establish_intro_t *obj)
+trn_cell_establish_intro_clear(trn_cell_establish_intro_t *obj)
{
(void) obj;
TRUNNEL_DYNARRAY_WIPE(&obj->auth_key);
TRUNNEL_DYNARRAY_CLEAR(&obj->auth_key);
- cell_extension_free(obj->extensions);
+ trn_cell_extension_free(obj->extensions);
obj->extensions = NULL;
TRUNNEL_DYNARRAY_WIPE(&obj->sig);
TRUNNEL_DYNARRAY_CLEAR(&obj->sig);
}
void
-hs_cell_establish_intro_free(hs_cell_establish_intro_t *obj)
+trn_cell_establish_intro_free(trn_cell_establish_intro_t *obj)
{
if (obj == NULL)
return;
- hs_cell_establish_intro_clear(obj);
- trunnel_memwipe(obj, sizeof(hs_cell_establish_intro_t));
+ trn_cell_establish_intro_clear(obj);
+ trunnel_memwipe(obj, sizeof(trn_cell_establish_intro_t));
trunnel_free_(obj);
}
const uint8_t *
-hs_cell_establish_intro_get_start_cell(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_get_start_cell(const trn_cell_establish_intro_t *inp)
{
return inp->start_cell;
}
uint8_t
-hs_cell_establish_intro_get_auth_key_type(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_get_auth_key_type(const trn_cell_establish_intro_t *inp)
{
return inp->auth_key_type;
}
int
-hs_cell_establish_intro_set_auth_key_type(hs_cell_establish_intro_t *inp, uint8_t val)
+trn_cell_establish_intro_set_auth_key_type(trn_cell_establish_intro_t *inp, uint8_t val)
{
if (! ((val == 0 || val == 1 || val == 2))) {
TRUNNEL_SET_ERROR_CODE(inp);
@@ -90,41 +90,41 @@ hs_cell_establish_intro_set_auth_key_type(hs_cell_establish_intro_t *inp, uint8_
return 0;
}
uint16_t
-hs_cell_establish_intro_get_auth_key_len(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_get_auth_key_len(const trn_cell_establish_intro_t *inp)
{
return inp->auth_key_len;
}
int
-hs_cell_establish_intro_set_auth_key_len(hs_cell_establish_intro_t *inp, uint16_t val)
+trn_cell_establish_intro_set_auth_key_len(trn_cell_establish_intro_t *inp, uint16_t val)
{
inp->auth_key_len = val;
return 0;
}
size_t
-hs_cell_establish_intro_getlen_auth_key(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getlen_auth_key(const trn_cell_establish_intro_t *inp)
{
return TRUNNEL_DYNARRAY_LEN(&inp->auth_key);
}
uint8_t
-hs_cell_establish_intro_get_auth_key(hs_cell_establish_intro_t *inp, size_t idx)
+trn_cell_establish_intro_get_auth_key(trn_cell_establish_intro_t *inp, size_t idx)
{
return TRUNNEL_DYNARRAY_GET(&inp->auth_key, idx);
}
uint8_t
-hs_cell_establish_intro_getconst_auth_key(const hs_cell_establish_intro_t *inp, size_t idx)
+trn_cell_establish_intro_getconst_auth_key(const trn_cell_establish_intro_t *inp, size_t idx)
{
- return hs_cell_establish_intro_get_auth_key((hs_cell_establish_intro_t*)inp, idx);
+ return trn_cell_establish_intro_get_auth_key((trn_cell_establish_intro_t*)inp, idx);
}
int
-hs_cell_establish_intro_set_auth_key(hs_cell_establish_intro_t *inp, size_t idx, uint8_t elt)
+trn_cell_establish_intro_set_auth_key(trn_cell_establish_intro_t *inp, size_t idx, uint8_t elt)
{
TRUNNEL_DYNARRAY_SET(&inp->auth_key, idx, elt);
return 0;
}
int
-hs_cell_establish_intro_add_auth_key(hs_cell_establish_intro_t *inp, uint8_t elt)
+trn_cell_establish_intro_add_auth_key(trn_cell_establish_intro_t *inp, uint8_t elt)
{
#if SIZE_MAX >= UINT16_MAX
if (inp->auth_key.n_ == UINT16_MAX)
@@ -138,17 +138,17 @@ hs_cell_establish_intro_add_auth_key(hs_cell_establish_intro_t *inp, uint8_t elt
}
uint8_t *
-hs_cell_establish_intro_getarray_auth_key(hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getarray_auth_key(trn_cell_establish_intro_t *inp)
{
return inp->auth_key.elts_;
}
const uint8_t *
-hs_cell_establish_intro_getconstarray_auth_key(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getconstarray_auth_key(const trn_cell_establish_intro_t *inp)
{
- return (const uint8_t *)hs_cell_establish_intro_getarray_auth_key((hs_cell_establish_intro_t*)inp);
+ return (const uint8_t *)trn_cell_establish_intro_getarray_auth_key((trn_cell_establish_intro_t*)inp);
}
int
-hs_cell_establish_intro_setlen_auth_key(hs_cell_establish_intro_t *inp, size_t newlen)
+trn_cell_establish_intro_setlen_auth_key(trn_cell_establish_intro_t *inp, size_t newlen)
{
uint8_t *newptr;
#if UINT16_MAX < SIZE_MAX
@@ -167,54 +167,54 @@ hs_cell_establish_intro_setlen_auth_key(hs_cell_establish_intro_t *inp, size_t n
TRUNNEL_SET_ERROR_CODE(inp);
return -1;
}
-struct cell_extension_st *
-hs_cell_establish_intro_get_extensions(hs_cell_establish_intro_t *inp)
+struct trn_cell_extension_st *
+trn_cell_establish_intro_get_extensions(trn_cell_establish_intro_t *inp)
{
return inp->extensions;
}
-const struct cell_extension_st *
-hs_cell_establish_intro_getconst_extensions(const hs_cell_establish_intro_t *inp)
+const struct trn_cell_extension_st *
+trn_cell_establish_intro_getconst_extensions(const trn_cell_establish_intro_t *inp)
{
- return hs_cell_establish_intro_get_extensions((hs_cell_establish_intro_t*) inp);
+ return trn_cell_establish_intro_get_extensions((trn_cell_establish_intro_t*) inp);
}
int
-hs_cell_establish_intro_set_extensions(hs_cell_establish_intro_t *inp, struct cell_extension_st *val)
+trn_cell_establish_intro_set_extensions(trn_cell_establish_intro_t *inp, struct trn_cell_extension_st *val)
{
if (inp->extensions && inp->extensions != val)
- cell_extension_free(inp->extensions);
- return hs_cell_establish_intro_set0_extensions(inp, val);
+ trn_cell_extension_free(inp->extensions);
+ return trn_cell_establish_intro_set0_extensions(inp, val);
}
int
-hs_cell_establish_intro_set0_extensions(hs_cell_establish_intro_t *inp, struct cell_extension_st *val)
+trn_cell_establish_intro_set0_extensions(trn_cell_establish_intro_t *inp, struct trn_cell_extension_st *val)
{
inp->extensions = val;
return 0;
}
const uint8_t *
-hs_cell_establish_intro_get_end_mac_fields(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_get_end_mac_fields(const trn_cell_establish_intro_t *inp)
{
return inp->end_mac_fields;
}
size_t
-hs_cell_establish_intro_getlen_handshake_mac(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getlen_handshake_mac(const trn_cell_establish_intro_t *inp)
{
(void)inp; return TRUNNEL_SHA3_256_LEN;
}
uint8_t
-hs_cell_establish_intro_get_handshake_mac(hs_cell_establish_intro_t *inp, size_t idx)
+trn_cell_establish_intro_get_handshake_mac(trn_cell_establish_intro_t *inp, size_t idx)
{
trunnel_assert(idx < TRUNNEL_SHA3_256_LEN);
return inp->handshake_mac[idx];
}
uint8_t
-hs_cell_establish_intro_getconst_handshake_mac(const hs_cell_establish_intro_t *inp, size_t idx)
+trn_cell_establish_intro_getconst_handshake_mac(const trn_cell_establish_intro_t *inp, size_t idx)
{
- return hs_cell_establish_intro_get_handshake_mac((hs_cell_establish_intro_t*)inp, idx);
+ return trn_cell_establish_intro_get_handshake_mac((trn_cell_establish_intro_t*)inp, idx);
}
int
-hs_cell_establish_intro_set_handshake_mac(hs_cell_establish_intro_t *inp, size_t idx, uint8_t elt)
+trn_cell_establish_intro_set_handshake_mac(trn_cell_establish_intro_t *inp, size_t idx, uint8_t elt)
{
trunnel_assert(idx < TRUNNEL_SHA3_256_LEN);
inp->handshake_mac[idx] = elt;
@@ -222,56 +222,56 @@ hs_cell_establish_intro_set_handshake_mac(hs_cell_establish_intro_t *inp, size_t
}
uint8_t *
-hs_cell_establish_intro_getarray_handshake_mac(hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getarray_handshake_mac(trn_cell_establish_intro_t *inp)
{
return inp->handshake_mac;
}
const uint8_t *
-hs_cell_establish_intro_getconstarray_handshake_mac(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getconstarray_handshake_mac(const trn_cell_establish_intro_t *inp)
{
- return (const uint8_t *)hs_cell_establish_intro_getarray_handshake_mac((hs_cell_establish_intro_t*)inp);
+ return (const uint8_t *)trn_cell_establish_intro_getarray_handshake_mac((trn_cell_establish_intro_t*)inp);
}
const uint8_t *
-hs_cell_establish_intro_get_end_sig_fields(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_get_end_sig_fields(const trn_cell_establish_intro_t *inp)
{
return inp->end_sig_fields;
}
uint16_t
-hs_cell_establish_intro_get_sig_len(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_get_sig_len(const trn_cell_establish_intro_t *inp)
{
return inp->sig_len;
}
int
-hs_cell_establish_intro_set_sig_len(hs_cell_establish_intro_t *inp, uint16_t val)
+trn_cell_establish_intro_set_sig_len(trn_cell_establish_intro_t *inp, uint16_t val)
{
inp->sig_len = val;
return 0;
}
size_t
-hs_cell_establish_intro_getlen_sig(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getlen_sig(const trn_cell_establish_intro_t *inp)
{
return TRUNNEL_DYNARRAY_LEN(&inp->sig);
}
uint8_t
-hs_cell_establish_intro_get_sig(hs_cell_establish_intro_t *inp, size_t idx)
+trn_cell_establish_intro_get_sig(trn_cell_establish_intro_t *inp, size_t idx)
{
return TRUNNEL_DYNARRAY_GET(&inp->sig, idx);
}
uint8_t
-hs_cell_establish_intro_getconst_sig(const hs_cell_establish_intro_t *inp, size_t idx)
+trn_cell_establish_intro_getconst_sig(const trn_cell_establish_intro_t *inp, size_t idx)
{
- return hs_cell_establish_intro_get_sig((hs_cell_establish_intro_t*)inp, idx);
+ return trn_cell_establish_intro_get_sig((trn_cell_establish_intro_t*)inp, idx);
}
int
-hs_cell_establish_intro_set_sig(hs_cell_establish_intro_t *inp, size_t idx, uint8_t elt)
+trn_cell_establish_intro_set_sig(trn_cell_establish_intro_t *inp, size_t idx, uint8_t elt)
{
TRUNNEL_DYNARRAY_SET(&inp->sig, idx, elt);
return 0;
}
int
-hs_cell_establish_intro_add_sig(hs_cell_establish_intro_t *inp, uint8_t elt)
+trn_cell_establish_intro_add_sig(trn_cell_establish_intro_t *inp, uint8_t elt)
{
#if SIZE_MAX >= UINT16_MAX
if (inp->sig.n_ == UINT16_MAX)
@@ -285,17 +285,17 @@ hs_cell_establish_intro_add_sig(hs_cell_establish_intro_t *inp, uint8_t elt)
}
uint8_t *
-hs_cell_establish_intro_getarray_sig(hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getarray_sig(trn_cell_establish_intro_t *inp)
{
return inp->sig.elts_;
}
const uint8_t *
-hs_cell_establish_intro_getconstarray_sig(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getconstarray_sig(const trn_cell_establish_intro_t *inp)
{
- return (const uint8_t *)hs_cell_establish_intro_getarray_sig((hs_cell_establish_intro_t*)inp);
+ return (const uint8_t *)trn_cell_establish_intro_getarray_sig((trn_cell_establish_intro_t*)inp);
}
int
-hs_cell_establish_intro_setlen_sig(hs_cell_establish_intro_t *inp, size_t newlen)
+trn_cell_establish_intro_setlen_sig(trn_cell_establish_intro_t *inp, size_t newlen)
{
uint8_t *newptr;
#if UINT16_MAX < SIZE_MAX
@@ -315,7 +315,7 @@ hs_cell_establish_intro_setlen_sig(hs_cell_establish_intro_t *inp, size_t newlen
return -1;
}
const char *
-hs_cell_establish_intro_check(const hs_cell_establish_intro_t *obj)
+trn_cell_establish_intro_check(const trn_cell_establish_intro_t *obj)
{
if (obj == NULL)
return "Object was NULL";
@@ -327,7 +327,7 @@ hs_cell_establish_intro_check(const hs_cell_establish_intro_t *obj)
return "Length mismatch for auth_key";
{
const char *msg;
- if (NULL != (msg = cell_extension_check(obj->extensions)))
+ if (NULL != (msg = trn_cell_extension_check(obj->extensions)))
return msg;
}
if (TRUNNEL_DYNARRAY_LEN(&obj->sig) != obj->sig_len)
@@ -336,11 +336,11 @@ hs_cell_establish_intro_check(const hs_cell_establish_intro_t *obj)
}
ssize_t
-hs_cell_establish_intro_encoded_len(const hs_cell_establish_intro_t *obj)
+trn_cell_establish_intro_encoded_len(const trn_cell_establish_intro_t *obj)
{
ssize_t result = 0;
- if (NULL != hs_cell_establish_intro_check(obj))
+ if (NULL != trn_cell_establish_intro_check(obj))
return -1;
@@ -353,8 +353,8 @@ hs_cell_establish_intro_encoded_len(const hs_cell_establish_intro_t *obj)
/* Length of u8 auth_key[auth_key_len] */
result += TRUNNEL_DYNARRAY_LEN(&obj->auth_key);
- /* Length of struct cell_extension extensions */
- result += cell_extension_encoded_len(obj->extensions);
+ /* Length of struct trn_cell_extension extensions */
+ result += trn_cell_extension_encoded_len(obj->extensions);
/* Length of u8 handshake_mac[TRUNNEL_SHA3_256_LEN] */
result += TRUNNEL_SHA3_256_LEN;
@@ -367,24 +367,24 @@ hs_cell_establish_intro_encoded_len(const hs_cell_establish_intro_t *obj)
return result;
}
int
-hs_cell_establish_intro_clear_errors(hs_cell_establish_intro_t *obj)
+trn_cell_establish_intro_clear_errors(trn_cell_establish_intro_t *obj)
{
int r = obj->trunnel_error_code_;
obj->trunnel_error_code_ = 0;
return r;
}
ssize_t
-hs_cell_establish_intro_encode(uint8_t *output, const size_t avail, const hs_cell_establish_intro_t *obj)
+trn_cell_establish_intro_encode(uint8_t *output, const size_t avail, const trn_cell_establish_intro_t *obj)
{
ssize_t result = 0;
size_t written = 0;
uint8_t *ptr = output;
const char *msg;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
- const ssize_t encoded_len = hs_cell_establish_intro_encoded_len(obj);
+ const ssize_t encoded_len = trn_cell_establish_intro_encoded_len(obj);
#endif
- if (NULL != (msg = hs_cell_establish_intro_check(obj)))
+ if (NULL != (msg = trn_cell_establish_intro_check(obj)))
goto check_failed;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
@@ -417,9 +417,9 @@ hs_cell_establish_intro_encode(uint8_t *output, const size_t avail, const hs_cel
written += elt_len; ptr += elt_len;
}
- /* Encode struct cell_extension extensions */
+ /* Encode struct trn_cell_extension extensions */
trunnel_assert(written <= avail);
- result = cell_extension_encode(ptr, avail - written, obj->extensions);
+ result = trn_cell_extension_encode(ptr, avail - written, obj->extensions);
if (result < 0)
goto fail; /* XXXXXXX !*/
written += result; ptr += result;
@@ -474,11 +474,11 @@ hs_cell_establish_intro_encode(uint8_t *output, const size_t avail, const hs_cel
return result;
}
-/** As hs_cell_establish_intro_parse(), but do not allocate the output
- * object.
+/** As trn_cell_establish_intro_parse(), but do not allocate the
+ * output object.
*/
static ssize_t
-hs_cell_establish_intro_parse_into(hs_cell_establish_intro_t *obj, const uint8_t *input, const size_t len_in)
+trn_cell_establish_intro_parse_into(trn_cell_establish_intro_t *obj, const uint8_t *input, const size_t len_in)
{
const uint8_t *ptr = input;
size_t remaining = len_in;
@@ -506,8 +506,8 @@ hs_cell_establish_intro_parse_into(hs_cell_establish_intro_t *obj, const uint8_t
memcpy(obj->auth_key.elts_, ptr, obj->auth_key_len);
ptr += obj->auth_key_len; remaining -= obj->auth_key_len;
- /* Parse struct cell_extension extensions */
- result = cell_extension_parse(&obj->extensions, ptr, remaining);
+ /* Parse struct trn_cell_extension extensions */
+ result = trn_cell_extension_parse(&obj->extensions, ptr, remaining);
if (result < 0)
goto relay_fail;
trunnel_assert((size_t)result <= remaining);
@@ -548,23 +548,23 @@ hs_cell_establish_intro_parse_into(hs_cell_establish_intro_t *obj, const uint8_t
}
ssize_t
-hs_cell_establish_intro_parse(hs_cell_establish_intro_t **output, const uint8_t *input, const size_t len_in)
+trn_cell_establish_intro_parse(trn_cell_establish_intro_t **output, const uint8_t *input, const size_t len_in)
{
ssize_t result;
- *output = hs_cell_establish_intro_new();
+ *output = trn_cell_establish_intro_new();
if (NULL == *output)
return -1;
- result = hs_cell_establish_intro_parse_into(*output, input, len_in);
+ result = trn_cell_establish_intro_parse_into(*output, input, len_in);
if (result < 0) {
- hs_cell_establish_intro_free(*output);
+ trn_cell_establish_intro_free(*output);
*output = NULL;
}
return result;
}
-hs_cell_intro_established_t *
-hs_cell_intro_established_new(void)
+trn_cell_intro_established_t *
+trn_cell_intro_established_new(void)
{
- hs_cell_intro_established_t *val = trunnel_calloc(1, sizeof(hs_cell_intro_established_t));
+ trn_cell_intro_established_t *val = trunnel_calloc(1, sizeof(trn_cell_intro_established_t));
if (NULL == val)
return NULL;
return val;
@@ -573,48 +573,48 @@ hs_cell_intro_established_new(void)
/** Release all storage held inside 'obj', but do not free 'obj'.
*/
static void
-hs_cell_intro_established_clear(hs_cell_intro_established_t *obj)
+trn_cell_intro_established_clear(trn_cell_intro_established_t *obj)
{
(void) obj;
- cell_extension_free(obj->extensions);
+ trn_cell_extension_free(obj->extensions);
obj->extensions = NULL;
}
void
-hs_cell_intro_established_free(hs_cell_intro_established_t *obj)
+trn_cell_intro_established_free(trn_cell_intro_established_t *obj)
{
if (obj == NULL)
return;
- hs_cell_intro_established_clear(obj);
- trunnel_memwipe(obj, sizeof(hs_cell_intro_established_t));
+ trn_cell_intro_established_clear(obj);
+ trunnel_memwipe(obj, sizeof(trn_cell_intro_established_t));
trunnel_free_(obj);
}
-struct cell_extension_st *
-hs_cell_intro_established_get_extensions(hs_cell_intro_established_t *inp)
+struct trn_cell_extension_st *
+trn_cell_intro_established_get_extensions(trn_cell_intro_established_t *inp)
{
return inp->extensions;
}
-const struct cell_extension_st *
-hs_cell_intro_established_getconst_extensions(const hs_cell_intro_established_t *inp)
+const struct trn_cell_extension_st *
+trn_cell_intro_established_getconst_extensions(const trn_cell_intro_established_t *inp)
{
- return hs_cell_intro_established_get_extensions((hs_cell_intro_established_t*) inp);
+ return trn_cell_intro_established_get_extensions((trn_cell_intro_established_t*) inp);
}
int
-hs_cell_intro_established_set_extensions(hs_cell_intro_established_t *inp, struct cell_extension_st *val)
+trn_cell_intro_established_set_extensions(trn_cell_intro_established_t *inp, struct trn_cell_extension_st *val)
{
if (inp->extensions && inp->extensions != val)
- cell_extension_free(inp->extensions);
- return hs_cell_intro_established_set0_extensions(inp, val);
+ trn_cell_extension_free(inp->extensions);
+ return trn_cell_intro_established_set0_extensions(inp, val);
}
int
-hs_cell_intro_established_set0_extensions(hs_cell_intro_established_t *inp, struct cell_extension_st *val)
+trn_cell_intro_established_set0_extensions(trn_cell_intro_established_t *inp, struct trn_cell_extension_st *val)
{
inp->extensions = val;
return 0;
}
const char *
-hs_cell_intro_established_check(const hs_cell_intro_established_t *obj)
+trn_cell_intro_established_check(const trn_cell_intro_established_t *obj)
{
if (obj == NULL)
return "Object was NULL";
@@ -622,53 +622,53 @@ hs_cell_intro_established_check(const hs_cell_intro_established_t *obj)
return "A set function failed on this object";
{
const char *msg;
- if (NULL != (msg = cell_extension_check(obj->extensions)))
+ if (NULL != (msg = trn_cell_extension_check(obj->extensions)))
return msg;
}
return NULL;
}
ssize_t
-hs_cell_intro_established_encoded_len(const hs_cell_intro_established_t *obj)
+trn_cell_intro_established_encoded_len(const trn_cell_intro_established_t *obj)
{
ssize_t result = 0;
- if (NULL != hs_cell_intro_established_check(obj))
+ if (NULL != trn_cell_intro_established_check(obj))
return -1;
- /* Length of struct cell_extension extensions */
- result += cell_extension_encoded_len(obj->extensions);
+ /* Length of struct trn_cell_extension extensions */
+ result += trn_cell_extension_encoded_len(obj->extensions);
return result;
}
int
-hs_cell_intro_established_clear_errors(hs_cell_intro_established_t *obj)
+trn_cell_intro_established_clear_errors(trn_cell_intro_established_t *obj)
{
int r = obj->trunnel_error_code_;
obj->trunnel_error_code_ = 0;
return r;
}
ssize_t
-hs_cell_intro_established_encode(uint8_t *output, const size_t avail, const hs_cell_intro_established_t *obj)
+trn_cell_intro_established_encode(uint8_t *output, const size_t avail, const trn_cell_intro_established_t *obj)
{
ssize_t result = 0;
size_t written = 0;
uint8_t *ptr = output;
const char *msg;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
- const ssize_t encoded_len = hs_cell_intro_established_encoded_len(obj);
+ const ssize_t encoded_len = trn_cell_intro_established_encoded_len(obj);
#endif
- if (NULL != (msg = hs_cell_intro_established_check(obj)))
+ if (NULL != (msg = trn_cell_intro_established_check(obj)))
goto check_failed;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
trunnel_assert(encoded_len >= 0);
#endif
- /* Encode struct cell_extension extensions */
+ /* Encode struct trn_cell_extension extensions */
trunnel_assert(written <= avail);
- result = cell_extension_encode(ptr, avail - written, obj->extensions);
+ result = trn_cell_extension_encode(ptr, avail - written, obj->extensions);
if (result < 0)
goto fail; /* XXXXXXX !*/
written += result; ptr += result;
@@ -694,19 +694,19 @@ hs_cell_intro_established_encode(uint8_t *output, const size_t avail, const hs_c
return result;
}
-/** As hs_cell_intro_established_parse(), but do not allocate the
+/** As trn_cell_intro_established_parse(), but do not allocate the
* output object.
*/
static ssize_t
-hs_cell_intro_established_parse_into(hs_cell_intro_established_t *obj, const uint8_t *input, const size_t len_in)
+trn_cell_intro_established_parse_into(trn_cell_intro_established_t *obj, const uint8_t *input, const size_t len_in)
{
const uint8_t *ptr = input;
size_t remaining = len_in;
ssize_t result = 0;
(void)result;
- /* Parse struct cell_extension extensions */
- result = cell_extension_parse(&obj->extensions, ptr, remaining);
+ /* Parse struct trn_cell_extension extensions */
+ result = trn_cell_extension_parse(&obj->extensions, ptr, remaining);
if (result < 0)
goto relay_fail;
trunnel_assert((size_t)result <= remaining);
@@ -720,15 +720,15 @@ hs_cell_intro_established_parse_into(hs_cell_intro_established_t *obj, const uin
}
ssize_t
-hs_cell_intro_established_parse(hs_cell_intro_established_t **output, const uint8_t *input, const size_t len_in)
+trn_cell_intro_established_parse(trn_cell_intro_established_t **output, const uint8_t *input, const size_t len_in)
{
ssize_t result;
- *output = hs_cell_intro_established_new();
+ *output = trn_cell_intro_established_new();
if (NULL == *output)
return -1;
- result = hs_cell_intro_established_parse_into(*output, input, len_in);
+ result = trn_cell_intro_established_parse_into(*output, input, len_in);
if (result < 0) {
- hs_cell_intro_established_free(*output);
+ trn_cell_intro_established_free(*output);
*output = NULL;
}
return result;