1 /*
2  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 #pragma ident	"%Z%%M%	%I%	%E% SMI"
7 
8 /*
9  * profile.h
10  */
11 
12 #ifndef _KRB5_PROFILE_H
13 #define _KRB5_PROFILE_H
14 
15 /* SUNW14resync */
16 #include "../profile/prof_err.h"
17 
18 #if defined(_WIN32)
19 #include <win-mac.h>
20 #endif
21 
22 #if defined(__MACH__) && defined(__APPLE__)
23 #    include <TargetConditionals.h>
24 #    if TARGET_RT_MAC_CFM
25 #        error "Use KfM 4.0 SDK headers for CFM compilation."
26 #    endif
27 #endif
28 
29 #ifndef KRB5_CALLCONV
30 #define KRB5_CALLCONV
31 #define KRB5_CALLCONV_C
32 #endif
33 
34 typedef struct _profile_t *profile_t;
35 
36 /*
37  * Used by the profile iterator in prof_get.c
38  */
39 #define PROFILE_ITER_LIST_SECTION	0x0001
40 #define PROFILE_ITER_SECTIONS_ONLY	0x0002
41 #define PROFILE_ITER_RELATIONS_ONLY	0x0004
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif /* __cplusplus */
46 
47 typedef char* profile_filespec_t;	/* path as C string */
48 typedef char* profile_filespec_list_t;	/* list of : separated paths, C string */
49 typedef const char * const_profile_filespec_t;	/* path as C string */
50 typedef const char * const_profile_filespec_list_t;	/* list of : separated paths, C string */
51 
52 long KRB5_CALLCONV profile_init
53 	(const_profile_filespec_t *files, profile_t *ret_profile);
54 
55 long KRB5_CALLCONV profile_init_path
56 	(const_profile_filespec_list_t filelist, profile_t *ret_profile);
57 
58 long KRB5_CALLCONV profile_flush
59 	(profile_t profile);
60 long KRB5_CALLCONV profile_flush_to_file
61 	(profile_t profile, const_profile_filespec_t outfile);
62 long KRB5_CALLCONV profile_flush_to_buffer
63 	(profile_t profile, char **bufp);
64 void KRB5_CALLCONV profile_free_buffer
65 	(profile_t profile, char *buf);
66 
67 long KRB5_CALLCONV profile_is_writable
68 	(profile_t profile, int *writable);
69 long KRB5_CALLCONV profile_is_modified
70 	(profile_t profile, int *modified);
71 
72 void KRB5_CALLCONV profile_abandon
73 	(profile_t profile);
74 
75 void KRB5_CALLCONV profile_release
76 	(profile_t profile);
77 
78 long KRB5_CALLCONV profile_get_values
79 	(profile_t profile, const char *const *names, char ***ret_values);
80 
81 void KRB5_CALLCONV profile_free_list
82 	(char **list);
83 
84 long KRB5_CALLCONV profile_get_string
85 	(profile_t profile, const char *name, const char *subname,
86 			const char *subsubname, const char *def_val,
87 			char **ret_string);
88 long KRB5_CALLCONV profile_get_integer
89 	(profile_t profile, const char *name, const char *subname,
90 			const char *subsubname, int def_val,
91 			int *ret_default);
92 
93 long KRB5_CALLCONV profile_get_boolean
94 	(profile_t profile, const char *name, const char *subname,
95 			const char *subsubname, int def_val,
96 			int *ret_default);
97 
98 long KRB5_CALLCONV profile_get_relation_names
99 	(profile_t profile, const char **names, char ***ret_names);
100 
101 long KRB5_CALLCONV profile_get_subsection_names
102 	(profile_t profile, const char **names, char ***ret_names);
103 
104 long KRB5_CALLCONV profile_iterator_create
105 	(profile_t profile, const char *const *names,
106 		   int flags, void **ret_iter);
107 
108 void KRB5_CALLCONV profile_iterator_free
109 	(void **iter_p);
110 
111 long KRB5_CALLCONV profile_iterator
112 	(void	**iter_p, char **ret_name, char **ret_value);
113 
114 void KRB5_CALLCONV profile_release_string (char *str);
115 
116 long KRB5_CALLCONV profile_update_relation
117 	(profile_t profile, const char **names,
118 		   const char *old_value, const char *new_value);
119 
120 long KRB5_CALLCONV profile_clear_relation
121 	(profile_t profile, const char **names);
122 
123 long KRB5_CALLCONV profile_rename_section
124 	(profile_t profile, const char **names,
125 		   const char *new_name);
126 
127 long KRB5_CALLCONV profile_add_relation
128 	(profile_t profile, const char **names,
129 		   const char *new_value);
130 
131 #ifdef __cplusplus
132 }
133 #endif /* __cplusplus */
134 
135 #endif /* _KRB5_PROFILE_H */
136