jpayne@69: /* jpayne@69: * profile.h jpayne@69: */ jpayne@69: jpayne@69: #ifndef _KRB5_PROFILE_H jpayne@69: #define _KRB5_PROFILE_H jpayne@69: jpayne@69: #if defined(_WIN32) jpayne@69: #include jpayne@69: #endif jpayne@69: jpayne@69: #if defined(__MACH__) && defined(__APPLE__) jpayne@69: # include jpayne@69: # if TARGET_RT_MAC_CFM jpayne@69: # error "Use KfM 4.0 SDK headers for CFM compilation." jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: #ifndef KRB5_CALLCONV jpayne@69: #define KRB5_CALLCONV jpayne@69: #define KRB5_CALLCONV_C jpayne@69: #endif jpayne@69: jpayne@69: typedef struct _profile_t *profile_t; jpayne@69: jpayne@69: /* Used by profile_init_flags(). */ jpayne@69: #define PROFILE_INIT_ALLOW_MODULE 0x0001 /* Allow module declaration */ jpayne@69: jpayne@69: /* jpayne@69: * Used by the profile iterator in prof_get.c jpayne@69: */ jpayne@69: #define PROFILE_ITER_LIST_SECTION 0x0001 jpayne@69: #define PROFILE_ITER_SECTIONS_ONLY 0x0002 jpayne@69: #define PROFILE_ITER_RELATIONS_ONLY 0x0004 jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: extern "C" { jpayne@69: #endif /* __cplusplus */ jpayne@69: jpayne@69: typedef char* profile_filespec_t; /* path as C string */ jpayne@69: typedef char* profile_filespec_list_t; /* list of : separated paths, C string */ jpayne@69: typedef const char * const_profile_filespec_t; /* path as C string */ jpayne@69: typedef const char * const_profile_filespec_list_t; /* list of : separated paths, C string */ jpayne@69: jpayne@69: long KRB5_CALLCONV profile_init jpayne@69: (const_profile_filespec_t *files, profile_t *ret_profile); jpayne@69: jpayne@69: long KRB5_CALLCONV profile_init_flags jpayne@69: (const_profile_filespec_t *files, int flags, profile_t *ret_profile); jpayne@69: jpayne@69: long KRB5_CALLCONV profile_init_path jpayne@69: (const_profile_filespec_list_t filelist, profile_t *ret_profile); jpayne@69: jpayne@69: long KRB5_CALLCONV profile_flush jpayne@69: (profile_t profile); jpayne@69: long KRB5_CALLCONV profile_flush_to_file jpayne@69: (profile_t profile, const_profile_filespec_t outfile); jpayne@69: long KRB5_CALLCONV profile_flush_to_buffer jpayne@69: (profile_t profile, char **bufp); jpayne@69: void KRB5_CALLCONV profile_free_buffer jpayne@69: (profile_t profile, char *buf); jpayne@69: jpayne@69: long KRB5_CALLCONV profile_is_writable jpayne@69: (profile_t profile, int *writable); jpayne@69: long KRB5_CALLCONV profile_is_modified jpayne@69: (profile_t profile, int *modified); jpayne@69: jpayne@69: void KRB5_CALLCONV profile_abandon jpayne@69: (profile_t profile); jpayne@69: jpayne@69: void KRB5_CALLCONV profile_release jpayne@69: (profile_t profile); jpayne@69: jpayne@69: long KRB5_CALLCONV profile_get_values jpayne@69: (profile_t profile, const char *const *names, char ***ret_values); jpayne@69: jpayne@69: void KRB5_CALLCONV profile_free_list jpayne@69: (char **list); jpayne@69: jpayne@69: long KRB5_CALLCONV profile_get_string jpayne@69: (profile_t profile, const char *name, const char *subname, jpayne@69: const char *subsubname, const char *def_val, jpayne@69: char **ret_string); jpayne@69: long KRB5_CALLCONV profile_get_integer jpayne@69: (profile_t profile, const char *name, const char *subname, jpayne@69: const char *subsubname, int def_val, jpayne@69: int *ret_default); jpayne@69: jpayne@69: long KRB5_CALLCONV profile_get_boolean jpayne@69: (profile_t profile, const char *name, const char *subname, jpayne@69: const char *subsubname, int def_val, jpayne@69: int *ret_default); jpayne@69: jpayne@69: long KRB5_CALLCONV profile_get_relation_names jpayne@69: (profile_t profile, const char **names, char ***ret_names); jpayne@69: jpayne@69: long KRB5_CALLCONV profile_get_subsection_names jpayne@69: (profile_t profile, const char **names, char ***ret_names); jpayne@69: jpayne@69: long KRB5_CALLCONV profile_iterator_create jpayne@69: (profile_t profile, const char *const *names, jpayne@69: int flags, void **ret_iter); jpayne@69: jpayne@69: void KRB5_CALLCONV profile_iterator_free jpayne@69: (void **iter_p); jpayne@69: jpayne@69: long KRB5_CALLCONV profile_iterator jpayne@69: (void **iter_p, char **ret_name, char **ret_value); jpayne@69: jpayne@69: void KRB5_CALLCONV profile_release_string (char *str); jpayne@69: jpayne@69: long KRB5_CALLCONV profile_update_relation jpayne@69: (profile_t profile, const char **names, jpayne@69: const char *old_value, const char *new_value); jpayne@69: jpayne@69: long KRB5_CALLCONV profile_clear_relation jpayne@69: (profile_t profile, const char **names); jpayne@69: jpayne@69: long KRB5_CALLCONV profile_rename_section jpayne@69: (profile_t profile, const char **names, jpayne@69: const char *new_name); jpayne@69: jpayne@69: long KRB5_CALLCONV profile_add_relation jpayne@69: (profile_t profile, const char **names, jpayne@69: const char *new_value); jpayne@69: jpayne@69: /* jpayne@69: * profile_init_vtable allows a caller to create a profile-compatible object jpayne@69: * with a different back end. jpayne@69: */ jpayne@69: jpayne@69: /* jpayne@69: * Mandatory: Look up all of the relations for names, placing the resulting jpayne@69: * values in *ret_values. If no relations exist, return PROF_NO_RELATION, or jpayne@69: * PROF_NO_SECTION to indicate that one of the intermediate names does not jpayne@69: * exist as a section. The list will be freed with free_values. jpayne@69: */ jpayne@69: typedef long jpayne@69: (*profile_get_values_fn)(void *cbdata, const char *const *names, jpayne@69: char ***ret_values); jpayne@69: jpayne@69: /* Mandatory: Free a list of strings returned by get_values. */ jpayne@69: typedef void jpayne@69: (*profile_free_values_fn)(void *cbdata, char **values); jpayne@69: jpayne@69: /* Optional: Release any data associated with the profile. */ jpayne@69: typedef void jpayne@69: (*profile_cleanup_fn)(void *cbdata); jpayne@69: jpayne@69: /* jpayne@69: * Optional (mandatory if cleanup is defined): Generate a new cbdata pointer jpayne@69: * for a copy of the profile. If not implemented, the new profile will receive jpayne@69: * the same cbdata pointer as the old one. jpayne@69: */ jpayne@69: typedef long jpayne@69: (*profile_copy_fn)(void *cbdata, void **ret_cbdata); jpayne@69: jpayne@69: /* jpayne@69: * Optional: Create an iterator handle. jpayne@69: * jpayne@69: * If flags contains PROFILE_ITER_LIST_SECTION, iterate over all of the jpayne@69: * relations and sections within names. Otherwise, iterate over the relation jpayne@69: * values for names, or produce a single section result if names is a section. jpayne@69: * jpayne@69: * If flags contains PROFILE_ITER_SECTIONS_ONLY, produce only sections. jpayne@69: * jpayne@69: * If flags contains PROFILE_ITER_RELATIONS_ONLY, produce only relations. jpayne@69: */ jpayne@69: typedef long jpayne@69: (*profile_iterator_create_fn)(void *cbdata, const char *const *names, jpayne@69: int flags, void **ret_iter); jpayne@69: jpayne@69: /* jpayne@69: * Optional (mandatory if iterator_create is defined): Produce the next jpayne@69: * relation or section in an iteration. If producing a section result, set jpayne@69: * *ret_value to NULL. The returned strings will be freed with free_string. jpayne@69: */ jpayne@69: typedef long jpayne@69: (*profile_iterator_fn)(void *cbdata, void *iter, char **ret_name, jpayne@69: char **ret_value); jpayne@69: jpayne@69: /* jpayne@69: * Optional (mandatory if iterator_create is defined): Free the memory for an jpayne@69: * iterator. jpayne@69: */ jpayne@69: typedef void jpayne@69: (*profile_iterator_free_fn)(void *cbdata, void *iter); jpayne@69: jpayne@69: /* Optional (mandatory if iterator is defined): Free a string value. */ jpayne@69: typedef void jpayne@69: (*profile_free_string_fn)(void *cbdata, char *string); jpayne@69: jpayne@69: /* jpayne@69: * Optional: Determine if a profile is writable. If not implemented, the jpayne@69: * profile is never writable. jpayne@69: */ jpayne@69: typedef long jpayne@69: (*profile_writable_fn)(void *cbdata, int *writable); jpayne@69: jpayne@69: /* jpayne@69: * Optional: Determine if a profile is modified in memory relative to the jpayne@69: * persistent store. If not implemented, the profile is assumed to never be jpayne@69: * modified. jpayne@69: */ jpayne@69: typedef long jpayne@69: (*profile_modified_fn)(void *cbdata, int *modified); jpayne@69: jpayne@69: /* jpayne@69: * Optional: Change the value of a relation, or remove it if new_value is NULL. jpayne@69: * If old_value is set and the relation does not have that value, return jpayne@69: * PROF_NO_RELATION. jpayne@69: */ jpayne@69: typedef long jpayne@69: (*profile_update_relation_fn)(void *cbdata, const char **names, jpayne@69: const char *old_value, const char *new_value); jpayne@69: jpayne@69: /* jpayne@69: * Optional: Rename a section to new_name, or remove the section if new_name is jpayne@69: * NULL. jpayne@69: */ jpayne@69: typedef long jpayne@69: (*profile_rename_section_fn)(void *cbdata, const char **names, jpayne@69: const char *new_name); jpayne@69: jpayne@69: /* jpayne@69: * Optional: Add a new relation, or a new section if new_value is NULL. Add jpayne@69: * any intermediate sections as necessary. jpayne@69: */ jpayne@69: typedef long jpayne@69: (*profile_add_relation_fn)(void *cbdata, const char **names, jpayne@69: const char *new_value); jpayne@69: jpayne@69: /* jpayne@69: * Optional: Flush any pending memory updates to the persistent store. If jpayne@69: * implemented, this function will be called by profile_release as well as jpayne@69: * profile_flush, so make sure it's not inefficient to flush an unmodified jpayne@69: * profile. jpayne@69: */ jpayne@69: typedef long jpayne@69: (*profile_flush_fn)(void *cbdata); jpayne@69: jpayne@69: struct profile_vtable { jpayne@69: int minor_ver; /* Set to structure minor version (currently 1) jpayne@69: * if calling profile_init_vtable. */ jpayne@69: jpayne@69: /* Methods needed for a basic read-only non-iterable profile (cleanup is jpayne@69: * optional). */ jpayne@69: profile_get_values_fn get_values; jpayne@69: profile_free_values_fn free_values; jpayne@69: profile_cleanup_fn cleanup; jpayne@69: profile_copy_fn copy; jpayne@69: jpayne@69: /* Methods for iterable profiles. */ jpayne@69: profile_iterator_create_fn iterator_create; jpayne@69: profile_iterator_fn iterator; jpayne@69: profile_iterator_free_fn iterator_free; jpayne@69: profile_free_string_fn free_string; jpayne@69: jpayne@69: /* Methods for writable profiles. */ jpayne@69: profile_writable_fn writable; jpayne@69: profile_modified_fn modified; jpayne@69: profile_update_relation_fn update_relation; jpayne@69: profile_rename_section_fn rename_section; jpayne@69: profile_add_relation_fn add_relation; jpayne@69: profile_flush_fn flush; jpayne@69: jpayne@69: /* End of minor version 1. */ jpayne@69: }; jpayne@69: jpayne@69: /* jpayne@69: * Create a profile object whose operations will be performed using the jpayne@69: * function pointers in vtable. cbdata will be supplied to each vtable jpayne@69: * function as the first argument. jpayne@69: */ jpayne@69: long KRB5_CALLCONV profile_init_vtable jpayne@69: (struct profile_vtable *vtable, void *cbdata, profile_t *ret_profile); jpayne@69: jpayne@69: /* jpayne@69: * Dynamically loadable profile modules should define a function named jpayne@69: * "profile_module_init" matching the following signature. The function should jpayne@69: * initialize the methods of the provided vtable structure, stopping at the jpayne@69: * field corresponding to vtable->minor_ver. Do not change the value of jpayne@69: * vtable->minor_ver. Unimplemented methods can be left uninitialized. The jpayne@69: * function should supply a callback data pointer in *cb_ret; this pointer can jpayne@69: * be cleaned up via the vtable cleanup method. jpayne@69: */ jpayne@69: typedef long jpayne@69: (*profile_module_init_fn)(const char *residual, struct profile_vtable *vtable, jpayne@69: void **cb_ret); jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: } jpayne@69: #endif /* __cplusplus */ jpayne@69: jpayne@69: #endif /* _KRB5_PROFILE_H */ jpayne@69: /* jpayne@69: * et-h-prof_err.h: jpayne@69: * This file is automatically generated; please do not edit it. jpayne@69: */ jpayne@69: jpayne@69: #include jpayne@69: jpayne@69: #define PROF_VERSION (-1429577728L) jpayne@69: #define PROF_MAGIC_NODE (-1429577727L) jpayne@69: #define PROF_NO_SECTION (-1429577726L) jpayne@69: #define PROF_NO_RELATION (-1429577725L) jpayne@69: #define PROF_ADD_NOT_SECTION (-1429577724L) jpayne@69: #define PROF_SECTION_WITH_VALUE (-1429577723L) jpayne@69: #define PROF_BAD_LINK_LIST (-1429577722L) jpayne@69: #define PROF_BAD_GROUP_LVL (-1429577721L) jpayne@69: #define PROF_BAD_PARENT_PTR (-1429577720L) jpayne@69: #define PROF_MAGIC_ITERATOR (-1429577719L) jpayne@69: #define PROF_SET_SECTION_VALUE (-1429577718L) jpayne@69: #define PROF_EINVAL (-1429577717L) jpayne@69: #define PROF_READ_ONLY (-1429577716L) jpayne@69: #define PROF_SECTION_NOTOP (-1429577715L) jpayne@69: #define PROF_SECTION_SYNTAX (-1429577714L) jpayne@69: #define PROF_RELATION_SYNTAX (-1429577713L) jpayne@69: #define PROF_EXTRA_CBRACE (-1429577712L) jpayne@69: #define PROF_MISSING_OBRACE (-1429577711L) jpayne@69: #define PROF_MAGIC_PROFILE (-1429577710L) jpayne@69: #define PROF_MAGIC_SECTION (-1429577709L) jpayne@69: #define PROF_TOPSECTION_ITER_NOSUPP (-1429577708L) jpayne@69: #define PROF_INVALID_SECTION (-1429577707L) jpayne@69: #define PROF_END_OF_SECTIONS (-1429577706L) jpayne@69: #define PROF_BAD_NAMESET (-1429577705L) jpayne@69: #define PROF_NO_PROFILE (-1429577704L) jpayne@69: #define PROF_MAGIC_FILE (-1429577703L) jpayne@69: #define PROF_FAIL_OPEN (-1429577702L) jpayne@69: #define PROF_EXISTS (-1429577701L) jpayne@69: #define PROF_BAD_BOOLEAN (-1429577700L) jpayne@69: #define PROF_BAD_INTEGER (-1429577699L) jpayne@69: #define PROF_MAGIC_FILE_DATA (-1429577698L) jpayne@69: #define PROF_FAIL_INCLUDE_FILE (-1429577697L) jpayne@69: #define PROF_FAIL_INCLUDE_DIR (-1429577696L) jpayne@69: #define PROF_UNSUPPORTED (-1429577695L) jpayne@69: #define PROF_MAGIC_NODE_ITERATOR (-1429577694L) jpayne@69: #define PROF_MODULE (-1429577693L) jpayne@69: #define PROF_MODULE_SYNTAX (-1429577692L) jpayne@69: #define PROF_MODULE_INVALID (-1429577691L) jpayne@69: #define ERROR_TABLE_BASE_prof (-1429577728L) jpayne@69: jpayne@69: extern const struct error_table et_prof_error_table; jpayne@69: jpayne@69: #if !defined(_WIN32) jpayne@69: /* for compatibility with older versions... */ jpayne@69: extern void initialize_prof_error_table (void) /*@modifies internalState@*/; jpayne@69: #else jpayne@69: #define initialize_prof_error_table() jpayne@69: #endif jpayne@69: jpayne@69: #if !defined(_WIN32) jpayne@69: #define init_prof_err_tbl initialize_prof_error_table jpayne@69: #define prof_err_base ERROR_TABLE_BASE_prof jpayne@69: #endif