blob: 4cc10ebcb92019033da4cf304a0fe86ef2dded3c [file] [log] [blame]
Theodore Ts'o2fa9ba92005-12-30 23:57:32 -05001/*
2 * profile.h
3 *
4 * Copyright (C) 2005 by Theodore Ts'o.
5 *
6 * %Begin-Header%
7 * This file may be redistributed under the terms of the GNU Public
8 * License.
9 * %End-Header%
Theodore Ts'oefc6f622008-08-27 23:07:54 -040010 *
Theodore Ts'o2fa9ba92005-12-30 23:57:32 -050011 * Copyright (C) 1985-2005 by the Massachusetts Institute of Technology.
Theodore Ts'oefc6f622008-08-27 23:07:54 -040012 *
Theodore Ts'o2fa9ba92005-12-30 23:57:32 -050013 * All rights reserved.
Theodore Ts'oefc6f622008-08-27 23:07:54 -040014 *
Theodore Ts'o2fa9ba92005-12-30 23:57:32 -050015 * Export of this software from the United States of America may require
16 * a specific license from the United States Government. It is the
17 * responsibility of any person or organization contemplating export to
18 * obtain such a license before exporting.
Theodore Ts'oefc6f622008-08-27 23:07:54 -040019 *
Theodore Ts'o2fa9ba92005-12-30 23:57:32 -050020 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
21 * distribute this software and its documentation for any purpose and
22 * without fee is hereby granted, provided that the above copyright
23 * notice appear in all copies and that both that copyright notice and
24 * this permission notice appear in supporting documentation, and that
25 * the name of M.I.T. not be used in advertising or publicity pertaining
26 * to distribution of the software without specific, written prior
27 * permission. Furthermore if you modify this software you must label
28 * your software as modified software and not distribute it in such a
29 * fashion that it might be confused with the original MIT software.
30 * M.I.T. makes no representations about the suitability of this software
31 * for any purpose. It is provided "as is" without express or implied
32 * warranty.
Theodore Ts'oefc6f622008-08-27 23:07:54 -040033 *
Theodore Ts'o2fa9ba92005-12-30 23:57:32 -050034 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
35 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
36 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
37 */
38
39#ifndef _PROFILE_H
40#define _PROFILE_H
41
42typedef struct _profile_t *profile_t;
43
Theodore Ts'oefc6f622008-08-27 23:07:54 -040044typedef void (*profile_syntax_err_cb_t)(const char *file, long err,
Theodore Ts'of5f14fc2006-01-04 10:32:16 -050045 int line_num);
46
Theodore Ts'o2fa9ba92005-12-30 23:57:32 -050047/*
48 * Used by the profile iterator in prof_get.c
49 */
50#define PROFILE_ITER_LIST_SECTION 0x0001
51#define PROFILE_ITER_SECTIONS_ONLY 0x0002
52#define PROFILE_ITER_RELATIONS_ONLY 0x0004
53
54#ifdef __cplusplus
55extern "C" {
56#endif /* __cplusplus */
57
58long profile_init
59 (const char * *files, profile_t *ret_profile);
60
Theodore Ts'o2fa9ba92005-12-30 23:57:32 -050061void profile_release
62 (profile_t profile);
63
Theodore Ts'o6f890e52007-07-04 13:03:35 -040064long profile_set_default
65 (profile_t profile, const char *def_string);
66
Theodore Ts'o2fa9ba92005-12-30 23:57:32 -050067long profile_get_string
Theodore Ts'oefc6f622008-08-27 23:07:54 -040068 (profile_t profile, const char *name, const char *subname,
Theodore Ts'o2fa9ba92005-12-30 23:57:32 -050069 const char *subsubname, const char *def_val,
70 char **ret_string);
71long profile_get_integer
72 (profile_t profile, const char *name, const char *subname,
73 const char *subsubname, int def_val,
74 int *ret_default);
75
Theodore Ts'o32460c12007-05-22 20:51:47 -040076long profile_get_uint
77 (profile_t profile, const char *name, const char *subname,
Theodore Ts'oefc6f622008-08-27 23:07:54 -040078 const char *subsubname, unsigned int def_val,
Theodore Ts'o32460c12007-05-22 20:51:47 -040079 unsigned int *ret_int);
80
JP Abgralle0ed7402014-03-19 19:08:39 -070081long profile_get_double
82 (profile_t profile, const char *name, const char *subname,
83 const char *subsubname, double def_val,
84 double *ret_float);
85
Theodore Ts'o2fa9ba92005-12-30 23:57:32 -050086long profile_get_boolean
87 (profile_t profile, const char *name, const char *subname,
88 const char *subsubname, int def_val,
89 int *ret_default);
90
Theodore Ts'o2fa9ba92005-12-30 23:57:32 -050091long profile_iterator_create
92 (profile_t profile, const char *const *names,
93 int flags, void **ret_iter);
94
95void profile_iterator_free
96 (void **iter_p);
Theodore Ts'oefc6f622008-08-27 23:07:54 -040097
Theodore Ts'o2fa9ba92005-12-30 23:57:32 -050098long profile_iterator
99 (void **iter_p, char **ret_name, char **ret_value);
100
Theodore Ts'of5f14fc2006-01-04 10:32:16 -0500101profile_syntax_err_cb_t profile_set_syntax_err_cb(profile_syntax_err_cb_t hook);
102
Theodore Ts'o2fa9ba92005-12-30 23:57:32 -0500103#ifdef __cplusplus
104}
105#endif /* __cplusplus */
106
107#endif /* _KRB5_H */