1 /* 2 * Copyright (C) 2022 Huawei Technologies Co., Ltd. 3 * Decription: function declaration for session management. 4 * 5 * This software is licensed under the terms of the GNU General Public 6 * License version 2, as published by the Free Software Foundation, and 7 * may be copied, distributed, and modified under those terms. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 */ 14 #ifndef SESSION_MANAGER_H 15 #define SESSION_MANAGER_H 16 17 #include <linux/fs.h> 18 #include "tc_ns_client.h" 19 #include "teek_ns_client.h" 20 21 int tc_client_session_ioctl(struct file *file, unsigned int cmd, 22 unsigned long arg); 23 int tc_ns_open_session(struct tc_ns_dev_file *dev_file, 24 struct tc_ns_client_context *context); 25 int tc_ns_close_session(struct tc_ns_dev_file *dev_file, 26 struct tc_ns_client_context *context); 27 int tc_ns_send_cmd(struct tc_ns_dev_file *dev_file, 28 struct tc_ns_client_context *context); 29 int tc_ns_load_image(struct tc_ns_dev_file *dev, const char *file_buffer, 30 struct sec_file_info *sec_file_info, struct tc_ns_client_return *tee_ret); 31 int tc_ns_load_image_with_lock(struct tc_ns_dev_file *dev, 32 const char *file_buffer, unsigned int file_size, enum secfile_type_t type); 33 void close_unclosed_session_in_kthread(struct tc_ns_dev_file *dev); 34 struct tc_ns_session *tc_find_session_by_uuid(unsigned int dev_file_id, 35 const struct tc_ns_smc_cmd *cmd); 36 struct tc_ns_service *tc_find_service_in_dev(const struct tc_ns_dev_file *dev, 37 const unsigned char *uuid, int uuid_size); 38 struct tc_ns_session *tc_find_session_withowner( 39 const struct list_head *session_list, unsigned int session_id, 40 const struct tc_ns_dev_file *dev_file); 41 int tc_ns_load_secfile(struct tc_ns_dev_file *dev_file, 42 void __user *argp, bool is_from_client_node); 43 int load_image(struct load_img_params *params, 44 struct sec_file_info *sec_file_info, struct tc_ns_client_return *tee_ret); 45 void get_service_struct(struct tc_ns_service *service); 46 void put_service_struct(struct tc_ns_service *service); 47 void get_session_struct(struct tc_ns_session *session); 48 void put_session_struct(struct tc_ns_session *session); 49 void dump_services_status(const char *param); 50 void init_srvc_list(void); 51 void free_all_session(void); 52 53 #endif 54