tom | 0eb04ca | 2014-08-25 14:34:51 -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 | import java.util.Set; |
| 28 | |
| 29 | abstract class OFMessageVer10 { |
| 30 | // version: 1.0 |
| 31 | final static byte WIRE_VERSION = 1; |
| 32 | final static int MINIMUM_LENGTH = 8; |
| 33 | |
| 34 | |
| 35 | public final static OFMessageVer10.Reader READER = new Reader(); |
| 36 | |
| 37 | static class Reader implements OFMessageReader<OFMessage> { |
| 38 | @Override |
| 39 | public OFMessage readFrom(ChannelBuffer bb) throws OFParseError { |
| 40 | if(bb.readableBytes() < MINIMUM_LENGTH) |
| 41 | return null; |
| 42 | int start = bb.readerIndex(); |
| 43 | // fixed value property version == 1 |
| 44 | byte version = bb.readByte(); |
| 45 | if(version != (byte) 0x1) |
| 46 | throw new OFParseError("Wrong version: Expected=OFVersion.OF_10(1), got="+version); |
| 47 | byte type = bb.readByte(); |
| 48 | bb.readerIndex(start); |
| 49 | switch(type) { |
| 50 | case (byte) 0x11: |
| 51 | // discriminator value OFType.STATS_REPLY=17 for class OFStatsReplyVer10 |
| 52 | return OFStatsReplyVer10.READER.readFrom(bb); |
| 53 | case (byte) 0x10: |
| 54 | // discriminator value OFType.STATS_REQUEST=16 for class OFStatsRequestVer10 |
| 55 | return OFStatsRequestVer10.READER.readFrom(bb); |
| 56 | case (byte) 0x1: |
| 57 | // discriminator value OFType.ERROR=1 for class OFErrorMsgVer10 |
| 58 | return OFErrorMsgVer10.READER.readFrom(bb); |
| 59 | case (byte) 0x13: |
| 60 | // discriminator value OFType.BARRIER_REPLY=19 for class OFBarrierReplyVer10 |
| 61 | return OFBarrierReplyVer10.READER.readFrom(bb); |
| 62 | case (byte) 0x12: |
| 63 | // discriminator value OFType.BARRIER_REQUEST=18 for class OFBarrierRequestVer10 |
| 64 | return OFBarrierRequestVer10.READER.readFrom(bb); |
| 65 | case (byte) 0x4: |
| 66 | // discriminator value OFType.EXPERIMENTER=4 for class OFExperimenterVer10 |
| 67 | return OFExperimenterVer10.READER.readFrom(bb); |
| 68 | case (byte) 0x3: |
| 69 | // discriminator value OFType.ECHO_REPLY=3 for class OFEchoReplyVer10 |
| 70 | return OFEchoReplyVer10.READER.readFrom(bb); |
| 71 | case (byte) 0x2: |
| 72 | // discriminator value OFType.ECHO_REQUEST=2 for class OFEchoRequestVer10 |
| 73 | return OFEchoRequestVer10.READER.readFrom(bb); |
| 74 | case (byte) 0x6: |
| 75 | // discriminator value OFType.FEATURES_REPLY=6 for class OFFeaturesReplyVer10 |
| 76 | return OFFeaturesReplyVer10.READER.readFrom(bb); |
| 77 | case (byte) 0x5: |
| 78 | // discriminator value OFType.FEATURES_REQUEST=5 for class OFFeaturesRequestVer10 |
| 79 | return OFFeaturesRequestVer10.READER.readFrom(bb); |
| 80 | case (byte) 0xe: |
| 81 | // discriminator value OFType.FLOW_MOD=14 for class OFFlowModVer10 |
| 82 | return OFFlowModVer10.READER.readFrom(bb); |
| 83 | case (byte) 0xb: |
| 84 | // discriminator value OFType.FLOW_REMOVED=11 for class OFFlowRemovedVer10 |
| 85 | return OFFlowRemovedVer10.READER.readFrom(bb); |
| 86 | case (byte) 0x8: |
| 87 | // discriminator value OFType.GET_CONFIG_REPLY=8 for class OFGetConfigReplyVer10 |
| 88 | return OFGetConfigReplyVer10.READER.readFrom(bb); |
| 89 | case (byte) 0x7: |
| 90 | // discriminator value OFType.GET_CONFIG_REQUEST=7 for class OFGetConfigRequestVer10 |
| 91 | return OFGetConfigRequestVer10.READER.readFrom(bb); |
| 92 | case (byte) 0x0: |
| 93 | // discriminator value OFType.HELLO=0 for class OFHelloVer10 |
| 94 | return OFHelloVer10.READER.readFrom(bb); |
| 95 | case (byte) 0xa: |
| 96 | // discriminator value OFType.PACKET_IN=10 for class OFPacketInVer10 |
| 97 | return OFPacketInVer10.READER.readFrom(bb); |
| 98 | case (byte) 0xd: |
| 99 | // discriminator value OFType.PACKET_OUT=13 for class OFPacketOutVer10 |
| 100 | return OFPacketOutVer10.READER.readFrom(bb); |
| 101 | case (byte) 0xf: |
| 102 | // discriminator value OFType.PORT_MOD=15 for class OFPortModVer10 |
| 103 | return OFPortModVer10.READER.readFrom(bb); |
| 104 | case (byte) 0xc: |
| 105 | // discriminator value OFType.PORT_STATUS=12 for class OFPortStatusVer10 |
| 106 | return OFPortStatusVer10.READER.readFrom(bb); |
| 107 | case (byte) 0x15: |
| 108 | // discriminator value OFType.QUEUE_GET_CONFIG_REPLY=21 for class OFQueueGetConfigReplyVer10 |
| 109 | return OFQueueGetConfigReplyVer10.READER.readFrom(bb); |
| 110 | case (byte) 0x14: |
| 111 | // discriminator value OFType.QUEUE_GET_CONFIG_REQUEST=20 for class OFQueueGetConfigRequestVer10 |
| 112 | return OFQueueGetConfigRequestVer10.READER.readFrom(bb); |
| 113 | case (byte) 0x9: |
| 114 | // discriminator value OFType.SET_CONFIG=9 for class OFSetConfigVer10 |
| 115 | return OFSetConfigVer10.READER.readFrom(bb); |
| 116 | // skip OFTableModVer10 - excluded from generation |
| 117 | default: |
| 118 | throw new OFParseError("Unknown value for discriminator type of class OFMessageVer10: " + type); |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | } |