xml/schema/aif.xsd
2019-12-08 01:42:33 -05:00

248 lines
13 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema targetNamespace="http://schema.xml.r00t2.io/aif.xsd"
xmlns="http://schema.xml.r00t2.io/aif.xsd"
xmlns:aif="http://schema.xml.r00t2.io/aif.xsd"
xmlns:linux="http://schema.xml.r00t2.io/linux.xsd"
xmlns:net="http://schema.xml.r00t2.io/net.xsd"
xmlns:std="http://schema.xml.r00t2.io/std.xsd"
xmlns:sys="http://schema.xml.r00t2.io/sys.xsd"
xmlns:unix="http://schema.xml.r00t2.io/unix.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="qualified">
<xs:simpleType name="t_disksize">
<xs:restriction base="xs:string">
<xs:pattern value="[-|+]?\s*([0-9]+)\s*(%|((k|Ki)|[MGTPEZY]i?)?B?|)\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="t_iface_name">
<xs:union memberTypes="linux:t_iface_name">
<xs:simpleType>
<xs:restriction>
<xs:enumeration value="auto"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:simpleType name="t_auto_ip6">
<xs:union memberTypes="net:t_auto_ip6">
<xs:simpleType>
<xs:restriction>
<xs:enumeration value="false"/>
<xs:enumeration value="none"/>
<xs:enumeration value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:simpleType name="t_netproto">
<xs:union memberTypes="net:t_netproto">
<xs:simpleType>
<xs:restriction>
<xs:enumeration value="both"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:simpleType name="t_dhcp_clients">
<!-- Only valid for netctl. AIF-NG uses the internal daemons for systemd-networkd and NM. -->
<xs:restriction base="xs:string">
<xs:enumeration value="dhcpcd"/>
<xs:enumeration value="dhclient"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="t_netprov">
<xs:restriction base="xs:token">
<xs:enumeration value="netctl"/>
<xs:enumeration value="nm"/>
<xs:enumeration value="networkd"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="t_iface">
<xs:sequence>
<xs:choice maxOccurs="unbounded">
<xs:element name="addresses" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="ipv4">
<xs:complexType>
<xs:sequence>
<xs:element name="address" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="net:t_qualified_addr_ip4">
<xs:attribute name="gateway"
type="net:t_addr_ip4"
use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="auto" type="xs:boolean" use="optional" default="true"/>
</xs:complexType>
<xs:unique name="uniq_ipv4_addr">
<xs:selector xpath="aif:address"/>
<xs:field xpath="."/>
</xs:unique>
</xs:element>
<xs:element name="ipv6">
<xs:complexType>
<xs:sequence>
<xs:element name="address" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="net:t_qualified_addr_ip6">
<xs:attribute name="gateway"
type="net:t_addr_ip6"
use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="auto" type="aif:t_auto_ip6"
use="optional" default="slaac"/>
</xs:complexType>
<xs:unique name="uniq_ipv6_addr">
<xs:selector xpath="aif:address"/>
<xs:field xpath="."/>
</xs:unique>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="resolvers" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="resolver" minOccurs="1" maxOccurs="unbounded"
type="net:t_both_addr"/>
<xs:element name="ipv4" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="auto" type="xs:boolean"
use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="ipv6" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="auto" type="xs:boolean"
use="required"/>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="routes" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="ipv4">
<xs:complexType>
<xs:sequence>
<xs:element name="route" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="net:t_qualified_addr_ip4">
<xs:attribute name="gateway"
type="net:t_addr_ip4"
use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="auto" type="xs:boolean" use="optional" default="true"/>
</xs:complexType>
<xs:unique name="uniq_ipv4_route">
<xs:selector xpath="aif:route"/>
<xs:field xpath="."/>
</xs:unique>
</xs:element>
<xs:element name="ipv6">
<xs:complexType>
<xs:sequence>
<xs:element name="address" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="net:t_qualified_addr_ip6">
<xs:attribute name="gateway"
type="net:t_addr_ip6"
use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<!-- DHCPv6 does not have an option to send routes,
so you need to use RAs. -->
<!-- See https://www.isc.org/blogs/routing-configuration-over-dhcpv6-2/
for more information. -->
<!-- https://datatracker.ietf.org/doc/draft-ietf-mif-dhcpv6-route-option/
expired. Shame, that. -->
<xs:attribute name="auto" type="xs:boolean" use="optional" default="true"/>
</xs:complexType>
<xs:unique name="uniq_ipv6_route">
<xs:selector xpath="aif:route"/>
<xs:field xpath="."/>
</xs:unique>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="device" type="aif:t_iface_name" use="required"/>
<xs:attribute name="defroute" type="xs:boolean" use="optional" default="false"/>
<xs:attribute name="searchDomain" type="std:t_nonempty" use="optional"/>
</xs:complexType>
<xs:complexType name="t_iface_wifi">
<xs:complexContent>
<xs:extension base="aif:t_iface">
<xs:sequence>
<xs:element name="encryption" type="net:t_wifi_crypto" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<!-- TODO: SSID needs to support unicode chars in both XML(/XSD type=?) and program -->
<xs:attribute name="essid" type="xs:string" use="required"/>
<xs:attribute name="bssid" type="net:t_mac_addr" use="optional"/>
<xs:attribute name="hidden" type="xs:boolean" use="optional" default="false"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:simpleType name="t_pacuri">
<!-- xs:anyURI is too permissive. -->
<!-- <xs:restriction base="xs:anyURI"> -->
<xs:restriction base="xs:token">
<xs:pattern value="(file|https?)://.+"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="t_passwd_hashtypes_detect">
<xs:union memberTypes="linux:t_passwd_hashtypes">
<xs:simpleType>
<xs:restriction>
<xs:enumeration value="(detect)"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
</xs:schema>