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 java.util.Set; |
| 27 | import org.slf4j.Logger; |
| 28 | import org.slf4j.LoggerFactory; |
| 29 | import org.jboss.netty.buffer.ChannelBuffer; |
| 30 | import com.google.common.hash.PrimitiveSink; |
| 31 | import com.google.common.hash.Funnel; |
| 32 | |
| 33 | class OFBsnSetAuxCxnsReplyVer13 implements OFBsnSetAuxCxnsReply { |
| 34 | private static final Logger logger = LoggerFactory.getLogger(OFBsnSetAuxCxnsReplyVer13.class); |
| 35 | // version: 1.3 |
| 36 | final static byte WIRE_VERSION = 4; |
| 37 | final static int LENGTH = 24; |
| 38 | |
| 39 | private final static long DEFAULT_XID = 0x0L; |
| 40 | private final static long DEFAULT_NUM_AUX = 0x0L; |
| 41 | private final static long DEFAULT_STATUS = 0x0L; |
| 42 | |
| 43 | // OF message fields |
| 44 | private final long xid; |
| 45 | private final long numAux; |
| 46 | private final long status; |
| 47 | // |
| 48 | // Immutable default instance |
| 49 | final static OFBsnSetAuxCxnsReplyVer13 DEFAULT = new OFBsnSetAuxCxnsReplyVer13( |
| 50 | DEFAULT_XID, DEFAULT_NUM_AUX, DEFAULT_STATUS |
| 51 | ); |
| 52 | |
| 53 | // package private constructor - used by readers, builders, and factory |
| 54 | OFBsnSetAuxCxnsReplyVer13(long xid, long numAux, long status) { |
| 55 | this.xid = xid; |
| 56 | this.numAux = numAux; |
| 57 | this.status = status; |
| 58 | } |
| 59 | |
| 60 | // Accessors for OF message fields |
| 61 | @Override |
| 62 | public OFVersion getVersion() { |
| 63 | return OFVersion.OF_13; |
| 64 | } |
| 65 | |
| 66 | @Override |
| 67 | public OFType getType() { |
| 68 | return OFType.EXPERIMENTER; |
| 69 | } |
| 70 | |
| 71 | @Override |
| 72 | public long getXid() { |
| 73 | return xid; |
| 74 | } |
| 75 | |
| 76 | @Override |
| 77 | public long getExperimenter() { |
| 78 | return 0x5c16c7L; |
| 79 | } |
| 80 | |
| 81 | @Override |
| 82 | public long getSubtype() { |
| 83 | return 0x3bL; |
| 84 | } |
| 85 | |
| 86 | @Override |
| 87 | public long getNumAux() { |
| 88 | return numAux; |
| 89 | } |
| 90 | |
| 91 | @Override |
| 92 | public long getStatus() { |
| 93 | return status; |
| 94 | } |
| 95 | |
| 96 | |
| 97 | |
| 98 | public OFBsnSetAuxCxnsReply.Builder createBuilder() { |
| 99 | return new BuilderWithParent(this); |
| 100 | } |
| 101 | |
| 102 | static class BuilderWithParent implements OFBsnSetAuxCxnsReply.Builder { |
| 103 | final OFBsnSetAuxCxnsReplyVer13 parentMessage; |
| 104 | |
| 105 | // OF message fields |
| 106 | private boolean xidSet; |
| 107 | private long xid; |
| 108 | private boolean numAuxSet; |
| 109 | private long numAux; |
| 110 | private boolean statusSet; |
| 111 | private long status; |
| 112 | |
| 113 | BuilderWithParent(OFBsnSetAuxCxnsReplyVer13 parentMessage) { |
| 114 | this.parentMessage = parentMessage; |
| 115 | } |
| 116 | |
| 117 | @Override |
| 118 | public OFVersion getVersion() { |
| 119 | return OFVersion.OF_13; |
| 120 | } |
| 121 | |
| 122 | @Override |
| 123 | public OFType getType() { |
| 124 | return OFType.EXPERIMENTER; |
| 125 | } |
| 126 | |
| 127 | @Override |
| 128 | public long getXid() { |
| 129 | return xid; |
| 130 | } |
| 131 | |
| 132 | @Override |
| 133 | public OFBsnSetAuxCxnsReply.Builder setXid(long xid) { |
| 134 | this.xid = xid; |
| 135 | this.xidSet = true; |
| 136 | return this; |
| 137 | } |
| 138 | @Override |
| 139 | public long getExperimenter() { |
| 140 | return 0x5c16c7L; |
| 141 | } |
| 142 | |
| 143 | @Override |
| 144 | public long getSubtype() { |
| 145 | return 0x3bL; |
| 146 | } |
| 147 | |
| 148 | @Override |
| 149 | public long getNumAux() { |
| 150 | return numAux; |
| 151 | } |
| 152 | |
| 153 | @Override |
| 154 | public OFBsnSetAuxCxnsReply.Builder setNumAux(long numAux) { |
| 155 | this.numAux = numAux; |
| 156 | this.numAuxSet = true; |
| 157 | return this; |
| 158 | } |
| 159 | @Override |
| 160 | public long getStatus() { |
| 161 | return status; |
| 162 | } |
| 163 | |
| 164 | @Override |
| 165 | public OFBsnSetAuxCxnsReply.Builder setStatus(long status) { |
| 166 | this.status = status; |
| 167 | this.statusSet = true; |
| 168 | return this; |
| 169 | } |
| 170 | |
| 171 | |
| 172 | @Override |
| 173 | public OFBsnSetAuxCxnsReply build() { |
| 174 | long xid = this.xidSet ? this.xid : parentMessage.xid; |
| 175 | long numAux = this.numAuxSet ? this.numAux : parentMessage.numAux; |
| 176 | long status = this.statusSet ? this.status : parentMessage.status; |
| 177 | |
| 178 | // |
| 179 | return new OFBsnSetAuxCxnsReplyVer13( |
| 180 | xid, |
| 181 | numAux, |
| 182 | status |
| 183 | ); |
| 184 | } |
| 185 | |
| 186 | } |
| 187 | |
| 188 | static class Builder implements OFBsnSetAuxCxnsReply.Builder { |
| 189 | // OF message fields |
| 190 | private boolean xidSet; |
| 191 | private long xid; |
| 192 | private boolean numAuxSet; |
| 193 | private long numAux; |
| 194 | private boolean statusSet; |
| 195 | private long status; |
| 196 | |
| 197 | @Override |
| 198 | public OFVersion getVersion() { |
| 199 | return OFVersion.OF_13; |
| 200 | } |
| 201 | |
| 202 | @Override |
| 203 | public OFType getType() { |
| 204 | return OFType.EXPERIMENTER; |
| 205 | } |
| 206 | |
| 207 | @Override |
| 208 | public long getXid() { |
| 209 | return xid; |
| 210 | } |
| 211 | |
| 212 | @Override |
| 213 | public OFBsnSetAuxCxnsReply.Builder setXid(long xid) { |
| 214 | this.xid = xid; |
| 215 | this.xidSet = true; |
| 216 | return this; |
| 217 | } |
| 218 | @Override |
| 219 | public long getExperimenter() { |
| 220 | return 0x5c16c7L; |
| 221 | } |
| 222 | |
| 223 | @Override |
| 224 | public long getSubtype() { |
| 225 | return 0x3bL; |
| 226 | } |
| 227 | |
| 228 | @Override |
| 229 | public long getNumAux() { |
| 230 | return numAux; |
| 231 | } |
| 232 | |
| 233 | @Override |
| 234 | public OFBsnSetAuxCxnsReply.Builder setNumAux(long numAux) { |
| 235 | this.numAux = numAux; |
| 236 | this.numAuxSet = true; |
| 237 | return this; |
| 238 | } |
| 239 | @Override |
| 240 | public long getStatus() { |
| 241 | return status; |
| 242 | } |
| 243 | |
| 244 | @Override |
| 245 | public OFBsnSetAuxCxnsReply.Builder setStatus(long status) { |
| 246 | this.status = status; |
| 247 | this.statusSet = true; |
| 248 | return this; |
| 249 | } |
| 250 | // |
| 251 | @Override |
| 252 | public OFBsnSetAuxCxnsReply build() { |
| 253 | long xid = this.xidSet ? this.xid : DEFAULT_XID; |
| 254 | long numAux = this.numAuxSet ? this.numAux : DEFAULT_NUM_AUX; |
| 255 | long status = this.statusSet ? this.status : DEFAULT_STATUS; |
| 256 | |
| 257 | |
| 258 | return new OFBsnSetAuxCxnsReplyVer13( |
| 259 | xid, |
| 260 | numAux, |
| 261 | status |
| 262 | ); |
| 263 | } |
| 264 | |
| 265 | } |
| 266 | |
| 267 | |
| 268 | final static Reader READER = new Reader(); |
| 269 | static class Reader implements OFMessageReader<OFBsnSetAuxCxnsReply> { |
| 270 | @Override |
| 271 | public OFBsnSetAuxCxnsReply readFrom(ChannelBuffer bb) throws OFParseError { |
| 272 | int start = bb.readerIndex(); |
| 273 | // fixed value property version == 4 |
| 274 | byte version = bb.readByte(); |
| 275 | if(version != (byte) 0x4) |
| 276 | throw new OFParseError("Wrong version: Expected=OFVersion.OF_13(4), got="+version); |
| 277 | // fixed value property type == 4 |
| 278 | byte type = bb.readByte(); |
| 279 | if(type != (byte) 0x4) |
| 280 | throw new OFParseError("Wrong type: Expected=OFType.EXPERIMENTER(4), got="+type); |
| 281 | int length = U16.f(bb.readShort()); |
| 282 | if(length != 24) |
| 283 | throw new OFParseError("Wrong length: Expected=24(24), got="+length); |
| 284 | if(bb.readableBytes() + (bb.readerIndex() - start) < length) { |
| 285 | // Buffer does not have all data yet |
| 286 | bb.readerIndex(start); |
| 287 | return null; |
| 288 | } |
| 289 | if(logger.isTraceEnabled()) |
| 290 | logger.trace("readFrom - length={}", length); |
| 291 | long xid = U32.f(bb.readInt()); |
| 292 | // fixed value property experimenter == 0x5c16c7L |
| 293 | int experimenter = bb.readInt(); |
| 294 | if(experimenter != 0x5c16c7) |
| 295 | throw new OFParseError("Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got="+experimenter); |
| 296 | // fixed value property subtype == 0x3bL |
| 297 | int subtype = bb.readInt(); |
| 298 | if(subtype != 0x3b) |
| 299 | throw new OFParseError("Wrong subtype: Expected=0x3bL(0x3bL), got="+subtype); |
| 300 | long numAux = U32.f(bb.readInt()); |
| 301 | long status = U32.f(bb.readInt()); |
| 302 | |
| 303 | OFBsnSetAuxCxnsReplyVer13 bsnSetAuxCxnsReplyVer13 = new OFBsnSetAuxCxnsReplyVer13( |
| 304 | xid, |
| 305 | numAux, |
| 306 | status |
| 307 | ); |
| 308 | if(logger.isTraceEnabled()) |
| 309 | logger.trace("readFrom - read={}", bsnSetAuxCxnsReplyVer13); |
| 310 | return bsnSetAuxCxnsReplyVer13; |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | public void putTo(PrimitiveSink sink) { |
| 315 | FUNNEL.funnel(this, sink); |
| 316 | } |
| 317 | |
| 318 | final static OFBsnSetAuxCxnsReplyVer13Funnel FUNNEL = new OFBsnSetAuxCxnsReplyVer13Funnel(); |
| 319 | static class OFBsnSetAuxCxnsReplyVer13Funnel implements Funnel<OFBsnSetAuxCxnsReplyVer13> { |
| 320 | private static final long serialVersionUID = 1L; |
| 321 | @Override |
| 322 | public void funnel(OFBsnSetAuxCxnsReplyVer13 message, PrimitiveSink sink) { |
| 323 | // fixed value property version = 4 |
| 324 | sink.putByte((byte) 0x4); |
| 325 | // fixed value property type = 4 |
| 326 | sink.putByte((byte) 0x4); |
| 327 | // fixed value property length = 24 |
| 328 | sink.putShort((short) 0x18); |
| 329 | sink.putLong(message.xid); |
| 330 | // fixed value property experimenter = 0x5c16c7L |
| 331 | sink.putInt(0x5c16c7); |
| 332 | // fixed value property subtype = 0x3bL |
| 333 | sink.putInt(0x3b); |
| 334 | sink.putLong(message.numAux); |
| 335 | sink.putLong(message.status); |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | |
| 340 | public void writeTo(ChannelBuffer bb) { |
| 341 | WRITER.write(bb, this); |
| 342 | } |
| 343 | |
| 344 | final static Writer WRITER = new Writer(); |
| 345 | static class Writer implements OFMessageWriter<OFBsnSetAuxCxnsReplyVer13> { |
| 346 | @Override |
| 347 | public void write(ChannelBuffer bb, OFBsnSetAuxCxnsReplyVer13 message) { |
| 348 | // fixed value property version = 4 |
| 349 | bb.writeByte((byte) 0x4); |
| 350 | // fixed value property type = 4 |
| 351 | bb.writeByte((byte) 0x4); |
| 352 | // fixed value property length = 24 |
| 353 | bb.writeShort((short) 0x18); |
| 354 | bb.writeInt(U32.t(message.xid)); |
| 355 | // fixed value property experimenter = 0x5c16c7L |
| 356 | bb.writeInt(0x5c16c7); |
| 357 | // fixed value property subtype = 0x3bL |
| 358 | bb.writeInt(0x3b); |
| 359 | bb.writeInt(U32.t(message.numAux)); |
| 360 | bb.writeInt(U32.t(message.status)); |
| 361 | |
| 362 | |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | @Override |
| 367 | public String toString() { |
| 368 | StringBuilder b = new StringBuilder("OFBsnSetAuxCxnsReplyVer13("); |
| 369 | b.append("xid=").append(xid); |
| 370 | b.append(", "); |
| 371 | b.append("numAux=").append(numAux); |
| 372 | b.append(", "); |
| 373 | b.append("status=").append(status); |
| 374 | b.append(")"); |
| 375 | return b.toString(); |
| 376 | } |
| 377 | |
| 378 | @Override |
| 379 | public boolean equals(Object obj) { |
| 380 | if (this == obj) |
| 381 | return true; |
| 382 | if (obj == null) |
| 383 | return false; |
| 384 | if (getClass() != obj.getClass()) |
| 385 | return false; |
| 386 | OFBsnSetAuxCxnsReplyVer13 other = (OFBsnSetAuxCxnsReplyVer13) obj; |
| 387 | |
| 388 | if( xid != other.xid) |
| 389 | return false; |
| 390 | if( numAux != other.numAux) |
| 391 | return false; |
| 392 | if( status != other.status) |
| 393 | return false; |
| 394 | return true; |
| 395 | } |
| 396 | |
| 397 | @Override |
| 398 | public int hashCode() { |
| 399 | final int prime = 31; |
| 400 | int result = 1; |
| 401 | |
| 402 | result = prime * (int) (xid ^ (xid >>> 32)); |
| 403 | result = prime * (int) (numAux ^ (numAux >>> 32)); |
| 404 | result = prime * (int) (status ^ (status >>> 32)); |
| 405 | return result; |
| 406 | } |
| 407 | |
| 408 | } |