e066a876b37e5276a2b78742fedaaf57a5a4cdc1
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / spi / BGPDispatcher.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.bgp.rib.impl.spi;
9
10 import com.google.common.base.Optional;
11 import io.netty.channel.ChannelFuture;
12 import io.netty.util.concurrent.Future;
13 import java.net.InetSocketAddress;
14 import org.opendaylight.protocol.bgp.rib.spi.BGPSession;
15 import org.opendaylight.tcpmd5.api.KeyMapping;
16
17 /**
18  * Dispatcher class for creating BGP clients.
19  */
20 public interface BGPDispatcher{
21
22     /**
23      * Creates BGP client.
24      *
25      * @param remoteAddress remote Peer address
26      * @param peerRegistry BGP peer registry
27      * @param retryTimer Retry timer
28      * @return Future promising a client session
29      */
30     Future<? extends BGPSession> createClient(InetSocketAddress remoteAddress, BGPPeerRegistry peerRegistry, int retryTimer);
31
32     /**
33      * Creates Reconnecting client.
34      *
35      * @param remoteAddress remote Peer Address
36      * @param peerRegistry BGP peer registry
37      * @param retryTimer Retry timer
38      * @param keys for TCPMD5
39      * @return Future promising a client session
40      */
41     Future<Void> createReconnectingClient(InetSocketAddress remoteAddress,
42         BGPPeerRegistry peerRegistry, int retryTimer, Optional<KeyMapping> keys);
43
44     /**
45      * Create new BGP server to accept incoming bgp connections (bound to provided socket localAddress).
46      *
47      * @param peerRegistry BGP peer registry
48      * @param localAddress Peer localAddress
49      *
50      * @return ChannelFuture promising a client session
51      */
52     ChannelFuture createServer(BGPPeerRegistry peerRegistry, InetSocketAddress localAddress);
53 }