cell_introduce1.h 24 KB

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