basictypes.rng 7.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
<?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>
E
Eric Blake 已提交
11 12 13 14 15
  <define name='unsignedLong'>
    <data type='unsignedLong'>
      <param name='pattern'>[0-9]+</param>
    </data>
  </define>
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

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

  <define name="uint8range">
    <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="uint24range">
    <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="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>

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
  <define name="pciaddress">
    <optional>
      <attribute name="domain">
        <ref name="pciDomain"/>
      </attribute>
    </optional>
    <attribute name="bus">
      <ref name="pciBus"/>
    </attribute>
    <attribute name="slot">
      <ref name="pciSlot"/>
    </attribute>
    <attribute name="function">
      <ref name="pciFunc"/>
    </attribute>
    <optional>
      <attribute name="multifunction">
        <choice>
          <value>on</value>
          <value>off</value>
        </choice>
      </attribute>
    </optional>
  </define>

82
  <!-- a 6 byte MAC address in ASCII-hex format, eg "12:34:56:78:9A:BC" -->
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
  <!-- 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>
98 99
  <define name="macAddr">
    <data type="string">
100
      <param name="pattern">[a-fA-F0-9]{2}(:[a-fA-F0-9]{2}){5}</param>
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
    </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 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>

145 146 147 148 149 150
  <define name="genericName">
    <data type="string">
      <param name="pattern">[a-zA-Z0-9_\+\-]+</param>
    </data>
  </define>

151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
  <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="filePath">
    <data type="string">
      <param name="pattern">[a-zA-Z0-9_\.\+\-\\&amp;&quot;&apos;&lt;&gt;/%]+</param>
    </data>
  </define>

  <define name="absFilePath">
    <data type="string">
171
      <param name="pattern">/[a-zA-Z0-9_\.\+\-\\&amp;&quot;&apos;&lt;&gt;/%,]+</param>
172 173 174 175 176 177 178 179 180
    </data>
  </define>

  <define name="absDirPath">
    <data type="string">
      <param name="pattern">/[a-zA-Z0-9_\.\+\-\\&amp;&quot;&apos;&lt;&gt;/%]*</param>
    </data>
  </define>

E
Eric Blake 已提交
181 182
  <define name='unit'>
    <data type='string'>
183
      <param name='pattern'>([bB]([yY][tT][eE][sS]?)?)|([kKmMgGtTpPeE]([iI]?[bB])?)</param>
E
Eric Blake 已提交
184 185
    </data>
  </define>
E
Eric Blake 已提交
186 187 188 189 190 191 192 193
  <define name='scaledInteger'>
    <optional>
      <attribute name='unit'>
        <ref name='unit'/>
      </attribute>
    </optional>
    <ref name='unsignedLong'/>
  </define>
E
Eric Blake 已提交
194

195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
  <define name="pciDomain">
    <data type="string">
      <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
    </data>
  </define>
  <define name="pciBus">
    <data type="string">
      <param name="pattern">(0x)?[0-9a-fA-F]{1,2}</param>
    </data>
  </define>
  <define name="pciSlot">
    <data type="string">
      <param name="pattern">(0x)?[0-1]?[0-9a-fA-F]</param>
    </data>
  </define>
  <define name="pciFunc">
    <data type="string">
      <param name="pattern">(0x)?[0-7]</param>
    </data>
  </define>

O
Osier Yang 已提交
216 217 218 219 220 221
  <define name='wwn'>
    <data type='string'>
      <param name='pattern'>[0-9a-fA-F]{16}</param>
    </data>
  </define>

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

228 229 230 231 232 233
  <define name='volName'>
    <data type='string'>
      <param name="pattern">[a-zA-Z0-9_\+\-\.]+</param>
    </data>
  </define>

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
  <define name='archnames'>
    <choice>
      <value>alpha</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>ppcemb</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>

268
</grammar>