tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

cell_introduce1.h (32465B)


      1 /* cell_introduce1.h -- generated by Trunnel v1.5.3.
      2 * https://gitweb.torproject.org/trunnel.git
      3 * You probably shouldn't edit this file.
      4 */
      5 #ifndef TRUNNEL_CELL_INTRODUCE1_H
      6 #define TRUNNEL_CELL_INTRODUCE1_H
      7 
      8 #include <stdint.h>
      9 #include "trunnel.h"
     10 
     11 struct trn_extension_st;
     12 struct link_specifier_st;
     13 #define TRUNNEL_SHA1_LEN 20
     14 #define TRUNNEL_REND_COOKIE_LEN 20
     15 #define TRUNNEL_HS_INTRO_ACK_STATUS_SUCCESS 0
     16 #define TRUNNEL_HS_INTRO_ACK_STATUS_UNKNOWN_ID 1
     17 #define TRUNNEL_HS_INTRO_ACK_STATUS_BAD_FORMAT 2
     18 #define TRUNNEL_HS_INTRO_AUTH_KEY_TYPE_LEGACY0 0
     19 #define TRUNNEL_HS_INTRO_AUTH_KEY_TYPE_LEGACY1 1
     20 #define TRUNNEL_HS_INTRO_AUTH_KEY_TYPE_ED25519 2
     21 #define TRUNNEL_HS_INTRO_ONION_KEY_TYPE_NTOR 1
     22 #define TRUNNEL_EXT_TYPE_CC_REQUEST 1
     23 #define TRUNNEL_EXT_TYPE_POW 2
     24 #define TRUNNEL_POW_NONCE_LEN 16
     25 #define TRUNNEL_POW_SOLUTION_LEN 16
     26 #define TRUNNEL_POW_SEED_HEAD_LEN 4
     27 #define TRUNNEL_POW_VERSION_EQUIX 1
     28 #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_EXTENSION_POW)
     29 struct trn_cell_extension_pow_st {
     30  uint8_t pow_version;
     31  uint8_t pow_nonce[TRUNNEL_POW_NONCE_LEN];
     32  uint32_t pow_effort;
     33  uint8_t pow_seed[TRUNNEL_POW_SEED_HEAD_LEN];
     34  uint8_t pow_solution[TRUNNEL_POW_SOLUTION_LEN];
     35  uint8_t trunnel_error_code_;
     36 };
     37 #endif
     38 typedef struct trn_cell_extension_pow_st trn_cell_extension_pow_t;
     39 #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_INTRODUCE1)
     40 struct trn_cell_introduce1_st {
     41  uint8_t legacy_key_id[TRUNNEL_SHA1_LEN];
     42  uint8_t auth_key_type;
     43  uint16_t auth_key_len;
     44  TRUNNEL_DYNARRAY_HEAD(, uint8_t) auth_key;
     45  struct trn_extension_st *extensions;
     46  TRUNNEL_DYNARRAY_HEAD(, uint8_t) encrypted;
     47  uint8_t trunnel_error_code_;
     48 };
     49 #endif
     50 typedef struct trn_cell_introduce1_st trn_cell_introduce1_t;
     51 #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_INTRODUCE_ACK)
     52 struct trn_cell_introduce_ack_st {
     53  uint16_t status;
     54  struct trn_extension_st *extensions;
     55  uint8_t trunnel_error_code_;
     56 };
     57 #endif
     58 typedef struct trn_cell_introduce_ack_st trn_cell_introduce_ack_t;
     59 #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_INTRODUCE_ENCRYPTED)
     60 struct trn_cell_introduce_encrypted_st {
     61  uint8_t rend_cookie[TRUNNEL_REND_COOKIE_LEN];
     62  struct trn_extension_st *extensions;
     63  uint8_t onion_key_type;
     64  uint16_t onion_key_len;
     65  TRUNNEL_DYNARRAY_HEAD(, uint8_t) onion_key;
     66  uint8_t nspec;
     67  TRUNNEL_DYNARRAY_HEAD(, struct link_specifier_st *) nspecs;
     68  TRUNNEL_DYNARRAY_HEAD(, uint8_t) pad;
     69  uint8_t trunnel_error_code_;
     70 };
     71 #endif
     72 typedef struct trn_cell_introduce_encrypted_st trn_cell_introduce_encrypted_t;
     73 /** Return a newly allocated trn_cell_extension_pow with all elements
     74 * set to zero.
     75 */
     76 trn_cell_extension_pow_t *trn_cell_extension_pow_new(void);
     77 /** Release all storage held by the trn_cell_extension_pow in
     78 * 'victim'. (Do nothing if 'victim' is NULL.)
     79 */
     80 void trn_cell_extension_pow_free(trn_cell_extension_pow_t *victim);
     81 /** Try to parse a trn_cell_extension_pow from the buffer in 'input',
     82 * using up to 'len_in' bytes from the input buffer. On success,
     83 * return the number of bytes consumed and set *output to the newly
     84 * allocated trn_cell_extension_pow_t. On failure, return -2 if the
     85 * input appears truncated, and -1 if the input is otherwise invalid.
     86 */
     87 ssize_t trn_cell_extension_pow_parse(trn_cell_extension_pow_t **output, const uint8_t *input, const size_t len_in);
     88 /** Return the number of bytes we expect to need to encode the
     89 * trn_cell_extension_pow in 'obj'. On failure, return a negative
     90 * value. Note that this value may be an overestimate, and can even be
     91 * an underestimate for certain unencodeable objects.
     92 */
     93 ssize_t trn_cell_extension_pow_encoded_len(const trn_cell_extension_pow_t *obj);
     94 /** Try to encode the trn_cell_extension_pow from 'input' into the
     95 * buffer at 'output', using up to 'avail' bytes of the output buffer.
     96 * On success, return the number of bytes used. On failure, return -2
     97 * if the buffer was not long enough, and -1 if the input was invalid.
     98 */
     99 ssize_t trn_cell_extension_pow_encode(uint8_t *output, size_t avail, const trn_cell_extension_pow_t *input);
    100 /** Check whether the internal state of the trn_cell_extension_pow in
    101 * 'obj' is consistent. Return NULL if it is, and a short message if
    102 * it is not.
    103 */
    104 const char *trn_cell_extension_pow_check(const trn_cell_extension_pow_t *obj);
    105 /** Clear any errors that were set on the object 'obj' by its setter
    106 * functions. Return true iff errors were cleared.
    107 */
    108 int trn_cell_extension_pow_clear_errors(trn_cell_extension_pow_t *obj);
    109 /** Return the value of the pow_version field of the
    110 * trn_cell_extension_pow_t in 'inp'
    111 */
    112 uint8_t trn_cell_extension_pow_get_pow_version(const trn_cell_extension_pow_t *inp);
    113 /** Set the value of the pow_version field of the
    114 * trn_cell_extension_pow_t in 'inp' to 'val'. Return 0 on success;
    115 * return -1 and set the error code on 'inp' on failure.
    116 */
    117 int trn_cell_extension_pow_set_pow_version(trn_cell_extension_pow_t *inp, uint8_t val);
    118 /** Return the (constant) length of the array holding the pow_nonce
    119 * field of the trn_cell_extension_pow_t in 'inp'.
    120 */
    121 size_t trn_cell_extension_pow_getlen_pow_nonce(const trn_cell_extension_pow_t *inp);
    122 /** Return the element at position 'idx' of the fixed array field
    123 * pow_nonce of the trn_cell_extension_pow_t in 'inp'.
    124 */
    125 uint8_t trn_cell_extension_pow_get_pow_nonce(trn_cell_extension_pow_t *inp, size_t idx);
    126 /** As trn_cell_extension_pow_get_pow_nonce, but take and return a
    127 * const pointer
    128 */
    129 uint8_t trn_cell_extension_pow_getconst_pow_nonce(const trn_cell_extension_pow_t *inp, size_t idx);
    130 /** Change the element at position 'idx' of the fixed array field
    131 * pow_nonce of the trn_cell_extension_pow_t in 'inp', so that it will
    132 * hold the value 'elt'.
    133 */
    134 int trn_cell_extension_pow_set_pow_nonce(trn_cell_extension_pow_t *inp, size_t idx, uint8_t elt);
    135 /** Return a pointer to the TRUNNEL_POW_NONCE_LEN-element array field
    136 * pow_nonce of 'inp'.
    137 */
    138 uint8_t * trn_cell_extension_pow_getarray_pow_nonce(trn_cell_extension_pow_t *inp);
    139 /** As trn_cell_extension_pow_get_pow_nonce, but take and return a
    140 * const pointer
    141 */
    142 const uint8_t  * trn_cell_extension_pow_getconstarray_pow_nonce(const trn_cell_extension_pow_t *inp);
    143 /** Return the value of the pow_effort field of the
    144 * trn_cell_extension_pow_t in 'inp'
    145 */
    146 uint32_t trn_cell_extension_pow_get_pow_effort(const trn_cell_extension_pow_t *inp);
    147 /** Set the value of the pow_effort field of the
    148 * trn_cell_extension_pow_t in 'inp' to 'val'. Return 0 on success;
    149 * return -1 and set the error code on 'inp' on failure.
    150 */
    151 int trn_cell_extension_pow_set_pow_effort(trn_cell_extension_pow_t *inp, uint32_t val);
    152 /** Return the (constant) length of the array holding the pow_seed
    153 * field of the trn_cell_extension_pow_t in 'inp'.
    154 */
    155 size_t trn_cell_extension_pow_getlen_pow_seed(const trn_cell_extension_pow_t *inp);
    156 /** Return the element at position 'idx' of the fixed array field
    157 * pow_seed of the trn_cell_extension_pow_t in 'inp'.
    158 */
    159 uint8_t trn_cell_extension_pow_get_pow_seed(trn_cell_extension_pow_t *inp, size_t idx);
    160 /** As trn_cell_extension_pow_get_pow_seed, but take and return a
    161 * const pointer
    162 */
    163 uint8_t trn_cell_extension_pow_getconst_pow_seed(const trn_cell_extension_pow_t *inp, size_t idx);
    164 /** Change the element at position 'idx' of the fixed array field
    165 * pow_seed of the trn_cell_extension_pow_t in 'inp', so that it will
    166 * hold the value 'elt'.
    167 */
    168 int trn_cell_extension_pow_set_pow_seed(trn_cell_extension_pow_t *inp, size_t idx, uint8_t elt);
    169 /** Return a pointer to the TRUNNEL_POW_SEED_HEAD_LEN-element array
    170 * field pow_seed of 'inp'.
    171 */
    172 uint8_t * trn_cell_extension_pow_getarray_pow_seed(trn_cell_extension_pow_t *inp);
    173 /** As trn_cell_extension_pow_get_pow_seed, but take and return a
    174 * const pointer
    175 */
    176 const uint8_t  * trn_cell_extension_pow_getconstarray_pow_seed(const trn_cell_extension_pow_t *inp);
    177 /** Return the (constant) length of the array holding the pow_solution
    178 * field of the trn_cell_extension_pow_t in 'inp'.
    179 */
    180 size_t trn_cell_extension_pow_getlen_pow_solution(const trn_cell_extension_pow_t *inp);
    181 /** Return the element at position 'idx' of the fixed array field
    182 * pow_solution of the trn_cell_extension_pow_t in 'inp'.
    183 */
    184 uint8_t trn_cell_extension_pow_get_pow_solution(trn_cell_extension_pow_t *inp, size_t idx);
    185 /** As trn_cell_extension_pow_get_pow_solution, but take and return a
    186 * const pointer
    187 */
    188 uint8_t trn_cell_extension_pow_getconst_pow_solution(const trn_cell_extension_pow_t *inp, size_t idx);
    189 /** Change the element at position 'idx' of the fixed array field
    190 * pow_solution of the trn_cell_extension_pow_t in 'inp', so that it
    191 * will hold the value 'elt'.
    192 */
    193 int trn_cell_extension_pow_set_pow_solution(trn_cell_extension_pow_t *inp, size_t idx, uint8_t elt);
    194 /** Return a pointer to the TRUNNEL_POW_SOLUTION_LEN-element array
    195 * field pow_solution of 'inp'.
    196 */
    197 uint8_t * trn_cell_extension_pow_getarray_pow_solution(trn_cell_extension_pow_t *inp);
    198 /** As trn_cell_extension_pow_get_pow_solution, but take and return a
    199 * const pointer
    200 */
    201 const uint8_t  * trn_cell_extension_pow_getconstarray_pow_solution(const trn_cell_extension_pow_t *inp);
    202 /** Return a newly allocated trn_cell_introduce1 with all elements set
    203 * to zero.
    204 */
    205 trn_cell_introduce1_t *trn_cell_introduce1_new(void);
    206 /** Release all storage held by the trn_cell_introduce1 in 'victim'.
    207 * (Do nothing if 'victim' is NULL.)
    208 */
    209 void trn_cell_introduce1_free(trn_cell_introduce1_t *victim);
    210 /** Try to parse a trn_cell_introduce1 from the buffer in 'input',
    211 * using up to 'len_in' bytes from the input buffer. On success,
    212 * return the number of bytes consumed and set *output to the newly
    213 * allocated trn_cell_introduce1_t. On failure, return -2 if the input
    214 * appears truncated, and -1 if the input is otherwise invalid.
    215 */
    216 ssize_t trn_cell_introduce1_parse(trn_cell_introduce1_t **output, const uint8_t *input, const size_t len_in);
    217 /** Return the number of bytes we expect to need to encode the
    218 * trn_cell_introduce1 in 'obj'. On failure, return a negative value.
    219 * Note that this value may be an overestimate, and can even be an
    220 * underestimate for certain unencodeable objects.
    221 */
    222 ssize_t trn_cell_introduce1_encoded_len(const trn_cell_introduce1_t *obj);
    223 /** Try to encode the trn_cell_introduce1 from 'input' into the buffer
    224 * at 'output', using up to 'avail' bytes of the output buffer. On
    225 * success, return the number of bytes used. On failure, return -2 if
    226 * the buffer was not long enough, and -1 if the input was invalid.
    227 */
    228 ssize_t trn_cell_introduce1_encode(uint8_t *output, size_t avail, const trn_cell_introduce1_t *input);
    229 /** Check whether the internal state of the trn_cell_introduce1 in
    230 * 'obj' is consistent. Return NULL if it is, and a short message if
    231 * it is not.
    232 */
    233 const char *trn_cell_introduce1_check(const trn_cell_introduce1_t *obj);
    234 /** Clear any errors that were set on the object 'obj' by its setter
    235 * functions. Return true iff errors were cleared.
    236 */
    237 int trn_cell_introduce1_clear_errors(trn_cell_introduce1_t *obj);
    238 /** Return the (constant) length of the array holding the
    239 * legacy_key_id field of the trn_cell_introduce1_t in 'inp'.
    240 */
    241 size_t trn_cell_introduce1_getlen_legacy_key_id(const trn_cell_introduce1_t *inp);
    242 /** Return the element at position 'idx' of the fixed array field
    243 * legacy_key_id of the trn_cell_introduce1_t in 'inp'.
    244 */
    245 uint8_t trn_cell_introduce1_get_legacy_key_id(trn_cell_introduce1_t *inp, size_t idx);
    246 /** As trn_cell_introduce1_get_legacy_key_id, but take and return a
    247 * const pointer
    248 */
    249 uint8_t trn_cell_introduce1_getconst_legacy_key_id(const trn_cell_introduce1_t *inp, size_t idx);
    250 /** Change the element at position 'idx' of the fixed array field
    251 * legacy_key_id of the trn_cell_introduce1_t in 'inp', so that it
    252 * will hold the value 'elt'.
    253 */
    254 int trn_cell_introduce1_set_legacy_key_id(trn_cell_introduce1_t *inp, size_t idx, uint8_t elt);
    255 /** Return a pointer to the TRUNNEL_SHA1_LEN-element array field
    256 * legacy_key_id of 'inp'.
    257 */
    258 uint8_t * trn_cell_introduce1_getarray_legacy_key_id(trn_cell_introduce1_t *inp);
    259 /** As trn_cell_introduce1_get_legacy_key_id, but take and return a
    260 * const pointer
    261 */
    262 const uint8_t  * trn_cell_introduce1_getconstarray_legacy_key_id(const trn_cell_introduce1_t *inp);
    263 /** Return the value of the auth_key_type field of the
    264 * trn_cell_introduce1_t in 'inp'
    265 */
    266 uint8_t trn_cell_introduce1_get_auth_key_type(const trn_cell_introduce1_t *inp);
    267 /** Set the value of the auth_key_type field of the
    268 * trn_cell_introduce1_t in 'inp' to 'val'. Return 0 on success;
    269 * return -1 and set the error code on 'inp' on failure.
    270 */
    271 int trn_cell_introduce1_set_auth_key_type(trn_cell_introduce1_t *inp, uint8_t val);
    272 /** Return the value of the auth_key_len field of the
    273 * trn_cell_introduce1_t in 'inp'
    274 */
    275 uint16_t trn_cell_introduce1_get_auth_key_len(const trn_cell_introduce1_t *inp);
    276 /** Set the value of the auth_key_len field of the
    277 * trn_cell_introduce1_t in 'inp' to 'val'. Return 0 on success;
    278 * return -1 and set the error code on 'inp' on failure.
    279 */
    280 int trn_cell_introduce1_set_auth_key_len(trn_cell_introduce1_t *inp, uint16_t val);
    281 /** Return the length of the dynamic array holding the auth_key field
    282 * of the trn_cell_introduce1_t in 'inp'.
    283 */
    284 size_t trn_cell_introduce1_getlen_auth_key(const trn_cell_introduce1_t *inp);
    285 /** Return the element at position 'idx' of the dynamic array field
    286 * auth_key of the trn_cell_introduce1_t in 'inp'.
    287 */
    288 uint8_t trn_cell_introduce1_get_auth_key(trn_cell_introduce1_t *inp, size_t idx);
    289 /** As trn_cell_introduce1_get_auth_key, but take and return a const
    290 * pointer
    291 */
    292 uint8_t trn_cell_introduce1_getconst_auth_key(const trn_cell_introduce1_t *inp, size_t idx);
    293 /** Change the element at position 'idx' of the dynamic array field
    294 * auth_key of the trn_cell_introduce1_t in 'inp', so that it will
    295 * hold the value 'elt'.
    296 */
    297 int trn_cell_introduce1_set_auth_key(trn_cell_introduce1_t *inp, size_t idx, uint8_t elt);
    298 /** Append a new element 'elt' to the dynamic array field auth_key of
    299 * the trn_cell_introduce1_t in 'inp'.
    300 */
    301 int trn_cell_introduce1_add_auth_key(trn_cell_introduce1_t *inp, uint8_t elt);
    302 /** Return a pointer to the variable-length array field auth_key of
    303 * 'inp'.
    304 */
    305 uint8_t * trn_cell_introduce1_getarray_auth_key(trn_cell_introduce1_t *inp);
    306 /** As trn_cell_introduce1_get_auth_key, but take and return a const
    307 * pointer
    308 */
    309 const uint8_t  * trn_cell_introduce1_getconstarray_auth_key(const trn_cell_introduce1_t *inp);
    310 /** Change the length of the variable-length array field auth_key of
    311 * 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
    312 * return -1 and set the error code on 'inp' on failure.
    313 */
    314 int trn_cell_introduce1_setlen_auth_key(trn_cell_introduce1_t *inp, size_t newlen);
    315 /** Return the value of the extensions field of the
    316 * trn_cell_introduce1_t in 'inp'
    317 */
    318 struct trn_extension_st * trn_cell_introduce1_get_extensions(trn_cell_introduce1_t *inp);
    319 /** As trn_cell_introduce1_get_extensions, but take and return a const
    320 * pointer
    321 */
    322 const struct trn_extension_st * trn_cell_introduce1_getconst_extensions(const trn_cell_introduce1_t *inp);
    323 /** Set the value of the extensions field of the trn_cell_introduce1_t
    324 * in 'inp' to 'val'. Free the old value if any. Steals the
    325 * referenceto 'val'.Return 0 on success; return -1 and set the error
    326 * code on 'inp' on failure.
    327 */
    328 int trn_cell_introduce1_set_extensions(trn_cell_introduce1_t *inp, struct trn_extension_st *val);
    329 /** As trn_cell_introduce1_set_extensions, but does not free the
    330 * previous value.
    331 */
    332 int trn_cell_introduce1_set0_extensions(trn_cell_introduce1_t *inp, struct trn_extension_st *val);
    333 /** Return the length of the dynamic array holding the encrypted field
    334 * of the trn_cell_introduce1_t in 'inp'.
    335 */
    336 size_t trn_cell_introduce1_getlen_encrypted(const trn_cell_introduce1_t *inp);
    337 /** Return the element at position 'idx' of the dynamic array field
    338 * encrypted of the trn_cell_introduce1_t in 'inp'.
    339 */
    340 uint8_t trn_cell_introduce1_get_encrypted(trn_cell_introduce1_t *inp, size_t idx);
    341 /** As trn_cell_introduce1_get_encrypted, but take and return a const
    342 * pointer
    343 */
    344 uint8_t trn_cell_introduce1_getconst_encrypted(const trn_cell_introduce1_t *inp, size_t idx);
    345 /** Change the element at position 'idx' of the dynamic array field
    346 * encrypted of the trn_cell_introduce1_t in 'inp', so that it will
    347 * hold the value 'elt'.
    348 */
    349 int trn_cell_introduce1_set_encrypted(trn_cell_introduce1_t *inp, size_t idx, uint8_t elt);
    350 /** Append a new element 'elt' to the dynamic array field encrypted of
    351 * the trn_cell_introduce1_t in 'inp'.
    352 */
    353 int trn_cell_introduce1_add_encrypted(trn_cell_introduce1_t *inp, uint8_t elt);
    354 /** Return a pointer to the variable-length array field encrypted of
    355 * 'inp'.
    356 */
    357 uint8_t * trn_cell_introduce1_getarray_encrypted(trn_cell_introduce1_t *inp);
    358 /** As trn_cell_introduce1_get_encrypted, but take and return a const
    359 * pointer
    360 */
    361 const uint8_t  * trn_cell_introduce1_getconstarray_encrypted(const trn_cell_introduce1_t *inp);
    362 /** Change the length of the variable-length array field encrypted of
    363 * 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
    364 * return -1 and set the error code on 'inp' on failure.
    365 */
    366 int trn_cell_introduce1_setlen_encrypted(trn_cell_introduce1_t *inp, size_t newlen);
    367 /** Return a newly allocated trn_cell_introduce_ack with all elements
    368 * set to zero.
    369 */
    370 trn_cell_introduce_ack_t *trn_cell_introduce_ack_new(void);
    371 /** Release all storage held by the trn_cell_introduce_ack in
    372 * 'victim'. (Do nothing if 'victim' is NULL.)
    373 */
    374 void trn_cell_introduce_ack_free(trn_cell_introduce_ack_t *victim);
    375 /** Try to parse a trn_cell_introduce_ack from the buffer in 'input',
    376 * using up to 'len_in' bytes from the input buffer. On success,
    377 * return the number of bytes consumed and set *output to the newly
    378 * allocated trn_cell_introduce_ack_t. On failure, return -2 if the
    379 * input appears truncated, and -1 if the input is otherwise invalid.
    380 */
    381 ssize_t trn_cell_introduce_ack_parse(trn_cell_introduce_ack_t **output, const uint8_t *input, const size_t len_in);
    382 /** Return the number of bytes we expect to need to encode the
    383 * trn_cell_introduce_ack in 'obj'. On failure, return a negative
    384 * value. Note that this value may be an overestimate, and can even be
    385 * an underestimate for certain unencodeable objects.
    386 */
    387 ssize_t trn_cell_introduce_ack_encoded_len(const trn_cell_introduce_ack_t *obj);
    388 /** Try to encode the trn_cell_introduce_ack from 'input' into the
    389 * buffer at 'output', using up to 'avail' bytes of the output buffer.
    390 * On success, return the number of bytes used. On failure, return -2
    391 * if the buffer was not long enough, and -1 if the input was invalid.
    392 */
    393 ssize_t trn_cell_introduce_ack_encode(uint8_t *output, size_t avail, const trn_cell_introduce_ack_t *input);
    394 /** Check whether the internal state of the trn_cell_introduce_ack in
    395 * 'obj' is consistent. Return NULL if it is, and a short message if
    396 * it is not.
    397 */
    398 const char *trn_cell_introduce_ack_check(const trn_cell_introduce_ack_t *obj);
    399 /** Clear any errors that were set on the object 'obj' by its setter
    400 * functions. Return true iff errors were cleared.
    401 */
    402 int trn_cell_introduce_ack_clear_errors(trn_cell_introduce_ack_t *obj);
    403 /** Return the value of the status field of the
    404 * trn_cell_introduce_ack_t in 'inp'
    405 */
    406 uint16_t trn_cell_introduce_ack_get_status(const trn_cell_introduce_ack_t *inp);
    407 /** Set the value of the status field of the trn_cell_introduce_ack_t
    408 * in 'inp' to 'val'. Return 0 on success; return -1 and set the error
    409 * code on 'inp' on failure.
    410 */
    411 int trn_cell_introduce_ack_set_status(trn_cell_introduce_ack_t *inp, uint16_t val);
    412 /** Return the value of the extensions field of the
    413 * trn_cell_introduce_ack_t in 'inp'
    414 */
    415 struct trn_extension_st * trn_cell_introduce_ack_get_extensions(trn_cell_introduce_ack_t *inp);
    416 /** As trn_cell_introduce_ack_get_extensions, but take and return a
    417 * const pointer
    418 */
    419 const struct trn_extension_st * trn_cell_introduce_ack_getconst_extensions(const trn_cell_introduce_ack_t *inp);
    420 /** Set the value of the extensions field of the
    421 * trn_cell_introduce_ack_t in 'inp' to 'val'. Free the old value if
    422 * any. Steals the referenceto 'val'.Return 0 on success; return -1
    423 * and set the error code on 'inp' on failure.
    424 */
    425 int trn_cell_introduce_ack_set_extensions(trn_cell_introduce_ack_t *inp, struct trn_extension_st *val);
    426 /** As trn_cell_introduce_ack_set_extensions, but does not free the
    427 * previous value.
    428 */
    429 int trn_cell_introduce_ack_set0_extensions(trn_cell_introduce_ack_t *inp, struct trn_extension_st *val);
    430 /** Return a newly allocated trn_cell_introduce_encrypted with all
    431 * elements set to zero.
    432 */
    433 trn_cell_introduce_encrypted_t *trn_cell_introduce_encrypted_new(void);
    434 /** Release all storage held by the trn_cell_introduce_encrypted in
    435 * 'victim'. (Do nothing if 'victim' is NULL.)
    436 */
    437 void trn_cell_introduce_encrypted_free(trn_cell_introduce_encrypted_t *victim);
    438 /** Try to parse a trn_cell_introduce_encrypted from the buffer in
    439 * 'input', using up to 'len_in' bytes from the input buffer. On
    440 * success, return the number of bytes consumed and set *output to the
    441 * newly allocated trn_cell_introduce_encrypted_t. On failure, return
    442 * -2 if the input appears truncated, and -1 if the input is otherwise
    443 * invalid.
    444 */
    445 ssize_t trn_cell_introduce_encrypted_parse(trn_cell_introduce_encrypted_t **output, const uint8_t *input, const size_t len_in);
    446 /** Return the number of bytes we expect to need to encode the
    447 * trn_cell_introduce_encrypted in 'obj'. On failure, return a
    448 * negative value. Note that this value may be an overestimate, and
    449 * can even be an underestimate for certain unencodeable objects.
    450 */
    451 ssize_t trn_cell_introduce_encrypted_encoded_len(const trn_cell_introduce_encrypted_t *obj);
    452 /** Try to encode the trn_cell_introduce_encrypted from 'input' into
    453 * the buffer at 'output', using up to 'avail' bytes of the output
    454 * buffer. On success, return the number of bytes used. On failure,
    455 * return -2 if the buffer was not long enough, and -1 if the input
    456 * was invalid.
    457 */
    458 ssize_t trn_cell_introduce_encrypted_encode(uint8_t *output, size_t avail, const trn_cell_introduce_encrypted_t *input);
    459 /** Check whether the internal state of the
    460 * trn_cell_introduce_encrypted in 'obj' is consistent. Return NULL if
    461 * it is, and a short message if it is not.
    462 */
    463 const char *trn_cell_introduce_encrypted_check(const trn_cell_introduce_encrypted_t *obj);
    464 /** Clear any errors that were set on the object 'obj' by its setter
    465 * functions. Return true iff errors were cleared.
    466 */
    467 int trn_cell_introduce_encrypted_clear_errors(trn_cell_introduce_encrypted_t *obj);
    468 /** Return the (constant) length of the array holding the rend_cookie
    469 * field of the trn_cell_introduce_encrypted_t in 'inp'.
    470 */
    471 size_t trn_cell_introduce_encrypted_getlen_rend_cookie(const trn_cell_introduce_encrypted_t *inp);
    472 /** Return the element at position 'idx' of the fixed array field
    473 * rend_cookie of the trn_cell_introduce_encrypted_t in 'inp'.
    474 */
    475 uint8_t trn_cell_introduce_encrypted_get_rend_cookie(trn_cell_introduce_encrypted_t *inp, size_t idx);
    476 /** As trn_cell_introduce_encrypted_get_rend_cookie, but take and
    477 * return a const pointer
    478 */
    479 uint8_t trn_cell_introduce_encrypted_getconst_rend_cookie(const trn_cell_introduce_encrypted_t *inp, size_t idx);
    480 /** Change the element at position 'idx' of the fixed array field
    481 * rend_cookie of the trn_cell_introduce_encrypted_t in 'inp', so that
    482 * it will hold the value 'elt'.
    483 */
    484 int trn_cell_introduce_encrypted_set_rend_cookie(trn_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt);
    485 /** Return a pointer to the TRUNNEL_REND_COOKIE_LEN-element array
    486 * field rend_cookie of 'inp'.
    487 */
    488 uint8_t * trn_cell_introduce_encrypted_getarray_rend_cookie(trn_cell_introduce_encrypted_t *inp);
    489 /** As trn_cell_introduce_encrypted_get_rend_cookie, but take and
    490 * return a const pointer
    491 */
    492 const uint8_t  * trn_cell_introduce_encrypted_getconstarray_rend_cookie(const trn_cell_introduce_encrypted_t *inp);
    493 /** Return the value of the extensions field of the
    494 * trn_cell_introduce_encrypted_t in 'inp'
    495 */
    496 struct trn_extension_st * trn_cell_introduce_encrypted_get_extensions(trn_cell_introduce_encrypted_t *inp);
    497 /** As trn_cell_introduce_encrypted_get_extensions, but take and
    498 * return a const pointer
    499 */
    500 const struct trn_extension_st * trn_cell_introduce_encrypted_getconst_extensions(const trn_cell_introduce_encrypted_t *inp);
    501 /** Set the value of the extensions field of the
    502 * trn_cell_introduce_encrypted_t in 'inp' to 'val'. Free the old
    503 * value if any. Steals the referenceto 'val'.Return 0 on success;
    504 * return -1 and set the error code on 'inp' on failure.
    505 */
    506 int trn_cell_introduce_encrypted_set_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_extension_st *val);
    507 /** As trn_cell_introduce_encrypted_set_extensions, but does not free
    508 * the previous value.
    509 */
    510 int trn_cell_introduce_encrypted_set0_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_extension_st *val);
    511 /** Return the value of the onion_key_type field of the
    512 * trn_cell_introduce_encrypted_t in 'inp'
    513 */
    514 uint8_t trn_cell_introduce_encrypted_get_onion_key_type(const trn_cell_introduce_encrypted_t *inp);
    515 /** Set the value of the onion_key_type field of the
    516 * trn_cell_introduce_encrypted_t in 'inp' to 'val'. Return 0 on
    517 * success; return -1 and set the error code on 'inp' on failure.
    518 */
    519 int trn_cell_introduce_encrypted_set_onion_key_type(trn_cell_introduce_encrypted_t *inp, uint8_t val);
    520 /** Return the value of the onion_key_len field of the
    521 * trn_cell_introduce_encrypted_t in 'inp'
    522 */
    523 uint16_t trn_cell_introduce_encrypted_get_onion_key_len(const trn_cell_introduce_encrypted_t *inp);
    524 /** Set the value of the onion_key_len field of the
    525 * trn_cell_introduce_encrypted_t in 'inp' to 'val'. Return 0 on
    526 * success; return -1 and set the error code on 'inp' on failure.
    527 */
    528 int trn_cell_introduce_encrypted_set_onion_key_len(trn_cell_introduce_encrypted_t *inp, uint16_t val);
    529 /** Return the length of the dynamic array holding the onion_key field
    530 * of the trn_cell_introduce_encrypted_t in 'inp'.
    531 */
    532 size_t trn_cell_introduce_encrypted_getlen_onion_key(const trn_cell_introduce_encrypted_t *inp);
    533 /** Return the element at position 'idx' of the dynamic array field
    534 * onion_key of the trn_cell_introduce_encrypted_t in 'inp'.
    535 */
    536 uint8_t trn_cell_introduce_encrypted_get_onion_key(trn_cell_introduce_encrypted_t *inp, size_t idx);
    537 /** As trn_cell_introduce_encrypted_get_onion_key, but take and return
    538 * a const pointer
    539 */
    540 uint8_t trn_cell_introduce_encrypted_getconst_onion_key(const trn_cell_introduce_encrypted_t *inp, size_t idx);
    541 /** Change the element at position 'idx' of the dynamic array field
    542 * onion_key of the trn_cell_introduce_encrypted_t in 'inp', so that
    543 * it will hold the value 'elt'.
    544 */
    545 int trn_cell_introduce_encrypted_set_onion_key(trn_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt);
    546 /** Append a new element 'elt' to the dynamic array field onion_key of
    547 * the trn_cell_introduce_encrypted_t in 'inp'.
    548 */
    549 int trn_cell_introduce_encrypted_add_onion_key(trn_cell_introduce_encrypted_t *inp, uint8_t elt);
    550 /** Return a pointer to the variable-length array field onion_key of
    551 * 'inp'.
    552 */
    553 uint8_t * trn_cell_introduce_encrypted_getarray_onion_key(trn_cell_introduce_encrypted_t *inp);
    554 /** As trn_cell_introduce_encrypted_get_onion_key, but take and return
    555 * a const pointer
    556 */
    557 const uint8_t  * trn_cell_introduce_encrypted_getconstarray_onion_key(const trn_cell_introduce_encrypted_t *inp);
    558 /** Change the length of the variable-length array field onion_key of
    559 * 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
    560 * return -1 and set the error code on 'inp' on failure.
    561 */
    562 int trn_cell_introduce_encrypted_setlen_onion_key(trn_cell_introduce_encrypted_t *inp, size_t newlen);
    563 /** Return the value of the nspec field of the
    564 * trn_cell_introduce_encrypted_t in 'inp'
    565 */
    566 uint8_t trn_cell_introduce_encrypted_get_nspec(const trn_cell_introduce_encrypted_t *inp);
    567 /** Set the value of the nspec field of the
    568 * trn_cell_introduce_encrypted_t in 'inp' to 'val'. Return 0 on
    569 * success; return -1 and set the error code on 'inp' on failure.
    570 */
    571 int trn_cell_introduce_encrypted_set_nspec(trn_cell_introduce_encrypted_t *inp, uint8_t val);
    572 /** Return the length of the dynamic array holding the nspecs field of
    573 * the trn_cell_introduce_encrypted_t in 'inp'.
    574 */
    575 size_t trn_cell_introduce_encrypted_getlen_nspecs(const trn_cell_introduce_encrypted_t *inp);
    576 /** Return the element at position 'idx' of the dynamic array field
    577 * nspecs of the trn_cell_introduce_encrypted_t in 'inp'.
    578 */
    579 struct link_specifier_st * trn_cell_introduce_encrypted_get_nspecs(trn_cell_introduce_encrypted_t *inp, size_t idx);
    580 /** As trn_cell_introduce_encrypted_get_nspecs, but take and return a
    581 * const pointer
    582 */
    583 const struct link_specifier_st * trn_cell_introduce_encrypted_getconst_nspecs(const trn_cell_introduce_encrypted_t *inp, size_t idx);
    584 /** Change the element at position 'idx' of the dynamic array field
    585 * nspecs of the trn_cell_introduce_encrypted_t in 'inp', so that it
    586 * will hold the value 'elt'. Free the previous value, if any.
    587 */
    588 int trn_cell_introduce_encrypted_set_nspecs(trn_cell_introduce_encrypted_t *inp, size_t idx, struct link_specifier_st * elt);
    589 /** As trn_cell_introduce_encrypted_set_nspecs, but does not free the
    590 * previous value.
    591 */
    592 int trn_cell_introduce_encrypted_set0_nspecs(trn_cell_introduce_encrypted_t *inp, size_t idx, struct link_specifier_st * elt);
    593 /** Append a new element 'elt' to the dynamic array field nspecs of
    594 * the trn_cell_introduce_encrypted_t in 'inp'.
    595 */
    596 int trn_cell_introduce_encrypted_add_nspecs(trn_cell_introduce_encrypted_t *inp, struct link_specifier_st * elt);
    597 /** Return a pointer to the variable-length array field nspecs of
    598 * 'inp'.
    599 */
    600 struct link_specifier_st * * trn_cell_introduce_encrypted_getarray_nspecs(trn_cell_introduce_encrypted_t *inp);
    601 /** As trn_cell_introduce_encrypted_get_nspecs, but take and return a
    602 * const pointer
    603 */
    604 const struct link_specifier_st *  const  * trn_cell_introduce_encrypted_getconstarray_nspecs(const trn_cell_introduce_encrypted_t *inp);
    605 /** Change the length of the variable-length array field nspecs of
    606 * 'inp' to 'newlen'.Fill extra elements with NULL; free removed
    607 * elements. Return 0 on success; return -1 and set the error code on
    608 * 'inp' on failure.
    609 */
    610 int trn_cell_introduce_encrypted_setlen_nspecs(trn_cell_introduce_encrypted_t *inp, size_t newlen);
    611 /** Return the length of the dynamic array holding the pad field of
    612 * the trn_cell_introduce_encrypted_t in 'inp'.
    613 */
    614 size_t trn_cell_introduce_encrypted_getlen_pad(const trn_cell_introduce_encrypted_t *inp);
    615 /** Return the element at position 'idx' of the dynamic array field
    616 * pad of the trn_cell_introduce_encrypted_t in 'inp'.
    617 */
    618 uint8_t trn_cell_introduce_encrypted_get_pad(trn_cell_introduce_encrypted_t *inp, size_t idx);
    619 /** As trn_cell_introduce_encrypted_get_pad, but take and return a
    620 * const pointer
    621 */
    622 uint8_t trn_cell_introduce_encrypted_getconst_pad(const trn_cell_introduce_encrypted_t *inp, size_t idx);
    623 /** Change the element at position 'idx' of the dynamic array field
    624 * pad of the trn_cell_introduce_encrypted_t in 'inp', so that it will
    625 * hold the value 'elt'.
    626 */
    627 int trn_cell_introduce_encrypted_set_pad(trn_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt);
    628 /** Append a new element 'elt' to the dynamic array field pad of the
    629 * trn_cell_introduce_encrypted_t in 'inp'.
    630 */
    631 int trn_cell_introduce_encrypted_add_pad(trn_cell_introduce_encrypted_t *inp, uint8_t elt);
    632 /** Return a pointer to the variable-length array field pad of 'inp'.
    633 */
    634 uint8_t * trn_cell_introduce_encrypted_getarray_pad(trn_cell_introduce_encrypted_t *inp);
    635 /** As trn_cell_introduce_encrypted_get_pad, but take and return a
    636 * const pointer
    637 */
    638 const uint8_t  * trn_cell_introduce_encrypted_getconstarray_pad(const trn_cell_introduce_encrypted_t *inp);
    639 /** Change the length of the variable-length array field pad of 'inp'
    640 * to 'newlen'.Fill extra elements with 0. Return 0 on success; return
    641 * -1 and set the error code on 'inp' on failure.
    642 */
    643 int trn_cell_introduce_encrypted_setlen_pad(trn_cell_introduce_encrypted_t *inp, size_t newlen);
    644 
    645 
    646 #endif