1 // Copyright 2024 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // This file is generated by rust-protobuf 3.2.0. Do not edit 16 // .proto file is parsed by protoc 3.21.12 17 // @generated 18 19 // https://github.com/rust-lang/rust-clippy/issues/702 20 #![allow(unknown_lints)] 21 #![allow(clippy::all)] 22 23 #![allow(unused_attributes)] 24 #![cfg_attr(rustfmt, rustfmt::skip)] 25 26 #![allow(box_pointers)] 27 #![allow(dead_code)] 28 #![allow(missing_docs)] 29 #![allow(non_camel_case_types)] 30 #![allow(non_snake_case)] 31 #![allow(non_upper_case_globals)] 32 #![allow(trivial_casts)] 33 #![allow(unused_results)] 34 #![allow(unused_mut)] 35 36 //! Generated file from `device_to_device_messages.proto` 37 // Generated for lite runtime 38 39 /// Generated files are compatible only with the same version 40 /// of protobuf runtime. 41 const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_2_0; 42 43 #[derive(PartialEq,Clone,Default,Debug)] 44 // @@protoc_insertion_point(message:securegcm.DeviceToDeviceMessage) 45 pub struct DeviceToDeviceMessage { 46 // message fields 47 // @@protoc_insertion_point(field:securegcm.DeviceToDeviceMessage.message) 48 pub message: ::std::option::Option<::std::vec::Vec<u8>>, 49 // @@protoc_insertion_point(field:securegcm.DeviceToDeviceMessage.sequence_number) 50 pub sequence_number: ::std::option::Option<i32>, 51 // special fields 52 // @@protoc_insertion_point(special_field:securegcm.DeviceToDeviceMessage.special_fields) 53 pub special_fields: ::protobuf::SpecialFields, 54 } 55 56 impl<'a> ::std::default::Default for &'a DeviceToDeviceMessage { default() -> &'a DeviceToDeviceMessage57 fn default() -> &'a DeviceToDeviceMessage { 58 <DeviceToDeviceMessage as ::protobuf::Message>::default_instance() 59 } 60 } 61 62 impl DeviceToDeviceMessage { new() -> DeviceToDeviceMessage63 pub fn new() -> DeviceToDeviceMessage { 64 ::std::default::Default::default() 65 } 66 67 // optional bytes message = 1; 68 message(&self) -> &[u8]69 pub fn message(&self) -> &[u8] { 70 match self.message.as_ref() { 71 Some(v) => v, 72 None => &[], 73 } 74 } 75 clear_message(&mut self)76 pub fn clear_message(&mut self) { 77 self.message = ::std::option::Option::None; 78 } 79 has_message(&self) -> bool80 pub fn has_message(&self) -> bool { 81 self.message.is_some() 82 } 83 84 // Param is passed by value, moved set_message(&mut self, v: ::std::vec::Vec<u8>)85 pub fn set_message(&mut self, v: ::std::vec::Vec<u8>) { 86 self.message = ::std::option::Option::Some(v); 87 } 88 89 // Mutable pointer to the field. 90 // If field is not initialized, it is initialized with default value first. mut_message(&mut self) -> &mut ::std::vec::Vec<u8>91 pub fn mut_message(&mut self) -> &mut ::std::vec::Vec<u8> { 92 if self.message.is_none() { 93 self.message = ::std::option::Option::Some(::std::vec::Vec::new()); 94 } 95 self.message.as_mut().unwrap() 96 } 97 98 // Take field take_message(&mut self) -> ::std::vec::Vec<u8>99 pub fn take_message(&mut self) -> ::std::vec::Vec<u8> { 100 self.message.take().unwrap_or_else(|| ::std::vec::Vec::new()) 101 } 102 103 // optional int32 sequence_number = 2; 104 sequence_number(&self) -> i32105 pub fn sequence_number(&self) -> i32 { 106 self.sequence_number.unwrap_or(0) 107 } 108 clear_sequence_number(&mut self)109 pub fn clear_sequence_number(&mut self) { 110 self.sequence_number = ::std::option::Option::None; 111 } 112 has_sequence_number(&self) -> bool113 pub fn has_sequence_number(&self) -> bool { 114 self.sequence_number.is_some() 115 } 116 117 // Param is passed by value, moved set_sequence_number(&mut self, v: i32)118 pub fn set_sequence_number(&mut self, v: i32) { 119 self.sequence_number = ::std::option::Option::Some(v); 120 } 121 } 122 123 impl ::protobuf::Message for DeviceToDeviceMessage { 124 const NAME: &'static str = "DeviceToDeviceMessage"; 125 is_initialized(&self) -> bool126 fn is_initialized(&self) -> bool { 127 true 128 } 129 merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()>130 fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { 131 while let Some(tag) = is.read_raw_tag_or_eof()? { 132 match tag { 133 10 => { 134 self.message = ::std::option::Option::Some(is.read_bytes()?); 135 }, 136 16 => { 137 self.sequence_number = ::std::option::Option::Some(is.read_int32()?); 138 }, 139 tag => { 140 ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; 141 }, 142 }; 143 } 144 ::std::result::Result::Ok(()) 145 } 146 147 // Compute sizes of nested messages 148 #[allow(unused_variables)] compute_size(&self) -> u64149 fn compute_size(&self) -> u64 { 150 let mut my_size = 0; 151 if let Some(v) = self.message.as_ref() { 152 my_size += ::protobuf::rt::bytes_size(1, &v); 153 } 154 if let Some(v) = self.sequence_number { 155 my_size += ::protobuf::rt::int32_size(2, v); 156 } 157 my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); 158 self.special_fields.cached_size().set(my_size as u32); 159 my_size 160 } 161 write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()>162 fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { 163 if let Some(v) = self.message.as_ref() { 164 os.write_bytes(1, v)?; 165 } 166 if let Some(v) = self.sequence_number { 167 os.write_int32(2, v)?; 168 } 169 os.write_unknown_fields(self.special_fields.unknown_fields())?; 170 ::std::result::Result::Ok(()) 171 } 172 special_fields(&self) -> &::protobuf::SpecialFields173 fn special_fields(&self) -> &::protobuf::SpecialFields { 174 &self.special_fields 175 } 176 mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields177 fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { 178 &mut self.special_fields 179 } 180 new() -> DeviceToDeviceMessage181 fn new() -> DeviceToDeviceMessage { 182 DeviceToDeviceMessage::new() 183 } 184 clear(&mut self)185 fn clear(&mut self) { 186 self.message = ::std::option::Option::None; 187 self.sequence_number = ::std::option::Option::None; 188 self.special_fields.clear(); 189 } 190 default_instance() -> &'static DeviceToDeviceMessage191 fn default_instance() -> &'static DeviceToDeviceMessage { 192 static instance: DeviceToDeviceMessage = DeviceToDeviceMessage { 193 message: ::std::option::Option::None, 194 sequence_number: ::std::option::Option::None, 195 special_fields: ::protobuf::SpecialFields::new(), 196 }; 197 &instance 198 } 199 } 200 201 #[derive(PartialEq,Clone,Default,Debug)] 202 // @@protoc_insertion_point(message:securegcm.InitiatorHello) 203 pub struct InitiatorHello { 204 // message fields 205 // @@protoc_insertion_point(field:securegcm.InitiatorHello.public_dh_key) 206 pub public_dh_key: ::protobuf::MessageField<super::securemessage::GenericPublicKey>, 207 // @@protoc_insertion_point(field:securegcm.InitiatorHello.protocol_version) 208 pub protocol_version: ::std::option::Option<i32>, 209 // special fields 210 // @@protoc_insertion_point(special_field:securegcm.InitiatorHello.special_fields) 211 pub special_fields: ::protobuf::SpecialFields, 212 } 213 214 impl<'a> ::std::default::Default for &'a InitiatorHello { default() -> &'a InitiatorHello215 fn default() -> &'a InitiatorHello { 216 <InitiatorHello as ::protobuf::Message>::default_instance() 217 } 218 } 219 220 impl InitiatorHello { new() -> InitiatorHello221 pub fn new() -> InitiatorHello { 222 ::std::default::Default::default() 223 } 224 225 // optional int32 protocol_version = 2; 226 protocol_version(&self) -> i32227 pub fn protocol_version(&self) -> i32 { 228 self.protocol_version.unwrap_or(0i32) 229 } 230 clear_protocol_version(&mut self)231 pub fn clear_protocol_version(&mut self) { 232 self.protocol_version = ::std::option::Option::None; 233 } 234 has_protocol_version(&self) -> bool235 pub fn has_protocol_version(&self) -> bool { 236 self.protocol_version.is_some() 237 } 238 239 // Param is passed by value, moved set_protocol_version(&mut self, v: i32)240 pub fn set_protocol_version(&mut self, v: i32) { 241 self.protocol_version = ::std::option::Option::Some(v); 242 } 243 } 244 245 impl ::protobuf::Message for InitiatorHello { 246 const NAME: &'static str = "InitiatorHello"; 247 is_initialized(&self) -> bool248 fn is_initialized(&self) -> bool { 249 for v in &self.public_dh_key { 250 if !v.is_initialized() { 251 return false; 252 } 253 }; 254 true 255 } 256 merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()>257 fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { 258 while let Some(tag) = is.read_raw_tag_or_eof()? { 259 match tag { 260 10 => { 261 ::protobuf::rt::read_singular_message_into_field(is, &mut self.public_dh_key)?; 262 }, 263 16 => { 264 self.protocol_version = ::std::option::Option::Some(is.read_int32()?); 265 }, 266 tag => { 267 ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; 268 }, 269 }; 270 } 271 ::std::result::Result::Ok(()) 272 } 273 274 // Compute sizes of nested messages 275 #[allow(unused_variables)] compute_size(&self) -> u64276 fn compute_size(&self) -> u64 { 277 let mut my_size = 0; 278 if let Some(v) = self.public_dh_key.as_ref() { 279 let len = v.compute_size(); 280 my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; 281 } 282 if let Some(v) = self.protocol_version { 283 my_size += ::protobuf::rt::int32_size(2, v); 284 } 285 my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); 286 self.special_fields.cached_size().set(my_size as u32); 287 my_size 288 } 289 write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()>290 fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { 291 if let Some(v) = self.public_dh_key.as_ref() { 292 ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; 293 } 294 if let Some(v) = self.protocol_version { 295 os.write_int32(2, v)?; 296 } 297 os.write_unknown_fields(self.special_fields.unknown_fields())?; 298 ::std::result::Result::Ok(()) 299 } 300 special_fields(&self) -> &::protobuf::SpecialFields301 fn special_fields(&self) -> &::protobuf::SpecialFields { 302 &self.special_fields 303 } 304 mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields305 fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { 306 &mut self.special_fields 307 } 308 new() -> InitiatorHello309 fn new() -> InitiatorHello { 310 InitiatorHello::new() 311 } 312 clear(&mut self)313 fn clear(&mut self) { 314 self.public_dh_key.clear(); 315 self.protocol_version = ::std::option::Option::None; 316 self.special_fields.clear(); 317 } 318 default_instance() -> &'static InitiatorHello319 fn default_instance() -> &'static InitiatorHello { 320 static instance: InitiatorHello = InitiatorHello { 321 public_dh_key: ::protobuf::MessageField::none(), 322 protocol_version: ::std::option::Option::None, 323 special_fields: ::protobuf::SpecialFields::new(), 324 }; 325 &instance 326 } 327 } 328 329 #[derive(PartialEq,Clone,Default,Debug)] 330 // @@protoc_insertion_point(message:securegcm.ResponderHello) 331 pub struct ResponderHello { 332 // message fields 333 // @@protoc_insertion_point(field:securegcm.ResponderHello.public_dh_key) 334 pub public_dh_key: ::protobuf::MessageField<super::securemessage::GenericPublicKey>, 335 // @@protoc_insertion_point(field:securegcm.ResponderHello.protocol_version) 336 pub protocol_version: ::std::option::Option<i32>, 337 // special fields 338 // @@protoc_insertion_point(special_field:securegcm.ResponderHello.special_fields) 339 pub special_fields: ::protobuf::SpecialFields, 340 } 341 342 impl<'a> ::std::default::Default for &'a ResponderHello { default() -> &'a ResponderHello343 fn default() -> &'a ResponderHello { 344 <ResponderHello as ::protobuf::Message>::default_instance() 345 } 346 } 347 348 impl ResponderHello { new() -> ResponderHello349 pub fn new() -> ResponderHello { 350 ::std::default::Default::default() 351 } 352 353 // optional int32 protocol_version = 2; 354 protocol_version(&self) -> i32355 pub fn protocol_version(&self) -> i32 { 356 self.protocol_version.unwrap_or(0i32) 357 } 358 clear_protocol_version(&mut self)359 pub fn clear_protocol_version(&mut self) { 360 self.protocol_version = ::std::option::Option::None; 361 } 362 has_protocol_version(&self) -> bool363 pub fn has_protocol_version(&self) -> bool { 364 self.protocol_version.is_some() 365 } 366 367 // Param is passed by value, moved set_protocol_version(&mut self, v: i32)368 pub fn set_protocol_version(&mut self, v: i32) { 369 self.protocol_version = ::std::option::Option::Some(v); 370 } 371 } 372 373 impl ::protobuf::Message for ResponderHello { 374 const NAME: &'static str = "ResponderHello"; 375 is_initialized(&self) -> bool376 fn is_initialized(&self) -> bool { 377 for v in &self.public_dh_key { 378 if !v.is_initialized() { 379 return false; 380 } 381 }; 382 true 383 } 384 merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()>385 fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { 386 while let Some(tag) = is.read_raw_tag_or_eof()? { 387 match tag { 388 10 => { 389 ::protobuf::rt::read_singular_message_into_field(is, &mut self.public_dh_key)?; 390 }, 391 16 => { 392 self.protocol_version = ::std::option::Option::Some(is.read_int32()?); 393 }, 394 tag => { 395 ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; 396 }, 397 }; 398 } 399 ::std::result::Result::Ok(()) 400 } 401 402 // Compute sizes of nested messages 403 #[allow(unused_variables)] compute_size(&self) -> u64404 fn compute_size(&self) -> u64 { 405 let mut my_size = 0; 406 if let Some(v) = self.public_dh_key.as_ref() { 407 let len = v.compute_size(); 408 my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; 409 } 410 if let Some(v) = self.protocol_version { 411 my_size += ::protobuf::rt::int32_size(2, v); 412 } 413 my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); 414 self.special_fields.cached_size().set(my_size as u32); 415 my_size 416 } 417 write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()>418 fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { 419 if let Some(v) = self.public_dh_key.as_ref() { 420 ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; 421 } 422 if let Some(v) = self.protocol_version { 423 os.write_int32(2, v)?; 424 } 425 os.write_unknown_fields(self.special_fields.unknown_fields())?; 426 ::std::result::Result::Ok(()) 427 } 428 special_fields(&self) -> &::protobuf::SpecialFields429 fn special_fields(&self) -> &::protobuf::SpecialFields { 430 &self.special_fields 431 } 432 mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields433 fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { 434 &mut self.special_fields 435 } 436 new() -> ResponderHello437 fn new() -> ResponderHello { 438 ResponderHello::new() 439 } 440 clear(&mut self)441 fn clear(&mut self) { 442 self.public_dh_key.clear(); 443 self.protocol_version = ::std::option::Option::None; 444 self.special_fields.clear(); 445 } 446 default_instance() -> &'static ResponderHello447 fn default_instance() -> &'static ResponderHello { 448 static instance: ResponderHello = ResponderHello { 449 public_dh_key: ::protobuf::MessageField::none(), 450 protocol_version: ::std::option::Option::None, 451 special_fields: ::protobuf::SpecialFields::new(), 452 }; 453 &instance 454 } 455 } 456 457 #[derive(PartialEq,Clone,Default,Debug)] 458 // @@protoc_insertion_point(message:securegcm.EcPoint) 459 pub struct EcPoint { 460 // message fields 461 // @@protoc_insertion_point(field:securegcm.EcPoint.curve) 462 pub curve: ::std::option::Option<::protobuf::EnumOrUnknown<Curve>>, 463 // @@protoc_insertion_point(field:securegcm.EcPoint.x) 464 pub x: ::std::option::Option<::std::vec::Vec<u8>>, 465 // @@protoc_insertion_point(field:securegcm.EcPoint.y) 466 pub y: ::std::option::Option<::std::vec::Vec<u8>>, 467 // special fields 468 // @@protoc_insertion_point(special_field:securegcm.EcPoint.special_fields) 469 pub special_fields: ::protobuf::SpecialFields, 470 } 471 472 impl<'a> ::std::default::Default for &'a EcPoint { default() -> &'a EcPoint473 fn default() -> &'a EcPoint { 474 <EcPoint as ::protobuf::Message>::default_instance() 475 } 476 } 477 478 impl EcPoint { new() -> EcPoint479 pub fn new() -> EcPoint { 480 ::std::default::Default::default() 481 } 482 483 // required .securegcm.Curve curve = 1; 484 curve(&self) -> Curve485 pub fn curve(&self) -> Curve { 486 match self.curve { 487 Some(e) => e.enum_value_or(Curve::ED_25519), 488 None => Curve::ED_25519, 489 } 490 } 491 clear_curve(&mut self)492 pub fn clear_curve(&mut self) { 493 self.curve = ::std::option::Option::None; 494 } 495 has_curve(&self) -> bool496 pub fn has_curve(&self) -> bool { 497 self.curve.is_some() 498 } 499 500 // Param is passed by value, moved set_curve(&mut self, v: Curve)501 pub fn set_curve(&mut self, v: Curve) { 502 self.curve = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); 503 } 504 505 // required bytes x = 2; 506 x(&self) -> &[u8]507 pub fn x(&self) -> &[u8] { 508 match self.x.as_ref() { 509 Some(v) => v, 510 None => &[], 511 } 512 } 513 clear_x(&mut self)514 pub fn clear_x(&mut self) { 515 self.x = ::std::option::Option::None; 516 } 517 has_x(&self) -> bool518 pub fn has_x(&self) -> bool { 519 self.x.is_some() 520 } 521 522 // Param is passed by value, moved set_x(&mut self, v: ::std::vec::Vec<u8>)523 pub fn set_x(&mut self, v: ::std::vec::Vec<u8>) { 524 self.x = ::std::option::Option::Some(v); 525 } 526 527 // Mutable pointer to the field. 528 // If field is not initialized, it is initialized with default value first. mut_x(&mut self) -> &mut ::std::vec::Vec<u8>529 pub fn mut_x(&mut self) -> &mut ::std::vec::Vec<u8> { 530 if self.x.is_none() { 531 self.x = ::std::option::Option::Some(::std::vec::Vec::new()); 532 } 533 self.x.as_mut().unwrap() 534 } 535 536 // Take field take_x(&mut self) -> ::std::vec::Vec<u8>537 pub fn take_x(&mut self) -> ::std::vec::Vec<u8> { 538 self.x.take().unwrap_or_else(|| ::std::vec::Vec::new()) 539 } 540 541 // required bytes y = 3; 542 y(&self) -> &[u8]543 pub fn y(&self) -> &[u8] { 544 match self.y.as_ref() { 545 Some(v) => v, 546 None => &[], 547 } 548 } 549 clear_y(&mut self)550 pub fn clear_y(&mut self) { 551 self.y = ::std::option::Option::None; 552 } 553 has_y(&self) -> bool554 pub fn has_y(&self) -> bool { 555 self.y.is_some() 556 } 557 558 // Param is passed by value, moved set_y(&mut self, v: ::std::vec::Vec<u8>)559 pub fn set_y(&mut self, v: ::std::vec::Vec<u8>) { 560 self.y = ::std::option::Option::Some(v); 561 } 562 563 // Mutable pointer to the field. 564 // If field is not initialized, it is initialized with default value first. mut_y(&mut self) -> &mut ::std::vec::Vec<u8>565 pub fn mut_y(&mut self) -> &mut ::std::vec::Vec<u8> { 566 if self.y.is_none() { 567 self.y = ::std::option::Option::Some(::std::vec::Vec::new()); 568 } 569 self.y.as_mut().unwrap() 570 } 571 572 // Take field take_y(&mut self) -> ::std::vec::Vec<u8>573 pub fn take_y(&mut self) -> ::std::vec::Vec<u8> { 574 self.y.take().unwrap_or_else(|| ::std::vec::Vec::new()) 575 } 576 } 577 578 impl ::protobuf::Message for EcPoint { 579 const NAME: &'static str = "EcPoint"; 580 is_initialized(&self) -> bool581 fn is_initialized(&self) -> bool { 582 if self.curve.is_none() { 583 return false; 584 } 585 if self.x.is_none() { 586 return false; 587 } 588 if self.y.is_none() { 589 return false; 590 } 591 true 592 } 593 merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()>594 fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { 595 while let Some(tag) = is.read_raw_tag_or_eof()? { 596 match tag { 597 8 => { 598 self.curve = ::std::option::Option::Some(is.read_enum_or_unknown()?); 599 }, 600 18 => { 601 self.x = ::std::option::Option::Some(is.read_bytes()?); 602 }, 603 26 => { 604 self.y = ::std::option::Option::Some(is.read_bytes()?); 605 }, 606 tag => { 607 ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; 608 }, 609 }; 610 } 611 ::std::result::Result::Ok(()) 612 } 613 614 // Compute sizes of nested messages 615 #[allow(unused_variables)] compute_size(&self) -> u64616 fn compute_size(&self) -> u64 { 617 let mut my_size = 0; 618 if let Some(v) = self.curve { 619 my_size += ::protobuf::rt::int32_size(1, v.value()); 620 } 621 if let Some(v) = self.x.as_ref() { 622 my_size += ::protobuf::rt::bytes_size(2, &v); 623 } 624 if let Some(v) = self.y.as_ref() { 625 my_size += ::protobuf::rt::bytes_size(3, &v); 626 } 627 my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); 628 self.special_fields.cached_size().set(my_size as u32); 629 my_size 630 } 631 write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()>632 fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { 633 if let Some(v) = self.curve { 634 os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; 635 } 636 if let Some(v) = self.x.as_ref() { 637 os.write_bytes(2, v)?; 638 } 639 if let Some(v) = self.y.as_ref() { 640 os.write_bytes(3, v)?; 641 } 642 os.write_unknown_fields(self.special_fields.unknown_fields())?; 643 ::std::result::Result::Ok(()) 644 } 645 special_fields(&self) -> &::protobuf::SpecialFields646 fn special_fields(&self) -> &::protobuf::SpecialFields { 647 &self.special_fields 648 } 649 mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields650 fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { 651 &mut self.special_fields 652 } 653 new() -> EcPoint654 fn new() -> EcPoint { 655 EcPoint::new() 656 } 657 clear(&mut self)658 fn clear(&mut self) { 659 self.curve = ::std::option::Option::None; 660 self.x = ::std::option::Option::None; 661 self.y = ::std::option::Option::None; 662 self.special_fields.clear(); 663 } 664 default_instance() -> &'static EcPoint665 fn default_instance() -> &'static EcPoint { 666 static instance: EcPoint = EcPoint { 667 curve: ::std::option::Option::None, 668 x: ::std::option::Option::None, 669 y: ::std::option::Option::None, 670 special_fields: ::protobuf::SpecialFields::new(), 671 }; 672 &instance 673 } 674 } 675 676 #[derive(PartialEq,Clone,Default,Debug)] 677 // @@protoc_insertion_point(message:securegcm.SpakeHandshakeMessage) 678 pub struct SpakeHandshakeMessage { 679 // message fields 680 // @@protoc_insertion_point(field:securegcm.SpakeHandshakeMessage.flow_number) 681 pub flow_number: ::std::option::Option<i32>, 682 // @@protoc_insertion_point(field:securegcm.SpakeHandshakeMessage.ec_point) 683 pub ec_point: ::protobuf::MessageField<EcPoint>, 684 // @@protoc_insertion_point(field:securegcm.SpakeHandshakeMessage.hash_value) 685 pub hash_value: ::std::option::Option<::std::vec::Vec<u8>>, 686 // @@protoc_insertion_point(field:securegcm.SpakeHandshakeMessage.payload) 687 pub payload: ::std::option::Option<::std::vec::Vec<u8>>, 688 // special fields 689 // @@protoc_insertion_point(special_field:securegcm.SpakeHandshakeMessage.special_fields) 690 pub special_fields: ::protobuf::SpecialFields, 691 } 692 693 impl<'a> ::std::default::Default for &'a SpakeHandshakeMessage { default() -> &'a SpakeHandshakeMessage694 fn default() -> &'a SpakeHandshakeMessage { 695 <SpakeHandshakeMessage as ::protobuf::Message>::default_instance() 696 } 697 } 698 699 impl SpakeHandshakeMessage { new() -> SpakeHandshakeMessage700 pub fn new() -> SpakeHandshakeMessage { 701 ::std::default::Default::default() 702 } 703 704 // optional int32 flow_number = 1; 705 flow_number(&self) -> i32706 pub fn flow_number(&self) -> i32 { 707 self.flow_number.unwrap_or(0) 708 } 709 clear_flow_number(&mut self)710 pub fn clear_flow_number(&mut self) { 711 self.flow_number = ::std::option::Option::None; 712 } 713 has_flow_number(&self) -> bool714 pub fn has_flow_number(&self) -> bool { 715 self.flow_number.is_some() 716 } 717 718 // Param is passed by value, moved set_flow_number(&mut self, v: i32)719 pub fn set_flow_number(&mut self, v: i32) { 720 self.flow_number = ::std::option::Option::Some(v); 721 } 722 723 // optional bytes hash_value = 3; 724 hash_value(&self) -> &[u8]725 pub fn hash_value(&self) -> &[u8] { 726 match self.hash_value.as_ref() { 727 Some(v) => v, 728 None => &[], 729 } 730 } 731 clear_hash_value(&mut self)732 pub fn clear_hash_value(&mut self) { 733 self.hash_value = ::std::option::Option::None; 734 } 735 has_hash_value(&self) -> bool736 pub fn has_hash_value(&self) -> bool { 737 self.hash_value.is_some() 738 } 739 740 // Param is passed by value, moved set_hash_value(&mut self, v: ::std::vec::Vec<u8>)741 pub fn set_hash_value(&mut self, v: ::std::vec::Vec<u8>) { 742 self.hash_value = ::std::option::Option::Some(v); 743 } 744 745 // Mutable pointer to the field. 746 // If field is not initialized, it is initialized with default value first. mut_hash_value(&mut self) -> &mut ::std::vec::Vec<u8>747 pub fn mut_hash_value(&mut self) -> &mut ::std::vec::Vec<u8> { 748 if self.hash_value.is_none() { 749 self.hash_value = ::std::option::Option::Some(::std::vec::Vec::new()); 750 } 751 self.hash_value.as_mut().unwrap() 752 } 753 754 // Take field take_hash_value(&mut self) -> ::std::vec::Vec<u8>755 pub fn take_hash_value(&mut self) -> ::std::vec::Vec<u8> { 756 self.hash_value.take().unwrap_or_else(|| ::std::vec::Vec::new()) 757 } 758 759 // optional bytes payload = 4; 760 payload(&self) -> &[u8]761 pub fn payload(&self) -> &[u8] { 762 match self.payload.as_ref() { 763 Some(v) => v, 764 None => &[], 765 } 766 } 767 clear_payload(&mut self)768 pub fn clear_payload(&mut self) { 769 self.payload = ::std::option::Option::None; 770 } 771 has_payload(&self) -> bool772 pub fn has_payload(&self) -> bool { 773 self.payload.is_some() 774 } 775 776 // Param is passed by value, moved set_payload(&mut self, v: ::std::vec::Vec<u8>)777 pub fn set_payload(&mut self, v: ::std::vec::Vec<u8>) { 778 self.payload = ::std::option::Option::Some(v); 779 } 780 781 // Mutable pointer to the field. 782 // If field is not initialized, it is initialized with default value first. mut_payload(&mut self) -> &mut ::std::vec::Vec<u8>783 pub fn mut_payload(&mut self) -> &mut ::std::vec::Vec<u8> { 784 if self.payload.is_none() { 785 self.payload = ::std::option::Option::Some(::std::vec::Vec::new()); 786 } 787 self.payload.as_mut().unwrap() 788 } 789 790 // Take field take_payload(&mut self) -> ::std::vec::Vec<u8>791 pub fn take_payload(&mut self) -> ::std::vec::Vec<u8> { 792 self.payload.take().unwrap_or_else(|| ::std::vec::Vec::new()) 793 } 794 } 795 796 impl ::protobuf::Message for SpakeHandshakeMessage { 797 const NAME: &'static str = "SpakeHandshakeMessage"; 798 is_initialized(&self) -> bool799 fn is_initialized(&self) -> bool { 800 for v in &self.ec_point { 801 if !v.is_initialized() { 802 return false; 803 } 804 }; 805 true 806 } 807 merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()>808 fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { 809 while let Some(tag) = is.read_raw_tag_or_eof()? { 810 match tag { 811 8 => { 812 self.flow_number = ::std::option::Option::Some(is.read_int32()?); 813 }, 814 18 => { 815 ::protobuf::rt::read_singular_message_into_field(is, &mut self.ec_point)?; 816 }, 817 26 => { 818 self.hash_value = ::std::option::Option::Some(is.read_bytes()?); 819 }, 820 34 => { 821 self.payload = ::std::option::Option::Some(is.read_bytes()?); 822 }, 823 tag => { 824 ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; 825 }, 826 }; 827 } 828 ::std::result::Result::Ok(()) 829 } 830 831 // Compute sizes of nested messages 832 #[allow(unused_variables)] compute_size(&self) -> u64833 fn compute_size(&self) -> u64 { 834 let mut my_size = 0; 835 if let Some(v) = self.flow_number { 836 my_size += ::protobuf::rt::int32_size(1, v); 837 } 838 if let Some(v) = self.ec_point.as_ref() { 839 let len = v.compute_size(); 840 my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; 841 } 842 if let Some(v) = self.hash_value.as_ref() { 843 my_size += ::protobuf::rt::bytes_size(3, &v); 844 } 845 if let Some(v) = self.payload.as_ref() { 846 my_size += ::protobuf::rt::bytes_size(4, &v); 847 } 848 my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); 849 self.special_fields.cached_size().set(my_size as u32); 850 my_size 851 } 852 write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()>853 fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { 854 if let Some(v) = self.flow_number { 855 os.write_int32(1, v)?; 856 } 857 if let Some(v) = self.ec_point.as_ref() { 858 ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; 859 } 860 if let Some(v) = self.hash_value.as_ref() { 861 os.write_bytes(3, v)?; 862 } 863 if let Some(v) = self.payload.as_ref() { 864 os.write_bytes(4, v)?; 865 } 866 os.write_unknown_fields(self.special_fields.unknown_fields())?; 867 ::std::result::Result::Ok(()) 868 } 869 special_fields(&self) -> &::protobuf::SpecialFields870 fn special_fields(&self) -> &::protobuf::SpecialFields { 871 &self.special_fields 872 } 873 mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields874 fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { 875 &mut self.special_fields 876 } 877 new() -> SpakeHandshakeMessage878 fn new() -> SpakeHandshakeMessage { 879 SpakeHandshakeMessage::new() 880 } 881 clear(&mut self)882 fn clear(&mut self) { 883 self.flow_number = ::std::option::Option::None; 884 self.ec_point.clear(); 885 self.hash_value = ::std::option::Option::None; 886 self.payload = ::std::option::Option::None; 887 self.special_fields.clear(); 888 } 889 default_instance() -> &'static SpakeHandshakeMessage890 fn default_instance() -> &'static SpakeHandshakeMessage { 891 static instance: SpakeHandshakeMessage = SpakeHandshakeMessage { 892 flow_number: ::std::option::Option::None, 893 ec_point: ::protobuf::MessageField::none(), 894 hash_value: ::std::option::Option::None, 895 payload: ::std::option::Option::None, 896 special_fields: ::protobuf::SpecialFields::new(), 897 }; 898 &instance 899 } 900 } 901 902 #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] 903 // @@protoc_insertion_point(enum:securegcm.Curve) 904 pub enum Curve { 905 // @@protoc_insertion_point(enum_value:securegcm.Curve.ED_25519) 906 ED_25519 = 1, 907 } 908 909 impl ::protobuf::Enum for Curve { 910 const NAME: &'static str = "Curve"; 911 value(&self) -> i32912 fn value(&self) -> i32 { 913 *self as i32 914 } 915 from_i32(value: i32) -> ::std::option::Option<Curve>916 fn from_i32(value: i32) -> ::std::option::Option<Curve> { 917 match value { 918 1 => ::std::option::Option::Some(Curve::ED_25519), 919 _ => ::std::option::Option::None 920 } 921 } 922 923 const VALUES: &'static [Curve] = &[ 924 Curve::ED_25519, 925 ]; 926 } 927 928 // Note, `Default` is implemented although default value is not 0 929 impl ::std::default::Default for Curve { default() -> Self930 fn default() -> Self { 931 Curve::ED_25519 932 } 933 } 934 935