diff options
Diffstat (limited to 'nearby/connections/ukey2/ukey2_proto/src/ukey2_all_proto/ukey.rs')
-rw-r--r-- | nearby/connections/ukey2/ukey2_proto/src/ukey2_all_proto/ukey.rs | 1406 |
1 files changed, 1406 insertions, 0 deletions
diff --git a/nearby/connections/ukey2/ukey2_proto/src/ukey2_all_proto/ukey.rs b/nearby/connections/ukey2/ukey2_proto/src/ukey2_all_proto/ukey.rs new file mode 100644 index 0000000..a4aef70 --- /dev/null +++ b/nearby/connections/ukey2/ukey2_proto/src/ukey2_all_proto/ukey.rs @@ -0,0 +1,1406 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file is generated by rust-protobuf 2.28.0. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_imports)] +#![allow(unused_results)] +//! Generated file from `ukey.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_28_0; + +#[derive(PartialEq,Clone,Default,Debug)] +pub struct Ukey2Message { + // message fields + message_type: ::std::option::Option<Ukey2Message_Type>, + message_data: ::protobuf::SingularField<::std::vec::Vec<u8>>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Ukey2Message { + fn default() -> &'a Ukey2Message { + <Ukey2Message as ::protobuf::Message>::default_instance() + } +} + +impl Ukey2Message { + pub fn new() -> Ukey2Message { + ::std::default::Default::default() + } + + // optional .securegcm.Ukey2Message.Type message_type = 1; + + + pub fn get_message_type(&self) -> Ukey2Message_Type { + self.message_type.unwrap_or(Ukey2Message_Type::UNKNOWN_DO_NOT_USE) + } + pub fn clear_message_type(&mut self) { + self.message_type = ::std::option::Option::None; + } + + pub fn has_message_type(&self) -> bool { + self.message_type.is_some() + } + + // Param is passed by value, moved + pub fn set_message_type(&mut self, v: Ukey2Message_Type) { + self.message_type = ::std::option::Option::Some(v); + } + + // optional bytes message_data = 2; + + + pub fn get_message_data(&self) -> &[u8] { + match self.message_data.as_ref() { + Some(v) => &v, + None => &[], + } + } + pub fn clear_message_data(&mut self) { + self.message_data.clear(); + } + + pub fn has_message_data(&self) -> bool { + self.message_data.is_some() + } + + // Param is passed by value, moved + pub fn set_message_data(&mut self, v: ::std::vec::Vec<u8>) { + self.message_data = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_message_data(&mut self) -> &mut ::std::vec::Vec<u8> { + if self.message_data.is_none() { + self.message_data.set_default(); + } + self.message_data.as_mut().unwrap() + } + + // Take field + pub fn take_message_data(&mut self) -> ::std::vec::Vec<u8> { + self.message_data.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for Ukey2Message { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.message_type, 1, &mut self.unknown_fields)? + }, + 2 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.message_data)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.message_type { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(ref v) = self.message_data.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.message_type { + os.write_enum(1, ::protobuf::ProtobufEnum::value(&v))?; + } + if let Some(ref v) = self.message_data.as_ref() { + os.write_bytes(2, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Ukey2Message { + Ukey2Message::new() + } + + fn default_instance() -> &'static Ukey2Message { + static instance: ::protobuf::rt::LazyV2<Ukey2Message> = ::protobuf::rt::LazyV2::INIT; + instance.get(Ukey2Message::new) + } +} + +impl ::protobuf::Clear for Ukey2Message { + fn clear(&mut self) { + self.message_type = ::std::option::Option::None; + self.message_data.clear(); + self.unknown_fields.clear(); + } +} + +impl ::protobuf::reflect::ProtobufValue for Ukey2Message { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum Ukey2Message_Type { + UNKNOWN_DO_NOT_USE = 0, + ALERT = 1, + CLIENT_INIT = 2, + SERVER_INIT = 3, + CLIENT_FINISH = 4, +} + +impl ::protobuf::ProtobufEnum for Ukey2Message_Type { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option<Ukey2Message_Type> { + match value { + 0 => ::std::option::Option::Some(Ukey2Message_Type::UNKNOWN_DO_NOT_USE), + 1 => ::std::option::Option::Some(Ukey2Message_Type::ALERT), + 2 => ::std::option::Option::Some(Ukey2Message_Type::CLIENT_INIT), + 3 => ::std::option::Option::Some(Ukey2Message_Type::SERVER_INIT), + 4 => ::std::option::Option::Some(Ukey2Message_Type::CLIENT_FINISH), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [Ukey2Message_Type] = &[ + Ukey2Message_Type::UNKNOWN_DO_NOT_USE, + Ukey2Message_Type::ALERT, + Ukey2Message_Type::CLIENT_INIT, + Ukey2Message_Type::SERVER_INIT, + Ukey2Message_Type::CLIENT_FINISH, + ]; + values + } +} + +impl ::std::marker::Copy for Ukey2Message_Type { +} + +impl ::std::default::Default for Ukey2Message_Type { + fn default() -> Self { + Ukey2Message_Type::UNKNOWN_DO_NOT_USE + } +} + +impl ::protobuf::reflect::ProtobufValue for Ukey2Message_Type { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) + } +} + +#[derive(PartialEq,Clone,Default,Debug)] +pub struct Ukey2Alert { + // message fields + field_type: ::std::option::Option<Ukey2Alert_AlertType>, + error_message: ::protobuf::SingularField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Ukey2Alert { + fn default() -> &'a Ukey2Alert { + <Ukey2Alert as ::protobuf::Message>::default_instance() + } +} + +impl Ukey2Alert { + pub fn new() -> Ukey2Alert { + ::std::default::Default::default() + } + + // optional .securegcm.Ukey2Alert.AlertType type = 1; + + + pub fn get_field_type(&self) -> Ukey2Alert_AlertType { + self.field_type.unwrap_or(Ukey2Alert_AlertType::BAD_MESSAGE) + } + pub fn clear_field_type(&mut self) { + self.field_type = ::std::option::Option::None; + } + + pub fn has_field_type(&self) -> bool { + self.field_type.is_some() + } + + // Param is passed by value, moved + pub fn set_field_type(&mut self, v: Ukey2Alert_AlertType) { + self.field_type = ::std::option::Option::Some(v); + } + + // optional string error_message = 2; + + + pub fn get_error_message(&self) -> &str { + match self.error_message.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_error_message(&mut self) { + self.error_message.clear(); + } + + pub fn has_error_message(&self) -> bool { + self.error_message.is_some() + } + + // Param is passed by value, moved + pub fn set_error_message(&mut self, v: ::std::string::String) { + self.error_message = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error_message(&mut self) -> &mut ::std::string::String { + if self.error_message.is_none() { + self.error_message.set_default(); + } + self.error_message.as_mut().unwrap() + } + + // Take field + pub fn take_error_message(&mut self) -> ::std::string::String { + self.error_message.take().unwrap_or_else(|| ::std::string::String::new()) + } +} + +impl ::protobuf::Message for Ukey2Alert { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 1, &mut self.unknown_fields)? + }, + 2 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.error_message)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.field_type { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(ref v) = self.error_message.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.field_type { + os.write_enum(1, ::protobuf::ProtobufEnum::value(&v))?; + } + if let Some(ref v) = self.error_message.as_ref() { + os.write_string(2, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Ukey2Alert { + Ukey2Alert::new() + } + + fn default_instance() -> &'static Ukey2Alert { + static instance: ::protobuf::rt::LazyV2<Ukey2Alert> = ::protobuf::rt::LazyV2::INIT; + instance.get(Ukey2Alert::new) + } +} + +impl ::protobuf::Clear for Ukey2Alert { + fn clear(&mut self) { + self.field_type = ::std::option::Option::None; + self.error_message.clear(); + self.unknown_fields.clear(); + } +} + +impl ::protobuf::reflect::ProtobufValue for Ukey2Alert { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum Ukey2Alert_AlertType { + BAD_MESSAGE = 1, + BAD_MESSAGE_TYPE = 2, + INCORRECT_MESSAGE = 3, + BAD_MESSAGE_DATA = 4, + BAD_VERSION = 100, + BAD_RANDOM = 101, + BAD_HANDSHAKE_CIPHER = 102, + BAD_NEXT_PROTOCOL = 103, + BAD_PUBLIC_KEY = 104, + INTERNAL_ERROR = 200, +} + +impl ::protobuf::ProtobufEnum for Ukey2Alert_AlertType { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option<Ukey2Alert_AlertType> { + match value { + 1 => ::std::option::Option::Some(Ukey2Alert_AlertType::BAD_MESSAGE), + 2 => ::std::option::Option::Some(Ukey2Alert_AlertType::BAD_MESSAGE_TYPE), + 3 => ::std::option::Option::Some(Ukey2Alert_AlertType::INCORRECT_MESSAGE), + 4 => ::std::option::Option::Some(Ukey2Alert_AlertType::BAD_MESSAGE_DATA), + 100 => ::std::option::Option::Some(Ukey2Alert_AlertType::BAD_VERSION), + 101 => ::std::option::Option::Some(Ukey2Alert_AlertType::BAD_RANDOM), + 102 => ::std::option::Option::Some(Ukey2Alert_AlertType::BAD_HANDSHAKE_CIPHER), + 103 => ::std::option::Option::Some(Ukey2Alert_AlertType::BAD_NEXT_PROTOCOL), + 104 => ::std::option::Option::Some(Ukey2Alert_AlertType::BAD_PUBLIC_KEY), + 200 => ::std::option::Option::Some(Ukey2Alert_AlertType::INTERNAL_ERROR), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [Ukey2Alert_AlertType] = &[ + Ukey2Alert_AlertType::BAD_MESSAGE, + Ukey2Alert_AlertType::BAD_MESSAGE_TYPE, + Ukey2Alert_AlertType::INCORRECT_MESSAGE, + Ukey2Alert_AlertType::BAD_MESSAGE_DATA, + Ukey2Alert_AlertType::BAD_VERSION, + Ukey2Alert_AlertType::BAD_RANDOM, + Ukey2Alert_AlertType::BAD_HANDSHAKE_CIPHER, + Ukey2Alert_AlertType::BAD_NEXT_PROTOCOL, + Ukey2Alert_AlertType::BAD_PUBLIC_KEY, + Ukey2Alert_AlertType::INTERNAL_ERROR, + ]; + values + } +} + +impl ::std::marker::Copy for Ukey2Alert_AlertType { +} + +// Note, `Default` is implemented although default value is not 0 +impl ::std::default::Default for Ukey2Alert_AlertType { + fn default() -> Self { + Ukey2Alert_AlertType::BAD_MESSAGE + } +} + +impl ::protobuf::reflect::ProtobufValue for Ukey2Alert_AlertType { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) + } +} + +#[derive(PartialEq,Clone,Default,Debug)] +pub struct Ukey2ClientInit { + // message fields + version: ::std::option::Option<i32>, + random: ::protobuf::SingularField<::std::vec::Vec<u8>>, + pub cipher_commitments: ::protobuf::RepeatedField<Ukey2ClientInit_CipherCommitment>, + next_protocol: ::protobuf::SingularField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Ukey2ClientInit { + fn default() -> &'a Ukey2ClientInit { + <Ukey2ClientInit as ::protobuf::Message>::default_instance() + } +} + +impl Ukey2ClientInit { + pub fn new() -> Ukey2ClientInit { + ::std::default::Default::default() + } + + // optional int32 version = 1; + + + pub fn get_version(&self) -> i32 { + self.version.unwrap_or(0) + } + pub fn clear_version(&mut self) { + self.version = ::std::option::Option::None; + } + + pub fn has_version(&self) -> bool { + self.version.is_some() + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: i32) { + self.version = ::std::option::Option::Some(v); + } + + // optional bytes random = 2; + + + pub fn get_random(&self) -> &[u8] { + match self.random.as_ref() { + Some(v) => &v, + None => &[], + } + } + pub fn clear_random(&mut self) { + self.random.clear(); + } + + pub fn has_random(&self) -> bool { + self.random.is_some() + } + + // Param is passed by value, moved + pub fn set_random(&mut self, v: ::std::vec::Vec<u8>) { + self.random = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_random(&mut self) -> &mut ::std::vec::Vec<u8> { + if self.random.is_none() { + self.random.set_default(); + } + self.random.as_mut().unwrap() + } + + // Take field + pub fn take_random(&mut self) -> ::std::vec::Vec<u8> { + self.random.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // repeated .securegcm.Ukey2ClientInit.CipherCommitment cipher_commitments = 3; + + + pub fn get_cipher_commitments(&self) -> &[Ukey2ClientInit_CipherCommitment] { + &self.cipher_commitments + } + pub fn clear_cipher_commitments(&mut self) { + self.cipher_commitments.clear(); + } + + // Param is passed by value, moved + pub fn set_cipher_commitments(&mut self, v: ::protobuf::RepeatedField<Ukey2ClientInit_CipherCommitment>) { + self.cipher_commitments = v; + } + + // Mutable pointer to the field. + pub fn mut_cipher_commitments(&mut self) -> &mut ::protobuf::RepeatedField<Ukey2ClientInit_CipherCommitment> { + &mut self.cipher_commitments + } + + // Take field + pub fn take_cipher_commitments(&mut self) -> ::protobuf::RepeatedField<Ukey2ClientInit_CipherCommitment> { + ::std::mem::replace(&mut self.cipher_commitments, ::protobuf::RepeatedField::new()) + } + + // optional string next_protocol = 4; + + + pub fn get_next_protocol(&self) -> &str { + match self.next_protocol.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_next_protocol(&mut self) { + self.next_protocol.clear(); + } + + pub fn has_next_protocol(&self) -> bool { + self.next_protocol.is_some() + } + + // Param is passed by value, moved + pub fn set_next_protocol(&mut self, v: ::std::string::String) { + self.next_protocol = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_next_protocol(&mut self) -> &mut ::std::string::String { + if self.next_protocol.is_none() { + self.next_protocol.set_default(); + } + self.next_protocol.as_mut().unwrap() + } + + // Take field + pub fn take_next_protocol(&mut self) -> ::std::string::String { + self.next_protocol.take().unwrap_or_else(|| ::std::string::String::new()) + } +} + +impl ::protobuf::Message for Ukey2ClientInit { + fn is_initialized(&self) -> bool { + for v in &self.cipher_commitments { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int32()?; + self.version = ::std::option::Option::Some(tmp); + }, + 2 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.random)?; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.cipher_commitments)?; + }, + 4 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.next_protocol)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.version { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.random.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + for value in &self.cipher_commitments { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if let Some(ref v) = self.next_protocol.as_ref() { + my_size += ::protobuf::rt::string_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.version { + os.write_int32(1, v)?; + } + if let Some(ref v) = self.random.as_ref() { + os.write_bytes(2, &v)?; + } + for v in &self.cipher_commitments { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if let Some(ref v) = self.next_protocol.as_ref() { + os.write_string(4, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Ukey2ClientInit { + Ukey2ClientInit::new() + } + + fn default_instance() -> &'static Ukey2ClientInit { + static instance: ::protobuf::rt::LazyV2<Ukey2ClientInit> = ::protobuf::rt::LazyV2::INIT; + instance.get(Ukey2ClientInit::new) + } +} + +impl ::protobuf::Clear for Ukey2ClientInit { + fn clear(&mut self) { + self.version = ::std::option::Option::None; + self.random.clear(); + self.cipher_commitments.clear(); + self.next_protocol.clear(); + self.unknown_fields.clear(); + } +} + +impl ::protobuf::reflect::ProtobufValue for Ukey2ClientInit { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default,Debug)] +pub struct Ukey2ClientInit_CipherCommitment { + // message fields + handshake_cipher: ::std::option::Option<Ukey2HandshakeCipher>, + commitment: ::protobuf::SingularField<::std::vec::Vec<u8>>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Ukey2ClientInit_CipherCommitment { + fn default() -> &'a Ukey2ClientInit_CipherCommitment { + <Ukey2ClientInit_CipherCommitment as ::protobuf::Message>::default_instance() + } +} + +impl Ukey2ClientInit_CipherCommitment { + pub fn new() -> Ukey2ClientInit_CipherCommitment { + ::std::default::Default::default() + } + + // optional .securegcm.Ukey2HandshakeCipher handshake_cipher = 1; + + + pub fn get_handshake_cipher(&self) -> Ukey2HandshakeCipher { + self.handshake_cipher.unwrap_or(Ukey2HandshakeCipher::RESERVED) + } + pub fn clear_handshake_cipher(&mut self) { + self.handshake_cipher = ::std::option::Option::None; + } + + pub fn has_handshake_cipher(&self) -> bool { + self.handshake_cipher.is_some() + } + + // Param is passed by value, moved + pub fn set_handshake_cipher(&mut self, v: Ukey2HandshakeCipher) { + self.handshake_cipher = ::std::option::Option::Some(v); + } + + // optional bytes commitment = 2; + + + pub fn get_commitment(&self) -> &[u8] { + match self.commitment.as_ref() { + Some(v) => &v, + None => &[], + } + } + pub fn clear_commitment(&mut self) { + self.commitment.clear(); + } + + pub fn has_commitment(&self) -> bool { + self.commitment.is_some() + } + + // Param is passed by value, moved + pub fn set_commitment(&mut self, v: ::std::vec::Vec<u8>) { + self.commitment = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_commitment(&mut self) -> &mut ::std::vec::Vec<u8> { + if self.commitment.is_none() { + self.commitment.set_default(); + } + self.commitment.as_mut().unwrap() + } + + // Take field + pub fn take_commitment(&mut self) -> ::std::vec::Vec<u8> { + self.commitment.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for Ukey2ClientInit_CipherCommitment { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.handshake_cipher, 1, &mut self.unknown_fields)? + }, + 2 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.commitment)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.handshake_cipher { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(ref v) = self.commitment.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.handshake_cipher { + os.write_enum(1, ::protobuf::ProtobufEnum::value(&v))?; + } + if let Some(ref v) = self.commitment.as_ref() { + os.write_bytes(2, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Ukey2ClientInit_CipherCommitment { + Ukey2ClientInit_CipherCommitment::new() + } + + fn default_instance() -> &'static Ukey2ClientInit_CipherCommitment { + static instance: ::protobuf::rt::LazyV2<Ukey2ClientInit_CipherCommitment> = ::protobuf::rt::LazyV2::INIT; + instance.get(Ukey2ClientInit_CipherCommitment::new) + } +} + +impl ::protobuf::Clear for Ukey2ClientInit_CipherCommitment { + fn clear(&mut self) { + self.handshake_cipher = ::std::option::Option::None; + self.commitment.clear(); + self.unknown_fields.clear(); + } +} + +impl ::protobuf::reflect::ProtobufValue for Ukey2ClientInit_CipherCommitment { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default,Debug)] +pub struct Ukey2ServerInit { + // message fields + version: ::std::option::Option<i32>, + random: ::protobuf::SingularField<::std::vec::Vec<u8>>, + handshake_cipher: ::std::option::Option<Ukey2HandshakeCipher>, + public_key: ::protobuf::SingularField<::std::vec::Vec<u8>>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Ukey2ServerInit { + fn default() -> &'a Ukey2ServerInit { + <Ukey2ServerInit as ::protobuf::Message>::default_instance() + } +} + +impl Ukey2ServerInit { + pub fn new() -> Ukey2ServerInit { + ::std::default::Default::default() + } + + // optional int32 version = 1; + + + pub fn get_version(&self) -> i32 { + self.version.unwrap_or(0) + } + pub fn clear_version(&mut self) { + self.version = ::std::option::Option::None; + } + + pub fn has_version(&self) -> bool { + self.version.is_some() + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: i32) { + self.version = ::std::option::Option::Some(v); + } + + // optional bytes random = 2; + + + pub fn get_random(&self) -> &[u8] { + match self.random.as_ref() { + Some(v) => &v, + None => &[], + } + } + pub fn clear_random(&mut self) { + self.random.clear(); + } + + pub fn has_random(&self) -> bool { + self.random.is_some() + } + + // Param is passed by value, moved + pub fn set_random(&mut self, v: ::std::vec::Vec<u8>) { + self.random = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_random(&mut self) -> &mut ::std::vec::Vec<u8> { + if self.random.is_none() { + self.random.set_default(); + } + self.random.as_mut().unwrap() + } + + // Take field + pub fn take_random(&mut self) -> ::std::vec::Vec<u8> { + self.random.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional .securegcm.Ukey2HandshakeCipher handshake_cipher = 3; + + + pub fn get_handshake_cipher(&self) -> Ukey2HandshakeCipher { + self.handshake_cipher.unwrap_or(Ukey2HandshakeCipher::RESERVED) + } + pub fn clear_handshake_cipher(&mut self) { + self.handshake_cipher = ::std::option::Option::None; + } + + pub fn has_handshake_cipher(&self) -> bool { + self.handshake_cipher.is_some() + } + + // Param is passed by value, moved + pub fn set_handshake_cipher(&mut self, v: Ukey2HandshakeCipher) { + self.handshake_cipher = ::std::option::Option::Some(v); + } + + // optional bytes public_key = 4; + + + pub fn get_public_key(&self) -> &[u8] { + match self.public_key.as_ref() { + Some(v) => &v, + None => &[], + } + } + pub fn clear_public_key(&mut self) { + self.public_key.clear(); + } + + pub fn has_public_key(&self) -> bool { + self.public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_public_key(&mut self, v: ::std::vec::Vec<u8>) { + self.public_key = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec<u8> { + if self.public_key.is_none() { + self.public_key.set_default(); + } + self.public_key.as_mut().unwrap() + } + + // Take field + pub fn take_public_key(&mut self) -> ::std::vec::Vec<u8> { + self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for Ukey2ServerInit { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int32()?; + self.version = ::std::option::Option::Some(tmp); + }, + 2 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.random)?; + }, + 3 => { + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.handshake_cipher, 3, &mut self.unknown_fields)? + }, + 4 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.public_key)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.version { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.random.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.handshake_cipher { + my_size += ::protobuf::rt::enum_size(3, v); + } + if let Some(ref v) = self.public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.version { + os.write_int32(1, v)?; + } + if let Some(ref v) = self.random.as_ref() { + os.write_bytes(2, &v)?; + } + if let Some(v) = self.handshake_cipher { + os.write_enum(3, ::protobuf::ProtobufEnum::value(&v))?; + } + if let Some(ref v) = self.public_key.as_ref() { + os.write_bytes(4, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Ukey2ServerInit { + Ukey2ServerInit::new() + } + + fn default_instance() -> &'static Ukey2ServerInit { + static instance: ::protobuf::rt::LazyV2<Ukey2ServerInit> = ::protobuf::rt::LazyV2::INIT; + instance.get(Ukey2ServerInit::new) + } +} + +impl ::protobuf::Clear for Ukey2ServerInit { + fn clear(&mut self) { + self.version = ::std::option::Option::None; + self.random.clear(); + self.handshake_cipher = ::std::option::Option::None; + self.public_key.clear(); + self.unknown_fields.clear(); + } +} + +impl ::protobuf::reflect::ProtobufValue for Ukey2ServerInit { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default,Debug)] +pub struct Ukey2ClientFinished { + // message fields + public_key: ::protobuf::SingularField<::std::vec::Vec<u8>>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Ukey2ClientFinished { + fn default() -> &'a Ukey2ClientFinished { + <Ukey2ClientFinished as ::protobuf::Message>::default_instance() + } +} + +impl Ukey2ClientFinished { + pub fn new() -> Ukey2ClientFinished { + ::std::default::Default::default() + } + + // optional bytes public_key = 1; + + + pub fn get_public_key(&self) -> &[u8] { + match self.public_key.as_ref() { + Some(v) => &v, + None => &[], + } + } + pub fn clear_public_key(&mut self) { + self.public_key.clear(); + } + + pub fn has_public_key(&self) -> bool { + self.public_key.is_some() + } + + // Param is passed by value, moved + pub fn set_public_key(&mut self, v: ::std::vec::Vec<u8>) { + self.public_key = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec<u8> { + if self.public_key.is_none() { + self.public_key.set_default(); + } + self.public_key.as_mut().unwrap() + } + + // Take field + pub fn take_public_key(&mut self) -> ::std::vec::Vec<u8> { + self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for Ukey2ClientFinished { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.public_key)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.public_key.as_ref() { + os.write_bytes(1, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Ukey2ClientFinished { + Ukey2ClientFinished::new() + } + + fn default_instance() -> &'static Ukey2ClientFinished { + static instance: ::protobuf::rt::LazyV2<Ukey2ClientFinished> = ::protobuf::rt::LazyV2::INIT; + instance.get(Ukey2ClientFinished::new) + } +} + +impl ::protobuf::Clear for Ukey2ClientFinished { + fn clear(&mut self) { + self.public_key.clear(); + self.unknown_fields.clear(); + } +} + +impl ::protobuf::reflect::ProtobufValue for Ukey2ClientFinished { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum Ukey2HandshakeCipher { + RESERVED = 0, + P256_SHA512 = 100, + CURVE25519_SHA512 = 200, +} + +impl ::protobuf::ProtobufEnum for Ukey2HandshakeCipher { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option<Ukey2HandshakeCipher> { + match value { + 0 => ::std::option::Option::Some(Ukey2HandshakeCipher::RESERVED), + 100 => ::std::option::Option::Some(Ukey2HandshakeCipher::P256_SHA512), + 200 => ::std::option::Option::Some(Ukey2HandshakeCipher::CURVE25519_SHA512), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [Ukey2HandshakeCipher] = &[ + Ukey2HandshakeCipher::RESERVED, + Ukey2HandshakeCipher::P256_SHA512, + Ukey2HandshakeCipher::CURVE25519_SHA512, + ]; + values + } +} + +impl ::std::marker::Copy for Ukey2HandshakeCipher { +} + +impl ::std::default::Default for Ukey2HandshakeCipher { + fn default() -> Self { + Ukey2HandshakeCipher::RESERVED + } +} + +impl ::protobuf::reflect::ProtobufValue for Ukey2HandshakeCipher { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) + } +} |