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.OFTableFeaturePropType; |
| 27 | import org.jboss.netty.buffer.ChannelBuffer; |
| 28 | import com.google.common.hash.PrimitiveSink; |
| 29 | |
| 30 | public class OFTableFeaturePropTypeSerializerVer13 { |
| 31 | |
| 32 | public final static short INSTRUCTIONS_VAL = (short) 0x0; |
| 33 | public final static short INSTRUCTIONS_MISS_VAL = (short) 0x1; |
| 34 | public final static short NEXT_TABLES_VAL = (short) 0x2; |
| 35 | public final static short NEXT_TABLES_MISS_VAL = (short) 0x3; |
| 36 | public final static short WRITE_ACTIONS_VAL = (short) 0x4; |
| 37 | public final static short WRITE_ACTIONS_MISS_VAL = (short) 0x5; |
| 38 | public final static short APPLY_ACTIONS_VAL = (short) 0x6; |
| 39 | public final static short APPLY_ACTIONS_MISS_VAL = (short) 0x7; |
| 40 | public final static short MATCH_VAL = (short) 0x8; |
| 41 | public final static short WILDCARDS_VAL = (short) 0xa; |
| 42 | public final static short WRITE_SETFIELD_VAL = (short) 0xc; |
| 43 | public final static short WRITE_SETFIELD_MISS_VAL = (short) 0xd; |
| 44 | public final static short APPLY_SETFIELD_VAL = (short) 0xe; |
| 45 | public final static short APPLY_SETFIELD_MISS_VAL = (short) 0xf; |
| 46 | public final static short EXPERIMENTER_VAL = (short) 0xfffe; |
| 47 | public final static short EXPERIMENTER_MISS_VAL = (short) 0xffff; |
| 48 | |
| 49 | public static OFTableFeaturePropType 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, OFTableFeaturePropType e) { |
| 58 | bb.writeShort(toWireValue(e)); |
| 59 | } |
| 60 | |
| 61 | public static void putTo(OFTableFeaturePropType e, PrimitiveSink sink) { |
| 62 | sink.putShort(toWireValue(e)); |
| 63 | } |
| 64 | |
| 65 | public static OFTableFeaturePropType ofWireValue(short val) { |
| 66 | switch(val) { |
| 67 | case INSTRUCTIONS_VAL: |
| 68 | return OFTableFeaturePropType.INSTRUCTIONS; |
| 69 | case INSTRUCTIONS_MISS_VAL: |
| 70 | return OFTableFeaturePropType.INSTRUCTIONS_MISS; |
| 71 | case NEXT_TABLES_VAL: |
| 72 | return OFTableFeaturePropType.NEXT_TABLES; |
| 73 | case NEXT_TABLES_MISS_VAL: |
| 74 | return OFTableFeaturePropType.NEXT_TABLES_MISS; |
| 75 | case WRITE_ACTIONS_VAL: |
| 76 | return OFTableFeaturePropType.WRITE_ACTIONS; |
| 77 | case WRITE_ACTIONS_MISS_VAL: |
| 78 | return OFTableFeaturePropType.WRITE_ACTIONS_MISS; |
| 79 | case APPLY_ACTIONS_VAL: |
| 80 | return OFTableFeaturePropType.APPLY_ACTIONS; |
| 81 | case APPLY_ACTIONS_MISS_VAL: |
| 82 | return OFTableFeaturePropType.APPLY_ACTIONS_MISS; |
| 83 | case MATCH_VAL: |
| 84 | return OFTableFeaturePropType.MATCH; |
| 85 | case WILDCARDS_VAL: |
| 86 | return OFTableFeaturePropType.WILDCARDS; |
| 87 | case WRITE_SETFIELD_VAL: |
| 88 | return OFTableFeaturePropType.WRITE_SETFIELD; |
| 89 | case WRITE_SETFIELD_MISS_VAL: |
| 90 | return OFTableFeaturePropType.WRITE_SETFIELD_MISS; |
| 91 | case APPLY_SETFIELD_VAL: |
| 92 | return OFTableFeaturePropType.APPLY_SETFIELD; |
| 93 | case APPLY_SETFIELD_MISS_VAL: |
| 94 | return OFTableFeaturePropType.APPLY_SETFIELD_MISS; |
| 95 | case EXPERIMENTER_VAL: |
| 96 | return OFTableFeaturePropType.EXPERIMENTER; |
| 97 | case EXPERIMENTER_MISS_VAL: |
| 98 | return OFTableFeaturePropType.EXPERIMENTER_MISS; |
| 99 | default: |
| 100 | throw new IllegalArgumentException("Illegal wire value for type OFTableFeaturePropType in version 1.3: " + val); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | |
| 105 | public static short toWireValue(OFTableFeaturePropType e) { |
| 106 | switch(e) { |
| 107 | case INSTRUCTIONS: |
| 108 | return INSTRUCTIONS_VAL; |
| 109 | case INSTRUCTIONS_MISS: |
| 110 | return INSTRUCTIONS_MISS_VAL; |
| 111 | case NEXT_TABLES: |
| 112 | return NEXT_TABLES_VAL; |
| 113 | case NEXT_TABLES_MISS: |
| 114 | return NEXT_TABLES_MISS_VAL; |
| 115 | case WRITE_ACTIONS: |
| 116 | return WRITE_ACTIONS_VAL; |
| 117 | case WRITE_ACTIONS_MISS: |
| 118 | return WRITE_ACTIONS_MISS_VAL; |
| 119 | case APPLY_ACTIONS: |
| 120 | return APPLY_ACTIONS_VAL; |
| 121 | case APPLY_ACTIONS_MISS: |
| 122 | return APPLY_ACTIONS_MISS_VAL; |
| 123 | case MATCH: |
| 124 | return MATCH_VAL; |
| 125 | case WILDCARDS: |
| 126 | return WILDCARDS_VAL; |
| 127 | case WRITE_SETFIELD: |
| 128 | return WRITE_SETFIELD_VAL; |
| 129 | case WRITE_SETFIELD_MISS: |
| 130 | return WRITE_SETFIELD_MISS_VAL; |
| 131 | case APPLY_SETFIELD: |
| 132 | return APPLY_SETFIELD_VAL; |
| 133 | case APPLY_SETFIELD_MISS: |
| 134 | return APPLY_SETFIELD_MISS_VAL; |
| 135 | case EXPERIMENTER: |
| 136 | return EXPERIMENTER_VAL; |
| 137 | case EXPERIMENTER_MISS: |
| 138 | return EXPERIMENTER_MISS_VAL; |
| 139 | default: |
| 140 | throw new IllegalArgumentException("Illegal enum value for type OFTableFeaturePropType in version 1.3: " + e); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | } |