diff --git a/Cargo.toml b/Cargo.toml index 568ec55..83f8f2d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fcpv2" -version = "0.0.1" +version = "0.0.2" authors = ["Horhik "] edition = "2018" license = "GPL-2.0" diff --git a/src/client/types.rs b/src/client/types.rs index 0bc7662..37de08f 100644 --- a/src/client/types.rs +++ b/src/client/types.rs @@ -20,6 +20,8 @@ pub enum VisibilityLevel { Yes, } pub enum VerbosityPut { + + SimpleProgress, ExpectedHashes, PutFetchable, @@ -61,11 +63,19 @@ fn is_berbosity_put_converting() { } pub enum VerbosityGet { + /// 0: report when complete + Report, + /// 1: SimpleProgress messages SimpleProgress, + /// 2: SendingToNetwork messages SendingToNetwork, + /// 4: CompatibilityMode messages (since 1255) CompatibilityMode, + /// 8: ExpectedHashes messages (since 1255) ExpectedHashes, + /// 32: ExpectedMIME messages (since 1307) ExpectedMIME, + /// 64: ExpectedDataLength messages (since 1307) ExpectedDataLength, } diff --git a/src/types/mod.rs b/src/types/mod.rs index 90ba3f9..8bad93a 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -1,6 +1,6 @@ pub mod traits; -use traits::*; use regex::Regex; +use traits::*; #[derive(Debug, PartialEq)] pub struct SSK { @@ -26,7 +26,7 @@ impl FcpParser for SSKKeypair { let reg = Regex::new( r"^SSKKeypair\nIdentifier=(.*)\nInsertURI=(.*)\nRequestURI=(.*)\nEndMessage", ) - .unwrap(); + .unwrap(); println!("{:?}", reg); let res = reg.captures(plain).unwrap(); let identifier = res[1].to_string(); @@ -40,10 +40,12 @@ impl FcpParser for SSKKeypair { } } - pub enum ReturnType { + /// return the data directly to the client via an AllData message, once we have all of it. (For persistent requests, the client will get a DataFound message but must send a GetRequestStatus to ask for the AllData). Direct, + /// write the data to disk. If you download to disk, you have to do a TestDDARequest. None, + /// don't return the data at all, just fetch it to the node and tell the client when we have finished. Disk, } @@ -52,4 +54,3 @@ impl FcpRequest for ReturnType { unimplemented!(); } } - diff --git a/src/types/traits.rs b/src/types/traits.rs index 367d5b2..b312ccc 100644 --- a/src/types/traits.rs +++ b/src/types/traits.rs @@ -1,7 +1,6 @@ pub trait FcpRequest { fn convert(&self) -> String; - fn fcp_wrap(&self, prefix: &str, postfix: &str) -> String { format!("{}{}{}", prefix, self.convert(), postfix) }