qubes.rng 11 KB

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