forked from yrutschle/sslh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sslh-conf.c
2454 lines (2178 loc) · 84.2 KB
/
sslh-conf.c
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
/* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README)
* on Sun Sep 11 21:43:25 2022.
# conf2struct: generate libconf parsers that read to structs
# Copyright (C) 2018-2021 Yves Rutschle
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
*/
#define _GNU_SOURCE
#include <string.h>
#ifdef LIBCONFIG
# include <libconfig.h>
#endif
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include "sslh-conf.h"
#include "argtable3.h"
#ifdef LIBPCRE
#define PCRE2_CODE_UNIT_WIDTH 8
#include <pcre2.h>
typedef struct {
PCRE2_SIZE rm_so;
PCRE2_SIZE rm_eo;
} regmatch_t;
#else
#include <regex.h>
#endif
/* This gets included in the output .c file */
/* Libconfig 1.4.9 is still used by major distributions
* (e.g. CentOS7) and had a different name for
* config_setting_lookup */
#if LIBCONFIG_VER_MAJOR == 1
#if LIBCONFIG_VER_MINOR == 4
#if LIBCONFIG_VER_REVISION == 9
#define config_setting_lookup config_lookup_from
#endif
#endif
#endif
/* config_type, lookup_fns, type2str are related, keep them together */
typedef enum {
CFG_BOOL,
CFG_INT,
CFG_INT64,
CFG_FLOAT,
CFG_STRING,
CFG_GROUP,
CFG_ARRAY,
CFG_LIST,
} config_type;
/* /config_type */
const char* type2str[] = {
"boolean",
"int",
"int64",
"float",
"string",
"group",
"array",
"list",
};
typedef union {
int def_bool;
int def_int;
long long def_int64;
double def_float;
char* def_string;
} any_val;
struct config_desc {
const char* name;
int type;
struct config_desc * sub_group; /* Table for compound types (list and group) */
void* arg_cl; /* command-line argument for this setting */
void* base_addr; /* Base of the structure (filled at runtime). Probably not useable for list elements */
size_t offset; /* Offset of setting in the structure */
size_t offset_len; /* Offset of *_len field, for arrays and lists */
size_t offset_present; /* offset of *_is_present field, for optional settings */
size_t size; /* Size of element, or size of group for groups and lists */
int array_type; /* type of array elements, when type == CFG_ARRAY */
int mandatory;
int optional;
any_val default_val;
};
#ifndef LIBCONFIG
/* Stubs in case you don't want libconfig */
typedef void config_setting_t;
typedef int config_t;
#define CONFIG_TRUE 1
#define CONFIG_FALSE 0
#define make_config_setting_lookup(type) \
int config_setting_lookup_##type(const config_setting_t* a, const char* b, void* c) { \
return 0; \
}
#define make_config_setting_get(type, ret_type) \
ret_type config_setting_get_##type(const config_setting_t* a) { \
return 0; \
}
enum {
CONFIG_TYPE_INT,
CONFIG_TYPE_BOOL,
CONFIG_TYPE_INT64,
CONFIG_TYPE_FLOAT,
CONFIG_TYPE_STRING
};
make_config_setting_lookup(bool);
make_config_setting_lookup(int);
make_config_setting_lookup(int64);
make_config_setting_lookup(float);
make_config_setting_lookup(string);
make_config_setting_get(bool, int);
make_config_setting_get(int, int);
make_config_setting_get(int64, long long int);
make_config_setting_get(float, double);
make_config_setting_get(string, char*);
config_setting_t* config_root_setting(config_t* c) {
return NULL;
}
config_setting_t* config_lookup(config_t* c, const char* b) {
return NULL;
}
void config_init(config_t* c) {
return;
}
char* config_setting_name(config_setting_t* c) {
return NULL;
}
int config_setting_is_list(config_setting_t* c) {
return 0;
}
int config_setting_is_array(config_setting_t* c) {
return 0;
}
int config_setting_is_scalar(config_setting_t* c) {
return 0;
}
int config_setting_index(const config_setting_t *setting) {
return 0;
}
config_setting_t* config_setting_lookup(config_setting_t* a, char* b) {
return NULL;
}
int config_setting_remove(config_setting_t* cfg, char* name) {
return 0;
}
int config_setting_type(config_setting_t* s) {
return -1;
}
int config_setting_length(config_setting_t* a) {
return 0;
}
config_setting_t* config_setting_get_elem(config_setting_t* a, int i) {
return NULL;
}
int config_read_file(config_t* a, const char* b) {
return CONFIG_TRUE;
}
int config_error_line(config_t* c) {
return 0;
}
char* config_error_text(config_t* c) {
return NULL;
}
#endif
/* This is the same as config_setting_lookup_string() except
it allocates a new string which belongs to the caller */
static int myconfig_setting_lookup_stringcpy(
const config_setting_t* setting,
const char* name,
char** value)
{
const char* str;
*value = NULL;
if (config_setting_lookup_string(setting, name, &str) == CONFIG_TRUE) {
asprintf(value, "%s", str);
return CONFIG_TRUE;
} else {
return CONFIG_FALSE;
}
}
typedef int (*lookup_fn)(const config_setting_t*, const char*, void*);
lookup_fn lookup_fns[] = {
(lookup_fn)config_setting_lookup_bool,
(lookup_fn)config_setting_lookup_int,
(lookup_fn)config_setting_lookup_int64,
(lookup_fn)config_setting_lookup_float,
(lookup_fn)myconfig_setting_lookup_stringcpy,
NULL, /* CFG_GROUP */
NULL, /* CFG_ARRAY */
NULL, /* CFG_LIST */
};
/* Copy an any_val to arbitrary memory location */
/* 0: success
* <0: error */
static int any_valcpy(config_type type, void* target, any_val val)
{
switch(type) {
case CFG_BOOL:
*(int*)target = val.def_bool;
break;
case CFG_INT:
*(int*)target = val.def_int;
break;
case CFG_INT64:
*(long long*)target = val.def_int64;
break;
case CFG_FLOAT:
*(double*)target = val.def_float;
break;
case CFG_STRING:
*(char**)target = val.def_string;
break;
default:
fprintf(stderr, "Unknown type specification %d\n", type);
return -1;
}
return 1;
}
/* Copy the value of a setting to an arbitrary memory that
* must be large enough */
/* 0: success
* <0: error */
static int settingcpy(config_type type, void* target, const config_setting_t* setting)
{
any_val val;
char* str;
switch(type) {
case CFG_BOOL:
val.def_bool = config_setting_get_bool(setting);
*(int*)target = val.def_bool;
break;
case CFG_INT:
val.def_int = config_setting_get_int(setting);
*(int*)target = val.def_int;
break;
case CFG_INT64:
val.def_int64 = config_setting_get_int64(setting);
*(long long*)target = val.def_int64;
break;
case CFG_FLOAT:
val.def_float = config_setting_get_float(setting);
*(double*)target = val.def_int64;
break;
case CFG_STRING:
asprintf(&str, "%s", config_setting_get_string(setting));
val.def_string = str;
*(char**)target = val.def_string;
break;
default:
fprintf(stderr, "Unknown type specification %d\n", type);
return -1;
}
return 0;
}
/* Copy the value of a command line arg to arbitrary memory
* that must be large enough for the type */
/* 0: success
* <0: error */
static int clcpy(config_type type, void* target, const void* cl_arg)
{
any_val val;
char* str;
switch(type) {
case CFG_BOOL:
val.def_bool = (*(struct arg_lit**)cl_arg)->count;
*(int*)target = val.def_bool;
break;
case CFG_INT:
val.def_int = (*(struct arg_int**)cl_arg)->ival[0];
*(int*)target = val.def_int;
break;
case CFG_INT64:
val.def_int64 = (*(struct arg_int**)cl_arg)->ival[0];
*(long long*)target = val.def_int64;
break;
case CFG_FLOAT:
val.def_float = (*(struct arg_dbl**)cl_arg)->dval[0];
*(double*)target = val.def_float;
break;
case CFG_STRING:
asprintf(&str, "%s", (*(struct arg_str**)cl_arg)->sval[0]);
val.def_string = str;
*(char**)target = val.def_string;
break;
default:
fprintf(stderr, "Unknown type specification %d\n", type);
return -1;
}
return 0;
}
/* Copy the value of a string argument to arbitary memory
* location that must be large enough, converting on the way
* (i.e. CFG_INT gets atoi() and so on) */
/* 0: success
* <0: error */
static int stringcpy(config_type type, void* target, char* from)
{
any_val val;
switch(type) {
case CFG_BOOL:
val.def_bool = (*from != '0');
*(int*)target = val.def_bool;
break;
case CFG_INT:
val.def_int = strtol(from, NULL, 10);
*(int*)target = val.def_int;
break;
case CFG_INT64:
val.def_int64 = strtoll(from, NULL, 10);
*(long long*)target = val.def_int64;
break;
case CFG_FLOAT:
val.def_float = strtod(from, NULL);
*(double*)target = val.def_float;
break;
case CFG_STRING:
val.def_string = from;
*(char**)target = val.def_string;
break;
default:
fprintf(stderr, "Unknown type specification %d\n", type);
return -1;
}
return 0;
}
/* Element to describe the target of a compound element
* element: which config entry is being changed
* match: if >0, index in pmatch to set
* if 0, don't match but init with value
* value: constant if not matching */
struct compound_cl_target {
struct config_desc * element;
int match;
any_val value;
};
/* Element to describe one compound command line argument
* An argument is string that gets matched against a regex,
* then match-groups get evaluated to each targets[].
* For lists, base_entry points to the config_setting so we
* can append to it */
struct compound_cl_arg {
const char* regex;
struct arg_str** arg_cl; /* arg_str entry for this compound option */
struct config_desc * base_entry;
struct compound_cl_target* targets;
/* If override_desc is set, it points to the descriptor of the element in
the group which will be checked for override. Then, override_matchindex
indicates the command-line parameter match used to compare against
override_desc to know if this group is overridden. If override_matchindex
is 0, we don't match from the command-line but from a constant stored in
override_const instead */
struct config_desc * override_desc;
int override_matchindex;
char* override_const;
};
struct arg_file* sslhcfg_conffile;
struct arg_int* sslhcfg_verbose_config;
struct arg_int* sslhcfg_verbose_config_error;
struct arg_int* sslhcfg_verbose_connections;
struct arg_int* sslhcfg_verbose_connections_try;
struct arg_int* sslhcfg_verbose_connections_error;
struct arg_int* sslhcfg_verbose_fd;
struct arg_int* sslhcfg_verbose_packets;
struct arg_int* sslhcfg_verbose_probe_info;
struct arg_int* sslhcfg_verbose_probe_error;
struct arg_int* sslhcfg_verbose_system_error;
struct arg_int* sslhcfg_verbose_int_error;
struct arg_lit* sslhcfg_version;
struct arg_lit* sslhcfg_foreground;
struct arg_lit* sslhcfg_inetd;
struct arg_lit* sslhcfg_numeric;
struct arg_lit* sslhcfg_transparent;
struct arg_int* sslhcfg_timeout;
struct arg_int* sslhcfg_udp_max_connections;
struct arg_str* sslhcfg_user;
struct arg_str* sslhcfg_pidfile;
struct arg_str* sslhcfg_chroot;
struct arg_str* sslhcfg_syslog_facility;
struct arg_str* sslhcfg_logfile;
struct arg_str* sslhcfg_on_timeout;
struct arg_str* sslhcfg_prefix;
struct arg_str* sslhcfg_listen;
struct arg_str* sslhcfg_ssh;
struct arg_str* sslhcfg_tls;
struct arg_str* sslhcfg_openvpn;
struct arg_str* sslhcfg_tinc;
struct arg_str* sslhcfg_wireguard;
struct arg_str* sslhcfg_xmpp;
struct arg_str* sslhcfg_http;
struct arg_str* sslhcfg_adb;
struct arg_str* sslhcfg_socks5;
struct arg_str* sslhcfg_syslog;
struct arg_str* sslhcfg_msrdp;
struct arg_str* sslhcfg_anyprot;
struct arg_end* sslhcfg_end;
static struct config_desc table_sslhcfg_protocols[] = {
{
/* name */ "name",
/* type */ CFG_STRING,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_protocols_item, name),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(char*),
/* array_type */ -1,
/* mandatory */ 1,
/* optional */ 0,
/* default_val*/ .default_val.def_string = NULL
},
{
/* name */ "host",
/* type */ CFG_STRING,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_protocols_item, host),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(char*),
/* array_type */ -1,
/* mandatory */ 1,
/* optional */ 0,
/* default_val*/ .default_val.def_string = NULL
},
{
/* name */ "port",
/* type */ CFG_STRING,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_protocols_item, port),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(char*),
/* array_type */ -1,
/* mandatory */ 1,
/* optional */ 0,
/* default_val*/ .default_val.def_string = NULL
},
{
/* name */ "service",
/* type */ CFG_STRING,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_protocols_item, service),
/* offset_len */ 0,
/* offset_present */ offsetof(struct sslhcfg_protocols_item, service_is_present),
/* size */ sizeof(char*),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 1,
/* default_val*/ .default_val.def_string = NULL
},
{
/* name */ "is_udp",
/* type */ CFG_BOOL,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_protocols_item, is_udp),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_bool = 0
},
{
/* name */ "udp_timeout",
/* type */ CFG_INT,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_protocols_item, udp_timeout),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_int = 60
},
{
/* name */ "fork",
/* type */ CFG_BOOL,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_protocols_item, fork),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_bool = 0
},
{
/* name */ "tfo_ok",
/* type */ CFG_BOOL,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_protocols_item, tfo_ok),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_bool = 0
},
{
/* name */ "transparent",
/* type */ CFG_BOOL,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_protocols_item, transparent),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_bool = 0
},
{
/* name */ "resolve_on_forward",
/* type */ CFG_BOOL,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_protocols_item, resolve_on_forward),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_bool = 0
},
{
/* name */ "log_level",
/* type */ CFG_INT,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_protocols_item, log_level),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_int = 1
},
{
/* name */ "keepalive",
/* type */ CFG_BOOL,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_protocols_item, keepalive),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_bool = 0
},
{
/* name */ "sni_hostnames",
/* type */ CFG_ARRAY,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_protocols_item, sni_hostnames),
/* offset_len */ offsetof(struct sslhcfg_protocols_item, sni_hostnames_len),
/* offset_present */ 0,
/* size */ sizeof(char*),
/* array_type */ CFG_STRING,
/* mandatory */ 1,
/* optional */ 0,
/* default_val*/ .default_val.def_int = 0
},
{
/* name */ "alpn_protocols",
/* type */ CFG_ARRAY,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_protocols_item, alpn_protocols),
/* offset_len */ offsetof(struct sslhcfg_protocols_item, alpn_protocols_len),
/* offset_present */ 0,
/* size */ sizeof(char*),
/* array_type */ CFG_STRING,
/* mandatory */ 1,
/* optional */ 0,
/* default_val*/ .default_val.def_int = 0
},
{
/* name */ "regex_patterns",
/* type */ CFG_ARRAY,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_protocols_item, regex_patterns),
/* offset_len */ offsetof(struct sslhcfg_protocols_item, regex_patterns_len),
/* offset_present */ 0,
/* size */ sizeof(char*),
/* array_type */ CFG_STRING,
/* mandatory */ 1,
/* optional */ 0,
/* default_val*/ .default_val.def_int = 0
},
{
/* name */ "minlength",
/* type */ CFG_INT,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_protocols_item, minlength),
/* offset_len */ 0,
/* offset_present */ offsetof(struct sslhcfg_protocols_item, minlength_is_present),
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 1,
/* default_val*/ .default_val.def_int = 0
},
{ 0 }
};
static struct config_desc table_sslhcfg_listen[] = {
{
/* name */ "host",
/* type */ CFG_STRING,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_listen_item, host),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(char*),
/* array_type */ -1,
/* mandatory */ 1,
/* optional */ 0,
/* default_val*/ .default_val.def_string = NULL
},
{
/* name */ "port",
/* type */ CFG_STRING,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_listen_item, port),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(char*),
/* array_type */ -1,
/* mandatory */ 1,
/* optional */ 0,
/* default_val*/ .default_val.def_string = NULL
},
{
/* name */ "is_udp",
/* type */ CFG_BOOL,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_listen_item, is_udp),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_bool = 0
},
{
/* name */ "keepalive",
/* type */ CFG_BOOL,
/* sub_group*/ NULL,
/* arg_cl */ NULL,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_listen_item, keepalive),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_bool = 0
},
{ 0 }
};
static struct config_desc table_sslhcfg[] = {
{
/* name */ "verbose_config",
/* type */ CFG_INT,
/* sub_group*/ NULL,
/* arg_cl */ & sslhcfg_verbose_config,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_item, verbose_config),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_int = 0
},
{
/* name */ "verbose_config_error",
/* type */ CFG_INT,
/* sub_group*/ NULL,
/* arg_cl */ & sslhcfg_verbose_config_error,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_item, verbose_config_error),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_int = 3
},
{
/* name */ "verbose_connections",
/* type */ CFG_INT,
/* sub_group*/ NULL,
/* arg_cl */ & sslhcfg_verbose_connections,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_item, verbose_connections),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_int = 3
},
{
/* name */ "verbose_connections_try",
/* type */ CFG_INT,
/* sub_group*/ NULL,
/* arg_cl */ & sslhcfg_verbose_connections_try,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_item, verbose_connections_try),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_int = 0
},
{
/* name */ "verbose_connections_error",
/* type */ CFG_INT,
/* sub_group*/ NULL,
/* arg_cl */ & sslhcfg_verbose_connections_error,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_item, verbose_connections_error),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_int = 3
},
{
/* name */ "verbose_fd",
/* type */ CFG_INT,
/* sub_group*/ NULL,
/* arg_cl */ & sslhcfg_verbose_fd,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_item, verbose_fd),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_int = 0
},
{
/* name */ "verbose_packets",
/* type */ CFG_INT,
/* sub_group*/ NULL,
/* arg_cl */ & sslhcfg_verbose_packets,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_item, verbose_packets),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_int = 0
},
{
/* name */ "verbose_probe_info",
/* type */ CFG_INT,
/* sub_group*/ NULL,
/* arg_cl */ & sslhcfg_verbose_probe_info,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_item, verbose_probe_info),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_int = 0
},
{
/* name */ "verbose_probe_error",
/* type */ CFG_INT,
/* sub_group*/ NULL,
/* arg_cl */ & sslhcfg_verbose_probe_error,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_item, verbose_probe_error),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_int = 3
},
{
/* name */ "verbose_system_error",
/* type */ CFG_INT,
/* sub_group*/ NULL,
/* arg_cl */ & sslhcfg_verbose_system_error,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_item, verbose_system_error),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_int = 3
},
{
/* name */ "verbose_int_error",
/* type */ CFG_INT,
/* sub_group*/ NULL,
/* arg_cl */ & sslhcfg_verbose_int_error,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_item, verbose_int_error),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_int = 3
},
{
/* name */ "version",
/* type */ CFG_BOOL,
/* sub_group*/ NULL,
/* arg_cl */ & sslhcfg_version,