summaryrefslogtreecommitdiffstats
path: root/src/main/resources/libvirt/rng/basictypes.rng
blob: 2d6f1a2c84b72a28ab64c3a1b734b3da294de409 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
<?xml version="1.0"?>
<!-- network-related definitions used in multiple grammars -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

  <!-- Our unsignedInt doesn't allow a leading "+" in its lexical form -->
  <define name="unsignedInt">
    <data type="unsignedInt">
      <param name="pattern">[0-9]+</param>
    </data>
  </define>
  <define name="unsignedLong">
    <data type="unsignedLong">
      <param name="pattern">[0-9]+</param>
    </data>
  </define>

  <define name="hexuint">
    <data type="string">
      <param name="pattern">(0x)?[0-9a-f]+</param>
    </data>
  </define>

  <define name="positiveInteger">
    <data type="positiveInteger">
      <param name="pattern">[0-9]+</param>
    </data>
  </define>

  <define name="octalMode">
    <data type="unsignedInt">
      <param name="pattern">[0-7]+</param>
    </data>
  </define>

  <define name="uint8">
    <choice>
      <data type="string">
        <param name="pattern">0x[0-9a-fA-F]{1,2}</param>
      </data>
      <data type="int">
        <param name="minInclusive">0</param>
        <param name="maxInclusive">255</param>
      </data>
    </choice>
  </define>
  <define name="uint16">
    <choice>
      <data type="string">
        <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
      </data>
      <data type="int">
        <param name="minInclusive">0</param>
        <param name="maxInclusive">65535</param>
      </data>
    </choice>
  </define>
  <define name="uint24">
    <choice>
      <data type="string">
        <param name="pattern">0x[0-9a-fA-F]{1,6}</param>
      </data>
      <data type="int">
        <param name="minInclusive">0</param>
        <param name="maxInclusive">16777215</param>
      </data>
    </choice>
  </define>
  <define name="uint32">
    <choice>
      <data type="string">
        <param name="pattern">(0x)?[0-9a-fA-F]{1,8}</param>
      </data>
      <data type="unsignedInt">
        <param name="minInclusive">0</param>
        <param name="maxInclusive">4294967295</param>
      </data>
    </choice>
  </define>

  <define name="UUID">
    <choice>
      <data type="string">
        <param name="pattern">[a-fA-F0-9]{32}</param>
      </data>
      <data type="string">
        <param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
      </data>
    </choice>
  </define>

  <define name="numaDistanceValue">
    <data type="unsignedInt">
      <param name="minInclusive">10</param>
      <param name="maxInclusive">255</param>
    </data>
  </define>

  <define name="pciaddress">
    <optional>
      <attribute name="domain">
        <ref name="pciDomain"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="bus">
        <ref name="pciBus"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="slot">
        <ref name="pciSlot"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="function">
        <ref name="pciFunc"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="multifunction">
        <ref name="virOnOff"/>
      </attribute>
    </optional>
  </define>
  <define name="zpciaddress">
    <optional>
      <element name="zpci">
        <optional>
          <attribute name="uid">
            <ref name="uint16"/>
          </attribute>
        </optional>
        <optional>
          <attribute name="fid">
            <ref name="uint32"/>
          </attribute>
        </optional>
      </element>
    </optional>
  </define>

  <!-- a 6 byte MAC address in ASCII-hex format, eg "12:34:56:78:9A:BC" -->
  <!-- The lowest bit of the 1st byte is the "multicast" bit. a         -->
  <!-- uniMacAddr requires that bit to be 0, and a multiMacAddr         -->
  <!-- requires it to be 1. Plain macAddr will accept either.           -->
  <!-- Currently there is no use of multiMacAddr in libvirt, it         -->
  <!-- is included here for documentation/comparison purposes.          -->
  <define name="uniMacAddr">
    <data type="string">
      <param name="pattern">[a-fA-F0-9][02468aAcCeE](:[a-fA-F0-9]{2}){5}</param>
    </data>
  </define>
  <define name="multiMacAddr">
    <data type="string">
      <param name="pattern">[a-fA-F0-9][13579bBdDfF](:[a-fA-F0-9]{2}){5}</param>
    </data>
  </define>
  <define name="macAddr">
    <data type="string">
      <param name="pattern">[a-fA-F0-9]{2}(:[a-fA-F0-9]{2}){5}</param>
    </data>
  </define>

  <!--====================================================================-->
  <!--The duid is a unique identifier used in DHCPv6 to identity an       -->
  <!--interface on a device (system).  The duid is often used by servers  -->
  <!--such as dnsmasq to assign a specific IP address (and optionally a   -->
  <!--name to an interface.  The applicable standards are RFC3315 and     -->
  <!--RFC6355.  These standards actually require the duid to be fixed for -->
  <!--the hardware device and applicable to all network interfaces on     -->
  <!--that device.  It is not clear that any software currently enforces  -->
  <!--this requirement although it could be implemented manually.         -->
  <!--====================================================================-->
  <!--There are currently four types of duids defined:                    -->
  <!--  type 1, duid-LLT, link-layer (MAC) plus 32 bit time when the      -->
  <!--          duid-LLT was created in seconds from January 1, 2000      -->
  <!--  type 2, duid-EN, 32 bit "enterprise number" followed by a         -->
  <!--          variable length unique identifier.                        -->
  <!--  type 3, duid-LL, link-layer (MAC)                                 -->
  <!--  type 4, duid-UUID, a 128 bit UUID (16 bytes)                      -->
  <!--RFC3315 states that the maximum length of a duid is 128 bytes plus  -->
  <!--the 16 bit type field.  Often, the machine type is "1" which is the -->
  <!--number assigned to ethernet.                                        -->

  <define name="duidLLT">
    <data type="string">
                     <!--   0======| type======| 0======| machine type======| time================| link-layer============|     -->
      <param name="pattern">[0]{1,2}:[0]{0,1}[1]:[0]{1,2}:[0]{0,1}[a-fA-F1-9](:[a-fA-F0-9]{1,2}){4}(:[a-fA-F0-9]{1,2}){6,8}</param>
    </data>
  </define>

  <define name="duidEN">
    <data type="string">
                     <!--   0======| type======| Enterprise number===| unique id ==============|     -->
      <param name="pattern">[0]{1,2}:[0]{0,1}[2](:[a-fA-F0-9]{1,2}){4}(:[a-fA-F0-9]{1,2}){1,124}</param>
    </data>
  </define>

  <define name="duidLL">
    <data type="string">
                     <!--   0======| type======| 0======| machine type======| link-layer============|     -->
      <param name="pattern">[0]{1,2}:[0]{0,1}[3]:[0]{1,2}:[0]{0,1}[a-fA-F1-9](:[a-fA-F0-9]{1,2}){6,8}</param>
    </data>
  </define>

  <define name="duidUUID">
    <data type="string">
                     <!--   0======| type======| UUID=================|     -->
      <param name="pattern">[0]{1,2}:[0]{0,1}[4](:[a-fA-F0-9]{1,2}){16}</param>
    </data>
  </define>

  <define name="DUID">
    <choice>
      <ref name="duidLLT"/>
      <ref name="duidEN"/>
      <ref name="duidLL"/>
      <ref name="duidUUID"/>
    </choice>
  </define>
  <!--======================================================================-->

  <!-- A D-Bus server address: https://dbus.freedesktop.org/doc/dbus-specification.html#addresses -->
  <define name="dbusAddr">
    <data type="string">
      <param name="pattern">.+</param>
    </data>
  </define>

  <!-- An ipv4 "dotted quad" address -->
  <define name="ipv4Addr">
    <data type="string">
      <param name="pattern">(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))</param>
    </data>
  </define>

  <!-- Based on https://web.archive.org/web/20090503193311/http://blog.mes-stats.fr/2008/10/09/regex-ipv4-et-ipv6 -->
  <define name="ipv6Addr">
    <data type="string">
      <!-- To understand this better, take apart the toplevel "|"s -->
<param name="pattern">(([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|(([0-9A-Fa-f]{1,4}:){0,5}:(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|(::([0-9A-Fa-f]{1,4}:){0,5}(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:)|(::)</param>
    </data>
  </define>

  <define name="ipAddr">
    <choice>
      <ref name="ipv4Addr"/>
      <ref name="ipv6Addr"/>
    </choice>
  </define>

  <define name="ipv4Prefix">
    <data type="unsignedInt">
      <param name="maxInclusive">32</param>
    </data>
  </define>

  <define name="ipv6Prefix">
    <data type="unsignedInt">
      <param name="maxInclusive">128</param>
    </data>
  </define>

  <define name="ipPrefix">
    <choice>
      <ref name="ipv4Prefix"/>
      <ref name="ipv6Prefix"/>
    </choice>
  </define>

  <!-- objectName represents any generic string for naming objects like domain -->
  <define name="objectNameWithSlash">
    <data type="string">
      <param name="pattern">[^\n]+</param>
    </data>
  </define>

  <define name="objectName">
    <data type="string">
      <param name="pattern">[^/\n]+</param>
    </data>
  </define>

  <define name="genericName">
    <data type="string">
      <param name="pattern">[a-zA-Z0-9_\+\-]+</param>
    </data>
  </define>

  <define name="dnsName">
    <data type="string">
      <param name="pattern">[a-zA-Z0-9\.\-]+</param>
    </data>
  </define>

  <define name="deviceName">
    <data type="string">
      <param name="pattern">[a-zA-Z0-9_\.\-\\:/]+</param>
    </data>
  </define>

  <define name="zoneName">
    <data type="string">
      <param name="pattern">[a-zA-Z0-9_\-]+</param>
    </data>
  </define>

  <define name="filePath">
    <data type="string">
      <param name="pattern">.+</param>
    </data>
  </define>

  <define name="dirPath">
    <data type="string">
      <param name="pattern">.+</param>
    </data>
  </define>

  <define name="absFilePath">
    <data type="string">
      <param name="pattern">(/|[a-zA-Z]:\\).+</param>
    </data>
  </define>

  <define name="vmwarePath">
    <data type="string">
      <param name="pattern">\[[^\]]+\] .+</param>
    </data>
  </define>

  <define name="absDirPath">
    <data type="string">
      <param name="pattern">/.*</param>
    </data>
  </define>

  <define name="unit">
    <data type="string">
      <param name="pattern">([bB]([yY][tT][eE][sS]?)?)|([kKmMgGtTpPeE]([iI]?[bB])?)</param>
    </data>
  </define>
  <define name="scaledInteger">
    <optional>
      <attribute name="unit">
        <ref name="unit"/>
      </attribute>
    </optional>
    <ref name="unsignedLong"/>
  </define>

  <define name="pciDomain">
    <ref name="uint32"/>
  </define>
  <define name="pciBus">
    <ref name="uint8"/>
  </define>
  <define name="pciSlot">
    <choice>
      <data type="string">
        <param name="pattern">(0x)?[0-1]?[0-9a-fA-F]</param>
      </data>
      <data type="int">
        <param name="minInclusive">0</param>
        <param name="maxInclusive">31</param>
      </data>
    </choice>
  </define>
  <define name="pciFunc">
    <choice>
      <data type="string">
        <param name="pattern">(0x)?[0-7]</param>
      </data>
      <data type="int">
        <param name="minInclusive">0</param>
        <param name="maxInclusive">7</param>
      </data>
    </choice>
  </define>

  <define name="wwn">
    <data type="string">
      <param name="pattern">(0x)?[0-9a-fA-F]{16}</param>
    </data>
  </define>

  <define name="ccwCssidRange">
    <choice>
      <data type="string">
        <param name="pattern">0x[0-9a-eA-E][0-9a-fA-F]?</param>
      </data>
      <data type="string">
        <param name="pattern">0x[fF][0-9a-eA-E]?</param>
      </data>
      <data type="int">
        <param name="minInclusive">0</param>
        <param name="maxInclusive">254</param>
      </data>
    </choice>
  </define>
  <define name="ccwSsidRange">
    <data type="string">
      <param name="pattern">(0x)?[0-3]</param>
    </data>
  </define>
  <define name="ccwDevnoRange">
    <choice>
      <data type="string">
        <param name="pattern">0x[0-9a-fA-F]{1,4}</param>
      </data>
      <data type="int">
        <param name="minInclusive">0</param>
        <param name="maxInclusive">65535</param>
      </data>
    </choice>
  </define>

  <define name="cpuset">
    <data type="string">
      <param name="pattern">([0-9]+(-[0-9]+)?|\^[0-9]+)(,([0-9]+(-[0-9]+)?|\^[0-9]+))*</param>
    </data>
  </define>

  <define name="volName">
    <!-- directory pools allow almost any file name as a volume name -->
    <data type="string">
      <param name="pattern">[^/]+</param>
      <except>
        <choice>
          <value>.</value>
          <value>..</value>
        </choice>
      </except>
    </data>
  </define>

  <define name="archnames">
    <choice>
      <value>aarch64</value>
      <value>alpha</value>
      <value>armv6l</value>
      <value>armv7l</value>
      <value>cris</value>
      <value>i686</value>
      <value>ia64</value>
      <value>lm32</value>
      <value>m68k</value>
      <value>microblaze</value>
      <value>microblazeel</value>
      <value>mips</value>
      <value>mipsel</value>
      <value>mips64</value>
      <value>mips64el</value>
      <value>openrisc</value>
      <value>parisc</value>
      <value>parisc64</value>
      <value>ppc</value>
      <value>ppc64</value>
      <value>ppc64le</value>
      <value>ppcemb</value>
      <value>riscv32</value>
      <value>riscv64</value>
      <value>s390</value>
      <value>s390x</value>
      <value>sh4</value>
      <value>sh4eb</value>
      <value>sparc</value>
      <value>sparc64</value>
      <value>unicore32</value>
      <value>x86_64</value>
      <value>xtensa</value>
      <value>xtensaeb</value>
    </choice>
  </define>

  <define name="PortNumber">
    <data type="int">
      <param name="minInclusive">-1</param>
      <param name="maxInclusive">65535</param>
    </data>
  </define>

  <define name="sourceinfoadapter">
    <element name="adapter">
      <choice>
        <group>
          <!-- To keep back-compat, "type" is not mandatory for
           scsi_host adapter -->
          <optional>
            <attribute name="type">
              <value>scsi_host</value>
            </attribute>
          </optional>
          <choice>
            <group>
              <attribute name="name">
                <text/>
              </attribute>
            </group>
            <group>
              <interleave>
                <element name="parentaddr">
                  <optional>
                    <attribute name="unique_id">
                      <ref name="positiveInteger"/>
                    </attribute>
                  </optional>
                  <element name="address">
                    <ref name="pciaddress"/>
                  </element>
                </element>
              </interleave>
            </group>
          </choice>
        </group>
        <group>
          <attribute name="type">
            <value>fc_host</value>
          </attribute>
          <optional>
            <attribute name="parent">
              <text/>
            </attribute>
          </optional>
          <optional>
            <attribute name="managed">
              <ref name="virYesNo"/>
            </attribute>
          </optional>
          <optional>
            <attribute name="parent_wwnn">
              <ref name="wwn"/>
            </attribute>
          </optional>
          <optional>
            <attribute name="parent_wwpn">
              <ref name="wwn"/>
            </attribute>
          </optional>
          <optional>
            <attribute name="parent_fabric_wwn">
              <ref name="wwn"/>
            </attribute>
          </optional>
          <attribute name="wwnn">
            <ref name="wwn"/>
          </attribute>
          <attribute name="wwpn">
            <ref name="wwn"/>
          </attribute>
        </group>
      </choice>
      <empty/>
    </element>
  </define>

  <define name="isaaddress">
    <optional>
      <attribute name="iobase">
        <data type="string">
          <param name="pattern">0x[a-fA-F0-9]{1,4}</param>
        </data>
      </attribute>
    </optional>
    <optional>
      <attribute name="irq">
        <data type="string">
          <param name="pattern">0x[a-fA-F0-9]</param>
        </data>
      </attribute>
    </optional>
  </define>

  <define name="link-speed-state">
    <optional>
      <element name="link">
        <optional>
          <attribute name="speed">
            <ref name="unsignedInt"/>
          </attribute>
        </optional>
        <optional>
          <attribute name="state">
            <choice>
              <value>unknown</value>
              <value>notpresent</value>
              <value>down</value>
              <value>lowerlayerdown</value>
              <value>testing</value>
              <value>dormant</value>
              <value>up</value>
            </choice>
          </attribute>
        </optional>
      </element>
    </optional>
  </define>

  <define name="virYesNo">
    <choice>
      <value>yes</value>
      <value>no</value>
    </choice>
  </define>

  <define name="virOnOff">
    <choice>
      <value>on</value>
      <value>off</value>
    </choice>
  </define>

  <define name="metadata">
    <element name="metadata">
      <zeroOrMore>
        <ref name="customElement"/>
      </zeroOrMore>
    </element>
  </define>

  <define name="customElement">
    <element>
      <anyName/>
      <zeroOrMore>
        <choice>
          <attribute>
            <anyName/>
          </attribute>
          <text/>
          <ref name="customElement"/>
        </choice>
      </zeroOrMore>
    </element>
  </define>

  <define name="leaseUnit">
    <choice>
      <value>seconds</value>
      <value>minutes</value>
      <value>hours</value>
    </choice>
  </define>

</grammar>