blob: 78ddd43e8dc59a93c2f32c86cf76c0defa23b9db [file] [log] [blame]
tom0eb04ca2014-08-25 14:34:51 -07001// 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
10package org.projectfloodlight.openflow.protocol.ver11;
11
12import org.projectfloodlight.openflow.protocol.*;
13import org.projectfloodlight.openflow.protocol.action.*;
14import org.projectfloodlight.openflow.protocol.actionid.*;
15import org.projectfloodlight.openflow.protocol.bsntlv.*;
16import org.projectfloodlight.openflow.protocol.errormsg.*;
17import org.projectfloodlight.openflow.protocol.meterband.*;
18import org.projectfloodlight.openflow.protocol.instruction.*;
19import org.projectfloodlight.openflow.protocol.instructionid.*;
20import org.projectfloodlight.openflow.protocol.match.*;
21import org.projectfloodlight.openflow.protocol.oxm.*;
22import org.projectfloodlight.openflow.protocol.queueprop.*;
23import org.projectfloodlight.openflow.types.*;
24import org.projectfloodlight.openflow.util.*;
25import org.projectfloodlight.openflow.exceptions.*;
26import org.projectfloodlight.openflow.protocol.OFBadInstructionCode;
27import org.jboss.netty.buffer.ChannelBuffer;
28import com.google.common.hash.PrimitiveSink;
29
30public class OFBadInstructionCodeSerializerVer11 {
31
32 public final static short UNKNOWN_INST_VAL = (short) 0x0;
33 public final static short UNSUP_INST_VAL = (short) 0x1;
34 public final static short BAD_TABLE_ID_VAL = (short) 0x2;
35 public final static short UNSUP_METADATA_VAL = (short) 0x3;
36 public final static short UNSUP_METADATA_MASK_VAL = (short) 0x4;
37 public final static short UNSUP_EXP_INST_VAL = (short) 0x5;
38
39 public static OFBadInstructionCode readFrom(ChannelBuffer bb) throws OFParseError {
40 try {
41 return ofWireValue(bb.readShort());
42 } catch (IllegalArgumentException e) {
43 throw new OFParseError(e);
44 }
45 }
46
47 public static void writeTo(ChannelBuffer bb, OFBadInstructionCode e) {
48 bb.writeShort(toWireValue(e));
49 }
50
51 public static void putTo(OFBadInstructionCode e, PrimitiveSink sink) {
52 sink.putShort(toWireValue(e));
53 }
54
55 public static OFBadInstructionCode ofWireValue(short val) {
56 switch(val) {
57 case UNKNOWN_INST_VAL:
58 return OFBadInstructionCode.UNKNOWN_INST;
59 case UNSUP_INST_VAL:
60 return OFBadInstructionCode.UNSUP_INST;
61 case BAD_TABLE_ID_VAL:
62 return OFBadInstructionCode.BAD_TABLE_ID;
63 case UNSUP_METADATA_VAL:
64 return OFBadInstructionCode.UNSUP_METADATA;
65 case UNSUP_METADATA_MASK_VAL:
66 return OFBadInstructionCode.UNSUP_METADATA_MASK;
67 case UNSUP_EXP_INST_VAL:
68 return OFBadInstructionCode.UNSUP_EXP_INST;
69 default:
70 throw new IllegalArgumentException("Illegal wire value for type OFBadInstructionCode in version 1.1: " + val);
71 }
72 }
73
74
75 public static short toWireValue(OFBadInstructionCode e) {
76 switch(e) {
77 case UNKNOWN_INST:
78 return UNKNOWN_INST_VAL;
79 case UNSUP_INST:
80 return UNSUP_INST_VAL;
81 case BAD_TABLE_ID:
82 return BAD_TABLE_ID_VAL;
83 case UNSUP_METADATA:
84 return UNSUP_METADATA_VAL;
85 case UNSUP_METADATA_MASK:
86 return UNSUP_METADATA_MASK_VAL;
87 case UNSUP_EXP_INST:
88 return UNSUP_EXP_INST_VAL;
89 default:
90 throw new IllegalArgumentException("Illegal enum value for type OFBadInstructionCode in version 1.1: " + e);
91 }
92 }
93
94}