Buttplug sex toy control library
at master 206 lines 7.5 kB view raw
1/// Data structure of Session command/request packet 2#[derive(Clone, Eq, PartialEq, ::prost::Message)] 3pub struct S0SessionCmd { 4} 5/// Data structure of Session response packet 6#[derive(Clone, Eq, PartialEq, ::prost::Message)] 7pub struct S0SessionResp { 8 #[prost(enumeration="Status", tag="1")] 9 pub status: i32, 10} 11/// Payload structure of session data 12#[derive(Clone, Eq, PartialEq, ::prost::Message)] 13pub struct Sec0Payload { 14 /// !< Type of message 15 #[prost(enumeration="Sec0MsgType", tag="1")] 16 pub msg: i32, 17 #[prost(oneof="sec0_payload::Payload", tags="20, 21")] 18 pub payload: ::core::option::Option<sec0_payload::Payload>, 19} 20/// Nested message and enum types in `Sec0Payload`. 21pub mod sec0_payload { 22 #[derive(Clone, Eq, PartialEq, ::prost::Oneof)] 23 pub enum Payload { 24 /// !< Payload data interpreted as Cmd 25 #[prost(message, tag="20")] 26 Sc(super::S0SessionCmd), 27 /// !< Payload data interpreted as Resp 28 #[prost(message, tag="21")] 29 Sr(super::S0SessionResp), 30 } 31} 32/// Data structure of Session command1 packet 33#[derive(Clone, Eq, PartialEq, ::prost::Message)] 34pub struct SessionCmd1 { 35 #[prost(bytes="vec", tag="2")] 36 pub client_verify_data: ::prost::alloc::vec::Vec<u8>, 37} 38/// Data structure of Session response1 packet 39#[derive(Clone, Eq, PartialEq, ::prost::Message)] 40pub struct SessionResp1 { 41 #[prost(enumeration="Status", tag="1")] 42 pub status: i32, 43 #[prost(bytes="vec", tag="3")] 44 pub device_verify_data: ::prost::alloc::vec::Vec<u8>, 45} 46/// Data structure of Session command0 packet 47#[derive(Clone, Eq, PartialEq, ::prost::Message)] 48pub struct SessionCmd0 { 49 #[prost(bytes="vec", tag="1")] 50 pub client_pubkey: ::prost::alloc::vec::Vec<u8>, 51} 52/// Data structure of Session response0 packet 53#[derive(Clone, Eq, PartialEq, ::prost::Message)] 54pub struct SessionResp0 { 55 #[prost(enumeration="Status", tag="1")] 56 pub status: i32, 57 #[prost(bytes="vec", tag="2")] 58 pub device_pubkey: ::prost::alloc::vec::Vec<u8>, 59 #[prost(bytes="vec", tag="3")] 60 pub device_random: ::prost::alloc::vec::Vec<u8>, 61} 62/// Payload structure of session data 63#[derive(Clone, Eq, PartialEq, ::prost::Message)] 64pub struct Sec1Payload { 65 /// !< Type of message 66 #[prost(enumeration="Sec1MsgType", tag="1")] 67 pub msg: i32, 68 #[prost(oneof="sec1_payload::Payload", tags="20, 21, 22, 23")] 69 pub payload: ::core::option::Option<sec1_payload::Payload>, 70} 71/// Nested message and enum types in `Sec1Payload`. 72pub mod sec1_payload { 73 #[derive(Clone, Eq, PartialEq, ::prost::Oneof)] 74 pub enum Payload { 75 /// !< Payload data interpreted as Cmd0 76 #[prost(message, tag="20")] 77 Sc0(super::SessionCmd0), 78 /// !< Payload data interpreted as Resp0 79 #[prost(message, tag="21")] 80 Sr0(super::SessionResp0), 81 /// !< Payload data interpreted as Cmd1 82 #[prost(message, tag="22")] 83 Sc1(super::SessionCmd1), 84 /// !< Payload data interpreted as Resp1 85 #[prost(message, tag="23")] 86 Sr1(super::SessionResp1), 87 } 88} 89/// Data structure exchanged when establishing 90/// secure session between Host and Client 91#[derive(Clone, Eq, PartialEq, ::prost::Message)] 92pub struct SessionData { 93 /// !< Type of security 94 #[prost(enumeration="SecSchemeVersion", tag="2")] 95 pub sec_ver: i32, 96 #[prost(oneof="session_data::Proto", tags="10, 11")] 97 pub proto: ::core::option::Option<session_data::Proto>, 98} 99/// Nested message and enum types in `SessionData`. 100pub mod session_data { 101 #[derive(Clone, Eq, PartialEq, ::prost::Oneof)] 102 pub enum Proto { 103 /// !< Payload data in case of security 0 104 #[prost(message, tag="10")] 105 Sec0(super::Sec0Payload), 106 /// !< Payload data in case of security 1 107 #[prost(message, tag="11")] 108 Sec1(super::Sec1Payload), 109 } 110} 111/// Allowed values for the status 112/// of a protocomm instance 113#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] 114#[repr(i32)] 115pub enum Status { 116 Success = 0, 117 InvalidSecScheme = 1, 118 InvalidProto = 2, 119 TooManySessions = 3, 120 InvalidArgument = 4, 121 InternalError = 5, 122 CryptoError = 6, 123 InvalidSession = 7, 124} 125impl Status { 126 /// String value of the enum field names used in the ProtoBuf definition. 127 /// 128 /// The values are not transformed in any way and thus are considered stable 129 /// (if the ProtoBuf definition does not change) and safe for programmatic use. 130 pub fn as_str_name(&self) -> &'static str { 131 match self { 132 Status::Success => "Success", 133 Status::InvalidSecScheme => "InvalidSecScheme", 134 Status::InvalidProto => "InvalidProto", 135 Status::TooManySessions => "TooManySessions", 136 Status::InvalidArgument => "InvalidArgument", 137 Status::InternalError => "InternalError", 138 Status::CryptoError => "CryptoError", 139 Status::InvalidSession => "InvalidSession", 140 } 141 } 142} 143/// A message must be of type Cmd or Resp 144#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] 145#[repr(i32)] 146pub enum Sec0MsgType { 147 S0SessionCommand = 0, 148 S0SessionResponse = 1, 149} 150impl Sec0MsgType { 151 /// String value of the enum field names used in the ProtoBuf definition. 152 /// 153 /// The values are not transformed in any way and thus are considered stable 154 /// (if the ProtoBuf definition does not change) and safe for programmatic use. 155 pub fn as_str_name(&self) -> &'static str { 156 match self { 157 Sec0MsgType::S0SessionCommand => "S0_Session_Command", 158 Sec0MsgType::S0SessionResponse => "S0_Session_Response", 159 } 160 } 161} 162/// A message must be of type Cmd0 / Cmd1 / Resp0 / Resp1 163#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] 164#[repr(i32)] 165pub enum Sec1MsgType { 166 SessionCommand0 = 0, 167 SessionResponse0 = 1, 168 SessionCommand1 = 2, 169 SessionResponse1 = 3, 170} 171impl Sec1MsgType { 172 /// String value of the enum field names used in the ProtoBuf definition. 173 /// 174 /// The values are not transformed in any way and thus are considered stable 175 /// (if the ProtoBuf definition does not change) and safe for programmatic use. 176 pub fn as_str_name(&self) -> &'static str { 177 match self { 178 Sec1MsgType::SessionCommand0 => "Session_Command0", 179 Sec1MsgType::SessionResponse0 => "Session_Response0", 180 Sec1MsgType::SessionCommand1 => "Session_Command1", 181 Sec1MsgType::SessionResponse1 => "Session_Response1", 182 } 183 } 184} 185/// Allowed values for the type of security 186/// being used in a protocomm session 187#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] 188#[repr(i32)] 189pub enum SecSchemeVersion { 190 /// !< Unsecured - plaintext communication 191 SecScheme0 = 0, 192 /// !< Security scheme 1 - Curve25519 + AES-256-CTR 193 SecScheme1 = 1, 194} 195impl SecSchemeVersion { 196 /// String value of the enum field names used in the ProtoBuf definition. 197 /// 198 /// The values are not transformed in any way and thus are considered stable 199 /// (if the ProtoBuf definition does not change) and safe for programmatic use. 200 pub fn as_str_name(&self) -> &'static str { 201 match self { 202 SecSchemeVersion::SecScheme0 => "SecScheme0", 203 SecSchemeVersion::SecScheme1 => "SecScheme1", 204 } 205 } 206}