blob: b434decb05e05d8946fac1e6d5c19ed032e1a982 [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 of_virtual_class.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.jboss.netty.buffer.ChannelBuffer;
27
28abstract class OFFlowModVer10 {
29 // version: 1.0
30 final static byte WIRE_VERSION = 1;
31 final static int MINIMUM_LENGTH = 72;
32
33
34 public final static OFFlowModVer10.Reader READER = new Reader();
35
36 static class Reader implements OFMessageReader<OFFlowMod> {
37 @Override
38 public OFFlowMod readFrom(ChannelBuffer bb) throws OFParseError {
39 if(bb.readableBytes() < MINIMUM_LENGTH)
40 return null;
41 int start = bb.readerIndex();
42 // fixed value property version == 1
43 byte version = bb.readByte();
44 if(version != (byte) 0x1)
45 throw new OFParseError("Wrong version: Expected=OFVersion.OF_10(1), got="+version);
46 // fixed value property type == 14
47 byte type = bb.readByte();
48 if(type != (byte) 0xe)
49 throw new OFParseError("Wrong type: Expected=OFType.FLOW_MOD(14), got="+type);
50 int length = U16.f(bb.readShort());
51 if(length < MINIMUM_LENGTH)
52 throw new OFParseError("Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length);
53 U32.f(bb.readInt());
54 ChannelUtilsVer10.readOFMatch(bb);
55 U64.ofRaw(bb.readLong());
56 short command = bb.readShort();
57 bb.readerIndex(start);
58 switch(command) {
59 case (short) 0x0:
60 // discriminator value OFFlowModCommand.ADD=0 for class OFFlowAddVer10
61 return OFFlowAddVer10.READER.readFrom(bb);
62 case (short) 0x3:
63 // discriminator value OFFlowModCommand.DELETE=3 for class OFFlowDeleteVer10
64 return OFFlowDeleteVer10.READER.readFrom(bb);
65 case (short) 0x4:
66 // discriminator value OFFlowModCommand.DELETE_STRICT=4 for class OFFlowDeleteStrictVer10
67 return OFFlowDeleteStrictVer10.READER.readFrom(bb);
68 case (short) 0x1:
69 // discriminator value OFFlowModCommand.MODIFY=1 for class OFFlowModifyVer10
70 return OFFlowModifyVer10.READER.readFrom(bb);
71 case (short) 0x2:
72 // discriminator value OFFlowModCommand.MODIFY_STRICT=2 for class OFFlowModifyStrictVer10
73 return OFFlowModifyStrictVer10.READER.readFrom(bb);
74 default:
75 throw new OFParseError("Unknown value for discriminator command of class OFFlowModVer10: " + command);
76 }
77 }
78 }
79}