2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.openflowjava.protocol.api.connection;
10 import com.google.common.annotations.Beta;
11 import java.net.InetSocketAddress;
12 import java.util.concurrent.Future;
13 import org.opendaylight.openflowjava.protocol.api.extensibility.AlienMessageListener;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OpenflowProtocolListener;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OpenflowProtocolService;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SystemNotificationsListener;
20 * @author michal.polkorab
22 public interface ConnectionAdapter extends OpenflowProtocolService {
25 * disconnect corresponding switch
26 * @return future set to true, when disconnect completed
28 Future<Boolean> disconnect();
31 * @return true, if connection to switch is alive
36 * @return address of the remote end - address of a switch if connected
38 InetSocketAddress getRemoteAddress();
41 * @param messageListener here will be pushed all messages from switch
43 void setMessageListener(OpenflowProtocolListener messageListener);
46 * @param systemListener here will be pushed all system messages from library
48 void setSystemListener(SystemNotificationsListener systemListener);
51 * Set handler for alien messages received from device
52 * @param alienMessageListener here will be pushed all alien messages from switch
54 void setAlienMessageListener(AlienMessageListener alienMessageListener);
57 * Throws exception if any of required listeners is missing
59 void checkListeners();
62 * notify listener about connection ready-to-use event
64 void fireConnectionReadyNotification();
67 * set listener for connection became ready-to-use event
68 * @param connectionReadyListener listens to connection ready event
70 void setConnectionReadyListener(ConnectionReadyListener connectionReadyListener);
73 * sets option for automatic channel reading;
74 * if set to false, incoming messages won't be read
76 * @param autoRead target value to be switched to
78 void setAutoRead(boolean autoRead);
81 * @return true, if channel is configured to autoread
86 * Registers a new bypass outbound queue
87 * @param <T> handler type
88 * @param handler queue handler
89 * @param maxQueueDepth max amount of not confirmed messaged in queue (i.e. edge for barrier message)
90 * @param maxBarrierNanos regular base for barrier message
91 * @return An {@link OutboundQueueHandlerRegistration}
94 <T extends OutboundQueueHandler> OutboundQueueHandlerRegistration<T> registerOutboundQueueHandler(T handler,
95 int maxQueueDepth, long maxBarrierNanos);
98 * Set filtering of PacketIn messages. By default these messages are not filtered.
99 * @param enabled True if PacketIn messages should be filtered, false if they should be reported.
102 void setPacketInFiltering(boolean enabled);