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 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 OFFlowRemovedVer10 implements OFFlowRemoved { |
| 34 | private static final Logger logger = LoggerFactory.getLogger(OFFlowRemovedVer10.class); |
| 35 | // version: 1.0 |
| 36 | final static byte WIRE_VERSION = 1; |
| 37 | final static int LENGTH = 88; |
| 38 | |
| 39 | private final static long DEFAULT_XID = 0x0L; |
| 40 | private final static Match DEFAULT_MATCH = OFFactoryVer10.MATCH_WILDCARD_ALL; |
| 41 | private final static U64 DEFAULT_COOKIE = U64.ZERO; |
| 42 | private final static int DEFAULT_PRIORITY = 0x0; |
| 43 | private final static short DEFAULT_REASON = (short) 0x0; |
| 44 | private final static long DEFAULT_DURATION_SEC = 0x0L; |
| 45 | private final static long DEFAULT_DURATION_NSEC = 0x0L; |
| 46 | private final static int DEFAULT_IDLE_TIMEOUT = 0x0; |
| 47 | private final static U64 DEFAULT_PACKET_COUNT = U64.ZERO; |
| 48 | private final static U64 DEFAULT_BYTE_COUNT = U64.ZERO; |
| 49 | |
| 50 | // OF message fields |
| 51 | private final long xid; |
| 52 | private final Match match; |
| 53 | private final U64 cookie; |
| 54 | private final int priority; |
| 55 | private final short reason; |
| 56 | private final long durationSec; |
| 57 | private final long durationNsec; |
| 58 | private final int idleTimeout; |
| 59 | private final U64 packetCount; |
| 60 | private final U64 byteCount; |
| 61 | // |
| 62 | // Immutable default instance |
| 63 | final static OFFlowRemovedVer10 DEFAULT = new OFFlowRemovedVer10( |
| 64 | DEFAULT_XID, DEFAULT_MATCH, DEFAULT_COOKIE, DEFAULT_PRIORITY, DEFAULT_REASON, DEFAULT_DURATION_SEC, DEFAULT_DURATION_NSEC, DEFAULT_IDLE_TIMEOUT, DEFAULT_PACKET_COUNT, DEFAULT_BYTE_COUNT |
| 65 | ); |
| 66 | |
| 67 | // package private constructor - used by readers, builders, and factory |
| 68 | OFFlowRemovedVer10(long xid, Match match, U64 cookie, int priority, short reason, long durationSec, long durationNsec, int idleTimeout, U64 packetCount, U64 byteCount) { |
| 69 | this.xid = xid; |
| 70 | this.match = match; |
| 71 | this.cookie = cookie; |
| 72 | this.priority = priority; |
| 73 | this.reason = reason; |
| 74 | this.durationSec = durationSec; |
| 75 | this.durationNsec = durationNsec; |
| 76 | this.idleTimeout = idleTimeout; |
| 77 | this.packetCount = packetCount; |
| 78 | this.byteCount = byteCount; |
| 79 | } |
| 80 | |
| 81 | // Accessors for OF message fields |
| 82 | @Override |
| 83 | public OFVersion getVersion() { |
| 84 | return OFVersion.OF_10; |
| 85 | } |
| 86 | |
| 87 | @Override |
| 88 | public OFType getType() { |
| 89 | return OFType.FLOW_REMOVED; |
| 90 | } |
| 91 | |
| 92 | @Override |
| 93 | public long getXid() { |
| 94 | return xid; |
| 95 | } |
| 96 | |
| 97 | @Override |
| 98 | public U64 getCookie() { |
| 99 | return cookie; |
| 100 | } |
| 101 | |
| 102 | @Override |
| 103 | public int getPriority() { |
| 104 | return priority; |
| 105 | } |
| 106 | |
| 107 | @Override |
| 108 | public short getReason() { |
| 109 | return reason; |
| 110 | } |
| 111 | |
| 112 | @Override |
| 113 | public TableId getTableId()throws UnsupportedOperationException { |
| 114 | throw new UnsupportedOperationException("Property tableId not supported in version 1.0"); |
| 115 | } |
| 116 | |
| 117 | @Override |
| 118 | public long getDurationSec() { |
| 119 | return durationSec; |
| 120 | } |
| 121 | |
| 122 | @Override |
| 123 | public long getDurationNsec() { |
| 124 | return durationNsec; |
| 125 | } |
| 126 | |
| 127 | @Override |
| 128 | public int getIdleTimeout() { |
| 129 | return idleTimeout; |
| 130 | } |
| 131 | |
| 132 | @Override |
| 133 | public int getHardTimeout()throws UnsupportedOperationException { |
| 134 | throw new UnsupportedOperationException("Property hardTimeout not supported in version 1.0"); |
| 135 | } |
| 136 | |
| 137 | @Override |
| 138 | public U64 getPacketCount() { |
| 139 | return packetCount; |
| 140 | } |
| 141 | |
| 142 | @Override |
| 143 | public U64 getByteCount() { |
| 144 | return byteCount; |
| 145 | } |
| 146 | |
| 147 | @Override |
| 148 | public Match getMatch() { |
| 149 | return match; |
| 150 | } |
| 151 | |
| 152 | |
| 153 | |
| 154 | public OFFlowRemoved.Builder createBuilder() { |
| 155 | return new BuilderWithParent(this); |
| 156 | } |
| 157 | |
| 158 | static class BuilderWithParent implements OFFlowRemoved.Builder { |
| 159 | final OFFlowRemovedVer10 parentMessage; |
| 160 | |
| 161 | // OF message fields |
| 162 | private boolean xidSet; |
| 163 | private long xid; |
| 164 | private boolean matchSet; |
| 165 | private Match match; |
| 166 | private boolean cookieSet; |
| 167 | private U64 cookie; |
| 168 | private boolean prioritySet; |
| 169 | private int priority; |
| 170 | private boolean reasonSet; |
| 171 | private short reason; |
| 172 | private boolean durationSecSet; |
| 173 | private long durationSec; |
| 174 | private boolean durationNsecSet; |
| 175 | private long durationNsec; |
| 176 | private boolean idleTimeoutSet; |
| 177 | private int idleTimeout; |
| 178 | private boolean packetCountSet; |
| 179 | private U64 packetCount; |
| 180 | private boolean byteCountSet; |
| 181 | private U64 byteCount; |
| 182 | |
| 183 | BuilderWithParent(OFFlowRemovedVer10 parentMessage) { |
| 184 | this.parentMessage = parentMessage; |
| 185 | } |
| 186 | |
| 187 | @Override |
| 188 | public OFVersion getVersion() { |
| 189 | return OFVersion.OF_10; |
| 190 | } |
| 191 | |
| 192 | @Override |
| 193 | public OFType getType() { |
| 194 | return OFType.FLOW_REMOVED; |
| 195 | } |
| 196 | |
| 197 | @Override |
| 198 | public long getXid() { |
| 199 | return xid; |
| 200 | } |
| 201 | |
| 202 | @Override |
| 203 | public OFFlowRemoved.Builder setXid(long xid) { |
| 204 | this.xid = xid; |
| 205 | this.xidSet = true; |
| 206 | return this; |
| 207 | } |
| 208 | @Override |
| 209 | public U64 getCookie() { |
| 210 | return cookie; |
| 211 | } |
| 212 | |
| 213 | @Override |
| 214 | public OFFlowRemoved.Builder setCookie(U64 cookie) { |
| 215 | this.cookie = cookie; |
| 216 | this.cookieSet = true; |
| 217 | return this; |
| 218 | } |
| 219 | @Override |
| 220 | public int getPriority() { |
| 221 | return priority; |
| 222 | } |
| 223 | |
| 224 | @Override |
| 225 | public OFFlowRemoved.Builder setPriority(int priority) { |
| 226 | this.priority = priority; |
| 227 | this.prioritySet = true; |
| 228 | return this; |
| 229 | } |
| 230 | @Override |
| 231 | public short getReason() { |
| 232 | return reason; |
| 233 | } |
| 234 | |
| 235 | @Override |
| 236 | public OFFlowRemoved.Builder setReason(short reason) { |
| 237 | this.reason = reason; |
| 238 | this.reasonSet = true; |
| 239 | return this; |
| 240 | } |
| 241 | @Override |
| 242 | public TableId getTableId()throws UnsupportedOperationException { |
| 243 | throw new UnsupportedOperationException("Property tableId not supported in version 1.0"); |
| 244 | } |
| 245 | |
| 246 | @Override |
| 247 | public OFFlowRemoved.Builder setTableId(TableId tableId) throws UnsupportedOperationException { |
| 248 | throw new UnsupportedOperationException("Property tableId not supported in version 1.0"); |
| 249 | } |
| 250 | @Override |
| 251 | public long getDurationSec() { |
| 252 | return durationSec; |
| 253 | } |
| 254 | |
| 255 | @Override |
| 256 | public OFFlowRemoved.Builder setDurationSec(long durationSec) { |
| 257 | this.durationSec = durationSec; |
| 258 | this.durationSecSet = true; |
| 259 | return this; |
| 260 | } |
| 261 | @Override |
| 262 | public long getDurationNsec() { |
| 263 | return durationNsec; |
| 264 | } |
| 265 | |
| 266 | @Override |
| 267 | public OFFlowRemoved.Builder setDurationNsec(long durationNsec) { |
| 268 | this.durationNsec = durationNsec; |
| 269 | this.durationNsecSet = true; |
| 270 | return this; |
| 271 | } |
| 272 | @Override |
| 273 | public int getIdleTimeout() { |
| 274 | return idleTimeout; |
| 275 | } |
| 276 | |
| 277 | @Override |
| 278 | public OFFlowRemoved.Builder setIdleTimeout(int idleTimeout) { |
| 279 | this.idleTimeout = idleTimeout; |
| 280 | this.idleTimeoutSet = true; |
| 281 | return this; |
| 282 | } |
| 283 | @Override |
| 284 | public int getHardTimeout()throws UnsupportedOperationException { |
| 285 | throw new UnsupportedOperationException("Property hardTimeout not supported in version 1.0"); |
| 286 | } |
| 287 | |
| 288 | @Override |
| 289 | public OFFlowRemoved.Builder setHardTimeout(int hardTimeout) throws UnsupportedOperationException { |
| 290 | throw new UnsupportedOperationException("Property hardTimeout not supported in version 1.0"); |
| 291 | } |
| 292 | @Override |
| 293 | public U64 getPacketCount() { |
| 294 | return packetCount; |
| 295 | } |
| 296 | |
| 297 | @Override |
| 298 | public OFFlowRemoved.Builder setPacketCount(U64 packetCount) { |
| 299 | this.packetCount = packetCount; |
| 300 | this.packetCountSet = true; |
| 301 | return this; |
| 302 | } |
| 303 | @Override |
| 304 | public U64 getByteCount() { |
| 305 | return byteCount; |
| 306 | } |
| 307 | |
| 308 | @Override |
| 309 | public OFFlowRemoved.Builder setByteCount(U64 byteCount) { |
| 310 | this.byteCount = byteCount; |
| 311 | this.byteCountSet = true; |
| 312 | return this; |
| 313 | } |
| 314 | @Override |
| 315 | public Match getMatch() { |
| 316 | return match; |
| 317 | } |
| 318 | |
| 319 | @Override |
| 320 | public OFFlowRemoved.Builder setMatch(Match match) { |
| 321 | this.match = match; |
| 322 | this.matchSet = true; |
| 323 | return this; |
| 324 | } |
| 325 | |
| 326 | |
| 327 | @Override |
| 328 | public OFFlowRemoved build() { |
| 329 | long xid = this.xidSet ? this.xid : parentMessage.xid; |
| 330 | Match match = this.matchSet ? this.match : parentMessage.match; |
| 331 | if(match == null) |
| 332 | throw new NullPointerException("Property match must not be null"); |
| 333 | U64 cookie = this.cookieSet ? this.cookie : parentMessage.cookie; |
| 334 | if(cookie == null) |
| 335 | throw new NullPointerException("Property cookie must not be null"); |
| 336 | int priority = this.prioritySet ? this.priority : parentMessage.priority; |
| 337 | short reason = this.reasonSet ? this.reason : parentMessage.reason; |
| 338 | long durationSec = this.durationSecSet ? this.durationSec : parentMessage.durationSec; |
| 339 | long durationNsec = this.durationNsecSet ? this.durationNsec : parentMessage.durationNsec; |
| 340 | int idleTimeout = this.idleTimeoutSet ? this.idleTimeout : parentMessage.idleTimeout; |
| 341 | U64 packetCount = this.packetCountSet ? this.packetCount : parentMessage.packetCount; |
| 342 | if(packetCount == null) |
| 343 | throw new NullPointerException("Property packetCount must not be null"); |
| 344 | U64 byteCount = this.byteCountSet ? this.byteCount : parentMessage.byteCount; |
| 345 | if(byteCount == null) |
| 346 | throw new NullPointerException("Property byteCount must not be null"); |
| 347 | |
| 348 | // |
| 349 | return new OFFlowRemovedVer10( |
| 350 | xid, |
| 351 | match, |
| 352 | cookie, |
| 353 | priority, |
| 354 | reason, |
| 355 | durationSec, |
| 356 | durationNsec, |
| 357 | idleTimeout, |
| 358 | packetCount, |
| 359 | byteCount |
| 360 | ); |
| 361 | } |
| 362 | |
| 363 | } |
| 364 | |
| 365 | static class Builder implements OFFlowRemoved.Builder { |
| 366 | // OF message fields |
| 367 | private boolean xidSet; |
| 368 | private long xid; |
| 369 | private boolean matchSet; |
| 370 | private Match match; |
| 371 | private boolean cookieSet; |
| 372 | private U64 cookie; |
| 373 | private boolean prioritySet; |
| 374 | private int priority; |
| 375 | private boolean reasonSet; |
| 376 | private short reason; |
| 377 | private boolean durationSecSet; |
| 378 | private long durationSec; |
| 379 | private boolean durationNsecSet; |
| 380 | private long durationNsec; |
| 381 | private boolean idleTimeoutSet; |
| 382 | private int idleTimeout; |
| 383 | private boolean packetCountSet; |
| 384 | private U64 packetCount; |
| 385 | private boolean byteCountSet; |
| 386 | private U64 byteCount; |
| 387 | |
| 388 | @Override |
| 389 | public OFVersion getVersion() { |
| 390 | return OFVersion.OF_10; |
| 391 | } |
| 392 | |
| 393 | @Override |
| 394 | public OFType getType() { |
| 395 | return OFType.FLOW_REMOVED; |
| 396 | } |
| 397 | |
| 398 | @Override |
| 399 | public long getXid() { |
| 400 | return xid; |
| 401 | } |
| 402 | |
| 403 | @Override |
| 404 | public OFFlowRemoved.Builder setXid(long xid) { |
| 405 | this.xid = xid; |
| 406 | this.xidSet = true; |
| 407 | return this; |
| 408 | } |
| 409 | @Override |
| 410 | public U64 getCookie() { |
| 411 | return cookie; |
| 412 | } |
| 413 | |
| 414 | @Override |
| 415 | public OFFlowRemoved.Builder setCookie(U64 cookie) { |
| 416 | this.cookie = cookie; |
| 417 | this.cookieSet = true; |
| 418 | return this; |
| 419 | } |
| 420 | @Override |
| 421 | public int getPriority() { |
| 422 | return priority; |
| 423 | } |
| 424 | |
| 425 | @Override |
| 426 | public OFFlowRemoved.Builder setPriority(int priority) { |
| 427 | this.priority = priority; |
| 428 | this.prioritySet = true; |
| 429 | return this; |
| 430 | } |
| 431 | @Override |
| 432 | public short getReason() { |
| 433 | return reason; |
| 434 | } |
| 435 | |
| 436 | @Override |
| 437 | public OFFlowRemoved.Builder setReason(short reason) { |
| 438 | this.reason = reason; |
| 439 | this.reasonSet = true; |
| 440 | return this; |
| 441 | } |
| 442 | @Override |
| 443 | public TableId getTableId()throws UnsupportedOperationException { |
| 444 | throw new UnsupportedOperationException("Property tableId not supported in version 1.0"); |
| 445 | } |
| 446 | |
| 447 | @Override |
| 448 | public OFFlowRemoved.Builder setTableId(TableId tableId) throws UnsupportedOperationException { |
| 449 | throw new UnsupportedOperationException("Property tableId not supported in version 1.0"); |
| 450 | } |
| 451 | @Override |
| 452 | public long getDurationSec() { |
| 453 | return durationSec; |
| 454 | } |
| 455 | |
| 456 | @Override |
| 457 | public OFFlowRemoved.Builder setDurationSec(long durationSec) { |
| 458 | this.durationSec = durationSec; |
| 459 | this.durationSecSet = true; |
| 460 | return this; |
| 461 | } |
| 462 | @Override |
| 463 | public long getDurationNsec() { |
| 464 | return durationNsec; |
| 465 | } |
| 466 | |
| 467 | @Override |
| 468 | public OFFlowRemoved.Builder setDurationNsec(long durationNsec) { |
| 469 | this.durationNsec = durationNsec; |
| 470 | this.durationNsecSet = true; |
| 471 | return this; |
| 472 | } |
| 473 | @Override |
| 474 | public int getIdleTimeout() { |
| 475 | return idleTimeout; |
| 476 | } |
| 477 | |
| 478 | @Override |
| 479 | public OFFlowRemoved.Builder setIdleTimeout(int idleTimeout) { |
| 480 | this.idleTimeout = idleTimeout; |
| 481 | this.idleTimeoutSet = true; |
| 482 | return this; |
| 483 | } |
| 484 | @Override |
| 485 | public int getHardTimeout()throws UnsupportedOperationException { |
| 486 | throw new UnsupportedOperationException("Property hardTimeout not supported in version 1.0"); |
| 487 | } |
| 488 | |
| 489 | @Override |
| 490 | public OFFlowRemoved.Builder setHardTimeout(int hardTimeout) throws UnsupportedOperationException { |
| 491 | throw new UnsupportedOperationException("Property hardTimeout not supported in version 1.0"); |
| 492 | } |
| 493 | @Override |
| 494 | public U64 getPacketCount() { |
| 495 | return packetCount; |
| 496 | } |
| 497 | |
| 498 | @Override |
| 499 | public OFFlowRemoved.Builder setPacketCount(U64 packetCount) { |
| 500 | this.packetCount = packetCount; |
| 501 | this.packetCountSet = true; |
| 502 | return this; |
| 503 | } |
| 504 | @Override |
| 505 | public U64 getByteCount() { |
| 506 | return byteCount; |
| 507 | } |
| 508 | |
| 509 | @Override |
| 510 | public OFFlowRemoved.Builder setByteCount(U64 byteCount) { |
| 511 | this.byteCount = byteCount; |
| 512 | this.byteCountSet = true; |
| 513 | return this; |
| 514 | } |
| 515 | @Override |
| 516 | public Match getMatch() { |
| 517 | return match; |
| 518 | } |
| 519 | |
| 520 | @Override |
| 521 | public OFFlowRemoved.Builder setMatch(Match match) { |
| 522 | this.match = match; |
| 523 | this.matchSet = true; |
| 524 | return this; |
| 525 | } |
| 526 | // |
| 527 | @Override |
| 528 | public OFFlowRemoved build() { |
| 529 | long xid = this.xidSet ? this.xid : DEFAULT_XID; |
| 530 | Match match = this.matchSet ? this.match : DEFAULT_MATCH; |
| 531 | if(match == null) |
| 532 | throw new NullPointerException("Property match must not be null"); |
| 533 | U64 cookie = this.cookieSet ? this.cookie : DEFAULT_COOKIE; |
| 534 | if(cookie == null) |
| 535 | throw new NullPointerException("Property cookie must not be null"); |
| 536 | int priority = this.prioritySet ? this.priority : DEFAULT_PRIORITY; |
| 537 | short reason = this.reasonSet ? this.reason : DEFAULT_REASON; |
| 538 | long durationSec = this.durationSecSet ? this.durationSec : DEFAULT_DURATION_SEC; |
| 539 | long durationNsec = this.durationNsecSet ? this.durationNsec : DEFAULT_DURATION_NSEC; |
| 540 | int idleTimeout = this.idleTimeoutSet ? this.idleTimeout : DEFAULT_IDLE_TIMEOUT; |
| 541 | U64 packetCount = this.packetCountSet ? this.packetCount : DEFAULT_PACKET_COUNT; |
| 542 | if(packetCount == null) |
| 543 | throw new NullPointerException("Property packetCount must not be null"); |
| 544 | U64 byteCount = this.byteCountSet ? this.byteCount : DEFAULT_BYTE_COUNT; |
| 545 | if(byteCount == null) |
| 546 | throw new NullPointerException("Property byteCount must not be null"); |
| 547 | |
| 548 | |
| 549 | return new OFFlowRemovedVer10( |
| 550 | xid, |
| 551 | match, |
| 552 | cookie, |
| 553 | priority, |
| 554 | reason, |
| 555 | durationSec, |
| 556 | durationNsec, |
| 557 | idleTimeout, |
| 558 | packetCount, |
| 559 | byteCount |
| 560 | ); |
| 561 | } |
| 562 | |
| 563 | } |
| 564 | |
| 565 | |
| 566 | final static Reader READER = new Reader(); |
| 567 | static class Reader implements OFMessageReader<OFFlowRemoved> { |
| 568 | @Override |
| 569 | public OFFlowRemoved readFrom(ChannelBuffer bb) throws OFParseError { |
| 570 | int start = bb.readerIndex(); |
| 571 | // fixed value property version == 1 |
| 572 | byte version = bb.readByte(); |
| 573 | if(version != (byte) 0x1) |
| 574 | throw new OFParseError("Wrong version: Expected=OFVersion.OF_10(1), got="+version); |
| 575 | // fixed value property type == 11 |
| 576 | byte type = bb.readByte(); |
| 577 | if(type != (byte) 0xb) |
| 578 | throw new OFParseError("Wrong type: Expected=OFType.FLOW_REMOVED(11), got="+type); |
| 579 | int length = U16.f(bb.readShort()); |
| 580 | if(length != 88) |
| 581 | throw new OFParseError("Wrong length: Expected=88(88), got="+length); |
| 582 | if(bb.readableBytes() + (bb.readerIndex() - start) < length) { |
| 583 | // Buffer does not have all data yet |
| 584 | bb.readerIndex(start); |
| 585 | return null; |
| 586 | } |
| 587 | if(logger.isTraceEnabled()) |
| 588 | logger.trace("readFrom - length={}", length); |
| 589 | long xid = U32.f(bb.readInt()); |
| 590 | Match match = ChannelUtilsVer10.readOFMatch(bb); |
| 591 | U64 cookie = U64.ofRaw(bb.readLong()); |
| 592 | int priority = U16.f(bb.readShort()); |
| 593 | short reason = U8.f(bb.readByte()); |
| 594 | // pad: 1 bytes |
| 595 | bb.skipBytes(1); |
| 596 | long durationSec = U32.f(bb.readInt()); |
| 597 | long durationNsec = U32.f(bb.readInt()); |
| 598 | int idleTimeout = U16.f(bb.readShort()); |
| 599 | // pad: 2 bytes |
| 600 | bb.skipBytes(2); |
| 601 | U64 packetCount = U64.ofRaw(bb.readLong()); |
| 602 | U64 byteCount = U64.ofRaw(bb.readLong()); |
| 603 | |
| 604 | OFFlowRemovedVer10 flowRemovedVer10 = new OFFlowRemovedVer10( |
| 605 | xid, |
| 606 | match, |
| 607 | cookie, |
| 608 | priority, |
| 609 | reason, |
| 610 | durationSec, |
| 611 | durationNsec, |
| 612 | idleTimeout, |
| 613 | packetCount, |
| 614 | byteCount |
| 615 | ); |
| 616 | if(logger.isTraceEnabled()) |
| 617 | logger.trace("readFrom - read={}", flowRemovedVer10); |
| 618 | return flowRemovedVer10; |
| 619 | } |
| 620 | } |
| 621 | |
| 622 | public void putTo(PrimitiveSink sink) { |
| 623 | FUNNEL.funnel(this, sink); |
| 624 | } |
| 625 | |
| 626 | final static OFFlowRemovedVer10Funnel FUNNEL = new OFFlowRemovedVer10Funnel(); |
| 627 | static class OFFlowRemovedVer10Funnel implements Funnel<OFFlowRemovedVer10> { |
| 628 | private static final long serialVersionUID = 1L; |
| 629 | @Override |
| 630 | public void funnel(OFFlowRemovedVer10 message, PrimitiveSink sink) { |
| 631 | // fixed value property version = 1 |
| 632 | sink.putByte((byte) 0x1); |
| 633 | // fixed value property type = 11 |
| 634 | sink.putByte((byte) 0xb); |
| 635 | // fixed value property length = 88 |
| 636 | sink.putShort((short) 0x58); |
| 637 | sink.putLong(message.xid); |
| 638 | message.match.putTo(sink); |
| 639 | message.cookie.putTo(sink); |
| 640 | sink.putInt(message.priority); |
| 641 | sink.putShort(message.reason); |
| 642 | // skip pad (1 bytes) |
| 643 | sink.putLong(message.durationSec); |
| 644 | sink.putLong(message.durationNsec); |
| 645 | sink.putInt(message.idleTimeout); |
| 646 | // skip pad (2 bytes) |
| 647 | message.packetCount.putTo(sink); |
| 648 | message.byteCount.putTo(sink); |
| 649 | } |
| 650 | } |
| 651 | |
| 652 | |
| 653 | public void writeTo(ChannelBuffer bb) { |
| 654 | WRITER.write(bb, this); |
| 655 | } |
| 656 | |
| 657 | final static Writer WRITER = new Writer(); |
| 658 | static class Writer implements OFMessageWriter<OFFlowRemovedVer10> { |
| 659 | @Override |
| 660 | public void write(ChannelBuffer bb, OFFlowRemovedVer10 message) { |
| 661 | // fixed value property version = 1 |
| 662 | bb.writeByte((byte) 0x1); |
| 663 | // fixed value property type = 11 |
| 664 | bb.writeByte((byte) 0xb); |
| 665 | // fixed value property length = 88 |
| 666 | bb.writeShort((short) 0x58); |
| 667 | bb.writeInt(U32.t(message.xid)); |
| 668 | message.match.writeTo(bb); |
| 669 | bb.writeLong(message.cookie.getValue()); |
| 670 | bb.writeShort(U16.t(message.priority)); |
| 671 | bb.writeByte(U8.t(message.reason)); |
| 672 | // pad: 1 bytes |
| 673 | bb.writeZero(1); |
| 674 | bb.writeInt(U32.t(message.durationSec)); |
| 675 | bb.writeInt(U32.t(message.durationNsec)); |
| 676 | bb.writeShort(U16.t(message.idleTimeout)); |
| 677 | // pad: 2 bytes |
| 678 | bb.writeZero(2); |
| 679 | bb.writeLong(message.packetCount.getValue()); |
| 680 | bb.writeLong(message.byteCount.getValue()); |
| 681 | |
| 682 | |
| 683 | } |
| 684 | } |
| 685 | |
| 686 | @Override |
| 687 | public String toString() { |
| 688 | StringBuilder b = new StringBuilder("OFFlowRemovedVer10("); |
| 689 | b.append("xid=").append(xid); |
| 690 | b.append(", "); |
| 691 | b.append("match=").append(match); |
| 692 | b.append(", "); |
| 693 | b.append("cookie=").append(cookie); |
| 694 | b.append(", "); |
| 695 | b.append("priority=").append(priority); |
| 696 | b.append(", "); |
| 697 | b.append("reason=").append(reason); |
| 698 | b.append(", "); |
| 699 | b.append("durationSec=").append(durationSec); |
| 700 | b.append(", "); |
| 701 | b.append("durationNsec=").append(durationNsec); |
| 702 | b.append(", "); |
| 703 | b.append("idleTimeout=").append(idleTimeout); |
| 704 | b.append(", "); |
| 705 | b.append("packetCount=").append(packetCount); |
| 706 | b.append(", "); |
| 707 | b.append("byteCount=").append(byteCount); |
| 708 | b.append(")"); |
| 709 | return b.toString(); |
| 710 | } |
| 711 | |
| 712 | @Override |
| 713 | public boolean equals(Object obj) { |
| 714 | if (this == obj) |
| 715 | return true; |
| 716 | if (obj == null) |
| 717 | return false; |
| 718 | if (getClass() != obj.getClass()) |
| 719 | return false; |
| 720 | OFFlowRemovedVer10 other = (OFFlowRemovedVer10) obj; |
| 721 | |
| 722 | if( xid != other.xid) |
| 723 | return false; |
| 724 | if (match == null) { |
| 725 | if (other.match != null) |
| 726 | return false; |
| 727 | } else if (!match.equals(other.match)) |
| 728 | return false; |
| 729 | if (cookie == null) { |
| 730 | if (other.cookie != null) |
| 731 | return false; |
| 732 | } else if (!cookie.equals(other.cookie)) |
| 733 | return false; |
| 734 | if( priority != other.priority) |
| 735 | return false; |
| 736 | if( reason != other.reason) |
| 737 | return false; |
| 738 | if( durationSec != other.durationSec) |
| 739 | return false; |
| 740 | if( durationNsec != other.durationNsec) |
| 741 | return false; |
| 742 | if( idleTimeout != other.idleTimeout) |
| 743 | return false; |
| 744 | if (packetCount == null) { |
| 745 | if (other.packetCount != null) |
| 746 | return false; |
| 747 | } else if (!packetCount.equals(other.packetCount)) |
| 748 | return false; |
| 749 | if (byteCount == null) { |
| 750 | if (other.byteCount != null) |
| 751 | return false; |
| 752 | } else if (!byteCount.equals(other.byteCount)) |
| 753 | return false; |
| 754 | return true; |
| 755 | } |
| 756 | |
| 757 | @Override |
| 758 | public int hashCode() { |
| 759 | final int prime = 31; |
| 760 | int result = 1; |
| 761 | |
| 762 | result = prime * (int) (xid ^ (xid >>> 32)); |
| 763 | result = prime * result + ((match == null) ? 0 : match.hashCode()); |
| 764 | result = prime * result + ((cookie == null) ? 0 : cookie.hashCode()); |
| 765 | result = prime * result + priority; |
| 766 | result = prime * result + reason; |
| 767 | result = prime * (int) (durationSec ^ (durationSec >>> 32)); |
| 768 | result = prime * (int) (durationNsec ^ (durationNsec >>> 32)); |
| 769 | result = prime * result + idleTimeout; |
| 770 | result = prime * result + ((packetCount == null) ? 0 : packetCount.hashCode()); |
| 771 | result = prime * result + ((byteCount == null) ? 0 : byteCount.hashCode()); |
| 772 | return result; |
| 773 | } |
| 774 | |
| 775 | } |