cell_introduce1.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. /* cell_introduce1.h -- generated by Trunnel v1.5.2.
  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. #include <stdint.h>
  8. #include "trunnel.h"
  9. struct trn_cell_extension_st;
  10. struct link_specifier_st;
  11. #define TRUNNEL_SHA1_LEN 20
  12. #define TRUNNEL_REND_COOKIE_LEN 20
  13. #define TRUNNEL_HS_INTRO_ACK_STATUS_SUCCESS 0
  14. #define TRUNNEL_HS_INTRO_ACK_STATUS_UNKNOWN_ID 1
  15. #define TRUNNEL_HS_INTRO_ACK_STATUS_BAD_FORMAT 2
  16. #define TRUNNEL_HS_INTRO_AUTH_KEY_TYPE_LEGACY0 0
  17. #define TRUNNEL_HS_INTRO_AUTH_KEY_TYPE_LEGACY1 1
  18. #define TRUNNEL_HS_INTRO_AUTH_KEY_TYPE_ED25519 2
  19. #define TRUNNEL_HS_INTRO_ONION_KEY_TYPE_NTOR 1
  20. #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_INTRODUCE1)
  21. struct trn_cell_introduce1_st {
  22. uint8_t legacy_key_id[TRUNNEL_SHA1_LEN];
  23. uint8_t auth_key_type;
  24. uint16_t auth_key_len;
  25. TRUNNEL_DYNARRAY_HEAD(, uint8_t) auth_key;
  26. struct trn_cell_extension_st *extensions;
  27. TRUNNEL_DYNARRAY_HEAD(, uint8_t) encrypted;
  28. uint8_t trunnel_error_code_;
  29. };
  30. #endif
  31. typedef struct trn_cell_introduce1_st trn_cell_introduce1_t;
  32. #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_INTRODUCE_ACK)
  33. struct trn_cell_introduce_ack_st {
  34. uint16_t status;
  35. struct trn_cell_extension_st *extensions;
  36. uint8_t trunnel_error_code_;
  37. };
  38. #endif
  39. typedef struct trn_cell_introduce_ack_st trn_cell_introduce_ack_t;
  40. #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_INTRODUCE_ENCRYPTED)
  41. struct trn_cell_introduce_encrypted_st {
  42. uint8_t rend_cookie[TRUNNEL_REND_COOKIE_LEN];
  43. struct trn_cell_extension_st *extensions;
  44. uint8_t onion_key_type;
  45. uint16_t onion_key_len;
  46. TRUNNEL_DYNARRAY_HEAD(, uint8_t) onion_key;
  47. uint8_t nspec;
  48. TRUNNEL_DYNARRAY_HEAD(, struct link_specifier_st *) nspecs;
  49. TRUNNEL_DYNARRAY_HEAD(, uint8_t) pad;
  50. uint8_t trunnel_error_code_;
  51. };
  52. #endif
  53. typedef struct trn_cell_introduce_encrypted_st trn_cell_introduce_encrypted_t;
  54. /** Return a newly allocated trn_cell_introduce1 with all elements set
  55. * to zero.
  56. */
  57. trn_cell_introduce1_t *trn_cell_introduce1_new(void);
  58. /** Release all storage held by the trn_cell_introduce1 in 'victim'.
  59. * (Do nothing if 'victim' is NULL.)
  60. */
  61. void trn_cell_introduce1_free(trn_cell_introduce1_t *victim);
  62. /** Try to parse a trn_cell_introduce1 from the buffer in 'input',
  63. * using up to 'len_in' bytes from the input buffer. On success,
  64. * return the number of bytes consumed and set *output to the newly
  65. * allocated trn_cell_introduce1_t. On failure, return -2 if the input
  66. * appears truncated, and -1 if the input is otherwise invalid.
  67. */
  68. ssize_t trn_cell_introduce1_parse(trn_cell_introduce1_t **output, const uint8_t *input, const size_t len_in);
  69. /** Return the number of bytes we expect to need to encode the
  70. * trn_cell_introduce1 in 'obj'. On failure, return a negative value.
  71. * Note that this value may be an overestimate, and can even be an
  72. * underestimate for certain unencodeable objects.
  73. */
  74. ssize_t trn_cell_introduce1_encoded_len(const trn_cell_introduce1_t *obj);
  75. /** Try to encode the trn_cell_introduce1 from 'input' into the buffer
  76. * at 'output', using up to 'avail' bytes of the output buffer. On
  77. * success, return the number of bytes used. On failure, return -2 if
  78. * the buffer was not long enough, and -1 if the input was invalid.
  79. */
  80. ssize_t trn_cell_introduce1_encode(uint8_t *output, size_t avail, const trn_cell_introduce1_t *input);
  81. /** Check whether the internal state of the trn_cell_introduce1 in
  82. * 'obj' is consistent. Return NULL if it is, and a short message if
  83. * it is not.
  84. */
  85. const char *trn_cell_introduce1_check(const trn_cell_introduce1_t *obj);
  86. /** Clear any errors that were set on the object 'obj' by its setter
  87. * functions. Return true iff errors were cleared.
  88. */
  89. int trn_cell_introduce1_clear_errors(trn_cell_introduce1_t *obj);
  90. /** Return the (constant) length of the array holding the
  91. * legacy_key_id field of the trn_cell_introduce1_t in 'inp'.
  92. */
  93. size_t trn_cell_introduce1_getlen_legacy_key_id(const trn_cell_introduce1_t *inp);
  94. /** Return the element at position 'idx' of the fixed array field
  95. * legacy_key_id of the trn_cell_introduce1_t in 'inp'.
  96. */
  97. uint8_t trn_cell_introduce1_get_legacy_key_id(trn_cell_introduce1_t *inp, size_t idx);
  98. /** As trn_cell_introduce1_get_legacy_key_id, but take and return a
  99. * const pointer
  100. */
  101. uint8_t trn_cell_introduce1_getconst_legacy_key_id(const trn_cell_introduce1_t *inp, size_t idx);
  102. /** Change the element at position 'idx' of the fixed array field
  103. * legacy_key_id of the trn_cell_introduce1_t in 'inp', so that it
  104. * will hold the value 'elt'.
  105. */
  106. int trn_cell_introduce1_set_legacy_key_id(trn_cell_introduce1_t *inp, size_t idx, uint8_t elt);
  107. /** Return a pointer to the TRUNNEL_SHA1_LEN-element array field
  108. * legacy_key_id of 'inp'.
  109. */
  110. uint8_t * trn_cell_introduce1_getarray_legacy_key_id(trn_cell_introduce1_t *inp);
  111. /** As trn_cell_introduce1_get_legacy_key_id, but take and return a
  112. * const pointer
  113. */
  114. const uint8_t * trn_cell_introduce1_getconstarray_legacy_key_id(const trn_cell_introduce1_t *inp);
  115. /** Return the value of the auth_key_type field of the
  116. * trn_cell_introduce1_t in 'inp'
  117. */
  118. uint8_t trn_cell_introduce1_get_auth_key_type(const trn_cell_introduce1_t *inp);
  119. /** Set the value of the auth_key_type field of the
  120. * trn_cell_introduce1_t in 'inp' to 'val'. Return 0 on success;
  121. * return -1 and set the error code on 'inp' on failure.
  122. */
  123. int trn_cell_introduce1_set_auth_key_type(trn_cell_introduce1_t *inp, uint8_t val);
  124. /** Return the value of the auth_key_len field of the
  125. * trn_cell_introduce1_t in 'inp'
  126. */
  127. uint16_t trn_cell_introduce1_get_auth_key_len(const trn_cell_introduce1_t *inp);
  128. /** Set the value of the auth_key_len field of the
  129. * trn_cell_introduce1_t in 'inp' to 'val'. Return 0 on success;
  130. * return -1 and set the error code on 'inp' on failure.
  131. */
  132. int trn_cell_introduce1_set_auth_key_len(trn_cell_introduce1_t *inp, uint16_t val);
  133. /** Return the length of the dynamic array holding the auth_key field
  134. * of the trn_cell_introduce1_t in 'inp'.
  135. */
  136. size_t trn_cell_introduce1_getlen_auth_key(const trn_cell_introduce1_t *inp);
  137. /** Return the element at position 'idx' of the dynamic array field
  138. * auth_key of the trn_cell_introduce1_t in 'inp'.
  139. */
  140. uint8_t trn_cell_introduce1_get_auth_key(trn_cell_introduce1_t *inp, size_t idx);
  141. /** As trn_cell_introduce1_get_auth_key, but take and return a const
  142. * pointer
  143. */
  144. uint8_t trn_cell_introduce1_getconst_auth_key(const trn_cell_introduce1_t *inp, size_t idx);
  145. /** Change the element at position 'idx' of the dynamic array field
  146. * auth_key of the trn_cell_introduce1_t in 'inp', so that it will
  147. * hold the value 'elt'.
  148. */
  149. int trn_cell_introduce1_set_auth_key(trn_cell_introduce1_t *inp, size_t idx, uint8_t elt);
  150. /** Append a new element 'elt' to the dynamic array field auth_key of
  151. * the trn_cell_introduce1_t in 'inp'.
  152. */
  153. int trn_cell_introduce1_add_auth_key(trn_cell_introduce1_t *inp, uint8_t elt);
  154. /** Return a pointer to the variable-length array field auth_key of
  155. * 'inp'.
  156. */
  157. uint8_t * trn_cell_introduce1_getarray_auth_key(trn_cell_introduce1_t *inp);
  158. /** As trn_cell_introduce1_get_auth_key, but take and return a const
  159. * pointer
  160. */
  161. const uint8_t * trn_cell_introduce1_getconstarray_auth_key(const trn_cell_introduce1_t *inp);
  162. /** Change the length of the variable-length array field auth_key of
  163. * 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
  164. * return -1 and set the error code on 'inp' on failure.
  165. */
  166. int trn_cell_introduce1_setlen_auth_key(trn_cell_introduce1_t *inp, size_t newlen);
  167. /** Return the value of the extensions field of the
  168. * trn_cell_introduce1_t in 'inp'
  169. */
  170. struct trn_cell_extension_st * trn_cell_introduce1_get_extensions(trn_cell_introduce1_t *inp);
  171. /** As trn_cell_introduce1_get_extensions, but take and return a const
  172. * pointer
  173. */
  174. const struct trn_cell_extension_st * trn_cell_introduce1_getconst_extensions(const trn_cell_introduce1_t *inp);
  175. /** Set the value of the extensions field of the trn_cell_introduce1_t
  176. * in 'inp' to 'val'. Free the old value if any. Steals the
  177. * referenceto 'val'.Return 0 on success; return -1 and set the error
  178. * code on 'inp' on failure.
  179. */
  180. int trn_cell_introduce1_set_extensions(trn_cell_introduce1_t *inp, struct trn_cell_extension_st *val);
  181. /** As trn_cell_introduce1_set_extensions, but does not free the
  182. * previous value.
  183. */
  184. int trn_cell_introduce1_set0_extensions(trn_cell_introduce1_t *inp, struct trn_cell_extension_st *val);
  185. /** Return the length of the dynamic array holding the encrypted field
  186. * of the trn_cell_introduce1_t in 'inp'.
  187. */
  188. size_t trn_cell_introduce1_getlen_encrypted(const trn_cell_introduce1_t *inp);
  189. /** Return the element at position 'idx' of the dynamic array field
  190. * encrypted of the trn_cell_introduce1_t in 'inp'.
  191. */
  192. uint8_t trn_cell_introduce1_get_encrypted(trn_cell_introduce1_t *inp, size_t idx);
  193. /** As trn_cell_introduce1_get_encrypted, but take and return a const
  194. * pointer
  195. */
  196. uint8_t trn_cell_introduce1_getconst_encrypted(const trn_cell_introduce1_t *inp, size_t idx);
  197. /** Change the element at position 'idx' of the dynamic array field
  198. * encrypted of the trn_cell_introduce1_t in 'inp', so that it will
  199. * hold the value 'elt'.
  200. */
  201. int trn_cell_introduce1_set_encrypted(trn_cell_introduce1_t *inp, size_t idx, uint8_t elt);
  202. /** Append a new element 'elt' to the dynamic array field encrypted of
  203. * the trn_cell_introduce1_t in 'inp'.
  204. */
  205. int trn_cell_introduce1_add_encrypted(trn_cell_introduce1_t *inp, uint8_t elt);
  206. /** Return a pointer to the variable-length array field encrypted of
  207. * 'inp'.
  208. */
  209. uint8_t * trn_cell_introduce1_getarray_encrypted(trn_cell_introduce1_t *inp);
  210. /** As trn_cell_introduce1_get_encrypted, but take and return a const
  211. * pointer
  212. */
  213. const uint8_t * trn_cell_introduce1_getconstarray_encrypted(const trn_cell_introduce1_t *inp);
  214. /** Change the length of the variable-length array field encrypted of
  215. * 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
  216. * return -1 and set the error code on 'inp' on failure.
  217. */
  218. int trn_cell_introduce1_setlen_encrypted(trn_cell_introduce1_t *inp, size_t newlen);
  219. /** Return a newly allocated trn_cell_introduce_ack with all elements
  220. * set to zero.
  221. */
  222. trn_cell_introduce_ack_t *trn_cell_introduce_ack_new(void);
  223. /** Release all storage held by the trn_cell_introduce_ack in
  224. * 'victim'. (Do nothing if 'victim' is NULL.)
  225. */
  226. void trn_cell_introduce_ack_free(trn_cell_introduce_ack_t *victim);
  227. /** Try to parse a trn_cell_introduce_ack from the buffer in 'input',
  228. * using up to 'len_in' bytes from the input buffer. On success,
  229. * return the number of bytes consumed and set *output to the newly
  230. * allocated trn_cell_introduce_ack_t. On failure, return -2 if the
  231. * input appears truncated, and -1 if the input is otherwise invalid.
  232. */
  233. ssize_t trn_cell_introduce_ack_parse(trn_cell_introduce_ack_t **output, const uint8_t *input, const size_t len_in);
  234. /** Return the number of bytes we expect to need to encode the
  235. * trn_cell_introduce_ack in 'obj'. On failure, return a negative
  236. * value. Note that this value may be an overestimate, and can even be
  237. * an underestimate for certain unencodeable objects.
  238. */
  239. ssize_t trn_cell_introduce_ack_encoded_len(const trn_cell_introduce_ack_t *obj);
  240. /** Try to encode the trn_cell_introduce_ack from 'input' into the
  241. * buffer at 'output', using up to 'avail' bytes of the output buffer.
  242. * On success, return the number of bytes used. On failure, return -2
  243. * if the buffer was not long enough, and -1 if the input was invalid.
  244. */
  245. ssize_t trn_cell_introduce_ack_encode(uint8_t *output, size_t avail, const trn_cell_introduce_ack_t *input);
  246. /** Check whether the internal state of the trn_cell_introduce_ack in
  247. * 'obj' is consistent. Return NULL if it is, and a short message if
  248. * it is not.
  249. */
  250. const char *trn_cell_introduce_ack_check(const trn_cell_introduce_ack_t *obj);
  251. /** Clear any errors that were set on the object 'obj' by its setter
  252. * functions. Return true iff errors were cleared.
  253. */
  254. int trn_cell_introduce_ack_clear_errors(trn_cell_introduce_ack_t *obj);
  255. /** Return the value of the status field of the
  256. * trn_cell_introduce_ack_t in 'inp'
  257. */
  258. uint16_t trn_cell_introduce_ack_get_status(const trn_cell_introduce_ack_t *inp);
  259. /** Set the value of the status field of the trn_cell_introduce_ack_t
  260. * in 'inp' to 'val'. Return 0 on success; return -1 and set the error
  261. * code on 'inp' on failure.
  262. */
  263. int trn_cell_introduce_ack_set_status(trn_cell_introduce_ack_t *inp, uint16_t val);
  264. /** Return the value of the extensions field of the
  265. * trn_cell_introduce_ack_t in 'inp'
  266. */
  267. struct trn_cell_extension_st * trn_cell_introduce_ack_get_extensions(trn_cell_introduce_ack_t *inp);
  268. /** As trn_cell_introduce_ack_get_extensions, but take and return a
  269. * const pointer
  270. */
  271. const struct trn_cell_extension_st * trn_cell_introduce_ack_getconst_extensions(const trn_cell_introduce_ack_t *inp);
  272. /** Set the value of the extensions field of the
  273. * trn_cell_introduce_ack_t in 'inp' to 'val'. Free the old value if
  274. * any. Steals the referenceto 'val'.Return 0 on success; return -1
  275. * and set the error code on 'inp' on failure.
  276. */
  277. int trn_cell_introduce_ack_set_extensions(trn_cell_introduce_ack_t *inp, struct trn_cell_extension_st *val);
  278. /** As trn_cell_introduce_ack_set_extensions, but does not free the
  279. * previous value.
  280. */
  281. int trn_cell_introduce_ack_set0_extensions(trn_cell_introduce_ack_t *inp, struct trn_cell_extension_st *val);
  282. /** Return a newly allocated trn_cell_introduce_encrypted with all
  283. * elements set to zero.
  284. */
  285. trn_cell_introduce_encrypted_t *trn_cell_introduce_encrypted_new(void);
  286. /** Release all storage held by the trn_cell_introduce_encrypted in
  287. * 'victim'. (Do nothing if 'victim' is NULL.)
  288. */
  289. void trn_cell_introduce_encrypted_free(trn_cell_introduce_encrypted_t *victim);
  290. /** Try to parse a trn_cell_introduce_encrypted from the buffer in
  291. * 'input', using up to 'len_in' bytes from the input buffer. On
  292. * success, return the number of bytes consumed and set *output to the
  293. * newly allocated trn_cell_introduce_encrypted_t. On failure, return
  294. * -2 if the input appears truncated, and -1 if the input is otherwise
  295. * invalid.
  296. */
  297. ssize_t trn_cell_introduce_encrypted_parse(trn_cell_introduce_encrypted_t **output, const uint8_t *input, const size_t len_in);
  298. /** Return the number of bytes we expect to need to encode the
  299. * trn_cell_introduce_encrypted in 'obj'. On failure, return a
  300. * negative value. Note that this value may be an overestimate, and
  301. * can even be an underestimate for certain unencodeable objects.
  302. */
  303. ssize_t trn_cell_introduce_encrypted_encoded_len(const trn_cell_introduce_encrypted_t *obj);
  304. /** Try to encode the trn_cell_introduce_encrypted from 'input' into
  305. * the buffer at 'output', using up to 'avail' bytes of the output
  306. * buffer. On success, return the number of bytes used. On failure,
  307. * return -2 if the buffer was not long enough, and -1 if the input
  308. * was invalid.
  309. */
  310. ssize_t trn_cell_introduce_encrypted_encode(uint8_t *output, size_t avail, const trn_cell_introduce_encrypted_t *input);
  311. /** Check whether the internal state of the
  312. * trn_cell_introduce_encrypted in 'obj' is consistent. Return NULL if
  313. * it is, and a short message if it is not.
  314. */
  315. const char *trn_cell_introduce_encrypted_check(const trn_cell_introduce_encrypted_t *obj);
  316. /** Clear any errors that were set on the object 'obj' by its setter
  317. * functions. Return true iff errors were cleared.
  318. */
  319. int trn_cell_introduce_encrypted_clear_errors(trn_cell_introduce_encrypted_t *obj);
  320. /** Return the (constant) length of the array holding the rend_cookie
  321. * field of the trn_cell_introduce_encrypted_t in 'inp'.
  322. */
  323. size_t trn_cell_introduce_encrypted_getlen_rend_cookie(const trn_cell_introduce_encrypted_t *inp);
  324. /** Return the element at position 'idx' of the fixed array field
  325. * rend_cookie of the trn_cell_introduce_encrypted_t in 'inp'.
  326. */
  327. uint8_t trn_cell_introduce_encrypted_get_rend_cookie(trn_cell_introduce_encrypted_t *inp, size_t idx);
  328. /** As trn_cell_introduce_encrypted_get_rend_cookie, but take and
  329. * return a const pointer
  330. */
  331. uint8_t trn_cell_introduce_encrypted_getconst_rend_cookie(const trn_cell_introduce_encrypted_t *inp, size_t idx);
  332. /** Change the element at position 'idx' of the fixed array field
  333. * rend_cookie of the trn_cell_introduce_encrypted_t in 'inp', so that
  334. * it will hold the value 'elt'.
  335. */
  336. int trn_cell_introduce_encrypted_set_rend_cookie(trn_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt);
  337. /** Return a pointer to the TRUNNEL_REND_COOKIE_LEN-element array
  338. * field rend_cookie of 'inp'.
  339. */
  340. uint8_t * trn_cell_introduce_encrypted_getarray_rend_cookie(trn_cell_introduce_encrypted_t *inp);
  341. /** As trn_cell_introduce_encrypted_get_rend_cookie, but take and
  342. * return a const pointer
  343. */
  344. const uint8_t * trn_cell_introduce_encrypted_getconstarray_rend_cookie(const trn_cell_introduce_encrypted_t *inp);
  345. /** Return the value of the extensions field of the
  346. * trn_cell_introduce_encrypted_t in 'inp'
  347. */
  348. struct trn_cell_extension_st * trn_cell_introduce_encrypted_get_extensions(trn_cell_introduce_encrypted_t *inp);
  349. /** As trn_cell_introduce_encrypted_get_extensions, but take and
  350. * return a const pointer
  351. */
  352. const struct trn_cell_extension_st * trn_cell_introduce_encrypted_getconst_extensions(const trn_cell_introduce_encrypted_t *inp);
  353. /** Set the value of the extensions field of the
  354. * trn_cell_introduce_encrypted_t in 'inp' to 'val'. Free the old
  355. * value if any. Steals the referenceto 'val'.Return 0 on success;
  356. * return -1 and set the error code on 'inp' on failure.
  357. */
  358. int trn_cell_introduce_encrypted_set_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_cell_extension_st *val);
  359. /** As trn_cell_introduce_encrypted_set_extensions, but does not free
  360. * the previous value.
  361. */
  362. int trn_cell_introduce_encrypted_set0_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_cell_extension_st *val);
  363. /** Return the value of the onion_key_type field of the
  364. * trn_cell_introduce_encrypted_t in 'inp'
  365. */
  366. uint8_t trn_cell_introduce_encrypted_get_onion_key_type(const trn_cell_introduce_encrypted_t *inp);
  367. /** Set the value of the onion_key_type field of the
  368. * trn_cell_introduce_encrypted_t in 'inp' to 'val'. Return 0 on
  369. * success; return -1 and set the error code on 'inp' on failure.
  370. */
  371. int trn_cell_introduce_encrypted_set_onion_key_type(trn_cell_introduce_encrypted_t *inp, uint8_t val);
  372. /** Return the value of the onion_key_len field of the
  373. * trn_cell_introduce_encrypted_t in 'inp'
  374. */
  375. uint16_t trn_cell_introduce_encrypted_get_onion_key_len(const trn_cell_introduce_encrypted_t *inp);
  376. /** Set the value of the onion_key_len field of the
  377. * trn_cell_introduce_encrypted_t in 'inp' to 'val'. Return 0 on
  378. * success; return -1 and set the error code on 'inp' on failure.
  379. */
  380. int trn_cell_introduce_encrypted_set_onion_key_len(trn_cell_introduce_encrypted_t *inp, uint16_t val);
  381. /** Return the length of the dynamic array holding the onion_key field
  382. * of the trn_cell_introduce_encrypted_t in 'inp'.
  383. */
  384. size_t trn_cell_introduce_encrypted_getlen_onion_key(const trn_cell_introduce_encrypted_t *inp);
  385. /** Return the element at position 'idx' of the dynamic array field
  386. * onion_key of the trn_cell_introduce_encrypted_t in 'inp'.
  387. */
  388. uint8_t trn_cell_introduce_encrypted_get_onion_key(trn_cell_introduce_encrypted_t *inp, size_t idx);
  389. /** As trn_cell_introduce_encrypted_get_onion_key, but take and return
  390. * a const pointer
  391. */
  392. uint8_t trn_cell_introduce_encrypted_getconst_onion_key(const trn_cell_introduce_encrypted_t *inp, size_t idx);
  393. /** Change the element at position 'idx' of the dynamic array field
  394. * onion_key of the trn_cell_introduce_encrypted_t in 'inp', so that
  395. * it will hold the value 'elt'.
  396. */
  397. int trn_cell_introduce_encrypted_set_onion_key(trn_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt);
  398. /** Append a new element 'elt' to the dynamic array field onion_key of
  399. * the trn_cell_introduce_encrypted_t in 'inp'.
  400. */
  401. int trn_cell_introduce_encrypted_add_onion_key(trn_cell_introduce_encrypted_t *inp, uint8_t elt);
  402. /** Return a pointer to the variable-length array field onion_key of
  403. * 'inp'.
  404. */
  405. uint8_t * trn_cell_introduce_encrypted_getarray_onion_key(trn_cell_introduce_encrypted_t *inp);
  406. /** As trn_cell_introduce_encrypted_get_onion_key, but take and return
  407. * a const pointer
  408. */
  409. const uint8_t * trn_cell_introduce_encrypted_getconstarray_onion_key(const trn_cell_introduce_encrypted_t *inp);
  410. /** Change the length of the variable-length array field onion_key of
  411. * 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
  412. * return -1 and set the error code on 'inp' on failure.
  413. */
  414. int trn_cell_introduce_encrypted_setlen_onion_key(trn_cell_introduce_encrypted_t *inp, size_t newlen);
  415. /** Return the value of the nspec field of the
  416. * trn_cell_introduce_encrypted_t in 'inp'
  417. */
  418. uint8_t trn_cell_introduce_encrypted_get_nspec(const trn_cell_introduce_encrypted_t *inp);
  419. /** Set the value of the nspec field of the
  420. * trn_cell_introduce_encrypted_t in 'inp' to 'val'. Return 0 on
  421. * success; return -1 and set the error code on 'inp' on failure.
  422. */
  423. int trn_cell_introduce_encrypted_set_nspec(trn_cell_introduce_encrypted_t *inp, uint8_t val);
  424. /** Return the length of the dynamic array holding the nspecs field of
  425. * the trn_cell_introduce_encrypted_t in 'inp'.
  426. */
  427. size_t trn_cell_introduce_encrypted_getlen_nspecs(const trn_cell_introduce_encrypted_t *inp);
  428. /** Return the element at position 'idx' of the dynamic array field
  429. * nspecs of the trn_cell_introduce_encrypted_t in 'inp'.
  430. */
  431. struct link_specifier_st * trn_cell_introduce_encrypted_get_nspecs(trn_cell_introduce_encrypted_t *inp, size_t idx);
  432. /** As trn_cell_introduce_encrypted_get_nspecs, but take and return a
  433. * const pointer
  434. */
  435. const struct link_specifier_st * trn_cell_introduce_encrypted_getconst_nspecs(const trn_cell_introduce_encrypted_t *inp, size_t idx);
  436. /** Change the element at position 'idx' of the dynamic array field
  437. * nspecs of the trn_cell_introduce_encrypted_t in 'inp', so that it
  438. * will hold the value 'elt'. Free the previous value, if any.
  439. */
  440. int trn_cell_introduce_encrypted_set_nspecs(trn_cell_introduce_encrypted_t *inp, size_t idx, struct link_specifier_st * elt);
  441. /** As trn_cell_introduce_encrypted_set_nspecs, but does not free the
  442. * previous value.
  443. */
  444. int trn_cell_introduce_encrypted_set0_nspecs(trn_cell_introduce_encrypted_t *inp, size_t idx, struct link_specifier_st * elt);
  445. /** Append a new element 'elt' to the dynamic array field nspecs of
  446. * the trn_cell_introduce_encrypted_t in 'inp'.
  447. */
  448. int trn_cell_introduce_encrypted_add_nspecs(trn_cell_introduce_encrypted_t *inp, struct link_specifier_st * elt);
  449. /** Return a pointer to the variable-length array field nspecs of
  450. * 'inp'.
  451. */
  452. struct link_specifier_st * * trn_cell_introduce_encrypted_getarray_nspecs(trn_cell_introduce_encrypted_t *inp);
  453. /** As trn_cell_introduce_encrypted_get_nspecs, but take and return a
  454. * const pointer
  455. */
  456. const struct link_specifier_st * const * trn_cell_introduce_encrypted_getconstarray_nspecs(const trn_cell_introduce_encrypted_t *inp);
  457. /** Change the length of the variable-length array field nspecs of
  458. * 'inp' to 'newlen'.Fill extra elements with NULL; free removed
  459. * elements. Return 0 on success; return -1 and set the error code on
  460. * 'inp' on failure.
  461. */
  462. int trn_cell_introduce_encrypted_setlen_nspecs(trn_cell_introduce_encrypted_t *inp, size_t newlen);
  463. /** Return the length of the dynamic array holding the pad field of
  464. * the trn_cell_introduce_encrypted_t in 'inp'.
  465. */
  466. size_t trn_cell_introduce_encrypted_getlen_pad(const trn_cell_introduce_encrypted_t *inp);
  467. /** Return the element at position 'idx' of the dynamic array field
  468. * pad of the trn_cell_introduce_encrypted_t in 'inp'.
  469. */
  470. uint8_t trn_cell_introduce_encrypted_get_pad(trn_cell_introduce_encrypted_t *inp, size_t idx);
  471. /** As trn_cell_introduce_encrypted_get_pad, but take and return a
  472. * const pointer
  473. */
  474. uint8_t trn_cell_introduce_encrypted_getconst_pad(const trn_cell_introduce_encrypted_t *inp, size_t idx);
  475. /** Change the element at position 'idx' of the dynamic array field
  476. * pad of the trn_cell_introduce_encrypted_t in 'inp', so that it will
  477. * hold the value 'elt'.
  478. */
  479. int trn_cell_introduce_encrypted_set_pad(trn_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt);
  480. /** Append a new element 'elt' to the dynamic array field pad of the
  481. * trn_cell_introduce_encrypted_t in 'inp'.
  482. */
  483. int trn_cell_introduce_encrypted_add_pad(trn_cell_introduce_encrypted_t *inp, uint8_t elt);
  484. /** Return a pointer to the variable-length array field pad of 'inp'.
  485. */
  486. uint8_t * trn_cell_introduce_encrypted_getarray_pad(trn_cell_introduce_encrypted_t *inp);
  487. /** As trn_cell_introduce_encrypted_get_pad, but take and return a
  488. * const pointer
  489. */
  490. const uint8_t * trn_cell_introduce_encrypted_getconstarray_pad(const trn_cell_introduce_encrypted_t *inp);
  491. /** Change the length of the variable-length array field pad of 'inp'
  492. * to 'newlen'.Fill extra elements with 0. Return 0 on success; return
  493. * -1 and set the error code on 'inp' on failure.
  494. */
  495. int trn_cell_introduce_encrypted_setlen_pad(trn_cell_introduce_encrypted_t *inp, size_t newlen);
  496. #endif