1/* Test nanopb option parsing. 2 * options.expected lists the patterns that are searched for in the output. 3 */ 4 5syntax = "proto2"; 6 7import "nanopb.proto"; 8 9// File level options 10option (nanopb_fileopt).max_size = 20; 11 12message Message1 13{ 14 required string filesize = 1; 15} 16 17// Message level options 18message Message2 19{ 20 option (nanopb_msgopt).max_size = 30; 21 required string msgsize = 1; 22} 23 24// Field level options 25message Message3 26{ 27 option (nanopb_msgopt).msgid = 103; 28 required string fieldsize = 1 [(nanopb).max_size = 40]; 29} 30 31// Forced callback field 32message Message4 33{ 34 option (nanopb_msgopt).msgid = 104; 35 required int32 int32_callback = 1 [(nanopb).type = FT_CALLBACK]; 36} 37 38// Short enum names 39enum Enum1 40{ 41 option (nanopb_enumopt).long_names = false; 42 EnumValue1 = 1; 43 EnumValue2 = 2; 44} 45 46message EnumTest 47{ 48 required Enum1 field = 1 [default = EnumValue2]; 49} 50 51// Short enum names inside message 52message Message5 53{ 54 option (nanopb_msgopt).msgid = 105; 55 enum Enum2 56 { 57 option (nanopb_enumopt).long_names = false; 58 EnumValue1 = 1; 59 } 60 required Enum2 field = 1 [default = EnumValue1]; 61} 62 63// Packed structure 64message my_packed_struct 65{ 66 option (nanopb_msgopt).packed_struct = true; 67 optional int32 myfield = 1; 68} 69 70// Message with ignored field 71message Message6 72{ 73 required int32 field1 = 1; 74 optional int32 skipped_field = 2 [(nanopb).type = FT_IGNORE]; 75} 76 77// Message that is skipped 78message SkippedMessage 79{ 80 option (nanopb_msgopt).skip_message = true; 81 required int32 foo = 1; 82} 83 84// Message with oneof field 85message OneofMessage 86{ 87 oneof foo { 88 int32 bar = 1; 89 } 90} 91 92