1syntax = "proto2";
2// package name placeholder
3
4enum NonZeroBasedEnum {
5    Two = 2;
6    Three = 3;
7    Four = 4;
8}
9
10message SubMessage {
11    required string substuff1 = 1 [default = "1"];
12    required int32 substuff2 = 2 [default = 2];
13    optional fixed32 substuff3 = 3 [default = 3];
14}
15
16message EmptyMessage {
17
18}
19
20enum HugeEnum {
21    Negative = -2147483647; /* protoc doesn't accept -2147483648 here */
22    Positive =  2147483647;
23}
24
25message Limits {
26    required int32      int32_min  =  1 [default = 2147483647];
27    required int32      int32_max  =  2 [default = -2147483647];
28    required uint32     uint32_min =  3 [default = 4294967295];
29    required uint32     uint32_max =  4 [default = 0];
30    required int64      int64_min  =  5 [default = 9223372036854775807];
31    required int64      int64_max  =  6 [default = -9223372036854775807];
32    required uint64     uint64_min =  7 [default = 18446744073709551615];
33    required uint64     uint64_max =  8 [default = 0];
34    required HugeEnum   enum_min   =  9 [default = Positive];
35    required HugeEnum   enum_max   = 10 [default = Negative];
36    required int32      largetag   = 65535 [default = 0];
37}
38
39message IntSizes {
40    required int32  req_int8 =   1 ;
41    required uint32 req_uint8 =  2 ;
42    required sint32 req_sint8 =  3 ;
43    required int32  req_int16 =  4 ;
44    required uint32 req_uint16 = 5 ;
45    required sint32 req_sint16 = 6 ;
46}
47
48message DescriptorSize8 {
49    required int32 first = 1;
50    required int32 second = 22222;
51}
52
53enum MyEnum {
54    Zero = 0;
55    First = 1;
56    Second = 2;
57    Truth = 42;
58}
59
60message AllTypes {
61    required int32      req_int32   = 1;
62    required int64      req_int64   = 2;
63    required uint32     req_uint32  = 3;
64    required uint64     req_uint64  = 4;
65    required sint32     req_sint32  = 5;
66    required sint64     req_sint64  = 6;
67    required bool       req_bool    = 7;
68
69    required fixed32    req_fixed32 = 8;
70    required sfixed32   req_sfixed32= 9;
71    required float      req_float   = 10;
72
73    required fixed64    req_fixed64 = 11;
74    required sfixed64   req_sfixed64= 12;
75    required double     req_double  = 13;
76
77    required string     req_string  = 14;
78    required bytes      req_bytes   = 15;
79    required SubMessage req_submsg  = 16;
80    required MyEnum     req_enum    = 17;
81    required EmptyMessage req_emptymsg = 18;
82    required bytes      req_fbytes  = 19;
83
84    repeated int32      rep_int32   = 21 [packed = true];
85    repeated int64      rep_int64   = 22 [packed = true];
86    repeated uint32     rep_uint32  = 23 [packed = true];
87    repeated uint64     rep_uint64  = 24 [packed = true];
88    repeated sint32     rep_sint32  = 25 [packed = true];
89    repeated sint64     rep_sint64  = 26 [packed = true];
90    repeated bool       rep_bool    = 27 [packed = true];
91
92    repeated fixed32    rep_fixed32 = 28 [packed = true];
93    repeated sfixed32   rep_sfixed32= 29 [packed = true];
94    repeated float      rep_float   = 30 [packed = true];
95
96    repeated fixed64    rep_fixed64 = 31 [packed = true];
97    repeated sfixed64   rep_sfixed64= 32 [packed = true];
98    repeated double     rep_double  = 33 [packed = true];
99
100    repeated string     rep_string  = 34;
101    repeated bytes      rep_bytes   = 35;
102    repeated SubMessage rep_submsg  = 36;
103    repeated MyEnum     rep_enum    = 37 [packed = true];
104    repeated EmptyMessage rep_emptymsg = 38;
105    repeated bytes      rep_fbytes  = 39;
106    repeated int32      rep_farray  = 40 [packed = true];
107
108    optional int32      opt_int32   = 41 [default = 4041];
109    optional int64      opt_int64   = 42 [default = 4042];
110    optional uint32     opt_uint32  = 43 [default = 4043];
111    optional uint64     opt_uint64  = 44 [default = 4044];
112    optional sint32     opt_sint32  = 45 [default = 4045];
113    optional sint64     opt_sint64  = 46 [default = 4046];
114    optional bool       opt_bool    = 47 [default = false];
115
116    optional fixed32    opt_fixed32 = 48 [default = 4048];
117    optional sfixed32   opt_sfixed32= 49 [default = 4049];
118    optional float      opt_float   = 50 [default = 4050];
119
120    optional fixed64    opt_fixed64 = 51 [default = 4051];
121    optional sfixed64   opt_sfixed64= 52 [default = 4052];
122    optional double     opt_double  = 53 [default = 4053];
123
124    optional string     opt_string  = 54 [default = "4054"];
125    optional bytes      opt_bytes   = 55 [default = "\x34\x5C\x00\xff"];
126    optional SubMessage opt_submsg  = 56;
127    optional MyEnum     opt_enum    = 57 [default = Second];
128    optional EmptyMessage opt_emptymsg = 58;
129    optional bytes      opt_fbytes  = 59 [default = "4059"];
130
131    oneof oneof
132    {
133        SubMessage oneof_msg1 = 60;
134        EmptyMessage oneof_msg2 = 61;
135        SubMessage static_msg = 63;
136    }
137
138    optional NonZeroBasedEnum opt_non_zero_based_enum = 62;
139
140    // Second fixed length array field to test the length check logic.
141    repeated fixed32 rep_farray2 = 95 [packed = true];
142
143    // Check support for custom integer sizes
144    required IntSizes req_intsizes = 96;
145
146    // Check support for 8-word descriptors
147    required DescriptorSize8 req_ds8 = 97;
148
149    // Check that extreme integer values are handled correctly
150    // Also checks support for 4-word descriptors
151    required Limits     req_limits = 98;
152
153    // Just to make sure that the size of the fields has been calculated
154    // properly, i.e. otherwise a bug in last field might not be detected.
155    required int32      end = 999;
156
157
158    extensions 200 to 255;
159}
160
161message TestExtension {
162    extend AllTypes {
163        optional TestExtension testextension = 250;
164    }
165    optional string strval = 1;
166}
167