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 java.util.Set; |
| 29 | import org.jboss.netty.buffer.ChannelBuffer; |
| 30 | import com.google.common.hash.PrimitiveSink; |
| 31 | import com.google.common.hash.Funnel; |
| 32 | |
| 33 | class OFBsnGetSwitchPipelineRequestVer13 implements OFBsnGetSwitchPipelineRequest { |
| 34 | private static final Logger logger = LoggerFactory.getLogger(OFBsnGetSwitchPipelineRequestVer13.class); |
| 35 | // version: 1.3 |
| 36 | final static byte WIRE_VERSION = 4; |
| 37 | final static int LENGTH = 16; |
| 38 | |
| 39 | private final static long DEFAULT_XID = 0x0L; |
| 40 | |
| 41 | // OF message fields |
| 42 | private final long xid; |
| 43 | // |
| 44 | // Immutable default instance |
| 45 | final static OFBsnGetSwitchPipelineRequestVer13 DEFAULT = new OFBsnGetSwitchPipelineRequestVer13( |
| 46 | DEFAULT_XID |
| 47 | ); |
| 48 | |
| 49 | // package private constructor - used by readers, builders, and factory |
| 50 | OFBsnGetSwitchPipelineRequestVer13(long xid) { |
| 51 | this.xid = xid; |
| 52 | } |
| 53 | |
| 54 | // Accessors for OF message fields |
| 55 | @Override |
| 56 | public OFVersion getVersion() { |
| 57 | return OFVersion.OF_13; |
| 58 | } |
| 59 | |
| 60 | @Override |
| 61 | public OFType getType() { |
| 62 | return OFType.EXPERIMENTER; |
| 63 | } |
| 64 | |
| 65 | @Override |
| 66 | public long getXid() { |
| 67 | return xid; |
| 68 | } |
| 69 | |
| 70 | @Override |
| 71 | public long getExperimenter() { |
| 72 | return 0x5c16c7L; |
| 73 | } |
| 74 | |
| 75 | @Override |
| 76 | public long getSubtype() { |
| 77 | return 0x33L; |
| 78 | } |
| 79 | |
| 80 | |
| 81 | |
| 82 | public OFBsnGetSwitchPipelineRequest.Builder createBuilder() { |
| 83 | return new BuilderWithParent(this); |
| 84 | } |
| 85 | |
| 86 | static class BuilderWithParent implements OFBsnGetSwitchPipelineRequest.Builder { |
| 87 | final OFBsnGetSwitchPipelineRequestVer13 parentMessage; |
| 88 | |
| 89 | // OF message fields |
| 90 | private boolean xidSet; |
| 91 | private long xid; |
| 92 | |
| 93 | BuilderWithParent(OFBsnGetSwitchPipelineRequestVer13 parentMessage) { |
| 94 | this.parentMessage = parentMessage; |
| 95 | } |
| 96 | |
| 97 | @Override |
| 98 | public OFVersion getVersion() { |
| 99 | return OFVersion.OF_13; |
| 100 | } |
| 101 | |
| 102 | @Override |
| 103 | public OFType getType() { |
| 104 | return OFType.EXPERIMENTER; |
| 105 | } |
| 106 | |
| 107 | @Override |
| 108 | public long getXid() { |
| 109 | return xid; |
| 110 | } |
| 111 | |
| 112 | @Override |
| 113 | public OFBsnGetSwitchPipelineRequest.Builder setXid(long xid) { |
| 114 | this.xid = xid; |
| 115 | this.xidSet = true; |
| 116 | return this; |
| 117 | } |
| 118 | @Override |
| 119 | public long getExperimenter() { |
| 120 | return 0x5c16c7L; |
| 121 | } |
| 122 | |
| 123 | @Override |
| 124 | public long getSubtype() { |
| 125 | return 0x33L; |
| 126 | } |
| 127 | |
| 128 | |
| 129 | |
| 130 | @Override |
| 131 | public OFBsnGetSwitchPipelineRequest build() { |
| 132 | long xid = this.xidSet ? this.xid : parentMessage.xid; |
| 133 | |
| 134 | // |
| 135 | return new OFBsnGetSwitchPipelineRequestVer13( |
| 136 | xid |
| 137 | ); |
| 138 | } |
| 139 | |
| 140 | } |
| 141 | |
| 142 | static class Builder implements OFBsnGetSwitchPipelineRequest.Builder { |
| 143 | // OF message fields |
| 144 | private boolean xidSet; |
| 145 | private long xid; |
| 146 | |
| 147 | @Override |
| 148 | public OFVersion getVersion() { |
| 149 | return OFVersion.OF_13; |
| 150 | } |
| 151 | |
| 152 | @Override |
| 153 | public OFType getType() { |
| 154 | return OFType.EXPERIMENTER; |
| 155 | } |
| 156 | |
| 157 | @Override |
| 158 | public long getXid() { |
| 159 | return xid; |
| 160 | } |
| 161 | |
| 162 | @Override |
| 163 | public OFBsnGetSwitchPipelineRequest.Builder setXid(long xid) { |
| 164 | this.xid = xid; |
| 165 | this.xidSet = true; |
| 166 | return this; |
| 167 | } |
| 168 | @Override |
| 169 | public long getExperimenter() { |
| 170 | return 0x5c16c7L; |
| 171 | } |
| 172 | |
| 173 | @Override |
| 174 | public long getSubtype() { |
| 175 | return 0x33L; |
| 176 | } |
| 177 | |
| 178 | // |
| 179 | @Override |
| 180 | public OFBsnGetSwitchPipelineRequest build() { |
| 181 | long xid = this.xidSet ? this.xid : DEFAULT_XID; |
| 182 | |
| 183 | |
| 184 | return new OFBsnGetSwitchPipelineRequestVer13( |
| 185 | xid |
| 186 | ); |
| 187 | } |
| 188 | |
| 189 | } |
| 190 | |
| 191 | |
| 192 | final static Reader READER = new Reader(); |
| 193 | static class Reader implements OFMessageReader<OFBsnGetSwitchPipelineRequest> { |
| 194 | @Override |
| 195 | public OFBsnGetSwitchPipelineRequest readFrom(ChannelBuffer bb) throws OFParseError { |
| 196 | int start = bb.readerIndex(); |
| 197 | // fixed value property version == 4 |
| 198 | byte version = bb.readByte(); |
| 199 | if(version != (byte) 0x4) |
| 200 | throw new OFParseError("Wrong version: Expected=OFVersion.OF_13(4), got="+version); |
| 201 | // fixed value property type == 4 |
| 202 | byte type = bb.readByte(); |
| 203 | if(type != (byte) 0x4) |
| 204 | throw new OFParseError("Wrong type: Expected=OFType.EXPERIMENTER(4), got="+type); |
| 205 | int length = U16.f(bb.readShort()); |
| 206 | if(length != 16) |
| 207 | throw new OFParseError("Wrong length: Expected=16(16), got="+length); |
| 208 | if(bb.readableBytes() + (bb.readerIndex() - start) < length) { |
| 209 | // Buffer does not have all data yet |
| 210 | bb.readerIndex(start); |
| 211 | return null; |
| 212 | } |
| 213 | if(logger.isTraceEnabled()) |
| 214 | logger.trace("readFrom - length={}", length); |
| 215 | long xid = U32.f(bb.readInt()); |
| 216 | // fixed value property experimenter == 0x5c16c7L |
| 217 | int experimenter = bb.readInt(); |
| 218 | if(experimenter != 0x5c16c7) |
| 219 | throw new OFParseError("Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got="+experimenter); |
| 220 | // fixed value property subtype == 0x33L |
| 221 | int subtype = bb.readInt(); |
| 222 | if(subtype != 0x33) |
| 223 | throw new OFParseError("Wrong subtype: Expected=0x33L(0x33L), got="+subtype); |
| 224 | |
| 225 | OFBsnGetSwitchPipelineRequestVer13 bsnGetSwitchPipelineRequestVer13 = new OFBsnGetSwitchPipelineRequestVer13( |
| 226 | xid |
| 227 | ); |
| 228 | if(logger.isTraceEnabled()) |
| 229 | logger.trace("readFrom - read={}", bsnGetSwitchPipelineRequestVer13); |
| 230 | return bsnGetSwitchPipelineRequestVer13; |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | public void putTo(PrimitiveSink sink) { |
| 235 | FUNNEL.funnel(this, sink); |
| 236 | } |
| 237 | |
| 238 | final static OFBsnGetSwitchPipelineRequestVer13Funnel FUNNEL = new OFBsnGetSwitchPipelineRequestVer13Funnel(); |
| 239 | static class OFBsnGetSwitchPipelineRequestVer13Funnel implements Funnel<OFBsnGetSwitchPipelineRequestVer13> { |
| 240 | private static final long serialVersionUID = 1L; |
| 241 | @Override |
| 242 | public void funnel(OFBsnGetSwitchPipelineRequestVer13 message, PrimitiveSink sink) { |
| 243 | // fixed value property version = 4 |
| 244 | sink.putByte((byte) 0x4); |
| 245 | // fixed value property type = 4 |
| 246 | sink.putByte((byte) 0x4); |
| 247 | // fixed value property length = 16 |
| 248 | sink.putShort((short) 0x10); |
| 249 | sink.putLong(message.xid); |
| 250 | // fixed value property experimenter = 0x5c16c7L |
| 251 | sink.putInt(0x5c16c7); |
| 252 | // fixed value property subtype = 0x33L |
| 253 | sink.putInt(0x33); |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | |
| 258 | public void writeTo(ChannelBuffer bb) { |
| 259 | WRITER.write(bb, this); |
| 260 | } |
| 261 | |
| 262 | final static Writer WRITER = new Writer(); |
| 263 | static class Writer implements OFMessageWriter<OFBsnGetSwitchPipelineRequestVer13> { |
| 264 | @Override |
| 265 | public void write(ChannelBuffer bb, OFBsnGetSwitchPipelineRequestVer13 message) { |
| 266 | // fixed value property version = 4 |
| 267 | bb.writeByte((byte) 0x4); |
| 268 | // fixed value property type = 4 |
| 269 | bb.writeByte((byte) 0x4); |
| 270 | // fixed value property length = 16 |
| 271 | bb.writeShort((short) 0x10); |
| 272 | bb.writeInt(U32.t(message.xid)); |
| 273 | // fixed value property experimenter = 0x5c16c7L |
| 274 | bb.writeInt(0x5c16c7); |
| 275 | // fixed value property subtype = 0x33L |
| 276 | bb.writeInt(0x33); |
| 277 | |
| 278 | |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | @Override |
| 283 | public String toString() { |
| 284 | StringBuilder b = new StringBuilder("OFBsnGetSwitchPipelineRequestVer13("); |
| 285 | b.append("xid=").append(xid); |
| 286 | b.append(")"); |
| 287 | return b.toString(); |
| 288 | } |
| 289 | |
| 290 | @Override |
| 291 | public boolean equals(Object obj) { |
| 292 | if (this == obj) |
| 293 | return true; |
| 294 | if (obj == null) |
| 295 | return false; |
| 296 | if (getClass() != obj.getClass()) |
| 297 | return false; |
| 298 | OFBsnGetSwitchPipelineRequestVer13 other = (OFBsnGetSwitchPipelineRequestVer13) obj; |
| 299 | |
| 300 | if( xid != other.xid) |
| 301 | return false; |
| 302 | return true; |
| 303 | } |
| 304 | |
| 305 | @Override |
| 306 | public int hashCode() { |
| 307 | final int prime = 31; |
| 308 | int result = 1; |
| 309 | |
| 310 | result = prime * (int) (xid ^ (xid >>> 32)); |
| 311 | return result; |
| 312 | } |
| 313 | |
| 314 | } |