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.core.OFFrameDecoder;
\r
7 import org.opendaylight.openflowjava.protocol.impl.serialization.OFSerializer;
\r
8 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
\r
11 * @author michal.polkorab
\r
14 public class ExperimenterInputMessageFactory implements OFSerializer<ExperimenterInput>{
\r
16 /** Code type of Experimenter message */
\r
17 public static final byte MESSAGE_TYPE = 4;
\r
18 private static ExperimenterInputMessageFactory instance;
\r
20 private ExperimenterInputMessageFactory() {
\r
21 // do nothing, just singleton
\r
25 * @return singleton factory
\r
27 public static ExperimenterInputMessageFactory getInstance() {
\r
28 if (instance == null) {
\r
29 instance = new ExperimenterInputMessageFactory();
\r
35 public void messageToBuffer(short version, ByteBuf out,
\r
36 ExperimenterInput message) {
\r
37 out.writeByte(message.getVersion());
\r
38 out.writeByte(MESSAGE_TYPE);
\r
39 out.writeShort(OFFrameDecoder.LENGTH_OF_HEADER + (Integer.SIZE/Byte.SIZE)*2);
\r
40 out.writeInt(message.getXid().intValue());
\r
41 out.writeInt(message.getExperimenter().intValue());
\r
42 out.writeInt(message.getExpType().intValue());
\r