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 package dccl.test;
28 
29 enum Enum1
30 {
31  ENUM_A = 1;
32  ENUM_B = 2;
33  ENUM_C = 3;
34 }
35 
36 message EmbeddedMsg1
37 {
38  optional double val = 1 [
39  (dccl.field).min = 0,
40  (dccl.field).max = 126,
41  (dccl.field).precision = 3
42  ];
43  optional EmbeddedMsg2 msg = 2;
44 }
45 
46 message EmbeddedMsg2
47 {
48  optional double val = 1 [
49  (dccl.field).min = 0,
50  (dccl.field).max = 126,
51  (dccl.field).precision = 2
52  ];
53  optional string sval = 2 [(dccl.field).max_length = 10];
54  optional Enum1 enum_default = 3;
55 }
56 
57 message TestMsg
58 {
59  option (dccl.msg).id = 2;
60  option (dccl.msg).max_bytes = 512;
61  option (dccl.msg).codec_version = 2;
62 
63  // test default enc/dec
64  optional double double_default_optional = 1 [
65  (dccl.field).min = -100,
66  (dccl.field).max = 126,
67  (dccl.field).precision = 2,
68  (dccl.field).in_head = true
69  ];
70  optional float float_default_optional = 2 [
71  (dccl.field).min = -20,
72  (dccl.field).max = 150,
73  (dccl.field).precision = 3
74  ];
75  optional int32 int32_default_optional = 3
76  [(dccl.field).min = -20, (dccl.field).max = 3000];
77  optional int64 int64_default_optional = 4
78  [(dccl.field).min = -710, (dccl.field).max = 3000];
79  optional uint32 uint32_default_optional = 5
80  [(dccl.field).min = 0, (dccl.field).max = 3000];
81  optional uint64 uint64_default_optional = 6
82  [(dccl.field).min = 5, (dccl.field).max = 3000];
83  optional sint32 sint32_default_optional = 7
84  [(dccl.field).min = -60, (dccl.field).max = 3000];
85  optional sint64 sint64_default_optional = 8
86  [(dccl.field).min = -70, (dccl.field).max = 3000];
87  optional fixed32 fixed32_default_optional = 9
88  [(dccl.field).min = 0, (dccl.field).max = 400];
89  optional fixed64 fixed64_default_optional = 10
90  [(dccl.field).min = 0, (dccl.field).max = 3000];
91  optional sfixed32 sfixed32_default_optional = 11
92  [(dccl.field).min = 11, (dccl.field).max = 3000];
93  optional sfixed64 sfixed64_default_optional = 12
94  [(dccl.field).min = -12, (dccl.field).max = 3000];
95 
96  optional bool bool_default_optional = 13;
97 
98  optional string string_default_optional = 14 [(dccl.field).max_length = 8];
99  optional bytes bytes_default_optional = 15 [(dccl.field).max_length = 9];
100 
101  optional Enum1 enum_default_optional = 16;
102 
103  optional EmbeddedMsg1 msg_default_optional = 17;
104 
105  required double double_default_required = 21 [
106  (dccl.field).min = -100,
107  (dccl.field).max = 126,
108  (dccl.field).precision = 2,
109  (dccl.field).in_head = true
110  ];
111  required float float_default_required = 22 [
112  (dccl.field).min = -20,
113  (dccl.field).max = 150,
114  (dccl.field).precision = 3
115  ];
116  required int32 int32_default_required = 23
117  [(dccl.field).min = -20, (dccl.field).max = 3000];
118  required int64 int64_default_required = 24
119  [(dccl.field).min = -710, (dccl.field).max = 3000];
120  required uint32 uint32_default_required = 25
121  [(dccl.field).min = 0, (dccl.field).max = 3000];
122  required uint64 uint64_default_required = 26
123  [(dccl.field).min = 5, (dccl.field).max = 3000];
124  required sint32 sint32_default_required = 27
125  [(dccl.field).min = -60, (dccl.field).max = 3000];
126  required sint64 sint64_default_required = 28
127  [(dccl.field).min = -70, (dccl.field).max = 3000];
128  required fixed32 fixed32_default_required = 29
129  [(dccl.field).min = 0, (dccl.field).max = 400];
130  required fixed64 fixed64_default_required = 30
131  [(dccl.field).min = 0, (dccl.field).max = 3000];
132  required sfixed32 sfixed32_default_required = 31
133  [(dccl.field).min = 11, (dccl.field).max = 3000];
134  required sfixed64 sfixed64_default_required = 32
135  [(dccl.field).min = -120, (dccl.field).max = 3000];
136 
137  required bool bool_default_required = 33;
138 
139  required string string_default_required = 34 [(dccl.field).max_length = 8];
140  required bytes bytes_default_required = 35 [(dccl.field).max_length = 9];
141 
142  required Enum1 enum_default_required = 36;
143 
144  required EmbeddedMsg1 msg_default_required = 37;
145 
146  repeated double double_default_repeat = 101 [
147  (dccl.field).min = 0,
148  (dccl.field).max = 100,
149  (dccl.field).precision = 3,
150  (dccl.field).max_repeat = 4
151  ];
152  repeated float float_default_repeat = 102 [
153  (dccl.field).min = 0,
154  (dccl.field).max = 100,
155  (dccl.field).precision = 3,
156  (dccl.field).max_repeat = 4
157  ];
158 
159  repeated int32 int32_default_repeat = 103 [
160  (dccl.field).min = 0,
161  (dccl.field).max = 100,
162  (dccl.field).max_repeat = 4
163  ];
164  repeated int64 int64_default_repeat = 104 [
165  (dccl.field).min = -100,
166  (dccl.field).max = 100,
167  (dccl.field).max_repeat = 4
168  ];
169  repeated uint32 uint32_default_repeat = 105 [
170  (dccl.field).min = 0,
171  (dccl.field).max = 100,
172  (dccl.field).max_repeat = 4,
173  (dccl.field).in_head = true
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 }