Verify build with protobuf-3.0.0, fix problems.
[apps/agl-service-can-low-level.git] / 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 }
20
21 // This is the inner options message, which basically defines options for
22 // a field. When it is used in message or file scope, it applies to all
23 // fields.
24 message NanoPBOptions {
25   // Allocated size for 'bytes' and 'string' fields.
26   optional int32 max_size = 1;
27   
28   // Allocated number of entries in arrays ('repeated' fields)
29   optional int32 max_count = 2;
30   
31   // Force type of field (callback or static allocation)
32   optional FieldType type = 3 [default = FT_DEFAULT];
33   
34   // Use long names for enums, i.e. EnumName_EnumValue.
35   optional bool long_names = 4 [default = true];
36   
37   // Add 'packed' attribute to generated structs.
38   // Note: this cannot be used on CPUs that break on unaligned
39   // accesses to variables.
40   optional bool packed_struct = 5 [default = false];
41   
42   // Skip this message
43   optional bool skip_message = 6 [default = false];
44 }
45
46 // Extensions to protoc 'Descriptor' type in order to define options
47 // inside a .proto file.
48 //
49 // Protocol Buffers extension number registry
50 // --------------------------------
51 // Project:  Nanopb
52 // Contact:  Petteri Aimonen <jpa@kapsi.fi>
53 // Web site: http://kapsi.fi/~jpa/nanopb
54 // Extensions: 1010 (all types)
55 // --------------------------------
56
57 extend google.protobuf.FileOptions {
58     optional NanoPBOptions nanopb_fileopt = 1010;
59 }
60
61 extend google.protobuf.MessageOptions {
62     optional NanoPBOptions nanopb_msgopt = 1010;
63 }
64
65 extend google.protobuf.EnumOptions {
66     optional NanoPBOptions nanopb_enumopt = 1010;
67 }
68
69 extend google.protobuf.FieldOptions {
70     optional NanoPBOptions nanopb = 1010;
71 }
72
73