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