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.ver10; |
| 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.OFQueueProperties; |
| 27 | import org.jboss.netty.buffer.ChannelBuffer; |
| 28 | import com.google.common.hash.PrimitiveSink; |
| 29 | |
| 30 | public class OFQueuePropertiesSerializerVer10 { |
| 31 | |
| 32 | public final static int NONE_VAL = 0x0; |
| 33 | public final static int MIN_RATE_VAL = 0x1; |
| 34 | |
| 35 | public static OFQueueProperties readFrom(ChannelBuffer bb) throws OFParseError { |
| 36 | try { |
| 37 | return ofWireValue(bb.readInt()); |
| 38 | } catch (IllegalArgumentException e) { |
| 39 | throw new OFParseError(e); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | public static void writeTo(ChannelBuffer bb, OFQueueProperties e) { |
| 44 | bb.writeInt(toWireValue(e)); |
| 45 | } |
| 46 | |
| 47 | public static void putTo(OFQueueProperties e, PrimitiveSink sink) { |
| 48 | sink.putInt(toWireValue(e)); |
| 49 | } |
| 50 | |
| 51 | public static OFQueueProperties ofWireValue(int val) { |
| 52 | switch(val) { |
| 53 | case NONE_VAL: |
| 54 | return OFQueueProperties.NONE; |
| 55 | case MIN_RATE_VAL: |
| 56 | return OFQueueProperties.MIN_RATE; |
| 57 | default: |
| 58 | throw new IllegalArgumentException("Illegal wire value for type OFQueueProperties in version 1.0: " + val); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | |
| 63 | public static int toWireValue(OFQueueProperties e) { |
| 64 | switch(e) { |
| 65 | case NONE: |
| 66 | return NONE_VAL; |
| 67 | case MIN_RATE: |
| 68 | return MIN_RATE_VAL; |
| 69 | default: |
| 70 | throw new IllegalArgumentException("Illegal enum value for type OFQueueProperties in version 1.0: " + e); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | } |