alshabib | 86ac11c | 2014-08-14 16:14:41 -0700 | [diff] [blame^] | 1 | // Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 2 | // Copyright (c) 2011, 2012 Open Networking Foundation |
| 3 | // Copyright (c) 2012, 2013 Big Switch Networks, Inc. |
| 4 | // This library was generated by the LoxiGen Compiler. |
| 5 | // See the file LICENSE.txt which should have been included in the source distribution |
| 6 | |
| 7 | // Automatically generated by LOXI from template const_serializer.java |
| 8 | // Do not modify |
| 9 | |
| 10 | package org.projectfloodlight.openflow.protocol.ver13; |
| 11 | |
| 12 | import org.projectfloodlight.openflow.protocol.*; |
| 13 | import org.projectfloodlight.openflow.protocol.action.*; |
| 14 | import org.projectfloodlight.openflow.protocol.actionid.*; |
| 15 | import org.projectfloodlight.openflow.protocol.bsntlv.*; |
| 16 | import org.projectfloodlight.openflow.protocol.errormsg.*; |
| 17 | import org.projectfloodlight.openflow.protocol.meterband.*; |
| 18 | import org.projectfloodlight.openflow.protocol.instruction.*; |
| 19 | import org.projectfloodlight.openflow.protocol.instructionid.*; |
| 20 | import org.projectfloodlight.openflow.protocol.match.*; |
| 21 | import org.projectfloodlight.openflow.protocol.oxm.*; |
| 22 | import org.projectfloodlight.openflow.protocol.queueprop.*; |
| 23 | import org.projectfloodlight.openflow.types.*; |
| 24 | import org.projectfloodlight.openflow.util.*; |
| 25 | import org.projectfloodlight.openflow.exceptions.*; |
| 26 | import org.projectfloodlight.openflow.protocol.OFHelloElemType; |
| 27 | import org.jboss.netty.buffer.ChannelBuffer; |
| 28 | import com.google.common.hash.PrimitiveSink; |
| 29 | |
| 30 | public class OFHelloElemTypeSerializerVer13 { |
| 31 | |
| 32 | public final static short VERSIONBITMAP_VAL = (short) 0x1; |
| 33 | |
| 34 | public static OFHelloElemType readFrom(ChannelBuffer bb) throws OFParseError { |
| 35 | try { |
| 36 | return ofWireValue(bb.readShort()); |
| 37 | } catch (IllegalArgumentException e) { |
| 38 | throw new OFParseError(e); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | public static void writeTo(ChannelBuffer bb, OFHelloElemType e) { |
| 43 | bb.writeShort(toWireValue(e)); |
| 44 | } |
| 45 | |
| 46 | public static void putTo(OFHelloElemType e, PrimitiveSink sink) { |
| 47 | sink.putShort(toWireValue(e)); |
| 48 | } |
| 49 | |
| 50 | public static OFHelloElemType ofWireValue(short val) { |
| 51 | switch(val) { |
| 52 | case VERSIONBITMAP_VAL: |
| 53 | return OFHelloElemType.VERSIONBITMAP; |
| 54 | default: |
| 55 | throw new IllegalArgumentException("Illegal wire value for type OFHelloElemType in version 1.3: " + val); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | |
| 60 | public static short toWireValue(OFHelloElemType e) { |
| 61 | switch(e) { |
| 62 | case VERSIONBITMAP: |
| 63 | return VERSIONBITMAP_VAL; |
| 64 | default: |
| 65 | throw new IllegalArgumentException("Illegal enum value for type OFHelloElemType in version 1.3: " + e); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | } |