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 2020/10/06 15:21:39 UTC
[plc4x] 01/04: - Kickoff
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch feature/plc4go
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit c897eed0fe4e01985ec64c94164064e7f135a4de
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Tue Oct 6 12:33:32 2020 +0200
- Kickoff
---
.gitignore | 3 +
plc4j/examples/replay-test/pom.xml | 80 ++++++++++++++++++++++
.../utils/pcapreplay/netty/PcapReplayChannel.java | 6 +-
sandbox/plc4go/pom.xml | 38 ++++++++++
4 files changed, 125 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
index aa03395..3ab3556 100644
--- a/.gitignore
+++ b/.gitignore
@@ -176,3 +176,6 @@ build-iPhoneSimulator/
# Exclude VSCode project settings.
.vscode/
+
+# Temp stuff ...
+/sandbox/plc4go/temp/
diff --git a/plc4j/examples/replay-test/pom.xml b/plc4j/examples/replay-test/pom.xml
new file mode 100644
index 0000000..10450fd
--- /dev/null
+++ b/plc4j/examples/replay-test/pom.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.plc4x.examples</groupId>
+ <artifactId>plc4j-examples</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>plc4j-replay-test</artifactId>
+ <name>PLC4J: Examples: Replay-Test</name>
+ <description>Replay test, that replays a given network capture against a given driver and tries if this can process all packets it contains.</description>
+
+ <properties>
+ <app.main.class>org.apache.plc4x.java.examples.replay.Plc4xReplayTest</app.main.class>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-api</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ <version>1.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>log4j-over-slf4j</artifactId>
+ <version>1.7.25</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <configuration>
+ <usedDependencies combine.children="append">
+ <usedDependency>org.slf4j:log4j-over-slf4j</usedDependency>
+ </usedDependencies>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
diff --git a/plc4j/utils/pcap-replay/src/main/java/org/apache/plc4x/java/utils/pcapreplay/netty/PcapReplayChannel.java b/plc4j/utils/pcap-replay/src/main/java/org/apache/plc4x/java/utils/pcapreplay/netty/PcapReplayChannel.java
index 4b37316..8384d40 100644
--- a/plc4j/utils/pcap-replay/src/main/java/org/apache/plc4x/java/utils/pcapreplay/netty/PcapReplayChannel.java
+++ b/plc4j/utils/pcap-replay/src/main/java/org/apache/plc4x/java/utils/pcapreplay/netty/PcapReplayChannel.java
@@ -101,7 +101,7 @@ public class PcapReplayChannel extends OioByteStreamChannel {
PcapHandle.TimestampPrecision.NANO);
// If the address allows fine tuning which packets to process, set a filter to reduce the load.
- String filter = config.getFilterString(localAddress, remoteAddress);
+ String filter = "";//config.getFilterString(localAddress, remoteAddress);
if(filter.length() > 0) {
handle.setFilter(filter, BpfProgram.BpfCompileMode.OPTIMIZE);
}
@@ -132,7 +132,9 @@ public class PcapReplayChannel extends OioByteStreamChannel {
// Send the bytes to the netty pipeline.
byte[] data = config.getPacketHandler().getData(packet);
- buffer.writeBytes(data);
+ if(data != null) {
+ buffer.writeBytes(data);
+ }
// Remember the timestamp of the current packet.
lastPacketTime = curPacketTime;
diff --git a/sandbox/plc4go/pom.xml b/sandbox/plc4go/pom.xml
new file mode 100644
index 0000000..d4601c2
--- /dev/null
+++ b/sandbox/plc4go/pom.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.plc4x.sandbox</groupId>
+ <artifactId>plc4x-sandbox</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>plc4go</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Sandbox: PLC4Go</name>
+ <description>Implementation of the protocol adapters for usage as Go(lang) library.</description>
+
+
+
+</project>
\ No newline at end of file