X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=openflow-protocol-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Fcore%2FOFDecoder.java;h=af04a525dcefd5d25a4eb05d832cac890a31d5c8;hb=0d942e8fb70b2c21f97eea3ed8904336ab5c54a4;hp=d0d3996204be5f2f38cde6be3fe6c8bd8219c86c;hpb=537927d0952c74dd362ede53fbbed7db8d53fc7b;p=openflowjava.git diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDecoder.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDecoder.java index d0d39962..af04a525 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDecoder.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDecoder.java @@ -1,54 +1,61 @@ -/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */ -package org.opendaylight.openflowjava.protocol.impl.core; - -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.MessageToMessageDecoder; - -import java.util.List; - -import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory; -import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Transforms OpenFlow Protocol messages to POJOs - * @author michal.polkorab - */ -public class OFDecoder extends MessageToMessageDecoder { - - private static final Logger LOGGER = LoggerFactory.getLogger(OFDecoder.class); - - /** - * Constructor of class - */ - public OFDecoder() { - LOGGER.debug("Creating OF 1.3 Decoder"); - } - - @Override - protected void decode(ChannelHandlerContext ctx, VersionMessageWrapper msg, - List out) throws Exception { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("VersionMessageWrapper received"); - LOGGER.debug("buffer size: " + msg.getMessageBuffer().readableBytes()); - LOGGER.debug("<< " + ByteBufUtils.byteBufToHexString(msg.getMessageBuffer())); - } - DataObject dataObject = null; - try { - dataObject = DeserializationFactory.bufferToMessage(msg.getMessageBuffer(), - msg.getVersion()); - } catch(Exception e) { - LOGGER.error("Message deserialization failed"); - LOGGER.error(e.getMessage(), e); - return; - } - if (dataObject == null) { - LOGGER.warn("Translated POJO is null"); - return; - } - msg.getMessageBuffer().release(); - out.add(dataObject); - } -} +/* + * 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.channel.ChannelHandlerContext; +import io.netty.handler.codec.MessageToMessageDecoder; + +import java.util.List; + +import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory; +import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Transforms OpenFlow Protocol messages to POJOs + * @author michal.polkorab + */ +public class OFDecoder extends MessageToMessageDecoder { + + private static final Logger LOGGER = LoggerFactory.getLogger(OFDecoder.class); + + /** + * Constructor of class + */ + public OFDecoder() { + LOGGER.debug("Creating OF 1.3 Decoder"); + } + + @Override + protected void decode(ChannelHandlerContext ctx, VersionMessageWrapper msg, + List out) throws Exception { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("VersionMessageWrapper received"); + LOGGER.debug("buffer size: " + msg.getMessageBuffer().readableBytes()); + LOGGER.debug("<< " + ByteBufUtils.byteBufToHexString(msg.getMessageBuffer())); + } + DataObject dataObject = null; + try { + dataObject = DeserializationFactory.bufferToMessage(msg.getMessageBuffer(), + msg.getVersion()); + } catch(Exception e) { + LOGGER.error("Message deserialization failed"); + LOGGER.error(e.getMessage(), e); + return; + } + if (dataObject == null) { + LOGGER.warn("Translated POJO is null"); + return; + } + msg.getMessageBuffer().release(); + out.add(dataObject); + } +}