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_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.slf4j.Logger; |
| 27 | import org.slf4j.LoggerFactory; |
| 28 | import org.jboss.netty.buffer.ChannelBuffer; |
| 29 | import com.google.common.hash.PrimitiveSink; |
| 30 | import com.google.common.hash.Funnel; |
| 31 | |
| 32 | class OFInstructionIdBsnDisableSplitHorizonCheckVer13 implements OFInstructionIdBsnDisableSplitHorizonCheck { |
| 33 | private static final Logger logger = LoggerFactory.getLogger(OFInstructionIdBsnDisableSplitHorizonCheckVer13.class); |
| 34 | // version: 1.3 |
| 35 | final static byte WIRE_VERSION = 4; |
| 36 | final static int LENGTH = 12; |
| 37 | |
| 38 | |
| 39 | // OF message fields |
| 40 | // |
| 41 | // Immutable default instance |
| 42 | final static OFInstructionIdBsnDisableSplitHorizonCheckVer13 DEFAULT = new OFInstructionIdBsnDisableSplitHorizonCheckVer13( |
| 43 | |
| 44 | ); |
| 45 | |
| 46 | final static OFInstructionIdBsnDisableSplitHorizonCheckVer13 INSTANCE = new OFInstructionIdBsnDisableSplitHorizonCheckVer13(); |
| 47 | // private empty constructor - use shared instance! |
| 48 | private OFInstructionIdBsnDisableSplitHorizonCheckVer13() { |
| 49 | } |
| 50 | |
| 51 | // Accessors for OF message fields |
| 52 | @Override |
| 53 | public OFInstructionType getType() { |
| 54 | return OFInstructionType.EXPERIMENTER; |
| 55 | } |
| 56 | |
| 57 | @Override |
| 58 | public long getExperimenter() { |
| 59 | return 0x5c16c7L; |
| 60 | } |
| 61 | |
| 62 | @Override |
| 63 | public long getSubtype() { |
| 64 | return 0x3L; |
| 65 | } |
| 66 | |
| 67 | @Override |
| 68 | public OFVersion getVersion() { |
| 69 | return OFVersion.OF_13; |
| 70 | } |
| 71 | |
| 72 | |
| 73 | |
| 74 | // no data members - do not support builder |
| 75 | public OFInstructionIdBsnDisableSplitHorizonCheck.Builder createBuilder() { |
| 76 | throw new UnsupportedOperationException("OFInstructionIdBsnDisableSplitHorizonCheckVer13 has no mutable properties -- builder unneeded"); |
| 77 | } |
| 78 | |
| 79 | |
| 80 | final static Reader READER = new Reader(); |
| 81 | static class Reader implements OFMessageReader<OFInstructionIdBsnDisableSplitHorizonCheck> { |
| 82 | @Override |
| 83 | public OFInstructionIdBsnDisableSplitHorizonCheck readFrom(ChannelBuffer bb) throws OFParseError { |
| 84 | int start = bb.readerIndex(); |
| 85 | // fixed value property type == 65535 |
| 86 | short type = bb.readShort(); |
| 87 | if(type != (short) 0xffff) |
| 88 | throw new OFParseError("Wrong type: Expected=OFInstructionType.EXPERIMENTER(65535), got="+type); |
| 89 | int length = U16.f(bb.readShort()); |
| 90 | if(length != 12) |
| 91 | throw new OFParseError("Wrong length: Expected=12(12), got="+length); |
| 92 | if(bb.readableBytes() + (bb.readerIndex() - start) < length) { |
| 93 | // Buffer does not have all data yet |
| 94 | bb.readerIndex(start); |
| 95 | return null; |
| 96 | } |
| 97 | if(logger.isTraceEnabled()) |
| 98 | logger.trace("readFrom - length={}", length); |
| 99 | // fixed value property experimenter == 0x5c16c7L |
| 100 | int experimenter = bb.readInt(); |
| 101 | if(experimenter != 0x5c16c7) |
| 102 | throw new OFParseError("Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got="+experimenter); |
| 103 | // fixed value property subtype == 0x3L |
| 104 | int subtype = bb.readInt(); |
| 105 | if(subtype != 0x3) |
| 106 | throw new OFParseError("Wrong subtype: Expected=0x3L(0x3L), got="+subtype); |
| 107 | |
| 108 | if(logger.isTraceEnabled()) |
| 109 | logger.trace("readFrom - returning shared instance={}", INSTANCE); |
| 110 | return INSTANCE; |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | public void putTo(PrimitiveSink sink) { |
| 115 | FUNNEL.funnel(this, sink); |
| 116 | } |
| 117 | |
| 118 | final static OFInstructionIdBsnDisableSplitHorizonCheckVer13Funnel FUNNEL = new OFInstructionIdBsnDisableSplitHorizonCheckVer13Funnel(); |
| 119 | static class OFInstructionIdBsnDisableSplitHorizonCheckVer13Funnel implements Funnel<OFInstructionIdBsnDisableSplitHorizonCheckVer13> { |
| 120 | private static final long serialVersionUID = 1L; |
| 121 | @Override |
| 122 | public void funnel(OFInstructionIdBsnDisableSplitHorizonCheckVer13 message, PrimitiveSink sink) { |
| 123 | // fixed value property type = 65535 |
| 124 | sink.putShort((short) 0xffff); |
| 125 | // fixed value property length = 12 |
| 126 | sink.putShort((short) 0xc); |
| 127 | // fixed value property experimenter = 0x5c16c7L |
| 128 | sink.putInt(0x5c16c7); |
| 129 | // fixed value property subtype = 0x3L |
| 130 | sink.putInt(0x3); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | |
| 135 | public void writeTo(ChannelBuffer bb) { |
| 136 | WRITER.write(bb, this); |
| 137 | } |
| 138 | |
| 139 | final static Writer WRITER = new Writer(); |
| 140 | static class Writer implements OFMessageWriter<OFInstructionIdBsnDisableSplitHorizonCheckVer13> { |
| 141 | @Override |
| 142 | public void write(ChannelBuffer bb, OFInstructionIdBsnDisableSplitHorizonCheckVer13 message) { |
| 143 | // fixed value property type = 65535 |
| 144 | bb.writeShort((short) 0xffff); |
| 145 | // fixed value property length = 12 |
| 146 | bb.writeShort((short) 0xc); |
| 147 | // fixed value property experimenter = 0x5c16c7L |
| 148 | bb.writeInt(0x5c16c7); |
| 149 | // fixed value property subtype = 0x3L |
| 150 | bb.writeInt(0x3); |
| 151 | |
| 152 | |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | @Override |
| 157 | public String toString() { |
| 158 | StringBuilder b = new StringBuilder("OFInstructionIdBsnDisableSplitHorizonCheckVer13("); |
| 159 | b.append(")"); |
| 160 | return b.toString(); |
| 161 | } |
| 162 | |
| 163 | @Override |
| 164 | public boolean equals(Object obj) { |
| 165 | if (this == obj) |
| 166 | return true; |
| 167 | if (obj == null) |
| 168 | return false; |
| 169 | if (getClass() != obj.getClass()) |
| 170 | return false; |
| 171 | |
| 172 | return true; |
| 173 | } |
| 174 | |
| 175 | @Override |
| 176 | public int hashCode() { |
| 177 | int result = 1; |
| 178 | |
| 179 | return result; |
| 180 | } |
| 181 | |
| 182 | } |