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