This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git

commit 51b5db361fb1c58ba221c8a450c8911c8ed35f68
Author: Christofer Dutz <[email protected]>
AuthorDate: Wed Feb 7 13:48:50 2018 +0100

    PLC4X-18 - Implement a Netty Pipeline that allows creating pipelines for 
low level protocols below TCP and UDP
    - Some more work on the raw socket netty support
---
 .../utils/rawsockets/netty/RawSocketChannel.java   | 34 +++++++++++---------
 .../rawsockets/netty/RawSocketChannelConfig.java   | 36 ++++++++++++++++++++++
 .../rawsockets/netty/RawSocketChannelOption.java   | 31 +++++++++++++++++++
 3 files changed, 87 insertions(+), 14 deletions(-)

diff --git 
a/plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/netty/RawSocketChannel.java
 
b/plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/netty/RawSocketChannel.java
index e304418..1665686 100644
--- 
a/plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/netty/RawSocketChannel.java
+++ 
b/plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/netty/RawSocketChannel.java
@@ -24,17 +24,23 @@ import java.net.SocketAddress;
 
 public class RawSocketChannel extends AbstractChannel {
 
-    public RawSocketChannel(Channel parent) {
-        super(parent);
+    private static final ChannelMetadata METADATA = new ChannelMetadata(false, 
16);
+
+    protected class RawByteUnsafe extends AbstractChannel.AbstractUnsafe {
+        @Override
+        public void connect(SocketAddress remoteAddress, SocketAddress 
localAddress, ChannelPromise promise) {
+            //getPipeline()
+            promise.setSuccess();
+        }
     }
 
-    public RawSocketChannel(Channel parent, ChannelId id) {
-        super(parent, id);
+    public RawSocketChannel() {
+        super(null);
     }
 
     @Override
     protected AbstractUnsafe newUnsafe() {
-        return null;
+        return new RawByteUnsafe();
     }
 
     @Override
@@ -54,47 +60,47 @@ public class RawSocketChannel extends AbstractChannel {
 
     @Override
     protected void doBind(SocketAddress localAddress) throws Exception {
-
+        System.out.println(localAddress);
     }
 
     @Override
     protected void doDisconnect() throws Exception {
-
+        System.out.println("disconnect");
     }
 
     @Override
     protected void doClose() throws Exception {
-
+        System.out.println("close");
     }
 
     @Override
     protected void doBeginRead() throws Exception {
-
+        System.out.println("beginRead");
     }
 
     @Override
     protected void doWrite(ChannelOutboundBuffer in) throws Exception {
-
+        System.out.println(in);
     }
 
     @Override
     public ChannelConfig config() {
-        return null;
+        return new RawSocketChannelConfig(this);
     }
 
     @Override
     public boolean isOpen() {
-        return false;
+        return true;
     }
 
     @Override
     public boolean isActive() {
-        return false;
+        return true;
     }
 
     @Override
     public ChannelMetadata metadata() {
-        return null;
+        return METADATA;
     }
 
 }
diff --git 
a/plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/netty/RawSocketChannelConfig.java
 
b/plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/netty/RawSocketChannelConfig.java
new file mode 100644
index 0000000..96d28d8
--- /dev/null
+++ 
b/plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/netty/RawSocketChannelConfig.java
@@ -0,0 +1,36 @@
+/*
+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.
+*/
+package org.apache.plc4x.java.utils.rawsockets.netty;
+
+import io.netty.channel.*;
+
+import java.util.Map;
+
+public class RawSocketChannelConfig extends DefaultChannelConfig implements 
ChannelConfig {
+
+    public RawSocketChannelConfig(Channel channel) {
+        super(channel);
+    }
+
+    @Override
+    public Map<ChannelOption<?>, Object> getOptions() {
+        return getOptions(super.getOptions(), 
RawSocketChannelOption.SOME_OPTION);
+    }
+
+}
diff --git 
a/plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/netty/RawSocketChannelOption.java
 
b/plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/netty/RawSocketChannelOption.java
new file mode 100644
index 0000000..a1793be
--- /dev/null
+++ 
b/plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/netty/RawSocketChannelOption.java
@@ -0,0 +1,31 @@
+/*
+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.
+*/
+package org.apache.plc4x.java.utils.rawsockets.netty;
+
+import io.netty.channel.ChannelOption;
+
+public class RawSocketChannelOption<T> extends ChannelOption<T> {
+
+    public static final ChannelOption<Boolean> SOME_OPTION = 
valueOf(RawSocketChannelOption.class, "SOME_OPTION");
+
+    protected RawSocketChannelOption() {
+        super(null);
+    }
+
+}

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to