Merge branch 'maint-0.4.5' into release-0.4.5
[tor.git] / src / trunnel / socks5.h
blob23ac64faba99e9942b4184f561925a09cc57bfef
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
8 #include <stdint.h>
9 #include "trunnel.h"
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_;
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_;
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_;
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_;
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_;
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_;
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_;
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_;
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_;
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.
115 domainname_t *domainname_new(void);
116 /** Release all storage held by the domainname in 'victim'. (Do
117 * nothing if 'victim' is NULL.)
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.
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.
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.
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.
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.
146 int domainname_clear_errors(domainname_t *obj);
147 /** Return the value of the len field of the domainname_t in 'inp'
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.
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'.
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'.
162 char domainname_get_name(domainname_t *inp, size_t idx);
163 /** As domainname_get_name, but take and return a const pointer
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'.
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'.
174 int domainname_add_name(domainname_t *inp, char elt);
175 /** Return a pointer to the variable-length array field name of 'inp'.
177 char * domainname_getarray_name(domainname_t *inp);
178 /** As domainname_get_name, but take and return a const pointer
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.
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.
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.
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.
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.
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.)
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.
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.
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.
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.
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.
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'
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.
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'
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.
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'
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.
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'
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.
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'
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.
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'
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.
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.
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.)
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.
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.
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.
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.
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.
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'
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.
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'
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.
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'
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.
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'
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.
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.
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.)
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.
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.
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.
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.
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.
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'
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.
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'
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.
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'.
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'.
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
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'.
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'.
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'.
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
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.
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.
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.
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.
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'
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.
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'.
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'.
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
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'.
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'.
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'.
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
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.
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.
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.
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.
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.
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.)
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.
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.
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.
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.
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.
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'
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.
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'
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.
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'.
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'.
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
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'.
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'.
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'.
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
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.
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.
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.)
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.
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.
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.
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.
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.
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'
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.
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'
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.
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.
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.)
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.
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.
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.
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.
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.
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'
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.
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'
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.
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.
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.)
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.
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.
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.
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.
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.
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'
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.
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'
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.
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'
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.
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'
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.
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'
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.
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'.
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'.
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
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'.
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'.
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
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'
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
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.
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.
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'
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.
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.
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.)
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.
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.
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.
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.
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.
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'
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.
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'
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.
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'
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.
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'
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.
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'
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.
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'.
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'.
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
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'.
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'.
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
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'
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
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.
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.
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'
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.
992 int socks5_server_reply_set_bind_port(socks5_server_reply_t *inp, uint16_t val);
995 #endif