| 1 | /* |
| 2 | Authors: |
| 3 | Pavel Březina <[email protected]> |
| 4 | |
| 5 | Copyright (C) 2018 Red Hat |
| 6 | |
| 7 | This program is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation; either version 3 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #ifndef _PROFILES_H_ |
| 22 | #define _PROFILES_H_cxx . . $ `src/lib/profiles/profiles.h:22:9`! |
| 23 | |
| 24 | #include <stdbool.h> |
| 25 | |
| 26 | #include "common/errno_t.h"cxx . . $ `<file>/src/common/errno_t.h`/ |
| 27 | #include "lib/files/files.h"cxx . . $ `<file>/src/lib/files/files.h`/ |
| 28 | |
| 29 | /** |
| 30 | * Profile information. |
| 31 | */ |
| 32 | struct authselect_profilecxx . . $ authselect_profile# { |
| 33 | /** |
| 34 | * Profile identifier. |
| 35 | * |
| 36 | * This may not be the same as name of the directory where the profile |
| 37 | * is stored. Custom profiles have the directory name prefixed with |
| 38 | * "custom" which differentiate them from default and vendor profiles. |
| 39 | */ |
| 40 | char *idcxx . . $ authselect_profile#id.; |
| 41 | |
| 42 | /** |
| 43 | * Filesystem path to the directory where the profile is located. |
| 44 | */ |
| 45 | char *pathcxx . . $ authselect_profile#path.; |
| 46 | |
| 47 | char *namecxx . . $ authselect_profile#name.; |
| 48 | char *descriptioncxx . . $ authselect_profile#description.; |
| 49 | char *requirementscxx . . $ authselect_profile#requirements.; |
| 50 | |
| 51 | /** |
| 52 | * System file templates. |
| 53 | */ |
| 54 | struct authselect_filescxx . . $ authselect_files# *filescxx . . $ authselect_profile#files.; |
| 55 | }; |
| 56 | |
| 57 | /** |
| 58 | * Activate given profile. |
| 59 | * |
| 60 | * Write all changes to the system. |
| 61 | * |
| 62 | * @return EOK on success, EACCES if we can not access some directories, |
| 63 | * other errno code on error. |
| 64 | */ |
| 65 | errno_tcxx . . $ errno_t# |
| 66 | authselect_profile_activatecxx . . $ authselect_profile_activate(91f62ebacbff91ef).(struct authselect_profilecxx . . $ authselect_profile# *profile, |
| 67 | const char **features); |
| 68 | |
| 69 | /** |
| 70 | * List all profile directories in a sorted NULL-terminated string array. |
| 71 | * |
| 72 | * This will find all profiles within default, vendor and custom profile |
| 73 | * directories. |
| 74 | * |
| 75 | * @param _profiles NULL-terminated sorted string array. |
| 76 | * |
| 77 | * @return EOK on success, other errno code on failure. |
| 78 | */ |
| 79 | errno_tcxx . . $ errno_t# |
| 80 | authselect_profile_listcxx . . $ authselect_profile_list(c293f0ab5a5bee95).(char ***_profiles); |
| 81 | |
| 82 | /** |
| 83 | * Read profile information. |
| 84 | * |
| 85 | * @param profile_id Profile ID to search for. |
| 86 | * @param type Profile type. |
| 87 | * @param _profile Profile information. |
| 88 | * |
| 89 | * @return EOK on success, ENOENT if the profile was not found, other errno |
| 90 | * code on error. |
| 91 | */ |
| 92 | errno_tcxx . . $ errno_t# |
| 93 | authselect_profile_readcxx . . $ authselect_profile_read(73a0aa0767d26394).(const char *profile_id, |
| 94 | enum authselect_profile_typecxx . . $ authselect_profile_type# type, |
| 95 | struct authselect_profilecxx . . $ authselect_profile# **_profile); |
| 96 | |
| 97 | /** |
| 98 | * Create custom profile id from a directory name. |
| 99 | * |
| 100 | * @param name Profile directory name. |
| 101 | * |
| 102 | * @return Custom profile id or NULL if allocation fails. |
| 103 | */ |
| 104 | char * |
| 105 | authselect_profile_custom_idcxx . . $ authselect_profile_custom_id(a8b8e32347182212).(const char *name); |
| 106 | |
| 107 | /** |
| 108 | * Return directory name of a custom profile. |
| 109 | * |
| 110 | * @param profile_id Profile id. |
| 111 | * |
| 112 | * @return Directory name of the profile, NULL if it is not a custom profile. |
| 113 | */ |
| 114 | const char * |
| 115 | authselect_profile_parse_customcxx . . $ authselect_profile_parse_custom(fb58d2e09a2a1ce6).(const char *profile_id); |
| 116 | |
| 117 | /** |
| 118 | * @return True if @profile_id is a custom profile, false otherwise. |
| 119 | */ |
| 120 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 121 | authselect_profile_is_customcxx . . $ authselect_profile_is_custom(c5f7da30cbc0f4e9).(const char *profile_id); |
| 122 | |
| 123 | /** |
| 124 | * Tell dconf to read updated files. |
| 125 | * |
| 126 | * @return EOK on success, other errno code on error. |
| 127 | */ |
| 128 | errno_tcxx . . $ errno_t# |
| 129 | authselect_profile_dconf_updatecxx . . $ authselect_profile_dconf_update(b126dc7c1de90089).(void); |
| 130 | |
| 131 | #endif /* _PROFILES_H_ */ |