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