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.ver10; |
| 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 OFBsnBwEnableSetReplyVer10 implements OFBsnBwEnableSetReply { |
| 34 | private static final Logger logger = LoggerFactory.getLogger(OFBsnBwEnableSetReplyVer10.class); |
| 35 | // version: 1.0 |
| 36 | final static byte WIRE_VERSION = 1; |
| 37 | final static int LENGTH = 24; |
| 38 | |
| 39 | private final static long DEFAULT_XID = 0x0L; |
| 40 | private final static long DEFAULT_ENABLE = 0x0L; |
| 41 | private final static long DEFAULT_STATUS = 0x0L; |
| 42 | |
| 43 | // OF message fields |
| 44 | private final long xid; |
| 45 | private final long enable; |
| 46 | private final long status; |
| 47 | // |
| 48 | // Immutable default instance |
| 49 | final static OFBsnBwEnableSetReplyVer10 DEFAULT = new OFBsnBwEnableSetReplyVer10( |
| 50 | DEFAULT_XID, DEFAULT_ENABLE, DEFAULT_STATUS |
| 51 | ); |
| 52 | |
| 53 | // package private constructor - used by readers, builders, and factory |
| 54 | OFBsnBwEnableSetReplyVer10(long xid, long enable, long status) { |
| 55 | this.xid = xid; |
| 56 | this.enable = enable; |
| 57 | this.status = status; |
| 58 | } |
| 59 | |
| 60 | // Accessors for OF message fields |
| 61 | @Override |
| 62 | public OFVersion getVersion() { |
| 63 | return OFVersion.OF_10; |
| 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 0x17L; |
| 84 | } |
| 85 | |
| 86 | @Override |
| 87 | public long getEnable() { |
| 88 | return enable; |
| 89 | } |
| 90 | |
| 91 | @Override |
| 92 | public long getStatus() { |
| 93 | return status; |
| 94 | } |
| 95 | |
| 96 | |
| 97 | |
| 98 | public OFBsnBwEnableSetReply.Builder createBuilder() { |
| 99 | return new BuilderWithParent(this); |
| 100 | } |
| 101 | |
| 102 | static class BuilderWithParent implements OFBsnBwEnableSetReply.Builder { |
| 103 | final OFBsnBwEnableSetReplyVer10 parentMessage; |
| 104 | |
| 105 | // OF message fields |
| 106 | private boolean xidSet; |
| 107 | private long xid; |
| 108 | private boolean enableSet; |
| 109 | private long enable; |
| 110 | private boolean statusSet; |
| 111 | private long status; |
| 112 | |
| 113 | BuilderWithParent(OFBsnBwEnableSetReplyVer10 parentMessage) { |
| 114 | this.parentMessage = parentMessage; |
| 115 | } |
| 116 | |
| 117 | @Override |
| 118 | public OFVersion getVersion() { |
| 119 | return OFVersion.OF_10; |
| 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 OFBsnBwEnableSetReply.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 0x17L; |
| 146 | } |
| 147 | |
| 148 | @Override |
| 149 | public long getEnable() { |
| 150 | return enable; |
| 151 | } |
| 152 | |
| 153 | @Override |
| 154 | public OFBsnBwEnableSetReply.Builder setEnable(long enable) { |
| 155 | this.enable = enable; |
| 156 | this.enableSet = true; |
| 157 | return this; |
| 158 | } |
| 159 | @Override |
| 160 | public long getStatus() { |
| 161 | return status; |
| 162 | } |
| 163 | |
| 164 | @Override |
| 165 | public OFBsnBwEnableSetReply.Builder setStatus(long status) { |
| 166 | this.status = status; |
| 167 | this.statusSet = true; |
| 168 | return this; |
| 169 | } |
| 170 | |
| 171 | |
| 172 | @Override |
| 173 | public OFBsnBwEnableSetReply build() { |
| 174 | long xid = this.xidSet ? this.xid : parentMessage.xid; |
| 175 | long enable = this.enableSet ? this.enable : parentMessage.enable; |
| 176 | long status = this.statusSet ? this.status : parentMessage.status; |
| 177 | |
| 178 | // |
| 179 | return new OFBsnBwEnableSetReplyVer10( |
| 180 | xid, |
| 181 | enable, |
| 182 | status |
| 183 | ); |
| 184 | } |
| 185 | |
| 186 | } |
| 187 | |
| 188 | static class Builder implements OFBsnBwEnableSetReply.Builder { |
| 189 | // OF message fields |
| 190 | private boolean xidSet; |
| 191 | private long xid; |
| 192 | private boolean enableSet; |
| 193 | private long enable; |
| 194 | private boolean statusSet; |
| 195 | private long status; |
| 196 | |
| 197 | @Override |
| 198 | public OFVersion getVersion() { |
| 199 | return OFVersion.OF_10; |
| 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 OFBsnBwEnableSetReply.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 0x17L; |
| 226 | } |
| 227 | |
| 228 | @Override |
| 229 | public long getEnable() { |
| 230 | return enable; |
| 231 | } |
| 232 | |
| 233 | @Override |
| 234 | public OFBsnBwEnableSetReply.Builder setEnable(long enable) { |
| 235 | this.enable = enable; |
| 236 | this.enableSet = true; |
| 237 | return this; |
| 238 | } |
| 239 | @Override |
| 240 | public long getStatus() { |
| 241 | return status; |
| 242 | } |
| 243 | |
| 244 | @Override |
| 245 | public OFBsnBwEnableSetReply.Builder setStatus(long status) { |
| 246 | this.status = status; |
| 247 | this.statusSet = true; |
| 248 | return this; |
| 249 | } |
| 250 | // |
| 251 | @Override |
| 252 | public OFBsnBwEnableSetReply build() { |
| 253 | long xid = this.xidSet ? this.xid : DEFAULT_XID; |
| 254 | long enable = this.enableSet ? this.enable : DEFAULT_ENABLE; |
| 255 | long status = this.statusSet ? this.status : DEFAULT_STATUS; |
| 256 | |
| 257 | |
| 258 | return new OFBsnBwEnableSetReplyVer10( |
| 259 | xid, |
| 260 | enable, |
| 261 | status |
| 262 | ); |
| 263 | } |
| 264 | |
| 265 | } |
| 266 | |
| 267 | |
| 268 | final static Reader READER = new Reader(); |
| 269 | static class Reader implements OFMessageReader<OFBsnBwEnableSetReply> { |
| 270 | @Override |
| 271 | public OFBsnBwEnableSetReply readFrom(ChannelBuffer bb) throws OFParseError { |
| 272 | int start = bb.readerIndex(); |
| 273 | // fixed value property version == 1 |
| 274 | byte version = bb.readByte(); |
| 275 | if(version != (byte) 0x1) |
| 276 | throw new OFParseError("Wrong version: Expected=OFVersion.OF_10(1), 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 == 0x17L |
| 297 | int subtype = bb.readInt(); |
| 298 | if(subtype != 0x17) |
| 299 | throw new OFParseError("Wrong subtype: Expected=0x17L(0x17L), got="+subtype); |
| 300 | long enable = U32.f(bb.readInt()); |
| 301 | long status = U32.f(bb.readInt()); |
| 302 | |
| 303 | OFBsnBwEnableSetReplyVer10 bsnBwEnableSetReplyVer10 = new OFBsnBwEnableSetReplyVer10( |
| 304 | xid, |
| 305 | enable, |
| 306 | status |
| 307 | ); |
| 308 | if(logger.isTraceEnabled()) |
| 309 | logger.trace("readFrom - read={}", bsnBwEnableSetReplyVer10); |
| 310 | return bsnBwEnableSetReplyVer10; |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | public void putTo(PrimitiveSink sink) { |
| 315 | FUNNEL.funnel(this, sink); |
| 316 | } |
| 317 | |
| 318 | final static OFBsnBwEnableSetReplyVer10Funnel FUNNEL = new OFBsnBwEnableSetReplyVer10Funnel(); |
| 319 | static class OFBsnBwEnableSetReplyVer10Funnel implements Funnel<OFBsnBwEnableSetReplyVer10> { |
| 320 | private static final long serialVersionUID = 1L; |
| 321 | @Override |
| 322 | public void funnel(OFBsnBwEnableSetReplyVer10 message, PrimitiveSink sink) { |
| 323 | // fixed value property version = 1 |
| 324 | sink.putByte((byte) 0x1); |
| 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 = 0x17L |
| 333 | sink.putInt(0x17); |
| 334 | sink.putLong(message.enable); |
| 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<OFBsnBwEnableSetReplyVer10> { |
| 346 | @Override |
| 347 | public void write(ChannelBuffer bb, OFBsnBwEnableSetReplyVer10 message) { |
| 348 | // fixed value property version = 1 |
| 349 | bb.writeByte((byte) 0x1); |
| 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 = 0x17L |
| 358 | bb.writeInt(0x17); |
| 359 | bb.writeInt(U32.t(message.enable)); |
| 360 | bb.writeInt(U32.t(message.status)); |
| 361 | |
| 362 | |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | @Override |
| 367 | public String toString() { |
| 368 | StringBuilder b = new StringBuilder("OFBsnBwEnableSetReplyVer10("); |
| 369 | b.append("xid=").append(xid); |
| 370 | b.append(", "); |
| 371 | b.append("enable=").append(enable); |
| 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 | OFBsnBwEnableSetReplyVer10 other = (OFBsnBwEnableSetReplyVer10) obj; |
| 387 | |
| 388 | if( xid != other.xid) |
| 389 | return false; |
| 390 | if( enable != other.enable) |
| 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) (enable ^ (enable >>> 32)); |
| 404 | result = prime * (int) (status ^ (status >>> 32)); |
| 405 | return result; |
| 406 | } |
| 407 | |
| 408 | } |