qubes.rng 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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. <doc:metavar>
  140. true|false
  141. </doc:metavar>
  142. <data type="boolean" />
  143. </attribute>
  144. </optional>
  145. <data type="string">
  146. <param name="pattern">[a-z0-9_-]+</param>
  147. </data>
  148. </element>
  149. </oneOrMore>
  150. </element>
  151. </optional>
  152. <zeroOrMore>
  153. <element name="devices">
  154. <doc:description>
  155. Container for devices of particular class.
  156. </doc:description>
  157. <attribute name="class">
  158. <doc:description>
  159. Class of devices in this container. Currently the
  160. only supported is ``pci``.
  161. </doc:description>
  162. <!-- TODO: class can be specified only once -->
  163. <value>pci</value>
  164. <!--
  165. <data type="string">
  166. <param name="pattern">[a-z0-9]+</param>
  167. </data>
  168. -->
  169. </attribute>
  170. <oneOrMore>
  171. <element name="device">
  172. <doc:description>
  173. One device. This tag should contain some
  174. identifier, format of which depends on
  175. particular device class.
  176. </doc:description>
  177. <!-- TODO: pattern dependent on class! -->
  178. <data type="string">
  179. <param name="pattern">[0-9a-f]{2}:[0-9a-f]{2}.[0-9a-f]{2}</param>
  180. </data>
  181. </element>
  182. </oneOrMore>
  183. </element>
  184. </zeroOrMore>
  185. <optional>
  186. <element name="tags">
  187. <doc:description>
  188. Container for user-defined tags.
  189. </doc:description>
  190. <oneOrMore>
  191. <element name="tag">
  192. <doc:description>
  193. Tag value.
  194. Tags are not used anywhere by qubes core, they
  195. are for users reference. In the future they
  196. will be available for use in policies.
  197. </doc:description>
  198. <attribute name="name">
  199. <doc:description>
  200. Name of the tag.
  201. </doc:description>
  202. <data type="string">
  203. <param name="pattern">[a-z0-9_-]+</param>
  204. </data>
  205. </attribute>
  206. <data type="string" />
  207. </element>
  208. </oneOrMore>
  209. </element>
  210. </optional>
  211. <!-- TODO: policy, incl. firewall -->
  212. </element>
  213. </define>
  214. <define name="properties">
  215. <element name="properties">
  216. <doc:description>
  217. Container for properties.
  218. </doc:description>
  219. <zeroOrMore>
  220. <element name="property">
  221. <doc:description>
  222. One property and its value specified either directly
  223. (as text contained in this tag) or as reference to
  224. another XML element in the tree (by ``ref=``
  225. attribute). How it is saved, it depends on particular
  226. property.
  227. </doc:description>
  228. <attribute name="name">
  229. <doc:description>
  230. Property name.
  231. </doc:description>
  232. <data type="string">
  233. <param name="pattern">[a-z0-9_]+</param>
  234. </data>
  235. </attribute>
  236. <choice>
  237. <attribute name="ref">
  238. <doc:description>
  239. Alternative property value, by reference to another XML element.
  240. </doc:description>
  241. <!-- TODO: IDREF (Schematron?) -->
  242. <data type="string" />
  243. </attribute>
  244. <data type="string" />
  245. </choice>
  246. </element>
  247. </zeroOrMore>
  248. </element>
  249. </define>
  250. </grammar>
  251. <!--
  252. vim: ts=4 sw=4 et
  253. -->