blob: 8026d958bc2a6c73136963277052c05d8657fd28 [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.ver13;
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.OFTableFeaturesFailedCode;
27import org.jboss.netty.buffer.ChannelBuffer;
28import com.google.common.hash.PrimitiveSink;
29
30public class OFTableFeaturesFailedCodeSerializerVer13 {
31
32 public final static short BAD_TABLE_VAL = (short) 0x0;
33 public final static short BAD_METADATA_VAL = (short) 0x1;
34 public final static short BAD_TYPE_VAL = (short) 0x2;
35 public final static short BAD_LEN_VAL = (short) 0x3;
36 public final static short BAD_ARGUMENT_VAL = (short) 0x4;
37 public final static short EPERM_VAL = (short) 0x5;
38
39 public static OFTableFeaturesFailedCode 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, OFTableFeaturesFailedCode e) {
48 bb.writeShort(toWireValue(e));
49 }
50
51 public static void putTo(OFTableFeaturesFailedCode e, PrimitiveSink sink) {
52 sink.putShort(toWireValue(e));
53 }
54
55 public static OFTableFeaturesFailedCode ofWireValue(short val) {
56 switch(val) {
57 case BAD_TABLE_VAL:
58 return OFTableFeaturesFailedCode.BAD_TABLE;
59 case BAD_METADATA_VAL:
60 return OFTableFeaturesFailedCode.BAD_METADATA;
61 case BAD_TYPE_VAL:
62 return OFTableFeaturesFailedCode.BAD_TYPE;
63 case BAD_LEN_VAL:
64 return OFTableFeaturesFailedCode.BAD_LEN;
65 case BAD_ARGUMENT_VAL:
66 return OFTableFeaturesFailedCode.BAD_ARGUMENT;
67 case EPERM_VAL:
68 return OFTableFeaturesFailedCode.EPERM;
69 default:
70 throw new IllegalArgumentException("Illegal wire value for type OFTableFeaturesFailedCode in version 1.3: " + val);
71 }
72 }
73
74
75 public static short toWireValue(OFTableFeaturesFailedCode e) {
76 switch(e) {
77 case BAD_TABLE:
78 return BAD_TABLE_VAL;
79 case BAD_METADATA:
80 return BAD_METADATA_VAL;
81 case BAD_TYPE:
82 return BAD_TYPE_VAL;
83 case BAD_LEN:
84 return BAD_LEN_VAL;
85 case BAD_ARGUMENT:
86 return BAD_ARGUMENT_VAL;
87 case EPERM:
88 return EPERM_VAL;
89 default:
90 throw new IllegalArgumentException("Illegal enum value for type OFTableFeaturesFailedCode in version 1.3: " + e);
91 }
92 }
93
94}