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.OFBadActionCode; |
| 27 | import org.jboss.netty.buffer.ChannelBuffer; |
| 28 | import com.google.common.hash.PrimitiveSink; |
| 29 | |
| 30 | public class OFBadActionCodeSerializerVer13 { |
| 31 | |
| 32 | public final static short BAD_TYPE_VAL = (short) 0x0; |
| 33 | public final static short BAD_LEN_VAL = (short) 0x1; |
| 34 | public final static short BAD_EXPERIMENTER_VAL = (short) 0x2; |
| 35 | public final static short BAD_EXPERIMENTER_TYPE_VAL = (short) 0x3; |
| 36 | public final static short BAD_OUT_PORT_VAL = (short) 0x4; |
| 37 | public final static short BAD_ARGUMENT_VAL = (short) 0x5; |
| 38 | public final static short EPERM_VAL = (short) 0x6; |
| 39 | public final static short TOO_MANY_VAL = (short) 0x7; |
| 40 | public final static short BAD_QUEUE_VAL = (short) 0x8; |
| 41 | public final static short BAD_OUT_GROUP_VAL = (short) 0x9; |
| 42 | public final static short MATCH_INCONSISTENT_VAL = (short) 0xa; |
| 43 | public final static short UNSUPPORTED_ORDER_VAL = (short) 0xb; |
| 44 | public final static short BAD_TAG_VAL = (short) 0xc; |
| 45 | public final static short BAD_SET_TYPE_VAL = (short) 0xd; |
| 46 | public final static short BAD_SET_LEN_VAL = (short) 0xe; |
| 47 | public final static short BAD_SET_ARGUMENT_VAL = (short) 0xf; |
| 48 | |
| 49 | public static OFBadActionCode readFrom(ChannelBuffer bb) throws OFParseError { |
| 50 | try { |
| 51 | return ofWireValue(bb.readShort()); |
| 52 | } catch (IllegalArgumentException e) { |
| 53 | throw new OFParseError(e); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | public static void writeTo(ChannelBuffer bb, OFBadActionCode e) { |
| 58 | bb.writeShort(toWireValue(e)); |
| 59 | } |
| 60 | |
| 61 | public static void putTo(OFBadActionCode e, PrimitiveSink sink) { |
| 62 | sink.putShort(toWireValue(e)); |
| 63 | } |
| 64 | |
| 65 | public static OFBadActionCode ofWireValue(short val) { |
| 66 | switch(val) { |
| 67 | case BAD_TYPE_VAL: |
| 68 | return OFBadActionCode.BAD_TYPE; |
| 69 | case BAD_LEN_VAL: |
| 70 | return OFBadActionCode.BAD_LEN; |
| 71 | case BAD_EXPERIMENTER_VAL: |
| 72 | return OFBadActionCode.BAD_EXPERIMENTER; |
| 73 | case BAD_EXPERIMENTER_TYPE_VAL: |
| 74 | return OFBadActionCode.BAD_EXPERIMENTER_TYPE; |
| 75 | case BAD_OUT_PORT_VAL: |
| 76 | return OFBadActionCode.BAD_OUT_PORT; |
| 77 | case BAD_ARGUMENT_VAL: |
| 78 | return OFBadActionCode.BAD_ARGUMENT; |
| 79 | case EPERM_VAL: |
| 80 | return OFBadActionCode.EPERM; |
| 81 | case TOO_MANY_VAL: |
| 82 | return OFBadActionCode.TOO_MANY; |
| 83 | case BAD_QUEUE_VAL: |
| 84 | return OFBadActionCode.BAD_QUEUE; |
| 85 | case BAD_OUT_GROUP_VAL: |
| 86 | return OFBadActionCode.BAD_OUT_GROUP; |
| 87 | case MATCH_INCONSISTENT_VAL: |
| 88 | return OFBadActionCode.MATCH_INCONSISTENT; |
| 89 | case UNSUPPORTED_ORDER_VAL: |
| 90 | return OFBadActionCode.UNSUPPORTED_ORDER; |
| 91 | case BAD_TAG_VAL: |
| 92 | return OFBadActionCode.BAD_TAG; |
| 93 | case BAD_SET_TYPE_VAL: |
| 94 | return OFBadActionCode.BAD_SET_TYPE; |
| 95 | case BAD_SET_LEN_VAL: |
| 96 | return OFBadActionCode.BAD_SET_LEN; |
| 97 | case BAD_SET_ARGUMENT_VAL: |
| 98 | return OFBadActionCode.BAD_SET_ARGUMENT; |
| 99 | default: |
| 100 | throw new IllegalArgumentException("Illegal wire value for type OFBadActionCode in version 1.3: " + val); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | |
| 105 | public static short toWireValue(OFBadActionCode e) { |
| 106 | switch(e) { |
| 107 | case BAD_TYPE: |
| 108 | return BAD_TYPE_VAL; |
| 109 | case BAD_LEN: |
| 110 | return BAD_LEN_VAL; |
| 111 | case BAD_EXPERIMENTER: |
| 112 | return BAD_EXPERIMENTER_VAL; |
| 113 | case BAD_EXPERIMENTER_TYPE: |
| 114 | return BAD_EXPERIMENTER_TYPE_VAL; |
| 115 | case BAD_OUT_PORT: |
| 116 | return BAD_OUT_PORT_VAL; |
| 117 | case BAD_ARGUMENT: |
| 118 | return BAD_ARGUMENT_VAL; |
| 119 | case EPERM: |
| 120 | return EPERM_VAL; |
| 121 | case TOO_MANY: |
| 122 | return TOO_MANY_VAL; |
| 123 | case BAD_QUEUE: |
| 124 | return BAD_QUEUE_VAL; |
| 125 | case BAD_OUT_GROUP: |
| 126 | return BAD_OUT_GROUP_VAL; |
| 127 | case MATCH_INCONSISTENT: |
| 128 | return MATCH_INCONSISTENT_VAL; |
| 129 | case UNSUPPORTED_ORDER: |
| 130 | return UNSUPPORTED_ORDER_VAL; |
| 131 | case BAD_TAG: |
| 132 | return BAD_TAG_VAL; |
| 133 | case BAD_SET_TYPE: |
| 134 | return BAD_SET_TYPE_VAL; |
| 135 | case BAD_SET_LEN: |
| 136 | return BAD_SET_LEN_VAL; |
| 137 | case BAD_SET_ARGUMENT: |
| 138 | return BAD_SET_ARGUMENT_VAL; |
| 139 | default: |
| 140 | throw new IllegalArgumentException("Illegal enum value for type OFBadActionCode in version 1.3: " + e); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | } |