1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
\r
2 package org.opendaylight.openflowjava.protocol.impl.serialization.factories;
\r
4 import io.netty.buffer.ByteBuf;
\r
6 import org.opendaylight.openflowjava.protocol.impl.serialization.OFSerializer;
\r
7 import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;
\r
8 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInput;
\r
11 * Translates FeaturesRequest messages (both OpenFlow v1.0 and OpenFlow v1.3)
\r
12 * @author michal.polkorab
\r
13 * @author timotej.kubas
\r
15 public class GetFeaturesInputMessageFactory implements OFSerializer<GetFeaturesInput>{
\r
17 /** Code type of FeaturesRequest message */
\r
18 public static final byte MESSAGE_TYPE = 5;
\r
19 private static final int MESSAGE_LENGTH = 8;
\r
20 private static GetFeaturesInputMessageFactory instance;
\r
22 private GetFeaturesInputMessageFactory() {
\r
23 // do nothing, just singleton
\r
27 * @return singleton factory
\r
29 public static synchronized GetFeaturesInputMessageFactory getInstance() {
\r
30 if (instance == null) {
\r
31 instance = new GetFeaturesInputMessageFactory();
\r
37 public void messageToBuffer(short version, ByteBuf out,
\r
38 GetFeaturesInput message) {
\r
39 ByteBufUtils.writeOFHeader(instance, message, out);
\r
43 public int computeLength(GetFeaturesInput message) {
\r
44 return MESSAGE_LENGTH;
\r
48 public byte getMessageType() {
\r
49 return MESSAGE_TYPE;
\r