1syntax = "proto2"; 2import "nanopb.proto"; 3 4message SubMessage 5{ 6 optional string dynamic_str = 1 [(nanopb).type = FT_POINTER]; 7 repeated string dynamic_str_arr = 2 [(nanopb).type = FT_POINTER]; 8 repeated SubMessage dynamic_submsg = 3 [(nanopb).type = FT_POINTER]; 9} 10 11message TestMessage 12{ 13 required SubMessage static_req_submsg = 1 [(nanopb).type = FT_STATIC]; 14 optional SubMessage dynamic_submsg = 2 [(nanopb).type = FT_POINTER]; 15 optional SubMessage static_opt_submsg = 3 [(nanopb).type = FT_STATIC]; 16 repeated SubMessage static_rep_submsg = 4 [(nanopb).type = FT_STATIC, (nanopb).max_count=2]; 17 extensions 100 to 200; 18} 19 20extend TestMessage 21{ 22 optional SubMessage dynamic_ext = 100 [(nanopb).type = FT_POINTER]; 23 optional SubMessage static_ext = 101 [(nanopb).type = FT_STATIC]; 24} 25 26message OneofMessage 27{ 28 required int32 first = 1; 29 oneof msgs 30 { 31 TestMessage msg1 = 2; 32 SubMessage msg2 = 3; 33 } 34 required int32 last = 4; 35} 36 37message RepeatedMessage 38{ 39 required int32 first = 1; 40 repeated SubMessage subs = 2; 41} 42