qubes.rng 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!--
  3. The Qubes OS Project, http://www.qubes-os.org
  4. Copyright (C) 2015 Wojtek Porczyk <woju@invisiblethingslab.com>
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, see <https://www.gnu.org/licenses/>.
  15. -->
  16. <!--
  17. This is main specification of qubes.xml in RelaxNG. It should not <include> any
  18. other file. If you need to extract some part of specification, just put the part
  19. in question in separate <define> and create small boilerplate schema like this:
  20. <?xml version="1.0" encoding="utf-8" ?>
  21. <grammar xmlns="http://relaxng.org/ns/structure/1.0">
  22. <include href="qubes.rng">
  23. <start>
  24. <ref name="domain" />
  25. </start>
  26. </include>
  27. </grammar>
  28. Don't forget to put <start> *inside* the <include>. If you'd put it outside,
  29. the parser will complain about missing combine= attribute on the second <start>.
  30. -->
  31. <grammar xmlns="http://relaxng.org/ns/structure/1.0"
  32. xmlns:q="http://qubes-os.org/qubes/3"
  33. xmlns:doc="http://qubes-os.org/qubes-doc/1"
  34. datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  35. <start>
  36. <element name="qubes">
  37. <doc:description>
  38. This is root element of whole qubes tree.
  39. </doc:description>
  40. <attribute name="version">
  41. <doc:description>
  42. Specifies minimal Qubes OS version.
  43. </doc:description>
  44. <value>3.0</value>
  45. <!--
  46. <data type="decimal">
  47. <param name="fractionDigits">1</param>
  48. <param name="minInclusive">0</param>
  49. </data>
  50. -->
  51. </attribute>
  52. <ref name="properties" />
  53. <element name="labels">
  54. <doc:description>
  55. Container for labels.
  56. </doc:description>
  57. <oneOrMore>
  58. <element name="label">
  59. <doc:description>
  60. Label which can be used by domain. One choice of
  61. colour for padlock icon.
  62. </doc:description>
  63. <attribute name="id">
  64. <doc:description>
  65. XML id attribute used for cross-referencing in
  66. properties' ``ref`` attribute.
  67. </doc:description>
  68. <!-- TODO this should be "label-" + name -->
  69. <data type="string">
  70. <param name="pattern">label-[0-9]+</param>
  71. </data>
  72. </attribute>
  73. <optional>
  74. <attribute name="color">
  75. <doc:description>
  76. Label's colour, HTML-like.
  77. </doc:description>
  78. <data type="string">
  79. <param name="pattern">#[0-9a-f]{6}</param>
  80. </data>
  81. </attribute>
  82. </optional>
  83. <data type="string">
  84. <param name="pattern">[a-z0-9_-]+</param>
  85. </data>
  86. </element>
  87. </oneOrMore>
  88. </element>
  89. <element name="domains">
  90. <doc:description>
  91. Container for domains.
  92. </doc:description>
  93. <zeroOrMore>
  94. <ref name="domain" />
  95. </zeroOrMore>
  96. </element>
  97. </element>
  98. </start>
  99. <define name="domain">
  100. <element name="domain">
  101. <doc:description>
  102. One Qubes domain.
  103. </doc:description>
  104. <attribute name="class">
  105. <doc:description>
  106. Type of the domain. This specifies Python's class that is
  107. used for instantiation of this VM.
  108. </doc:description>
  109. <data type="string" />
  110. </attribute>
  111. <attribute name="id">
  112. <doc:description>
  113. XML id attribute used for cross-referencing in properties'
  114. ``ref`` attribute.
  115. <!-- TODO this should be "domain-" + domain's name -->
  116. </doc:description>
  117. <data type="string">
  118. <param name="pattern">domain-[0-9]+</param>
  119. </data>
  120. </attribute>
  121. <ref name="properties" />
  122. <optional>
  123. <element name="features">
  124. <doc:description>
  125. Container for features.
  126. </doc:description>
  127. <oneOrMore>
  128. <element name="feature">
  129. <doc:description>
  130. One feature of this domain.
  131. </doc:description>
  132. <attribute name="name">
  133. <doc:description>
  134. Name of the feature.
  135. </doc:description>
  136. <data type="string">
  137. <param name="pattern">[a-z0-9_-]+</param>
  138. </data>
  139. </attribute>
  140. <data type="string">
  141. <param name="pattern">[a-z0-9_-]*</param>
  142. </data>
  143. </element>
  144. </oneOrMore>
  145. </element>
  146. </optional>
  147. <zeroOrMore>
  148. <element name="devices">
  149. <doc:description>
  150. Container for devices of particular class.
  151. </doc:description>
  152. <attribute name="class">
  153. <doc:description>
  154. Class of devices in this container. Currently the
  155. only supported is ``pci``.
  156. </doc:description>
  157. <!-- TODO: class can be specified only once -->
  158. <value>pci</value>
  159. <!--
  160. <data type="string">
  161. <param name="pattern">[a-z0-9]+</param>
  162. </data>
  163. -->
  164. </attribute>
  165. <oneOrMore>
  166. <element name="device">
  167. <doc:description>
  168. One device. It's identified by by a pair of
  169. backend domain and some identifier (device class
  170. dependant).
  171. </doc:description>
  172. <attribute name="backend-domain">
  173. <doc:description>
  174. Backend domain name.
  175. </doc:description>
  176. <data type="string">
  177. <param name="pattern">[a-z0-9_]+</param>
  178. </data>
  179. </attribute>
  180. <attribute name="id">
  181. <!-- TODO: pattern dependent on class! -->
  182. <data type="string">
  183. <param name="pattern">[0-9a-f]{2}_[0-9a-f]{2}.[0-9a-f]{2}</param>
  184. </data>
  185. </attribute>
  186. <zeroOrMore>
  187. <element name="option">
  188. <doc:description>
  189. Options
  190. </doc:description>
  191. <attribute name="name">
  192. <doc:description>
  193. Option name.
  194. </doc:description>
  195. <data type="string">
  196. <param name="pattern">[a-z0-9_-]+</param>
  197. </data>
  198. </attribute>
  199. <data type="string">
  200. </data>
  201. </element>
  202. </zeroOrMore>
  203. </element>
  204. </oneOrMore>
  205. </element>
  206. </zeroOrMore>
  207. <optional>
  208. <element name="tags">
  209. <doc:description>
  210. Container for user-defined tags.
  211. </doc:description>
  212. <oneOrMore>
  213. <element name="tag">
  214. <doc:description>
  215. Tag value.
  216. Tags are not used anywhere by qubes core, they
  217. are for users reference. In the future they
  218. will be available for use in policies.
  219. </doc:description>
  220. <attribute name="name">
  221. <doc:description>
  222. Name of the tag.
  223. </doc:description>
  224. <data type="string">
  225. <param name="pattern">[a-z0-9_-]+</param>
  226. </data>
  227. </attribute>
  228. <data type="string" />
  229. </element>
  230. </oneOrMore>
  231. </element>
  232. </optional>
  233. <!-- TODO: policy, incl. firewall -->
  234. </element>
  235. </define>
  236. <define name="properties">
  237. <element name="properties">
  238. <doc:description>
  239. Container for properties.
  240. </doc:description>
  241. <zeroOrMore>
  242. <element name="property">
  243. <doc:description>
  244. One property and its value specified either directly
  245. (as text contained in this tag) or as reference to
  246. another XML element in the tree (by ``ref=``
  247. attribute). How it is saved, it depends on particular
  248. property.
  249. </doc:description>
  250. <attribute name="name">
  251. <doc:description>
  252. Property name.
  253. </doc:description>
  254. <data type="string">
  255. <param name="pattern">[a-z0-9_]+</param>
  256. </data>
  257. </attribute>
  258. <choice>
  259. <attribute name="ref">
  260. <doc:description>
  261. Alternative property value, by reference to another XML element.
  262. </doc:description>
  263. <!-- TODO: IDREF (Schematron?) -->
  264. <data type="string" />
  265. </attribute>
  266. <data type="string" />
  267. </choice>
  268. </element>
  269. </zeroOrMore>
  270. </element>
  271. </define>
  272. </grammar>
  273. <!--
  274. vim: ts=4 sw=4 et
  275. -->