tom | 0eb04ca | 2014-08-25 14:34:51 -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.OFControllerMaxLen; |
| 27 | import org.jboss.netty.buffer.ChannelBuffer; |
| 28 | import com.google.common.hash.PrimitiveSink; |
| 29 | |
| 30 | public class OFControllerMaxLenSerializerVer13 { |
| 31 | |
| 32 | public final static short MAX_VAL = (short) 0xffe5; |
| 33 | public final static short NO_BUFFER_VAL = (short) 0xffff; |
| 34 | |
| 35 | public static OFControllerMaxLen readFrom(ChannelBuffer bb) throws OFParseError { |
| 36 | try { |
| 37 | return ofWireValue(bb.readShort()); |
| 38 | } catch (IllegalArgumentException e) { |
| 39 | throw new OFParseError(e); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | public static void writeTo(ChannelBuffer bb, OFControllerMaxLen e) { |
| 44 | bb.writeShort(toWireValue(e)); |
| 45 | } |
| 46 | |
| 47 | public static void putTo(OFControllerMaxLen e, PrimitiveSink sink) { |
| 48 | sink.putShort(toWireValue(e)); |
| 49 | } |
| 50 | |
| 51 | public static OFControllerMaxLen ofWireValue(short val) { |
| 52 | switch(val) { |
| 53 | case MAX_VAL: |
| 54 | return OFControllerMaxLen.MAX; |
| 55 | case NO_BUFFER_VAL: |
| 56 | return OFControllerMaxLen.NO_BUFFER; |
| 57 | default: |
| 58 | throw new IllegalArgumentException("Illegal wire value for type OFControllerMaxLen in version 1.3: " + val); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | |
| 63 | public static short toWireValue(OFControllerMaxLen e) { |
| 64 | switch(e) { |
| 65 | case MAX: |
| 66 | return MAX_VAL; |
| 67 | case NO_BUFFER: |
| 68 | return NO_BUFFER_VAL; |
| 69 | default: |
| 70 | throw new IllegalArgumentException("Illegal enum value for type OFControllerMaxLen in version 1.3: " + e); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | } |