Buttplug sex toy control library
1syntax = "proto3";
2package protocomm;
3
4/* Allowed values for the status
5 * of a protocomm instance */
6 enum Status {
7 Success = 0;
8 InvalidSecScheme = 1;
9 InvalidProto = 2;
10 TooManySessions = 3;
11 InvalidArgument = 4;
12 InternalError = 5;
13 CryptoError = 6;
14 InvalidSession = 7;
15}
16
17/* Data structure of Session command/request packet */
18message S0SessionCmd {
19
20}
21
22/* Data structure of Session response packet */
23message S0SessionResp {
24 Status status = 1;
25}
26
27/* A message must be of type Cmd or Resp */
28enum Sec0MsgType {
29 S0_Session_Command = 0;
30 S0_Session_Response = 1;
31}
32
33/* Payload structure of session data */
34message Sec0Payload {
35 Sec0MsgType msg = 1; /*!< Type of message */
36 oneof payload {
37 S0SessionCmd sc = 20; /*!< Payload data interpreted as Cmd */
38 S0SessionResp sr = 21; /*!< Payload data interpreted as Resp */
39 }
40}
41
42/* Data structure of Session command1 packet */
43message SessionCmd1 {
44 bytes client_verify_data = 2;
45}
46
47/* Data structure of Session response1 packet */
48message SessionResp1 {
49 Status status = 1;
50 bytes device_verify_data = 3;
51}
52
53/* Data structure of Session command0 packet */
54message SessionCmd0 {
55 bytes client_pubkey = 1;
56}
57
58/* Data structure of Session response0 packet */
59message SessionResp0 {
60 Status status = 1;
61 bytes device_pubkey = 2;
62 bytes device_random = 3;
63}
64
65/* A message must be of type Cmd0 / Cmd1 / Resp0 / Resp1 */
66enum Sec1MsgType {
67 Session_Command0 = 0;
68 Session_Response0 = 1;
69 Session_Command1 = 2;
70 Session_Response1 = 3;
71}
72
73/* Payload structure of session data */
74message Sec1Payload {
75 Sec1MsgType msg = 1; /*!< Type of message */
76 oneof payload {
77 SessionCmd0 sc0 = 20; /*!< Payload data interpreted as Cmd0 */
78 SessionResp0 sr0 = 21; /*!< Payload data interpreted as Resp0 */
79 SessionCmd1 sc1 = 22; /*!< Payload data interpreted as Cmd1 */
80 SessionResp1 sr1 = 23; /*!< Payload data interpreted as Resp1 */
81 }
82}
83
84
85/* Allowed values for the type of security
86 * being used in a protocomm session */
87enum SecSchemeVersion {
88 SecScheme0 = 0; /*!< Unsecured - plaintext communication */
89 SecScheme1 = 1; /*!< Security scheme 1 - Curve25519 + AES-256-CTR*/
90}
91
92/* Data structure exchanged when establishing
93 * secure session between Host and Client */
94message SessionData {
95 SecSchemeVersion sec_ver = 2; /*!< Type of security */
96 oneof proto {
97 Sec0Payload sec0 = 10; /*!< Payload data in case of security 0 */
98 Sec1Payload sec1 = 11; /*!< Payload data in case of security 1 */
99 }
100}