#ifndef TRUNNEL_CELL_ESTABLISH_INTRO_H
#define TRUNNEL_CELL_ESTABLISH_INTRO_H
#include <stdint.h>
#include "trunnel.h"
struct trn_cell_extension_st;
#define TRUNNEL_SHA3_256_LEN 32
#define TRUNNEL_CELL_EXTENSION_TYPE_DOS 1
#define TRUNNEL_DOS_PARAM_TYPE_INTRO2_RATE_PER_SEC 1
#define TRUNNEL_DOS_PARAM_TYPE_INTRO2_BURST_PER_SEC 2
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_EXTENSION_DOS_PARAM)
struct trn_cell_extension_dos_param_st {
uint8_t type;
uint64_t value;
uint8_t trunnel_error_code_;
};
#endif
typedef struct trn_cell_extension_dos_param_st trn_cell_extension_dos_param_t;
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_ESTABLISH_INTRO)
struct trn_cell_establish_intro_st {
const uint8_t *start_cell;
uint8_t auth_key_type;
uint16_t auth_key_len;
TRUNNEL_DYNARRAY_HEAD(, uint8_t) auth_key;
struct trn_cell_extension_st *extensions;
const uint8_t *end_mac_fields;
uint8_t handshake_mac[TRUNNEL_SHA3_256_LEN];
const uint8_t *end_sig_fields;
uint16_t sig_len;
TRUNNEL_DYNARRAY_HEAD(, uint8_t) sig;
uint8_t trunnel_error_code_;
};
#endif
typedef struct trn_cell_establish_intro_st trn_cell_establish_intro_t;
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_EXTENSION_DOS)
struct trn_cell_extension_dos_st {
uint8_t n_params;
TRUNNEL_DYNARRAY_HEAD(, struct trn_cell_extension_dos_param_st *) params;
uint8_t trunnel_error_code_;
};
#endif
typedef struct trn_cell_extension_dos_st trn_cell_extension_dos_t;
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_INTRO_ESTABLISHED)
struct trn_cell_intro_established_st {
struct trn_cell_extension_st *extensions;
uint8_t trunnel_error_code_;
};
#endif
typedef struct trn_cell_intro_established_st trn_cell_intro_established_t;
trn_cell_extension_dos_param_t *trn_cell_extension_dos_param_new(void);
void trn_cell_extension_dos_param_free(trn_cell_extension_dos_param_t *victim);
ssize_t trn_cell_extension_dos_param_parse(trn_cell_extension_dos_param_t **output, const uint8_t *input, const size_t len_in);
ssize_t trn_cell_extension_dos_param_encoded_len(const trn_cell_extension_dos_param_t *obj);
ssize_t trn_cell_extension_dos_param_encode(uint8_t *output, size_t avail, const trn_cell_extension_dos_param_t *input);
const char *trn_cell_extension_dos_param_check(const trn_cell_extension_dos_param_t *obj);
int trn_cell_extension_dos_param_clear_errors(trn_cell_extension_dos_param_t *obj);
uint8_t trn_cell_extension_dos_param_get_type(const trn_cell_extension_dos_param_t *inp);
int trn_cell_extension_dos_param_set_type(trn_cell_extension_dos_param_t *inp, uint8_t val);
uint64_t trn_cell_extension_dos_param_get_value(const trn_cell_extension_dos_param_t *inp);
int trn_cell_extension_dos_param_set_value(trn_cell_extension_dos_param_t *inp, uint64_t val);
trn_cell_establish_intro_t *trn_cell_establish_intro_new(void);
void trn_cell_establish_intro_free(trn_cell_establish_intro_t *victim);
ssize_t trn_cell_establish_intro_parse(trn_cell_establish_intro_t **output, const uint8_t *input, const size_t len_in);
ssize_t trn_cell_establish_intro_encoded_len(const trn_cell_establish_intro_t *obj);
ssize_t trn_cell_establish_intro_encode(uint8_t *output, size_t avail, const trn_cell_establish_intro_t *input);
const char *trn_cell_establish_intro_check(const trn_cell_establish_intro_t *obj);
int trn_cell_establish_intro_clear_errors(trn_cell_establish_intro_t *obj);
const uint8_t * trn_cell_establish_intro_get_start_cell(const trn_cell_establish_intro_t *inp);
uint8_t trn_cell_establish_intro_get_auth_key_type(const trn_cell_establish_intro_t *inp);
int trn_cell_establish_intro_set_auth_key_type(trn_cell_establish_intro_t *inp, uint8_t val);
uint16_t trn_cell_establish_intro_get_auth_key_len(const trn_cell_establish_intro_t *inp);
int trn_cell_establish_intro_set_auth_key_len(trn_cell_establish_intro_t *inp, uint16_t val);
size_t trn_cell_establish_intro_getlen_auth_key(const trn_cell_establish_intro_t *inp);
uint8_t trn_cell_establish_intro_get_auth_key(trn_cell_establish_intro_t *inp, size_t idx);
uint8_t trn_cell_establish_intro_getconst_auth_key(const trn_cell_establish_intro_t *inp, size_t idx);
int trn_cell_establish_intro_set_auth_key(trn_cell_establish_intro_t *inp, size_t idx, uint8_t elt);
int trn_cell_establish_intro_add_auth_key(trn_cell_establish_intro_t *inp, uint8_t elt);
uint8_t * trn_cell_establish_intro_getarray_auth_key(trn_cell_establish_intro_t *inp);
const uint8_t * trn_cell_establish_intro_getconstarray_auth_key(const trn_cell_establish_intro_t *inp);
int trn_cell_establish_intro_setlen_auth_key(trn_cell_establish_intro_t *inp, size_t newlen);
struct trn_cell_extension_st * trn_cell_establish_intro_get_extensions(trn_cell_establish_intro_t *inp);
const struct trn_cell_extension_st * trn_cell_establish_intro_getconst_extensions(const trn_cell_establish_intro_t *inp);
int trn_cell_establish_intro_set_extensions(trn_cell_establish_intro_t *inp, struct trn_cell_extension_st *val);
int trn_cell_establish_intro_set0_extensions(trn_cell_establish_intro_t *inp, struct trn_cell_extension_st *val);
const uint8_t * trn_cell_establish_intro_get_end_mac_fields(const trn_cell_establish_intro_t *inp);
size_t trn_cell_establish_intro_getlen_handshake_mac(const trn_cell_establish_intro_t *inp);
uint8_t trn_cell_establish_intro_get_handshake_mac(trn_cell_establish_intro_t *inp, size_t idx);
uint8_t trn_cell_establish_intro_getconst_handshake_mac(const trn_cell_establish_intro_t *inp, size_t idx);
int trn_cell_establish_intro_set_handshake_mac(trn_cell_establish_intro_t *inp, size_t idx, uint8_t elt);
uint8_t * trn_cell_establish_intro_getarray_handshake_mac(trn_cell_establish_intro_t *inp);
const uint8_t * trn_cell_establish_intro_getconstarray_handshake_mac(const trn_cell_establish_intro_t *inp);
const uint8_t * trn_cell_establish_intro_get_end_sig_fields(const trn_cell_establish_intro_t *inp);
uint16_t trn_cell_establish_intro_get_sig_len(const trn_cell_establish_intro_t *inp);
int trn_cell_establish_intro_set_sig_len(trn_cell_establish_intro_t *inp, uint16_t val);
size_t trn_cell_establish_intro_getlen_sig(const trn_cell_establish_intro_t *inp);
uint8_t trn_cell_establish_intro_get_sig(trn_cell_establish_intro_t *inp, size_t idx);
uint8_t trn_cell_establish_intro_getconst_sig(const trn_cell_establish_intro_t *inp, size_t idx);
int trn_cell_establish_intro_set_sig(trn_cell_establish_intro_t *inp, size_t idx, uint8_t elt);
int trn_cell_establish_intro_add_sig(trn_cell_establish_intro_t *inp, uint8_t elt);
uint8_t * trn_cell_establish_intro_getarray_sig(trn_cell_establish_intro_t *inp);
const uint8_t * trn_cell_establish_intro_getconstarray_sig(const trn_cell_establish_intro_t *inp);
int trn_cell_establish_intro_setlen_sig(trn_cell_establish_intro_t *inp, size_t newlen);
trn_cell_extension_dos_t *trn_cell_extension_dos_new(void);
void trn_cell_extension_dos_free(trn_cell_extension_dos_t *victim);
ssize_t trn_cell_extension_dos_parse(trn_cell_extension_dos_t **output, const uint8_t *input, const size_t len_in);
ssize_t trn_cell_extension_dos_encoded_len(const trn_cell_extension_dos_t *obj);
ssize_t trn_cell_extension_dos_encode(uint8_t *output, size_t avail, const trn_cell_extension_dos_t *input);
const char *trn_cell_extension_dos_check(const trn_cell_extension_dos_t *obj);
int trn_cell_extension_dos_clear_errors(trn_cell_extension_dos_t *obj);
uint8_t trn_cell_extension_dos_get_n_params(const trn_cell_extension_dos_t *inp);
int trn_cell_extension_dos_set_n_params(trn_cell_extension_dos_t *inp, uint8_t val);
size_t trn_cell_extension_dos_getlen_params(const trn_cell_extension_dos_t *inp);
struct trn_cell_extension_dos_param_st * trn_cell_extension_dos_get_params(trn_cell_extension_dos_t *inp, size_t idx);
const struct trn_cell_extension_dos_param_st * trn_cell_extension_dos_getconst_params(const trn_cell_extension_dos_t *inp, size_t idx);
int trn_cell_extension_dos_set_params(trn_cell_extension_dos_t *inp, size_t idx, struct trn_cell_extension_dos_param_st * elt);
int trn_cell_extension_dos_set0_params(trn_cell_extension_dos_t *inp, size_t idx, struct trn_cell_extension_dos_param_st * elt);
int trn_cell_extension_dos_add_params(trn_cell_extension_dos_t *inp, struct trn_cell_extension_dos_param_st * elt);
struct trn_cell_extension_dos_param_st * * trn_cell_extension_dos_getarray_params(trn_cell_extension_dos_t *inp);
const struct trn_cell_extension_dos_param_st * const * trn_cell_extension_dos_getconstarray_params(const trn_cell_extension_dos_t *inp);
int trn_cell_extension_dos_setlen_params(trn_cell_extension_dos_t *inp, size_t newlen);
trn_cell_intro_established_t *trn_cell_intro_established_new(void);
void trn_cell_intro_established_free(trn_cell_intro_established_t *victim);
ssize_t trn_cell_intro_established_parse(trn_cell_intro_established_t **output, const uint8_t *input, const size_t len_in);
ssize_t trn_cell_intro_established_encoded_len(const trn_cell_intro_established_t *obj);
ssize_t trn_cell_intro_established_encode(uint8_t *output, size_t avail, const trn_cell_intro_established_t *input);
const char *trn_cell_intro_established_check(const trn_cell_intro_established_t *obj);
int trn_cell_intro_established_clear_errors(trn_cell_intro_established_t *obj);
struct trn_cell_extension_st * trn_cell_intro_established_get_extensions(trn_cell_intro_established_t *inp);
const struct trn_cell_extension_st * trn_cell_intro_established_getconst_extensions(const trn_cell_intro_established_t *inp);
int trn_cell_intro_established_set_extensions(trn_cell_intro_established_t *inp, struct trn_cell_extension_st *val);
int trn_cell_intro_established_set0_extensions(trn_cell_intro_established_t *inp, struct trn_cell_extension_st *val);
#endif