use alloc::{string::String, vec::Vec};
use serde::{Deserialize, Serialize};
pub const STATE_IDLE: i32 = 0;
pub const STATE_ENCRYPTING: i32 = 1;
pub const STATE_DECRYPTING: i32 = 2;
pub const STATE_PAUSED: i32 = 3;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct JvckVolumePrepareReq {
pub volume_path: String,
#[serde(default, skip_serializing_if = "String::is_empty")]
pub nt_device_path: String,
#[serde(default)]
pub use_header: u32,
#[serde(default)]
pub use_footer: u32,
#[serde(default)]
pub metadata_size: u32,
#[serde(default, with = "serde_bytes")]
pub vmk: Vec<u8>,
#[serde(default, with = "serde_bytes")]
pub metadata_block: Vec<u8>,
#[serde(default)]
pub is_os_volume: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct JvckVolumePrepareResp {
pub offset_sector: u64,
pub data_sectors: u64,
pub sector_size: u32,
#[serde(default, skip_serializing_if = "String::is_empty")]
pub raw_partition_path: String,
#[serde(default, skip_serializing_if = "String::is_empty")]
pub raw_disk_path: String,
#[serde(default)]
pub partition_start_lba: u64,
#[serde(default)]
pub fully_attached: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct JvckVolumeAttachReq {
pub volume_path: String,
#[serde(with = "serde_bytes")]
pub vmk: Vec<u8>,
#[serde(default)]
pub use_header: u32,
#[serde(default)]
pub use_footer: u32,
#[serde(default)]
pub metadata_size: u32,
#[serde(default, skip_serializing_if = "String::is_empty")]
pub nt_device_path: String,
#[serde(default, skip_serializing_if = "String::is_empty")]
pub raw_partition_path: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct JvckVolumeAttachResp {
pub offset_sector: u64,
pub total_sectors: u64,
pub sector_size: u32,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VolumeRequest {
pub volume_path: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VolumeStatus {
pub volume_path: String,
pub state: i32,
pub encrypted_sector: u64,
pub total_sectors: u64,
pub sector_size: u32,
pub is_attached: bool,
#[serde(default)]
pub filter_below_fsd: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VolumeListEntry {
pub volume_path: String,
pub state: i32,
pub encrypted_sector: u64,
pub total_sectors: u64,
pub sector_size: u32,
pub is_os_volume: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VolumeListResponse {
pub volumes: Vec<VolumeListEntry>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProgressEvent {
pub encrypted_sector: u64,
pub total_sectors: u64,
pub state: i32,
#[serde(default, skip_serializing_if = "String::is_empty")]
pub error: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BenchAesReq {
#[serde(default)]
pub size_bytes: u64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BenchAesResp {
pub size_bytes: u64,
pub encrypt_mib_s: u64,
pub decrypt_mib_s: u64,
}