-/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.openflowjava.protocol.impl.core;
import io.netty.buffer.ByteBuf;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.opendaylight.openflowjava.protocol.impl.connection.ConnectionFacade;
import org.opendaylight.openflowjava.protocol.impl.core.TcpHandler.COMPONENT_NAMES;
import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;
private boolean detectSsl;
private static final Logger LOGGER = LoggerFactory
.getLogger(TlsDetector.class);
+
+ private ConnectionFacade connectionFacade;
/**
* Constructor of class
*/
public TlsDetector() {
- LOGGER.info("Creating TLS Detector");
+ LOGGER.debug("Creating TLS Detector");
detectSsl = true;
}
SSLEngine engine = SslContextFactory.getServerContext()
.createSSLEngine();
engine.setUseClientMode(false);
- p.addBefore(COMPONENT_NAMES.DELEGATING_INBOUND_HANDLER.name(), COMPONENT_NAMES.SSL_HANDLER.name(),
+ p.addAfter(COMPONENT_NAMES.TLS_DETECTOR.name(), COMPONENT_NAMES.SSL_HANDLER.name(),
new SslHandler(engine));
}
}
- private static void enableOFFrameDecoder(ChannelHandlerContext ctx) {
- ChannelPipeline p = ctx.channel().pipeline();
- if (p.get(COMPONENT_NAMES.OF_FRAME_DECODER.name()) == null) {
- LOGGER.debug("Engaging OFFrameDecoder");
- p.addBefore(COMPONENT_NAMES.DELEGATING_INBOUND_HANDLER.name(), COMPONENT_NAMES.OF_FRAME_DECODER.name(), new OFFrameDecoder());
- } else {
- LOGGER.debug("OFFD already in pipeline");
- }
- }
-
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf bb,
List<Object> list) throws Exception {
} else {
LOGGER.info("Connection is not encrypted");
}
- enableOFFrameDecoder(ctx);
+
+ if (connectionFacade != null) {
+ LOGGER.debug("Firing onConnectionReady notification");
+ connectionFacade.fireConnectionReadyNotification();
+ }
+
ctx.pipeline().remove(COMPONENT_NAMES.TLS_DETECTOR.name());
}
+
+ /**
+ * @param connectionFacade the connectionFacade to set
+ */
+ public void setConnectionFacade(ConnectionFacade connectionFacade) {
+ this.connectionFacade = connectionFacade;
+ }
}