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";
11 FT_DEFAULT = 0; // Automatically decide field type, generate static field if possible.
12 FT_CALLBACK = 1; // Always generate a callback field.
13 FT_STATIC = 2; // Generate a static field or raise an exception if not possible.
14 FT_IGNORE = 3; // Ignore the field completely.
17 message NanoPBOptions {
18 // Allocated size for 'bytes' and 'string' fields.
19 optional int32 max_size = 1;
21 // Allocated number of entries in arrays ('repeated' fields)
22 optional int32 max_count = 2;
24 // Force type of field (callback or static allocation)
25 optional FieldType type = 3 [default = FT_DEFAULT];
27 // Use long names for enums, i.e. EnumName_EnumValue.
28 optional bool long_names = 4 [default = true];
30 // Add 'packed' attribute to generated structs.
31 optional bool packed_struct = 5 [default = false];
34 // Protocol Buffers extension number registry
35 // --------------------------------
37 // Contact: Petteri Aimonen <jpa@kapsi.fi>
38 // Web site: http://kapsi.fi/~jpa/nanopb
39 // Extensions: 1010 (all types)
40 // --------------------------------
42 extend google.protobuf.FileOptions {
43 optional NanoPBOptions nanopb_fileopt = 1010;
46 extend google.protobuf.MessageOptions {
47 optional NanoPBOptions nanopb_msgopt = 1010;
50 extend google.protobuf.EnumOptions {
51 optional NanoPBOptions nanopb_enumopt = 1010;
54 extend google.protobuf.FieldOptions {
55 optional NanoPBOptions nanopb = 1010;