• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2019 Google Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto3";
18
19message Misc {
20    oneof misc_oneof {
21        string comment = 1;
22        ProcessingInstruction inst = 2;
23    }
24}
25
26message PEReference {
27    string name = 1;
28}
29
30message ElementDecl {
31    enum ContentSpec {
32        EMPTY = 0;
33        ANY = 1;
34        FUZZ = 2;
35        MIXED = 3;
36        CHILDREN = 4;
37    }
38    string name = 1;
39    ContentSpec spec = 2;
40    repeated string cdata = 3;
41}
42
43message AttrType {
44    enum Type {
45        CDATA = 0;
46        ID = 1;
47        IDREF = 2;
48        IDREFS = 3;
49        ENTITY = 4;
50        ENTITIES = 5;
51        NMTOKEN = 6;
52        NMTOKENS = 7;
53    }
54    Type ty = 1;
55}
56
57message EnumeratedType {
58    repeated string names = 1;
59}
60
61message AttrListDecl {
62    string name = 1;
63    AttrType atype = 2;
64    EnumeratedType etype = 3;
65    DefaultDecl def = 4;
66}
67
68message ExternalId {
69    enum Type {
70        SYSTEM = 0;
71        PUBLIC = 1;
72        FUZZ = 2;
73    }
74    Type type = 1;
75    string system = 2;
76    string pub = 3;
77}
78
79message AttValue {
80    enum Type {
81        ENTITY = 0;
82        CHAR = 1;
83        FUZZ = 2;
84    }
85    Type type = 1;
86    repeated string value = 2;
87}
88
89message DefaultDecl {
90    enum Type {
91        REQUIRED = 0;
92        IMPLIED = 1;
93        FIXED = 2;
94        FUZZ = 3;
95    }
96    Type type = 1;
97    AttValue att = 2;
98}
99
100message AttDef {
101    // TODO: Add enumerated type
102    enum Type {
103        CDATA = 0;
104        ID = 1;
105        IDREF = 2;
106        IDREFS = 3;
107        ENTITY = 4;
108        ENTITIES = 5;
109        NMTOKEN = 6;
110        NMTOKENS = 7;
111        FUZZ = 8;
112    }
113    string name = 1;
114    Type type = 2;
115    DefaultDecl def = 3;
116}
117
118message AttListDecl {
119    string name = 1;
120    repeated AttDef attdefs = 2;
121}
122
123message NotationDecl {
124    string name = 1;
125    oneof notation_oneof {
126        ExternalId ext = 2;
127        string pub = 3;
128        string fuzz = 4;
129    }
130}
131
132message EntityValue {
133    enum Type {
134        ENTITY = 0;
135        CHAR = 1;
136        PEREF = 2;
137        FUZZ = 3;
138    }
139    Type type = 1;
140    repeated string name = 2;
141}
142
143message NDataDecl {
144    string name = 1;
145}
146
147message EntityDef {
148    oneof entity_oneof {
149        ExternalId ext = 1;
150        EntityValue val = 2;
151    }
152    NDataDecl ndata = 3;
153}
154
155message PEDef {
156    oneof pedef_oneof {
157        EntityValue val = 1;
158        ExternalId id = 2;
159    }
160}
161
162message EntityDecl {
163    enum Type {
164        GEDECL = 0;
165        PEDECL = 1;
166    }
167    Type type = 1;
168    string name = 2;
169    EntityDef ent = 3;
170    PEDef pedef = 4;
171}
172
173message ConditionalSect {
174    enum Type {
175        INCLUDE = 0;
176        IGNORE = 1;
177        FUZZ = 2;
178    }
179    Type type = 1;
180    ExtSubsetDecl ext = 2;
181    // TODO: Make this recursive
182    // See https://www.w3.org/TR/xml/#NT-conditionalSect
183    repeated string ignores = 3;
184}
185
186message OneExtSubsetDecl {
187    oneof extsubset_oneof {
188        MarkupDecl m = 1;
189        ConditionalSect c = 2;
190    }
191}
192
193message ExtSubsetDecl {
194    repeated OneExtSubsetDecl decls = 1;
195}
196
197message MarkupDecl {
198    oneof markup_oneof {
199        ElementDecl e = 1;
200        AttListDecl a = 2;
201        NotationDecl n = 3;
202        Misc m = 4;
203        EntityDecl entity = 5;
204        ExtSubsetDecl ext = 6;
205    }
206}
207
208message DocTypeDecl {
209    string name = 1;
210    ExternalId ext = 2;
211    repeated MarkupDecl mdecl = 3;
212}
213
214message Prolog {
215    XmlDeclaration decl = 1;
216    DocTypeDecl doctype = 2;
217    repeated Misc misc = 3;
218}
219
220message KeyValue {
221    enum XmlNamespace {
222        ATTRIBUTES = 0;
223        BASE = 1;
224        CATALOG = 2;
225        ID = 3;
226        LANG = 4;
227        LINK = 5;
228        SPACE = 6;
229        SPECIAL = 7;
230        TEST = 8;
231        FUZZ = 9;
232    }
233    XmlNamespace type = 1;
234    string key = 2;
235    string value = 3;
236}
237
238message ProcessingInstruction {
239    string name = 1;
240    repeated KeyValue kv = 2;
241}
242
243message CData {
244    string data = 1;
245}
246
247message Content {
248    // TODO: Add other content types
249    oneof content_oneof {
250        string str = 1;
251        Element e = 2;
252        CData c = 3;
253    }
254}
255
256message Element {
257    enum Type {
258        PREDEFINED = 0;
259        FUZZ = 1;
260    }
261    enum Id {
262        XIINCLUDE = 0;
263        XIFALLBACK = 1;
264        // Attributes of xinclude
265        XIHREF = 2;
266        XIPARSE = 3;
267        XIXPOINTER = 4;
268        XIENCODING = 5;
269        XIACCEPT = 6;
270        XIACCEPTLANG = 7;
271    }
272    Type type = 1;
273    Id id = 2;
274    string name = 3;
275    repeated KeyValue kv = 4;
276    Content content = 5;
277    string childprop = 6;
278}
279
280message VersionNum {
281    enum Type {
282        STANDARD = 0;
283        FUZZ = 1;
284    }
285    Type type = 1;
286    uint64 major = 2;
287    uint64 minor = 3;
288}
289
290message Encodings {
291    enum Enc {
292        BIG5 = 0;
293        EUCJP = 1;
294        EUCKR = 2;
295        GB18030 = 3;
296        ISO2022JP = 4;
297        ISO2022KR = 5;
298        ISO88591 = 6;
299        ISO88592 = 7;
300        ISO88593 = 8;
301        ISO88594 = 9;
302        ISO88595 = 10;
303        ISO88596 = 11;
304        ISO88597 = 12;
305        ISO88598 = 13;
306        ISO88599 = 14;
307        SHIFTJIS = 15;
308        TIS620 = 16;
309        USASCII = 17;
310        UTF8 = 18;
311        UTF16 = 19;
312        UTF16BE = 20;
313        UTF16LE = 21;
314        WINDOWS31J = 22;
315        WINDOWS1255 = 23;
316        WINDOWS1256 = 24;
317        FUZZ = 25;
318    }
319    Enc name = 1;
320    string fuzz = 2;
321}
322
323message XmlDeclaration {
324    VersionNum ver = 1;
325    Encodings enc = 2;
326    enum Standalone {
327        YES = 0;
328        NO = 1;
329    }
330    Standalone standalone = 3;
331    string fuzz = 4;
332}
333
334message XmlDocument {
335    Prolog p = 1;
336    repeated Element e = 2;
337}
338
339package xmlProtoFuzzer;