alshabib | 86ac11c | 2014-08-14 16:14:41 -0700 | [diff] [blame] | 1 | // 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 | |
| 10 | package org.projectfloodlight.openflow.protocol.ver10; |
| 11 | |
| 12 | import org.projectfloodlight.openflow.protocol.*; |
| 13 | import org.projectfloodlight.openflow.protocol.action.*; |
| 14 | import org.projectfloodlight.openflow.protocol.actionid.*; |
| 15 | import org.projectfloodlight.openflow.protocol.bsntlv.*; |
| 16 | import org.projectfloodlight.openflow.protocol.errormsg.*; |
| 17 | import org.projectfloodlight.openflow.protocol.meterband.*; |
| 18 | import org.projectfloodlight.openflow.protocol.instruction.*; |
| 19 | import org.projectfloodlight.openflow.protocol.instructionid.*; |
| 20 | import org.projectfloodlight.openflow.protocol.match.*; |
| 21 | import org.projectfloodlight.openflow.protocol.oxm.*; |
| 22 | import org.projectfloodlight.openflow.protocol.queueprop.*; |
| 23 | import org.projectfloodlight.openflow.types.*; |
| 24 | import org.projectfloodlight.openflow.util.*; |
| 25 | import org.projectfloodlight.openflow.exceptions.*; |
| 26 | import org.jboss.netty.buffer.ChannelBuffer; |
| 27 | |
| 28 | abstract class OFStatsReplyVer10 { |
| 29 | // version: 1.0 |
| 30 | final static byte WIRE_VERSION = 1; |
| 31 | final static int MINIMUM_LENGTH = 12; |
| 32 | |
| 33 | |
| 34 | public final static OFStatsReplyVer10.Reader READER = new Reader(); |
| 35 | |
| 36 | static class Reader implements OFMessageReader<OFStatsReply> { |
| 37 | @Override |
| 38 | public OFStatsReply 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 == 17 |
| 47 | byte type = bb.readByte(); |
| 48 | if(type != (byte) 0x11) |
| 49 | throw new OFParseError("Wrong type: Expected=OFType.STATS_REPLY(17), 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 | short statsType = bb.readShort(); |
| 55 | bb.readerIndex(start); |
| 56 | switch(statsType) { |
| 57 | case (short) 0x2: |
| 58 | // discriminator value OFStatsType.AGGREGATE=2 for class OFAggregateStatsReplyVer10 |
| 59 | return OFAggregateStatsReplyVer10.READER.readFrom(bb); |
| 60 | case (short) 0xffff: |
| 61 | // discriminator value OFStatsType.EXPERIMENTER=65535 for class OFExperimenterStatsReplyVer10 |
| 62 | return OFExperimenterStatsReplyVer10.READER.readFrom(bb); |
| 63 | case (short) 0x0: |
| 64 | // discriminator value OFStatsType.DESC=0 for class OFDescStatsReplyVer10 |
| 65 | return OFDescStatsReplyVer10.READER.readFrom(bb); |
| 66 | case (short) 0x1: |
| 67 | // discriminator value OFStatsType.FLOW=1 for class OFFlowStatsReplyVer10 |
| 68 | return OFFlowStatsReplyVer10.READER.readFrom(bb); |
| 69 | case (short) 0x4: |
| 70 | // discriminator value OFStatsType.PORT=4 for class OFPortStatsReplyVer10 |
| 71 | return OFPortStatsReplyVer10.READER.readFrom(bb); |
| 72 | case (short) 0x5: |
| 73 | // discriminator value OFStatsType.QUEUE=5 for class OFQueueStatsReplyVer10 |
| 74 | return OFQueueStatsReplyVer10.READER.readFrom(bb); |
| 75 | case (short) 0x3: |
| 76 | // discriminator value OFStatsType.TABLE=3 for class OFTableStatsReplyVer10 |
| 77 | return OFTableStatsReplyVer10.READER.readFrom(bb); |
| 78 | default: |
| 79 | throw new OFParseError("Unknown value for discriminator statsType of class OFStatsReplyVer10: " + statsType); |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | } |