1 /* 2 * Copyright (C) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 //! session_struct 16 #![allow(missing_docs)] 17 18 #[derive(Debug, Default, PartialEq, Eq, Clone)] 19 pub struct SessionHandShake { 20 pub banner: String, 21 pub auth_type: u8, 22 pub session_id: u32, 23 pub connect_key: String, 24 pub buf: String, 25 pub version: String, 26 } 27 28 #[derive(Debug, Default, PartialEq, Eq)] 29 pub struct PayloadProtect { 30 pub channel_id: u32, 31 pub command_flag: u32, 32 pub check_sum: u8, 33 pub v_code: u8, 34 } 35 36 #[derive(Debug, Default, PartialEq, Eq)] 37 pub struct PayloadHead { 38 pub flag: [u8; 2], 39 pub reserve: [u8; 2], 40 pub protocol_ver: u8, 41 pub head_size: u16, 42 pub data_size: u32, 43 } 44 45 #[allow(unused)] 46 #[derive(Debug, Default, PartialEq, Eq, Clone)] 47 pub struct UartHead { 48 pub flag: [u8; 2], 49 pub option: u16, 50 pub session_id: u32, 51 pub data_size: u32, 52 pub package_index: u32, 53 pub data_checksum: u32, 54 pub head_checksum: u32, 55 } 56 57 #[allow(unused)] 58 #[derive(Debug, Default, PartialEq, Eq)] 59 pub struct UsbHead { 60 pub flag: [u8; 2], 61 pub option: u8, 62 pub session_id: u32, 63 pub data_size: u32, 64 } 65 66 #[derive(Debug, Default, Clone, PartialEq, Eq)] 67 pub struct TransferConfig { 68 pub file_size: u64, 69 pub atime: u64, 70 pub mtime: u64, 71 pub options: String, 72 pub path: String, 73 pub optional_name: String, 74 pub update_if_new: bool, 75 pub compress_type: u8, 76 pub hold_timestamp: bool, 77 pub function_name: String, 78 pub client_cwd: String, 79 pub reserve1: String, 80 pub reserve2: String, 81 } 82 83 #[derive(Debug, Default, PartialEq, Eq)] 84 pub struct FileMode { 85 pub perm: u64, 86 pub u_id: u64, 87 pub g_id: u64, 88 pub context: String, 89 pub full_name: String, 90 } 91 92 #[derive(Debug, Default, PartialEq, Eq)] 93 pub struct TransferPayload { 94 pub index: u64, 95 pub compress_type: u8, 96 pub compress_size: u32, 97 pub uncompress_size: u32, 98 } 99