blob: e17971210bdedfe726203bd0545a2b078e72e334 [file] [log] [blame]
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
xmlns:cotp="http://plc4x.apache.org/cotp"
targetNamespace="http://plc4x.apache.org/cotp">
<xs:annotation>
<xs:appinfo source="http://www.ogf.org/dfdl/">
<dfdl:defineVariable name="messageType" type="xs:string"/>
<dfdl:format representation="binary"
binaryNumberRep="binary"
byteOrder="bigEndian"
lengthKind="implicit" lengthUnits="bytes" length="0"
occursCountKind="implicit"
textOutputMinLength="0"
alignment="1" alignmentUnits="bits"
leadingSkip="0" trailingSkip="0"
textPadKind="none" ignoreCase="no"
encoding="utf-8" truncateSpecifiedLengthString="no"
initiator="" terminator=""
sequenceKind="ordered" separator=""
escapeSchemeRef="" initiatedContent="no"/>
</xs:appinfo>
</xs:annotation>
<!--
Simple type definition.
-->
<xs:simpleType name="byte" dfdl:lengthUnits="bytes" dfdl:length="1" dfdl:lengthKind="explicit">
<xs:restriction base="xs:unsignedByte"/>
</xs:simpleType>
<xs:simpleType name="short" dfdl:lengthUnits="bytes" dfdl:length="2" dfdl:lengthKind="explicit">
<xs:restriction base="xs:unsignedShort"/>
</xs:simpleType>
<!--
ISO 8073/X.224 - ISO-TP - COTP - Connection-Oriented Transport Protocol Messages
-->
<xs:element name="CotpTPDU">
<xs:complexType>
<xs:sequence>
<!-- Length of the COTP header data -->
<xs:element name="headerLength" type="cotp:byte"/>
<xs:element name="type" type="cotp:byte"/>
<xs:choice dfdl:choiceDispatchKey="{type}">
<xs:element dfdl:choiceBranchKey="224" ref="cotp:CotpTpduConnectionRequest"/>
<xs:element dfdl:choiceBranchKey="208" ref="cotp:CotpTpduConnectionResponse"/>
<xs:element dfdl:choiceBranchKey="128" ref="cotp:CotpTpduDisconnectRequest"/>
<xs:element dfdl:choiceBranchKey="192" ref="cotp:CotpTpduDisconnectResponse"/>
<xs:element dfdl:choiceBranchKey="112" ref="cotp:CotpTpduError"/>
<xs:element dfdl:choiceBranchKey="240" ref="cotp:CotpTpduData"/>
</xs:choice>
<!-- TODO: add the entire rest of the input to the user-data -->
<xs:element name="userData" type="xs:hexBinary"
dfdl:byteOrder="bigEndian" dfdl:lengthUnits="bytes" dfdl:lengthKind="explicit"
dfdl:length="{totalInputSize - (2 + 1 + ../headerLength}"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CotpTpduConnectionRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="destinationReference" type="cotp:short"/>
<xs:element name="sourceReference" type="cotp:short"/>
<xs:element name="protocolClass" type="cotp:byte"/>
<xs:element ref="cotp:parameters"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CotpTpduConnectionResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="destinationReference" type="cotp:short"/>
<xs:element name="sourceReference" type="cotp:short"/>
<xs:element name="protocolClass" type="cotp:byte"/>
<xs:element ref="cotp:parameters"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CotpTpduDisconnectRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="destinationReference" type="cotp:short"/>
<xs:element name="sourceReference" type="cotp:short"/>
<xs:element name="disconnectReason" type="cotp:byte"/>
<xs:element ref="cotp:parameters"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CotpTpduDisconnectResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="destinationReference" type="cotp:short"/>
<xs:element name="sourceReference" type="cotp:short"/>
<xs:element ref="cotp:parameters"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CotpTpduError">
<xs:complexType>
<xs:sequence>
<xs:element name="destinationReference" type="cotp:short"/>
<xs:element name="rejectCause" type="cotp:byte"/>
<xs:element ref="cotp:parameters"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CotpTpduData">
<xs:complexType>
<xs:sequence>
<xs:element name="endOfTransmission" type="xs:unsignedInt"
dfdl:lengthKind="explicit" dfdl:lengthUnits="bits" dfdl:length="1"/>
<xs:element name="tpduRef" type="xs:unsignedInt"
dfdl:lengthKind="explicit" dfdl:lengthUnits="bits" dfdl:length="7"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="parameters">
<xs:complexType>
<xs:sequence>
<xs:element name="parameter">
<xs:complexType>
<xs:sequence>
<xs:element name="type" type="cotp:byte"/>
<xs:element name="parameterLength" type="cotp:byte"/>
<xs:choice dfdl:choiceDispatchKey="{type}">
<xs:element dfdl:choiceBranchKey="192" ref="cotp:CotpParameterTpduSize"/>
<xs:element dfdl:choiceBranchKey="193" ref="cotp:CotpParameterCallingTsap"/>
<xs:element dfdl:choiceBranchKey="194" ref="cotp:CotpParameterCalledTsap"/>
<xs:element dfdl:choiceBranchKey="195" ref="cotp:CotpParameterChecksum"/>
<xs:element dfdl:choiceBranchKey="224" ref="cotp:CotpParameterDisconnectAdditionalInformation"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CotpParameterTpduSize">
<xs:complexType>
<xs:sequence>
<xs:element name="tpduSize" type="cotp:byte"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CotpParameterCallingTsap">
<xs:complexType>
<xs:sequence>
<xs:element name="tsapId" type="cotp:short"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CotpParameterCalledTsap">
<xs:complexType>
<xs:sequence>
<xs:element name="tsapId" type="cotp:short"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CotpParameterChecksum">
<xs:complexType>
<xs:sequence>
<xs:element name="tsapId" type="cotp:byte"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CotpParameterDisconnectAdditionalInformation">
<xs:complexType>
<xs:sequence>
<xs:element name="data" type="xs:hexBinary"
dfdl:byteOrder="bigEndian" dfdl:lengthUnits="bytes" dfdl:lengthKind="explicit"
dfdl:length="{../../../parameterLength}"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>