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.OFBadRequestCode; |
| 27 | import org.jboss.netty.buffer.ChannelBuffer; |
| 28 | import com.google.common.hash.PrimitiveSink; |
| 29 | |
| 30 | public class OFBadRequestCodeSerializerVer13 { |
| 31 | |
| 32 | public final static short BAD_VERSION_VAL = (short) 0x0; |
| 33 | public final static short BAD_TYPE_VAL = (short) 0x1; |
| 34 | public final static short BAD_STAT_VAL = (short) 0x2; |
| 35 | public final static short BAD_EXPERIMENTER_VAL = (short) 0x3; |
| 36 | public final static short BAD_EXPERIMENTER_TYPE_VAL = (short) 0x4; |
| 37 | public final static short EPERM_VAL = (short) 0x5; |
| 38 | public final static short BAD_LEN_VAL = (short) 0x6; |
| 39 | public final static short BUFFER_EMPTY_VAL = (short) 0x7; |
| 40 | public final static short BUFFER_UNKNOWN_VAL = (short) 0x8; |
| 41 | public final static short BAD_TABLE_ID_VAL = (short) 0x9; |
| 42 | public final static short IS_SLAVE_VAL = (short) 0xa; |
| 43 | public final static short BAD_PORT_VAL = (short) 0xb; |
| 44 | public final static short BAD_PACKET_VAL = (short) 0xc; |
| 45 | public final static short MULTIPART_BUFFER_OVERFLOW_VAL = (short) 0xd; |
| 46 | |
| 47 | public static OFBadRequestCode readFrom(ChannelBuffer bb) throws OFParseError { |
| 48 | try { |
| 49 | return ofWireValue(bb.readShort()); |
| 50 | } catch (IllegalArgumentException e) { |
| 51 | throw new OFParseError(e); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | public static void writeTo(ChannelBuffer bb, OFBadRequestCode e) { |
| 56 | bb.writeShort(toWireValue(e)); |
| 57 | } |
| 58 | |
| 59 | public static void putTo(OFBadRequestCode e, PrimitiveSink sink) { |
| 60 | sink.putShort(toWireValue(e)); |
| 61 | } |
| 62 | |
| 63 | public static OFBadRequestCode ofWireValue(short val) { |
| 64 | switch(val) { |
| 65 | case BAD_VERSION_VAL: |
| 66 | return OFBadRequestCode.BAD_VERSION; |
| 67 | case BAD_TYPE_VAL: |
| 68 | return OFBadRequestCode.BAD_TYPE; |
| 69 | case BAD_STAT_VAL: |
| 70 | return OFBadRequestCode.BAD_STAT; |
| 71 | case BAD_EXPERIMENTER_VAL: |
| 72 | return OFBadRequestCode.BAD_EXPERIMENTER; |
| 73 | case BAD_EXPERIMENTER_TYPE_VAL: |
| 74 | return OFBadRequestCode.BAD_EXPERIMENTER_TYPE; |
| 75 | case EPERM_VAL: |
| 76 | return OFBadRequestCode.EPERM; |
| 77 | case BAD_LEN_VAL: |
| 78 | return OFBadRequestCode.BAD_LEN; |
| 79 | case BUFFER_EMPTY_VAL: |
| 80 | return OFBadRequestCode.BUFFER_EMPTY; |
| 81 | case BUFFER_UNKNOWN_VAL: |
| 82 | return OFBadRequestCode.BUFFER_UNKNOWN; |
| 83 | case BAD_TABLE_ID_VAL: |
| 84 | return OFBadRequestCode.BAD_TABLE_ID; |
| 85 | case IS_SLAVE_VAL: |
| 86 | return OFBadRequestCode.IS_SLAVE; |
| 87 | case BAD_PORT_VAL: |
| 88 | return OFBadRequestCode.BAD_PORT; |
| 89 | case BAD_PACKET_VAL: |
| 90 | return OFBadRequestCode.BAD_PACKET; |
| 91 | case MULTIPART_BUFFER_OVERFLOW_VAL: |
| 92 | return OFBadRequestCode.MULTIPART_BUFFER_OVERFLOW; |
| 93 | default: |
| 94 | throw new IllegalArgumentException("Illegal wire value for type OFBadRequestCode in version 1.3: " + val); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | |
| 99 | public static short toWireValue(OFBadRequestCode e) { |
| 100 | switch(e) { |
| 101 | case BAD_VERSION: |
| 102 | return BAD_VERSION_VAL; |
| 103 | case BAD_TYPE: |
| 104 | return BAD_TYPE_VAL; |
| 105 | case BAD_STAT: |
| 106 | return BAD_STAT_VAL; |
| 107 | case BAD_EXPERIMENTER: |
| 108 | return BAD_EXPERIMENTER_VAL; |
| 109 | case BAD_EXPERIMENTER_TYPE: |
| 110 | return BAD_EXPERIMENTER_TYPE_VAL; |
| 111 | case EPERM: |
| 112 | return EPERM_VAL; |
| 113 | case BAD_LEN: |
| 114 | return BAD_LEN_VAL; |
| 115 | case BUFFER_EMPTY: |
| 116 | return BUFFER_EMPTY_VAL; |
| 117 | case BUFFER_UNKNOWN: |
| 118 | return BUFFER_UNKNOWN_VAL; |
| 119 | case BAD_TABLE_ID: |
| 120 | return BAD_TABLE_ID_VAL; |
| 121 | case IS_SLAVE: |
| 122 | return IS_SLAVE_VAL; |
| 123 | case BAD_PORT: |
| 124 | return BAD_PORT_VAL; |
| 125 | case BAD_PACKET: |
| 126 | return BAD_PACKET_VAL; |
| 127 | case MULTIPART_BUFFER_OVERFLOW: |
| 128 | return MULTIPART_BUFFER_OVERFLOW_VAL; |
| 129 | default: |
| 130 | throw new IllegalArgumentException("Illegal enum value for type OFBadRequestCode in version 1.3: " + e); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | } |