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