changes for config subsystem - BUG 754
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / serialization / OFSerializer.java
1 /*
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.openflowjava.protocol.impl.serialization;
10
11 import io.netty.buffer.ByteBuf;
12
13 import org.opendaylight.yangtools.yang.binding.DataObject;
14
15 /**
16  * Uniform interface for serializing factories
17  * @author michal.polkorab
18  * @author timotej.kubas
19  * @param <E> message type
20  */
21 public interface OFSerializer <E extends DataObject> {
22
23     /**
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
28      */
29     public abstract void messageToBuffer(short version, ByteBuf out, E message);
30     
31     /**
32      * Compute length of received message
33      * @param message 
34      * @return computed length
35      */
36     public abstract int computeLength(E message);
37     
38     /**
39      * @return message code type
40      */
41     public byte getMessageType();
42 }