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.ver13; |
| 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 OFErrorMsgVer13 { |
| 29 | // version: 1.3 |
| 30 | final static byte WIRE_VERSION = 4; |
| 31 | final static int MINIMUM_LENGTH = 10; |
| 32 | |
| 33 | |
| 34 | public final static OFErrorMsgVer13.Reader READER = new Reader(); |
| 35 | |
| 36 | static class Reader implements OFMessageReader<OFErrorMsg> { |
| 37 | @Override |
| 38 | public OFErrorMsg readFrom(ChannelBuffer bb) throws OFParseError { |
| 39 | if(bb.readableBytes() < MINIMUM_LENGTH) |
| 40 | return null; |
| 41 | int start = bb.readerIndex(); |
| 42 | // fixed value property version == 4 |
| 43 | byte version = bb.readByte(); |
| 44 | if(version != (byte) 0x4) |
| 45 | throw new OFParseError("Wrong version: Expected=OFVersion.OF_13(4), got="+version); |
| 46 | // fixed value property type == 1 |
| 47 | byte type = bb.readByte(); |
| 48 | if(type != (byte) 0x1) |
| 49 | throw new OFParseError("Wrong type: Expected=OFType.ERROR(1), 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 errType = bb.readShort(); |
| 55 | bb.readerIndex(start); |
| 56 | switch(errType) { |
| 57 | case (short) 0x2: |
| 58 | // discriminator value OFErrorType.BAD_ACTION=2 for class OFBadActionErrorMsgVer13 |
| 59 | return OFBadActionErrorMsgVer13.READER.readFrom(bb); |
| 60 | case (short) 0x1: |
| 61 | // discriminator value OFErrorType.BAD_REQUEST=1 for class OFBadRequestErrorMsgVer13 |
| 62 | return OFBadRequestErrorMsgVer13.READER.readFrom(bb); |
| 63 | case (short) 0x5: |
| 64 | // discriminator value OFErrorType.FLOW_MOD_FAILED=5 for class OFFlowModFailedErrorMsgVer13 |
| 65 | return OFFlowModFailedErrorMsgVer13.READER.readFrom(bb); |
| 66 | case (short) 0x0: |
| 67 | // discriminator value OFErrorType.HELLO_FAILED=0 for class OFHelloFailedErrorMsgVer13 |
| 68 | return OFHelloFailedErrorMsgVer13.READER.readFrom(bb); |
| 69 | case (short) 0x7: |
| 70 | // discriminator value OFErrorType.PORT_MOD_FAILED=7 for class OFPortModFailedErrorMsgVer13 |
| 71 | return OFPortModFailedErrorMsgVer13.READER.readFrom(bb); |
| 72 | case (short) 0x9: |
| 73 | // discriminator value OFErrorType.QUEUE_OP_FAILED=9 for class OFQueueOpFailedErrorMsgVer13 |
| 74 | return OFQueueOpFailedErrorMsgVer13.READER.readFrom(bb); |
| 75 | case (short) 0x3: |
| 76 | // discriminator value OFErrorType.BAD_INSTRUCTION=3 for class OFBadInstructionErrorMsgVer13 |
| 77 | return OFBadInstructionErrorMsgVer13.READER.readFrom(bb); |
| 78 | case (short) 0x4: |
| 79 | // discriminator value OFErrorType.BAD_MATCH=4 for class OFBadMatchErrorMsgVer13 |
| 80 | return OFBadMatchErrorMsgVer13.READER.readFrom(bb); |
| 81 | case (short) 0x6: |
| 82 | // discriminator value OFErrorType.GROUP_MOD_FAILED=6 for class OFGroupModFailedErrorMsgVer13 |
| 83 | return OFGroupModFailedErrorMsgVer13.READER.readFrom(bb); |
| 84 | case (short) 0xa: |
| 85 | // discriminator value OFErrorType.SWITCH_CONFIG_FAILED=10 for class OFSwitchConfigFailedErrorMsgVer13 |
| 86 | return OFSwitchConfigFailedErrorMsgVer13.READER.readFrom(bb); |
| 87 | case (short) 0x8: |
| 88 | // discriminator value OFErrorType.TABLE_MOD_FAILED=8 for class OFTableModFailedErrorMsgVer13 |
| 89 | return OFTableModFailedErrorMsgVer13.READER.readFrom(bb); |
| 90 | case (short) 0xffff: |
| 91 | // discriminator value OFErrorType.EXPERIMENTER=65535 for class OFExperimenterErrorMsgVer13 |
| 92 | return OFExperimenterErrorMsgVer13.READER.readFrom(bb); |
| 93 | case (short) 0xb: |
| 94 | // discriminator value OFErrorType.ROLE_REQUEST_FAILED=11 for class OFRoleRequestFailedErrorMsgVer13 |
| 95 | return OFRoleRequestFailedErrorMsgVer13.READER.readFrom(bb); |
| 96 | case (short) 0xc: |
| 97 | // discriminator value OFErrorType.METER_MOD_FAILED=12 for class OFMeterModFailedErrorMsgVer13 |
| 98 | return OFMeterModFailedErrorMsgVer13.READER.readFrom(bb); |
| 99 | case (short) 0xd: |
| 100 | // discriminator value OFErrorType.TABLE_FEATURES_FAILED=13 for class OFTableFeaturesFailedErrorMsgVer13 |
| 101 | return OFTableFeaturesFailedErrorMsgVer13.READER.readFrom(bb); |
| 102 | default: |
| 103 | throw new OFParseError("Unknown value for discriminator errType of class OFErrorMsgVer13: " + errType); |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | } |