tor

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

socks5.h (47731B)


      1 /* socks5.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_SOCKS5_H
      6 #define TRUNNEL_SOCKS5_H
      7 
      8 #include <stdint.h>
      9 #include "trunnel.h"
     10 
     11 #define CMD_CONNECT 1
     12 #define CMD_BIND 2
     13 #define CMD_UDP_ASSOCIATE 3
     14 #define CMD_RESOLVE 240
     15 #define CMD_RESOLVE_PTR 241
     16 #define ATYPE_IPV4 1
     17 #define ATYPE_IPV6 4
     18 #define ATYPE_DOMAINNAME 3
     19 #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_DOMAINNAME)
     20 struct domainname_st {
     21  uint8_t len;
     22  trunnel_string_t name;
     23  uint8_t trunnel_error_code_;
     24 };
     25 #endif
     26 typedef struct domainname_st domainname_t;
     27 #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_SOCKS4_CLIENT_REQUEST)
     28 struct socks4_client_request_st {
     29  uint8_t version;
     30  uint8_t command;
     31  uint16_t port;
     32  uint32_t addr;
     33  char *username;
     34  char *socks4a_addr_hostname;
     35  uint8_t trunnel_error_code_;
     36 };
     37 #endif
     38 typedef struct socks4_client_request_st socks4_client_request_t;
     39 #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_SOCKS4_SERVER_REPLY)
     40 struct socks4_server_reply_st {
     41  uint8_t version;
     42  uint8_t status;
     43  uint16_t port;
     44  uint32_t addr;
     45  uint8_t trunnel_error_code_;
     46 };
     47 #endif
     48 typedef struct socks4_server_reply_st socks4_server_reply_t;
     49 #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_SOCKS5_CLIENT_USERPASS_AUTH)
     50 struct socks5_client_userpass_auth_st {
     51  uint8_t version;
     52  uint8_t username_len;
     53  trunnel_string_t username;
     54  uint8_t passwd_len;
     55  trunnel_string_t passwd;
     56  uint8_t trunnel_error_code_;
     57 };
     58 #endif
     59 typedef struct socks5_client_userpass_auth_st socks5_client_userpass_auth_t;
     60 #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_SOCKS5_CLIENT_VERSION)
     61 struct socks5_client_version_st {
     62  uint8_t version;
     63  uint8_t n_methods;
     64  TRUNNEL_DYNARRAY_HEAD(, uint8_t) methods;
     65  uint8_t trunnel_error_code_;
     66 };
     67 #endif
     68 typedef struct socks5_client_version_st socks5_client_version_t;
     69 #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_SOCKS5_SERVER_METHOD)
     70 struct socks5_server_method_st {
     71  uint8_t version;
     72  uint8_t method;
     73  uint8_t trunnel_error_code_;
     74 };
     75 #endif
     76 typedef struct socks5_server_method_st socks5_server_method_t;
     77 #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_SOCKS5_SERVER_USERPASS_AUTH)
     78 struct socks5_server_userpass_auth_st {
     79  uint8_t version;
     80  uint8_t status;
     81  uint8_t trunnel_error_code_;
     82 };
     83 #endif
     84 typedef struct socks5_server_userpass_auth_st socks5_server_userpass_auth_t;
     85 #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_SOCKS5_CLIENT_REQUEST)
     86 struct socks5_client_request_st {
     87  uint8_t version;
     88  uint8_t command;
     89  uint8_t reserved;
     90  uint8_t atype;
     91  uint32_t dest_addr_ipv4;
     92  uint8_t dest_addr_ipv6[16];
     93  struct domainname_st *dest_addr_domainname;
     94  uint16_t dest_port;
     95  uint8_t trunnel_error_code_;
     96 };
     97 #endif
     98 typedef struct socks5_client_request_st socks5_client_request_t;
     99 #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_SOCKS5_SERVER_REPLY)
    100 struct socks5_server_reply_st {
    101  uint8_t version;
    102  uint8_t reply;
    103  uint8_t reserved;
    104  uint8_t atype;
    105  uint32_t bind_addr_ipv4;
    106  uint8_t bind_addr_ipv6[16];
    107  struct domainname_st *bind_addr_domainname;
    108  uint16_t bind_port;
    109  uint8_t trunnel_error_code_;
    110 };
    111 #endif
    112 typedef struct socks5_server_reply_st socks5_server_reply_t;
    113 /** Return a newly allocated domainname with all elements set to zero.
    114 */
    115 domainname_t *domainname_new(void);
    116 /** Release all storage held by the domainname in 'victim'. (Do
    117 * nothing if 'victim' is NULL.)
    118 */
    119 void domainname_free(domainname_t *victim);
    120 /** Try to parse a domainname from the buffer in 'input', using up to
    121 * 'len_in' bytes from the input buffer. On success, return the number
    122 * of bytes consumed and set *output to the newly allocated
    123 * domainname_t. On failure, return -2 if the input appears truncated,
    124 * and -1 if the input is otherwise invalid.
    125 */
    126 ssize_t domainname_parse(domainname_t **output, const uint8_t *input, const size_t len_in);
    127 /** Return the number of bytes we expect to need to encode the
    128 * domainname in 'obj'. On failure, return a negative value. Note that
    129 * this value may be an overestimate, and can even be an underestimate
    130 * for certain unencodeable objects.
    131 */
    132 ssize_t domainname_encoded_len(const domainname_t *obj);
    133 /** Try to encode the domainname from 'input' into the buffer at
    134 * 'output', using up to 'avail' bytes of the output buffer. On
    135 * success, return the number of bytes used. On failure, return -2 if
    136 * the buffer was not long enough, and -1 if the input was invalid.
    137 */
    138 ssize_t domainname_encode(uint8_t *output, size_t avail, const domainname_t *input);
    139 /** Check whether the internal state of the domainname in 'obj' is
    140 * consistent. Return NULL if it is, and a short message if it is not.
    141 */
    142 const char *domainname_check(const domainname_t *obj);
    143 /** Clear any errors that were set on the object 'obj' by its setter
    144 * functions. Return true iff errors were cleared.
    145 */
    146 int domainname_clear_errors(domainname_t *obj);
    147 /** Return the value of the len field of the domainname_t in 'inp'
    148 */
    149 uint8_t domainname_get_len(const domainname_t *inp);
    150 /** Set the value of the len field of the domainname_t in 'inp' to
    151 * 'val'. Return 0 on success; return -1 and set the error code on
    152 * 'inp' on failure.
    153 */
    154 int domainname_set_len(domainname_t *inp, uint8_t val);
    155 /** Return the length of the dynamic array holding the name field of
    156 * the domainname_t in 'inp'.
    157 */
    158 size_t domainname_getlen_name(const domainname_t *inp);
    159 /** Return the element at position 'idx' of the dynamic array field
    160 * name of the domainname_t in 'inp'.
    161 */
    162 char domainname_get_name(domainname_t *inp, size_t idx);
    163 /** As domainname_get_name, but take and return a const pointer
    164 */
    165 char domainname_getconst_name(const domainname_t *inp, size_t idx);
    166 /** Change the element at position 'idx' of the dynamic array field
    167 * name of the domainname_t in 'inp', so that it will hold the value
    168 * 'elt'.
    169 */
    170 int domainname_set_name(domainname_t *inp, size_t idx, char elt);
    171 /** Append a new element 'elt' to the dynamic array field name of the
    172 * domainname_t in 'inp'.
    173 */
    174 int domainname_add_name(domainname_t *inp, char elt);
    175 /** Return a pointer to the variable-length array field name of 'inp'.
    176 */
    177 char * domainname_getarray_name(domainname_t *inp);
    178 /** As domainname_get_name, but take and return a const pointer
    179 */
    180 const char  * domainname_getconstarray_name(const domainname_t *inp);
    181 /** Change the length of the variable-length array field name of 'inp'
    182 * to 'newlen'.Fill extra elements with 0. Return 0 on success; return
    183 * -1 and set the error code on 'inp' on failure.
    184 */
    185 int domainname_setlen_name(domainname_t *inp, size_t newlen);
    186 /** Return the value of the name field of a domainname_t as a NUL-
    187 * terminated string.
    188 */
    189 const char * domainname_getstr_name(domainname_t *inp);
    190 /** Set the value of the name field of a domainname_t to a given
    191 * string of length 'len'. Return 0 on success; return -1 and set the
    192 * error code on 'inp' on failure.
    193 */
    194 int domainname_setstr0_name(domainname_t *inp, const char *val, size_t len);
    195 /** Set the value of the name field of a domainname_t to a given NUL-
    196 * terminated string. Return 0 on success; return -1 and set the error
    197 * code on 'inp' on failure.
    198 */
    199 int domainname_setstr_name(domainname_t *inp, const char *val);
    200 /** Return a newly allocated socks4_client_request with all elements
    201 * set to zero.
    202 */
    203 socks4_client_request_t *socks4_client_request_new(void);
    204 /** Release all storage held by the socks4_client_request in 'victim'.
    205 * (Do nothing if 'victim' is NULL.)
    206 */
    207 void socks4_client_request_free(socks4_client_request_t *victim);
    208 /** Try to parse a socks4_client_request from the buffer in 'input',
    209 * using up to 'len_in' bytes from the input buffer. On success,
    210 * return the number of bytes consumed and set *output to the newly
    211 * allocated socks4_client_request_t. On failure, return -2 if the
    212 * input appears truncated, and -1 if the input is otherwise invalid.
    213 */
    214 ssize_t socks4_client_request_parse(socks4_client_request_t **output, const uint8_t *input, const size_t len_in);
    215 /** Return the number of bytes we expect to need to encode the
    216 * socks4_client_request in 'obj'. On failure, return a negative
    217 * value. Note that this value may be an overestimate, and can even be
    218 * an underestimate for certain unencodeable objects.
    219 */
    220 ssize_t socks4_client_request_encoded_len(const socks4_client_request_t *obj);
    221 /** Try to encode the socks4_client_request from 'input' into the
    222 * buffer at 'output', using up to 'avail' bytes of the output buffer.
    223 * On success, return the number of bytes used. On failure, return -2
    224 * if the buffer was not long enough, and -1 if the input was invalid.
    225 */
    226 ssize_t socks4_client_request_encode(uint8_t *output, size_t avail, const socks4_client_request_t *input);
    227 /** Check whether the internal state of the socks4_client_request in
    228 * 'obj' is consistent. Return NULL if it is, and a short message if
    229 * it is not.
    230 */
    231 const char *socks4_client_request_check(const socks4_client_request_t *obj);
    232 /** Clear any errors that were set on the object 'obj' by its setter
    233 * functions. Return true iff errors were cleared.
    234 */
    235 int socks4_client_request_clear_errors(socks4_client_request_t *obj);
    236 /** Return the value of the version field of the
    237 * socks4_client_request_t in 'inp'
    238 */
    239 uint8_t socks4_client_request_get_version(const socks4_client_request_t *inp);
    240 /** Set the value of the version field of the socks4_client_request_t
    241 * in 'inp' to 'val'. Return 0 on success; return -1 and set the error
    242 * code on 'inp' on failure.
    243 */
    244 int socks4_client_request_set_version(socks4_client_request_t *inp, uint8_t val);
    245 /** Return the value of the command field of the
    246 * socks4_client_request_t in 'inp'
    247 */
    248 uint8_t socks4_client_request_get_command(const socks4_client_request_t *inp);
    249 /** Set the value of the command field of the socks4_client_request_t
    250 * in 'inp' to 'val'. Return 0 on success; return -1 and set the error
    251 * code on 'inp' on failure.
    252 */
    253 int socks4_client_request_set_command(socks4_client_request_t *inp, uint8_t val);
    254 /** Return the value of the port field of the socks4_client_request_t
    255 * in 'inp'
    256 */
    257 uint16_t socks4_client_request_get_port(const socks4_client_request_t *inp);
    258 /** Set the value of the port field of the socks4_client_request_t in
    259 * 'inp' to 'val'. Return 0 on success; return -1 and set the error
    260 * code on 'inp' on failure.
    261 */
    262 int socks4_client_request_set_port(socks4_client_request_t *inp, uint16_t val);
    263 /** Return the value of the addr field of the socks4_client_request_t
    264 * in 'inp'
    265 */
    266 uint32_t socks4_client_request_get_addr(const socks4_client_request_t *inp);
    267 /** Set the value of the addr field of the socks4_client_request_t in
    268 * 'inp' to 'val'. Return 0 on success; return -1 and set the error
    269 * code on 'inp' on failure.
    270 */
    271 int socks4_client_request_set_addr(socks4_client_request_t *inp, uint32_t val);
    272 /** Return the value of the username field of the
    273 * socks4_client_request_t in 'inp'
    274 */
    275 const char * socks4_client_request_get_username(const socks4_client_request_t *inp);
    276 /** Set the value of the username field of the socks4_client_request_t
    277 * in 'inp' to 'val'. Free the old value if any. Does not steal the
    278 * reference to 'val'.Return 0 on success; return -1 and set the error
    279 * code on 'inp' on failure.
    280 */
    281 int socks4_client_request_set_username(socks4_client_request_t *inp, const char *val);
    282 /** Return the value of the socks4a_addr_hostname field of the
    283 * socks4_client_request_t in 'inp'
    284 */
    285 const char * socks4_client_request_get_socks4a_addr_hostname(const socks4_client_request_t *inp);
    286 /** Set the value of the socks4a_addr_hostname field of the
    287 * socks4_client_request_t in 'inp' to 'val'. Free the old value if
    288 * any. Does not steal the reference to 'val'.Return 0 on success;
    289 * return -1 and set the error code on 'inp' on failure.
    290 */
    291 int socks4_client_request_set_socks4a_addr_hostname(socks4_client_request_t *inp, const char *val);
    292 /** Return a newly allocated socks4_server_reply with all elements set
    293 * to zero.
    294 */
    295 socks4_server_reply_t *socks4_server_reply_new(void);
    296 /** Release all storage held by the socks4_server_reply in 'victim'.
    297 * (Do nothing if 'victim' is NULL.)
    298 */
    299 void socks4_server_reply_free(socks4_server_reply_t *victim);
    300 /** Try to parse a socks4_server_reply from the buffer in 'input',
    301 * using up to 'len_in' bytes from the input buffer. On success,
    302 * return the number of bytes consumed and set *output to the newly
    303 * allocated socks4_server_reply_t. On failure, return -2 if the input
    304 * appears truncated, and -1 if the input is otherwise invalid.
    305 */
    306 ssize_t socks4_server_reply_parse(socks4_server_reply_t **output, const uint8_t *input, const size_t len_in);
    307 /** Return the number of bytes we expect to need to encode the
    308 * socks4_server_reply in 'obj'. On failure, return a negative value.
    309 * Note that this value may be an overestimate, and can even be an
    310 * underestimate for certain unencodeable objects.
    311 */
    312 ssize_t socks4_server_reply_encoded_len(const socks4_server_reply_t *obj);
    313 /** Try to encode the socks4_server_reply from 'input' into the buffer
    314 * at 'output', using up to 'avail' bytes of the output buffer. On
    315 * success, return the number of bytes used. On failure, return -2 if
    316 * the buffer was not long enough, and -1 if the input was invalid.
    317 */
    318 ssize_t socks4_server_reply_encode(uint8_t *output, size_t avail, const socks4_server_reply_t *input);
    319 /** Check whether the internal state of the socks4_server_reply in
    320 * 'obj' is consistent. Return NULL if it is, and a short message if
    321 * it is not.
    322 */
    323 const char *socks4_server_reply_check(const socks4_server_reply_t *obj);
    324 /** Clear any errors that were set on the object 'obj' by its setter
    325 * functions. Return true iff errors were cleared.
    326 */
    327 int socks4_server_reply_clear_errors(socks4_server_reply_t *obj);
    328 /** Return the value of the version field of the socks4_server_reply_t
    329 * in 'inp'
    330 */
    331 uint8_t socks4_server_reply_get_version(const socks4_server_reply_t *inp);
    332 /** Set the value of the version field of the socks4_server_reply_t in
    333 * 'inp' to 'val'. Return 0 on success; return -1 and set the error
    334 * code on 'inp' on failure.
    335 */
    336 int socks4_server_reply_set_version(socks4_server_reply_t *inp, uint8_t val);
    337 /** Return the value of the status field of the socks4_server_reply_t
    338 * in 'inp'
    339 */
    340 uint8_t socks4_server_reply_get_status(const socks4_server_reply_t *inp);
    341 /** Set the value of the status field of the socks4_server_reply_t in
    342 * 'inp' to 'val'. Return 0 on success; return -1 and set the error
    343 * code on 'inp' on failure.
    344 */
    345 int socks4_server_reply_set_status(socks4_server_reply_t *inp, uint8_t val);
    346 /** Return the value of the port field of the socks4_server_reply_t in
    347 * 'inp'
    348 */
    349 uint16_t socks4_server_reply_get_port(const socks4_server_reply_t *inp);
    350 /** Set the value of the port field of the socks4_server_reply_t in
    351 * 'inp' to 'val'. Return 0 on success; return -1 and set the error
    352 * code on 'inp' on failure.
    353 */
    354 int socks4_server_reply_set_port(socks4_server_reply_t *inp, uint16_t val);
    355 /** Return the value of the addr field of the socks4_server_reply_t in
    356 * 'inp'
    357 */
    358 uint32_t socks4_server_reply_get_addr(const socks4_server_reply_t *inp);
    359 /** Set the value of the addr field of the socks4_server_reply_t in
    360 * 'inp' to 'val'. Return 0 on success; return -1 and set the error
    361 * code on 'inp' on failure.
    362 */
    363 int socks4_server_reply_set_addr(socks4_server_reply_t *inp, uint32_t val);
    364 /** Return a newly allocated socks5_client_userpass_auth with all
    365 * elements set to zero.
    366 */
    367 socks5_client_userpass_auth_t *socks5_client_userpass_auth_new(void);
    368 /** Release all storage held by the socks5_client_userpass_auth in
    369 * 'victim'. (Do nothing if 'victim' is NULL.)
    370 */
    371 void socks5_client_userpass_auth_free(socks5_client_userpass_auth_t *victim);
    372 /** Try to parse a socks5_client_userpass_auth from the buffer in
    373 * 'input', using up to 'len_in' bytes from the input buffer. On
    374 * success, return the number of bytes consumed and set *output to the
    375 * newly allocated socks5_client_userpass_auth_t. On failure, return
    376 * -2 if the input appears truncated, and -1 if the input is otherwise
    377 * invalid.
    378 */
    379 ssize_t socks5_client_userpass_auth_parse(socks5_client_userpass_auth_t **output, const uint8_t *input, const size_t len_in);
    380 /** Return the number of bytes we expect to need to encode the
    381 * socks5_client_userpass_auth in 'obj'. On failure, return a negative
    382 * value. Note that this value may be an overestimate, and can even be
    383 * an underestimate for certain unencodeable objects.
    384 */
    385 ssize_t socks5_client_userpass_auth_encoded_len(const socks5_client_userpass_auth_t *obj);
    386 /** Try to encode the socks5_client_userpass_auth from 'input' into
    387 * the buffer at 'output', using up to 'avail' bytes of the output
    388 * buffer. On success, return the number of bytes used. On failure,
    389 * return -2 if the buffer was not long enough, and -1 if the input
    390 * was invalid.
    391 */
    392 ssize_t socks5_client_userpass_auth_encode(uint8_t *output, size_t avail, const socks5_client_userpass_auth_t *input);
    393 /** Check whether the internal state of the
    394 * socks5_client_userpass_auth in 'obj' is consistent. Return NULL if
    395 * it is, and a short message if it is not.
    396 */
    397 const char *socks5_client_userpass_auth_check(const socks5_client_userpass_auth_t *obj);
    398 /** Clear any errors that were set on the object 'obj' by its setter
    399 * functions. Return true iff errors were cleared.
    400 */
    401 int socks5_client_userpass_auth_clear_errors(socks5_client_userpass_auth_t *obj);
    402 /** Return the value of the version field of the
    403 * socks5_client_userpass_auth_t in 'inp'
    404 */
    405 uint8_t socks5_client_userpass_auth_get_version(const socks5_client_userpass_auth_t *inp);
    406 /** Set the value of the version field of the
    407 * socks5_client_userpass_auth_t in 'inp' to 'val'. Return 0 on
    408 * success; return -1 and set the error code on 'inp' on failure.
    409 */
    410 int socks5_client_userpass_auth_set_version(socks5_client_userpass_auth_t *inp, uint8_t val);
    411 /** Return the value of the username_len field of the
    412 * socks5_client_userpass_auth_t in 'inp'
    413 */
    414 uint8_t socks5_client_userpass_auth_get_username_len(const socks5_client_userpass_auth_t *inp);
    415 /** Set the value of the username_len field of the
    416 * socks5_client_userpass_auth_t in 'inp' to 'val'. Return 0 on
    417 * success; return -1 and set the error code on 'inp' on failure.
    418 */
    419 int socks5_client_userpass_auth_set_username_len(socks5_client_userpass_auth_t *inp, uint8_t val);
    420 /** Return the length of the dynamic array holding the username field
    421 * of the socks5_client_userpass_auth_t in 'inp'.
    422 */
    423 size_t socks5_client_userpass_auth_getlen_username(const socks5_client_userpass_auth_t *inp);
    424 /** Return the element at position 'idx' of the dynamic array field
    425 * username of the socks5_client_userpass_auth_t in 'inp'.
    426 */
    427 char socks5_client_userpass_auth_get_username(socks5_client_userpass_auth_t *inp, size_t idx);
    428 /** As socks5_client_userpass_auth_get_username, but take and return a
    429 * const pointer
    430 */
    431 char socks5_client_userpass_auth_getconst_username(const socks5_client_userpass_auth_t *inp, size_t idx);
    432 /** Change the element at position 'idx' of the dynamic array field
    433 * username of the socks5_client_userpass_auth_t in 'inp', so that it
    434 * will hold the value 'elt'.
    435 */
    436 int socks5_client_userpass_auth_set_username(socks5_client_userpass_auth_t *inp, size_t idx, char elt);
    437 /** Append a new element 'elt' to the dynamic array field username of
    438 * the socks5_client_userpass_auth_t in 'inp'.
    439 */
    440 int socks5_client_userpass_auth_add_username(socks5_client_userpass_auth_t *inp, char elt);
    441 /** Return a pointer to the variable-length array field username of
    442 * 'inp'.
    443 */
    444 char * socks5_client_userpass_auth_getarray_username(socks5_client_userpass_auth_t *inp);
    445 /** As socks5_client_userpass_auth_get_username, but take and return a
    446 * const pointer
    447 */
    448 const char  * socks5_client_userpass_auth_getconstarray_username(const socks5_client_userpass_auth_t *inp);
    449 /** Change the length of the variable-length array field username of
    450 * 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
    451 * return -1 and set the error code on 'inp' on failure.
    452 */
    453 int socks5_client_userpass_auth_setlen_username(socks5_client_userpass_auth_t *inp, size_t newlen);
    454 /** Return the value of the username field of a
    455 * socks5_client_userpass_auth_t as a NUL-terminated string.
    456 */
    457 const char * socks5_client_userpass_auth_getstr_username(socks5_client_userpass_auth_t *inp);
    458 /** Set the value of the username field of a
    459 * socks5_client_userpass_auth_t to a given string of length 'len'.
    460 * Return 0 on success; return -1 and set the error code on 'inp' on
    461 * failure.
    462 */
    463 int socks5_client_userpass_auth_setstr0_username(socks5_client_userpass_auth_t *inp, const char *val, size_t len);
    464 /** Set the value of the username field of a
    465 * socks5_client_userpass_auth_t to a given NUL-terminated string.
    466 * Return 0 on success; return -1 and set the error code on 'inp' on
    467 * failure.
    468 */
    469 int socks5_client_userpass_auth_setstr_username(socks5_client_userpass_auth_t *inp, const char *val);
    470 /** Return the value of the passwd_len field of the
    471 * socks5_client_userpass_auth_t in 'inp'
    472 */
    473 uint8_t socks5_client_userpass_auth_get_passwd_len(const socks5_client_userpass_auth_t *inp);
    474 /** Set the value of the passwd_len field of the
    475 * socks5_client_userpass_auth_t in 'inp' to 'val'. Return 0 on
    476 * success; return -1 and set the error code on 'inp' on failure.
    477 */
    478 int socks5_client_userpass_auth_set_passwd_len(socks5_client_userpass_auth_t *inp, uint8_t val);
    479 /** Return the length of the dynamic array holding the passwd field of
    480 * the socks5_client_userpass_auth_t in 'inp'.
    481 */
    482 size_t socks5_client_userpass_auth_getlen_passwd(const socks5_client_userpass_auth_t *inp);
    483 /** Return the element at position 'idx' of the dynamic array field
    484 * passwd of the socks5_client_userpass_auth_t in 'inp'.
    485 */
    486 char socks5_client_userpass_auth_get_passwd(socks5_client_userpass_auth_t *inp, size_t idx);
    487 /** As socks5_client_userpass_auth_get_passwd, but take and return a
    488 * const pointer
    489 */
    490 char socks5_client_userpass_auth_getconst_passwd(const socks5_client_userpass_auth_t *inp, size_t idx);
    491 /** Change the element at position 'idx' of the dynamic array field
    492 * passwd of the socks5_client_userpass_auth_t in 'inp', so that it
    493 * will hold the value 'elt'.
    494 */
    495 int socks5_client_userpass_auth_set_passwd(socks5_client_userpass_auth_t *inp, size_t idx, char elt);
    496 /** Append a new element 'elt' to the dynamic array field passwd of
    497 * the socks5_client_userpass_auth_t in 'inp'.
    498 */
    499 int socks5_client_userpass_auth_add_passwd(socks5_client_userpass_auth_t *inp, char elt);
    500 /** Return a pointer to the variable-length array field passwd of
    501 * 'inp'.
    502 */
    503 char * socks5_client_userpass_auth_getarray_passwd(socks5_client_userpass_auth_t *inp);
    504 /** As socks5_client_userpass_auth_get_passwd, but take and return a
    505 * const pointer
    506 */
    507 const char  * socks5_client_userpass_auth_getconstarray_passwd(const socks5_client_userpass_auth_t *inp);
    508 /** Change the length of the variable-length array field passwd of
    509 * 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
    510 * return -1 and set the error code on 'inp' on failure.
    511 */
    512 int socks5_client_userpass_auth_setlen_passwd(socks5_client_userpass_auth_t *inp, size_t newlen);
    513 /** Return the value of the passwd field of a
    514 * socks5_client_userpass_auth_t as a NUL-terminated string.
    515 */
    516 const char * socks5_client_userpass_auth_getstr_passwd(socks5_client_userpass_auth_t *inp);
    517 /** Set the value of the passwd field of a
    518 * socks5_client_userpass_auth_t to a given string of length 'len'.
    519 * Return 0 on success; return -1 and set the error code on 'inp' on
    520 * failure.
    521 */
    522 int socks5_client_userpass_auth_setstr0_passwd(socks5_client_userpass_auth_t *inp, const char *val, size_t len);
    523 /** Set the value of the passwd field of a
    524 * socks5_client_userpass_auth_t to a given NUL-terminated string.
    525 * Return 0 on success; return -1 and set the error code on 'inp' on
    526 * failure.
    527 */
    528 int socks5_client_userpass_auth_setstr_passwd(socks5_client_userpass_auth_t *inp, const char *val);
    529 /** Return a newly allocated socks5_client_version with all elements
    530 * set to zero.
    531 */
    532 socks5_client_version_t *socks5_client_version_new(void);
    533 /** Release all storage held by the socks5_client_version in 'victim'.
    534 * (Do nothing if 'victim' is NULL.)
    535 */
    536 void socks5_client_version_free(socks5_client_version_t *victim);
    537 /** Try to parse a socks5_client_version from the buffer in 'input',
    538 * using up to 'len_in' bytes from the input buffer. On success,
    539 * return the number of bytes consumed and set *output to the newly
    540 * allocated socks5_client_version_t. On failure, return -2 if the
    541 * input appears truncated, and -1 if the input is otherwise invalid.
    542 */
    543 ssize_t socks5_client_version_parse(socks5_client_version_t **output, const uint8_t *input, const size_t len_in);
    544 /** Return the number of bytes we expect to need to encode the
    545 * socks5_client_version in 'obj'. On failure, return a negative
    546 * value. Note that this value may be an overestimate, and can even be
    547 * an underestimate for certain unencodeable objects.
    548 */
    549 ssize_t socks5_client_version_encoded_len(const socks5_client_version_t *obj);
    550 /** Try to encode the socks5_client_version from 'input' into the
    551 * buffer at 'output', using up to 'avail' bytes of the output buffer.
    552 * On success, return the number of bytes used. On failure, return -2
    553 * if the buffer was not long enough, and -1 if the input was invalid.
    554 */
    555 ssize_t socks5_client_version_encode(uint8_t *output, size_t avail, const socks5_client_version_t *input);
    556 /** Check whether the internal state of the socks5_client_version in
    557 * 'obj' is consistent. Return NULL if it is, and a short message if
    558 * it is not.
    559 */
    560 const char *socks5_client_version_check(const socks5_client_version_t *obj);
    561 /** Clear any errors that were set on the object 'obj' by its setter
    562 * functions. Return true iff errors were cleared.
    563 */
    564 int socks5_client_version_clear_errors(socks5_client_version_t *obj);
    565 /** Return the value of the version field of the
    566 * socks5_client_version_t in 'inp'
    567 */
    568 uint8_t socks5_client_version_get_version(const socks5_client_version_t *inp);
    569 /** Set the value of the version field of the socks5_client_version_t
    570 * in 'inp' to 'val'. Return 0 on success; return -1 and set the error
    571 * code on 'inp' on failure.
    572 */
    573 int socks5_client_version_set_version(socks5_client_version_t *inp, uint8_t val);
    574 /** Return the value of the n_methods field of the
    575 * socks5_client_version_t in 'inp'
    576 */
    577 uint8_t socks5_client_version_get_n_methods(const socks5_client_version_t *inp);
    578 /** Set the value of the n_methods field of the
    579 * socks5_client_version_t in 'inp' to 'val'. Return 0 on success;
    580 * return -1 and set the error code on 'inp' on failure.
    581 */
    582 int socks5_client_version_set_n_methods(socks5_client_version_t *inp, uint8_t val);
    583 /** Return the length of the dynamic array holding the methods field
    584 * of the socks5_client_version_t in 'inp'.
    585 */
    586 size_t socks5_client_version_getlen_methods(const socks5_client_version_t *inp);
    587 /** Return the element at position 'idx' of the dynamic array field
    588 * methods of the socks5_client_version_t in 'inp'.
    589 */
    590 uint8_t socks5_client_version_get_methods(socks5_client_version_t *inp, size_t idx);
    591 /** As socks5_client_version_get_methods, but take and return a const
    592 * pointer
    593 */
    594 uint8_t socks5_client_version_getconst_methods(const socks5_client_version_t *inp, size_t idx);
    595 /** Change the element at position 'idx' of the dynamic array field
    596 * methods of the socks5_client_version_t in 'inp', so that it will
    597 * hold the value 'elt'.
    598 */
    599 int socks5_client_version_set_methods(socks5_client_version_t *inp, size_t idx, uint8_t elt);
    600 /** Append a new element 'elt' to the dynamic array field methods of
    601 * the socks5_client_version_t in 'inp'.
    602 */
    603 int socks5_client_version_add_methods(socks5_client_version_t *inp, uint8_t elt);
    604 /** Return a pointer to the variable-length array field methods of
    605 * 'inp'.
    606 */
    607 uint8_t * socks5_client_version_getarray_methods(socks5_client_version_t *inp);
    608 /** As socks5_client_version_get_methods, but take and return a const
    609 * pointer
    610 */
    611 const uint8_t  * socks5_client_version_getconstarray_methods(const socks5_client_version_t *inp);
    612 /** Change the length of the variable-length array field methods of
    613 * 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
    614 * return -1 and set the error code on 'inp' on failure.
    615 */
    616 int socks5_client_version_setlen_methods(socks5_client_version_t *inp, size_t newlen);
    617 /** Return a newly allocated socks5_server_method with all elements
    618 * set to zero.
    619 */
    620 socks5_server_method_t *socks5_server_method_new(void);
    621 /** Release all storage held by the socks5_server_method in 'victim'.
    622 * (Do nothing if 'victim' is NULL.)
    623 */
    624 void socks5_server_method_free(socks5_server_method_t *victim);
    625 /** Try to parse a socks5_server_method from the buffer in 'input',
    626 * using up to 'len_in' bytes from the input buffer. On success,
    627 * return the number of bytes consumed and set *output to the newly
    628 * allocated socks5_server_method_t. On failure, return -2 if the
    629 * input appears truncated, and -1 if the input is otherwise invalid.
    630 */
    631 ssize_t socks5_server_method_parse(socks5_server_method_t **output, const uint8_t *input, const size_t len_in);
    632 /** Return the number of bytes we expect to need to encode the
    633 * socks5_server_method in 'obj'. On failure, return a negative value.
    634 * Note that this value may be an overestimate, and can even be an
    635 * underestimate for certain unencodeable objects.
    636 */
    637 ssize_t socks5_server_method_encoded_len(const socks5_server_method_t *obj);
    638 /** Try to encode the socks5_server_method from 'input' into the
    639 * buffer at 'output', using up to 'avail' bytes of the output buffer.
    640 * On success, return the number of bytes used. On failure, return -2
    641 * if the buffer was not long enough, and -1 if the input was invalid.
    642 */
    643 ssize_t socks5_server_method_encode(uint8_t *output, size_t avail, const socks5_server_method_t *input);
    644 /** Check whether the internal state of the socks5_server_method in
    645 * 'obj' is consistent. Return NULL if it is, and a short message if
    646 * it is not.
    647 */
    648 const char *socks5_server_method_check(const socks5_server_method_t *obj);
    649 /** Clear any errors that were set on the object 'obj' by its setter
    650 * functions. Return true iff errors were cleared.
    651 */
    652 int socks5_server_method_clear_errors(socks5_server_method_t *obj);
    653 /** Return the value of the version field of the
    654 * socks5_server_method_t in 'inp'
    655 */
    656 uint8_t socks5_server_method_get_version(const socks5_server_method_t *inp);
    657 /** Set the value of the version field of the socks5_server_method_t
    658 * in 'inp' to 'val'. Return 0 on success; return -1 and set the error
    659 * code on 'inp' on failure.
    660 */
    661 int socks5_server_method_set_version(socks5_server_method_t *inp, uint8_t val);
    662 /** Return the value of the method field of the socks5_server_method_t
    663 * in 'inp'
    664 */
    665 uint8_t socks5_server_method_get_method(const socks5_server_method_t *inp);
    666 /** Set the value of the method field of the socks5_server_method_t in
    667 * 'inp' to 'val'. Return 0 on success; return -1 and set the error
    668 * code on 'inp' on failure.
    669 */
    670 int socks5_server_method_set_method(socks5_server_method_t *inp, uint8_t val);
    671 /** Return a newly allocated socks5_server_userpass_auth with all
    672 * elements set to zero.
    673 */
    674 socks5_server_userpass_auth_t *socks5_server_userpass_auth_new(void);
    675 /** Release all storage held by the socks5_server_userpass_auth in
    676 * 'victim'. (Do nothing if 'victim' is NULL.)
    677 */
    678 void socks5_server_userpass_auth_free(socks5_server_userpass_auth_t *victim);
    679 /** Try to parse a socks5_server_userpass_auth from the buffer in
    680 * 'input', using up to 'len_in' bytes from the input buffer. On
    681 * success, return the number of bytes consumed and set *output to the
    682 * newly allocated socks5_server_userpass_auth_t. On failure, return
    683 * -2 if the input appears truncated, and -1 if the input is otherwise
    684 * invalid.
    685 */
    686 ssize_t socks5_server_userpass_auth_parse(socks5_server_userpass_auth_t **output, const uint8_t *input, const size_t len_in);
    687 /** Return the number of bytes we expect to need to encode the
    688 * socks5_server_userpass_auth in 'obj'. On failure, return a negative
    689 * value. Note that this value may be an overestimate, and can even be
    690 * an underestimate for certain unencodeable objects.
    691 */
    692 ssize_t socks5_server_userpass_auth_encoded_len(const socks5_server_userpass_auth_t *obj);
    693 /** Try to encode the socks5_server_userpass_auth from 'input' into
    694 * the buffer at 'output', using up to 'avail' bytes of the output
    695 * buffer. On success, return the number of bytes used. On failure,
    696 * return -2 if the buffer was not long enough, and -1 if the input
    697 * was invalid.
    698 */
    699 ssize_t socks5_server_userpass_auth_encode(uint8_t *output, size_t avail, const socks5_server_userpass_auth_t *input);
    700 /** Check whether the internal state of the
    701 * socks5_server_userpass_auth in 'obj' is consistent. Return NULL if
    702 * it is, and a short message if it is not.
    703 */
    704 const char *socks5_server_userpass_auth_check(const socks5_server_userpass_auth_t *obj);
    705 /** Clear any errors that were set on the object 'obj' by its setter
    706 * functions. Return true iff errors were cleared.
    707 */
    708 int socks5_server_userpass_auth_clear_errors(socks5_server_userpass_auth_t *obj);
    709 /** Return the value of the version field of the
    710 * socks5_server_userpass_auth_t in 'inp'
    711 */
    712 uint8_t socks5_server_userpass_auth_get_version(const socks5_server_userpass_auth_t *inp);
    713 /** Set the value of the version field of the
    714 * socks5_server_userpass_auth_t in 'inp' to 'val'. Return 0 on
    715 * success; return -1 and set the error code on 'inp' on failure.
    716 */
    717 int socks5_server_userpass_auth_set_version(socks5_server_userpass_auth_t *inp, uint8_t val);
    718 /** Return the value of the status field of the
    719 * socks5_server_userpass_auth_t in 'inp'
    720 */
    721 uint8_t socks5_server_userpass_auth_get_status(const socks5_server_userpass_auth_t *inp);
    722 /** Set the value of the status field of the
    723 * socks5_server_userpass_auth_t in 'inp' to 'val'. Return 0 on
    724 * success; return -1 and set the error code on 'inp' on failure.
    725 */
    726 int socks5_server_userpass_auth_set_status(socks5_server_userpass_auth_t *inp, uint8_t val);
    727 /** Return a newly allocated socks5_client_request with all elements
    728 * set to zero.
    729 */
    730 socks5_client_request_t *socks5_client_request_new(void);
    731 /** Release all storage held by the socks5_client_request in 'victim'.
    732 * (Do nothing if 'victim' is NULL.)
    733 */
    734 void socks5_client_request_free(socks5_client_request_t *victim);
    735 /** Try to parse a socks5_client_request from the buffer in 'input',
    736 * using up to 'len_in' bytes from the input buffer. On success,
    737 * return the number of bytes consumed and set *output to the newly
    738 * allocated socks5_client_request_t. On failure, return -2 if the
    739 * input appears truncated, and -1 if the input is otherwise invalid.
    740 */
    741 ssize_t socks5_client_request_parse(socks5_client_request_t **output, const uint8_t *input, const size_t len_in);
    742 /** Return the number of bytes we expect to need to encode the
    743 * socks5_client_request in 'obj'. On failure, return a negative
    744 * value. Note that this value may be an overestimate, and can even be
    745 * an underestimate for certain unencodeable objects.
    746 */
    747 ssize_t socks5_client_request_encoded_len(const socks5_client_request_t *obj);
    748 /** Try to encode the socks5_client_request from 'input' into the
    749 * buffer at 'output', using up to 'avail' bytes of the output buffer.
    750 * On success, return the number of bytes used. On failure, return -2
    751 * if the buffer was not long enough, and -1 if the input was invalid.
    752 */
    753 ssize_t socks5_client_request_encode(uint8_t *output, size_t avail, const socks5_client_request_t *input);
    754 /** Check whether the internal state of the socks5_client_request in
    755 * 'obj' is consistent. Return NULL if it is, and a short message if
    756 * it is not.
    757 */
    758 const char *socks5_client_request_check(const socks5_client_request_t *obj);
    759 /** Clear any errors that were set on the object 'obj' by its setter
    760 * functions. Return true iff errors were cleared.
    761 */
    762 int socks5_client_request_clear_errors(socks5_client_request_t *obj);
    763 /** Return the value of the version field of the
    764 * socks5_client_request_t in 'inp'
    765 */
    766 uint8_t socks5_client_request_get_version(const socks5_client_request_t *inp);
    767 /** Set the value of the version field of the socks5_client_request_t
    768 * in 'inp' to 'val'. Return 0 on success; return -1 and set the error
    769 * code on 'inp' on failure.
    770 */
    771 int socks5_client_request_set_version(socks5_client_request_t *inp, uint8_t val);
    772 /** Return the value of the command field of the
    773 * socks5_client_request_t in 'inp'
    774 */
    775 uint8_t socks5_client_request_get_command(const socks5_client_request_t *inp);
    776 /** Set the value of the command field of the socks5_client_request_t
    777 * in 'inp' to 'val'. Return 0 on success; return -1 and set the error
    778 * code on 'inp' on failure.
    779 */
    780 int socks5_client_request_set_command(socks5_client_request_t *inp, uint8_t val);
    781 /** Return the value of the reserved field of the
    782 * socks5_client_request_t in 'inp'
    783 */
    784 uint8_t socks5_client_request_get_reserved(const socks5_client_request_t *inp);
    785 /** Set the value of the reserved field of the socks5_client_request_t
    786 * in 'inp' to 'val'. Return 0 on success; return -1 and set the error
    787 * code on 'inp' on failure.
    788 */
    789 int socks5_client_request_set_reserved(socks5_client_request_t *inp, uint8_t val);
    790 /** Return the value of the atype field of the socks5_client_request_t
    791 * in 'inp'
    792 */
    793 uint8_t socks5_client_request_get_atype(const socks5_client_request_t *inp);
    794 /** Set the value of the atype field of the socks5_client_request_t in
    795 * 'inp' to 'val'. Return 0 on success; return -1 and set the error
    796 * code on 'inp' on failure.
    797 */
    798 int socks5_client_request_set_atype(socks5_client_request_t *inp, uint8_t val);
    799 /** Return the value of the dest_addr_ipv4 field of the
    800 * socks5_client_request_t in 'inp'
    801 */
    802 uint32_t socks5_client_request_get_dest_addr_ipv4(const socks5_client_request_t *inp);
    803 /** Set the value of the dest_addr_ipv4 field of the
    804 * socks5_client_request_t in 'inp' to 'val'. Return 0 on success;
    805 * return -1 and set the error code on 'inp' on failure.
    806 */
    807 int socks5_client_request_set_dest_addr_ipv4(socks5_client_request_t *inp, uint32_t val);
    808 /** Return the (constant) length of the array holding the
    809 * dest_addr_ipv6 field of the socks5_client_request_t in 'inp'.
    810 */
    811 size_t socks5_client_request_getlen_dest_addr_ipv6(const socks5_client_request_t *inp);
    812 /** Return the element at position 'idx' of the fixed array field
    813 * dest_addr_ipv6 of the socks5_client_request_t in 'inp'.
    814 */
    815 uint8_t socks5_client_request_get_dest_addr_ipv6(socks5_client_request_t *inp, size_t idx);
    816 /** As socks5_client_request_get_dest_addr_ipv6, but take and return a
    817 * const pointer
    818 */
    819 uint8_t socks5_client_request_getconst_dest_addr_ipv6(const socks5_client_request_t *inp, size_t idx);
    820 /** Change the element at position 'idx' of the fixed array field
    821 * dest_addr_ipv6 of the socks5_client_request_t in 'inp', so that it
    822 * will hold the value 'elt'.
    823 */
    824 int socks5_client_request_set_dest_addr_ipv6(socks5_client_request_t *inp, size_t idx, uint8_t elt);
    825 /** Return a pointer to the 16-element array field dest_addr_ipv6 of
    826 * 'inp'.
    827 */
    828 uint8_t * socks5_client_request_getarray_dest_addr_ipv6(socks5_client_request_t *inp);
    829 /** As socks5_client_request_get_dest_addr_ipv6, but take and return a
    830 * const pointer
    831 */
    832 const uint8_t  * socks5_client_request_getconstarray_dest_addr_ipv6(const socks5_client_request_t *inp);
    833 /** Return the value of the dest_addr_domainname field of the
    834 * socks5_client_request_t in 'inp'
    835 */
    836 struct domainname_st * socks5_client_request_get_dest_addr_domainname(socks5_client_request_t *inp);
    837 /** As socks5_client_request_get_dest_addr_domainname, but take and
    838 * return a const pointer
    839 */
    840 const struct domainname_st * socks5_client_request_getconst_dest_addr_domainname(const socks5_client_request_t *inp);
    841 /** Set the value of the dest_addr_domainname field of the
    842 * socks5_client_request_t in 'inp' to 'val'. Free the old value if
    843 * any. Steals the referenceto 'val'.Return 0 on success; return -1
    844 * and set the error code on 'inp' on failure.
    845 */
    846 int socks5_client_request_set_dest_addr_domainname(socks5_client_request_t *inp, struct domainname_st *val);
    847 /** As socks5_client_request_set_dest_addr_domainname, but does not
    848 * free the previous value.
    849 */
    850 int socks5_client_request_set0_dest_addr_domainname(socks5_client_request_t *inp, struct domainname_st *val);
    851 /** Return the value of the dest_port field of the
    852 * socks5_client_request_t in 'inp'
    853 */
    854 uint16_t socks5_client_request_get_dest_port(const socks5_client_request_t *inp);
    855 /** Set the value of the dest_port field of the
    856 * socks5_client_request_t in 'inp' to 'val'. Return 0 on success;
    857 * return -1 and set the error code on 'inp' on failure.
    858 */
    859 int socks5_client_request_set_dest_port(socks5_client_request_t *inp, uint16_t val);
    860 /** Return a newly allocated socks5_server_reply with all elements set
    861 * to zero.
    862 */
    863 socks5_server_reply_t *socks5_server_reply_new(void);
    864 /** Release all storage held by the socks5_server_reply in 'victim'.
    865 * (Do nothing if 'victim' is NULL.)
    866 */
    867 void socks5_server_reply_free(socks5_server_reply_t *victim);
    868 /** Try to parse a socks5_server_reply from the buffer in 'input',
    869 * using up to 'len_in' bytes from the input buffer. On success,
    870 * return the number of bytes consumed and set *output to the newly
    871 * allocated socks5_server_reply_t. On failure, return -2 if the input
    872 * appears truncated, and -1 if the input is otherwise invalid.
    873 */
    874 ssize_t socks5_server_reply_parse(socks5_server_reply_t **output, const uint8_t *input, const size_t len_in);
    875 /** Return the number of bytes we expect to need to encode the
    876 * socks5_server_reply in 'obj'. On failure, return a negative value.
    877 * Note that this value may be an overestimate, and can even be an
    878 * underestimate for certain unencodeable objects.
    879 */
    880 ssize_t socks5_server_reply_encoded_len(const socks5_server_reply_t *obj);
    881 /** Try to encode the socks5_server_reply from 'input' into the buffer
    882 * at 'output', using up to 'avail' bytes of the output buffer. On
    883 * success, return the number of bytes used. On failure, return -2 if
    884 * the buffer was not long enough, and -1 if the input was invalid.
    885 */
    886 ssize_t socks5_server_reply_encode(uint8_t *output, size_t avail, const socks5_server_reply_t *input);
    887 /** Check whether the internal state of the socks5_server_reply in
    888 * 'obj' is consistent. Return NULL if it is, and a short message if
    889 * it is not.
    890 */
    891 const char *socks5_server_reply_check(const socks5_server_reply_t *obj);
    892 /** Clear any errors that were set on the object 'obj' by its setter
    893 * functions. Return true iff errors were cleared.
    894 */
    895 int socks5_server_reply_clear_errors(socks5_server_reply_t *obj);
    896 /** Return the value of the version field of the socks5_server_reply_t
    897 * in 'inp'
    898 */
    899 uint8_t socks5_server_reply_get_version(const socks5_server_reply_t *inp);
    900 /** Set the value of the version field of the socks5_server_reply_t in
    901 * 'inp' to 'val'. Return 0 on success; return -1 and set the error
    902 * code on 'inp' on failure.
    903 */
    904 int socks5_server_reply_set_version(socks5_server_reply_t *inp, uint8_t val);
    905 /** Return the value of the reply field of the socks5_server_reply_t
    906 * in 'inp'
    907 */
    908 uint8_t socks5_server_reply_get_reply(const socks5_server_reply_t *inp);
    909 /** Set the value of the reply field of the socks5_server_reply_t in
    910 * 'inp' to 'val'. Return 0 on success; return -1 and set the error
    911 * code on 'inp' on failure.
    912 */
    913 int socks5_server_reply_set_reply(socks5_server_reply_t *inp, uint8_t val);
    914 /** Return the value of the reserved field of the
    915 * socks5_server_reply_t in 'inp'
    916 */
    917 uint8_t socks5_server_reply_get_reserved(const socks5_server_reply_t *inp);
    918 /** Set the value of the reserved field of the socks5_server_reply_t
    919 * in 'inp' to 'val'. Return 0 on success; return -1 and set the error
    920 * code on 'inp' on failure.
    921 */
    922 int socks5_server_reply_set_reserved(socks5_server_reply_t *inp, uint8_t val);
    923 /** Return the value of the atype field of the socks5_server_reply_t
    924 * in 'inp'
    925 */
    926 uint8_t socks5_server_reply_get_atype(const socks5_server_reply_t *inp);
    927 /** Set the value of the atype field of the socks5_server_reply_t in
    928 * 'inp' to 'val'. Return 0 on success; return -1 and set the error
    929 * code on 'inp' on failure.
    930 */
    931 int socks5_server_reply_set_atype(socks5_server_reply_t *inp, uint8_t val);
    932 /** Return the value of the bind_addr_ipv4 field of the
    933 * socks5_server_reply_t in 'inp'
    934 */
    935 uint32_t socks5_server_reply_get_bind_addr_ipv4(const socks5_server_reply_t *inp);
    936 /** Set the value of the bind_addr_ipv4 field of the
    937 * socks5_server_reply_t in 'inp' to 'val'. Return 0 on success;
    938 * return -1 and set the error code on 'inp' on failure.
    939 */
    940 int socks5_server_reply_set_bind_addr_ipv4(socks5_server_reply_t *inp, uint32_t val);
    941 /** Return the (constant) length of the array holding the
    942 * bind_addr_ipv6 field of the socks5_server_reply_t in 'inp'.
    943 */
    944 size_t socks5_server_reply_getlen_bind_addr_ipv6(const socks5_server_reply_t *inp);
    945 /** Return the element at position 'idx' of the fixed array field
    946 * bind_addr_ipv6 of the socks5_server_reply_t in 'inp'.
    947 */
    948 uint8_t socks5_server_reply_get_bind_addr_ipv6(socks5_server_reply_t *inp, size_t idx);
    949 /** As socks5_server_reply_get_bind_addr_ipv6, but take and return a
    950 * const pointer
    951 */
    952 uint8_t socks5_server_reply_getconst_bind_addr_ipv6(const socks5_server_reply_t *inp, size_t idx);
    953 /** Change the element at position 'idx' of the fixed array field
    954 * bind_addr_ipv6 of the socks5_server_reply_t in 'inp', so that it
    955 * will hold the value 'elt'.
    956 */
    957 int socks5_server_reply_set_bind_addr_ipv6(socks5_server_reply_t *inp, size_t idx, uint8_t elt);
    958 /** Return a pointer to the 16-element array field bind_addr_ipv6 of
    959 * 'inp'.
    960 */
    961 uint8_t * socks5_server_reply_getarray_bind_addr_ipv6(socks5_server_reply_t *inp);
    962 /** As socks5_server_reply_get_bind_addr_ipv6, but take and return a
    963 * const pointer
    964 */
    965 const uint8_t  * socks5_server_reply_getconstarray_bind_addr_ipv6(const socks5_server_reply_t *inp);
    966 /** Return the value of the bind_addr_domainname field of the
    967 * socks5_server_reply_t in 'inp'
    968 */
    969 struct domainname_st * socks5_server_reply_get_bind_addr_domainname(socks5_server_reply_t *inp);
    970 /** As socks5_server_reply_get_bind_addr_domainname, but take and
    971 * return a const pointer
    972 */
    973 const struct domainname_st * socks5_server_reply_getconst_bind_addr_domainname(const socks5_server_reply_t *inp);
    974 /** Set the value of the bind_addr_domainname field of the
    975 * socks5_server_reply_t in 'inp' to 'val'. Free the old value if any.
    976 * Steals the referenceto 'val'.Return 0 on success; return -1 and set
    977 * the error code on 'inp' on failure.
    978 */
    979 int socks5_server_reply_set_bind_addr_domainname(socks5_server_reply_t *inp, struct domainname_st *val);
    980 /** As socks5_server_reply_set_bind_addr_domainname, but does not free
    981 * the previous value.
    982 */
    983 int socks5_server_reply_set0_bind_addr_domainname(socks5_server_reply_t *inp, struct domainname_st *val);
    984 /** Return the value of the bind_port field of the
    985 * socks5_server_reply_t in 'inp'
    986 */
    987 uint16_t socks5_server_reply_get_bind_port(const socks5_server_reply_t *inp);
    988 /** Set the value of the bind_port field of the socks5_server_reply_t
    989 * in 'inp' to 'val'. Return 0 on success; return -1 and set the error
    990 * code on 'inp' on failure.
    991 */
    992 int socks5_server_reply_set_bind_port(socks5_server_reply_t *inp, uint16_t val);
    993 
    994 
    995 #endif