xref: /freebsd/contrib/unbound/util/config_file.h (revision db3cb3640f547c063293e9fdc4db69e9dc120951)
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 
36 /**
37  * \file
38  *
39  * This file contains functions for the config file.
40  */
41 
42 #ifndef UTIL_CONFIG_FILE_H
43 #define UTIL_CONFIG_FILE_H
44 struct config_stub;
45 struct config_strlist;
46 struct config_str2list;
47 struct module_qstate;
48 struct sock_list;
49 struct ub_packed_rrset_key;
50 
51 /**
52  * The configuration options.
53  * Strings are malloced.
54  */
55 struct config_file {
56 	/** verbosity level as specified in the config file */
57 	int verbosity;
58 
59 	/** statistics interval (in seconds) */
60 	int stat_interval;
61 	/** if false, statistics values are reset after printing them */
62 	int stat_cumulative;
63 	/** if true, the statistics are kept in greater detail */
64 	int stat_extended;
65 
66 	/** number of threads to create */
67 	int num_threads;
68 
69 	/** port on which queries are answered. */
70 	int port;
71 	/** do ip4 query support. */
72 	int do_ip4;
73 	/** do ip6 query support. */
74 	int do_ip6;
75 	/** do udp query support. */
76 	int do_udp;
77 	/** do tcp query support. */
78 	int do_tcp;
79 	/** tcp upstream queries (no UDP upstream queries) */
80 	int tcp_upstream;
81 
82 	/** private key file for dnstcp-ssl service (enabled if not NULL) */
83 	char* ssl_service_key;
84 	/** public key file for dnstcp-ssl service */
85 	char* ssl_service_pem;
86 	/** port on which to provide ssl service */
87 	int ssl_port;
88 	/** if outgoing tcp connections use SSL */
89 	int ssl_upstream;
90 
91 	/** outgoing port range number of ports (per thread) */
92 	int outgoing_num_ports;
93 	/** number of outgoing tcp buffers per (per thread) */
94 	size_t outgoing_num_tcp;
95 	/** number of incoming tcp buffers per (per thread) */
96 	size_t incoming_num_tcp;
97 	/** allowed udp port numbers, array with 0 if not allowed */
98 	int* outgoing_avail_ports;
99 
100 	/** EDNS buffer size to use */
101 	size_t edns_buffer_size;
102 	/** number of bytes buffer size for DNS messages */
103 	size_t msg_buffer_size;
104 	/** size of the message cache */
105 	size_t msg_cache_size;
106 	/** slabs in the message cache. */
107 	size_t msg_cache_slabs;
108 	/** number of queries every thread can service */
109 	size_t num_queries_per_thread;
110 	/** number of msec to wait before items can be jostled out */
111 	size_t jostle_time;
112 	/** size of the rrset cache */
113 	size_t rrset_cache_size;
114 	/** slabs in the rrset cache */
115 	size_t rrset_cache_slabs;
116 	/** host cache ttl in seconds */
117 	int host_ttl;
118 	/** number of slabs in the infra host cache */
119 	size_t infra_cache_slabs;
120 	/** max number of hosts in the infra cache */
121 	size_t infra_cache_numhosts;
122 	/** delay close of udp-timeouted ports, if 0 no delayclose. in msec */
123 	int delay_close;
124 
125 	/** the target fetch policy for the iterator */
126 	char* target_fetch_policy;
127 
128 	/** automatic interface for incoming messages. Uses ipv6 remapping,
129 	 * and recvmsg/sendmsg ancillary data to detect interfaces, boolean */
130 	int if_automatic;
131 	/** SO_RCVBUF size to set on port 53 UDP socket */
132 	size_t so_rcvbuf;
133 	/** SO_SNDBUF size to set on port 53 UDP socket */
134 	size_t so_sndbuf;
135 	/** SO_REUSEPORT requested on port 53 sockets */
136 	int so_reuseport;
137 
138 	/** number of interfaces to open. If 0 default all interfaces. */
139 	int num_ifs;
140 	/** interface description strings (IP addresses) */
141 	char **ifs;
142 
143 	/** number of outgoing interfaces to open.
144 	 * If 0 default all interfaces. */
145 	int num_out_ifs;
146 	/** outgoing interface description strings (IP addresses) */
147 	char **out_ifs;
148 
149 	/** the root hints */
150 	struct config_strlist* root_hints;
151 	/** the stub definitions, linked list */
152 	struct config_stub* stubs;
153 	/** the forward zone definitions, linked list */
154 	struct config_stub* forwards;
155 	/** list of donotquery addresses, linked list */
156 	struct config_strlist* donotqueryaddrs;
157 	/** list of access control entries, linked list */
158 	struct config_str2list* acls;
159 	/** use default localhost donotqueryaddr entries */
160 	int donotquery_localhost;
161 
162 	/** harden against very small edns buffer sizes */
163 	int harden_short_bufsize;
164 	/** harden against very large query sizes */
165 	int harden_large_queries;
166 	/** harden against spoofed glue (out of zone data) */
167 	int harden_glue;
168 	/** harden against receiving no DNSSEC data for trust anchor */
169 	int harden_dnssec_stripped;
170 	/** harden against queries that fall under known nxdomain names */
171 	int harden_below_nxdomain;
172 	/** harden the referral path, query for NS,A,AAAA and validate */
173 	int harden_referral_path;
174 	/** use 0x20 bits in query as random ID bits */
175 	int use_caps_bits_for_id;
176 	/** strip away these private addrs from answers, no DNS Rebinding */
177 	struct config_strlist* private_address;
178 	/** allow domain (and subdomains) to use private address space */
179 	struct config_strlist* private_domain;
180 	/** what threshold for unwanted action. */
181 	size_t unwanted_threshold;
182 	/** the number of seconds maximal TTL used for RRsets and messages */
183 	int max_ttl;
184 	/** the number of seconds minimum TTL used for RRsets and messages */
185 	int min_ttl;
186 	/** if prefetching of messages should be performed. */
187 	int prefetch;
188 	/** if prefetching of DNSKEYs should be performed. */
189 	int prefetch_key;
190 
191 	/** chrootdir, if not "" or chroot will be done */
192 	char* chrootdir;
193 	/** username to change to, if not "". */
194 	char* username;
195 	uid_t uid;
196 	gid_t gid;
197 	/** working directory */
198 	char* directory;
199 	/** filename to log to. */
200 	char* logfile;
201 	/** pidfile to write pid to. */
202 	char* pidfile;
203 
204 	/** should log messages be sent to syslogd */
205 	int use_syslog;
206 	/** log timestamp in ascii UTC */
207 	int log_time_ascii;
208 	/** log queries with one line per query */
209 	int log_queries;
210 
211 	/** do not report identity (id.server, hostname.bind) */
212 	int hide_identity;
213 	/** do not report version (version.server, version.bind) */
214 	int hide_version;
215 	/** identity, hostname is returned if "". */
216 	char* identity;
217 	/** version, package version returned if "". */
218 	char* version;
219 
220 	/** the module configuration string */
221 	char* module_conf;
222 
223 	/** files with trusted DS and DNSKEYs in zonefile format, list */
224 	struct config_strlist* trust_anchor_file_list;
225 	/** list of trustanchor keys, linked list */
226 	struct config_strlist* trust_anchor_list;
227 	/** files with 5011 autotrust tracked keys */
228 	struct config_strlist* auto_trust_anchor_file_list;
229 	/** files with trusted DNSKEYs in named.conf format, list */
230 	struct config_strlist* trusted_keys_file_list;
231 	/** DLV anchor file */
232 	char* dlv_anchor_file;
233 	/** DLV anchor inline */
234 	struct config_strlist* dlv_anchor_list;
235 	/** insecure domain list */
236 	struct config_strlist* domain_insecure;
237 
238 	/** if not 0, this value is the validation date for RRSIGs */
239 	int32_t val_date_override;
240 	/** the minimum for signature clock skew */
241 	int32_t val_sig_skew_min;
242 	/** the maximum for signature clock skew */
243 	int32_t val_sig_skew_max;
244 	/** this value sets the number of seconds before revalidating bogus */
245 	int bogus_ttl;
246 	/** should validator clean additional section for secure msgs */
247 	int val_clean_additional;
248 	/** log bogus messages by the validator */
249 	int val_log_level;
250 	/** squelch val_log_level to log - this is library goes to callback */
251 	int val_log_squelch;
252 	/** should validator allow bogus messages to go through */
253 	int val_permissive_mode;
254 	/** ignore the CD flag in incoming queries and refuse them bogus data */
255 	int ignore_cd;
256 	/** nsec3 maximum iterations per key size, string */
257 	char* val_nsec3_key_iterations;
258 	/** autotrust add holddown time, in seconds */
259 	unsigned int add_holddown;
260 	/** autotrust del holddown time, in seconds */
261 	unsigned int del_holddown;
262 	/** autotrust keep_missing time, in seconds. 0 is forever. */
263 	unsigned int keep_missing;
264 
265 	/** size of the key cache */
266 	size_t key_cache_size;
267 	/** slabs in the key cache. */
268 	size_t key_cache_slabs;
269 	/** size of the neg cache */
270 	size_t neg_cache_size;
271 
272 	/** local zones config */
273 	struct config_str2list* local_zones;
274 	/** local zones nodefault list */
275 	struct config_strlist* local_zones_nodefault;
276 	/** local data RRs configged */
277 	struct config_strlist* local_data;
278 	/** unblock lan zones (reverse lookups for 10/8 and so on) */
279 	int unblock_lan_zones;
280 
281 	/** remote control section. enable toggle. */
282 	int remote_control_enable;
283 	/** the interfaces the remote control should listen on */
284 	struct config_strlist* control_ifs;
285 	/** port number for the control port */
286 	int control_port;
287 	/** use certificates for remote control */
288 	int remote_control_use_cert;
289 	/** private key file for server */
290 	char* server_key_file;
291 	/** certificate file for server */
292 	char* server_cert_file;
293 	/** private key file for unbound-control */
294 	char* control_key_file;
295 	/** certificate file for unbound-control */
296 	char* control_cert_file;
297 
298 	/** Python script file */
299 	char* python_script;
300 
301 	/** daemonize, i.e. fork into the background. */
302 	int do_daemonize;
303 
304 	/* minimal response when positive answer */
305 	int minimal_responses;
306 
307 	/* RRSet roundrobin */
308 	int rrset_roundrobin;
309 
310 	/* maximum UDP response size */
311 	size_t max_udp_size;
312 
313 	/* DNS64 prefix */
314 	char* dns64_prefix;
315 
316 	/* Synthetize all AAAA record despite the presence of an authoritative one */
317 	int dns64_synthall;
318 
319 	/** true to enable dnstap support */
320 	int dnstap;
321 	/** dnstap socket path */
322 	char* dnstap_socket_path;
323 	/** true to send "identity" via dnstap */
324 	int dnstap_send_identity;
325 	/** true to send "version" via dnstap */
326 	int dnstap_send_version;
327 	/** dnstap "identity", hostname is used if "". */
328 	char* dnstap_identity;
329 	/** dnstap "version", package version is used if "". */
330 	char* dnstap_version;
331 
332 	/** true to log dnstap RESOLVER_QUERY message events */
333 	int dnstap_log_resolver_query_messages;
334 	/** true to log dnstap RESOLVER_RESPONSE message events */
335 	int dnstap_log_resolver_response_messages;
336 	/** true to log dnstap CLIENT_QUERY message events */
337 	int dnstap_log_client_query_messages;
338 	/** true to log dnstap CLIENT_RESPONSE message events */
339 	int dnstap_log_client_response_messages;
340 	/** true to log dnstap FORWARDER_QUERY message events */
341 	int dnstap_log_forwarder_query_messages;
342 	/** true to log dnstap FORWARDER_RESPONSE message events */
343 	int dnstap_log_forwarder_response_messages;
344 };
345 
346 /**
347  * Stub config options
348  */
349 struct config_stub {
350 	/** next in list */
351 	struct config_stub* next;
352 	/** domain name (in text) of the stub apex domain */
353 	char* name;
354 	/** list of stub nameserver hosts (domain name) */
355 	struct config_strlist* hosts;
356 	/** list of stub nameserver addresses (IP address) */
357 	struct config_strlist* addrs;
358 	/** if stub-prime is set */
359 	int isprime;
360 	/** if forward-first is set (failover to without if fails) */
361 	int isfirst;
362 };
363 
364 /**
365  * List of strings for config options
366  */
367 struct config_strlist {
368 	/** next item in list */
369 	struct config_strlist* next;
370 	/** config option string */
371 	char* str;
372 };
373 
374 /**
375  * List of two strings for config options
376  */
377 struct config_str2list {
378 	/** next item in list */
379 	struct config_str2list* next;
380 	/** first string */
381 	char* str;
382 	/** second string */
383 	char* str2;
384 };
385 
386 /** List head for strlist processing, used for append operation. */
387 struct config_strlist_head {
388 	/** first in list of text items */
389 	struct config_strlist* first;
390 	/** last in list of text items */
391 	struct config_strlist* last;
392 };
393 
394 /**
395  * Create config file structure. Filled with default values.
396  * @return: the new structure or NULL on memory error.
397  */
398 struct config_file* config_create(void);
399 
400 /**
401  * Create config file structure for library use. Filled with default values.
402  * @return: the new structure or NULL on memory error.
403  */
404 struct config_file* config_create_forlib(void);
405 
406 /**
407  * Read the config file from the specified filename.
408  * @param config: where options are stored into, must be freshly created.
409  * @param filename: name of configfile. If NULL nothing is done.
410  * @param chroot: if not NULL, the chroot dir currently in use (for include).
411  * @return: false on error. In that case errno is set, ENOENT means
412  * 	file not found.
413  */
414 int config_read(struct config_file* config, const char* filename,
415 	const char* chroot);
416 
417 /**
418  * Destroy the config file structure.
419  * @param config: to delete.
420  */
421 void config_delete(struct config_file* config);
422 
423 /**
424  * Apply config to global constants; this routine is called in single thread.
425  * @param config: to apply. Side effect: global constants change.
426  */
427 void config_apply(struct config_file* config);
428 
429 /**
430  * Set the given keyword to the given value.
431  * @param config: where to store config
432  * @param option: option name, including the ':' character.
433  * @param value: value, this string is copied if needed, or parsed.
434  * 	The caller owns the value string.
435  * @return 0 on error (malloc or syntax error).
436  */
437 int config_set_option(struct config_file* config, const char* option,
438 	const char* value);
439 
440 /**
441  * Call print routine for the given option.
442  * @param cfg: config.
443  * @param opt: option name without trailing :.
444  *	This is different from config_set_option.
445  * @param func: print func, called as (str, arg) for every data element.
446  * @param arg: user argument for print func.
447  * @return false if the option name is not supported (syntax error).
448  */
449 int config_get_option(struct config_file* cfg, const char* opt,
450 	void (*func)(char*,void*), void* arg);
451 
452 /**
453  * Get an option and return strlist
454  * @param cfg: config file
455  * @param opt: option name.
456  * @param list: list is returned here. malloced, caller must free it.
457  * @return 0=OK, 1=syntax error, 2=malloc failed.
458  */
459 int config_get_option_list(struct config_file* cfg, const char* opt,
460 	struct config_strlist** list);
461 
462 /**
463  * Get an option and collate results into string
464  * @param cfg: config file
465  * @param opt: option name.
466  * @param str: string. malloced, caller must free it.
467  * @return 0=OK, 1=syntax error, 2=malloc failed.
468  */
469 int config_get_option_collate(struct config_file* cfg, const char* opt,
470 	char** str);
471 
472 /**
473  * function to print to a file, use as func with config_get_option.
474  * @param line: text to print. \n appended.
475  * @param arg: pass a FILE*, like stdout.
476  */
477 void config_print_func(char* line, void* arg);
478 
479 /**
480  * function to collate the text strings into a strlist_head.
481  * @param line: text to append.
482  * @param arg: pass a strlist_head structure. zeroed on start.
483  */
484 void config_collate_func(char* line, void* arg);
485 
486 /**
487  * take a strlist_head list and return a malloc string. separated with newline.
488  * @param list: strlist first to collate. zeroes return "".
489  * @return NULL on malloc failure. Or if malloc failure happened in strlist.
490  */
491 char* config_collate_cat(struct config_strlist* list);
492 
493 /**
494  * Append text at end of list.
495  * @param list: list head. zeroed at start.
496  * @param item: new item. malloced by caller. if NULL the insertion fails.
497  * @return true on success.
498  */
499 int cfg_strlist_append(struct config_strlist_head* list, char* item);
500 
501 /**
502  * Insert string into strlist.
503  * @param head: pointer to strlist head variable.
504  * @param item: new item. malloced by caller. If NULL the insertion fails.
505  * @return: true on success.
506  */
507 int cfg_strlist_insert(struct config_strlist** head, char* item);
508 
509 /**
510  * Insert string into str2list.
511  * @param head: pointer to str2list head variable.
512  * @param item: new item. malloced by caller. If NULL the insertion fails.
513  * @param i2: 2nd string, malloced by caller. If NULL the insertion fails.
514  * @return: true on success.
515  */
516 int cfg_str2list_insert(struct config_str2list** head, char* item, char* i2);
517 
518 /**
519  * Delete items in config string list.
520  * @param list: list.
521  */
522 void config_delstrlist(struct config_strlist* list);
523 
524 /**
525  * Delete items in config double string list.
526  * @param list: list.
527  */
528 void config_deldblstrlist(struct config_str2list* list);
529 
530 /**
531  * Delete items in config stub list.
532  * @param list: list.
533  */
534 void config_delstubs(struct config_stub* list);
535 
536 /**
537  * Convert 14digit to time value
538  * @param str: string of 14 digits
539  * @return time value or 0 for error.
540  */
541 time_t cfg_convert_timeval(const char* str);
542 
543 /**
544  * Count number of values in the string.
545  * format ::= (sp num)+ sp
546  * num ::= [-](0-9)+
547  * sp ::= (space|tab)*
548  *
549  * @param str: string
550  * @return: 0 on parse error, or empty string, else
551  *	number of integer values in the string.
552  */
553 int cfg_count_numbers(const char* str);
554 
555 /**
556  * Convert a 'nice' memory or file size into a bytecount
557  * From '100k' to 102400. and so on. Understands kKmMgG.
558  * k=1024, m=1024*1024, g=1024*1024*1024.
559  * @param str: string
560  * @param res: result is stored here, size in bytes.
561  * @return: true if parsed correctly, or 0 on a parse error (and an error
562  * is logged).
563  */
564 int cfg_parse_memsize(const char* str, size_t* res);
565 
566 /**
567  * Parse local-zone directive into two strings and register it in the config.
568  * @param cfg: to put it in.
569  * @param val: argument strings to local-zone, "example.com nodefault".
570  * @return: false on failure
571  */
572 int cfg_parse_local_zone(struct config_file* cfg, const char* val);
573 
574 /**
575  * Mark "number" or "low-high" as available or not in ports array.
576  * @param str: string in input
577  * @param allow: give true if this range is permitted.
578  * @param avail: the array from cfg.
579  * @param num: size of the array (65536).
580  * @return: true if parsed correctly, or 0 on a parse error (and an error
581  * is logged).
582  */
583 int cfg_mark_ports(const char* str, int allow, int* avail, int num);
584 
585 /**
586  * Get a condensed list of ports returned. allocated.
587  * @param cfg: config file.
588  * @param avail: the available ports array is returned here.
589  * @return: number of ports in array or 0 on error.
590  */
591 int cfg_condense_ports(struct config_file* cfg, int** avail);
592 
593 /**
594  * Scan ports available
595  * @param avail: the array from cfg.
596  * @param num: size of the array (65536).
597  * @return the number of ports available for use.
598  */
599 int cfg_scan_ports(int* avail, int num);
600 
601 /**
602  * Convert a filename to full pathname in original filesys
603  * @param fname: the path name to convert.
604  *      Must not be null or empty.
605  * @param cfg: config struct for chroot and chdir (if set).
606  * @param use_chdir: if false, only chroot is applied.
607  * @return pointer to malloced buffer which is: [chroot][chdir]fname
608  *      or NULL on malloc failure.
609  */
610 char* fname_after_chroot(const char* fname, struct config_file* cfg,
611 	int use_chdir);
612 
613 /**
614  * Convert a ptr shorthand into a full reverse-notation PTR record.
615  * @param str: input string, "IP name"
616  * @return: malloced string "reversed-ip-name PTR name"
617  */
618 char* cfg_ptr_reverse(char* str);
619 
620 /**
621  * Append text to the error info for validation.
622  * @param qstate: query state.
623  * @param str: copied into query region and appended.
624  * Failures to allocate are logged.
625  */
626 void errinf(struct module_qstate* qstate, const char* str);
627 
628 /**
629  * Append text to error info:  from 1.2.3.4
630  * @param qstate: query state.
631  * @param origin: sock list with origin of trouble.
632  *	Every element added.
633  *	If NULL: nothing is added.
634  *	if 0len element: 'from cache' is added.
635  */
636 void errinf_origin(struct module_qstate* qstate, struct sock_list *origin);
637 
638 /**
639  * Append text to error info:  for RRset name type class
640  * @param qstate: query state.
641  * @param rr: rrset_key.
642  */
643 void errinf_rrset(struct module_qstate* qstate, struct ub_packed_rrset_key *rr);
644 
645 /**
646  * Append text to error info:  str dname
647  * @param qstate: query state.
648  * @param str: explanation string
649  * @param dname: the dname.
650  */
651 void errinf_dname(struct module_qstate* qstate, const char* str,
652 	uint8_t* dname);
653 
654 /**
655  * Create error info in string
656  * @param qstate: query state.
657  * @return string or NULL on malloc failure (already logged).
658  *    This string is malloced and has to be freed by caller.
659  */
660 char* errinf_to_str(struct module_qstate* qstate);
661 
662 /**
663  * Used during options parsing
664  */
665 struct config_parser_state {
666 	/** name of file being parser */
667 	char* filename;
668 	/** line number in the file, starts at 1 */
669 	int line;
670 	/** number of errors encountered */
671 	int errors;
672 	/** the result of parsing is stored here. */
673 	struct config_file* cfg;
674 	/** the current chroot dir (or NULL if none) */
675 	const char* chroot;
676 };
677 
678 /** global config parser object used during config parsing */
679 extern struct config_parser_state* cfg_parser;
680 /** init lex state */
681 void init_cfg_parse(void);
682 /** lex in file */
683 extern FILE* ub_c_in;
684 /** lex out file */
685 extern FILE* ub_c_out;
686 /** the yacc lex generated parse function */
687 int ub_c_parse(void);
688 /** the lexer function */
689 int ub_c_lex(void);
690 /** wrap function */
691 int ub_c_wrap(void);
692 /** parsing helpers: print error with file and line numbers */
693 void ub_c_error(const char* msg);
694 /** parsing helpers: print error with file and line numbers */
695 void ub_c_error_msg(const char* fmt, ...) ATTR_FORMAT(printf, 1, 2);
696 
697 #ifdef UB_ON_WINDOWS
698 /**
699  * Obtain registry string (if it exists).
700  * @param key: key string
701  * @param name: name of value to fetch.
702  * @return malloced string with the result or NULL if it did not
703  * 	exist on an error (logged with log_err) was encountered.
704  */
705 char* w_lookup_reg_str(const char* key, const char* name);
706 #endif /* UB_ON_WINDOWS */
707 
708 #endif /* UTIL_CONFIG_FILE_H */
709