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