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
10 package org.opendaylight.openflowjava.protocol.spi.connection;
12 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionConfiguration;
13 import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
14 import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
15 import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
16 import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
17 import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;
18 import org.opendaylight.yangtools.yang.binding.DataObject;
20 import com.google.common.util.concurrent.ListenableFuture;
24 * @author michal.polkorab
27 public interface SwitchConnectionProvider extends AutoCloseable {
30 * @param configuration [protocol, port, address and supported features]
32 void setConfiguration(ConnectionConfiguration configuration);
35 * start listening to switches, but please don't forget to do
36 * {@link #setSwitchConnectionHandler(SwitchConnectionHandler)} first
37 * @return future, triggered to true, when listening channel is up and running
39 ListenableFuture<Boolean> startup();
42 * stop listening to switches
43 * @return future, triggered to true, when all listening channels are down
45 ListenableFuture<Boolean> shutdown();
48 * @param switchConHandler instance being informed when new switch connects
50 void setSwitchConnectionHandler(SwitchConnectionHandler switchConHandler);
53 * Registers custom serializer
54 * @param key used for serializer lookup
55 * @param serializer serializer implementation
57 public <E extends DataObject> void registerCustomSerializer(MessageTypeKey<E> key,
58 OFSerializer<E> serializer);
61 * Registers custom deserializer
62 * @param key used for deserializer lookup
63 * @param deserializer deserializer instance
65 public void registerDeserializer(MessageCodeKey key, OFGeneralDeserializer deserializer);