summaryrefslogtreecommitdiffstats
path: root/generator/nanopb.proto
blob: e7bea139577acc10cf28b0b31008215c30b79368 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Custom options for defining:
// - Maximum size of string/bytes
// - Maximum number of elements in array
//
// These are used by nanopb to generate statically allocable structures
// for memory-limited environments.

import "google/protobuf/descriptor.proto";

enum FieldType {
    FT_DEFAULT = 0; // Automatically decide field type, generate static field if possible.
    FT_CALLBACK = 1; // Always generate a callback field.
    FT_STATIC = 2; // Generate a static field or raise an exception if not possible.
}

message NanoPBOptions {
  optional int32 max_size = 1;
  optional int32 max_count = 2;
  optional FieldType type = 3 [default = FT_DEFAULT];
}

// Protocol Buffers extension number registry
// --------------------------------                                                                                                            
// Project:  Nanopb                                                                                                                            
// Contact:  Petteri Aimonen <jpa@kapsi.fi>                                                                                                    
// Web site: http://kapsi.fi/~jpa/nanopb                                                                                                       
// Extensions: 1010 (all types)                                                                                                                
// --------------------------------   

extend google.protobuf.FileOptions {
    optional NanoPBOptions nanopb_fileopt = 1010;
}

extend google.protobuf.MessageOptions {
    optional NanoPBOptions nanopb_msgopt = 1010;
}

extend google.protobuf.FieldOptions {
    optional NanoPBOptions nanopb = 1010;
}