2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.openflowjava.protocol.impl.serialization;
11 import io.netty.buffer.ByteBuf;
13 import org.opendaylight.yangtools.yang.binding.DataObject;
16 * Uniform interface for serializing factories
17 * @author michal.polkorab
18 * @author timotej.kubas
19 * @param <E> message type
21 public interface OFSerializer <E extends DataObject> {
24 * Transforms POJO/DTO into byte message (ByteBuf).
25 * @param version version of used OF Protocol
26 * @param out ByteBuf used for output
27 * @param message message that will be transformed into ByteBuf
29 public abstract void messageToBuffer(short version, ByteBuf out, E message);
32 * Compute length of received message
34 * @return computed length
36 public abstract int computeLength(E message);
39 * @return message code type
41 public byte getMessageType();