/* cell_establish_intro.c -- generated by Trunnel v1.5.3.
* https://gitweb.torproject.org/trunnel.git
* You probably shouldn't edit this file.
*/
#include <stdlib.h>
#include "trunnel-impl.h"
#include "cell_establish_intro.h"
#define TRUNNEL_SET_ERROR_CODE(obj) \
do { \
(obj)->trunnel_error_code_ = 1; \
} while (0)
#if defined(__COVERITY__) || defined(__clang_analyzer__)
/* If we're running a static analysis tool, we don't want it to complain
* that some of our remaining-bytes checks are dead-code. */
int cellestablishintro_deadcode_dummy__ = 0;
#define OR_DEADCODE_DUMMY || cellestablishintro_deadcode_dummy__
#else
#define OR_DEADCODE_DUMMY
#endif
#define CHECK_REMAINING(nbytes, label) \
do { \
if (remaining < (nbytes) OR_DEADCODE_DUMMY) { \
goto label; \
} \
} while (0)
typedef struct trn_cell_extension_st trn_cell_extension_t;
trn_cell_extension_t *trn_cell_extension_new(void);
void trn_cell_extension_free(trn_cell_extension_t *victim);
ssize_t trn_cell_extension_parse(trn_cell_extension_t **output, const uint8_t *input, const size_t len_in);
ssize_t trn_cell_extension_encoded_len(const trn_cell_extension_t *obj);
ssize_t trn_cell_extension_encode(uint8_t *output, size_t avail, const trn_cell_extension_t *input);
const char *trn_cell_extension_check(const trn_cell_extension_t *obj);
int trn_cell_extension_clear_errors(trn_cell_extension_t *obj);
trn_cell_extension_dos_param_t *
trn_cell_extension_dos_param_new(void)
{
trn_cell_extension_dos_param_t *val = trunnel_calloc(1, sizeof(trn_cell_extension_dos_param_t));
if (NULL == val)
return NULL;
return val;
}
/** Release all storage held inside 'obj', but do not free 'obj'.
*/
static void
trn_cell_extension_dos_param_clear(trn_cell_extension_dos_param_t *obj)
{
(void) obj;
}
void
trn_cell_extension_dos_param_free(trn_cell_extension_dos_param_t *obj)
{
if (obj == NULL)
return;
trn_cell_extension_dos_param_clear(obj);
trunnel_memwipe(obj, sizeof(trn_cell_extension_dos_param_t));
trunnel_free_(obj);
}
uint8_t
trn_cell_extension_dos_param_get_type(const trn_cell_extension_dos_param_t *inp)
{
return inp->type;
}
int
trn_cell_extension_dos_param_set_type(trn_cell_extension_dos_param_t *inp, uint8_t val)
{
inp->type = val;
return 0;
}
uint64_t
trn_cell_extension_dos_param_get_value(const trn_cell_extension_dos_param_t *inp)
{
return inp->value;
}
int
trn_cell_extension_dos_param_set_value(trn_cell_extension_dos_param_t *inp, uint64_t val)
{
inp->value = val;
return 0;
}
const char *
trn_cell_extension_dos_param_check(const trn_cell_extension_dos_param_t *obj)
{
if (obj == NULL)
return "Object was NULL";
if (obj->trunnel_error_code_)
return "A set function failed on this object";
return NULL;
}
ssize_t
trn_cell_extension_dos_param_encoded_len(const trn_cell_extension_dos_param_t