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 //
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 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 = 3;
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  ];
174  repeated uint64 uint64_default_repeat = 106 [
175  (dccl.field).min = 0,
176  (dccl.field).max = 100,
177  (dccl.field).max_repeat = 4
178  ];
179  repeated sint32 sint32_default_repeat = 107 [
180  (dccl.field).min = -60,
181  (dccl.field).max = 100,
182  (dccl.field).max_repeat = 4
183  ];
184  repeated sint64 sint64_default_repeat = 108 [
185  (dccl.field).min = -600,
186  (dccl.field).max = 100,
187  (dccl.field).max_repeat = 4
188  ];
189  repeated fixed32 fixed32_default_repeat = 109 [
190  (dccl.field).min = 0,
191  (dccl.field).max = 100,
192  (dccl.field).max_repeat = 4
193  ];
194  repeated fixed64 fixed64_default_repeat = 110 [
195  (dccl.field).min = 0,
196  (dccl.field).max = 100,
197  (dccl.field).max_repeat = 4
198  ];
199  repeated sfixed32 sfixed32_default_repeat = 111 [
200  (dccl.field).min = 0,
201  (dccl.field).max = 100,
202  (dccl.field).max_repeat = 4
203  ];
204  repeated sfixed64 sfixed64_default_repeat = 112 [
205  (dccl.field).min = -500,
206  (dccl.field).max = 100,
207  (dccl.field).max_repeat = 4
208  ];
209 
210  repeated bool bool_default_repeat = 113 [(dccl.field).max_repeat = 4];
211 
212  repeated string string_default_repeat = 114
213  [(dccl.field).max_length = 4, (dccl.field).max_repeat = 4];
214  repeated bytes bytes_default_repeat = 115
215  [(dccl.field).max_length = 4, (dccl.field).max_repeat = 4];
216 
217  repeated Enum1 enum_default_repeat = 116 [(dccl.field).max_repeat = 4];
218 
219  repeated EmbeddedMsg1 msg_default_repeat = 117
220  [(dccl.field).max_repeat = 4];
221 }