1/* 2 * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. 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 16syntax = "proto3"; 17 18option optimize_for = LITE_RUNTIME; 19 20enum NUM { 21 ZERO = 0; 22 ONE = 1; 23 TWO = 2; 24 THREE = 3; 25 FOUR = 4; 26} 27 28message SubMessage { 29 int32 vint_int32 = 1; 30 int64 vint_int64 = 2; 31 uint32 vint_uint32 = 3; 32 uint64 vint_uint64 = 4; 33} 34 35message ExampleMessage { 36 // https://developers.google.com/protocol-buffers/docs/encoding 37 // ID Name Used For 38 // 0 VARINT int32, int64, uint32, uint64, sint32, sint64, bool, enum 39 int32 vint_int32 = 1; 40 int64 vint_int64 = 2; 41 uint32 vint_uint32 = 3; 42 uint64 vint_uint64 = 4; 43 sint32 vint_sint32 = 5; 44 sint64 vint_sint64 = 6; 45 bool vint_bool = 7; 46 NUM vint_enum = 8; 47 48 // 1 I64 fixed64, sfixed64, double 49 fixed64 I64_fixed64 = 11; 50 sfixed64 I64_sfixed64 = 12; 51 double I64_double = 13; 52 53 // 2 LEN string, bytes, embedded messages, packed repeated fields 54 string LEN_string = 21; 55 bytes LEN_bytes = 22; // maybe need identified by protoC 56 SubMessage LEN_sub = 23; 57 // repeated sint32 repeated_signed_vint = 24; // repeated signed(zigzag) not supported in libprotobuf 58 repeated int32 LEN_repeated_packed_signed_vint = 25; // [packed = true] 59 repeated uint32 LEN_repeated_packed_unsigned_vint = 26; // [packed = true] 60 repeated fixed64 LEN_repeated_packed_fixed = 27; // [packed = true] 61 repeated SubMessage repeated_LEN_sub = 28; 62 63 // 5 I32 fixed32, sfixed32, float 64 fixed32 I32_fixed32 = 51; 65 sfixed32 I32_sfixed32 = 52; 66 float I32_float = 53; 67 68 // 6 oneof 69 oneof oneoffield { 70 fixed64 oneof_fixed64 = 61; 71 string oneof_string = 62; 72 SubMessage oneof_sub = 63; 73 } 74 75 repeated ExampleMessage repeated_Example = 100; 76 77} 78