xml/schema/net.xsd
2019-12-08 02:07:21 -05:00

153 lines
6.5 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema targetNamespace="http://schema.xml.r00t2.io/net.xsd"
xmlns="http://schema.xml.r00t2.io/net.xsd"
xmlns:net="http://schema.xml.r00t2.io/net.xsd"
xmlns:std="http://schema.xml.r00t2.io/std.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="qualified">
<xs:simpleType name="t_addr_ip4">
<xs:restriction base="xs:string">
<!-- This is a REALLY LAZY regex. Matching IPv4 in regex is ugly as heck, so we do that in-code.
This is just a gatekeeper. -->
<xs:pattern value="[0-9.]{7,15}"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="t_addr_ip6">
<xs:restriction base="xs:string">
<!-- This is a REALLY LAZY regex. Matching IPv6 in regex is ugly as heck, so we do that in-code.
This is just a gatekeeper. -->
<xs:pattern value="[A-Za-z0-9:]+"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="t_authselect">
<xs:restriction base="xs:token">
<xs:enumeration value="basic"/>
<xs:enumeration value="digest"/>
<xs:enumeration value="none"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="t_auto_ip6">
<xs:restriction base="xs:string">
<xs:enumeration value="slaac"/>
<xs:enumeration value="dhcp6"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="t_both_addr">
<xs:union memberTypes="net:t_addr_ip4 net:t_addr_ip6"/>
</xs:simpleType>
<xs:simpleType name="t_both_qualified_addr">
<xs:union memberTypes="net:t_qualified_addr_ip4 net:t_qualified_addr_ip6"/>
</xs:simpleType>
<xs:complexType name="t_http_resource">
<xs:simpleContent>
<xs:extension base="std:t_uri">
<xs:attribute name="user" type="std:t_nonempty" use="optional"/>
<xs:attribute name="password" type="std:t_nonempty" use="optional"/>
<xs:attribute name="realm" type="std:t_nonempty" use="optional"/>
<xs:attribute name="authtype" type="net:t_authselect" use="optional" default="none"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="t_mac_addr">
<xs:restriction base="xs:token">
<!-- EUI48[RFC7043§3] (previously MAC48[RFC7042§2.1]) -->
<xs:pattern value="([A-Fa-f0-9]{2}[:-]?){5}[A-Fa-f0-9]{2}"/>
<!-- EUI64[RFC7043§4, RFC4291§2.5.1] -->
<xs:pattern value="([A-Fa-f0-9]{2}[:-]?){3}[Ff]{3}[FfEe][:-]?([A-Fa-f0-9]{2}[:-]?){2}[A-Fa-f0-9]{2}"/>
<xs:pattern value="([A-Fa-f0-9]{2}[:-]?){3}[A-Fa-f0-9]{4}[:-]?([A-Fa-f0-9]{2}[:-]?){2}[A-Fa-f0-9]{2}"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="t_netproto">
<xs:restriction base="xs:token">
<xs:enumeration value="ipv4"/>
<xs:enumeration value="ipv6"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="t_proto">
<!-- TODO: expand? Remove gre? -->
<xs:restriction base="xs:string">
<xs:enumeration value="tcp"/>
<xs:enumeration value="udp"/>
<xs:enumeration value="icmp"/>
<xs:enumeration value="gre"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="t_qualified_addr_ip4">
<!-- This is a REALLY LAZY regex. Matching IPv4 in regex is ugly as heck, so we do that in-code.
This is just a gatekeeper. -->
<xs:restriction base="xs:string">
<xs:pattern value="[0-9.]{7,15}/[0-9]{1,2}"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="t_qualified_addr_ip6">
<!-- This is a REALLY LAZY regex. Matching IPv6 in regex is ugly as heck, so we do that in-code.
This is just a gatekeeper. -->
<xs:restriction base="xs:string">
<xs:pattern value="[A-Za-z0-9:]+/[0-9]{1,3}"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
<!-- TODO: "enterprise" WPA2 (add'l details)?
WPA3?
EAP,
eduroam (https://github.com/rst0git/netctl-eduroam-config/blob/master/eduroam), etc. -->
<!-- wep64, wep128, wpa-psk:tkip, wpa-psk:aes, wpa2-psk:tkip, wpa2-psk:aes, wpa2-psk:tkip/aes -->
<xs:complexType name="t_wifi_crypto">
<xs:all>
<xs:element name="type" minOccurs="1" maxOccurs="1" default="wpa2">
<xs:simpleType>
<xs:restriction base="xs:token">
<!-- <xs:enumeration value="wep"/> -->
<xs:enumeration value="wpa"/>
<xs:enumeration value="wpa2"/>
<!-- <xs:enumeration value="wpa3"/> -->
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Only valid for WPA/WPA2 (and maybe WPA3 once supported?) -->
<xs:element name="creds" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:choice minOccurs="1" maxOccurs="1">
<!-- "personal" -->
<xs:element name="psk">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<!-- A key can be generated via "wpa_passphrase <ssid> <passphrase>" -->
<!-- or via genPSK.py in extras/ -->
<xs:attribute name="isKey" type="xs:boolean" use="optional" default="false"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<!-- TODO -->
<!-- <xs:element name="enterprise"></xs:element> -->
</xs:choice>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:schema>