xref: /freebsd/contrib/unbound/util/config_file.h (revision ec0e626bafb335b30c499d06066997f54b10c092)
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  * Find username, sets uid and gid.
431  * @param config: the config structure.
432  */
433 void config_lookup_uid(struct config_file* config);
434 
435 /**
436  * Set the given keyword to the given value.
437  * @param config: where to store config
438  * @param option: option name, including the ':' character.
439  * @param value: value, this string is copied if needed, or parsed.
440  * 	The caller owns the value string.
441  * @return 0 on error (malloc or syntax error).
442  */
443 int config_set_option(struct config_file* config, const char* option,
444 	const char* value);
445 
446 /**
447  * Call print routine for the given option.
448  * @param cfg: config.
449  * @param opt: option name without trailing :.
450  *	This is different from config_set_option.
451  * @param func: print func, called as (str, arg) for every data element.
452  * @param arg: user argument for print func.
453  * @return false if the option name is not supported (syntax error).
454  */
455 int config_get_option(struct config_file* cfg, const char* opt,
456 	void (*func)(char*,void*), void* arg);
457 
458 /**
459  * Get an option and return strlist
460  * @param cfg: config file
461  * @param opt: option name.
462  * @param list: list is returned here. malloced, caller must free it.
463  * @return 0=OK, 1=syntax error, 2=malloc failed.
464  */
465 int config_get_option_list(struct config_file* cfg, const char* opt,
466 	struct config_strlist** list);
467 
468 /**
469  * Get an option and collate results into string
470  * @param cfg: config file
471  * @param opt: option name.
472  * @param str: string. malloced, caller must free it.
473  * @return 0=OK, 1=syntax error, 2=malloc failed.
474  */
475 int config_get_option_collate(struct config_file* cfg, const char* opt,
476 	char** str);
477 
478 /**
479  * function to print to a file, use as func with config_get_option.
480  * @param line: text to print. \n appended.
481  * @param arg: pass a FILE*, like stdout.
482  */
483 void config_print_func(char* line, void* arg);
484 
485 /**
486  * function to collate the text strings into a strlist_head.
487  * @param line: text to append.
488  * @param arg: pass a strlist_head structure. zeroed on start.
489  */
490 void config_collate_func(char* line, void* arg);
491 
492 /**
493  * take a strlist_head list and return a malloc string. separated with newline.
494  * @param list: strlist first to collate. zeroes return "".
495  * @return NULL on malloc failure. Or if malloc failure happened in strlist.
496  */
497 char* config_collate_cat(struct config_strlist* list);
498 
499 /**
500  * Append text at end of list.
501  * @param list: list head. zeroed at start.
502  * @param item: new item. malloced by caller. if NULL the insertion fails.
503  * @return true on success.
504  */
505 int cfg_strlist_append(struct config_strlist_head* list, char* item);
506 
507 /**
508  * Insert string into strlist.
509  * @param head: pointer to strlist head variable.
510  * @param item: new item. malloced by caller. If NULL the insertion fails.
511  * @return: true on success.
512  */
513 int cfg_strlist_insert(struct config_strlist** head, char* item);
514 
515 /**
516  * Insert string into str2list.
517  * @param head: pointer to str2list head variable.
518  * @param item: new item. malloced by caller. If NULL the insertion fails.
519  * @param i2: 2nd string, malloced by caller. If NULL the insertion fails.
520  * @return: true on success.
521  */
522 int cfg_str2list_insert(struct config_str2list** head, char* item, char* i2);
523 
524 /**
525  * Delete items in config string list.
526  * @param list: list.
527  */
528 void config_delstrlist(struct config_strlist* list);
529 
530 /**
531  * Delete items in config double string list.
532  * @param list: list.
533  */
534 void config_deldblstrlist(struct config_str2list* list);
535 
536 /**
537  * Delete items in config stub list.
538  * @param list: list.
539  */
540 void config_delstubs(struct config_stub* list);
541 
542 /**
543  * Convert 14digit to time value
544  * @param str: string of 14 digits
545  * @return time value or 0 for error.
546  */
547 time_t cfg_convert_timeval(const char* str);
548 
549 /**
550  * Count number of values in the string.
551  * format ::= (sp num)+ sp
552  * num ::= [-](0-9)+
553  * sp ::= (space|tab)*
554  *
555  * @param str: string
556  * @return: 0 on parse error, or empty string, else
557  *	number of integer values in the string.
558  */
559 int cfg_count_numbers(const char* str);
560 
561 /**
562  * Convert a 'nice' memory or file size into a bytecount
563  * From '100k' to 102400. and so on. Understands kKmMgG.
564  * k=1024, m=1024*1024, g=1024*1024*1024.
565  * @param str: string
566  * @param res: result is stored here, size in bytes.
567  * @return: true if parsed correctly, or 0 on a parse error (and an error
568  * is logged).
569  */
570 int cfg_parse_memsize(const char* str, size_t* res);
571 
572 /**
573  * Parse local-zone directive into two strings and register it in the config.
574  * @param cfg: to put it in.
575  * @param val: argument strings to local-zone, "example.com nodefault".
576  * @return: false on failure
577  */
578 int cfg_parse_local_zone(struct config_file* cfg, const char* val);
579 
580 /**
581  * Mark "number" or "low-high" as available or not in ports array.
582  * @param str: string in input
583  * @param allow: give true if this range is permitted.
584  * @param avail: the array from cfg.
585  * @param num: size of the array (65536).
586  * @return: true if parsed correctly, or 0 on a parse error (and an error
587  * is logged).
588  */
589 int cfg_mark_ports(const char* str, int allow, int* avail, int num);
590 
591 /**
592  * Get a condensed list of ports returned. allocated.
593  * @param cfg: config file.
594  * @param avail: the available ports array is returned here.
595  * @return: number of ports in array or 0 on error.
596  */
597 int cfg_condense_ports(struct config_file* cfg, int** avail);
598 
599 /**
600  * Scan ports available
601  * @param avail: the array from cfg.
602  * @param num: size of the array (65536).
603  * @return the number of ports available for use.
604  */
605 int cfg_scan_ports(int* avail, int num);
606 
607 /**
608  * Convert a filename to full pathname in original filesys
609  * @param fname: the path name to convert.
610  *      Must not be null or empty.
611  * @param cfg: config struct for chroot and chdir (if set).
612  * @param use_chdir: if false, only chroot is applied.
613  * @return pointer to malloced buffer which is: [chroot][chdir]fname
614  *      or NULL on malloc failure.
615  */
616 char* fname_after_chroot(const char* fname, struct config_file* cfg,
617 	int use_chdir);
618 
619 /**
620  * Convert a ptr shorthand into a full reverse-notation PTR record.
621  * @param str: input string, "IP name"
622  * @return: malloced string "reversed-ip-name PTR name"
623  */
624 char* cfg_ptr_reverse(char* str);
625 
626 /**
627  * Append text to the error info for validation.
628  * @param qstate: query state.
629  * @param str: copied into query region and appended.
630  * Failures to allocate are logged.
631  */
632 void errinf(struct module_qstate* qstate, const char* str);
633 
634 /**
635  * Append text to error info:  from 1.2.3.4
636  * @param qstate: query state.
637  * @param origin: sock list with origin of trouble.
638  *	Every element added.
639  *	If NULL: nothing is added.
640  *	if 0len element: 'from cache' is added.
641  */
642 void errinf_origin(struct module_qstate* qstate, struct sock_list *origin);
643 
644 /**
645  * Append text to error info:  for RRset name type class
646  * @param qstate: query state.
647  * @param rr: rrset_key.
648  */
649 void errinf_rrset(struct module_qstate* qstate, struct ub_packed_rrset_key *rr);
650 
651 /**
652  * Append text to error info:  str dname
653  * @param qstate: query state.
654  * @param str: explanation string
655  * @param dname: the dname.
656  */
657 void errinf_dname(struct module_qstate* qstate, const char* str,
658 	uint8_t* dname);
659 
660 /**
661  * Create error info in string
662  * @param qstate: query state.
663  * @return string or NULL on malloc failure (already logged).
664  *    This string is malloced and has to be freed by caller.
665  */
666 char* errinf_to_str(struct module_qstate* qstate);
667 
668 /**
669  * Used during options parsing
670  */
671 struct config_parser_state {
672 	/** name of file being parser */
673 	char* filename;
674 	/** line number in the file, starts at 1 */
675 	int line;
676 	/** number of errors encountered */
677 	int errors;
678 	/** the result of parsing is stored here. */
679 	struct config_file* cfg;
680 	/** the current chroot dir (or NULL if none) */
681 	const char* chroot;
682 };
683 
684 /** global config parser object used during config parsing */
685 extern struct config_parser_state* cfg_parser;
686 /** init lex state */
687 void init_cfg_parse(void);
688 /** lex in file */
689 extern FILE* ub_c_in;
690 /** lex out file */
691 extern FILE* ub_c_out;
692 /** the yacc lex generated parse function */
693 int ub_c_parse(void);
694 /** the lexer function */
695 int ub_c_lex(void);
696 /** wrap function */
697 int ub_c_wrap(void);
698 /** parsing helpers: print error with file and line numbers */
699 void ub_c_error(const char* msg);
700 /** parsing helpers: print error with file and line numbers */
701 void ub_c_error_msg(const char* fmt, ...) ATTR_FORMAT(printf, 1, 2);
702 
703 #ifdef UB_ON_WINDOWS
704 /**
705  * Obtain registry string (if it exists).
706  * @param key: key string
707  * @param name: name of value to fetch.
708  * @return malloced string with the result or NULL if it did not
709  * 	exist on an error (logged with log_err) was encountered.
710  */
711 char* w_lookup_reg_str(const char* key, const char* name);
712 #endif /* UB_ON_WINDOWS */
713 
714 #endif /* UTIL_CONFIG_FILE_H */
715