storage.h (2472B)
1 /* 2 * 3 * Wireless daemon for Linux 4 * 5 * Copyright (C) 2013-2019 Intel Corporation. All rights reserved. 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * This library 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 GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 * 21 */ 22 23 #include <time.h> 24 25 struct l_settings; 26 enum security; 27 28 ssize_t read_file(void *buffer, size_t len, const char *path_fmt, ...) 29 __attribute__((format(printf, 3, 4))); 30 31 ssize_t write_file(const void *buffer, size_t len, bool preserve_times, 32 const char *path_fmt, ...) 33 __attribute__((format(printf, 4, 5))); 34 35 bool storage_is_file(const char *filename); 36 bool storage_create_dirs(void); 37 void storage_cleanup_dirs(void); 38 char *storage_get_path(const char *format, ...); 39 char *storage_get_hotspot_path(const char *format, ...); 40 41 const char *storage_network_ssid_from_path(const char *path, 42 enum security *type); 43 char *storage_get_network_file_path(enum security type, const char *ssid); 44 45 struct l_settings *storage_network_open(enum security type, const char *ssid); 46 int storage_network_touch(enum security type, const char *ssid); 47 void storage_network_sync(enum security type, const char *ssid, 48 struct l_settings *settings); 49 int storage_network_remove(enum security type, const char *ssid); 50 51 struct l_settings *storage_known_frequencies_load(void); 52 void storage_known_frequencies_sync(struct l_settings *known_freqs); 53 54 struct l_settings *storage_eap_tls_cache_load(void); 55 void storage_eap_tls_cache_sync(const struct l_settings *cache); 56 57 int __storage_decrypt(struct l_settings *settings, const char *ssid, 58 bool *changed); 59 char *__storage_encrypt(const struct l_settings *settings, const char *ssid, 60 size_t *out_len); 61 bool storage_decrypt(struct l_settings *settings, const char *path, 62 const char *name); 63 64 bool storage_init(const uint8_t *key, size_t key_len); 65 void storage_exit(void);