BUG-58: refactor to take advantage of netty
[bgpcep.git] / pcep / api / src / main / java / org / opendaylight / protocol / pcep / PCEPDispatcher.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. 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.protocol.pcep;
9
10 import io.netty.channel.ChannelFuture;
11 import io.netty.util.concurrent.Future;
12
13 import java.io.IOException;
14 import java.net.InetSocketAddress;
15
16 import org.opendaylight.protocol.framework.ReconnectStrategy;
17 import org.opendaylight.protocol.framework.SessionListenerFactory;
18
19 /**
20  * Dispatcher class for creating servers and clients.
21  */
22 public interface PCEPDispatcher {
23         /**
24          * Creates server. Each server needs three factories to pass their instances to client sessions.
25          * @param address to be bound with the server
26          * @param listenerFactory to create listeners for clients
27          * @param proposalFactory to create proposed open objects for clients
28          * @param checkerFactory to create session characteristics checker for clients
29          * @return instance of PCEPServer
30          * @throws IOException if some IO error occurred
31          */
32         public ChannelFuture createServer(final InetSocketAddress address, final SessionListenerFactory<PCEPSessionListener> listenerFactory);
33
34         /**
35          * Creates a client. Needs to be started via the start method.
36          * @param connection PCEP connection settings
37          * @param strategy Reconnection strategy to be used for TCP-level connection
38          * @throws IOException if some IO error occurred
39          */
40         public Future<? extends PCEPSession> createClient(InetSocketAddress address, final PCEPSessionListener listener, final ReconnectStrategy strategy);
41 }
42