blob: e30a18c474dc23c812a82731dfa281da8fa36b33 [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.ver12;
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.OFPortModFailedCode;
27import org.jboss.netty.buffer.ChannelBuffer;
28import com.google.common.hash.PrimitiveSink;
29
30public class OFPortModFailedCodeSerializerVer12 {
31
32 public final static short BAD_PORT_VAL = (short) 0x0;
33 public final static short BAD_HW_ADDR_VAL = (short) 0x1;
34 public final static short BAD_CONFIG_VAL = (short) 0x2;
35 public final static short BAD_ADVERTISE_VAL = (short) 0x3;
36 public final static short EPERM_VAL = (short) 0x4;
37
38 public static OFPortModFailedCode readFrom(ChannelBuffer bb) throws OFParseError {
39 try {
40 return ofWireValue(bb.readShort());
41 } catch (IllegalArgumentException e) {
42 throw new OFParseError(e);
43 }
44 }
45
46 public static void writeTo(ChannelBuffer bb, OFPortModFailedCode e) {
47 bb.writeShort(toWireValue(e));
48 }
49
50 public static void putTo(OFPortModFailedCode e, PrimitiveSink sink) {
51 sink.putShort(toWireValue(e));
52 }
53
54 public static OFPortModFailedCode ofWireValue(short val) {
55 switch(val) {
56 case BAD_PORT_VAL:
57 return OFPortModFailedCode.BAD_PORT;
58 case BAD_HW_ADDR_VAL:
59 return OFPortModFailedCode.BAD_HW_ADDR;
60 case BAD_CONFIG_VAL:
61 return OFPortModFailedCode.BAD_CONFIG;
62 case BAD_ADVERTISE_VAL:
63 return OFPortModFailedCode.BAD_ADVERTISE;
64 case EPERM_VAL:
65 return OFPortModFailedCode.EPERM;
66 default:
67 throw new IllegalArgumentException("Illegal wire value for type OFPortModFailedCode in version 1.2: " + val);
68 }
69 }
70
71
72 public static short toWireValue(OFPortModFailedCode e) {
73 switch(e) {
74 case BAD_PORT:
75 return BAD_PORT_VAL;
76 case BAD_HW_ADDR:
77 return BAD_HW_ADDR_VAL;
78 case BAD_CONFIG:
79 return BAD_CONFIG_VAL;
80 case BAD_ADVERTISE:
81 return BAD_ADVERTISE_VAL;
82 case EPERM:
83 return EPERM_VAL;
84 default:
85 throw new IllegalArgumentException("Illegal enum value for type OFPortModFailedCode in version 1.2: " + e);
86 }
87 }
88
89}