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