jpayne@69
|
1 /*
|
jpayne@69
|
2 * profile.h
|
jpayne@69
|
3 */
|
jpayne@69
|
4
|
jpayne@69
|
5 #ifndef _KRB5_PROFILE_H
|
jpayne@69
|
6 #define _KRB5_PROFILE_H
|
jpayne@69
|
7
|
jpayne@69
|
8 #if defined(_WIN32)
|
jpayne@69
|
9 #include <win-mac.h>
|
jpayne@69
|
10 #endif
|
jpayne@69
|
11
|
jpayne@69
|
12 #if defined(__MACH__) && defined(__APPLE__)
|
jpayne@69
|
13 # include <TargetConditionals.h>
|
jpayne@69
|
14 # if TARGET_RT_MAC_CFM
|
jpayne@69
|
15 # error "Use KfM 4.0 SDK headers for CFM compilation."
|
jpayne@69
|
16 # endif
|
jpayne@69
|
17 #endif
|
jpayne@69
|
18
|
jpayne@69
|
19 #ifndef KRB5_CALLCONV
|
jpayne@69
|
20 #define KRB5_CALLCONV
|
jpayne@69
|
21 #define KRB5_CALLCONV_C
|
jpayne@69
|
22 #endif
|
jpayne@69
|
23
|
jpayne@69
|
24 typedef struct _profile_t *profile_t;
|
jpayne@69
|
25
|
jpayne@69
|
26 /* Used by profile_init_flags(). */
|
jpayne@69
|
27 #define PROFILE_INIT_ALLOW_MODULE 0x0001 /* Allow module declaration */
|
jpayne@69
|
28
|
jpayne@69
|
29 /*
|
jpayne@69
|
30 * Used by the profile iterator in prof_get.c
|
jpayne@69
|
31 */
|
jpayne@69
|
32 #define PROFILE_ITER_LIST_SECTION 0x0001
|
jpayne@69
|
33 #define PROFILE_ITER_SECTIONS_ONLY 0x0002
|
jpayne@69
|
34 #define PROFILE_ITER_RELATIONS_ONLY 0x0004
|
jpayne@69
|
35
|
jpayne@69
|
36 #ifdef __cplusplus
|
jpayne@69
|
37 extern "C" {
|
jpayne@69
|
38 #endif /* __cplusplus */
|
jpayne@69
|
39
|
jpayne@69
|
40 typedef char* profile_filespec_t; /* path as C string */
|
jpayne@69
|
41 typedef char* profile_filespec_list_t; /* list of : separated paths, C string */
|
jpayne@69
|
42 typedef const char * const_profile_filespec_t; /* path as C string */
|
jpayne@69
|
43 typedef const char * const_profile_filespec_list_t; /* list of : separated paths, C string */
|
jpayne@69
|
44
|
jpayne@69
|
45 long KRB5_CALLCONV profile_init
|
jpayne@69
|
46 (const_profile_filespec_t *files, profile_t *ret_profile);
|
jpayne@69
|
47
|
jpayne@69
|
48 long KRB5_CALLCONV profile_init_flags
|
jpayne@69
|
49 (const_profile_filespec_t *files, int flags, profile_t *ret_profile);
|
jpayne@69
|
50
|
jpayne@69
|
51 long KRB5_CALLCONV profile_init_path
|
jpayne@69
|
52 (const_profile_filespec_list_t filelist, profile_t *ret_profile);
|
jpayne@69
|
53
|
jpayne@69
|
54 long KRB5_CALLCONV profile_flush
|
jpayne@69
|
55 (profile_t profile);
|
jpayne@69
|
56 long KRB5_CALLCONV profile_flush_to_file
|
jpayne@69
|
57 (profile_t profile, const_profile_filespec_t outfile);
|
jpayne@69
|
58 long KRB5_CALLCONV profile_flush_to_buffer
|
jpayne@69
|
59 (profile_t profile, char **bufp);
|
jpayne@69
|
60 void KRB5_CALLCONV profile_free_buffer
|
jpayne@69
|
61 (profile_t profile, char *buf);
|
jpayne@69
|
62
|
jpayne@69
|
63 long KRB5_CALLCONV profile_is_writable
|
jpayne@69
|
64 (profile_t profile, int *writable);
|
jpayne@69
|
65 long KRB5_CALLCONV profile_is_modified
|
jpayne@69
|
66 (profile_t profile, int *modified);
|
jpayne@69
|
67
|
jpayne@69
|
68 void KRB5_CALLCONV profile_abandon
|
jpayne@69
|
69 (profile_t profile);
|
jpayne@69
|
70
|
jpayne@69
|
71 void KRB5_CALLCONV profile_release
|
jpayne@69
|
72 (profile_t profile);
|
jpayne@69
|
73
|
jpayne@69
|
74 long KRB5_CALLCONV profile_get_values
|
jpayne@69
|
75 (profile_t profile, const char *const *names, char ***ret_values);
|
jpayne@69
|
76
|
jpayne@69
|
77 void KRB5_CALLCONV profile_free_list
|
jpayne@69
|
78 (char **list);
|
jpayne@69
|
79
|
jpayne@69
|
80 long KRB5_CALLCONV profile_get_string
|
jpayne@69
|
81 (profile_t profile, const char *name, const char *subname,
|
jpayne@69
|
82 const char *subsubname, const char *def_val,
|
jpayne@69
|
83 char **ret_string);
|
jpayne@69
|
84 long KRB5_CALLCONV profile_get_integer
|
jpayne@69
|
85 (profile_t profile, const char *name, const char *subname,
|
jpayne@69
|
86 const char *subsubname, int def_val,
|
jpayne@69
|
87 int *ret_default);
|
jpayne@69
|
88
|
jpayne@69
|
89 long KRB5_CALLCONV profile_get_boolean
|
jpayne@69
|
90 (profile_t profile, const char *name, const char *subname,
|
jpayne@69
|
91 const char *subsubname, int def_val,
|
jpayne@69
|
92 int *ret_default);
|
jpayne@69
|
93
|
jpayne@69
|
94 long KRB5_CALLCONV profile_get_relation_names
|
jpayne@69
|
95 (profile_t profile, const char **names, char ***ret_names);
|
jpayne@69
|
96
|
jpayne@69
|
97 long KRB5_CALLCONV profile_get_subsection_names
|
jpayne@69
|
98 (profile_t profile, const char **names, char ***ret_names);
|
jpayne@69
|
99
|
jpayne@69
|
100 long KRB5_CALLCONV profile_iterator_create
|
jpayne@69
|
101 (profile_t profile, const char *const *names,
|
jpayne@69
|
102 int flags, void **ret_iter);
|
jpayne@69
|
103
|
jpayne@69
|
104 void KRB5_CALLCONV profile_iterator_free
|
jpayne@69
|
105 (void **iter_p);
|
jpayne@69
|
106
|
jpayne@69
|
107 long KRB5_CALLCONV profile_iterator
|
jpayne@69
|
108 (void **iter_p, char **ret_name, char **ret_value);
|
jpayne@69
|
109
|
jpayne@69
|
110 void KRB5_CALLCONV profile_release_string (char *str);
|
jpayne@69
|
111
|
jpayne@69
|
112 long KRB5_CALLCONV profile_update_relation
|
jpayne@69
|
113 (profile_t profile, const char **names,
|
jpayne@69
|
114 const char *old_value, const char *new_value);
|
jpayne@69
|
115
|
jpayne@69
|
116 long KRB5_CALLCONV profile_clear_relation
|
jpayne@69
|
117 (profile_t profile, const char **names);
|
jpayne@69
|
118
|
jpayne@69
|
119 long KRB5_CALLCONV profile_rename_section
|
jpayne@69
|
120 (profile_t profile, const char **names,
|
jpayne@69
|
121 const char *new_name);
|
jpayne@69
|
122
|
jpayne@69
|
123 long KRB5_CALLCONV profile_add_relation
|
jpayne@69
|
124 (profile_t profile, const char **names,
|
jpayne@69
|
125 const char *new_value);
|
jpayne@69
|
126
|
jpayne@69
|
127 /*
|
jpayne@69
|
128 * profile_init_vtable allows a caller to create a profile-compatible object
|
jpayne@69
|
129 * with a different back end.
|
jpayne@69
|
130 */
|
jpayne@69
|
131
|
jpayne@69
|
132 /*
|
jpayne@69
|
133 * Mandatory: Look up all of the relations for names, placing the resulting
|
jpayne@69
|
134 * values in *ret_values. If no relations exist, return PROF_NO_RELATION, or
|
jpayne@69
|
135 * PROF_NO_SECTION to indicate that one of the intermediate names does not
|
jpayne@69
|
136 * exist as a section. The list will be freed with free_values.
|
jpayne@69
|
137 */
|
jpayne@69
|
138 typedef long
|
jpayne@69
|
139 (*profile_get_values_fn)(void *cbdata, const char *const *names,
|
jpayne@69
|
140 char ***ret_values);
|
jpayne@69
|
141
|
jpayne@69
|
142 /* Mandatory: Free a list of strings returned by get_values. */
|
jpayne@69
|
143 typedef void
|
jpayne@69
|
144 (*profile_free_values_fn)(void *cbdata, char **values);
|
jpayne@69
|
145
|
jpayne@69
|
146 /* Optional: Release any data associated with the profile. */
|
jpayne@69
|
147 typedef void
|
jpayne@69
|
148 (*profile_cleanup_fn)(void *cbdata);
|
jpayne@69
|
149
|
jpayne@69
|
150 /*
|
jpayne@69
|
151 * Optional (mandatory if cleanup is defined): Generate a new cbdata pointer
|
jpayne@69
|
152 * for a copy of the profile. If not implemented, the new profile will receive
|
jpayne@69
|
153 * the same cbdata pointer as the old one.
|
jpayne@69
|
154 */
|
jpayne@69
|
155 typedef long
|
jpayne@69
|
156 (*profile_copy_fn)(void *cbdata, void **ret_cbdata);
|
jpayne@69
|
157
|
jpayne@69
|
158 /*
|
jpayne@69
|
159 * Optional: Create an iterator handle.
|
jpayne@69
|
160 *
|
jpayne@69
|
161 * If flags contains PROFILE_ITER_LIST_SECTION, iterate over all of the
|
jpayne@69
|
162 * relations and sections within names. Otherwise, iterate over the relation
|
jpayne@69
|
163 * values for names, or produce a single section result if names is a section.
|
jpayne@69
|
164 *
|
jpayne@69
|
165 * If flags contains PROFILE_ITER_SECTIONS_ONLY, produce only sections.
|
jpayne@69
|
166 *
|
jpayne@69
|
167 * If flags contains PROFILE_ITER_RELATIONS_ONLY, produce only relations.
|
jpayne@69
|
168 */
|
jpayne@69
|
169 typedef long
|
jpayne@69
|
170 (*profile_iterator_create_fn)(void *cbdata, const char *const *names,
|
jpayne@69
|
171 int flags, void **ret_iter);
|
jpayne@69
|
172
|
jpayne@69
|
173 /*
|
jpayne@69
|
174 * Optional (mandatory if iterator_create is defined): Produce the next
|
jpayne@69
|
175 * relation or section in an iteration. If producing a section result, set
|
jpayne@69
|
176 * *ret_value to NULL. The returned strings will be freed with free_string.
|
jpayne@69
|
177 */
|
jpayne@69
|
178 typedef long
|
jpayne@69
|
179 (*profile_iterator_fn)(void *cbdata, void *iter, char **ret_name,
|
jpayne@69
|
180 char **ret_value);
|
jpayne@69
|
181
|
jpayne@69
|
182 /*
|
jpayne@69
|
183 * Optional (mandatory if iterator_create is defined): Free the memory for an
|
jpayne@69
|
184 * iterator.
|
jpayne@69
|
185 */
|
jpayne@69
|
186 typedef void
|
jpayne@69
|
187 (*profile_iterator_free_fn)(void *cbdata, void *iter);
|
jpayne@69
|
188
|
jpayne@69
|
189 /* Optional (mandatory if iterator is defined): Free a string value. */
|
jpayne@69
|
190 typedef void
|
jpayne@69
|
191 (*profile_free_string_fn)(void *cbdata, char *string);
|
jpayne@69
|
192
|
jpayne@69
|
193 /*
|
jpayne@69
|
194 * Optional: Determine if a profile is writable. If not implemented, the
|
jpayne@69
|
195 * profile is never writable.
|
jpayne@69
|
196 */
|
jpayne@69
|
197 typedef long
|
jpayne@69
|
198 (*profile_writable_fn)(void *cbdata, int *writable);
|
jpayne@69
|
199
|
jpayne@69
|
200 /*
|
jpayne@69
|
201 * Optional: Determine if a profile is modified in memory relative to the
|
jpayne@69
|
202 * persistent store. If not implemented, the profile is assumed to never be
|
jpayne@69
|
203 * modified.
|
jpayne@69
|
204 */
|
jpayne@69
|
205 typedef long
|
jpayne@69
|
206 (*profile_modified_fn)(void *cbdata, int *modified);
|
jpayne@69
|
207
|
jpayne@69
|
208 /*
|
jpayne@69
|
209 * Optional: Change the value of a relation, or remove it if new_value is NULL.
|
jpayne@69
|
210 * If old_value is set and the relation does not have that value, return
|
jpayne@69
|
211 * PROF_NO_RELATION.
|
jpayne@69
|
212 */
|
jpayne@69
|
213 typedef long
|
jpayne@69
|
214 (*profile_update_relation_fn)(void *cbdata, const char **names,
|
jpayne@69
|
215 const char *old_value, const char *new_value);
|
jpayne@69
|
216
|
jpayne@69
|
217 /*
|
jpayne@69
|
218 * Optional: Rename a section to new_name, or remove the section if new_name is
|
jpayne@69
|
219 * NULL.
|
jpayne@69
|
220 */
|
jpayne@69
|
221 typedef long
|
jpayne@69
|
222 (*profile_rename_section_fn)(void *cbdata, const char **names,
|
jpayne@69
|
223 const char *new_name);
|
jpayne@69
|
224
|
jpayne@69
|
225 /*
|
jpayne@69
|
226 * Optional: Add a new relation, or a new section if new_value is NULL. Add
|
jpayne@69
|
227 * any intermediate sections as necessary.
|
jpayne@69
|
228 */
|
jpayne@69
|
229 typedef long
|
jpayne@69
|
230 (*profile_add_relation_fn)(void *cbdata, const char **names,
|
jpayne@69
|
231 const char *new_value);
|
jpayne@69
|
232
|
jpayne@69
|
233 /*
|
jpayne@69
|
234 * Optional: Flush any pending memory updates to the persistent store. If
|
jpayne@69
|
235 * implemented, this function will be called by profile_release as well as
|
jpayne@69
|
236 * profile_flush, so make sure it's not inefficient to flush an unmodified
|
jpayne@69
|
237 * profile.
|
jpayne@69
|
238 */
|
jpayne@69
|
239 typedef long
|
jpayne@69
|
240 (*profile_flush_fn)(void *cbdata);
|
jpayne@69
|
241
|
jpayne@69
|
242 struct profile_vtable {
|
jpayne@69
|
243 int minor_ver; /* Set to structure minor version (currently 1)
|
jpayne@69
|
244 * if calling profile_init_vtable. */
|
jpayne@69
|
245
|
jpayne@69
|
246 /* Methods needed for a basic read-only non-iterable profile (cleanup is
|
jpayne@69
|
247 * optional). */
|
jpayne@69
|
248 profile_get_values_fn get_values;
|
jpayne@69
|
249 profile_free_values_fn free_values;
|
jpayne@69
|
250 profile_cleanup_fn cleanup;
|
jpayne@69
|
251 profile_copy_fn copy;
|
jpayne@69
|
252
|
jpayne@69
|
253 /* Methods for iterable profiles. */
|
jpayne@69
|
254 profile_iterator_create_fn iterator_create;
|
jpayne@69
|
255 profile_iterator_fn iterator;
|
jpayne@69
|
256 profile_iterator_free_fn iterator_free;
|
jpayne@69
|
257 profile_free_string_fn free_string;
|
jpayne@69
|
258
|
jpayne@69
|
259 /* Methods for writable profiles. */
|
jpayne@69
|
260 profile_writable_fn writable;
|
jpayne@69
|
261 profile_modified_fn modified;
|
jpayne@69
|
262 profile_update_relation_fn update_relation;
|
jpayne@69
|
263 profile_rename_section_fn rename_section;
|
jpayne@69
|
264 profile_add_relation_fn add_relation;
|
jpayne@69
|
265 profile_flush_fn flush;
|
jpayne@69
|
266
|
jpayne@69
|
267 /* End of minor version 1. */
|
jpayne@69
|
268 };
|
jpayne@69
|
269
|
jpayne@69
|
270 /*
|
jpayne@69
|
271 * Create a profile object whose operations will be performed using the
|
jpayne@69
|
272 * function pointers in vtable. cbdata will be supplied to each vtable
|
jpayne@69
|
273 * function as the first argument.
|
jpayne@69
|
274 */
|
jpayne@69
|
275 long KRB5_CALLCONV profile_init_vtable
|
jpayne@69
|
276 (struct profile_vtable *vtable, void *cbdata, profile_t *ret_profile);
|
jpayne@69
|
277
|
jpayne@69
|
278 /*
|
jpayne@69
|
279 * Dynamically loadable profile modules should define a function named
|
jpayne@69
|
280 * "profile_module_init" matching the following signature. The function should
|
jpayne@69
|
281 * initialize the methods of the provided vtable structure, stopping at the
|
jpayne@69
|
282 * field corresponding to vtable->minor_ver. Do not change the value of
|
jpayne@69
|
283 * vtable->minor_ver. Unimplemented methods can be left uninitialized. The
|
jpayne@69
|
284 * function should supply a callback data pointer in *cb_ret; this pointer can
|
jpayne@69
|
285 * be cleaned up via the vtable cleanup method.
|
jpayne@69
|
286 */
|
jpayne@69
|
287 typedef long
|
jpayne@69
|
288 (*profile_module_init_fn)(const char *residual, struct profile_vtable *vtable,
|
jpayne@69
|
289 void **cb_ret);
|
jpayne@69
|
290
|
jpayne@69
|
291 #ifdef __cplusplus
|
jpayne@69
|
292 }
|
jpayne@69
|
293 #endif /* __cplusplus */
|
jpayne@69
|
294
|
jpayne@69
|
295 #endif /* _KRB5_PROFILE_H */
|
jpayne@69
|
296 /*
|
jpayne@69
|
297 * et-h-prof_err.h:
|
jpayne@69
|
298 * This file is automatically generated; please do not edit it.
|
jpayne@69
|
299 */
|
jpayne@69
|
300
|
jpayne@69
|
301 #include <com_err.h>
|
jpayne@69
|
302
|
jpayne@69
|
303 #define PROF_VERSION (-1429577728L)
|
jpayne@69
|
304 #define PROF_MAGIC_NODE (-1429577727L)
|
jpayne@69
|
305 #define PROF_NO_SECTION (-1429577726L)
|
jpayne@69
|
306 #define PROF_NO_RELATION (-1429577725L)
|
jpayne@69
|
307 #define PROF_ADD_NOT_SECTION (-1429577724L)
|
jpayne@69
|
308 #define PROF_SECTION_WITH_VALUE (-1429577723L)
|
jpayne@69
|
309 #define PROF_BAD_LINK_LIST (-1429577722L)
|
jpayne@69
|
310 #define PROF_BAD_GROUP_LVL (-1429577721L)
|
jpayne@69
|
311 #define PROF_BAD_PARENT_PTR (-1429577720L)
|
jpayne@69
|
312 #define PROF_MAGIC_ITERATOR (-1429577719L)
|
jpayne@69
|
313 #define PROF_SET_SECTION_VALUE (-1429577718L)
|
jpayne@69
|
314 #define PROF_EINVAL (-1429577717L)
|
jpayne@69
|
315 #define PROF_READ_ONLY (-1429577716L)
|
jpayne@69
|
316 #define PROF_SECTION_NOTOP (-1429577715L)
|
jpayne@69
|
317 #define PROF_SECTION_SYNTAX (-1429577714L)
|
jpayne@69
|
318 #define PROF_RELATION_SYNTAX (-1429577713L)
|
jpayne@69
|
319 #define PROF_EXTRA_CBRACE (-1429577712L)
|
jpayne@69
|
320 #define PROF_MISSING_OBRACE (-1429577711L)
|
jpayne@69
|
321 #define PROF_MAGIC_PROFILE (-1429577710L)
|
jpayne@69
|
322 #define PROF_MAGIC_SECTION (-1429577709L)
|
jpayne@69
|
323 #define PROF_TOPSECTION_ITER_NOSUPP (-1429577708L)
|
jpayne@69
|
324 #define PROF_INVALID_SECTION (-1429577707L)
|
jpayne@69
|
325 #define PROF_END_OF_SECTIONS (-1429577706L)
|
jpayne@69
|
326 #define PROF_BAD_NAMESET (-1429577705L)
|
jpayne@69
|
327 #define PROF_NO_PROFILE (-1429577704L)
|
jpayne@69
|
328 #define PROF_MAGIC_FILE (-1429577703L)
|
jpayne@69
|
329 #define PROF_FAIL_OPEN (-1429577702L)
|
jpayne@69
|
330 #define PROF_EXISTS (-1429577701L)
|
jpayne@69
|
331 #define PROF_BAD_BOOLEAN (-1429577700L)
|
jpayne@69
|
332 #define PROF_BAD_INTEGER (-1429577699L)
|
jpayne@69
|
333 #define PROF_MAGIC_FILE_DATA (-1429577698L)
|
jpayne@69
|
334 #define PROF_FAIL_INCLUDE_FILE (-1429577697L)
|
jpayne@69
|
335 #define PROF_FAIL_INCLUDE_DIR (-1429577696L)
|
jpayne@69
|
336 #define PROF_UNSUPPORTED (-1429577695L)
|
jpayne@69
|
337 #define PROF_MAGIC_NODE_ITERATOR (-1429577694L)
|
jpayne@69
|
338 #define PROF_MODULE (-1429577693L)
|
jpayne@69
|
339 #define PROF_MODULE_SYNTAX (-1429577692L)
|
jpayne@69
|
340 #define PROF_MODULE_INVALID (-1429577691L)
|
jpayne@69
|
341 #define ERROR_TABLE_BASE_prof (-1429577728L)
|
jpayne@69
|
342
|
jpayne@69
|
343 extern const struct error_table et_prof_error_table;
|
jpayne@69
|
344
|
jpayne@69
|
345 #if !defined(_WIN32)
|
jpayne@69
|
346 /* for compatibility with older versions... */
|
jpayne@69
|
347 extern void initialize_prof_error_table (void) /*@modifies internalState@*/;
|
jpayne@69
|
348 #else
|
jpayne@69
|
349 #define initialize_prof_error_table()
|
jpayne@69
|
350 #endif
|
jpayne@69
|
351
|
jpayne@69
|
352 #if !defined(_WIN32)
|
jpayne@69
|
353 #define init_prof_err_tbl initialize_prof_error_table
|
jpayne@69
|
354 #define prof_err_base ERROR_TABLE_BASE_prof
|
jpayne@69
|
355 #endif
|