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

<xs:schema targetNamespace="http://xmlns.krupczak.org/xsd/xmptypes-2.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-2.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$
    Fri Oct 26 13:41:16 EDT 2012
   </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:enumeration value="true"/>
     <xs:enumeration value="1"/>
     <xs:enumeration value="false"/>
     <xs:enumeration value="0"/>
     <xs:enumeration value="unknown"/>
     <xs:enumeration value="-1"/>
     <xs:enumeration value="2"/>
   </xs:restriction>
</xs:simpleType>

<!-- ascii date/time string in format of UNIX ctime or unix date -->
<xs:simpleType name="dateTime">
   <xs:restriction base="xs:string">
     <xs:maxLength value="28"/>
   </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>

<!-- plain old IPv4 address -->
<xs:simpleType name="ipV4Address">
   <xs:restriction base="xs:string">
      <xs:pattern value="((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])"/>
    </xs:restriction>
</xs:simpleType>

<!-- either/or IPv4 or IPv6 -->
<xs:simpleType name="ipAddress">
 <xs:union memberTypes="smi:ipV4Address smi:ipV6Address"/>
</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:enumeration value="noError"/>
      <xs:enumeration value="noErrorMoreData"/>
      <xs:enumeration value="tooBig"/>
      <xs:enumeration value="noSuchName"/>
      <xs:enumeration value="badValue"/>
      <xs:enumeration value="readOnly"/>
      <xs:enumeration value="genError"/>
      <xs:enumeration value="noAccess"/>
      <xs:enumeration value="notTabular"/>
      <xs:enumeration value="wrongType"/>
      <xs:enumeration value="wrongLength"/>
      <xs:enumeration value="wrongEncoding"/>
      <xs:enumeration value="wrongValue"/>
      <xs:enumeration value="noCreation"/>
      <xs:enumeration value="inconsistentValue"/>
      <xs:enumeration value="resourceUnavailable"/>
      <xs:enumeration value="commitFailed"/>
      <xs:enumeration value="undoFailed"/>
      <xs:enumeration value="authorizationError"/>
      <xs:enumeration value="notWritable"/>
      <xs:enumeration value="inconsistentName"/>
      <xs:enumeration value="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:enumeration value="counter"/>
      <xs:enumeration value="ipAddress"/>
      <xs:enumeration value="ipV4Address"/>
      <xs:enumeration value="ipV6Address"/>
      <xs:enumeration value="dateTime"/>
      <xs:enumeration value="gauge"/>
      <xs:enumeration value="integer"/>
      <xs:enumeration value="unsignedInteger"/>
      <xs:enumeration value="bool"/>
      <xs:enumeration value="boolean"/>
      <xs:enumeration value="macAddress"/>
      <xs:enumeration value="physAddress"/>
      <xs:enumeration value="displayString"/>
      <xs:enumeration value="binaryString"/>
      <xs:enumeration value="nullSyntax"/>
      <xs:enumeration value="table"/>
      <xs:enumeration value="floatingPoint"/>
      <xs:enumeration value="unsupportedVariable"/>
      <xs:enumeration value="extendedBoolean"/>
      <xs:enumeration value="coreModuleType"/>
      <xs:enumeration value="dependencySrcType"/>
      <xs:enumeration value="dependencyTypeType"/>
      <xs:enumeration value="dependencyReferenceType"/>
    </xs:restriction>
</xs:simpleType>

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

<xs:simpleType name="tableOperationsList">
  <xs:list itemType="smi:tableOperations"/>
</xs:simpleType>

<!-- scalar operations -->
<xs:simpleType name="scalarOperations">
   <xs:restriction base="xs:string">
     <xs:enumeration value="get"/>
     <xs:enumeration value="set"/>
   </xs:restriction>
</xs:simpleType>

<xs:simpleType name="scalarOperationsList">
   <xs:list itemType="smi:scalarOperations"/>
</xs:simpleType>

<!-- core MIB module type -->
<xs:simpleType name="coreModuleType">
  <xs:restriction base="xs:integer">
    <xs:enumeration value="1"/> <!-- agentModule -->
    <xs:enumeration value="2"/> <!-- pluginModule -->
    <xs:enumeration value="3"/> <!-- libModule -->
    <xs:enumeration value="4"/> <!-- dataModule -->
    <xs:enumeration value="5"/> <!-- binModule -->
  </xs:restriction>
</xs:simpleType>

<!-- dependency type type -->
<xs:simpleType name="dependencyTypeType">
  <xs:restriction base="xs:integer">
   <xs:enumeration value="1"/> <!-- other -->
   <xs:enumeration value="2"/> <!-- Remote filesys -->
   <xs:enumeration value="3"/> <!-- DNS --> 
   <xs:enumeration value="4"/> <!-- NTP --> 
   <xs:enumeration value="5"/> <!-- SMTP, IMAP, POP, email--> 
   <xs:enumeration value="6"/> <!-- Directory services-->
   <xs:enumeration value="7"/> <!-- Radius -->
   <xs:enumeration value="8"/> <!-- printer --> 
   <xs:enumeration value="9"/> <!-- X11 and other remote desktop -->
   <xs:enumeration value="10"/> <!-- Login, telnet, rlogin, ssh --> 
   <xs:enumeration value="11"/> <!-- Web, proxy, etc.-->
   <xs:enumeration value="12"/> <!-- NNTP -->
   <xs:enumeration value="13"/> <!-- DHCP -->
   <xs:enumeration value="14"/> <!-- Database (Oracle, SQLserver, MySQL -->
   <xs:enumeration value="15"/> <!-- Routing -->
   <xs:enumeration value="16"/> <!-- FTP --> 
   <xs:enumeration value="17"/> <!-- Streaming audio/video -->
   <xs:enumeration value="18"/> <!-- NetBIOS -->
   <xs:enumeration value="19"/> <!-- Citrix and/or TerminalServer -->
   <xs:enumeration value="20"/> <!-- Lotus Notes -->
   <xs:enumeration value="21"/> <!-- NetWare client/servver --> 
   <xs:enumeration value="22"/> <!-- MQseries and message passing -->
   <xs:enumeration value="23"/> <!-- P2P -->
   <xs:enumeration value="24"/> <!-- middleware dependency --> 
   <xs:enumeration value="25"/> <!-- RCS, CVS, SVN, revision control -->
   <xs:enumeration value="26"/> <!-- RPC -->
   <xs:enumeration value="27"/> <!-- SIP -->
   <xs:enumeration value="28"/> <!-- VNC -->
   <xs:enumeration value="29"/> <!-- IAX -->
   <xs:enumeration value="30"/> <!-- VPN -->
   <xs:enumeration value="31"/> <!-- guest to host vm dependency -->
 </xs:restriction>
</xs:simpleType>

<xs:simpleType name="dependencyStringType">
  <xs:restriction base="xs:string">
   <xs:enumeration value="dependOther"/>
   <xs:enumeration value="dependFilesys"/>
   <xs:enumeration value="dependDNS"/>
   <xs:enumeration value="dependNTP"/>
   <xs:enumeration value="dependEmail"/>
   <xs:enumeration value="dependDir"/>
   <xs:enumeration value="dependRadius"/>
   <xs:enumeration value="dependPrinter"/>
   <xs:enumeration value="dependX11"/>
   <xs:enumeration value="dependLogin"/>
   <xs:enumeration value="dependWeb"/>
   <xs:enumeration value="dependNNTP"/>
   <xs:enumeration value="dependDHCP"/>
   <xs:enumeration value="dependDB"/>
   <xs:enumeration value="dependRouter"/>
   <xs:enumeration value="dependFTP"/>
   <xs:enumeration value="dependStreaming"/>
   <xs:enumeration value="dependNetBIOS"/>
   <xs:enumeration value="dependCitrix"/>
   <xs:enumeration value="dependLotus"/>
   <xs:enumeration value="dependNetware"/>
   <xs:enumeration value="dependMQseries"/>
   <xs:enumeration value="dependP2P"/>
   <xs:enumeration value="dependMiddleware"/>
   <xs:enumeration value="dependRCS"/>
   <xs:enumeration value="dependRPC"/>
   <xs:enumeration value="dependSIP"/>
   <xs:enumeration value="dependVNC"/>
   <xs:enumeration value="dependIAX"/>
   <xs:enumeration value="dependVPN"/>
   <xs:enumeration value="dependVM"/>
  </xs:restriction>
</xs:simpleType>

<!-- dependency src type -->
<xs:simpleType name="dependencySrcType">
  <xs:restriction base="xs:integer">
   <xs:enumeration value="1"/> <!-- unknown -->
   <xs:enumeration value="2"/> <!-- via os/app configuration -->
   <xs:enumeration value="3"/> <!-- dynamic -->
   <xs:enumeration value="4"/> <!-- static, hardcoded -->
   <xs:enumeration value="5"/> <!-- logfile scanning -->
  </xs:restriction>
</xs:simpleType>

<!-- dependency reference type -->
<xs:simpleType name="dependencyReferenceType">
  <xs:restriction base="xs:integer">
   <xs:enumeration value="0"/> <!-- outbound -->
   <xs:enumeration value="1"/> <!-- inbound -->
   <xs:enumeration value="2"/> <!-- transit; system is neither client nor server-->
  </xs:restriction>
</xs:simpleType>

<xs:simpleType name="dependencyReferenceStringType">
  <xs:restriction base="xs:string">
    <xs:enumeration value="dependOutbound"/>
    <xs:enumeration value="dependInbound"/>
    <xs:enumeration value="dependTransit"/>
    <xs:enumeration value="0"/>
    <xs:enumeration value="1"/>
    <xs:enumeration value="2"/>
  </xs:restriction>
</xs:simpleType>

<!-- MIB specifications -->

<xs:complexType name="mibObjectType">
  <xs:sequence>
    <xs:element name="objectName" type="xs:string"/>
    <xs:element name="objectSyntax" type="smi:xmpSyntax"/>
    <xs:element name="objectDescription" type="xs:string"/>
    <xs:element name="objectAccess" type="smi:scalarOperationsList"/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="tableObjectType">
  <xs:sequence>
    <xs:element name="tableName" type="xs:string"/>
    <xs:element name="tableDescription" type="xs:string"/>
    <xs:element name="tableOps" type="smi:tableOperationsList"/>
    <xs:element name="tableKey" type="xs:string"/>
    <xs:choice minOccurs="1" maxOccurs="unbounded">
      <xs:element name="columnObject" type="smi:mibObjectType"/>
    </xs:choice>
  </xs:sequence>
</xs:complexType>

<xs:element name="xmpMIB">
  <xs:annotation>
    <xs:documentation>
     Top-level element for an XMP MIB spec.  A MIB is a sequence of 
     description info and then one or MIB objects.  MIB objects can 
     be scalar or tabular.
    </xs:documentation>
  </xs:annotation>

 <xs:complexType>
  <xs:sequence>
   <xs:element name="mibName" type="xs:string"/>
   <xs:element name="mibOrganization" type="xs:string"/>
   <xs:element name="mibDescription" type="xs:string"/>
   <xs:element name="mibContactInfo" type="xs:string"/>
   <xs:element name="mibLastUpdate" type="smi:dateTime"/>
   <xs:choice minOccurs="1" maxOccurs="unbounded">
     <xs:element name="mibObject" type="smi:mibObjectType"/>
     <xs:element name="tableObject" type="smi:tableObjectType"/>
   </xs:choice>
  </xs:sequence>
 </xs:complexType>
</xs:element>

</xs:schema>
