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.ver11; |
| 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.OFActionType; |
| 27 | import org.jboss.netty.buffer.ChannelBuffer; |
| 28 | import com.google.common.hash.PrimitiveSink; |
| 29 | |
| 30 | public class OFActionTypeSerializerVer11 { |
| 31 | |
| 32 | public final static short OUTPUT_VAL = (short) 0x0; |
| 33 | public final static short SET_VLAN_VID_VAL = (short) 0x1; |
| 34 | public final static short SET_VLAN_PCP_VAL = (short) 0x2; |
| 35 | public final static short SET_DL_SRC_VAL = (short) 0x3; |
| 36 | public final static short SET_DL_DST_VAL = (short) 0x4; |
| 37 | public final static short SET_NW_SRC_VAL = (short) 0x5; |
| 38 | public final static short SET_NW_DST_VAL = (short) 0x6; |
| 39 | public final static short SET_NW_TOS_VAL = (short) 0x7; |
| 40 | public final static short SET_NW_ECN_VAL = (short) 0x8; |
| 41 | public final static short SET_TP_SRC_VAL = (short) 0x9; |
| 42 | public final static short SET_TP_DST_VAL = (short) 0xa; |
| 43 | public final static short COPY_TTL_OUT_VAL = (short) 0xb; |
| 44 | public final static short COPY_TTL_IN_VAL = (short) 0xc; |
| 45 | public final static short SET_MPLS_LABEL_VAL = (short) 0xd; |
| 46 | public final static short SET_MPLS_TC_VAL = (short) 0xe; |
| 47 | public final static short SET_MPLS_TTL_VAL = (short) 0xf; |
| 48 | public final static short DEC_MPLS_TTL_VAL = (short) 0x10; |
| 49 | public final static short PUSH_VLAN_VAL = (short) 0x11; |
| 50 | public final static short POP_VLAN_VAL = (short) 0x12; |
| 51 | public final static short PUSH_MPLS_VAL = (short) 0x13; |
| 52 | public final static short POP_MPLS_VAL = (short) 0x14; |
| 53 | public final static short SET_QUEUE_VAL = (short) 0x15; |
| 54 | public final static short GROUP_VAL = (short) 0x16; |
| 55 | public final static short SET_NW_TTL_VAL = (short) 0x17; |
| 56 | public final static short DEC_NW_TTL_VAL = (short) 0x18; |
| 57 | public final static short EXPERIMENTER_VAL = (short) 0xffff; |
| 58 | |
| 59 | public static OFActionType readFrom(ChannelBuffer bb) throws OFParseError { |
| 60 | try { |
| 61 | return ofWireValue(bb.readShort()); |
| 62 | } catch (IllegalArgumentException e) { |
| 63 | throw new OFParseError(e); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | public static void writeTo(ChannelBuffer bb, OFActionType e) { |
| 68 | bb.writeShort(toWireValue(e)); |
| 69 | } |
| 70 | |
| 71 | public static void putTo(OFActionType e, PrimitiveSink sink) { |
| 72 | sink.putShort(toWireValue(e)); |
| 73 | } |
| 74 | |
| 75 | public static OFActionType ofWireValue(short val) { |
| 76 | switch(val) { |
| 77 | case OUTPUT_VAL: |
| 78 | return OFActionType.OUTPUT; |
| 79 | case SET_VLAN_VID_VAL: |
| 80 | return OFActionType.SET_VLAN_VID; |
| 81 | case SET_VLAN_PCP_VAL: |
| 82 | return OFActionType.SET_VLAN_PCP; |
| 83 | case SET_DL_SRC_VAL: |
| 84 | return OFActionType.SET_DL_SRC; |
| 85 | case SET_DL_DST_VAL: |
| 86 | return OFActionType.SET_DL_DST; |
| 87 | case SET_NW_SRC_VAL: |
| 88 | return OFActionType.SET_NW_SRC; |
| 89 | case SET_NW_DST_VAL: |
| 90 | return OFActionType.SET_NW_DST; |
| 91 | case SET_NW_TOS_VAL: |
| 92 | return OFActionType.SET_NW_TOS; |
| 93 | case SET_NW_ECN_VAL: |
| 94 | return OFActionType.SET_NW_ECN; |
| 95 | case SET_TP_SRC_VAL: |
| 96 | return OFActionType.SET_TP_SRC; |
| 97 | case SET_TP_DST_VAL: |
| 98 | return OFActionType.SET_TP_DST; |
| 99 | case COPY_TTL_OUT_VAL: |
| 100 | return OFActionType.COPY_TTL_OUT; |
| 101 | case COPY_TTL_IN_VAL: |
| 102 | return OFActionType.COPY_TTL_IN; |
| 103 | case SET_MPLS_LABEL_VAL: |
| 104 | return OFActionType.SET_MPLS_LABEL; |
| 105 | case SET_MPLS_TC_VAL: |
| 106 | return OFActionType.SET_MPLS_TC; |
| 107 | case SET_MPLS_TTL_VAL: |
| 108 | return OFActionType.SET_MPLS_TTL; |
| 109 | case DEC_MPLS_TTL_VAL: |
| 110 | return OFActionType.DEC_MPLS_TTL; |
| 111 | case PUSH_VLAN_VAL: |
| 112 | return OFActionType.PUSH_VLAN; |
| 113 | case POP_VLAN_VAL: |
| 114 | return OFActionType.POP_VLAN; |
| 115 | case PUSH_MPLS_VAL: |
| 116 | return OFActionType.PUSH_MPLS; |
| 117 | case POP_MPLS_VAL: |
| 118 | return OFActionType.POP_MPLS; |
| 119 | case SET_QUEUE_VAL: |
| 120 | return OFActionType.SET_QUEUE; |
| 121 | case GROUP_VAL: |
| 122 | return OFActionType.GROUP; |
| 123 | case SET_NW_TTL_VAL: |
| 124 | return OFActionType.SET_NW_TTL; |
| 125 | case DEC_NW_TTL_VAL: |
| 126 | return OFActionType.DEC_NW_TTL; |
| 127 | case EXPERIMENTER_VAL: |
| 128 | return OFActionType.EXPERIMENTER; |
| 129 | default: |
| 130 | throw new IllegalArgumentException("Illegal wire value for type OFActionType in version 1.1: " + val); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | |
| 135 | public static short toWireValue(OFActionType e) { |
| 136 | switch(e) { |
| 137 | case OUTPUT: |
| 138 | return OUTPUT_VAL; |
| 139 | case SET_VLAN_VID: |
| 140 | return SET_VLAN_VID_VAL; |
| 141 | case SET_VLAN_PCP: |
| 142 | return SET_VLAN_PCP_VAL; |
| 143 | case SET_DL_SRC: |
| 144 | return SET_DL_SRC_VAL; |
| 145 | case SET_DL_DST: |
| 146 | return SET_DL_DST_VAL; |
| 147 | case SET_NW_SRC: |
| 148 | return SET_NW_SRC_VAL; |
| 149 | case SET_NW_DST: |
| 150 | return SET_NW_DST_VAL; |
| 151 | case SET_NW_TOS: |
| 152 | return SET_NW_TOS_VAL; |
| 153 | case SET_NW_ECN: |
| 154 | return SET_NW_ECN_VAL; |
| 155 | case SET_TP_SRC: |
| 156 | return SET_TP_SRC_VAL; |
| 157 | case SET_TP_DST: |
| 158 | return SET_TP_DST_VAL; |
| 159 | case COPY_TTL_OUT: |
| 160 | return COPY_TTL_OUT_VAL; |
| 161 | case COPY_TTL_IN: |
| 162 | return COPY_TTL_IN_VAL; |
| 163 | case SET_MPLS_LABEL: |
| 164 | return SET_MPLS_LABEL_VAL; |
| 165 | case SET_MPLS_TC: |
| 166 | return SET_MPLS_TC_VAL; |
| 167 | case SET_MPLS_TTL: |
| 168 | return SET_MPLS_TTL_VAL; |
| 169 | case DEC_MPLS_TTL: |
| 170 | return DEC_MPLS_TTL_VAL; |
| 171 | case PUSH_VLAN: |
| 172 | return PUSH_VLAN_VAL; |
| 173 | case POP_VLAN: |
| 174 | return POP_VLAN_VAL; |
| 175 | case PUSH_MPLS: |
| 176 | return PUSH_MPLS_VAL; |
| 177 | case POP_MPLS: |
| 178 | return POP_MPLS_VAL; |
| 179 | case SET_QUEUE: |
| 180 | return SET_QUEUE_VAL; |
| 181 | case GROUP: |
| 182 | return GROUP_VAL; |
| 183 | case SET_NW_TTL: |
| 184 | return SET_NW_TTL_VAL; |
| 185 | case DEC_NW_TTL: |
| 186 | return DEC_NW_TTL_VAL; |
| 187 | case EXPERIMENTER: |
| 188 | return EXPERIMENTER_VAL; |
| 189 | default: |
| 190 | throw new IllegalArgumentException("Illegal enum value for type OFActionType in version 1.1: " + e); |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | } |