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.EchoReplyInput;
\r
11 * @author michal.polkorab
\r
14 public class EchoReplyInputMessageFactory implements OFSerializer<EchoReplyInput>{
\r
16 /** Code type of EchoReply message */
\r
17 public static final byte MESSAGE_TYPE = 3;
\r
18 private static EchoReplyInputMessageFactory instance;
\r
20 private EchoReplyInputMessageFactory() {
\r
21 // do nothing, just singleton
\r
25 * @return singleton factory
\r
27 public static EchoReplyInputMessageFactory getInstance() {
\r
28 if (instance == null) {
\r
29 instance = new EchoReplyInputMessageFactory();
\r
35 public void messageToBuffer(short version, ByteBuf out,
\r
36 EchoReplyInput message) {
\r
37 out.writeByte(message.getVersion());
\r
38 out.writeByte(MESSAGE_TYPE);
\r
39 out.writeShort(OFFrameDecoder.LENGTH_OF_HEADER);
\r
40 out.writeInt(message.getXid().intValue());
\r