1 message SubMessage { 2 required string substuff1 = 1 [default = "1"]; 3 required int32 substuff2 = 2 [default = 2]; 4 optional fixed32 substuff3 = 3 [default = 3]; 5 } 6 7 message EmptyMessage { 8 9 } 10 11 enum HugeEnum { 12 Negative = -2147483647; /* protoc doesn't accept -2147483648 here */ 13 Positive = 2147483647; 14 } 15 16 message Limits { 17 required int32 int32_min = 1 [default = 2147483647]; 18 required int32 int32_max = 2 [default = -2147483647]; 19 required uint32 uint32_min = 3 [default = 4294967295]; 20 required uint32 uint32_max = 4 [default = 0]; 21 required int64 int64_min = 5 [default = 9223372036854775807]; 22 required int64 int64_max = 6 [default = -9223372036854775807]; 23 required uint64 uint64_min = 7 [default = 18446744073709551615]; 24 required uint64 uint64_max = 8 [default = 0]; 25 required HugeEnum enum_min = 9 [default = Positive]; 26 required HugeEnum enum_max = 10 [default = Negative]; 27 } 28 29 enum MyEnum { 30 Zero = 0; 31 First = 1; 32 Second = 2; 33 Truth = 42; 34 } 35 36 message AllTypes { 37 required int32 req_int32 = 1; 38 required int64 req_int64 = 2; 39 required uint32 req_uint32 = 3; 40 required uint64 req_uint64 = 4; 41 required sint32 req_sint32 = 5; 42 required sint64 req_sint64 = 6; 43 required bool req_bool = 7; 44 45 required fixed32 req_fixed32 = 8; 46 required sfixed32 req_sfixed32= 9; 47 required float req_float = 10; 48 49 required fixed64 req_fixed64 = 11; 50 required sfixed64 req_sfixed64= 12; 51 required double req_double = 13; 52 53 required string req_string = 14; 54 required bytes req_bytes = 15; 55 required SubMessage req_submsg = 16; 56 required MyEnum req_enum = 17; 57 required EmptyMessage req_emptymsg = 18; 58 59 60 repeated int32 rep_int32 = 21 [packed = true]; 61 repeated int64 rep_int64 = 22 [packed = true]; 62 repeated uint32 rep_uint32 = 23 [packed = true]; 63 repeated uint64 rep_uint64 = 24 [packed = true]; 64 repeated sint32 rep_sint32 = 25 [packed = true]; 65 repeated sint64 rep_sint64 = 26 [packed = true]; 66 repeated bool rep_bool = 27 [packed = true]; 67 68 repeated fixed32 rep_fixed32 = 28 [packed = true]; 69 repeated sfixed32 rep_sfixed32= 29 [packed = true]; 70 repeated float rep_float = 30 [packed = true]; 71 72 repeated fixed64 rep_fixed64 = 31 [packed = true]; 73 repeated sfixed64 rep_sfixed64= 32 [packed = true]; 74 repeated double rep_double = 33 [packed = true]; 75 76 repeated string rep_string = 34; 77 repeated bytes rep_bytes = 35; 78 repeated SubMessage rep_submsg = 36; 79 repeated MyEnum rep_enum = 37 [packed = true]; 80 repeated EmptyMessage rep_emptymsg = 38; 81 82 optional int32 opt_int32 = 41 [default = 4041]; 83 optional int64 opt_int64 = 42 [default = 4042]; 84 optional uint32 opt_uint32 = 43 [default = 4043]; 85 optional uint64 opt_uint64 = 44 [default = 4044]; 86 optional sint32 opt_sint32 = 45 [default = 4045]; 87 optional sint64 opt_sint64 = 46 [default = 4046]; 88 optional bool opt_bool = 47 [default = false]; 89 90 optional fixed32 opt_fixed32 = 48 [default = 4048]; 91 optional sfixed32 opt_sfixed32= 49 [default = 4049]; 92 optional float opt_float = 50 [default = 4050]; 93 94 optional fixed64 opt_fixed64 = 51 [default = 4051]; 95 optional sfixed64 opt_sfixed64= 52 [default = 4052]; 96 optional double opt_double = 53 [default = 4053]; 97 98 optional string opt_string = 54 [default = "4054"]; 99 optional bytes opt_bytes = 55 [default = "4055"]; 100 optional SubMessage opt_submsg = 56; 101 optional MyEnum opt_enum = 57 [default = Second]; 102 optional EmptyMessage opt_emptymsg = 58; 103 104 // Check that extreme integer values are handled correctly 105 required Limits req_limits = 98; 106 107 // Just to make sure that the size of the fields has been calculated 108 // properly, i.e. otherwise a bug in last field might not be detected. 109 required int32 end = 99; 110 111 112 extensions 200 to 255; 113 } 114 115