blob: 04914390e9cb951e42d923ca656c7af2b5037f40 [file] [log] [blame]
Jerome Poichet7c997852014-05-20 10:50:05 -07001// Copyright 2009 Google Inc. All Rights Reserved.
2
3package polo.wire.protobuf;
4
Daniel Weis9726a932015-10-22 20:44:51 -07005option javanano_use_deprecated_package = true;
Jerome Poichet7c997852014-05-20 10:50:05 -07006option java_outer_classname = "PoloProto";
7option java_package = "com.google.polo.wire.protobuf";
8option optimize_for = LITE_RUNTIME;
9
10// OuterMessage - base outer message type used in the protocol.
11
12message OuterMessage {
13
14 // MessageType indicates the type of the enclosed message (serialized in the
15 // `payload` field)
16 enum MessageType {
17 // Initialization phase
18 MESSAGE_TYPE_PAIRING_REQUEST = 10;
19 MESSAGE_TYPE_PAIRING_REQUEST_ACK = 11;
20
21 // Configuration phase
22 MESSAGE_TYPE_OPTIONS = 20;
23 MESSAGE_TYPE_CONFIGURATION = 30;
24 MESSAGE_TYPE_CONFIGURATION_ACK = 31;
25
26 // Pairing phase
27 MESSAGE_TYPE_SECRET = 40;
28 MESSAGE_TYPE_SECRET_ACK = 41;
29 }
30
31 // Protocol status states.
32 enum Status {
33 STATUS_OK = 200;
34 STATUS_ERROR = 400;
35 STATUS_BAD_CONFIGURATION = 401;
36 STATUS_BAD_SECRET = 402;
37 }
38
39 required uint32 protocol_version = 1 [default = 1];
40
41 // Protocol status. Any status other than STATUS_OK implies a fault.
42 required Status status = 2;
43
44 // Encapsulated message. These fields are required if status is STATUS_OK.
45 optional MessageType type = 3;
46 optional bytes payload = 4;
47
48}
49
50
51//
52// Initialization messages
53//
54
55message PairingRequest {
56 // String name of the service to pair with. The name used should be an
57 // established convention of the application protocol.
58 required string service_name = 1;
59
60 // Descriptive name of the client.
61 optional string client_name = 2;
62}
63
64message PairingRequestAck {
65 // Descriptive name of the server.
66 optional string server_name = 1;
67}
68
69
70//
71// Configuration messages
72//
73
74message Options {
75 message Encoding {
76 enum EncodingType {
77 ENCODING_TYPE_UNKNOWN = 0;
78 ENCODING_TYPE_ALPHANUMERIC = 1;
79 ENCODING_TYPE_NUMERIC = 2;
80 ENCODING_TYPE_HEXADECIMAL = 3;
81 ENCODING_TYPE_QRCODE = 4;
82 }
83
84 required EncodingType type = 1;
85 required uint32 symbol_length = 2;
86 }
87
88 enum RoleType {
89 ROLE_TYPE_UNKNOWN = 0;
90 ROLE_TYPE_INPUT = 1;
91 ROLE_TYPE_OUTPUT = 2;
92 }
93
94 // List of encodings this endpoint accepts when serving as an input device.
95 repeated Encoding input_encodings = 1;
96
97 // List of encodings this endpoint can generate as an output device.
98 repeated Encoding output_encodings = 2;
99
100 // Preferred role, if any.
101 optional RoleType preferred_role = 3;
102}
103
104message Configuration {
105 // The encoding to be used in this session.
106 required Options.Encoding encoding = 1;
107
108 // The role of the client (ie, the one initiating pairing). This implies the
109 // peer (server) acts as the complementary role.
110 required Options.RoleType client_role = 2;
111}
112
113message ConfigurationAck {
114}
115
116
117//
118// Pairing messages
119//
120
121message Secret {
122 required bytes secret = 1;
123}
124
125message SecretAck {
126 required bytes secret = 1;
127}
128