1 // Custom options for defining:
2 // - Maximum size of string/bytes
3 // - Maximum number of elements in array
5 // These are used by nanopb to generate statically allocable structures
6 // for memory-limited environments.
8 import "google/protobuf/descriptor.proto";
10 option java_package = "fi.kapsi.koti.jpa.nanopb";
13 FT_DEFAULT = 0; // Automatically decide field type, generate static field if possible.
14 FT_CALLBACK = 1; // Always generate a callback field.
15 FT_STATIC = 2; // Generate a static field or raise an exception if not possible.
16 FT_IGNORE = 3; // Ignore the field completely.
19 // This is the inner options message, which basically defines options for
20 // a field. When it is used in message or file scope, it applies to all
22 message NanoPBOptions {
23 // Allocated size for 'bytes' and 'string' fields.
24 optional int32 max_size = 1;
26 // Allocated number of entries in arrays ('repeated' fields)
27 optional int32 max_count = 2;
29 // Force type of field (callback or static allocation)
30 optional FieldType type = 3 [default = FT_DEFAULT];
32 // Use long names for enums, i.e. EnumName_EnumValue.
33 optional bool long_names = 4 [default = true];
35 // Add 'packed' attribute to generated structs.
36 // Note: this cannot be used on CPUs that break on unaligned
37 // accesses to variables.
38 optional bool packed_struct = 5 [default = false];
41 // Extensions to protoc 'Descriptor' type in order to define options
42 // inside a .proto file.
44 // Protocol Buffers extension number registry
45 // --------------------------------
47 // Contact: Petteri Aimonen <jpa@kapsi.fi>
48 // Web site: http://kapsi.fi/~jpa/nanopb
49 // Extensions: 1010 (all types)
50 // --------------------------------
52 extend google.protobuf.FileOptions {
53 optional NanoPBOptions nanopb_fileopt = 1010;
56 extend google.protobuf.MessageOptions {
57 optional NanoPBOptions nanopb_msgopt = 1010;
60 extend google.protobuf.EnumOptions {
61 optional NanoPBOptions nanopb_enumopt = 1010;
64 extend google.protobuf.FieldOptions {
65 optional NanoPBOptions nanopb = 1010;