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:54 UTC
[incubator-plc4x] branch develop updated (0d03828 -> 972188f)
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git.
from 0d03828 - Added DFDL Schema for S7 Protocol.
new 8076766 - Added two more DFDL schemas for ISO-TP and ISO-on-TCP
add 46d5d93 S7: fix of array acquirement, fix of String aquirement, added additional scraper yml
add 704f989 Merge pull request #43 from timbo2k/s7_array_stuff
add 980c069 S7: changed byteLength and blockNumber from short to int
add 7031908 Merge pull request #44 from timbo2k/too_short_range_for_offset
new 972188f - Resolved merge conflicts..
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../org/apache/plc4x/java/s7/model/S7Field.java | 54 +++++-
.../model/params/items/S7AnyVarParameterItem.java | 12 +-
.../strategies/DefaultS7MessageProcessor.java | 12 +-
.../java/org/apache/plc4x/java/issues/PLC4X56.java | 42 +++-
.../src/test/resources/example_with_strings.yml | 14 +-
src/main/dfdl/cotp-protocol.dfdl.xsd | 213 +++++++++++++++++++++
src/main/dfdl/tpkt-protocol.dfdl.xsd | 84 ++++++++
7 files changed, 400 insertions(+), 31 deletions(-)
create mode 100644 src/main/dfdl/cotp-protocol.dfdl.xsd
create mode 100644 src/main/dfdl/tpkt-protocol.dfdl.xsd
[incubator-plc4x] 01/02: - Added two more DFDL schemas for ISO-TP
and ISO-on-TCP
Posted by cd...@apache.org.
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
[incubator-plc4x] 02/02: - Resolved merge conflicts..
Posted by cd...@apache.org.
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 972188f8ce7d39dfd17bb0b78e1517d9cfd2ffbe
Merge: 8076766 7031908
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Wed Jan 16 21:48:32 2019 +0100
- Resolved merge conflicts..
.../org/apache/plc4x/java/s7/model/S7Field.java | 54 ++++++++++++++++++----
.../model/params/items/S7AnyVarParameterItem.java | 12 ++---
.../strategies/DefaultS7MessageProcessor.java | 12 ++---
.../java/org/apache/plc4x/java/issues/PLC4X56.java | 42 ++++++++++++++++-
.../src/test/resources/example_with_strings.yml | 14 +++---
5 files changed, 103 insertions(+), 31 deletions(-)
diff --cc plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/model/params/items/S7AnyVarParameterItem.java
index b1849f8,e9bc87c..876c82c
--- a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/model/params/items/S7AnyVarParameterItem.java
+++ b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/model/params/items/S7AnyVarParameterItem.java
@@@ -20,8 -20,8 +20,8 @@@ package org.apache.plc4x.java.s7.netty.
import org.apache.plc4x.java.s7.netty.model.types.MemoryArea;
import org.apache.plc4x.java.s7.netty.model.types.SpecificationType;
--import org.apache.plc4x.java.s7.netty.model.types.VariableAddressingMode;
import org.apache.plc4x.java.s7.netty.model.types.TransportSize;
++import org.apache.plc4x.java.s7.netty.model.types.VariableAddressingMode;
/**
* "Low-level" description of S7 Address range and the necessary size for transportation of values.
diff --cc plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/issues/PLC4X56.java
index d5de122,15d7a42..bc60896
--- a/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/issues/PLC4X56.java
+++ b/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/issues/PLC4X56.java
@@@ -22,7 -23,10 +23,8 @@@ import org.apache.plc4x.java.api.except
import org.apache.plc4x.java.s7.model.S7Field;
import org.apache.plc4x.java.s7.netty.model.types.MemoryArea;
import org.apache.plc4x.java.s7.netty.model.types.TransportSize;
+ import org.junit.Assert;
-import org.junit.Rule;
import org.junit.jupiter.api.Test;
-import org.junit.rules.ExpectedException;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;