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_POINTER = 4; // Always generate a dynamically allocated field.
16 FT_STATIC = 2; // Generate a static field or raise an exception if not possible.
17 FT_IGNORE = 3; // Ignore the field completely.
20 // This is the inner options message, which basically defines options for
21 // a field. When it is used in message or file scope, it applies to all
23 message NanoPBOptions {
24 // Allocated size for 'bytes' and 'string' fields.
25 optional int32 max_size = 1;
27 // Allocated number of entries in arrays ('repeated' fields)
28 optional int32 max_count = 2;
30 // Force type of field (callback or static allocation)
31 optional FieldType type = 3 [default = FT_DEFAULT];
33 // Use long names for enums, i.e. EnumName_EnumValue.
34 optional bool long_names = 4 [default = true];
36 // Add 'packed' attribute to generated structs.
37 // Note: this cannot be used on CPUs that break on unaligned
38 // accesses to variables.
39 optional bool packed_struct = 5 [default = false];
42 // Extensions to protoc 'Descriptor' type in order to define options
43 // inside a .proto file.
45 // Protocol Buffers extension number registry
46 // --------------------------------
48 // Contact: Petteri Aimonen <jpa@kapsi.fi>
49 // Web site: http://kapsi.fi/~jpa/nanopb
50 // Extensions: 1010 (all types)
51 // --------------------------------
53 extend google.protobuf.FileOptions {
54 optional NanoPBOptions nanopb_fileopt = 1010;
57 extend google.protobuf.MessageOptions {
58 optional NanoPBOptions nanopb_msgopt = 1010;
61 extend google.protobuf.EnumOptions {
62 optional NanoPBOptions nanopb_enumopt = 1010;
65 extend google.protobuf.FieldOptions {
66 optional NanoPBOptions nanopb = 1010;