summaryrefslogtreecommitdiff
path: root/src/trunnel/hs/cell_introduce1.h
blob: b81c562343f5be4e1b927e96776d18b8a12cb6e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
/* cell_introduce1.h -- generated by Trunnel v1.5.3.
 * https://gitweb.torproject.org/trunnel.git
 * You probably shouldn't edit this file.
 */
#ifndef TRUNNEL_CELL_INTRODUCE1_H
#define TRUNNEL_CELL_INTRODUCE1_H

#include <stdint.h>
#include "trunnel.h"

struct trn_extension_st;
struct link_specifier_st;
#define TRUNNEL_SHA1_LEN 20
#define TRUNNEL_REND_COOKIE_LEN 20
#define TRUNNEL_HS_INTRO_ACK_STATUS_SUCCESS 0
#define TRUNNEL_HS_INTRO_ACK_STATUS_UNKNOWN_ID 1
#define TRUNNEL_HS_INTRO_ACK_STATUS_BAD_FORMAT 2
#define TRUNNEL_HS_INTRO_AUTH_KEY_TYPE_LEGACY0 0
#define TRUNNEL_HS_INTRO_AUTH_KEY_TYPE_LEGACY1 1
#define TRUNNEL_HS_INTRO_AUTH_KEY_TYPE_ED25519 2
#define TRUNNEL_HS_INTRO_ONION_KEY_TYPE_NTOR 1
#define TRUNNEL_EXT_TYPE_CC_REQUEST 1
#define TRUNNEL_EXT_TYPE_POW 2
#define TRUNNEL_POW_NONCE_LEN 16
#define TRUNNEL_POW_SOLUTION_LEN 16
#define TRUNNEL_POW_SEED_HEAD_LEN 4
#define TRUNNEL_POW_VERSION_EQUIX 1
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_EXTENSION_POW)
struct trn_cell_extension_pow_st {
  uint8_t pow_version;
  uint8_t pow_nonce[TRUNNEL_POW_NONCE_LEN];
  uint32_t pow_effort;
  uint8_t pow_seed[TRUNNEL_POW_SEED_HEAD_LEN];
  uint8_t pow_solution[TRUNNEL_POW_SOLUTION_LEN];
  uint8_t trunnel_error_code_;
};
#endif
typedef struct trn_cell_extension_pow_st trn_cell_extension_pow_t;
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_INTRODUCE1)
struct trn_cell_introduce1_st {
  uint8_t legacy_key_id[TRUNNEL_SHA1_LEN];
  uint8_t auth_key_type;
  uint16_t auth_key_len;
  TRUNNEL_DYNARRAY_HEAD(, uint8_t) auth_key;
  struct trn_extension_st *extensions;
  TRUNNEL_DYNARRAY_HEAD(, uint8_t) encrypted;
  uint8_t trunnel_error_code_;
};
#endif
typedef struct trn_cell_introduce1_st trn_cell_introduce1_t;
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_INTRODUCE_ACK)
struct trn_cell_introduce_ack_st {
  uint16_t status;
  struct trn_extension_st *extensions;
  uint8_t trunnel_error_code_;
};
#endif
typedef struct trn_cell_introduce_ack_st trn_cell_introduce_ack_t;
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_INTRODUCE_ENCRYPTED)
struct trn_cell_introduce_encrypted_st {
  uint8_t rend_cookie[TRUNNEL_REND_COOKIE_LEN];
  struct trn_extension_st *extensions;
  uint8_t onion_key_type;
  uint16_t onion_key_len;
  TRUNNEL_DYNARRAY_HEAD(, uint8_t) onion_key;
  uint8_t nspec;
  TRUNNEL_DYNARRAY_HEAD(, struct link_specifier_st *) nspecs;
  TRUNNEL_DYNARRAY_HEAD(, uint8_t) pad;
  uint8_t trunnel_error_code_;
};
#endif
typedef struct trn_cell_introduce_encrypted_st trn_cell_introduce_encrypted_t;
/** Return a newly allocated trn_cell_extension_pow with all elements
 * set to zero.
 */
trn_cell_extension_pow_t *trn_cell_extension_pow_new(void);
/** Release all storage held by the trn_cell_extension_pow in
 * 'victim'. (Do nothing if 'victim' is NULL.)
 */
void trn_cell_extension_pow_free(trn_cell_extension_pow_t *victim);
/** Try to parse a trn_cell_extension_pow from the buffer in 'input',
 * using up to 'len_in' bytes from the input buffer. On success,
 * return the number of bytes consumed and set *output to the newly
 * allocated trn_cell_extension_pow_t. On failure, return -2 if the
 * input appears truncated, and -1 if the input is otherwise invalid.
 */
ssize_t trn_cell_extension_pow_parse(trn_cell_extension_pow_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
 * trn_cell_extension_pow in 'obj'. On failure, return a negative
 * value. Note that this value may be an overestimate, and can even be
 * an underestimate for certain unencodeable objects.
 */
ssize_t trn_cell_extension_pow_encoded_len(const trn_cell_extension_pow_t *obj);
/** Try to encode the trn_cell_extension_pow from 'input' into the
 * buffer at 'output', using up to 'avail' bytes of the output buffer.
 * On success, return the number of bytes used. On failure, return -2
 * if the buffer was not long enough, and -1 if the input was invalid.
 */
ssize_t trn_cell_extension_pow_encode(uint8_t *output, size_t avail, const trn_cell_extension_pow_t *input);
/** Check whether the internal state of the trn_cell_extension_pow in
 * 'obj' is consistent. Return NULL if it is, and a short message if
 * it is not.
 */
const char *trn_cell_extension_pow_check(const trn_cell_extension_pow_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
 * functions. Return true iff errors were cleared.
 */
int trn_cell_extension_pow_clear_errors(trn_cell_extension_pow_t *obj);
/** Return the value of the pow_version field of the
 * trn_cell_extension_pow_t in 'inp'
 */
uint8_t trn_cell_extension_pow_get_pow_version(const trn_cell_extension_pow_t *inp);
/** Set the value of the pow_version field of the
 * trn_cell_extension_pow_t in 'inp' to 'val'. Return 0 on success;
 * return -1 and set the error code on 'inp' on failure.
 */
int trn_cell_extension_pow_set_pow_version(trn_cell_extension_pow_t *inp, uint8_t val);
/** Return the (constant) length of the array holding the pow_nonce
 * field of the trn_cell_extension_pow_t in 'inp'.
 */
size_t trn_cell_extension_pow_getlen_pow_nonce(const trn_cell_extension_pow_t *inp);
/** Return the element at position 'idx' of the fixed array field
 * pow_nonce of the trn_cell_extension_pow_t in 'inp'.
 */
uint8_t trn_cell_extension_pow_get_pow_nonce(trn_cell_extension_pow_t *inp, size_t idx);
/** As trn_cell_extension_pow_get_pow_nonce, but take and return a
 * const pointer
 */
uint8_t trn_cell_extension_pow_getconst_pow_nonce(const trn_cell_extension_pow_t *inp, size_t idx);
/** Change the element at position 'idx' of the fixed array field
 * pow_nonce of the trn_cell_extension_pow_t in 'inp', so that it will
 * hold the value 'elt'.
 */
int trn_cell_extension_pow_set_pow_nonce(trn_cell_extension_pow_t *inp, size_t idx, uint8_t elt);
/** Return a pointer to the TRUNNEL_POW_NONCE_LEN-element array field
 * pow_nonce of 'inp'.
 */
uint8_t * trn_cell_extension_pow_getarray_pow_nonce(trn_cell_extension_pow_t *inp);
/** As trn_cell_extension_pow_get_pow_nonce, but take and return a
 * const pointer
 */
const uint8_t  * trn_cell_extension_pow_getconstarray_pow_nonce(const trn_cell_extension_pow_t *inp);
/** Return the value of the pow_effort field of the
 * trn_cell_extension_pow_t in 'inp'
 */
uint32_t trn_cell_extension_pow_get_pow_effort(const trn_cell_extension_pow_t *inp);
/** Set the value of the pow_effort field of the
 * trn_cell_extension_pow_t in 'inp' to 'val'. Return 0 on success;
 * return -1 and set the error code on 'inp' on failure.
 */
int trn_cell_extension_pow_set_pow_effort(trn_cell_extension_pow_t *inp, uint32_t val);
/** Return the (constant) length of the array holding the pow_seed
 * field of the trn_cell_extension_pow_t in 'inp'.
 */
size_t trn_cell_extension_pow_getlen_pow_seed(const trn_cell_extension_pow_t *inp);
/** Return the element at position 'idx' of the fixed array field
 * pow_seed of the trn_cell_extension_pow_t in 'inp'.
 */
uint8_t trn_cell_extension_pow_get_pow_seed(trn_cell_extension_pow_t *inp, size_t idx);
/** As trn_cell_extension_pow_get_pow_seed, but take and return a
 * const pointer
 */
uint8_t trn_cell_extension_pow_getconst_pow_seed(const trn_cell_extension_pow_t *inp, size_t idx);
/** Change the element at position 'idx' of the fixed array field
 * pow_seed of the trn_cell_extension_pow_t in 'inp', so that it will
 * hold the value 'elt'.
 */
int trn_cell_extension_pow_set_pow_seed(trn_cell_extension_pow_t *inp, size_t idx, uint8_t elt);
/** Return a pointer to the TRUNNEL_POW_SEED_HEAD_LEN-element array
 * field pow_seed of 'inp'.
 */
uint8_t * trn_cell_extension_pow_getarray_pow_seed(trn_cell_extension_pow_t *inp);
/** As trn_cell_extension_pow_get_pow_seed, but take and return a
 * const pointer
 */
const uint8_t  * trn_cell_extension_pow_getconstarray_pow_seed(const trn_cell_extension_pow_t *inp);
/** Return the (constant) length of the array holding the pow_solution
 * field of the trn_cell_extension_pow_t in 'inp'.
 */
size_t trn_cell_extension_pow_getlen_pow_solution(const trn_cell_extension_pow_t *inp);
/** Return the element at position 'idx' of the fixed array field
 * pow_solution of the trn_cell_extension_pow_t in 'inp'.
 */
uint8_t trn_cell_extension_pow_get_pow_solution(trn_cell_extension_pow_t *inp, size_t idx);
/** As trn_cell_extension_pow_get_pow_solution, but take and return a
 * const pointer
 */
uint8_t trn_cell_extension_pow_getconst_pow_solution(const trn_cell_extension_pow_t *inp, size_t idx);
/** Change the element at position 'idx' of the fixed array field
 * pow_solution of the trn_cell_extension_pow_t in 'inp', so that it
 * will hold the value 'elt'.
 */
int trn_cell_extension_pow_set_pow_solution(trn_cell_extension_pow_t *inp, size_t idx, uint8_t elt);
/** Return a pointer to the TRUNNEL_POW_SOLUTION_LEN-element array
 * field pow_solution of 'inp'.
 */
uint8_t * trn_cell_extension_pow_getarray_pow_solution(trn_cell_extension_pow_t *inp);
/** As trn_cell_extension_pow_get_pow_solution, but take and return a
 * const pointer
 */
const uint8_t  * trn_cell_extension_pow_getconstarray_pow_solution(const trn_cell_extension_pow_t *inp);
/** Return a newly allocated trn_cell_introduce1 with all elements set
 * to zero.
 */
trn_cell_introduce1_t *trn_cell_introduce1_new(void);
/** Release all storage held by the trn_cell_introduce1 in 'victim'.
 * (Do nothing if 'victim' is NULL.)
 */
void trn_cell_introduce1_free(trn_cell_introduce1_t *victim);
/** Try to parse a trn_cell_introduce1 from the buffer in 'input',
 * using up to 'len_in' bytes from the input buffer. On success,
 * return the number of bytes consumed and set *output to the newly
 * allocated trn_cell_introduce1_t. On failure, return -2 if the input
 * appears truncated, and -1 if the input is otherwise invalid.
 */
ssize_t trn_cell_introduce1_parse(trn_cell_introduce1_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
 * trn_cell_introduce1 in 'obj'. On failure, return a negative value.
 * Note that this value may be an overestimate, and can even be an
 * underestimate for certain unencodeable objects.
 */
ssize_t trn_cell_introduce1_encoded_len(const trn_cell_introduce1_t *obj);
/** Try to encode the trn_cell_introduce1 from 'input' into the buffer
 * at 'output', using up to 'avail' bytes of the output buffer. On
 * success, return the number of bytes used. On failure, return -2 if
 * the buffer was not long enough, and -1 if the input was invalid.
 */
ssize_t trn_cell_introduce1_encode(uint8_t *output, size_t avail, const trn_cell_introduce1_t *input);
/** Check whether the internal state of the trn_cell_introduce1 in
 * 'obj' is consistent. Return NULL if it is, and a short message if
 * it is not.
 */
const char *trn_cell_introduce1_check(const trn_cell_introduce1_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
 * functions. Return true iff errors were cleared.
 */
int trn_cell_introduce1_clear_errors(trn_cell_introduce1_t *obj);
/** Return the (constant) length of the array holding the
 * legacy_key_id field of the trn_cell_introduce1_t in 'inp'.
 */
size_t trn_cell_introduce1_getlen_legacy_key_id(const trn_cell_introduce1_t *inp);
/** Return the element at position 'idx' of the fixed array field
 * legacy_key_id of the trn_cell_introduce1_t in 'inp'.
 */
uint8_t trn_cell_introduce1_get_legacy_key_id(trn_cell_introduce1_t *inp, size_t idx);
/** As trn_cell_introduce1_get_legacy_key_id, but take and return a
 * const pointer
 */
uint8_t trn_cell_introduce1_getconst_legacy_key_id(const trn_cell_introduce1_t *inp, size_t idx);
/** Change the element at position 'idx' of the fixed array field
 * legacy_key_id of the trn_cell_introduce1_t in 'inp', so that it
 * will hold the value 'elt'.
 */
int trn_cell_introduce1_set_legacy_key_id(trn_cell_introduce1_t *inp, size_t idx, uint8_t elt);
/** Return a pointer to the TRUNNEL_SHA1_LEN-element array field
 * legacy_key_id of 'inp'.
 */
uint8_t * trn_cell_introduce1_getarray_legacy_key_id(trn_cell_introduce1_t *inp);
/** As trn_cell_introduce1_get_legacy_key_id, but take and return a
 * const pointer
 */
const uint8_t  * trn_cell_introduce1_getconstarray_legacy_key_id(const trn_cell_introduce1_t *inp);
/** Return the value of the auth_key_type field of the
 * trn_cell_introduce1_t in 'inp'
 */
uint8_t trn_cell_introduce1_get_auth_key_type(const trn_cell_introduce1_t *inp);
/** Set the value of the auth_key_type field of the
 * trn_cell_introduce1_t in 'inp' to 'val'. Return 0 on success;
 * return -1 and set the error code on 'inp' on failure.
 */
int trn_cell_introduce1_set_auth_key_type(trn_cell_introduce1_t *inp, uint8_t val);
/** Return the value of the auth_key_len field of the
 * trn_cell_introduce1_t in 'inp'
 */
uint16_t trn_cell_introduce1_get_auth_key_len(const trn_cell_introduce1_t *inp);
/** Set the value of the auth_key_len field of the
 * trn_cell_introduce1_t in 'inp' to 'val'. Return 0 on success;
 * return -1 and set the error code on 'inp' on failure.
 */
int trn_cell_introduce1_set_auth_key_len(trn_cell_introduce1_t *inp, uint16_t val);
/** Return the length of the dynamic array holding the auth_key field
 * of the trn_cell_introduce1_t in 'inp'.
 */
size_t trn_cell_introduce1_getlen_auth_key(const trn_cell_introduce1_t *inp);
/** Return the element at position 'idx' of the dynamic array field
 * auth_key of the trn_cell_introduce1_t in 'inp'.
 */
uint8_t trn_cell_introduce1_get_auth_key(trn_cell_introduce1_t *inp, size_t idx);
/** As trn_cell_introduce1_get_auth_key, but take and return a const
 * pointer
 */
uint8_t trn_cell_introduce1_getconst_auth_key(const trn_cell_introduce1_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
 * auth_key of the trn_cell_introduce1_t in 'inp', so that it will
 * hold the value 'elt'.
 */
int trn_cell_introduce1_set_auth_key(trn_cell_introduce1_t *inp, size_t idx, uint8_t elt);
/** Append a new element 'elt' to the dynamic array field auth_key of
 * the trn_cell_introduce1_t in 'inp'.
 */
int trn_cell_introduce1_add_auth_key(trn_cell_introduce1_t *inp, uint8_t elt);
/** Return a pointer to the variable-length array field auth_key of
 * 'inp'.
 */
uint8_t * trn_cell_introduce1_getarray_auth_key(trn_cell_introduce1_t *inp);
/** As trn_cell_introduce1_get_auth_key, but take and return a const
 * pointer
 */
const uint8_t  * trn_cell_introduce1_getconstarray_auth_key(const trn_cell_introduce1_t *inp);
/** Change the length of the variable-length array field auth_key of
 * 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
 * return -1 and set the error code on 'inp' on failure.
 */
int trn_cell_introduce1_setlen_auth_key(trn_cell_introduce1_t *inp, size_t newlen);
/** Return the value of the extensions field of the
 * trn_cell_introduce1_t in 'inp'
 */
struct trn_extension_st * trn_cell_introduce1_get_extensions(trn_cell_introduce1_t *inp);
/** As trn_cell_introduce1_get_extensions, but take and return a const
 * pointer
 */
const struct trn_extension_st * trn_cell_introduce1_getconst_extensions(const trn_cell_introduce1_t *inp);
/** Set the value of the extensions field of the trn_cell_introduce1_t
 * in 'inp' to 'val'. Free the old value if any. Steals the
 * referenceto 'val'.Return 0 on success; return -1 and set the error
 * code on 'inp' on failure.
 */
int trn_cell_introduce1_set_extensions(trn_cell_introduce1_t *inp, struct trn_extension_st *val);
/** As trn_cell_introduce1_set_extensions, but does not free the
 * previous value.
 */
int trn_cell_introduce1_set0_extensions(trn_cell_introduce1_t *inp, struct trn_extension_st *val);
/** Return the length of the dynamic array holding the encrypted field
 * of the trn_cell_introduce1_t in 'inp'.
 */
size_t trn_cell_introduce1_getlen_encrypted(const trn_cell_introduce1_t *inp);
/** Return the element at position 'idx' of the dynamic array field
 * encrypted of the trn_cell_introduce1_t in 'inp'.
 */
uint8_t trn_cell_introduce1_get_encrypted(trn_cell_introduce1_t *inp, size_t idx);
/** As trn_cell_introduce1_get_encrypted, but take and return a const
 * pointer
 */
uint8_t trn_cell_introduce1_getconst_encrypted(const trn_cell_introduce1_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
 * encrypted of the trn_cell_introduce1_t in 'inp', so that it will
 * hold the value 'elt'.
 */
int trn_cell_introduce1_set_encrypted(trn_cell_introduce1_t *inp, size_t idx, uint8_t elt);
/** Append a new element 'elt' to the dynamic array field encrypted of
 * the trn_cell_introduce1_t in 'inp'.
 */
int trn_cell_introduce1_add_encrypted(trn_cell_introduce1_t *inp, uint8_t elt);
/** Return a pointer to the variable-length array field encrypted of
 * 'inp'.
 */
uint8_t * trn_cell_introduce1_getarray_encrypted(trn_cell_introduce1_t *inp);
/** As trn_cell_introduce1_get_encrypted, but take and return a const
 * pointer
 */
const uint8_t  * trn_cell_introduce1_getconstarray_encrypted(const trn_cell_introduce1_t *inp);
/** Change the length of the variable-length array field encrypted of
 * 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
 * return -1 and set the error code on 'inp' on failure.
 */
int trn_cell_introduce1_setlen_encrypted(trn_cell_introduce1_t *inp, size_t newlen);
/** Return a newly allocated trn_cell_introduce_ack with all elements
 * set to zero.
 */
trn_cell_introduce_ack_t *trn_cell_introduce_ack_new(void);
/** Release all storage held by the trn_cell_introduce_ack in
 * 'victim'. (Do nothing if 'victim' is NULL.)
 */
void trn_cell_introduce_ack_free(trn_cell_introduce_ack_t *victim);
/** Try to parse a trn_cell_introduce_ack from the buffer in 'input',
 * using up to 'len_in' bytes from the input buffer. On success,
 * return the number of bytes consumed and set *output to the newly
 * allocated trn_cell_introduce_ack_t. On failure, return -2 if the
 * input appears truncated, and -1 if the input is otherwise invalid.
 */
ssize_t trn_cell_introduce_ack_parse(trn_cell_introduce_ack_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
 * trn_cell_introduce_ack in 'obj'. On failure, return a negative
 * value. Note that this value may be an overestimate, and can even be
 * an underestimate for certain unencodeable objects.
 */
ssize_t trn_cell_introduce_ack_encoded_len(const trn_cell_introduce_ack_t *obj);
/** Try to encode the trn_cell_introduce_ack from 'input' into the
 * buffer at 'output', using up to 'avail' bytes of the output buffer.
 * On success, return the number of bytes used. On failure, return -2
 * if the buffer was not long enough, and -1 if the input was invalid.
 */
ssize_t trn_cell_introduce_ack_encode(uint8_t *output, size_t avail, const trn_cell_introduce_ack_t *input);
/** Check whether the internal state of the trn_cell_introduce_ack in
 * 'obj' is consistent. Return NULL if it is, and a short message if
 * it is not.
 */
const char *trn_cell_introduce_ack_check(const trn_cell_introduce_ack_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
 * functions. Return true iff errors were cleared.
 */
int trn_cell_introduce_ack_clear_errors(trn_cell_introduce_ack_t *obj);
/** Return the value of the status field of the
 * trn_cell_introduce_ack_t in 'inp'
 */
uint16_t trn_cell_introduce_ack_get_status(const trn_cell_introduce_ack_t *inp);
/** Set the value of the status field of the trn_cell_introduce_ack_t
 * in 'inp' to 'val'. Return 0 on success; return -1 and set the error
 * code on 'inp' on failure.
 */
int trn_cell_introduce_ack_set_status(trn_cell_introduce_ack_t *inp, uint16_t val);
/** Return the value of the extensions field of the
 * trn_cell_introduce_ack_t in 'inp'
 */
struct trn_extension_st * trn_cell_introduce_ack_get_extensions(trn_cell_introduce_ack_t *inp);
/** As trn_cell_introduce_ack_get_extensions, but take and return a
 * const pointer
 */
const struct trn_extension_st * trn_cell_introduce_ack_getconst_extensions(const trn_cell_introduce_ack_t *inp);
/** Set the value of the extensions field of the
 * trn_cell_introduce_ack_t in 'inp' to 'val'. Free the old value if
 * any. Steals the referenceto 'val'.Return 0 on success; return -1
 * and set the error code on 'inp' on failure.
 */
int trn_cell_introduce_ack_set_extensions(trn_cell_introduce_ack_t *inp, struct trn_extension_st *val);
/** As trn_cell_introduce_ack_set_extensions, but does not free the
 * previous value.
 */
int trn_cell_introduce_ack_set0_extensions(trn_cell_introduce_ack_t *inp, struct trn_extension_st *val);
/** Return a newly allocated trn_cell_introduce_encrypted with all
 * elements set to zero.
 */
trn_cell_introduce_encrypted_t *trn_cell_introduce_encrypted_new(void);
/** Release all storage held by the trn_cell_introduce_encrypted in
 * 'victim'. (Do nothing if 'victim' is NULL.)
 */
void trn_cell_introduce_encrypted_free(trn_cell_introduce_encrypted_t *victim);
/** Try to parse a trn_cell_introduce_encrypted from the buffer in
 * 'input', using up to 'len_in' bytes from the input buffer. On
 * success, return the number of bytes consumed and set *output to the
 * newly allocated trn_cell_introduce_encrypted_t. On failure, return
 * -2 if the input appears truncated, and -1 if the input is otherwise
 * invalid.
 */
ssize_t trn_cell_introduce_encrypted_parse(trn_cell_introduce_encrypted_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
 * trn_cell_introduce_encrypted in 'obj'. On failure, return a
 * negative value. Note that this value may be an overestimate, and
 * can even be an underestimate for certain unencodeable objects.
 */
ssize_t trn_cell_introduce_encrypted_encoded_len(const trn_cell_introduce_encrypted_t *obj);
/** Try to encode the trn_cell_introduce_encrypted from 'input' into
 * the buffer at 'output', using up to 'avail' bytes of the output
 * buffer. On success, return the number of bytes used. On failure,
 * return -2 if the buffer was not long enough, and -1 if the input
 * was invalid.
 */
ssize_t trn_cell_introduce_encrypted_encode(uint8_t *output, size_t avail, const trn_cell_introduce_encrypted_t *input);
/** Check whether the internal state of the
 * trn_cell_introduce_encrypted in 'obj' is consistent. Return NULL if
 * it is, and a short message if it is not.
 */
const char *trn_cell_introduce_encrypted_check(const trn_cell_introduce_encrypted_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
 * functions. Return true iff errors were cleared.
 */
int trn_cell_introduce_encrypted_clear_errors(trn_cell_introduce_encrypted_t *obj);
/** Return the (constant) length of the array holding the rend_cookie
 * field of the trn_cell_introduce_encrypted_t in 'inp'.
 */
size_t trn_cell_introduce_encrypted_getlen_rend_cookie(const trn_cell_introduce_encrypted_t *inp);
/** Return the element at position 'idx' of the fixed array field
 * rend_cookie of the trn_cell_introduce_encrypted_t in 'inp'.
 */
uint8_t trn_cell_introduce_encrypted_get_rend_cookie(trn_cell_introduce_encrypted_t *inp, size_t idx);
/** As trn_cell_introduce_encrypted_get_rend_cookie, but take and
 * return a const pointer
 */
uint8_t trn_cell_introduce_encrypted_getconst_rend_cookie(const trn_cell_introduce_encrypted_t *inp, size_t idx);
/** Change the element at position 'idx' of the fixed array field
 * rend_cookie of the trn_cell_introduce_encrypted_t in 'inp', so that
 * it will hold the value 'elt'.
 */
int trn_cell_introduce_encrypted_set_rend_cookie(trn_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt);
/** Return a pointer to the TRUNNEL_REND_COOKIE_LEN-element array
 * field rend_cookie of 'inp'.
 */
uint8_t * trn_cell_introduce_encrypted_getarray_rend_cookie(trn_cell_introduce_encrypted_t *inp);
/** As trn_cell_introduce_encrypted_get_rend_cookie, but take and
 * return a const pointer
 */
const uint8_t  * trn_cell_introduce_encrypted_getconstarray_rend_cookie(const trn_cell_introduce_encrypted_t *inp);
/** Return the value of the extensions field of the
 * trn_cell_introduce_encrypted_t in 'inp'
 */
struct trn_extension_st * trn_cell_introduce_encrypted_get_extensions(trn_cell_introduce_encrypted_t *inp);
/** As trn_cell_introduce_encrypted_get_extensions, but take and
 * return a const pointer
 */
const struct trn_extension_st * trn_cell_introduce_encrypted_getconst_extensions(const trn_cell_introduce_encrypted_t *inp);
/** Set the value of the extensions field of the
 * trn_cell_introduce_encrypted_t in 'inp' to 'val'. Free the old
 * value if any. Steals the referenceto 'val'.Return 0 on success;
 * return -1 and set the error code on 'inp' on failure.
 */
int trn_cell_introduce_encrypted_set_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_extension_st *val);
/** As trn_cell_introduce_encrypted_set_extensions, but does not free
 * the previous value.
 */
int trn_cell_introduce_encrypted_set0_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_extension_st *val);
/** Return the value of the onion_key_type field of the
 * trn_cell_introduce_encrypted_t in 'inp'
 */
uint8_t trn_cell_introduce_encrypted_get_onion_key_type(const trn_cell_introduce_encrypted_t *inp);
/** Set the value of the onion_key_type field of the
 * trn_cell_introduce_encrypted_t in 'inp' to 'val'. Return 0 on
 * success; return -1 and set the error code on 'inp' on failure.
 */
int trn_cell_introduce_encrypted_set_onion_key_type(trn_cell_introduce_encrypted_t *inp, uint8_t val);
/** Return the value of the onion_key_len field of the
 * trn_cell_introduce_encrypted_t in 'inp'
 */
uint16_t trn_cell_introduce_encrypted_get_onion_key_len(const trn_cell_introduce_encrypted_t *inp);
/** Set the value of the onion_key_len field of the
 * trn_cell_introduce_encrypted_t in 'inp' to 'val'. Return 0 on
 * success; return -1 and set the error code on 'inp' on failure.
 */
int trn_cell_introduce_encrypted_set_onion_key_len(trn_cell_introduce_encrypted_t *inp, uint16_t val);
/** Return the length of the dynamic array holding the onion_key field
 * of the trn_cell_introduce_encrypted_t in 'inp'.
 */
size_t trn_cell_introduce_encrypted_getlen_onion_key(const trn_cell_introduce_encrypted_t *inp);
/** Return the element at position 'idx' of the dynamic array field
 * onion_key of the trn_cell_introduce_encrypted_t in 'inp'.
 */
uint8_t trn_cell_introduce_encrypted_get_onion_key(trn_cell_introduce_encrypted_t *inp, size_t idx);
/** As trn_cell_introduce_encrypted_get_onion_key, but take and return
 * a const pointer
 */
uint8_t trn_cell_introduce_encrypted_getconst_onion_key(const trn_cell_introduce_encrypted_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
 * onion_key of the trn_cell_introduce_encrypted_t in 'inp', so that
 * it will hold the value 'elt'.
 */
int trn_cell_introduce_encrypted_set_onion_key(trn_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt);
/** Append a new element 'elt' to the dynamic array field onion_key of
 * the trn_cell_introduce_encrypted_t in 'inp'.
 */
int trn_cell_introduce_encrypted_add_onion_key(trn_cell_introduce_encrypted_t *inp, uint8_t elt);
/** Return a pointer to the variable-length array field onion_key of
 * 'inp'.
 */
uint8_t * trn_cell_introduce_encrypted_getarray_onion_key(trn_cell_introduce_encrypted_t *inp);
/** As trn_cell_introduce_encrypted_get_onion_key, but take and return
 * a const pointer
 */
const uint8_t  * trn_cell_introduce_encrypted_getconstarray_onion_key(const trn_cell_introduce_encrypted_t *inp);
/** Change the length of the variable-length array field onion_key of
 * 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
 * return -1 and set the error code on 'inp' on failure.
 */
int trn_cell_introduce_encrypted_setlen_onion_key(trn_cell_introduce_encrypted_t *inp, size_t newlen);
/** Return the value of the nspec field of the
 * trn_cell_introduce_encrypted_t in 'inp'
 */
uint8_t trn_cell_introduce_encrypted_get_nspec(const trn_cell_introduce_encrypted_t *inp);
/** Set the value of the nspec field of the
 * trn_cell_introduce_encrypted_t in 'inp' to 'val'. Return 0 on
 * success; return -1 and set the error code on 'inp' on failure.
 */
int trn_cell_introduce_encrypted_set_nspec(trn_cell_introduce_encrypted_t *inp, uint8_t val);
/** Return the length of the dynamic array holding the nspecs field of
 * the trn_cell_introduce_encrypted_t in 'inp'.
 */
size_t trn_cell_introduce_encrypted_getlen_nspecs(const trn_cell_introduce_encrypted_t *inp);
/** Return the element at position 'idx' of the dynamic array field
 * nspecs of the trn_cell_introduce_encrypted_t in 'inp'.
 */
struct link_specifier_st * trn_cell_introduce_encrypted_get_nspecs(trn_cell_introduce_encrypted_t *inp, size_t idx);
/** As trn_cell_introduce_encrypted_get_nspecs, but take and return a
 * const pointer
 */
 const struct link_specifier_st * trn_cell_introduce_encrypted_getconst_nspecs(const trn_cell_introduce_encrypted_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
 * nspecs of the trn_cell_introduce_encrypted_t in 'inp', so that it
 * will hold the value 'elt'. Free the previous value, if any.
 */
int trn_cell_introduce_encrypted_set_nspecs(trn_cell_introduce_encrypted_t *inp, size_t idx, struct link_specifier_st * elt);
/** As trn_cell_introduce_encrypted_set_nspecs, but does not free the
 * previous value.
 */
int trn_cell_introduce_encrypted_set0_nspecs(trn_cell_introduce_encrypted_t *inp, size_t idx, struct link_specifier_st * elt);
/** Append a new element 'elt' to the dynamic array field nspecs of
 * the trn_cell_introduce_encrypted_t in 'inp'.
 */
int trn_cell_introduce_encrypted_add_nspecs(trn_cell_introduce_encrypted_t *inp, struct link_specifier_st * elt);
/** Return a pointer to the variable-length array field nspecs of
 * 'inp'.
 */
struct link_specifier_st * * trn_cell_introduce_encrypted_getarray_nspecs(trn_cell_introduce_encrypted_t *inp);
/** As trn_cell_introduce_encrypted_get_nspecs, but take and return a
 * const pointer
 */
const struct link_specifier_st *  const  * trn_cell_introduce_encrypted_getconstarray_nspecs(const trn_cell_introduce_encrypted_t *inp);
/** Change the length of the variable-length array field nspecs of
 * 'inp' to 'newlen'.Fill extra elements with NULL; free removed
 * elements. Return 0 on success; return -1 and set the error code on
 * 'inp' on failure.
 */
int trn_cell_introduce_encrypted_setlen_nspecs(trn_cell_introduce_encrypted_t *inp, size_t newlen);
/** Return the length of the dynamic array holding the pad field of
 * the trn_cell_introduce_encrypted_t in 'inp'.
 */
size_t trn_cell_introduce_encrypted_getlen_pad(const trn_cell_introduce_encrypted_t *inp);
/** Return the element at position 'idx' of the dynamic array field
 * pad of the trn_cell_introduce_encrypted_t in 'inp'.
 */
uint8_t trn_cell_introduce_encrypted_get_pad(trn_cell_introduce_encrypted_t *inp, size_t idx);
/** As trn_cell_introduce_encrypted_get_pad, but take and return a
 * const pointer
 */
uint8_t trn_cell_introduce_encrypted_getconst_pad(const trn_cell_introduce_encrypted_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
 * pad of the trn_cell_introduce_encrypted_t in 'inp', so that it will
 * hold the value 'elt'.
 */
int trn_cell_introduce_encrypted_set_pad(trn_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt);
/** Append a new element 'elt' to the dynamic array field pad of the
 * trn_cell_introduce_encrypted_t in 'inp'.
 */
int trn_cell_introduce_encrypted_add_pad(trn_cell_introduce_encrypted_t *inp, uint8_t elt);
/** Return a pointer to the variable-length array field pad of 'inp'.
 */
uint8_t * trn_cell_introduce_encrypted_getarray_pad(trn_cell_introduce_encrypted_t *inp);
/** As trn_cell_introduce_encrypted_get_pad, but take and return a
 * const pointer
 */
const uint8_t  * trn_cell_introduce_encrypted_getconstarray_pad(const trn_cell_introduce_encrypted_t *inp);
/** Change the length of the variable-length array field pad of 'inp'
 * to 'newlen'.Fill extra elements with 0. Return 0 on success; return
 * -1 and set the error code on 'inp' on failure.
 */
int trn_cell_introduce_encrypted_setlen_pad(trn_cell_introduce_encrypted_t *inp, size_t newlen);


#endif