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 java.util.Iterator;
\r
5 import java.util.List;
\r
7 import io.netty.buffer.ByteBuf;
\r
9 import org.opendaylight.openflowjava.protocol.impl.serialization.OFSerializer;
\r
10 import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;
\r
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
\r
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.hello.Elements;
\r
15 * @author michal.polkorab
\r
18 public class HelloInputMessageFactory implements OFSerializer<HelloInput>{
\r
20 /** Code type of Hello message */
\r
21 public static final byte MESSAGE_TYPE = 0;
\r
22 private static final int MESSAGE_LENGTH = 8;
\r
23 private static HelloInputMessageFactory instance;
\r
25 private HelloInputMessageFactory() {
\r
26 // do nothing, just singleton
\r
30 * @return singleton factory
\r
32 public static HelloInputMessageFactory getInstance() {
\r
33 if (instance == null) {
\r
34 instance = new HelloInputMessageFactory();
\r
40 public void messageToBuffer(short version, ByteBuf out, HelloInput message) {
\r
41 ByteBufUtils.writeOFHeader(instance, message, out);
\r
42 // TODO - fill list of elements into ByteBuf, check length too
\r
46 public int computeLength() {
\r
47 return MESSAGE_LENGTH;
\r
51 public byte getMessageType() {
\r
52 return MESSAGE_TYPE;
\r