blob: aa4c3b12b79415d8baa656a984123e3bb8837b87 [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.OFBsnVrfCounterT;
27import org.jboss.netty.buffer.ChannelBuffer;
28import com.google.common.hash.PrimitiveSink;
29
30public class OFBsnVrfCounterTSerializerVer13 {
31
32 public final static byte BSN_VRF_COUNTER_BYTES_VAL = (byte) 0x0;
33 public final static byte BSN_VRF_COUNTER_PACKETS_VAL = (byte) 0x1;
34
35 public static OFBsnVrfCounterT readFrom(ChannelBuffer bb) throws OFParseError {
36 try {
37 return ofWireValue(bb.readByte());
38 } catch (IllegalArgumentException e) {
39 throw new OFParseError(e);
40 }
41 }
42
43 public static void writeTo(ChannelBuffer bb, OFBsnVrfCounterT e) {
44 bb.writeByte(toWireValue(e));
45 }
46
47 public static void putTo(OFBsnVrfCounterT e, PrimitiveSink sink) {
48 sink.putByte(toWireValue(e));
49 }
50
51 public static OFBsnVrfCounterT ofWireValue(byte val) {
52 switch(val) {
53 case BSN_VRF_COUNTER_BYTES_VAL:
54 return OFBsnVrfCounterT.BSN_VRF_COUNTER_BYTES;
55 case BSN_VRF_COUNTER_PACKETS_VAL:
56 return OFBsnVrfCounterT.BSN_VRF_COUNTER_PACKETS;
57 default:
58 throw new IllegalArgumentException("Illegal wire value for type OFBsnVrfCounterT in version 1.3: " + val);
59 }
60 }
61
62
63 public static byte toWireValue(OFBsnVrfCounterT e) {
64 switch(e) {
65 case BSN_VRF_COUNTER_BYTES:
66 return BSN_VRF_COUNTER_BYTES_VAL;
67 case BSN_VRF_COUNTER_PACKETS:
68 return BSN_VRF_COUNTER_PACKETS_VAL;
69 default:
70 throw new IllegalArgumentException("Illegal enum value for type OFBsnVrfCounterT in version 1.3: " + e);
71 }
72 }
73
74}