tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

cell_rendezvous.h (9103B)


      1 /* cell_rendezvous.h -- generated by Trunnel v1.5.3.
      2 * https://gitweb.torproject.org/trunnel.git
      3 * You probably shouldn't edit this file.
      4 */
      5 #ifndef TRUNNEL_CELL_RENDEZVOUS_H
      6 #define TRUNNEL_CELL_RENDEZVOUS_H
      7 
      8 #include <stdint.h>
      9 #include "trunnel.h"
     10 
     11 #define TRUNNEL_REND_COOKIE_LEN 20
     12 #define TRUNNEL_HANDSHAKE_INFO_LEN 64
     13 #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_RENDEZVOUS1)
     14 struct trn_cell_rendezvous1_st {
     15  uint8_t rendezvous_cookie[TRUNNEL_REND_COOKIE_LEN];
     16  TRUNNEL_DYNARRAY_HEAD(, uint8_t) handshake_info;
     17  uint8_t trunnel_error_code_;
     18 };
     19 #endif
     20 typedef struct trn_cell_rendezvous1_st trn_cell_rendezvous1_t;
     21 #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_RENDEZVOUS2)
     22 struct trn_cell_rendezvous2_st {
     23  uint8_t handshake_info[TRUNNEL_HANDSHAKE_INFO_LEN];
     24  uint8_t trunnel_error_code_;
     25 };
     26 #endif
     27 typedef struct trn_cell_rendezvous2_st trn_cell_rendezvous2_t;
     28 /** Return a newly allocated trn_cell_rendezvous1 with all elements
     29 * set to zero.
     30 */
     31 trn_cell_rendezvous1_t *trn_cell_rendezvous1_new(void);
     32 /** Release all storage held by the trn_cell_rendezvous1 in 'victim'.
     33 * (Do nothing if 'victim' is NULL.)
     34 */
     35 void trn_cell_rendezvous1_free(trn_cell_rendezvous1_t *victim);
     36 /** Try to parse a trn_cell_rendezvous1 from the buffer in 'input',
     37 * using up to 'len_in' bytes from the input buffer. On success,
     38 * return the number of bytes consumed and set *output to the newly
     39 * allocated trn_cell_rendezvous1_t. On failure, return -2 if the
     40 * input appears truncated, and -1 if the input is otherwise invalid.
     41 */
     42 ssize_t trn_cell_rendezvous1_parse(trn_cell_rendezvous1_t **output, const uint8_t *input, const size_t len_in);
     43 /** Return the number of bytes we expect to need to encode the
     44 * trn_cell_rendezvous1 in 'obj'. On failure, return a negative value.
     45 * Note that this value may be an overestimate, and can even be an
     46 * underestimate for certain unencodeable objects.
     47 */
     48 ssize_t trn_cell_rendezvous1_encoded_len(const trn_cell_rendezvous1_t *obj);
     49 /** Try to encode the trn_cell_rendezvous1 from 'input' into the
     50 * buffer at 'output', using up to 'avail' bytes of the output buffer.
     51 * On success, return the number of bytes used. On failure, return -2
     52 * if the buffer was not long enough, and -1 if the input was invalid.
     53 */
     54 ssize_t trn_cell_rendezvous1_encode(uint8_t *output, size_t avail, const trn_cell_rendezvous1_t *input);
     55 /** Check whether the internal state of the trn_cell_rendezvous1 in
     56 * 'obj' is consistent. Return NULL if it is, and a short message if
     57 * it is not.
     58 */
     59 const char *trn_cell_rendezvous1_check(const trn_cell_rendezvous1_t *obj);
     60 /** Clear any errors that were set on the object 'obj' by its setter
     61 * functions. Return true iff errors were cleared.
     62 */
     63 int trn_cell_rendezvous1_clear_errors(trn_cell_rendezvous1_t *obj);
     64 /** Return the (constant) length of the array holding the
     65 * rendezvous_cookie field of the trn_cell_rendezvous1_t in 'inp'.
     66 */
     67 size_t trn_cell_rendezvous1_getlen_rendezvous_cookie(const trn_cell_rendezvous1_t *inp);
     68 /** Return the element at position 'idx' of the fixed array field
     69 * rendezvous_cookie of the trn_cell_rendezvous1_t in 'inp'.
     70 */
     71 uint8_t trn_cell_rendezvous1_get_rendezvous_cookie(trn_cell_rendezvous1_t *inp, size_t idx);
     72 /** As trn_cell_rendezvous1_get_rendezvous_cookie, but take and return
     73 * a const pointer
     74 */
     75 uint8_t trn_cell_rendezvous1_getconst_rendezvous_cookie(const trn_cell_rendezvous1_t *inp, size_t idx);
     76 /** Change the element at position 'idx' of the fixed array field
     77 * rendezvous_cookie of the trn_cell_rendezvous1_t in 'inp', so that
     78 * it will hold the value 'elt'.
     79 */
     80 int trn_cell_rendezvous1_set_rendezvous_cookie(trn_cell_rendezvous1_t *inp, size_t idx, uint8_t elt);
     81 /** Return a pointer to the TRUNNEL_REND_COOKIE_LEN-element array
     82 * field rendezvous_cookie of 'inp'.
     83 */
     84 uint8_t * trn_cell_rendezvous1_getarray_rendezvous_cookie(trn_cell_rendezvous1_t *inp);
     85 /** As trn_cell_rendezvous1_get_rendezvous_cookie, but take and return
     86 * a const pointer
     87 */
     88 const uint8_t  * trn_cell_rendezvous1_getconstarray_rendezvous_cookie(const trn_cell_rendezvous1_t *inp);
     89 /** Return the length of the dynamic array holding the handshake_info
     90 * field of the trn_cell_rendezvous1_t in 'inp'.
     91 */
     92 size_t trn_cell_rendezvous1_getlen_handshake_info(const trn_cell_rendezvous1_t *inp);
     93 /** Return the element at position 'idx' of the dynamic array field
     94 * handshake_info of the trn_cell_rendezvous1_t in 'inp'.
     95 */
     96 uint8_t trn_cell_rendezvous1_get_handshake_info(trn_cell_rendezvous1_t *inp, size_t idx);
     97 /** As trn_cell_rendezvous1_get_handshake_info, but take and return a
     98 * const pointer
     99 */
    100 uint8_t trn_cell_rendezvous1_getconst_handshake_info(const trn_cell_rendezvous1_t *inp, size_t idx);
    101 /** Change the element at position 'idx' of the dynamic array field
    102 * handshake_info of the trn_cell_rendezvous1_t in 'inp', so that it
    103 * will hold the value 'elt'.
    104 */
    105 int trn_cell_rendezvous1_set_handshake_info(trn_cell_rendezvous1_t *inp, size_t idx, uint8_t elt);
    106 /** Append a new element 'elt' to the dynamic array field
    107 * handshake_info of the trn_cell_rendezvous1_t in 'inp'.
    108 */
    109 int trn_cell_rendezvous1_add_handshake_info(trn_cell_rendezvous1_t *inp, uint8_t elt);
    110 /** Return a pointer to the variable-length array field handshake_info
    111 * of 'inp'.
    112 */
    113 uint8_t * trn_cell_rendezvous1_getarray_handshake_info(trn_cell_rendezvous1_t *inp);
    114 /** As trn_cell_rendezvous1_get_handshake_info, but take and return a
    115 * const pointer
    116 */
    117 const uint8_t  * trn_cell_rendezvous1_getconstarray_handshake_info(const trn_cell_rendezvous1_t *inp);
    118 /** Change the length of the variable-length array field
    119 * handshake_info of 'inp' to 'newlen'.Fill extra elements with 0.
    120 * Return 0 on success; return -1 and set the error code on 'inp' on
    121 * failure.
    122 */
    123 int trn_cell_rendezvous1_setlen_handshake_info(trn_cell_rendezvous1_t *inp, size_t newlen);
    124 /** Return a newly allocated trn_cell_rendezvous2 with all elements
    125 * set to zero.
    126 */
    127 trn_cell_rendezvous2_t *trn_cell_rendezvous2_new(void);
    128 /** Release all storage held by the trn_cell_rendezvous2 in 'victim'.
    129 * (Do nothing if 'victim' is NULL.)
    130 */
    131 void trn_cell_rendezvous2_free(trn_cell_rendezvous2_t *victim);
    132 /** Try to parse a trn_cell_rendezvous2 from the buffer in 'input',
    133 * using up to 'len_in' bytes from the input buffer. On success,
    134 * return the number of bytes consumed and set *output to the newly
    135 * allocated trn_cell_rendezvous2_t. On failure, return -2 if the
    136 * input appears truncated, and -1 if the input is otherwise invalid.
    137 */
    138 ssize_t trn_cell_rendezvous2_parse(trn_cell_rendezvous2_t **output, const uint8_t *input, const size_t len_in);
    139 /** Return the number of bytes we expect to need to encode the
    140 * trn_cell_rendezvous2 in 'obj'. On failure, return a negative value.
    141 * Note that this value may be an overestimate, and can even be an
    142 * underestimate for certain unencodeable objects.
    143 */
    144 ssize_t trn_cell_rendezvous2_encoded_len(const trn_cell_rendezvous2_t *obj);
    145 /** Try to encode the trn_cell_rendezvous2 from 'input' into the
    146 * buffer at 'output', using up to 'avail' bytes of the output buffer.
    147 * On success, return the number of bytes used. On failure, return -2
    148 * if the buffer was not long enough, and -1 if the input was invalid.
    149 */
    150 ssize_t trn_cell_rendezvous2_encode(uint8_t *output, size_t avail, const trn_cell_rendezvous2_t *input);
    151 /** Check whether the internal state of the trn_cell_rendezvous2 in
    152 * 'obj' is consistent. Return NULL if it is, and a short message if
    153 * it is not.
    154 */
    155 const char *trn_cell_rendezvous2_check(const trn_cell_rendezvous2_t *obj);
    156 /** Clear any errors that were set on the object 'obj' by its setter
    157 * functions. Return true iff errors were cleared.
    158 */
    159 int trn_cell_rendezvous2_clear_errors(trn_cell_rendezvous2_t *obj);
    160 /** Return the (constant) length of the array holding the
    161 * handshake_info field of the trn_cell_rendezvous2_t in 'inp'.
    162 */
    163 size_t trn_cell_rendezvous2_getlen_handshake_info(const trn_cell_rendezvous2_t *inp);
    164 /** Return the element at position 'idx' of the fixed array field
    165 * handshake_info of the trn_cell_rendezvous2_t in 'inp'.
    166 */
    167 uint8_t trn_cell_rendezvous2_get_handshake_info(trn_cell_rendezvous2_t *inp, size_t idx);
    168 /** As trn_cell_rendezvous2_get_handshake_info, but take and return a
    169 * const pointer
    170 */
    171 uint8_t trn_cell_rendezvous2_getconst_handshake_info(const trn_cell_rendezvous2_t *inp, size_t idx);
    172 /** Change the element at position 'idx' of the fixed array field
    173 * handshake_info of the trn_cell_rendezvous2_t in 'inp', so that it
    174 * will hold the value 'elt'.
    175 */
    176 int trn_cell_rendezvous2_set_handshake_info(trn_cell_rendezvous2_t *inp, size_t idx, uint8_t elt);
    177 /** Return a pointer to the TRUNNEL_HANDSHAKE_INFO_LEN-element array
    178 * field handshake_info of 'inp'.
    179 */
    180 uint8_t * trn_cell_rendezvous2_getarray_handshake_info(trn_cell_rendezvous2_t *inp);
    181 /** As trn_cell_rendezvous2_get_handshake_info, but take and return a
    182 * const pointer
    183 */
    184 const uint8_t  * trn_cell_rendezvous2_getconstarray_handshake_info(const trn_cell_rendezvous2_t *inp);
    185 
    186 
    187 #endif