1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
|
/* socks5.h -- generated by Trunnel v1.5.2.
* https://gitweb.torproject.org/trunnel.git
* You probably shouldn't edit this file.
*/
#ifndef TRUNNEL_SOCKS5_H
#define TRUNNEL_SOCKS5_H
#include <stdint.h>
#include "trunnel.h"
#define CMD_CONNECT 1
#define CMD_BIND 2
#define CMD_UDP_ASSOCIATE 3
#define CMD_RESOLVE 240
#define CMD_RESOLVE_PTR 241
#define ATYPE_IPV4 1
#define ATYPE_IPV6 4
#define ATYPE_DOMAINNAME 3
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_DOMAINNAME)
struct domainname_st {
uint8_t len;
trunnel_string_t name;
uint8_t trunnel_error_code_;
};
#endif
typedef struct domainname_st domainname_t;
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_SOCKS4_CLIENT_REQUEST)
struct socks4_client_request_st {
uint8_t version;
uint8_t command;
uint16_t port;
uint32_t addr;
char *username;
char *socks4a_addr_hostname;
uint8_t trunnel_error_code_;
};
#endif
typedef struct socks4_client_request_st socks4_client_request_t;
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_SOCKS4_SERVER_REPLY)
struct socks4_server_reply_st {
uint8_t version;
uint8_t status;
uint16_t port;
uint32_t addr;
uint8_t trunnel_error_code_;
};
#endif
typedef struct socks4_server_reply_st socks4_server_reply_t;
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_SOCKS5_CLIENT_USERPASS_AUTH)
struct socks5_client_userpass_auth_st {
uint8_t version;
uint8_t username_len;
trunnel_string_t username;
uint8_t passwd_len;
trunnel_string_t passwd;
uint8_t trunnel_error_code_;
};
#endif
typedef struct socks5_client_userpass_auth_st socks5_client_userpass_auth_t;
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_SOCKS5_CLIENT_VERSION)
struct socks5_client_version_st {
uint8_t version;
uint8_t n_methods;
TRUNNEL_DYNARRAY_HEAD(, uint8_t) methods;
uint8_t trunnel_error_code_;
};
#endif
typedef struct socks5_client_version_st socks5_client_version_t;
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_SOCKS5_SERVER_METHOD)
struct socks5_server_method_st {
uint8_t version;
uint8_t method;
uint8_t trunnel_error_code_;
};
#endif
typedef struct socks5_server_method_st socks5_server_method_t;
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_SOCKS5_SERVER_USERPATH_AUTH)
struct socks5_server_userpath_auth_st {
uint8_t version;
uint8_t status;
uint8_t trunnel_error_code_;
};
#endif
typedef struct socks5_server_userpath_auth_st socks5_server_userpath_auth_t;
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TOR_SOCKSAUTH_KEYVAL)
struct tor_socksauth_keyval_st {
uint16_t keylen;
trunnel_string_t key;
uint16_t vallen;
trunnel_string_t val;
uint8_t trunnel_error_code_;
};
#endif
typedef struct tor_socksauth_keyval_st tor_socksauth_keyval_t;
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_SOCKS5_CLIENT_REQUEST)
struct socks5_client_request_st {
uint8_t version;
uint8_t command;
uint8_t reserved;
uint8_t atype;
uint32_t dest_addr_ipv4;
uint8_t dest_addr_ipv6[16];
struct domainname_st *dest_addr_domainname;
uint16_t dest_port;
uint8_t trunnel_error_code_;
};
#endif
typedef struct socks5_client_request_st socks5_client_request_t;
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_SOCKS5_SERVER_REPLY)
struct socks5_server_reply_st {
uint8_t version;
uint8_t reply;
uint8_t reserved;
uint8_t atype;
uint32_t bind_addr_ipv4;
uint8_t bind_addr_ipv6[16];
struct domainname_st *bind_addr_domainname;
uint16_t bind_port;
uint8_t trunnel_error_code_;
};
#endif
typedef struct socks5_server_reply_st socks5_server_reply_t;
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TOR_EXTENDED_SOCKS_AUTH_REQUEST)
struct tor_extended_socks_auth_request_st {
uint8_t version;
uint16_t npairs;
TRUNNEL_DYNARRAY_HEAD(, struct tor_socksauth_keyval_st *) pairs;
uint8_t trunnel_error_code_;
};
#endif
typedef struct tor_extended_socks_auth_request_st tor_extended_socks_auth_request_t;
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TOR_EXTENDED_SOCKS_AUTH_RESPONSE)
struct tor_extended_socks_auth_response_st {
uint8_t version;
uint8_t status;
uint16_t npairs;
TRUNNEL_DYNARRAY_HEAD(, struct tor_socksauth_keyval_st *) pairs;
uint8_t trunnel_error_code_;
};
#endif
typedef struct tor_extended_socks_auth_response_st tor_extended_socks_auth_response_t;
/** Return a newly allocated domainname with all elements set to zero.
*/
domainname_t *domainname_new(void);
/** Release all storage held by the domainname in 'victim'. (Do
* nothing if 'victim' is NULL.)
*/
void domainname_free(domainname_t *victim);
/** Try to parse a domainname from the buffer in 'input', using up to
* 'len_in' bytes from the input buffer. On success, return the number
* of bytes consumed and set *output to the newly allocated
* domainname_t. On failure, return -2 if the input appears truncated,
* and -1 if the input is otherwise invalid.
*/
ssize_t domainname_parse(domainname_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
* domainname in 'obj'. On failure, return a negative value. Note that
* this value may be an overestimate, and can even be an underestimate
* for certain unencodeable objects.
*/
ssize_t domainname_encoded_len(const domainname_t *obj);
/** Try to encode the domainname from 'input' into the buffer at
* 'output', using up to 'avail' bytes of the output buffer. On
* success, return the number of bytes used. On failure, return -2 if
* the buffer was not long enough, and -1 if the input was invalid.
*/
ssize_t domainname_encode(uint8_t *output, size_t avail, const domainname_t *input);
/** Check whether the internal state of the domainname in 'obj' is
* consistent. Return NULL if it is, and a short message if it is not.
*/
const char *domainname_check(const domainname_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
int domainname_clear_errors(domainname_t *obj);
/** Return the value of the len field of the domainname_t in 'inp'
*/
uint8_t domainname_get_len(const domainname_t *inp);
/** Set the value of the len field of the domainname_t in 'inp' to
* 'val'. Return 0 on success; return -1 and set the error code on
* 'inp' on failure.
*/
int domainname_set_len(domainname_t *inp, uint8_t val);
/** Return the length of the dynamic array holding the name field of
* the domainname_t in 'inp'.
*/
size_t domainname_getlen_name(const domainname_t *inp);
/** Return the element at position 'idx' of the dynamic array field
* name of the domainname_t in 'inp'.
*/
char domainname_get_name(domainname_t *inp, size_t idx);
/** As domainname_get_name, but take and return a const pointer
*/
char domainname_getconst_name(const domainname_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
* name of the domainname_t in 'inp', so that it will hold the value
* 'elt'.
*/
int domainname_set_name(domainname_t *inp, size_t idx, char elt);
/** Append a new element 'elt' to the dynamic array field name of the
* domainname_t in 'inp'.
*/
int domainname_add_name(domainname_t *inp, char elt);
/** Return a pointer to the variable-length array field name of 'inp'.
*/
char * domainname_getarray_name(domainname_t *inp);
/** As domainname_get_name, but take and return a const pointer
*/
const char * domainname_getconstarray_name(const domainname_t *inp);
/** Change the length of the variable-length array field name of 'inp'
* to 'newlen'.Fill extra elements with 0. Return 0 on success; return
* -1 and set the error code on 'inp' on failure.
*/
int domainname_setlen_name(domainname_t *inp, size_t newlen);
/** Return the value of the name field of a domainname_t as a NUL-
* terminated string.
*/
const char * domainname_getstr_name(domainname_t *inp);
/** Set the value of the name field of a domainname_t to a given
* string of length 'len'. Return 0 on success; return -1 and set the
* error code on 'inp' on failure.
*/
int domainname_setstr0_name(domainname_t *inp, const char *val, size_t len);
/** Set the value of the name field of a domainname_t to a given NUL-
* terminated string. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int domainname_setstr_name(domainname_t *inp, const char *val);
/** Return a newly allocated socks4_client_request with all elements
* set to zero.
*/
socks4_client_request_t *socks4_client_request_new(void);
/** Release all storage held by the socks4_client_request in 'victim'.
* (Do nothing if 'victim' is NULL.)
*/
void socks4_client_request_free(socks4_client_request_t *victim);
/** Try to parse a socks4_client_request from the buffer in 'input',
* using up to 'len_in' bytes from the input buffer. On success,
* return the number of bytes consumed and set *output to the newly
* allocated socks4_client_request_t. On failure, return -2 if the
* input appears truncated, and -1 if the input is otherwise invalid.
*/
ssize_t socks4_client_request_parse(socks4_client_request_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
* socks4_client_request in 'obj'. On failure, return a negative
* value. Note that this value may be an overestimate, and can even be
* an underestimate for certain unencodeable objects.
*/
ssize_t socks4_client_request_encoded_len(const socks4_client_request_t *obj);
/** Try to encode the socks4_client_request from 'input' into the
* buffer at 'output', using up to 'avail' bytes of the output buffer.
* On success, return the number of bytes used. On failure, return -2
* if the buffer was not long enough, and -1 if the input was invalid.
*/
ssize_t socks4_client_request_encode(uint8_t *output, size_t avail, const socks4_client_request_t *input);
/** Check whether the internal state of the socks4_client_request in
* 'obj' is consistent. Return NULL if it is, and a short message if
* it is not.
*/
const char *socks4_client_request_check(const socks4_client_request_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
int socks4_client_request_clear_errors(socks4_client_request_t *obj);
/** Return the value of the version field of the
* socks4_client_request_t in 'inp'
*/
uint8_t socks4_client_request_get_version(const socks4_client_request_t *inp);
/** Set the value of the version field of the socks4_client_request_t
* in 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks4_client_request_set_version(socks4_client_request_t *inp, uint8_t val);
/** Return the value of the command field of the
* socks4_client_request_t in 'inp'
*/
uint8_t socks4_client_request_get_command(const socks4_client_request_t *inp);
/** Set the value of the command field of the socks4_client_request_t
* in 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks4_client_request_set_command(socks4_client_request_t *inp, uint8_t val);
/** Return the value of the port field of the socks4_client_request_t
* in 'inp'
*/
uint16_t socks4_client_request_get_port(const socks4_client_request_t *inp);
/** Set the value of the port field of the socks4_client_request_t in
* 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks4_client_request_set_port(socks4_client_request_t *inp, uint16_t val);
/** Return the value of the addr field of the socks4_client_request_t
* in 'inp'
*/
uint32_t socks4_client_request_get_addr(const socks4_client_request_t *inp);
/** Set the value of the addr field of the socks4_client_request_t in
* 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks4_client_request_set_addr(socks4_client_request_t *inp, uint32_t val);
/** Return the value of the username field of the
* socks4_client_request_t in 'inp'
*/
const char * socks4_client_request_get_username(const socks4_client_request_t *inp);
/** Set the value of the username field of the socks4_client_request_t
* in 'inp' to 'val'. Free the old value if any. Does not steal the
* reference to 'val'.Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks4_client_request_set_username(socks4_client_request_t *inp, const char *val);
/** Return the value of the socks4a_addr_hostname field of the
* socks4_client_request_t in 'inp'
*/
const char * socks4_client_request_get_socks4a_addr_hostname(const socks4_client_request_t *inp);
/** Set the value of the socks4a_addr_hostname field of the
* socks4_client_request_t in 'inp' to 'val'. Free the old value if
* any. Does not steal the reference to 'val'.Return 0 on success;
* return -1 and set the error code on 'inp' on failure.
*/
int socks4_client_request_set_socks4a_addr_hostname(socks4_client_request_t *inp, const char *val);
/** Return a newly allocated socks4_server_reply with all elements set
* to zero.
*/
socks4_server_reply_t *socks4_server_reply_new(void);
/** Release all storage held by the socks4_server_reply in 'victim'.
* (Do nothing if 'victim' is NULL.)
*/
void socks4_server_reply_free(socks4_server_reply_t *victim);
/** Try to parse a socks4_server_reply from the buffer in 'input',
* using up to 'len_in' bytes from the input buffer. On success,
* return the number of bytes consumed and set *output to the newly
* allocated socks4_server_reply_t. On failure, return -2 if the input
* appears truncated, and -1 if the input is otherwise invalid.
*/
ssize_t socks4_server_reply_parse(socks4_server_reply_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
* socks4_server_reply in 'obj'. On failure, return a negative value.
* Note that this value may be an overestimate, and can even be an
* underestimate for certain unencodeable objects.
*/
ssize_t socks4_server_reply_encoded_len(const socks4_server_reply_t *obj);
/** Try to encode the socks4_server_reply from 'input' into the buffer
* at 'output', using up to 'avail' bytes of the output buffer. On
* success, return the number of bytes used. On failure, return -2 if
* the buffer was not long enough, and -1 if the input was invalid.
*/
ssize_t socks4_server_reply_encode(uint8_t *output, size_t avail, const socks4_server_reply_t *input);
/** Check whether the internal state of the socks4_server_reply in
* 'obj' is consistent. Return NULL if it is, and a short message if
* it is not.
*/
const char *socks4_server_reply_check(const socks4_server_reply_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
int socks4_server_reply_clear_errors(socks4_server_reply_t *obj);
/** Return the value of the version field of the socks4_server_reply_t
* in 'inp'
*/
uint8_t socks4_server_reply_get_version(const socks4_server_reply_t *inp);
/** Set the value of the version field of the socks4_server_reply_t in
* 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks4_server_reply_set_version(socks4_server_reply_t *inp, uint8_t val);
/** Return the value of the status field of the socks4_server_reply_t
* in 'inp'
*/
uint8_t socks4_server_reply_get_status(const socks4_server_reply_t *inp);
/** Set the value of the status field of the socks4_server_reply_t in
* 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks4_server_reply_set_status(socks4_server_reply_t *inp, uint8_t val);
/** Return the value of the port field of the socks4_server_reply_t in
* 'inp'
*/
uint16_t socks4_server_reply_get_port(const socks4_server_reply_t *inp);
/** Set the value of the port field of the socks4_server_reply_t in
* 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks4_server_reply_set_port(socks4_server_reply_t *inp, uint16_t val);
/** Return the value of the addr field of the socks4_server_reply_t in
* 'inp'
*/
uint32_t socks4_server_reply_get_addr(const socks4_server_reply_t *inp);
/** Set the value of the addr field of the socks4_server_reply_t in
* 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks4_server_reply_set_addr(socks4_server_reply_t *inp, uint32_t val);
/** Return a newly allocated socks5_client_userpass_auth with all
* elements set to zero.
*/
socks5_client_userpass_auth_t *socks5_client_userpass_auth_new(void);
/** Release all storage held by the socks5_client_userpass_auth in
* 'victim'. (Do nothing if 'victim' is NULL.)
*/
void socks5_client_userpass_auth_free(socks5_client_userpass_auth_t *victim);
/** Try to parse a socks5_client_userpass_auth from the buffer in
* 'input', using up to 'len_in' bytes from the input buffer. On
* success, return the number of bytes consumed and set *output to the
* newly allocated socks5_client_userpass_auth_t. On failure, return
* -2 if the input appears truncated, and -1 if the input is otherwise
* invalid.
*/
ssize_t socks5_client_userpass_auth_parse(socks5_client_userpass_auth_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
* socks5_client_userpass_auth in 'obj'. On failure, return a negative
* value. Note that this value may be an overestimate, and can even be
* an underestimate for certain unencodeable objects.
*/
ssize_t socks5_client_userpass_auth_encoded_len(const socks5_client_userpass_auth_t *obj);
/** Try to encode the socks5_client_userpass_auth from 'input' into
* the buffer at 'output', using up to 'avail' bytes of the output
* buffer. On success, return the number of bytes used. On failure,
* return -2 if the buffer was not long enough, and -1 if the input
* was invalid.
*/
ssize_t socks5_client_userpass_auth_encode(uint8_t *output, size_t avail, const socks5_client_userpass_auth_t *input);
/** Check whether the internal state of the
* socks5_client_userpass_auth in 'obj' is consistent. Return NULL if
* it is, and a short message if it is not.
*/
const char *socks5_client_userpass_auth_check(const socks5_client_userpass_auth_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
int socks5_client_userpass_auth_clear_errors(socks5_client_userpass_auth_t *obj);
/** Return the value of the version field of the
* socks5_client_userpass_auth_t in 'inp'
*/
uint8_t socks5_client_userpass_auth_get_version(const socks5_client_userpass_auth_t *inp);
/** Set the value of the version field of the
* socks5_client_userpass_auth_t in 'inp' to 'val'. Return 0 on
* success; return -1 and set the error code on 'inp' on failure.
*/
int socks5_client_userpass_auth_set_version(socks5_client_userpass_auth_t *inp, uint8_t val);
/** Return the value of the username_len field of the
* socks5_client_userpass_auth_t in 'inp'
*/
uint8_t socks5_client_userpass_auth_get_username_len(const socks5_client_userpass_auth_t *inp);
/** Set the value of the username_len field of the
* socks5_client_userpass_auth_t in 'inp' to 'val'. Return 0 on
* success; return -1 and set the error code on 'inp' on failure.
*/
int socks5_client_userpass_auth_set_username_len(socks5_client_userpass_auth_t *inp, uint8_t val);
/** Return the length of the dynamic array holding the username field
* of the socks5_client_userpass_auth_t in 'inp'.
*/
size_t socks5_client_userpass_auth_getlen_username(const socks5_client_userpass_auth_t *inp);
/** Return the element at position 'idx' of the dynamic array field
* username of the socks5_client_userpass_auth_t in 'inp'.
*/
char socks5_client_userpass_auth_get_username(socks5_client_userpass_auth_t *inp, size_t idx);
/** As socks5_client_userpass_auth_get_username, but take and return a
* const pointer
*/
char socks5_client_userpass_auth_getconst_username(const socks5_client_userpass_auth_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
* username of the socks5_client_userpass_auth_t in 'inp', so that it
* will hold the value 'elt'.
*/
int socks5_client_userpass_auth_set_username(socks5_client_userpass_auth_t *inp, size_t idx, char elt);
/** Append a new element 'elt' to the dynamic array field username of
* the socks5_client_userpass_auth_t in 'inp'.
*/
int socks5_client_userpass_auth_add_username(socks5_client_userpass_auth_t *inp, char elt);
/** Return a pointer to the variable-length array field username of
* 'inp'.
*/
char * socks5_client_userpass_auth_getarray_username(socks5_client_userpass_auth_t *inp);
/** As socks5_client_userpass_auth_get_username, but take and return a
* const pointer
*/
const char * socks5_client_userpass_auth_getconstarray_username(const socks5_client_userpass_auth_t *inp);
/** Change the length of the variable-length array field username of
* 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
* return -1 and set the error code on 'inp' on failure.
*/
int socks5_client_userpass_auth_setlen_username(socks5_client_userpass_auth_t *inp, size_t newlen);
/** Return the value of the username field of a
* socks5_client_userpass_auth_t as a NUL-terminated string.
*/
const char * socks5_client_userpass_auth_getstr_username(socks5_client_userpass_auth_t *inp);
/** Set the value of the username field of a
* socks5_client_userpass_auth_t to a given string of length 'len'.
* Return 0 on success; return -1 and set the error code on 'inp' on
* failure.
*/
int socks5_client_userpass_auth_setstr0_username(socks5_client_userpass_auth_t *inp, const char *val, size_t len);
/** Set the value of the username field of a
* socks5_client_userpass_auth_t to a given NUL-terminated string.
* Return 0 on success; return -1 and set the error code on 'inp' on
* failure.
*/
int socks5_client_userpass_auth_setstr_username(socks5_client_userpass_auth_t *inp, const char *val);
/** Return the value of the passwd_len field of the
* socks5_client_userpass_auth_t in 'inp'
*/
uint8_t socks5_client_userpass_auth_get_passwd_len(const socks5_client_userpass_auth_t *inp);
/** Set the value of the passwd_len field of the
* socks5_client_userpass_auth_t in 'inp' to 'val'. Return 0 on
* success; return -1 and set the error code on 'inp' on failure.
*/
int socks5_client_userpass_auth_set_passwd_len(socks5_client_userpass_auth_t *inp, uint8_t val);
/** Return the length of the dynamic array holding the passwd field of
* the socks5_client_userpass_auth_t in 'inp'.
*/
size_t socks5_client_userpass_auth_getlen_passwd(const socks5_client_userpass_auth_t *inp);
/** Return the element at position 'idx' of the dynamic array field
* passwd of the socks5_client_userpass_auth_t in 'inp'.
*/
char socks5_client_userpass_auth_get_passwd(socks5_client_userpass_auth_t *inp, size_t idx);
/** As socks5_client_userpass_auth_get_passwd, but take and return a
* const pointer
*/
char socks5_client_userpass_auth_getconst_passwd(const socks5_client_userpass_auth_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
* passwd of the socks5_client_userpass_auth_t in 'inp', so that it
* will hold the value 'elt'.
*/
int socks5_client_userpass_auth_set_passwd(socks5_client_userpass_auth_t *inp, size_t idx, char elt);
/** Append a new element 'elt' to the dynamic array field passwd of
* the socks5_client_userpass_auth_t in 'inp'.
*/
int socks5_client_userpass_auth_add_passwd(socks5_client_userpass_auth_t *inp, char elt);
/** Return a pointer to the variable-length array field passwd of
* 'inp'.
*/
char * socks5_client_userpass_auth_getarray_passwd(socks5_client_userpass_auth_t *inp);
/** As socks5_client_userpass_auth_get_passwd, but take and return a
* const pointer
*/
const char * socks5_client_userpass_auth_getconstarray_passwd(const socks5_client_userpass_auth_t *inp);
/** Change the length of the variable-length array field passwd of
* 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
* return -1 and set the error code on 'inp' on failure.
*/
int socks5_client_userpass_auth_setlen_passwd(socks5_client_userpass_auth_t *inp, size_t newlen);
/** Return the value of the passwd field of a
* socks5_client_userpass_auth_t as a NUL-terminated string.
*/
const char * socks5_client_userpass_auth_getstr_passwd(socks5_client_userpass_auth_t *inp);
/** Set the value of the passwd field of a
* socks5_client_userpass_auth_t to a given string of length 'len'.
* Return 0 on success; return -1 and set the error code on 'inp' on
* failure.
*/
int socks5_client_userpass_auth_setstr0_passwd(socks5_client_userpass_auth_t *inp, const char *val, size_t len);
/** Set the value of the passwd field of a
* socks5_client_userpass_auth_t to a given NUL-terminated string.
* Return 0 on success; return -1 and set the error code on 'inp' on
* failure.
*/
int socks5_client_userpass_auth_setstr_passwd(socks5_client_userpass_auth_t *inp, const char *val);
/** Return a newly allocated socks5_client_version with all elements
* set to zero.
*/
socks5_client_version_t *socks5_client_version_new(void);
/** Release all storage held by the socks5_client_version in 'victim'.
* (Do nothing if 'victim' is NULL.)
*/
void socks5_client_version_free(socks5_client_version_t *victim);
/** Try to parse a socks5_client_version from the buffer in 'input',
* using up to 'len_in' bytes from the input buffer. On success,
* return the number of bytes consumed and set *output to the newly
* allocated socks5_client_version_t. On failure, return -2 if the
* input appears truncated, and -1 if the input is otherwise invalid.
*/
ssize_t socks5_client_version_parse(socks5_client_version_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
* socks5_client_version in 'obj'. On failure, return a negative
* value. Note that this value may be an overestimate, and can even be
* an underestimate for certain unencodeable objects.
*/
ssize_t socks5_client_version_encoded_len(const socks5_client_version_t *obj);
/** Try to encode the socks5_client_version from 'input' into the
* buffer at 'output', using up to 'avail' bytes of the output buffer.
* On success, return the number of bytes used. On failure, return -2
* if the buffer was not long enough, and -1 if the input was invalid.
*/
ssize_t socks5_client_version_encode(uint8_t *output, size_t avail, const socks5_client_version_t *input);
/** Check whether the internal state of the socks5_client_version in
* 'obj' is consistent. Return NULL if it is, and a short message if
* it is not.
*/
const char *socks5_client_version_check(const socks5_client_version_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
int socks5_client_version_clear_errors(socks5_client_version_t *obj);
/** Return the value of the version field of the
* socks5_client_version_t in 'inp'
*/
uint8_t socks5_client_version_get_version(const socks5_client_version_t *inp);
/** Set the value of the version field of the socks5_client_version_t
* in 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks5_client_version_set_version(socks5_client_version_t *inp, uint8_t val);
/** Return the value of the n_methods field of the
* socks5_client_version_t in 'inp'
*/
uint8_t socks5_client_version_get_n_methods(const socks5_client_version_t *inp);
/** Set the value of the n_methods field of the
* socks5_client_version_t in 'inp' to 'val'. Return 0 on success;
* return -1 and set the error code on 'inp' on failure.
*/
int socks5_client_version_set_n_methods(socks5_client_version_t *inp, uint8_t val);
/** Return the length of the dynamic array holding the methods field
* of the socks5_client_version_t in 'inp'.
*/
size_t socks5_client_version_getlen_methods(const socks5_client_version_t *inp);
/** Return the element at position 'idx' of the dynamic array field
* methods of the socks5_client_version_t in 'inp'.
*/
uint8_t socks5_client_version_get_methods(socks5_client_version_t *inp, size_t idx);
/** As socks5_client_version_get_methods, but take and return a const
* pointer
*/
uint8_t socks5_client_version_getconst_methods(const socks5_client_version_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
* methods of the socks5_client_version_t in 'inp', so that it will
* hold the value 'elt'.
*/
int socks5_client_version_set_methods(socks5_client_version_t *inp, size_t idx, uint8_t elt);
/** Append a new element 'elt' to the dynamic array field methods of
* the socks5_client_version_t in 'inp'.
*/
int socks5_client_version_add_methods(socks5_client_version_t *inp, uint8_t elt);
/** Return a pointer to the variable-length array field methods of
* 'inp'.
*/
uint8_t * socks5_client_version_getarray_methods(socks5_client_version_t *inp);
/** As socks5_client_version_get_methods, but take and return a const
* pointer
*/
const uint8_t * socks5_client_version_getconstarray_methods(const socks5_client_version_t *inp);
/** Change the length of the variable-length array field methods of
* 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
* return -1 and set the error code on 'inp' on failure.
*/
int socks5_client_version_setlen_methods(socks5_client_version_t *inp, size_t newlen);
/** Return a newly allocated socks5_server_method with all elements
* set to zero.
*/
socks5_server_method_t *socks5_server_method_new(void);
/** Release all storage held by the socks5_server_method in 'victim'.
* (Do nothing if 'victim' is NULL.)
*/
void socks5_server_method_free(socks5_server_method_t *victim);
/** Try to parse a socks5_server_method from the buffer in 'input',
* using up to 'len_in' bytes from the input buffer. On success,
* return the number of bytes consumed and set *output to the newly
* allocated socks5_server_method_t. On failure, return -2 if the
* input appears truncated, and -1 if the input is otherwise invalid.
*/
ssize_t socks5_server_method_parse(socks5_server_method_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
* socks5_server_method in 'obj'. On failure, return a negative value.
* Note that this value may be an overestimate, and can even be an
* underestimate for certain unencodeable objects.
*/
ssize_t socks5_server_method_encoded_len(const socks5_server_method_t *obj);
/** Try to encode the socks5_server_method from 'input' into the
* buffer at 'output', using up to 'avail' bytes of the output buffer.
* On success, return the number of bytes used. On failure, return -2
* if the buffer was not long enough, and -1 if the input was invalid.
*/
ssize_t socks5_server_method_encode(uint8_t *output, size_t avail, const socks5_server_method_t *input);
/** Check whether the internal state of the socks5_server_method in
* 'obj' is consistent. Return NULL if it is, and a short message if
* it is not.
*/
const char *socks5_server_method_check(const socks5_server_method_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
int socks5_server_method_clear_errors(socks5_server_method_t *obj);
/** Return the value of the version field of the
* socks5_server_method_t in 'inp'
*/
uint8_t socks5_server_method_get_version(const socks5_server_method_t *inp);
/** Set the value of the version field of the socks5_server_method_t
* in 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks5_server_method_set_version(socks5_server_method_t *inp, uint8_t val);
/** Return the value of the method field of the socks5_server_method_t
* in 'inp'
*/
uint8_t socks5_server_method_get_method(const socks5_server_method_t *inp);
/** Set the value of the method field of the socks5_server_method_t in
* 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks5_server_method_set_method(socks5_server_method_t *inp, uint8_t val);
/** Return a newly allocated socks5_server_userpath_auth with all
* elements set to zero.
*/
socks5_server_userpath_auth_t *socks5_server_userpath_auth_new(void);
/** Release all storage held by the socks5_server_userpath_auth in
* 'victim'. (Do nothing if 'victim' is NULL.)
*/
void socks5_server_userpath_auth_free(socks5_server_userpath_auth_t *victim);
/** Try to parse a socks5_server_userpath_auth from the buffer in
* 'input', using up to 'len_in' bytes from the input buffer. On
* success, return the number of bytes consumed and set *output to the
* newly allocated socks5_server_userpath_auth_t. On failure, return
* -2 if the input appears truncated, and -1 if the input is otherwise
* invalid.
*/
ssize_t socks5_server_userpath_auth_parse(socks5_server_userpath_auth_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
* socks5_server_userpath_auth in 'obj'. On failure, return a negative
* value. Note that this value may be an overestimate, and can even be
* an underestimate for certain unencodeable objects.
*/
ssize_t socks5_server_userpath_auth_encoded_len(const socks5_server_userpath_auth_t *obj);
/** Try to encode the socks5_server_userpath_auth from 'input' into
* the buffer at 'output', using up to 'avail' bytes of the output
* buffer. On success, return the number of bytes used. On failure,
* return -2 if the buffer was not long enough, and -1 if the input
* was invalid.
*/
ssize_t socks5_server_userpath_auth_encode(uint8_t *output, size_t avail, const socks5_server_userpath_auth_t *input);
/** Check whether the internal state of the
* socks5_server_userpath_auth in 'obj' is consistent. Return NULL if
* it is, and a short message if it is not.
*/
const char *socks5_server_userpath_auth_check(const socks5_server_userpath_auth_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
int socks5_server_userpath_auth_clear_errors(socks5_server_userpath_auth_t *obj);
/** Return the value of the version field of the
* socks5_server_userpath_auth_t in 'inp'
*/
uint8_t socks5_server_userpath_auth_get_version(const socks5_server_userpath_auth_t *inp);
/** Set the value of the version field of the
* socks5_server_userpath_auth_t in 'inp' to 'val'. Return 0 on
* success; return -1 and set the error code on 'inp' on failure.
*/
int socks5_server_userpath_auth_set_version(socks5_server_userpath_auth_t *inp, uint8_t val);
/** Return the value of the status field of the
* socks5_server_userpath_auth_t in 'inp'
*/
uint8_t socks5_server_userpath_auth_get_status(const socks5_server_userpath_auth_t *inp);
/** Set the value of the status field of the
* socks5_server_userpath_auth_t in 'inp' to 'val'. Return 0 on
* success; return -1 and set the error code on 'inp' on failure.
*/
int socks5_server_userpath_auth_set_status(socks5_server_userpath_auth_t *inp, uint8_t val);
/** Return a newly allocated tor_socksauth_keyval with all elements
* set to zero.
*/
tor_socksauth_keyval_t *tor_socksauth_keyval_new(void);
/** Release all storage held by the tor_socksauth_keyval in 'victim'.
* (Do nothing if 'victim' is NULL.)
*/
void tor_socksauth_keyval_free(tor_socksauth_keyval_t *victim);
/** Try to parse a tor_socksauth_keyval from the buffer in 'input',
* using up to 'len_in' bytes from the input buffer. On success,
* return the number of bytes consumed and set *output to the newly
* allocated tor_socksauth_keyval_t. On failure, return -2 if the
* input appears truncated, and -1 if the input is otherwise invalid.
*/
ssize_t tor_socksauth_keyval_parse(tor_socksauth_keyval_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
* tor_socksauth_keyval in 'obj'. On failure, return a negative value.
* Note that this value may be an overestimate, and can even be an
* underestimate for certain unencodeable objects.
*/
ssize_t tor_socksauth_keyval_encoded_len(const tor_socksauth_keyval_t *obj);
/** Try to encode the tor_socksauth_keyval from 'input' into the
* buffer at 'output', using up to 'avail' bytes of the output buffer.
* On success, return the number of bytes used. On failure, return -2
* if the buffer was not long enough, and -1 if the input was invalid.
*/
ssize_t tor_socksauth_keyval_encode(uint8_t *output, size_t avail, const tor_socksauth_keyval_t *input);
/** Check whether the internal state of the tor_socksauth_keyval in
* 'obj' is consistent. Return NULL if it is, and a short message if
* it is not.
*/
const char *tor_socksauth_keyval_check(const tor_socksauth_keyval_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
int tor_socksauth_keyval_clear_errors(tor_socksauth_keyval_t *obj);
/** Return the value of the keylen field of the tor_socksauth_keyval_t
* in 'inp'
*/
uint16_t tor_socksauth_keyval_get_keylen(const tor_socksauth_keyval_t *inp);
/** Set the value of the keylen field of the tor_socksauth_keyval_t in
* 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int tor_socksauth_keyval_set_keylen(tor_socksauth_keyval_t *inp, uint16_t val);
/** Return the length of the dynamic array holding the key field of
* the tor_socksauth_keyval_t in 'inp'.
*/
size_t tor_socksauth_keyval_getlen_key(const tor_socksauth_keyval_t *inp);
/** Return the element at position 'idx' of the dynamic array field
* key of the tor_socksauth_keyval_t in 'inp'.
*/
char tor_socksauth_keyval_get_key(tor_socksauth_keyval_t *inp, size_t idx);
/** As tor_socksauth_keyval_get_key, but take and return a const
* pointer
*/
char tor_socksauth_keyval_getconst_key(const tor_socksauth_keyval_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
* key of the tor_socksauth_keyval_t in 'inp', so that it will hold
* the value 'elt'.
*/
int tor_socksauth_keyval_set_key(tor_socksauth_keyval_t *inp, size_t idx, char elt);
/** Append a new element 'elt' to the dynamic array field key of the
* tor_socksauth_keyval_t in 'inp'.
*/
int tor_socksauth_keyval_add_key(tor_socksauth_keyval_t *inp, char elt);
/** Return a pointer to the variable-length array field key of 'inp'.
*/
char * tor_socksauth_keyval_getarray_key(tor_socksauth_keyval_t *inp);
/** As tor_socksauth_keyval_get_key, but take and return a const
* pointer
*/
const char * tor_socksauth_keyval_getconstarray_key(const tor_socksauth_keyval_t *inp);
/** Change the length of the variable-length array field key of 'inp'
* to 'newlen'.Fill extra elements with 0. Return 0 on success; return
* -1 and set the error code on 'inp' on failure.
*/
int tor_socksauth_keyval_setlen_key(tor_socksauth_keyval_t *inp, size_t newlen);
/** Return the value of the key field of a tor_socksauth_keyval_t as a
* NUL-terminated string.
*/
const char * tor_socksauth_keyval_getstr_key(tor_socksauth_keyval_t *inp);
/** Set the value of the key field of a tor_socksauth_keyval_t to a
* given string of length 'len'. Return 0 on success; return -1 and
* set the error code on 'inp' on failure.
*/
int tor_socksauth_keyval_setstr0_key(tor_socksauth_keyval_t *inp, const char *val, size_t len);
/** Set the value of the key field of a tor_socksauth_keyval_t to a
* given NUL-terminated string. Return 0 on success; return -1 and set
* the error code on 'inp' on failure.
*/
int tor_socksauth_keyval_setstr_key(tor_socksauth_keyval_t *inp, const char *val);
/** Return the value of the vallen field of the tor_socksauth_keyval_t
* in 'inp'
*/
uint16_t tor_socksauth_keyval_get_vallen(const tor_socksauth_keyval_t *inp);
/** Set the value of the vallen field of the tor_socksauth_keyval_t in
* 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int tor_socksauth_keyval_set_vallen(tor_socksauth_keyval_t *inp, uint16_t val);
/** Return the length of the dynamic array holding the val field of
* the tor_socksauth_keyval_t in 'inp'.
*/
size_t tor_socksauth_keyval_getlen_val(const tor_socksauth_keyval_t *inp);
/** Return the element at position 'idx' of the dynamic array field
* val of the tor_socksauth_keyval_t in 'inp'.
*/
char tor_socksauth_keyval_get_val(tor_socksauth_keyval_t *inp, size_t idx);
/** As tor_socksauth_keyval_get_val, but take and return a const
* pointer
*/
char tor_socksauth_keyval_getconst_val(const tor_socksauth_keyval_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
* val of the tor_socksauth_keyval_t in 'inp', so that it will hold
* the value 'elt'.
*/
int tor_socksauth_keyval_set_val(tor_socksauth_keyval_t *inp, size_t idx, char elt);
/** Append a new element 'elt' to the dynamic array field val of the
* tor_socksauth_keyval_t in 'inp'.
*/
int tor_socksauth_keyval_add_val(tor_socksauth_keyval_t *inp, char elt);
/** Return a pointer to the variable-length array field val of 'inp'.
*/
char * tor_socksauth_keyval_getarray_val(tor_socksauth_keyval_t *inp);
/** As tor_socksauth_keyval_get_val, but take and return a const
* pointer
*/
const char * tor_socksauth_keyval_getconstarray_val(const tor_socksauth_keyval_t *inp);
/** Change the length of the variable-length array field val of 'inp'
* to 'newlen'.Fill extra elements with 0. Return 0 on success; return
* -1 and set the error code on 'inp' on failure.
*/
int tor_socksauth_keyval_setlen_val(tor_socksauth_keyval_t *inp, size_t newlen);
/** Return the value of the val field of a tor_socksauth_keyval_t as a
* NUL-terminated string.
*/
const char * tor_socksauth_keyval_getstr_val(tor_socksauth_keyval_t *inp);
/** Set the value of the val field of a tor_socksauth_keyval_t to a
* given string of length 'len'. Return 0 on success; return -1 and
* set the error code on 'inp' on failure.
*/
int tor_socksauth_keyval_setstr0_val(tor_socksauth_keyval_t *inp, const char *val, size_t len);
/** Set the value of the val field of a tor_socksauth_keyval_t to a
* given NUL-terminated string. Return 0 on success; return -1 and set
* the error code on 'inp' on failure.
*/
int tor_socksauth_keyval_setstr_val(tor_socksauth_keyval_t *inp, const char *val);
/** Return a newly allocated socks5_client_request with all elements
* set to zero.
*/
socks5_client_request_t *socks5_client_request_new(void);
/** Release all storage held by the socks5_client_request in 'victim'.
* (Do nothing if 'victim' is NULL.)
*/
void socks5_client_request_free(socks5_client_request_t *victim);
/** Try to parse a socks5_client_request from the buffer in 'input',
* using up to 'len_in' bytes from the input buffer. On success,
* return the number of bytes consumed and set *output to the newly
* allocated socks5_client_request_t. On failure, return -2 if the
* input appears truncated, and -1 if the input is otherwise invalid.
*/
ssize_t socks5_client_request_parse(socks5_client_request_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
* socks5_client_request in 'obj'. On failure, return a negative
* value. Note that this value may be an overestimate, and can even be
* an underestimate for certain unencodeable objects.
*/
ssize_t socks5_client_request_encoded_len(const socks5_client_request_t *obj);
/** Try to encode the socks5_client_request from 'input' into the
* buffer at 'output', using up to 'avail' bytes of the output buffer.
* On success, return the number of bytes used. On failure, return -2
* if the buffer was not long enough, and -1 if the input was invalid.
*/
ssize_t socks5_client_request_encode(uint8_t *output, size_t avail, const socks5_client_request_t *input);
/** Check whether the internal state of the socks5_client_request in
* 'obj' is consistent. Return NULL if it is, and a short message if
* it is not.
*/
const char *socks5_client_request_check(const socks5_client_request_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
int socks5_client_request_clear_errors(socks5_client_request_t *obj);
/** Return the value of the version field of the
* socks5_client_request_t in 'inp'
*/
uint8_t socks5_client_request_get_version(const socks5_client_request_t *inp);
/** Set the value of the version field of the socks5_client_request_t
* in 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks5_client_request_set_version(socks5_client_request_t *inp, uint8_t val);
/** Return the value of the command field of the
* socks5_client_request_t in 'inp'
*/
uint8_t socks5_client_request_get_command(const socks5_client_request_t *inp);
/** Set the value of the command field of the socks5_client_request_t
* in 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks5_client_request_set_command(socks5_client_request_t *inp, uint8_t val);
/** Return the value of the reserved field of the
* socks5_client_request_t in 'inp'
*/
uint8_t socks5_client_request_get_reserved(const socks5_client_request_t *inp);
/** Set the value of the reserved field of the socks5_client_request_t
* in 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks5_client_request_set_reserved(socks5_client_request_t *inp, uint8_t val);
/** Return the value of the atype field of the socks5_client_request_t
* in 'inp'
*/
uint8_t socks5_client_request_get_atype(const socks5_client_request_t *inp);
/** Set the value of the atype field of the socks5_client_request_t in
* 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks5_client_request_set_atype(socks5_client_request_t *inp, uint8_t val);
/** Return the value of the dest_addr_ipv4 field of the
* socks5_client_request_t in 'inp'
*/
uint32_t socks5_client_request_get_dest_addr_ipv4(const socks5_client_request_t *inp);
/** Set the value of the dest_addr_ipv4 field of the
* socks5_client_request_t in 'inp' to 'val'. Return 0 on success;
* return -1 and set the error code on 'inp' on failure.
*/
int socks5_client_request_set_dest_addr_ipv4(socks5_client_request_t *inp, uint32_t val);
/** Return the (constant) length of the array holding the
* dest_addr_ipv6 field of the socks5_client_request_t in 'inp'.
*/
size_t socks5_client_request_getlen_dest_addr_ipv6(const socks5_client_request_t *inp);
/** Return the element at position 'idx' of the fixed array field
* dest_addr_ipv6 of the socks5_client_request_t in 'inp'.
*/
uint8_t socks5_client_request_get_dest_addr_ipv6(socks5_client_request_t *inp, size_t idx);
/** As socks5_client_request_get_dest_addr_ipv6, but take and return a
* const pointer
*/
uint8_t socks5_client_request_getconst_dest_addr_ipv6(const socks5_client_request_t *inp, size_t idx);
/** Change the element at position 'idx' of the fixed array field
* dest_addr_ipv6 of the socks5_client_request_t in 'inp', so that it
* will hold the value 'elt'.
*/
int socks5_client_request_set_dest_addr_ipv6(socks5_client_request_t *inp, size_t idx, uint8_t elt);
/** Return a pointer to the 16-element array field dest_addr_ipv6 of
* 'inp'.
*/
uint8_t * socks5_client_request_getarray_dest_addr_ipv6(socks5_client_request_t *inp);
/** As socks5_client_request_get_dest_addr_ipv6, but take and return a
* const pointer
*/
const uint8_t * socks5_client_request_getconstarray_dest_addr_ipv6(const socks5_client_request_t *inp);
/** Return the value of the dest_addr_domainname field of the
* socks5_client_request_t in 'inp'
*/
struct domainname_st * socks5_client_request_get_dest_addr_domainname(socks5_client_request_t *inp);
/** As socks5_client_request_get_dest_addr_domainname, but take and
* return a const pointer
*/
const struct domainname_st * socks5_client_request_getconst_dest_addr_domainname(const socks5_client_request_t *inp);
/** Set the value of the dest_addr_domainname field of the
* socks5_client_request_t in 'inp' to 'val'. Free the old value if
* any. Steals the referenceto 'val'.Return 0 on success; return -1
* and set the error code on 'inp' on failure.
*/
int socks5_client_request_set_dest_addr_domainname(socks5_client_request_t *inp, struct domainname_st *val);
/** As socks5_client_request_set_dest_addr_domainname, but does not
* free the previous value.
*/
int socks5_client_request_set0_dest_addr_domainname(socks5_client_request_t *inp, struct domainname_st *val);
/** Return the value of the dest_port field of the
* socks5_client_request_t in 'inp'
*/
uint16_t socks5_client_request_get_dest_port(const socks5_client_request_t *inp);
/** Set the value of the dest_port field of the
* socks5_client_request_t in 'inp' to 'val'. Return 0 on success;
* return -1 and set the error code on 'inp' on failure.
*/
int socks5_client_request_set_dest_port(socks5_client_request_t *inp, uint16_t val);
/** Return a newly allocated socks5_server_reply with all elements set
* to zero.
*/
socks5_server_reply_t *socks5_server_reply_new(void);
/** Release all storage held by the socks5_server_reply in 'victim'.
* (Do nothing if 'victim' is NULL.)
*/
void socks5_server_reply_free(socks5_server_reply_t *victim);
/** Try to parse a socks5_server_reply from the buffer in 'input',
* using up to 'len_in' bytes from the input buffer. On success,
* return the number of bytes consumed and set *output to the newly
* allocated socks5_server_reply_t. On failure, return -2 if the input
* appears truncated, and -1 if the input is otherwise invalid.
*/
ssize_t socks5_server_reply_parse(socks5_server_reply_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
* socks5_server_reply in 'obj'. On failure, return a negative value.
* Note that this value may be an overestimate, and can even be an
* underestimate for certain unencodeable objects.
*/
ssize_t socks5_server_reply_encoded_len(const socks5_server_reply_t *obj);
/** Try to encode the socks5_server_reply from 'input' into the buffer
* at 'output', using up to 'avail' bytes of the output buffer. On
* success, return the number of bytes used. On failure, return -2 if
* the buffer was not long enough, and -1 if the input was invalid.
*/
ssize_t socks5_server_reply_encode(uint8_t *output, size_t avail, const socks5_server_reply_t *input);
/** Check whether the internal state of the socks5_server_reply in
* 'obj' is consistent. Return NULL if it is, and a short message if
* it is not.
*/
const char *socks5_server_reply_check(const socks5_server_reply_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
int socks5_server_reply_clear_errors(socks5_server_reply_t *obj);
/** Return the value of the version field of the socks5_server_reply_t
* in 'inp'
*/
uint8_t socks5_server_reply_get_version(const socks5_server_reply_t *inp);
/** Set the value of the version field of the socks5_server_reply_t in
* 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks5_server_reply_set_version(socks5_server_reply_t *inp, uint8_t val);
/** Return the value of the reply field of the socks5_server_reply_t
* in 'inp'
*/
uint8_t socks5_server_reply_get_reply(const socks5_server_reply_t *inp);
/** Set the value of the reply field of the socks5_server_reply_t in
* 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks5_server_reply_set_reply(socks5_server_reply_t *inp, uint8_t val);
/** Return the value of the reserved field of the
* socks5_server_reply_t in 'inp'
*/
uint8_t socks5_server_reply_get_reserved(const socks5_server_reply_t *inp);
/** Set the value of the reserved field of the socks5_server_reply_t
* in 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks5_server_reply_set_reserved(socks5_server_reply_t *inp, uint8_t val);
/** Return the value of the atype field of the socks5_server_reply_t
* in 'inp'
*/
uint8_t socks5_server_reply_get_atype(const socks5_server_reply_t *inp);
/** Set the value of the atype field of the socks5_server_reply_t in
* 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks5_server_reply_set_atype(socks5_server_reply_t *inp, uint8_t val);
/** Return the value of the bind_addr_ipv4 field of the
* socks5_server_reply_t in 'inp'
*/
uint32_t socks5_server_reply_get_bind_addr_ipv4(const socks5_server_reply_t *inp);
/** Set the value of the bind_addr_ipv4 field of the
* socks5_server_reply_t in 'inp' to 'val'. Return 0 on success;
* return -1 and set the error code on 'inp' on failure.
*/
int socks5_server_reply_set_bind_addr_ipv4(socks5_server_reply_t *inp, uint32_t val);
/** Return the (constant) length of the array holding the
* bind_addr_ipv6 field of the socks5_server_reply_t in 'inp'.
*/
size_t socks5_server_reply_getlen_bind_addr_ipv6(const socks5_server_reply_t *inp);
/** Return the element at position 'idx' of the fixed array field
* bind_addr_ipv6 of the socks5_server_reply_t in 'inp'.
*/
uint8_t socks5_server_reply_get_bind_addr_ipv6(socks5_server_reply_t *inp, size_t idx);
/** As socks5_server_reply_get_bind_addr_ipv6, but take and return a
* const pointer
*/
uint8_t socks5_server_reply_getconst_bind_addr_ipv6(const socks5_server_reply_t *inp, size_t idx);
/** Change the element at position 'idx' of the fixed array field
* bind_addr_ipv6 of the socks5_server_reply_t in 'inp', so that it
* will hold the value 'elt'.
*/
int socks5_server_reply_set_bind_addr_ipv6(socks5_server_reply_t *inp, size_t idx, uint8_t elt);
/** Return a pointer to the 16-element array field bind_addr_ipv6 of
* 'inp'.
*/
uint8_t * socks5_server_reply_getarray_bind_addr_ipv6(socks5_server_reply_t *inp);
/** As socks5_server_reply_get_bind_addr_ipv6, but take and return a
* const pointer
*/
const uint8_t * socks5_server_reply_getconstarray_bind_addr_ipv6(const socks5_server_reply_t *inp);
/** Return the value of the bind_addr_domainname field of the
* socks5_server_reply_t in 'inp'
*/
struct domainname_st * socks5_server_reply_get_bind_addr_domainname(socks5_server_reply_t *inp);
/** As socks5_server_reply_get_bind_addr_domainname, but take and
* return a const pointer
*/
const struct domainname_st * socks5_server_reply_getconst_bind_addr_domainname(const socks5_server_reply_t *inp);
/** Set the value of the bind_addr_domainname field of the
* socks5_server_reply_t in 'inp' to 'val'. Free the old value if any.
* Steals the referenceto 'val'.Return 0 on success; return -1 and set
* the error code on 'inp' on failure.
*/
int socks5_server_reply_set_bind_addr_domainname(socks5_server_reply_t *inp, struct domainname_st *val);
/** As socks5_server_reply_set_bind_addr_domainname, but does not free
* the previous value.
*/
int socks5_server_reply_set0_bind_addr_domainname(socks5_server_reply_t *inp, struct domainname_st *val);
/** Return the value of the bind_port field of the
* socks5_server_reply_t in 'inp'
*/
uint16_t socks5_server_reply_get_bind_port(const socks5_server_reply_t *inp);
/** Set the value of the bind_port field of the socks5_server_reply_t
* in 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
int socks5_server_reply_set_bind_port(socks5_server_reply_t *inp, uint16_t val);
/** Return a newly allocated tor_extended_socks_auth_request with all
* elements set to zero.
*/
tor_extended_socks_auth_request_t *tor_extended_socks_auth_request_new(void);
/** Release all storage held by the tor_extended_socks_auth_request in
* 'victim'. (Do nothing if 'victim' is NULL.)
*/
void tor_extended_socks_auth_request_free(tor_extended_socks_auth_request_t *victim);
/** Try to parse a tor_extended_socks_auth_request from the buffer in
* 'input', using up to 'len_in' bytes from the input buffer. On
* success, return the number of bytes consumed and set *output to the
* newly allocated tor_extended_socks_auth_request_t. On failure,
* return -2 if the input appears truncated, and -1 if the input is
* otherwise invalid.
*/
ssize_t tor_extended_socks_auth_request_parse(tor_extended_socks_auth_request_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
* tor_extended_socks_auth_request in 'obj'. On failure, return a
* negative value. Note that this value may be an overestimate, and
* can even be an underestimate for certain unencodeable objects.
*/
ssize_t tor_extended_socks_auth_request_encoded_len(const tor_extended_socks_auth_request_t *obj);
/** Try to encode the tor_extended_socks_auth_request from 'input'
* into the buffer at 'output', using up to 'avail' bytes of the
* output buffer. On success, return the number of bytes used. On
* failure, return -2 if the buffer was not long enough, and -1 if the
* input was invalid.
*/
ssize_t tor_extended_socks_auth_request_encode(uint8_t *output, size_t avail, const tor_extended_socks_auth_request_t *input);
/** Check whether the internal state of the
* tor_extended_socks_auth_request in 'obj' is consistent. Return NULL
* if it is, and a short message if it is not.
*/
const char *tor_extended_socks_auth_request_check(const tor_extended_socks_auth_request_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
int tor_extended_socks_auth_request_clear_errors(tor_extended_socks_auth_request_t *obj);
/** Return the value of the version field of the
* tor_extended_socks_auth_request_t in 'inp'
*/
uint8_t tor_extended_socks_auth_request_get_version(const tor_extended_socks_auth_request_t *inp);
/** Set the value of the version field of the
* tor_extended_socks_auth_request_t in 'inp' to 'val'. Return 0 on
* success; return -1 and set the error code on 'inp' on failure.
*/
int tor_extended_socks_auth_request_set_version(tor_extended_socks_auth_request_t *inp, uint8_t val);
/** Return the value of the npairs field of the
* tor_extended_socks_auth_request_t in 'inp'
*/
uint16_t tor_extended_socks_auth_request_get_npairs(const tor_extended_socks_auth_request_t *inp);
/** Set the value of the npairs field of the
* tor_extended_socks_auth_request_t in 'inp' to 'val'. Return 0 on
* success; return -1 and set the error code on 'inp' on failure.
*/
int tor_extended_socks_auth_request_set_npairs(tor_extended_socks_auth_request_t *inp, uint16_t val);
/** Return the length of the dynamic array holding the pairs field of
* the tor_extended_socks_auth_request_t in 'inp'.
*/
size_t tor_extended_socks_auth_request_getlen_pairs(const tor_extended_socks_auth_request_t *inp);
/** Return the element at position 'idx' of the dynamic array field
* pairs of the tor_extended_socks_auth_request_t in 'inp'.
*/
struct tor_socksauth_keyval_st * tor_extended_socks_auth_request_get_pairs(tor_extended_socks_auth_request_t *inp, size_t idx);
/** As tor_extended_socks_auth_request_get_pairs, but take and return
* a const pointer
*/
const struct tor_socksauth_keyval_st * tor_extended_socks_auth_request_getconst_pairs(const tor_extended_socks_auth_request_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
* pairs of the tor_extended_socks_auth_request_t in 'inp', so that it
* will hold the value 'elt'. Free the previous value, if any.
*/
int tor_extended_socks_auth_request_set_pairs(tor_extended_socks_auth_request_t *inp, size_t idx, struct tor_socksauth_keyval_st * elt);
/** As tor_extended_socks_auth_request_set_pairs, but does not free
* the previous value.
*/
int tor_extended_socks_auth_request_set0_pairs(tor_extended_socks_auth_request_t *inp, size_t idx, struct tor_socksauth_keyval_st * elt);
/** Append a new element 'elt' to the dynamic array field pairs of the
* tor_extended_socks_auth_request_t in 'inp'.
*/
int tor_extended_socks_auth_request_add_pairs(tor_extended_socks_auth_request_t *inp, struct tor_socksauth_keyval_st * elt);
/** Return a pointer to the variable-length array field pairs of
* 'inp'.
*/
struct tor_socksauth_keyval_st * * tor_extended_socks_auth_request_getarray_pairs(tor_extended_socks_auth_request_t *inp);
/** As tor_extended_socks_auth_request_get_pairs, but take and return
* a const pointer
*/
const struct tor_socksauth_keyval_st * const * tor_extended_socks_auth_request_getconstarray_pairs(const tor_extended_socks_auth_request_t *inp);
/** Change the length of the variable-length array field pairs of
* 'inp' to 'newlen'.Fill extra elements with NULL; free removed
* elements. Return 0 on success; return -1 and set the error code on
* 'inp' on failure.
*/
int tor_extended_socks_auth_request_setlen_pairs(tor_extended_socks_auth_request_t *inp, size_t newlen);
/** Return a newly allocated tor_extended_socks_auth_response with all
* elements set to zero.
*/
tor_extended_socks_auth_response_t *tor_extended_socks_auth_response_new(void);
/** Release all storage held by the tor_extended_socks_auth_response
* in 'victim'. (Do nothing if 'victim' is NULL.)
*/
void tor_extended_socks_auth_response_free(tor_extended_socks_auth_response_t *victim);
/** Try to parse a tor_extended_socks_auth_response from the buffer in
* 'input', using up to 'len_in' bytes from the input buffer. On
* success, return the number of bytes consumed and set *output to the
* newly allocated tor_extended_socks_auth_response_t. On failure,
* return -2 if the input appears truncated, and -1 if the input is
* otherwise invalid.
*/
ssize_t tor_extended_socks_auth_response_parse(tor_extended_socks_auth_response_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
* tor_extended_socks_auth_response in 'obj'. On failure, return a
* negative value. Note that this value may be an overestimate, and
* can even be an underestimate for certain unencodeable objects.
*/
ssize_t tor_extended_socks_auth_response_encoded_len(const tor_extended_socks_auth_response_t *obj);
/** Try to encode the tor_extended_socks_auth_response from 'input'
* into the buffer at 'output', using up to 'avail' bytes of the
* output buffer. On success, return the number of bytes used. On
* failure, return -2 if the buffer was not long enough, and -1 if the
* input was invalid.
*/
ssize_t tor_extended_socks_auth_response_encode(uint8_t *output, size_t avail, const tor_extended_socks_auth_response_t *input);
/** Check whether the internal state of the
* tor_extended_socks_auth_response in 'obj' is consistent. Return
* NULL if it is, and a short message if it is not.
*/
const char *tor_extended_socks_auth_response_check(const tor_extended_socks_auth_response_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
int tor_extended_socks_auth_response_clear_errors(tor_extended_socks_auth_response_t *obj);
/** Return the value of the version field of the
* tor_extended_socks_auth_response_t in 'inp'
*/
uint8_t tor_extended_socks_auth_response_get_version(const tor_extended_socks_auth_response_t *inp);
/** Set the value of the version field of the
* tor_extended_socks_auth_response_t in 'inp' to 'val'. Return 0 on
* success; return -1 and set the error code on 'inp' on failure.
*/
int tor_extended_socks_auth_response_set_version(tor_extended_socks_auth_response_t *inp, uint8_t val);
/** Return the value of the status field of the
* tor_extended_socks_auth_response_t in 'inp'
*/
uint8_t tor_extended_socks_auth_response_get_status(const tor_extended_socks_auth_response_t *inp);
/** Set the value of the status field of the
* tor_extended_socks_auth_response_t in 'inp' to 'val'. Return 0 on
* success; return -1 and set the error code on 'inp' on failure.
*/
int tor_extended_socks_auth_response_set_status(tor_extended_socks_auth_response_t *inp, uint8_t val);
/** Return the value of the npairs field of the
* tor_extended_socks_auth_response_t in 'inp'
*/
uint16_t tor_extended_socks_auth_response_get_npairs(const tor_extended_socks_auth_response_t *inp);
/** Set the value of the npairs field of the
* tor_extended_socks_auth_response_t in 'inp' to 'val'. Return 0 on
* success; return -1 and set the error code on 'inp' on failure.
*/
int tor_extended_socks_auth_response_set_npairs(tor_extended_socks_auth_response_t *inp, uint16_t val);
/** Return the length of the dynamic array holding the pairs field of
* the tor_extended_socks_auth_response_t in 'inp'.
*/
size_t tor_extended_socks_auth_response_getlen_pairs(const tor_extended_socks_auth_response_t *inp);
/** Return the element at position 'idx' of the dynamic array field
* pairs of the tor_extended_socks_auth_response_t in 'inp'.
*/
struct tor_socksauth_keyval_st * tor_extended_socks_auth_response_get_pairs(tor_extended_socks_auth_response_t *inp, size_t idx);
/** As tor_extended_socks_auth_response_get_pairs, but take and return
* a const pointer
*/
const struct tor_socksauth_keyval_st * tor_extended_socks_auth_response_getconst_pairs(const tor_extended_socks_auth_response_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
* pairs of the tor_extended_socks_auth_response_t in 'inp', so that
* it will hold the value 'elt'. Free the previous value, if any.
*/
int tor_extended_socks_auth_response_set_pairs(tor_extended_socks_auth_response_t *inp, size_t idx, struct tor_socksauth_keyval_st * elt);
/** As tor_extended_socks_auth_response_set_pairs, but does not free
* the previous value.
*/
int tor_extended_socks_auth_response_set0_pairs(tor_extended_socks_auth_response_t *inp, size_t idx, struct tor_socksauth_keyval_st * elt);
/** Append a new element 'elt' to the dynamic array field pairs of the
* tor_extended_socks_auth_response_t in 'inp'.
*/
int tor_extended_socks_auth_response_add_pairs(tor_extended_socks_auth_response_t *inp, struct tor_socksauth_keyval_st * elt);
/** Return a pointer to the variable-length array field pairs of
* 'inp'.
*/
struct tor_socksauth_keyval_st * * tor_extended_socks_auth_response_getarray_pairs(tor_extended_socks_auth_response_t *inp);
/** As tor_extended_socks_auth_response_get_pairs, but take and return
* a const pointer
*/
const struct tor_socksauth_keyval_st * const * tor_extended_socks_auth_response_getconstarray_pairs(const tor_extended_socks_auth_response_t *inp);
/** Change the length of the variable-length array field pairs of
* 'inp' to 'newlen'.Fill extra elements with NULL; free removed
* elements. Return 0 on success; return -1 and set the error code on
* 'inp' on failure.
*/
int tor_extended_socks_auth_response_setlen_pairs(tor_extended_socks_auth_response_t *inp, size_t newlen);
#endif
|