qs_core/
packets.rs

1use crate::common::{FilesAvailable, FilesToSkip};
2use bincode::{Decode, Encode};
3
4/// All packets send from the sender to the receiver
5#[derive(Debug, Clone, Encode, Decode)]
6pub enum SenderToReceiver {
7    /// Initial connection request
8    ConnRequest { version_num: String },
9    /// Send the files the sender wants to send
10    FileInfo { files: Vec<FilesAvailable> },
11}
12
13/// All packets send from the receiver to the sender
14#[derive(Debug, Clone, Encode, Decode)]
15pub enum ReceiverToSender {
16    /// Reject the connection request, because the version number is wrong
17    WrongVersion { expected: String },
18    /// Accept the connection request
19    Ok,
20    /// Reject the files the sender wants to send
21    RejectFiles,
22    /// Accept the files, and send the files that are supposed to be fully or partially skipped
23    AcceptFilesSkip { files: Vec<Option<FilesToSkip>> },
24}