]> git.decadent.org.uk Git - nfs-utils.git/blob - support/include/conffile.h
libexport.a: Refactor client_init()
[nfs-utils.git] / support / include / conffile.h
1 /* $OpenBSD: conf.h,v 1.30 2004/06/25 20:25:34 hshoexer Exp $    */
2 /* $EOM: conf.h,v 1.13 2000/09/18 00:01:47 ho Exp $      */
3
4 /*
5  * Copyright (c) 1998, 1999, 2001 Niklas Hallqvist.  All rights reserved.
6  * Copyright (c) 2000, 2003 HÃ¥kan Olsson.  All rights reserved.
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  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28
29 /*
30  * This code was written under funding by Ericsson Radio Systems.
31  */
32
33 #ifndef _CONFFILE_H_
34 #define _CONFFILE_H_
35
36 #include <sys/queue.h>
37 #include <ctype.h>
38
39 struct conf_list_node {
40         TAILQ_ENTRY(conf_list_node) link;
41         char    *field;
42 };
43
44 struct conf_list {
45         size_t  cnt;
46         TAILQ_HEAD(conf_list_fields_head, conf_list_node) fields;
47 };
48
49 extern char    *conf_path;
50
51 extern int      conf_begin(void);
52 extern int      conf_decode_base64(u_int8_t *, u_int32_t *, u_char *);
53 extern int      conf_end(int, int);
54 extern void     conf_free_list(struct conf_list *);
55 extern struct sockaddr *conf_get_address(char *, char *);
56 extern struct conf_list *conf_get_list(char *, char *);
57 extern struct conf_list *conf_get_tag_list(char *);
58 extern int      conf_get_num(char *, char *, int);
59 extern char    *conf_get_str(char *, char *);
60 extern char    *conf_get_section(char *, char *, char *);
61 extern void     conf_init(void);
62 extern int      conf_match_num(char *, char *, int);
63 extern void     conf_reinit(void);
64 extern int      conf_remove(int, char *, char *);
65 extern int      conf_remove_section(int, char *);
66 extern void     conf_report(void);
67
68 /*
69  * Convert letter from upper case to lower case
70  */
71 static inline void upper2lower(char *str)
72 {
73         char c;
74
75         while ((c = tolower(*str)))
76                 *str++ = c;
77 }
78
79
80 #endif                          /* _CONFFILE_H_ */