<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright (c) 2000-2021 Ericsson Telecom AB
 All rights reserved. This program and the accompanying materials
 are made available under the terms of the Eclipse Public License v2.0
 which accompanies this distribution, and is available at
 https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html

 Contributors:
  Balasko, Jeno
  Raduly, Csaba
-->
<xs:schema targetNamespace="http://tail-f.com/ns/confd/1.0"
	   xmlns="http://tail-f.com/ns/confd/1.0"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xml:lang="en">
  <xs:import namespace="http://www.w3.org/2001/XMLSchema"
	     schemaLocation="XMLSchema.xsd"/>

  <xs:simpleType name="inetAddress">
    <xs:union memberTypes="inetAddressIP inetAddressDNS"/>
  </xs:simpleType>

  <xs:simpleType name="inetAddressIP">
    <xs:union memberTypes="inetAddressIPv4 inetAddressIPv6"/>
  </xs:simpleType>

  <xs:simpleType name="inetAddressIPv4">
    <xs:restriction base="xs:string">
      <xs:minLength value="7"/>
      <xs:maxLength value="15"/>
      <xs:pattern value="(([0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){1,3}([0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])"/>

    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="inetAddressIPv6">
    <xs:restriction base="xs:string">
      <xs:minLength value="0"/>
      <xs:maxLength value="39"/>
      <!-- Full -->
      <xs:pattern value="(([0-9a-fA-F]{1,4}:){7})([0-9a-fA-F]{1,4})"/>
      <!-- Mixed -->
      <xs:pattern value="(([0-9a-fA-F]{1,4}:){6})(([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))"/>
      <!-- Shortened -->
      <xs:pattern value="(([0-9a-fA-F]{1,4}:)*([0-9a-fA-F]{1,4}))*(::)(([0-9a-fA-F]{1,4}:)*([0-9a-fA-F]{1,4}))*"/>
      <!-- Shortened mixed -->
      <xs:pattern value="(([0-9a-fA-F]{1,4}:)*([0-9a-fA-F]{1,4}))*(::)(([0-9a-fA-F]{1,4}:)*([0-9a-fA-F]{1,4}))*(([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="inetAddressDNS">
    <xs:restriction base="xs:string"/>
  </xs:simpleType>
  
  <xs:simpleType name="inetPortNumber">
    <xs:restriction base="xs:unsignedShort"/>
  </xs:simpleType>

  <xs:simpleType name="size">
    <xs:restriction base="xs:string">
      <xs:pattern value="S([0-9]+G)?([0-9]+M)?([0-9]+K)?([0-9]+B)?"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="MD5DigestString">
    <xs:restriction base="xs:string"/>
  </xs:simpleType>

  <xs:simpleType name="DES3CBCEncryptedString">
    <xs:restriction base="xs:string"/>
  </xs:simpleType>

  <xs:simpleType name="AESCFB128EncryptedString">
    <xs:restriction base="xs:string"/>
  </xs:simpleType>

  <xs:simpleType name="atom">
    <xs:restriction base="xs:string"/>
  </xs:simpleType>

  <xs:simpleType name="hexValue">
    <xs:restriction base="xs:string">
      <xs:pattern value="[0-9a-fA-F]*"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="hexList">
    <xs:restriction base="xs:string">
      <xs:pattern value="([0-9a-fA-F][0-9a-fA-F]:)*([0-9a-fA-F][0-9a-fA-F])"/>
      <xs:pattern value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="octetList">
    <xs:restriction base="xs:string">
      <xs:pattern value="(([0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.)*([0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="oid">
    <xs:restriction base="xs:string">
      <xs:pattern value="(([0-9]?[0-9]*)\.)*([0-9]?[0-9]*)?"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="objectRef">
    <xs:restriction base="xs:string">
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="Counter32">
    <xs:restriction base="xs:unsignedInt">
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="Counter64">
    <xs:restriction base="xs:unsignedLong">
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="Gauge32">
    <xs:restriction base="xs:unsignedInt">
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="ipPrefix">

    <xs:union>
    <xs:simpleType>
      <xs:restriction base="ipv4Prefix">
      </xs:restriction>
    </xs:simpleType>
    <xs:simpleType>
      <xs:restriction base="ipv6Prefix">
      </xs:restriction>
    </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="ipv4Prefix">

    <xs:restriction base="xs:string">
      <xs:pattern value="(([0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])/\p{N}+"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="ipv6Prefix">

    <xs:restriction base="xs:string">
      <xs:pattern value="((([0-9a-fA-F]{1,4}:){7})([0-9a-fA-F]{1,4})/\p{N}+)|((([0-9a-fA-F]{1,4}:){6})(([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))/\p{N}+)|((([0-9a-fA-F]{1,4}:)*([0-9a-fA-F]{1,4}))*(::)(([0-9a-fA-F]{1,4}:)*([0-9a-fA-F]{1,4}))*/\p{N}+)((([0-9a-fA-F]{1,4}:)*([0-9a-fA-F]{1,4}))*(::)(([0-9a-fA-F]{1,4}:)*([0-9a-fA-F]{1,4}))*(([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))/\p{N}+)"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:attribute name="default" type="xs:anySimpleType">
  </xs:attribute>

  <xs:attribute name="config" type="xs:boolean">
  </xs:attribute>

  <xs:element name="errorMessage">
    <xs:simpleType>
      <xs:restriction base="xs:string"/>
    </xs:simpleType>
  </xs:element>
</xs:schema>
