You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2019/01/16 20:48:55 UTC
[incubator-plc4x] 01/02: - Added two more DFDL schemas for ISO-TP
and ISO-on-TCP
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
commit 8076766d866c7fbbcaf05905814dc2100d3e7594
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Wed Jan 16 21:45:52 2019 +0100
- Added two more DFDL schemas for ISO-TP and ISO-on-TCP
---
src/main/dfdl/cotp-protocol.dfdl.xsd | 213 +++++++++++++++++++++++++++++++++++
src/main/dfdl/tpkt-protocol.dfdl.xsd | 84 ++++++++++++++
2 files changed, 297 insertions(+)
diff --git a/src/main/dfdl/cotp-protocol.dfdl.xsd b/src/main/dfdl/cotp-protocol.dfdl.xsd
new file mode 100644
index 0000000..e179712
--- /dev/null
+++ b/src/main/dfdl/cotp-protocol.dfdl.xsd
@@ -0,0 +1,213 @@
+<!--
+ 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>
\ No newline at end of file
diff --git a/src/main/dfdl/tpkt-protocol.dfdl.xsd b/src/main/dfdl/tpkt-protocol.dfdl.xsd
new file mode 100644
index 0000000..2341219
--- /dev/null
+++ b/src/main/dfdl/tpkt-protocol.dfdl.xsd
@@ -0,0 +1,84 @@
+<!--
+ 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:tpkt="http://plc4x.apache.org/tpkt"
+ targetNamespace="http://plc4x.apache.org/tpkt">
+
+ <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>
+
+ <!--
+
+ TPKT - Iso-On-TCP
+
+ -->
+
+ <xs:element name="TpktMessage">
+ <xs:complexType>
+ <xs:sequence>
+ <!-- TPKT Magic Byte always 0x03 -->
+ <xs:element name="magicByte" type="tpkt:byte">
+ <xs:annotation>
+ <xs:appinfo source="http://www.ogf.org/dfdl/">
+ <dfdl:assert message="Magic number was not 0x03."
+ test="{. eq 3}" />
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="reserved" type="tpkt:byte"/>
+ <xs:element name="length" type="tpkt:short"/>
+ <xs:element name="userData" type="xs:hexBinary"
+ dfdl:byteOrder="bigEndian" dfdl:lengthUnits="bytes" dfdl:lengthKind="explicit"
+ dfdl:length="{../length - 4}"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
\ No newline at end of file