1 // This is a transitional file, to provide parallel support between the old
2 // nanopb.proto and new options.proto files. Eventually nanopb.proto will
3 // be left only for legacy code, but for now the generator is still also
4 // using it. However, your new code can start using this file already now.
5 // See pull request #241 for details:
6 // https://github.com/nanopb/nanopb/pull/241
8 // Custom options for defining:
9 // - Maximum size of string/bytes
10 // - Maximum number of elements in array
12 // These are used by nanopb to generate statically allocable structures
13 // for memory-limited environments.
16 import "google/protobuf/descriptor.proto";
19 option java_package = "fi.kapsi.koti.jpa.nanopb";
22 FT_DEFAULT = 0; // Automatically decide field type, generate static field if possible.
23 FT_CALLBACK = 1; // Always generate a callback field.
24 FT_POINTER = 4; // Always generate a dynamically allocated field.
25 FT_STATIC = 2; // Generate a static field or raise an exception if not possible.
26 FT_IGNORE = 3; // Ignore the field completely.
27 FT_INLINE = 5; // Legacy option, use the separate 'fixed_length' option instead
31 IS_DEFAULT = 0; // Default, 32/64bit based on type in .proto
38 // This is the inner options message, which basically defines options for
39 // a field. When it is used in message or file scope, it applies to all
42 // Allocated size for 'bytes' and 'string' fields.
43 // For string fields, this should include the space for null terminator.
44 optional int32 max_size = 1;
46 // Maximum length for 'string' fields. Setting this is equivalent
47 // to setting max_size to a value of length+1.
48 optional int32 max_length = 14;
50 // Allocated number of entries in arrays ('repeated' fields)
51 optional int32 max_count = 2;
53 // Size of integer fields. Can save some memory if you don't need
54 // full 32 bits for the value.
55 optional IntSize int_size = 7 [default = IS_DEFAULT];
57 // Force type of field (callback or static allocation)
58 optional FieldType type = 3 [default = FT_DEFAULT];
60 // Use long names for enums, i.e. EnumName_EnumValue.
61 optional bool long_names = 4 [default = true];
63 // Add 'packed' attribute to generated structs.
64 // Note: this cannot be used on CPUs that break on unaligned
65 // accesses to variables.
66 optional bool packed_struct = 5 [default = false];
68 // Add 'packed' attribute to generated enums.
69 optional bool packed_enum = 10 [default = false];
72 optional bool skip_message = 6 [default = false];
74 // Generate oneof fields as normal optional fields instead of union.
75 optional bool no_unions = 8 [default = false];
77 // integer type tag for a message
78 optional uint32 msgid = 9;
80 // decode oneof as anonymous union
81 optional bool anonymous_oneof = 11 [default = false];
83 // Proto3 singular field does not generate a "has_" flag
84 optional bool proto3 = 12 [default = false];
86 // Generate an enum->string mapping function (can take up lots of space).
87 optional bool enum_to_string = 13 [default = false];
89 // Generate bytes arrays with fixed length
90 optional bool fixed_length = 15 [default = false];
93 // Extensions to protoc 'Descriptor' type in order to define options
94 // inside a .proto file.
96 // Protocol Buffers extension number registry
97 // --------------------------------
99 // Contact: Petteri Aimonen <jpa@kapsi.fi>
100 // Web site: http://kapsi.fi/~jpa/nanopb
101 // Extensions: 1010 (all types)
102 // --------------------------------
104 extend google.protobuf.FileOptions {
105 optional Options fileopt = 1010;
108 extend google.protobuf.MessageOptions {
109 optional Options msgopt = 1010;
112 extend google.protobuf.EnumOptions {
113 optional Options enumopt = 1010;
116 extend google.protobuf.FieldOptions {
117 optional Options fieldopt = 1010;