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%2FGetFeaturesInputMessageFactory.java;h=d56df56ac613b48523ba183631d459004c4160d8;hb=26aeaa7e2754b2cf4f6ad63055ab3ce34f68c961;hp=ced7255ad90c4936ad8d3997df382bde1bd05d06;hpb=7494ef8cb011ce850af5d1cf33e90e212fdc2a97;p=openflowjava.git diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/GetFeaturesInputMessageFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/GetFeaturesInputMessageFactory.java index ced7255a..d56df56a 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/GetFeaturesInputMessageFactory.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/GetFeaturesInputMessageFactory.java @@ -1,51 +1,33 @@ -/* 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.GetFeaturesInput; - -/** - * @author michal.polkorab - * - */ -public class GetFeaturesInputMessageFactory implements OFSerializer{ - - /** Code type of FeaturesRequest message */ - public static final byte MESSAGE_TYPE = 5; - private static final int MESSAGE_LENGTH = 8; - private static GetFeaturesInputMessageFactory instance; - - private GetFeaturesInputMessageFactory() { - // do nothing, just singleton - } - - /** - * @return singleton factory - */ - public static synchronized GetFeaturesInputMessageFactory getInstance() { - if (instance == null) { - instance = new GetFeaturesInputMessageFactory(); - } - return instance; - } - - @Override - public void messageToBuffer(short version, ByteBuf out, - GetFeaturesInput message) { - ByteBufUtils.writeOFHeader(instance, message, out); - } - - @Override - public int computeLength(GetFeaturesInput 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.protocol.impl.util.ByteBufUtils; +import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInput; + +/** + * Translates FeaturesRequest messages (both OpenFlow v1.0 and OpenFlow v1.3) + * @author michal.polkorab + * @author timotej.kubas + */ +public class GetFeaturesInputMessageFactory implements OFSerializer{ + + /** Code type of FeaturesRequest message */ + private static final byte MESSAGE_TYPE = 5; + + @Override + public void serialize(GetFeaturesInput message, ByteBuf outBuffer) { + ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.OFHEADER_SIZE); + } + +}