aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/message/handshake.rs
diff options
context:
space:
mode:
authorMax Audron <audron@cocaine.farm>2020-01-17 10:47:50 +0100
committerMax Audron <audron@cocaine.farm>2020-01-17 10:48:44 +0100
commitde973723312c56a58651f12146668500697543c0 (patch)
treef7cc1e5f9039101bc199e611901b162aa4ed13b1 /src/protocol/message/handshake.rs
parentrefactor parse impl (diff)
finish main parsing
Diffstat (limited to 'src/protocol/message/handshake.rs')
-rw-r--r--src/protocol/message/handshake.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/protocol/message/handshake.rs b/src/protocol/message/handshake.rs
index 918c424..b346d8e 100644
--- a/src/protocol/message/handshake.rs
+++ b/src/protocol/message/handshake.rs
@@ -46,7 +46,7 @@ pub struct ClientInitReject {
impl HandshakeSerialize for ClientInitReject {
fn serialize(&self) -> Vec<u8> {
let mut values: VariantMap = VariantMap::with_capacity(2);
- values.insert("MsgProtocol::Primitive".to_string(), Variant::String("ClientInitReject".to_string()));
+ values.insert("MsgType".to_string(), Variant::String("ClientInitReject".to_string()));
values.insert("ErrorString".to_string(), Variant::String(self.error_string.clone()));
return HandshakeSerialize::serialize(&values);
}
@@ -66,19 +66,19 @@ impl HandshakeDeserialize for ClientInitReject {
pub struct ClientInitAck {
pub core_features: u32, // Flags of supported legacy features
pub core_configured: bool, // If the core has already been configured
- pub backend_info: VariantList, // List of VariantMaps of info on available backends
- pub authenticator_info: VariantList, // List of VariantMaps of info on available authenticators
+ pub storage_backends: VariantList, // List of VariantMaps of info on available backends
+ pub authenticators: VariantList, // List of VariantMaps of info on available authenticators
pub feature_list: StringList, // List of supported extended features
}
impl HandshakeSerialize for ClientInitAck {
fn serialize(&self) -> Vec<u8> {
let mut values: VariantMap = VariantMap::with_capacity(2);
- values.insert("MsgProtocol::Primitive".to_string(), Variant::String("ClientInitAck".to_string()));
+ values.insert("MsgType".to_string(), Variant::String("ClientInitAck".to_string()));
values.insert("CoreFeatures".to_string(), Variant::u32(self.core_features));
- values.insert("CoreConfigured".to_string(), Variant::bool(self.core_configured));
- values.insert("BackendInfo".to_string(), Variant::VariantList(self.backend_info.clone()));
- values.insert("AuthenticatorInfo".to_string(), Variant::VariantList(self.authenticator_info.clone()));
+ values.insert("Configured".to_string(), Variant::bool(self.core_configured));
+ values.insert("StorageBackends".to_string(), Variant::VariantList(self.storage_backends.clone()));
+ values.insert("Authenticators".to_string(), Variant::VariantList(self.authenticators.clone()));
values.insert("FeatureList".to_string(), Variant::StringList(self.feature_list.clone()));
return HandshakeSerialize::serialize(&values);
}
@@ -89,10 +89,10 @@ impl HandshakeDeserialize for ClientInitAck {
let (len, values): (usize, VariantMap) = HandshakeDeserialize::parse(b);
return (len, Self {
- core_features: match_variant!(values, Variant::u32, "CoreFeatures"),
- core_configured: match_variant!(values, Variant::bool, "CoreConfigured"),
- backend_info: match_variant!(values, Variant::VariantList, "BackendInfo"),
- authenticator_info: match_variant!(values, Variant::VariantList, "AuthenticatorInfo"),
+ core_features: 0x00008000,
+ core_configured: match_variant!(values, Variant::bool, "Configured"),
+ storage_backends: match_variant!(values, Variant::VariantList, "StorageBackends"),
+ authenticators: match_variant!(values, Variant::VariantList, "Authenticators"),
feature_list: match_variant!(values, Variant::StringList, "FeatureList")
});
}