DCCL v5
Loading...
Searching...
No Matches
test.proto
1// Copyright 2024:
2// GobySoft, LLC (2013-)
3// Community contributors (see AUTHORS file)
4// File authors:
5// Toby Schneider <toby@gobysoft.org>
6//
7//
8// This file is part of the Dynamic Compact Control Language Library
9// ("DCCL").
10//
11// DCCL is free software: you can redistribute it and/or modify
12// it under the terms of the GNU Lesser General Public License as published by
13// the Free Software Foundation, either version 2.1 of the License, or
14// (at your option) any later version.
15//
16// DCCL is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU Lesser General Public License for more details.
20//
21// You should have received a copy of the GNU Lesser General Public License
22// along with DCCL. If not, see <http://www.gnu.org/licenses/>.
23syntax = "proto2";
24import "dccl/option_extensions.proto";
25package dccl.test;
26
27// Tests that DCCL recursively checks for in_head fields inside embedded messages.
28// Bar.foo does NOT have in_head=true, but Foo.header does.
29// The codec must encode/decode Foo.header as part of the HEAD.
30
31message HeaderMsg
32{
33 required int32 field = 1 [(dccl.field).min = 0, (dccl.field).max = 127];
34}
35
36// Foo itself is not marked in_head, but its embedded Header is.
37message Foo
38{
39 required HeaderMsg header = 1 [(dccl.field).in_head = true];
40 required int32 body_field = 2 [(dccl.field).min = 0, (dccl.field).max = 255];
41}
42
43message BarV4
44{
45 option (dccl.msg).id = 11013;
46 option (dccl.msg).max_bytes = 32;
47 option (dccl.msg).codec_version = 4;
48
49 required Foo foo = 1;
50 required int32 bar_body = 2 [(dccl.field).min = 0, (dccl.field).max = 255];
51}
52
53message BarV5
54{
55 option (dccl.msg).id = 11014;
56 option (dccl.msg).max_bytes = 32;
57 option (dccl.msg).codec_version = 5;
58
59 required Foo foo = 1;
60 required int32 bar_body = 2 [(dccl.field).min = 0, (dccl.field).max = 255];
61}