Bump to odlparent 2.0.0
[openflowjava.git] / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / connection / ConnectionAdapter.java
1 /*
2  * Copyright (c) 2013 Pantheon Technologies 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.openflowjava.protocol.api.connection;
9
10 import com.google.common.annotations.Beta;
11 import java.net.InetSocketAddress;
12 import java.util.concurrent.Future;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OpenflowProtocolListener;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OpenflowProtocolService;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SystemNotificationsListener;
16
17 /**
18  * @author mirehak
19  * @author michal.polkorab
20  */
21 public interface ConnectionAdapter extends OpenflowProtocolService {
22
23     /**
24      * disconnect corresponding switch
25      * @return future set to true, when disconnect completed
26      */
27     Future<Boolean> disconnect();
28
29     /**
30      * @return true, if connection to switch is alive
31      */
32     boolean isAlive();
33
34     /**
35      * @return address of the remote end - address of a switch if connected
36      */
37     InetSocketAddress getRemoteAddress();
38     /**
39      * @param messageListener here will be pushed all messages from switch
40      */
41     void setMessageListener(OpenflowProtocolListener messageListener);
42
43     /**
44      * @param systemListener here will be pushed all system messages from library
45      */
46     void setSystemListener(SystemNotificationsListener systemListener);
47
48     /**
49      * Throws exception if any of required listeners is missing
50      */
51     void checkListeners();
52
53     /**
54      * notify listener about connection ready-to-use event
55      */
56     void fireConnectionReadyNotification();
57
58     /**
59      * set listener for connection became ready-to-use event
60      * @param connectionReadyListener listens to connection ready event
61      */
62     void setConnectionReadyListener(ConnectionReadyListener connectionReadyListener);
63
64     /**
65      * sets option for automatic channel reading;
66      * if set to false, incoming messages won't be read
67      *
68      * @param autoRead target value to be switched to
69      */
70     void setAutoRead(boolean autoRead);
71
72     /**
73      * @return true, if channel is configured to autoread
74      */
75     boolean isAutoRead();
76
77     /**
78      * Registers a new bypass outbound queue
79      * @param <T> handler type
80      * @param handler queue handler
81      * @param maxQueueDepth max amount of not confirmed messaged in queue (i.e. edge for barrier message)
82      * @param maxBarrierNanos regular base for barrier message
83      * @return An {@link OutboundQueueHandlerRegistration}
84      */
85     @Beta
86     <T extends OutboundQueueHandler> OutboundQueueHandlerRegistration<T> registerOutboundQueueHandler(T handler,
87         int maxQueueDepth, long maxBarrierNanos);
88
89     /**
90      * Set filtering of PacketIn messages. By default these messages are not filtered.
91      * @param enabled True if PacketIn messages should be filtered, false if they should be reported.
92      */
93     @Beta
94     void setPacketInFiltering(boolean enabled);
95 }