X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Fserialization%2Ffactories%2FOF10QueueGetConfigInputMessageFactory.java;h=7afa4bc25c9058bad96f2d972d8f385a203d42d0;hb=07de1ed897da9d7dc70c6d550f38c59339ed751e;hp=5b83e7d810593b3c4fa184caa3fca1e1fafee790;hpb=5b05fc8e7dd2b61a076dfd1864a205b0995c7722;p=openflowjava.git diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10QueueGetConfigInputMessageFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10QueueGetConfigInputMessageFactory.java index 5b83e7d8..7afa4bc2 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10QueueGetConfigInputMessageFactory.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10QueueGetConfigInputMessageFactory.java @@ -1,53 +1,35 @@ -/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */ -package org.opendaylight.openflowjava.protocol.impl.serialization.factories; - -import io.netty.buffer.ByteBuf; - -import org.opendaylight.openflowjava.protocol.impl.serialization.OFSerializer; -import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInput; - -/** - * Translates QueueGetConfigRequest messages - * @author michal.polkorab - */ -public class OF10QueueGetConfigInputMessageFactory implements OFSerializer { - - private static final byte MESSAGE_TYPE = 20; - private static final byte PADDING_IN_GET_QUEUE_CONFIG_MESSAGE = 2; - private static final int MESSAGE_LENGTH = 12; - - private static OF10QueueGetConfigInputMessageFactory instance; - - private OF10QueueGetConfigInputMessageFactory() { - // singleton - } - - /** - * @return singleton factory - */ - public static synchronized OF10QueueGetConfigInputMessageFactory getInstance(){ - if(instance == null){ - instance = new OF10QueueGetConfigInputMessageFactory(); - } - return instance; - } - - @Override - public void messageToBuffer(short version, ByteBuf out, GetQueueConfigInput message){ - ByteBufUtils.writeOFHeader(instance, message, out); - out.writeShort(message.getPort().getValue().intValue()); - ByteBufUtils.padBuffer(PADDING_IN_GET_QUEUE_CONFIG_MESSAGE, out); - } - - @Override - public int computeLength(GetQueueConfigInput message){ - return MESSAGE_LENGTH; - } - - @Override - public byte getMessageType() { - return MESSAGE_TYPE; - } - -} +/* + * 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.serialization.factories; + +import io.netty.buffer.ByteBuf; + +import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer; +import org.opendaylight.openflowjava.util.ByteBufUtils; +import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInput; + +/** + * Translates QueueGetConfigRequest messages + * @author michal.polkorab + */ +public class OF10QueueGetConfigInputMessageFactory implements OFSerializer { + + private static final byte MESSAGE_TYPE = 20; + private static final byte PADDING_IN_GET_QUEUE_CONFIG_MESSAGE = 2; + + @Override + public void serialize(GetQueueConfigInput message, ByteBuf outBuffer) { + ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH); + outBuffer.writeShort(message.getPort().getValue().intValue()); + outBuffer.writeZero(PADDING_IN_GET_QUEUE_CONFIG_MESSAGE); + ByteBufUtils.updateOFHeaderLength(outBuffer); + } + +}