DCCL v4
test.proto
1 // Copyright 2019-2023:
2 // GobySoft, LLC (2013-)
3 // Community contributors (see AUTHORS file)
4 // File authors:
5 // Toby Schneider <toby@gobysoft.org>
6 // Chris Murphy <cmurphy@aphysci.com>
7 //
8 //
9 // This file is part of the Dynamic Compact Control Language Library
10 // ("DCCL").
11 //
12 // DCCL is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU Lesser General Public License as published by
14 // the Free Software Foundation, either version 2.1 of the License, or
15 // (at your option) any later version.
16 //
17 // DCCL is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU Lesser General Public License for more details.
21 //
22 // You should have received a copy of the GNU Lesser General Public License
23 // along with DCCL. If not, see <http://www.gnu.org/licenses/>.
24 syntax = "proto2";
25 import "dccl/option_extensions.proto";
26 
27 package dccl.test;
28 
29 enum Enum
30 {
31  ENUM2_A = -2; // for completeness, though negative values are discouraged
32  ENUM2_B = 0;
33  ENUM2_C = 1;
34  ENUM2_D = 2;
35  ENUM2_E = 10;
36  ENUM2_F = 11;
37  ENUM2_G = 12;
38  ENUM2_H =
39  16777213; // Many skipped values - packed will be 3b, unpacked 24b
40 }
41 
42 message TestMsgPack
43 {
44  option (dccl.msg).id = 2;
45  option (dccl.msg).max_bytes = 2;
46  option (dccl.msg).codec_version = 4;
47 
48  required int32 five_bit_padding = 1
49  [(dccl.field) = { min: 0, max: 31 }]; // 5b padding.
50  required Enum value = 2 [(dccl.field).packed_enum = true];
51 }
52 
53 message TestMsgUnpack
54 {
55  option (dccl.msg).id = 3;
56  option (dccl.msg).max_bytes = 4;
57  option (dccl.msg).codec_version = 4;
58 
59  required Enum value = 1 [(dccl.field).packed_enum = false];
60 }