<?xml version="1.0" encoding="UTF-8"?>

<xs:schema targetNamespace="http://xmlns.krupczak.org/xsd/xmptypes-1.0"
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:smi="http://xmlns.krupczak.org/xsd/xmptypes-1.0"
   elementFormDefault="qualified" attributeFormDefault="qualified">

 <xs:annotation>
   <xs:documentation>XML Schema for common types we use in XMP, XMP SMI,
    and MIB schemas.  Version $Id$
   </xs:documentation>
 </xs:annotation>

<!-- simple types -->

 <!-- 64-bit, unsigned, monotonically increasing number -->
 <xs:simpleType name="counter">
   <xs:restriction base="xs:unsignedLong"/>
 </xs:simpleType>

 <!-- 64-bit, unsigned number -->
 <xs:simpleType name="gauge">
   <xs:restriction base="xs:unsignedLong"/>
 </xs:simpleType>

 <xs:simpleType name="integer">
   <xs:restriction base="xs:long"/>
 </xs:simpleType>

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

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

 <xs:simpleType name="binaryString">
   <xs:restriction base="xs:hexBinary"/>
 </xs:simpleType>

 <xs:simpleType name="floatingPoint">
   <xs:restriction base="xs:double"/>
 </xs:simpleType>

 <xs:simpleType name="bool">
   <xs:restriction base="xs:boolean"/>
 </xs:simpleType>

 <xs:simpleType name="boolean">
   <xs:restriction base="xs:boolean"/>
 </xs:simpleType>

 <xs:simpleType name="extendedBoolean">
   <xs:restriction base="xs:string">
     <xs:pattern value="true|1|false|0|unknown-1"/>
   </xs:restriction>
 </xs:simpleType>

 <!-- ascii date/time string in format of UNIX ctime -->
 <xs:simpleType name="dateTime">
   <xs:restriction base="xs:string">
     <xs:maxLength value="26"/>
   </xs:restriction>
 </xs:simpleType>

 <xs:simpleType name="macAddress">
   <xs:restriction base="xs:string">
     <xs:pattern
   value="[0-9|a-f|A-F][0-9|a-f|A-F]:[0-9|a-f|A-F][0-9|a-f|A-F]:[0-9|a-f|A-F][0-9|a-f|A-F]:[0-9|a-f|A-F][0-9|a-f|A-F]:[0-9|a-f|A-F][0-9|a-f|A-F]:[0-9|a-f|A-F][0-9|a-f|A-F]"/>
    </xs:restriction>
 </xs:simpleType>

 <xs:simpleType name="physAddress">
   <xs:restriction base="xs:string">
     <xs:pattern
   value="[0-9|a-f|A-F][0-9|a-f|A-F]:[0-9|a-f|A-F][0-9|a-f|A-F]:[0-9|a-f|A-F][0-9|a-f|A-F]:[0-9|a-f|A-F][0-9|a-f|A-F]:[0-9|a-f|A-F][0-9|a-f|A-F]:[0-9|a-f|A-F][0-9|a-f|A-F]"/>
   </xs:restriction>
 </xs:simpleType>

 <!-- RFC 2373 format -->
 <xs:simpleType name="ipV6Address">
   <xs:restriction base="xs:string">
     <xs:pattern
 value="[0-9|a-f|A-F][0-9|a-f|A-F][0-9|a-f|A-F][0-9|a-f|A-F]:[0-9|a-f|A-F][0-9|a-f|A-F][0-9|a-f|A-F][0-9|a-f|A-F]:[0-9|a-f|A-F][0-9|a-f|A-F][0-9|a-f|A-F][0-9|a-f|A-F]:[0-9|a-f|A-F][0-9|a-f|A-F][0-9|a-f|A-F][0-9|a-f|A-F]:[0-9|a-f|A-F][0-9|a-f|A-F][0-9|a-f|A-F][0-9|a-f|A-F]:[0-9|a-f|A-F][0-9|a-f|A-F][0-9|a-f|A-F][0-9|a-f|A-F]:[0-9|a-f|A-F][0-9|a-f|A-F][0-9|a-f|A-F][0-9|a-f|A-F]:[0-9|a-f|A-F][0-9|a-f|A-F][0-9|a-f|A-F][0-9|a-f|A-F]"/>
   </xs:restriction>
 </xs:simpleType>

 <!-- syntax/value that indicates a variable is not supported -->
 <xs:simpleType name="unsupportedVariable">
   <xs:restriction base="xs:string">
     <xs:length value="0"/>
   </xs:restriction>
 </xs:simpleType>

 <!-- syntax/value indicating no value -->
 <xs:simpleType name="nullSyntax">
   <xs:restriction base="xs:string">
     <xs:length value="0"/>
   </xs:restriction>
 </xs:simpleType>

 <!-- table is a complex type; no individual MIB variable can be this type -->

  <xs:simpleType name="errorStatus">
    <xs:restriction base="xs:string">
      <xs:pattern value=
         "noError|noErrorMoreData|tooBig|noSuchName|badValue|readOnly|genError|noAccess|notTabular|wrongType|wrongLength|wrongEncoding|wrongValue|noCreation|inconsistentValue|resourceUnavailable|commitFailed|undoFailed|authorizationError|notWritable|inconsistentName|parseError"/>
    </xs:restriction>
  </xs:simpleType>

  <!-- we'd really like xmpSyntax to be a choice of our simpleTypes -->
  <xs:simpleType name="xmpSyntax">
    <xs:restriction base="xs:string">
      <xs:pattern value=
      "counter|ipV4Address|ipV6Address|dateTime|gauge|integer|unsignedInteger|bool|boolean|macAddress|physAddress|displayString|binaryString|nullSyntax|table|floatingPoint|unsupportedVariable|extendedBoolean"/>
    </xs:restriction>
  </xs:simpleType>

  <!-- table operations -->
  <xs:simpleType name="tableOperations">
    <xs:restriction base="xs:string">
      <xs:pattern value=
        "select|insert|update|delete"/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>
