Refresh IETF client/server models
[netconf.git] / transport / transport-tcp / src / main / java / org / opendaylight / netconf / transport / tcp / AbstractNettyImpl.java
1 /*
2  * Copyright (c) 2022 PANTHEON.tech, s.r.o. and others.  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.netconf.transport.tcp;
9
10 import io.netty.bootstrap.Bootstrap;
11 import io.netty.bootstrap.ServerBootstrap;
12 import io.netty.channel.EventLoopGroup;
13 import io.netty.channel.socket.ServerSocketChannel;
14 import io.netty.channel.socket.SocketChannel;
15 import java.util.concurrent.ThreadFactory;
16 import org.eclipse.jdt.annotation.NonNullByDefault;
17 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.tcp.common.rev240208.tcp.common.grouping.Keepalives;
18
19 /**
20  * Wrapper around a particular Netty transport implementation.
21  */
22 @NonNullByDefault
23 abstract sealed class AbstractNettyImpl permits EpollNettyImpl, NioNettyImpl {
24
25     abstract Class<? extends SocketChannel> channelClass();
26
27     abstract Class<? extends ServerSocketChannel> serverChannelClass();
28
29     abstract EventLoopGroup newEventLoopGroup(int numThreads, ThreadFactory threadFactory);
30
31     abstract boolean supportsKeepalives();
32
33     abstract void configureKeepalives(Bootstrap bootstrap, Keepalives keepalives);
34
35     abstract void configureKeepalives(ServerBootstrap bootstrap, Keepalives keepalives);
36
37     @Override
38     public abstract String toString();
39 }