DCCL v4
test.proto
1 // Copyright 2011-2023:
2 // GobySoft, LLC (2013-)
3 // Massachusetts Institute of Technology (2007-2014)
4 // Community contributors (see AUTHORS file)
5 // File authors:
6 // Toby Schneider <toby@gobysoft.org>
7 // Chris Murphy <cmurphy@aphysci.com>
8 //
9 //
10 // This file is part of the Dynamic Compact Control Language Library
11 // ("DCCL").
12 //
13 // DCCL is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU Lesser General Public License as published by
15 // the Free Software Foundation, either version 2.1 of the License, or
16 // (at your option) any later version.
17 //
18 // DCCL is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU Lesser General Public License for more details.
22 //
23 // You should have received a copy of the GNU Lesser General Public License
24 // along with DCCL. If not, see <http://www.gnu.org/licenses/>.
25 syntax = "proto2";
26 import "dccl/option_extensions.proto";
27 
28 package dccl.test;
29 
30 enum Enum1
31 {
32  ENUM_A = 1;
33  ENUM_B = 2;
34  ENUM_C = 3;
35 }
36 
37 message EmbeddedMsg1
38 {
39  optional double val = 1 [
40  (dccl.field).min = 0,
41  (dccl.field).max = 126,
42  (dccl.field).precision = 3
43  ];
44  optional EmbeddedMsg2 msg = 2;
45 }
46 
47 message EmbeddedMsg2
48 {
49  optional double val = 1 [
50  (dccl.field).min = 0,
51  (dccl.field).max = 126,
52  (dccl.field).precision = 2
53  ];
54  optional string sval = 2 [(dccl.field).max_length = 10];
55  optional Enum1 enum_default = 3;
56 }
57 
58 message TestMsg
59 {
60  option (dccl.msg).id = 2;
61  option (dccl.msg).max_bytes = 512;
62  option (dccl.msg).codec_version = 4;
63 
64  // test default enc/dec
65  optional double double_default_optional = 1 [
66  (dccl.field).min = -100,
67  (dccl.field).max = 126,
68  (dccl.field).precision = 2,
69  (dccl.field).in_head = true
70  ];
71  optional float float_default_optional = 2 [
72  (dccl.field).min = -20,
73  (dccl.field).max = 150,
74  (dccl.field).precision = 3
75  ];
76  optional int32 int32_default_optional = 3
77  [(dccl.field).min = -20, (dccl.field).max = 3000];
78  optional int64 int64_default_optional = 4
79  [(dccl.field).min = -710, (dccl.field).max = 3000];
80  optional uint32 uint32_default_optional = 5
81  [(dccl.field).min = 0, (dccl.field).max = 3000];
82  optional uint64 uint64_default_optional = 6
83  [(dccl.field).min = 5, (dccl.field).max = 3000];
84  optional sint32 sint32_default_optional = 7
85  [(dccl.field).min = -60, (dccl.field).max = 3000];
86  optional sint64 sint64_default_optional = 8
87  [(dccl.field).min = -70, (dccl.field).max = 3000];
88  optional fixed32 fixed32_default_optional = 9
89  [(dccl.field).min = 0, (dccl.field).max = 400];
90  optional fixed64 fixed64_default_optional = 10
91  [(dccl.field).min = 0, (dccl.field).max = 3000];
92  optional sfixed32 sfixed32_default_optional = 11
93  [(dccl.field).min = 11, (dccl.field).max = 3000];
94  optional sfixed64 sfixed64_default_optional = 12
95  [(dccl.field).min = -12, (dccl.field).max = 3000];
96 
97  optional bool bool_default_optional = 13;
98 
99  optional string string_default_optional = 14 [(dccl.field).max_length = 8];
100  optional bytes bytes_default_optional = 15 [(dccl.field).max_length = 9];
101 
102  optional Enum1 enum_default_optional = 16;
103 
104  optional EmbeddedMsg1 msg_default_optional = 17;
105 
106  required double double_default_required = 21 [
107  (dccl.field).min = -100,
108  (dccl.field).max = 126,
109  (dccl.field).precision = 2,
110  (dccl.field).in_head = true
111  ];
112  required float float_default_required = 22 [
113  (dccl.field).min = -20,
114  (dccl.field).max = 150,
115  (dccl.field).precision = 3
116  ];
117  required int32 int32_default_required = 23
118  [(dccl.field).min = -20, (dccl.field).max = 3000];
119  required int64 int64_default_required = 24
120  [(dccl.field).min = -710, (dccl.field).max = 3000];
121  required uint32 uint32_default_required = 25
122  [(dccl.field).min = 0, (dccl.field).max = 3000];
123  required uint64 uint64_default_required = 26
124  [(dccl.field).min = 5, (dccl.field).max = 3000];
125  required sint32 sint32_default_required = 27
126  [(dccl.field).min = -60, (dccl.field).max = 3000];
127  required sint64 sint64_default_required = 28
128  [(dccl.field).min = -70, (dccl.field).max = 3000];
129  required fixed32 fixed32_default_required = 29
130  [(dccl.field).min = 0, (dccl.field).max = 400];
131  required fixed64 fixed64_default_required = 30
132  [(dccl.field).min = 0, (dccl.field).max = 3000];
133  required sfixed32 sfixed32_default_required = 31
134  [(dccl.field).min = 11, (dccl.field).max = 3000];
135  required sfixed64 sfixed64_default_required = 32
136  [(dccl.field).min = -120, (dccl.field).max = 3000];
137 
138  required bool bool_default_required = 33;
139 
140  required string string_default_required = 34 [(dccl.field).max_length = 8];
141  required bytes bytes_default_required = 35 [(dccl.field).max_length = 9];
142 
143  required Enum1 enum_default_required = 36;
144 
145  required EmbeddedMsg1 msg_default_required = 37;
146 
147  repeated double double_default_repeat = 101 [
148  (dccl.field).min = 0,
149  (dccl.field).max = 100,
150  (dccl.field).precision = 3,
151  (dccl.field).max_repeat = 4
152  ];
153  repeated float float_default_repeat = 102 [
154  (dccl.field).min = 0,
155  (dccl.field).max = 100,
156  (dccl.field).precision = 3,
157  (dccl.field).max_repeat = 4
158  ];
159 
160  repeated int32 int32_default_repeat = 103 [
161  (dccl.field).min = 0,
162  (dccl.field).max = 100,
163  (dccl.field).max_repeat = 4
164  ];
165  repeated int64 int64_default_repeat = 104 [
166  (dccl.field).min = -100,
167  (dccl.field).max = 100,
168  (dccl.field).max_repeat = 4
169  ];
170  repeated uint32 uint32_default_repeat = 105 [
171  (dccl.field).min = 0,
172  (dccl.field).max = 100,
173  (dccl.field).max_repeat = 4
174  ];
175  repeated uint64 uint64_default_repeat = 106 [
176  (dccl.field).min = 0,
177  (dccl.field).max = 100,
178  (dccl.field).max_repeat = 4
179  ];
180  repeated sint32 sint32_default_repeat = 107 [
181  (dccl.field).min = -60,
182  (dccl.field).max = 100,
183  (dccl.field).max_repeat = 4
184  ];
185  repeated sint64 sint64_default_repeat = 108 [
186  (dccl.field).min = -600,
187  (dccl.field).max = 100,
188  (dccl.field).max_repeat = 4
189  ];
190  repeated fixed32 fixed32_default_repeat = 109 [
191  (dccl.field).min = 0,
192  (dccl.field).max = 100,
193  (dccl.field).max_repeat = 4
194  ];
195  repeated fixed64 fixed64_default_repeat = 110 [
196  (dccl.field).min = 0,
197  (dccl.field).max = 100,
198  (dccl.field).max_repeat = 4
199  ];
200  repeated sfixed32 sfixed32_default_repeat = 111 [
201  (dccl.field).min = 0,
202  (dccl.field).max = 100,
203  (dccl.field).max_repeat = 4
204  ];
205  repeated sfixed64 sfixed64_default_repeat = 112 [
206  (dccl.field).min = -500,
207  (dccl.field).max = 100,
208  (dccl.field).max_repeat = 4
209  ];
210 
211  repeated bool bool_default_repeat = 113 [(dccl.field).max_repeat = 4];
212 
213  repeated string string_default_repeat = 114
214  [(dccl.field).max_length = 4, (dccl.field).max_repeat = 4];
215  repeated bytes bytes_default_repeat = 115
216  [(dccl.field).max_length = 4, (dccl.field).max_repeat = 4];
217 
218  repeated Enum1 enum_default_repeat = 116 [(dccl.field).max_repeat = 4];
219 
220  repeated EmbeddedMsg1 msg_default_repeat = 117
221  [(dccl.field).max_repeat = 4];
222 }