49e9cf0c35886e559d81dade4137d0155c7845a7
[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.util.concurrent.Future;
11
12 import java.io.IOException;
13 import java.net.InetSocketAddress;
14
15 import org.opendaylight.protocol.framework.ProtocolServer;
16 import org.opendaylight.protocol.framework.ReconnectStrategy;
17
18 /**
19  * Dispatcher class for creating servers and clients.
20  */
21 public interface PCEPDispatcher {
22
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 Future<ProtocolServer> createServer(final InetSocketAddress address, final PCEPConnectionFactory connectionFactory) throws IOException;
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(PCEPConnection connection, final ReconnectStrategy strategy) throws IOException;
41
42         /**
43          * Sets the limit of maximum unknown messages per minute. If not set by the user, default is 5 messages/minute.
44          * @param limit maximum unknown messages per minute
45          */
46         public void setMaxUnknownMessages(final int limit);
47 }
48