/* ICFS: Interactively Controlled File System Copyright (C) 2024-2025 Fedir Kovalov This program can be distributed under the terms of the GNU GPLv2. See the file LICENSE. */ /* * Interface for controlling communication with the UI. */ #ifndef UI_SOCKET_H #define UI_SOCKET_H #include "process_info.h" #include /** * Initialize the GUI communication. * * @return: 0 on success, -1 on faliure. */ int init_ui_socket(const char *perm_permissions_db_filename); /** * Close the GUI communication. */ void destroy_ui_socket(void); /** * Check access according to: * 1. temporary permission table * 2. permanent permission table * 3. user descision * * @param filename: The file that the process is trying to access * @pram pi: The process information * @param opts: options (GRANT_TEMP, GRANT_PERM) * @return: 0 if access is denied, 1 if access is allowed */ int interactive_access(const char *filename, struct process_info pi, int opts); #define GRANT_TEMP 1 #define GRANT_PERM 2 // #define TABLE_ONLY 4 // NOTE: Add this in the future? #endif // !UI_SOCKET_H