Electroneum
Loading...
Searching...
No Matches
config_file.h
Go to the documentation of this file.
1/*
2 * util/config_file.h - reads and stores the config file for unbound.
3 *
4 * Copyright (c) 2007, NLnet Labs. All rights reserved.
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * Neither the name of the NLNET LABS nor the names of its contributors may
20 * be used to endorse or promote products derived from this software without
21 * specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
41
42#ifndef UTIL_CONFIG_FILE_H
43#define UTIL_CONFIG_FILE_H
44struct config_stub;
45struct config_auth;
46struct config_view;
47struct config_strlist;
48struct config_str2list;
49struct config_str3list;
51struct module_qstate;
52struct sock_list;
54struct regional;
55
63
71
78
81
83 int port;
85 int do_ip4;
87 int do_ip6;
91 int do_udp;
93 int do_tcp;
102
117
126
153
160
165 size_t so_rcvbuf;
167 size_t so_sndbuf;
174
178 char **ifs;
179
184 char **out_ifs;
185
198#ifdef CLIENT_SUBNET
201 struct config_strlist* client_subnet;
203 struct config_strlist* client_subnet_zone;
205 uint16_t client_subnet_opcode;
207 int client_subnet_always_forward;
209 uint8_t max_client_subnet_ipv4;
210 uint8_t max_client_subnet_ipv6;
211#endif
216
251
255 char* username;
259 char* logfile;
261 char* pidfile;
262
273
281 char* identity;
283 char* version;
284
287
306
332 unsigned int add_holddown;
334 unsigned int del_holddown;
336 unsigned int keep_missing;
339
346
378 char** tagname;
381
398
401
404
407
408 /* minimal response when positive answer */
410
411 /* RRSet roundrobin */
413
414 /* maximum UDP response size */
416
417 /* DNS64 prefix */
419
420 /* Synthetize all AAAA record despite the presence of an authoritative one */
422
435
448
451
460
482
507#ifdef USE_IPSECMOD
509 int ipsecmod_enabled;
511 struct config_strlist* ipsecmod_whitelist;
513 char* ipsecmod_hook;
515 int ipsecmod_ignore_bogus;
517 int ipsecmod_max_ttl;
519 int ipsecmod_strict;
520#endif
521
522 /* cachedb module */
523#ifdef USE_CACHEDB
525 char* cachedb_backend;
527 char* cachedb_secret;
528#ifdef USE_REDIS
530 char* redis_server_host;
532 int redis_server_port;
534 int redis_timeout;
535#endif
536#endif
537};
538
540extern uid_t cfg_uid;
542extern gid_t cfg_gid;
545
565
590
613
621 char* str;
622};
623
631 char* str;
633 char* str2;
634};
635
643 char* str;
645 char* str2;
647 char* str3;
648};
649
650
663
669
675
684int config_read(struct config_file* config, const char* filename,
685 const char* chroot);
686
692
698
704
714 const char* value);
715
725int config_get_option(struct config_file* cfg, const char* opt,
726 void (*func)(char*,void*), void* arg);
727
735int config_get_option_list(struct config_file* cfg, const char* opt,
736 struct config_strlist** list);
737
745int config_get_option_collate(struct config_file* cfg, const char* opt,
746 char** str);
747
753void config_print_func(char* line, void* arg);
754
760void config_collate_func(char* line, void* arg);
761
768
775int cfg_strlist_append(struct config_strlist_head* list, char* item);
776
784 const char* item);
785
792int cfg_strlist_insert(struct config_strlist** head, char* item);
793
796 struct config_strlist** head, char* item);
797
805int cfg_str2list_insert(struct config_str2list** head, char* item, char* i2);
806
815int cfg_str3list_insert(struct config_str3list** head, char* item, char* i2,
816 char* i3);
817
827 uint8_t* i2, size_t i2len);
828
838struct config_stub* cfg_stub_find(struct config_stub*** pp, const char* nm);
839
845
851
857
860
866
871void config_delstubs(struct config_stub* list);
872
878
883void config_delauths(struct config_auth* list);
884
890
895void config_delviews(struct config_view* list);
896
900
906time_t cfg_convert_timeval(const char* str);
907
918int cfg_count_numbers(const char* str);
919
929int cfg_parse_memsize(const char* str, size_t* res);
930
937int config_add_tag(struct config_file* cfg, const char* tag);
938
945int find_tag_id(struct config_file* cfg, const char* tag);
946
956 size_t* listlen);
957
965char* config_taglist2str(struct config_file* cfg, uint8_t* taglist,
966 size_t len);
967
976int taglist_intersect(uint8_t* list1, size_t list1len, uint8_t* list2,
977 size_t list2len);
978
985int cfg_parse_local_zone(struct config_file* cfg, const char* val);
986
996int cfg_mark_ports(const char* str, int allow, int* avail, int num);
997
1004int cfg_condense_ports(struct config_file* cfg, int** avail);
1005
1012int cfg_scan_ports(int* avail, int num);
1013
1023char* fname_after_chroot(const char* fname, struct config_file* cfg,
1024 int use_chdir);
1025
1031char* cfg_ptr_reverse(char* str);
1032
1039void errinf(struct module_qstate* qstate, const char* str);
1040
1049void errinf_origin(struct module_qstate* qstate, struct sock_list *origin);
1050
1056void errinf_rrset(struct module_qstate* qstate, struct ub_packed_rrset_key *rr);
1057
1064void errinf_dname(struct module_qstate* qstate, const char* str,
1065 uint8_t* dname);
1066
1073char* errinf_to_str(struct module_qstate* qstate);
1074
1082 int line;
1088 const char* chroot;
1089};
1090
1092extern struct config_parser_state* cfg_parser;
1096extern FILE* ub_c_in;
1098extern FILE* ub_c_out;
1100int ub_c_parse(void);
1102int ub_c_lex(void);
1104int ub_c_wrap(void);
1106void ub_c_error(const char* msg);
1108void ub_c_error_msg(const char* fmt, ...) ATTR_FORMAT(printf, 1, 2);
1109
1110#ifdef UB_ON_WINDOWS
1118char* w_lookup_reg_str(const char* key, const char* name);
1119
1121void w_config_adjust_directory(struct config_file* cfg);
1122#endif /* UB_ON_WINDOWS */
1123
1126
1127#endif /* UTIL_CONFIG_FILE_H */
int ub_c_lex(void)
void int fake_sha1
struct config_file * config_create_forlib(void)
void config_apply(struct config_file *config)
void config_collate_func(char *line, void *arg)
void errinf_origin(struct module_qstate *qstate, struct sock_list *origin)
int ub_c_parse(void)
int config_get_option(struct config_file *cfg, const char *opt, void(*func)(char *, void *), void *arg)
void errinf_rrset(struct module_qstate *qstate, struct ub_packed_rrset_key *rr)
uid_t cfg_uid
int taglist_intersect(uint8_t *list1, size_t list1len, uint8_t *list2, size_t list2len)
void config_delete(struct config_file *config)
int find_tag_id(struct config_file *cfg, const char *tag)
FILE * ub_c_out
int cfg_strlist_append(struct config_strlist_head *list, char *item)
void config_del_strbytelist(struct config_strbytelist *list)
void config_delstub(struct config_stub *p)
struct config_strlist * cfg_strlist_find(struct config_strlist *head, const char *item)
void config_delstubs(struct config_stub *list)
void int fake_dsa
char * errinf_to_str(struct module_qstate *qstate)
int cfg_region_strlist_insert(struct regional *region, struct config_strlist **head, char *item)
void errinf_dname(struct module_qstate *qstate, const char *str, uint8_t *dname)
int cfg_parse_memsize(const char *str, size_t *res)
char * config_collate_cat(struct config_strlist *list)
int config_add_tag(struct config_file *cfg, const char *tag)
void ub_c_error_msg(const char *fmt,...) ATTR_FORMAT(printf
int config_get_option_list(struct config_file *cfg, const char *opt, struct config_strlist **list)
int cfg_strbytelist_insert(struct config_strbytelist **head, char *item, uint8_t *i2, size_t i2len)
int autr_permit_small_holddown
void config_deldblstrlist(struct config_str2list *list)
struct config_parser_state * cfg_parser
int cfg_strlist_insert(struct config_strlist **head, char *item)
void config_delauths(struct config_auth *list)
int options_remote_is_address(struct config_file *cfg)
void errinf(struct module_qstate *qstate, const char *str)
int cfg_mark_ports(const char *str, int allow, int *avail, int num)
void config_delview(struct config_view *p)
void config_delauth(struct config_auth *p)
struct config_stub * cfg_stub_find(struct config_stub ***pp, const char *nm)
int config_set_option(struct config_file *config, const char *option, const char *value)
gid_t cfg_gid
time_t cfg_convert_timeval(const char *str)
void config_deltrplstrlist(struct config_str3list *list)
int cfg_str3list_insert(struct config_str3list **head, char *item, char *i2, char *i3)
int config_read(struct config_file *config, const char *filename, const char *chroot)
uint8_t * config_parse_taglist(struct config_file *cfg, char *str, size_t *listlen)
void config_lookup_uid(struct config_file *config)
char * fname_after_chroot(const char *fname, struct config_file *cfg, int use_chdir)
int cfg_condense_ports(struct config_file *cfg, int **avail)
int cfg_count_numbers(const char *str)
void ub_c_error(const char *msg)
void init_cfg_parse(void)
int cfg_parse_local_zone(struct config_file *cfg, const char *val)
int ub_c_wrap(void)
void config_delstrlist(struct config_strlist *list)
int cfg_scan_ports(int *avail, int num)
FILE * ub_c_in
void config_delviews(struct config_view *list)
char * cfg_ptr_reverse(char *str)
int cfg_str2list_insert(struct config_str2list **head, char *item, char *i2)
struct config_file * config_create(void)
void config_print_func(char *line, void *arg)
char * config_taglist2str(struct config_file *cfg, uint8_t *taglist, size_t len)
int config_get_option_collate(struct config_file *cfg, const char *opt, char **str)
const char * res
const char * key
struct rule_list head
const GenericPointer< typename T::ValueType > T2 value
Definition pointer.h:1225
unsigned short uint16_t
Definition stdint.h:125
signed int int32_t
Definition stdint.h:123
unsigned char uint8_t
Definition stdint.h:124
int fallback_enabled
struct config_strlist * allow_notify
struct config_strlist * urls
struct config_strlist * masters
struct config_auth * next
char * zonefile
int hide_trustanchor
size_t max_udp_size
char * dnstap_version
unsigned int keep_missing
size_t edns_buffer_size
size_t infra_cache_numhosts
int dnstap_log_resolver_query_messages
char * ssl_service_key
int ip_ratelimit_factor
int max_negative_ttl
struct config_strlist * dlv_anchor_list
int val_log_squelch
size_t dnscrypt_shared_secret_cache_slabs
size_t jostle_time
struct config_strlist * trusted_keys_file_list
int permit_small_holddown
struct config_strbytelist * acl_tags
char * server_key_file
char * pidfile
int ratelimit_factor
struct config_strlist * private_domain
int trust_anchor_signaling
char * python_script
char * control_cert_file
struct config_stub * stubs
size_t dnscrypt_shared_secret_cache_size
size_t dnscrypt_nonce_cache_slabs
int local_zones_disable_default
size_t infra_cache_slabs
int harden_short_bufsize
int outgoing_num_ports
struct config_str3list * local_zone_overrides
int32_t val_sig_skew_max
struct config_strlist * dnscrypt_provider_cert
struct config_str2list * acls
char * module_conf
char * log_identity
struct config_strlist * donotqueryaddrs
char * identity
char * dnstap_identity
size_t neg_cache_size
int root_key_sentinel
struct config_strlist * root_hints
size_t rrset_cache_slabs
int use_caps_bits_for_id
size_t num_queries_per_thread
char * directory
int infra_cache_min_rtt
struct config_stub * forwards
int qname_minimisation_strict
struct config_str2list * local_zones
int harden_algo_downgrade
int dnstap_log_client_response_messages
struct config_str2list * respip_actions
struct config_str2list * acl_view
struct config_strlist * private_address
struct config_strlist * dnscrypt_secret_key
int aggressive_nsec
size_t incoming_num_tcp
char * ssl_service_pem
char * target_fetch_policy
int dnstap_send_version
size_t unwanted_threshold
int udp_upstream_without_downstream
Definition config_file.h:97
int outgoing_tcp_mss
size_t outgoing_num_tcp
struct config_strlist * dnscrypt_provider_cert_rotated
struct config_strlist * auto_trust_anchor_file_list
struct config_strlist_head control_ifs
size_t ratelimit_slabs
size_t key_cache_size
size_t msg_cache_size
int harden_dnssec_stripped
char * chrootdir
struct config_auth * auths
int unblock_lan_zones
char * dnstap_socket_path
int stat_cumulative
Definition config_file.h:75
int val_permissive_mode
int stat_interval
Definition config_file.h:73
int disable_dnssec_lame_check
int donotquery_localhost
int harden_large_queries
int harden_referral_path
int harden_below_nxdomain
struct config_strbytelist * respip_tags
unsigned int add_holddown
char ** ifs
int32_t val_date_override
size_t ratelimit_size
struct config_view * views
int val_clean_additional
struct config_str2list * ratelimit_for_domain
unsigned int del_holddown
char * tls_cert_bundle
char * dnscrypt_provider
size_t so_sndbuf
size_t ip_ratelimit_size
struct config_strbytelist * local_zone_tags
struct config_str2list * ratelimit_below_domain
int dnstap_log_client_query_messages
char * server_cert_file
struct config_str3list * acl_tag_actions
int insecure_lan_zones
char * dns64_prefix
char * logfile
int dnstap_log_forwarder_query_messages
int stat_extended
Definition config_file.h:77
int dnstap_log_resolver_response_messages
char * control_key_file
char * dlv_anchor_file
struct config_strlist * trust_anchor_file_list
size_t rrset_cache_size
struct config_strlist * domain_insecure
struct config_strlist * caps_whitelist
size_t ip_ratelimit_slabs
size_t so_rcvbuf
size_t dnscrypt_nonce_cache_size
struct config_strlist * tls_additional_port
struct config_strlist * local_zones_nodefault
int rrset_roundrobin
int dnstap_send_identity
struct config_str3list * acl_tag_datas
size_t msg_buffer_size
char * version
char ** tagname
struct config_strlist * local_data
int32_t val_sig_skew_min
int qname_minimisation
char * username
size_t msg_cache_slabs
int remote_control_enable
int minimal_responses
char * val_nsec3_key_iterations
int dnstap_log_forwarder_response_messages
int control_use_cert
int * outgoing_avail_ports
size_t key_cache_slabs
struct config_str2list * respip_data
struct config_strlist * trust_anchor_list
char ** out_ifs
struct config_file * cfg
const char * chroot
struct config_str2list * next
struct config_str3list * next
struct config_strbytelist * next
struct config_strlist * last
Definition config_file.h:61
struct config_strlist * first
Definition config_file.h:59
struct config_strlist * next
struct config_stub * next
struct config_strlist * hosts
struct config_strlist * addrs
struct config_str2list * respip_actions
struct config_str2list * respip_data
struct config_strlist * local_data
struct config_str2list * local_zones
struct config_view * next
struct config_strlist * local_zones_nodefault