Add 'CAN-binder/libs/nanopb/' from commit '278ffb890e3d8722e4c7d824baaf221a1e375fc4'
[apps/agl-service-can-low-level.git] / CAN-binder / libs / nanopb / generator / proto / nanopb.proto
1 // Custom options for defining:
2 // - Maximum size of string/bytes
3 // - Maximum number of elements in array
4 //
5 // These are used by nanopb to generate statically allocable structures
6 // for memory-limited environments.
7
8 syntax = "proto2";
9 import "google/protobuf/descriptor.proto";
10
11 option java_package = "fi.kapsi.koti.jpa.nanopb";
12
13 enum FieldType {
14     FT_DEFAULT = 0; // Automatically decide field type, generate static field if possible.
15     FT_CALLBACK = 1; // Always generate a callback field.
16     FT_POINTER = 4; // Always generate a dynamically allocated field.
17     FT_STATIC = 2; // Generate a static field or raise an exception if not possible.
18     FT_IGNORE = 3; // Ignore the field completely.
19     FT_INLINE = 5; // Legacy option, use the separate 'fixed_length' option instead
20 }
21
22 enum IntSize {
23     IS_DEFAULT = 0; // Default, 32/64bit based on type in .proto
24     IS_8 = 8;
25     IS_16 = 16;
26     IS_32 = 32;
27     IS_64 = 64;
28 }
29
30 // This is the inner options message, which basically defines options for
31 // a field. When it is used in message or file scope, it applies to all
32 // fields.
33 message NanoPBOptions {
34   // Allocated size for 'bytes' and 'string' fields.
35   // For string fields, this should include the space for null terminator.
36   optional int32 max_size = 1;
37   
38   // Maximum length for 'string' fields. Setting this is equivalent
39   // to setting max_size to a value of length+1.
40   optional int32 max_length = 14;
41   
42   // Allocated number of entries in arrays ('repeated' fields)
43   optional int32 max_count = 2;
44   
45   // Size of integer fields. Can save some memory if you don't need
46   // full 32 bits for the value.
47   optional IntSize int_size = 7 [default = IS_DEFAULT];
48
49   // Force type of field (callback or static allocation)
50   optional FieldType type = 3 [default = FT_DEFAULT];
51   
52   // Use long names for enums, i.e. EnumName_EnumValue.
53   optional bool long_names = 4 [default = true];
54   
55   // Add 'packed' attribute to generated structs.
56   // Note: this cannot be used on CPUs that break on unaligned
57   // accesses to variables.
58   optional bool packed_struct = 5 [default = false];
59   
60   // Add 'packed' attribute to generated enums.
61   optional bool packed_enum = 10 [default = false];
62   
63   // Skip this message
64   optional bool skip_message = 6 [default = false];
65
66   // Generate oneof fields as normal optional fields instead of union.
67   optional bool no_unions = 8 [default = false];
68
69   // integer type tag for a message
70   optional uint32 msgid = 9;
71
72   // decode oneof as anonymous union
73   optional bool anonymous_oneof = 11 [default = false];
74
75   // Proto3 singular field does not generate a "has_" flag
76   optional bool proto3 = 12 [default = false];
77
78   // Generate an enum->string mapping function (can take up lots of space).
79   optional bool enum_to_string = 13 [default = false];
80
81   // Generate bytes arrays with fixed length
82   optional bool fixed_length = 15 [default = false];
83 }
84
85 // Extensions to protoc 'Descriptor' type in order to define options
86 // inside a .proto file.
87 //
88 // Protocol Buffers extension number registry
89 // --------------------------------
90 // Project:  Nanopb
91 // Contact:  Petteri Aimonen <jpa@kapsi.fi>
92 // Web site: http://kapsi.fi/~jpa/nanopb
93 // Extensions: 1010 (all types)
94 // --------------------------------
95
96 extend google.protobuf.FileOptions {
97     optional NanoPBOptions nanopb_fileopt = 1010;
98 }
99
100 extend google.protobuf.MessageOptions {
101     optional NanoPBOptions nanopb_msgopt = 1010;
102 }
103
104 extend google.protobuf.EnumOptions {
105     optional NanoPBOptions nanopb_enumopt = 1010;
106 }
107
108 extend google.protobuf.FieldOptions {
109     optional NanoPBOptions nanopb = 1010;
110 }
111
112