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_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 OFInstructionBsnDisableVlanCountersVer13 implements OFInstructionBsnDisableVlanCounters { |
| 33 | private static final Logger logger = LoggerFactory.getLogger(OFInstructionBsnDisableVlanCountersVer13.class); |
| 34 | // version: 1.3 |
| 35 | final static byte WIRE_VERSION = 4; |
| 36 | final static int LENGTH = 16; |
| 37 | |
| 38 | |
| 39 | // OF message fields |
| 40 | // |
| 41 | // Immutable default instance |
| 42 | final static OFInstructionBsnDisableVlanCountersVer13 DEFAULT = new OFInstructionBsnDisableVlanCountersVer13( |
| 43 | |
| 44 | ); |
| 45 | |
| 46 | final static OFInstructionBsnDisableVlanCountersVer13 INSTANCE = new OFInstructionBsnDisableVlanCountersVer13(); |
| 47 | // private empty constructor - use shared instance! |
| 48 | private OFInstructionBsnDisableVlanCountersVer13() { |
| 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 0x9L; |
| 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 OFInstructionBsnDisableVlanCounters.Builder createBuilder() { |
| 76 | throw new UnsupportedOperationException("OFInstructionBsnDisableVlanCountersVer13 has no mutable properties -- builder unneeded"); |
| 77 | } |
| 78 | |
| 79 | |
| 80 | final static Reader READER = new Reader(); |
| 81 | static class Reader implements OFMessageReader<OFInstructionBsnDisableVlanCounters> { |
| 82 | @Override |
| 83 | public OFInstructionBsnDisableVlanCounters 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 != 16) |
| 91 | throw new OFParseError("Wrong length: Expected=16(16), 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 == 0x9L |
| 104 | int subtype = bb.readInt(); |
| 105 | if(subtype != 0x9) |
| 106 | throw new OFParseError("Wrong subtype: Expected=0x9L(0x9L), got="+subtype); |
| 107 | // pad: 4 bytes |
| 108 | bb.skipBytes(4); |
| 109 | |
| 110 | if(logger.isTraceEnabled()) |
| 111 | logger.trace("readFrom - returning shared instance={}", INSTANCE); |
| 112 | return INSTANCE; |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | public void putTo(PrimitiveSink sink) { |
| 117 | FUNNEL.funnel(this, sink); |
| 118 | } |
| 119 | |
| 120 | final static OFInstructionBsnDisableVlanCountersVer13Funnel FUNNEL = new OFInstructionBsnDisableVlanCountersVer13Funnel(); |
| 121 | static class OFInstructionBsnDisableVlanCountersVer13Funnel implements Funnel<OFInstructionBsnDisableVlanCountersVer13> { |
| 122 | private static final long serialVersionUID = 1L; |
| 123 | @Override |
| 124 | public void funnel(OFInstructionBsnDisableVlanCountersVer13 message, PrimitiveSink sink) { |
| 125 | // fixed value property type = 65535 |
| 126 | sink.putShort((short) 0xffff); |
| 127 | // fixed value property length = 16 |
| 128 | sink.putShort((short) 0x10); |
| 129 | // fixed value property experimenter = 0x5c16c7L |
| 130 | sink.putInt(0x5c16c7); |
| 131 | // fixed value property subtype = 0x9L |
| 132 | sink.putInt(0x9); |
| 133 | // skip pad (4 bytes) |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | |
| 138 | public void writeTo(ChannelBuffer bb) { |
| 139 | WRITER.write(bb, this); |
| 140 | } |
| 141 | |
| 142 | final static Writer WRITER = new Writer(); |
| 143 | static class Writer implements OFMessageWriter<OFInstructionBsnDisableVlanCountersVer13> { |
| 144 | @Override |
| 145 | public void write(ChannelBuffer bb, OFInstructionBsnDisableVlanCountersVer13 message) { |
| 146 | // fixed value property type = 65535 |
| 147 | bb.writeShort((short) 0xffff); |
| 148 | // fixed value property length = 16 |
| 149 | bb.writeShort((short) 0x10); |
| 150 | // fixed value property experimenter = 0x5c16c7L |
| 151 | bb.writeInt(0x5c16c7); |
| 152 | // fixed value property subtype = 0x9L |
| 153 | bb.writeInt(0x9); |
| 154 | // pad: 4 bytes |
| 155 | bb.writeZero(4); |
| 156 | |
| 157 | |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | @Override |
| 162 | public String toString() { |
| 163 | StringBuilder b = new StringBuilder("OFInstructionBsnDisableVlanCountersVer13("); |
| 164 | b.append(")"); |
| 165 | return b.toString(); |
| 166 | } |
| 167 | |
| 168 | @Override |
| 169 | public boolean equals(Object obj) { |
| 170 | if (this == obj) |
| 171 | return true; |
| 172 | if (obj == null) |
| 173 | return false; |
| 174 | if (getClass() != obj.getClass()) |
| 175 | return false; |
| 176 | |
| 177 | return true; |
| 178 | } |
| 179 | |
| 180 | @Override |
| 181 | public int hashCode() { |
| 182 | int result = 1; |
| 183 | |
| 184 | return result; |
| 185 | } |
| 186 | |
| 187 | } |