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.ver12; |
| 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.OFFlowModFailedCode; |
| 27 | import org.jboss.netty.buffer.ChannelBuffer; |
| 28 | import com.google.common.hash.PrimitiveSink; |
| 29 | |
| 30 | public class OFFlowModFailedCodeSerializerVer12 { |
| 31 | |
| 32 | public final static short UNKNOWN_VAL = (short) 0x0; |
| 33 | public final static short TABLE_FULL_VAL = (short) 0x1; |
| 34 | public final static short BAD_TABLE_ID_VAL = (short) 0x2; |
| 35 | public final static short OVERLAP_VAL = (short) 0x3; |
| 36 | public final static short EPERM_VAL = (short) 0x4; |
| 37 | public final static short BAD_TIMEOUT_VAL = (short) 0x5; |
| 38 | public final static short BAD_COMMAND_VAL = (short) 0x6; |
| 39 | public final static short BAD_FLAGS_VAL = (short) 0x7; |
| 40 | |
| 41 | public static OFFlowModFailedCode readFrom(ChannelBuffer bb) throws OFParseError { |
| 42 | try { |
| 43 | return ofWireValue(bb.readShort()); |
| 44 | } catch (IllegalArgumentException e) { |
| 45 | throw new OFParseError(e); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | public static void writeTo(ChannelBuffer bb, OFFlowModFailedCode e) { |
| 50 | bb.writeShort(toWireValue(e)); |
| 51 | } |
| 52 | |
| 53 | public static void putTo(OFFlowModFailedCode e, PrimitiveSink sink) { |
| 54 | sink.putShort(toWireValue(e)); |
| 55 | } |
| 56 | |
| 57 | public static OFFlowModFailedCode ofWireValue(short val) { |
| 58 | switch(val) { |
| 59 | case UNKNOWN_VAL: |
| 60 | return OFFlowModFailedCode.UNKNOWN; |
| 61 | case TABLE_FULL_VAL: |
| 62 | return OFFlowModFailedCode.TABLE_FULL; |
| 63 | case BAD_TABLE_ID_VAL: |
| 64 | return OFFlowModFailedCode.BAD_TABLE_ID; |
| 65 | case OVERLAP_VAL: |
| 66 | return OFFlowModFailedCode.OVERLAP; |
| 67 | case EPERM_VAL: |
| 68 | return OFFlowModFailedCode.EPERM; |
| 69 | case BAD_TIMEOUT_VAL: |
| 70 | return OFFlowModFailedCode.BAD_TIMEOUT; |
| 71 | case BAD_COMMAND_VAL: |
| 72 | return OFFlowModFailedCode.BAD_COMMAND; |
| 73 | case BAD_FLAGS_VAL: |
| 74 | return OFFlowModFailedCode.BAD_FLAGS; |
| 75 | default: |
| 76 | throw new IllegalArgumentException("Illegal wire value for type OFFlowModFailedCode in version 1.2: " + val); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | |
| 81 | public static short toWireValue(OFFlowModFailedCode e) { |
| 82 | switch(e) { |
| 83 | case UNKNOWN: |
| 84 | return UNKNOWN_VAL; |
| 85 | case TABLE_FULL: |
| 86 | return TABLE_FULL_VAL; |
| 87 | case BAD_TABLE_ID: |
| 88 | return BAD_TABLE_ID_VAL; |
| 89 | case OVERLAP: |
| 90 | return OVERLAP_VAL; |
| 91 | case EPERM: |
| 92 | return EPERM_VAL; |
| 93 | case BAD_TIMEOUT: |
| 94 | return BAD_TIMEOUT_VAL; |
| 95 | case BAD_COMMAND: |
| 96 | return BAD_COMMAND_VAL; |
| 97 | case BAD_FLAGS: |
| 98 | return BAD_FLAGS_VAL; |
| 99 | default: |
| 100 | throw new IllegalArgumentException("Illegal enum value for type OFFlowModFailedCode in version 1.2: " + e); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | } |