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 // Kyle Guilbert <kguilbert@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 package dccl.test;
27 
28 enum Enum
29 {
30  ENUM2_A = 3;
31  ENUM2_B = 4;
32  ENUM2_C = 5;
33 }
34 
35 message PresenceMsg
36 {
37  option (dccl.msg).id = 10;
38  option (dccl.msg).max_bytes = 64;
39  option (dccl.msg).codec_version = 4;
40  option (dccl.msg).codec_group = "dccl.presence";
41 
42  // required fields are unchanged
43  required int32 req_i32 = 1 [(dccl.field) = { min: -100, max: 500 }];
44  required int64 req_i64 = 2 [(dccl.field) = { min: 0, max: 65535 }];
45  required uint32 req_ui32 = 3 [(dccl.field) = { min: 0, max: 1022 }];
46  required uint64 req_ui64 = 4 [(dccl.field) = { min: 100, max: 1123 }];
47  required float req_float = 5
48  [(dccl.field) = { min: -1000, max: 1000, precision: 5 }];
49  required double req_double = 6
50  [(dccl.field) = { min: -1000, max: 1000, precision: 8 }];
51  required Enum req_enum = 7;
52 
53  // optional fields will gain an extra bit; when unpopulated, the fields are
54  // encoded with this bit only
55  optional int32 opt_i32 = 8 [(dccl.field) = { min: -100, max: 500 }];
56  optional int64 opt_i64 = 9 [(dccl.field) = { min: 0, max: 65535 }];
57  optional uint32 opt_ui32 = 10 [(dccl.field) = { min: 0, max: 1022 }];
58  optional uint64 opt_ui64 = 11 [(dccl.field) = { min: 100, max: 1123 }];
59  optional float opt_float = 12
60  [(dccl.field) = { min: -1000, max: 1000, precision: 5 }];
61  optional double opt_double = 13
62  [(dccl.field) = { min: -1000, max: 1000, precision: 8 }];
63  optional Enum opt_enum = 14;
64  optional bool opt_bool = 15;
65  optional string opt_str = 16 [(dccl.field) = { max_length: 5 }];
66  optional bytes opt_bytes = 17 [(dccl.field) = { max_length: 2 }];
67 
68  // note: since repeated fields are treated like "required" fields, they are
69  // unaffected by the presence codec
70  repeated int32 repeat_i32 = 20
71  [(dccl.field) = { min: -100, max: 500, max_repeat: 2 }];
72  repeated Enum repeat_enum = 21 [(dccl.field) = { max_repeat: 3 }];
73 }