blob: 81063c7a2445b8eceaa01e0ab32f9c95f9454ff7 [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.OFBsnVlanCounterT;
27import org.jboss.netty.buffer.ChannelBuffer;
28import com.google.common.hash.PrimitiveSink;
29
30public class OFBsnVlanCounterTSerializerVer13 {
31
32 public final static byte BSN_VLAN_COUNTER_RX_BYTES_VAL = (byte) 0x0;
33 public final static byte BSN_VLAN_COUNTER_RX_PACKETS_VAL = (byte) 0x1;
34 public final static byte BSN_VLAN_COUNTER_TX_BYTES_VAL = (byte) 0x2;
35 public final static byte BSN_VLAN_COUNTER_TX_PACKETS_VAL = (byte) 0x3;
36
37 public static OFBsnVlanCounterT readFrom(ChannelBuffer bb) throws OFParseError {
38 try {
39 return ofWireValue(bb.readByte());
40 } catch (IllegalArgumentException e) {
41 throw new OFParseError(e);
42 }
43 }
44
45 public static void writeTo(ChannelBuffer bb, OFBsnVlanCounterT e) {
46 bb.writeByte(toWireValue(e));
47 }
48
49 public static void putTo(OFBsnVlanCounterT e, PrimitiveSink sink) {
50 sink.putByte(toWireValue(e));
51 }
52
53 public static OFBsnVlanCounterT ofWireValue(byte val) {
54 switch(val) {
55 case BSN_VLAN_COUNTER_RX_BYTES_VAL:
56 return OFBsnVlanCounterT.BSN_VLAN_COUNTER_RX_BYTES;
57 case BSN_VLAN_COUNTER_RX_PACKETS_VAL:
58 return OFBsnVlanCounterT.BSN_VLAN_COUNTER_RX_PACKETS;
59 case BSN_VLAN_COUNTER_TX_BYTES_VAL:
60 return OFBsnVlanCounterT.BSN_VLAN_COUNTER_TX_BYTES;
61 case BSN_VLAN_COUNTER_TX_PACKETS_VAL:
62 return OFBsnVlanCounterT.BSN_VLAN_COUNTER_TX_PACKETS;
63 default:
64 throw new IllegalArgumentException("Illegal wire value for type OFBsnVlanCounterT in version 1.3: " + val);
65 }
66 }
67
68
69 public static byte toWireValue(OFBsnVlanCounterT e) {
70 switch(e) {
71 case BSN_VLAN_COUNTER_RX_BYTES:
72 return BSN_VLAN_COUNTER_RX_BYTES_VAL;
73 case BSN_VLAN_COUNTER_RX_PACKETS:
74 return BSN_VLAN_COUNTER_RX_PACKETS_VAL;
75 case BSN_VLAN_COUNTER_TX_BYTES:
76 return BSN_VLAN_COUNTER_TX_BYTES_VAL;
77 case BSN_VLAN_COUNTER_TX_PACKETS:
78 return BSN_VLAN_COUNTER_TX_PACKETS_VAL;
79 default:
80 throw new IllegalArgumentException("Illegal enum value for type OFBsnVlanCounterT in version 1.3: " + e);
81 }
82 }
83
84}