BUG-632: add initial configuration bits for TCP-MD5
[bgpcep.git] / tcp-md5 / netty / src / main / java / org / opendaylight / bgpcep / tcpmd5 / netty / MD5NioServerSocketChannel.java
1 /*
2  * Copyright (c) 2013 Robert Varga. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.bgpcep.tcpmd5.netty;
9
10 import io.netty.channel.socket.nio.NioServerSocketChannel;
11
12 import org.opendaylight.bgpcep.tcpmd5.KeyAccessFactory;
13 import org.opendaylight.bgpcep.tcpmd5.nio.MD5ServerSocketChannel;
14
15 /**
16  * {@link NioServerSocketChannel} enabled with support for TCP MD5 Signature
17  * option.
18  */
19 public class MD5NioServerSocketChannel extends NioServerSocketChannel {
20         private final MD5ServerSocketChannelConfig config;
21         private final MD5ServerSocketChannel channel;
22
23         public MD5NioServerSocketChannel() {
24                 super();
25                 this.channel = new MD5ServerSocketChannel(super.javaChannel());
26                 this.config = new ProxyMD5ServerSocketChannelConfig(super.config(), channel);
27         }
28
29         public MD5NioServerSocketChannel(final KeyAccessFactory keyAccessFactory) {
30                 super();
31                 this.channel = new MD5ServerSocketChannel(super.javaChannel(), keyAccessFactory);
32                 this.config = new ProxyMD5ServerSocketChannelConfig(super.config(), channel);
33         }
34
35         @Override
36         public MD5ServerSocketChannelConfig config() {
37                 return this.config;
38         }
39
40         @Override
41         protected MD5ServerSocketChannel javaChannel() {
42                 return this.channel;
43         }
44 }