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