blob: d4a44033ecf08eaf717a109cfb9a60dc7b3d863c [file] [log] [blame]
tom0eb04ca2014-08-25 14:34:51 -07001// 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
10package org.projectfloodlight.openflow.protocol.ver11;
11
12import org.projectfloodlight.openflow.protocol.*;
13import org.projectfloodlight.openflow.protocol.action.*;
14import org.projectfloodlight.openflow.protocol.actionid.*;
15import org.projectfloodlight.openflow.protocol.bsntlv.*;
16import org.projectfloodlight.openflow.protocol.errormsg.*;
17import org.projectfloodlight.openflow.protocol.meterband.*;
18import org.projectfloodlight.openflow.protocol.instruction.*;
19import org.projectfloodlight.openflow.protocol.instructionid.*;
20import org.projectfloodlight.openflow.protocol.match.*;
21import org.projectfloodlight.openflow.protocol.oxm.*;
22import org.projectfloodlight.openflow.protocol.queueprop.*;
23import org.projectfloodlight.openflow.types.*;
24import org.projectfloodlight.openflow.util.*;
25import org.projectfloodlight.openflow.exceptions.*;
26import java.util.Set;
27import org.slf4j.Logger;
28import org.slf4j.LoggerFactory;
29import org.jboss.netty.buffer.ChannelBuffer;
30import com.google.common.hash.PrimitiveSink;
31import com.google.common.hash.Funnel;
32
33class OFBsnSetPktinSuppressionRequestVer11 implements OFBsnSetPktinSuppressionRequest {
34 private static final Logger logger = LoggerFactory.getLogger(OFBsnSetPktinSuppressionRequestVer11.class);
35 // version: 1.1
36 final static byte WIRE_VERSION = 2;
37 final static int LENGTH = 32;
38
39 private final static long DEFAULT_XID = 0x0L;
40 private final static boolean DEFAULT_ENABLED = false;
41 private final static int DEFAULT_IDLE_TIMEOUT = 0x0;
42 private final static int DEFAULT_HARD_TIMEOUT = 0x0;
43 private final static int DEFAULT_PRIORITY = 0x0;
44 private final static U64 DEFAULT_COOKIE = U64.ZERO;
45
46 // OF message fields
47 private final long xid;
48 private final boolean enabled;
49 private final int idleTimeout;
50 private final int hardTimeout;
51 private final int priority;
52 private final U64 cookie;
53//
54 // Immutable default instance
55 final static OFBsnSetPktinSuppressionRequestVer11 DEFAULT = new OFBsnSetPktinSuppressionRequestVer11(
56 DEFAULT_XID, DEFAULT_ENABLED, DEFAULT_IDLE_TIMEOUT, DEFAULT_HARD_TIMEOUT, DEFAULT_PRIORITY, DEFAULT_COOKIE
57 );
58
59 // package private constructor - used by readers, builders, and factory
60 OFBsnSetPktinSuppressionRequestVer11(long xid, boolean enabled, int idleTimeout, int hardTimeout, int priority, U64 cookie) {
61 this.xid = xid;
62 this.enabled = enabled;
63 this.idleTimeout = idleTimeout;
64 this.hardTimeout = hardTimeout;
65 this.priority = priority;
66 this.cookie = cookie;
67 }
68
69 // Accessors for OF message fields
70 @Override
71 public OFVersion getVersion() {
72 return OFVersion.OF_11;
73 }
74
75 @Override
76 public OFType getType() {
77 return OFType.EXPERIMENTER;
78 }
79
80 @Override
81 public long getXid() {
82 return xid;
83 }
84
85 @Override
86 public long getExperimenter() {
87 return 0x5c16c7L;
88 }
89
90 @Override
91 public long getSubtype() {
92 return 0xbL;
93 }
94
95 @Override
96 public boolean isEnabled() {
97 return enabled;
98 }
99
100 @Override
101 public int getIdleTimeout() {
102 return idleTimeout;
103 }
104
105 @Override
106 public int getHardTimeout() {
107 return hardTimeout;
108 }
109
110 @Override
111 public int getPriority() {
112 return priority;
113 }
114
115 @Override
116 public U64 getCookie() {
117 return cookie;
118 }
119
120
121
122 public OFBsnSetPktinSuppressionRequest.Builder createBuilder() {
123 return new BuilderWithParent(this);
124 }
125
126 static class BuilderWithParent implements OFBsnSetPktinSuppressionRequest.Builder {
127 final OFBsnSetPktinSuppressionRequestVer11 parentMessage;
128
129 // OF message fields
130 private boolean xidSet;
131 private long xid;
132 private boolean enabledSet;
133 private boolean enabled;
134 private boolean idleTimeoutSet;
135 private int idleTimeout;
136 private boolean hardTimeoutSet;
137 private int hardTimeout;
138 private boolean prioritySet;
139 private int priority;
140 private boolean cookieSet;
141 private U64 cookie;
142
143 BuilderWithParent(OFBsnSetPktinSuppressionRequestVer11 parentMessage) {
144 this.parentMessage = parentMessage;
145 }
146
147 @Override
148 public OFVersion getVersion() {
149 return OFVersion.OF_11;
150 }
151
152 @Override
153 public OFType getType() {
154 return OFType.EXPERIMENTER;
155 }
156
157 @Override
158 public long getXid() {
159 return xid;
160 }
161
162 @Override
163 public OFBsnSetPktinSuppressionRequest.Builder setXid(long xid) {
164 this.xid = xid;
165 this.xidSet = true;
166 return this;
167 }
168 @Override
169 public long getExperimenter() {
170 return 0x5c16c7L;
171 }
172
173 @Override
174 public long getSubtype() {
175 return 0xbL;
176 }
177
178 @Override
179 public boolean isEnabled() {
180 return enabled;
181 }
182
183 @Override
184 public OFBsnSetPktinSuppressionRequest.Builder setEnabled(boolean enabled) {
185 this.enabled = enabled;
186 this.enabledSet = true;
187 return this;
188 }
189 @Override
190 public int getIdleTimeout() {
191 return idleTimeout;
192 }
193
194 @Override
195 public OFBsnSetPktinSuppressionRequest.Builder setIdleTimeout(int idleTimeout) {
196 this.idleTimeout = idleTimeout;
197 this.idleTimeoutSet = true;
198 return this;
199 }
200 @Override
201 public int getHardTimeout() {
202 return hardTimeout;
203 }
204
205 @Override
206 public OFBsnSetPktinSuppressionRequest.Builder setHardTimeout(int hardTimeout) {
207 this.hardTimeout = hardTimeout;
208 this.hardTimeoutSet = true;
209 return this;
210 }
211 @Override
212 public int getPriority() {
213 return priority;
214 }
215
216 @Override
217 public OFBsnSetPktinSuppressionRequest.Builder setPriority(int priority) {
218 this.priority = priority;
219 this.prioritySet = true;
220 return this;
221 }
222 @Override
223 public U64 getCookie() {
224 return cookie;
225 }
226
227 @Override
228 public OFBsnSetPktinSuppressionRequest.Builder setCookie(U64 cookie) {
229 this.cookie = cookie;
230 this.cookieSet = true;
231 return this;
232 }
233
234
235 @Override
236 public OFBsnSetPktinSuppressionRequest build() {
237 long xid = this.xidSet ? this.xid : parentMessage.xid;
238 boolean enabled = this.enabledSet ? this.enabled : parentMessage.enabled;
239 int idleTimeout = this.idleTimeoutSet ? this.idleTimeout : parentMessage.idleTimeout;
240 int hardTimeout = this.hardTimeoutSet ? this.hardTimeout : parentMessage.hardTimeout;
241 int priority = this.prioritySet ? this.priority : parentMessage.priority;
242 U64 cookie = this.cookieSet ? this.cookie : parentMessage.cookie;
243 if(cookie == null)
244 throw new NullPointerException("Property cookie must not be null");
245
246 //
247 return new OFBsnSetPktinSuppressionRequestVer11(
248 xid,
249 enabled,
250 idleTimeout,
251 hardTimeout,
252 priority,
253 cookie
254 );
255 }
256
257 }
258
259 static class Builder implements OFBsnSetPktinSuppressionRequest.Builder {
260 // OF message fields
261 private boolean xidSet;
262 private long xid;
263 private boolean enabledSet;
264 private boolean enabled;
265 private boolean idleTimeoutSet;
266 private int idleTimeout;
267 private boolean hardTimeoutSet;
268 private int hardTimeout;
269 private boolean prioritySet;
270 private int priority;
271 private boolean cookieSet;
272 private U64 cookie;
273
274 @Override
275 public OFVersion getVersion() {
276 return OFVersion.OF_11;
277 }
278
279 @Override
280 public OFType getType() {
281 return OFType.EXPERIMENTER;
282 }
283
284 @Override
285 public long getXid() {
286 return xid;
287 }
288
289 @Override
290 public OFBsnSetPktinSuppressionRequest.Builder setXid(long xid) {
291 this.xid = xid;
292 this.xidSet = true;
293 return this;
294 }
295 @Override
296 public long getExperimenter() {
297 return 0x5c16c7L;
298 }
299
300 @Override
301 public long getSubtype() {
302 return 0xbL;
303 }
304
305 @Override
306 public boolean isEnabled() {
307 return enabled;
308 }
309
310 @Override
311 public OFBsnSetPktinSuppressionRequest.Builder setEnabled(boolean enabled) {
312 this.enabled = enabled;
313 this.enabledSet = true;
314 return this;
315 }
316 @Override
317 public int getIdleTimeout() {
318 return idleTimeout;
319 }
320
321 @Override
322 public OFBsnSetPktinSuppressionRequest.Builder setIdleTimeout(int idleTimeout) {
323 this.idleTimeout = idleTimeout;
324 this.idleTimeoutSet = true;
325 return this;
326 }
327 @Override
328 public int getHardTimeout() {
329 return hardTimeout;
330 }
331
332 @Override
333 public OFBsnSetPktinSuppressionRequest.Builder setHardTimeout(int hardTimeout) {
334 this.hardTimeout = hardTimeout;
335 this.hardTimeoutSet = true;
336 return this;
337 }
338 @Override
339 public int getPriority() {
340 return priority;
341 }
342
343 @Override
344 public OFBsnSetPktinSuppressionRequest.Builder setPriority(int priority) {
345 this.priority = priority;
346 this.prioritySet = true;
347 return this;
348 }
349 @Override
350 public U64 getCookie() {
351 return cookie;
352 }
353
354 @Override
355 public OFBsnSetPktinSuppressionRequest.Builder setCookie(U64 cookie) {
356 this.cookie = cookie;
357 this.cookieSet = true;
358 return this;
359 }
360//
361 @Override
362 public OFBsnSetPktinSuppressionRequest build() {
363 long xid = this.xidSet ? this.xid : DEFAULT_XID;
364 boolean enabled = this.enabledSet ? this.enabled : DEFAULT_ENABLED;
365 int idleTimeout = this.idleTimeoutSet ? this.idleTimeout : DEFAULT_IDLE_TIMEOUT;
366 int hardTimeout = this.hardTimeoutSet ? this.hardTimeout : DEFAULT_HARD_TIMEOUT;
367 int priority = this.prioritySet ? this.priority : DEFAULT_PRIORITY;
368 U64 cookie = this.cookieSet ? this.cookie : DEFAULT_COOKIE;
369 if(cookie == null)
370 throw new NullPointerException("Property cookie must not be null");
371
372
373 return new OFBsnSetPktinSuppressionRequestVer11(
374 xid,
375 enabled,
376 idleTimeout,
377 hardTimeout,
378 priority,
379 cookie
380 );
381 }
382
383 }
384
385
386 final static Reader READER = new Reader();
387 static class Reader implements OFMessageReader<OFBsnSetPktinSuppressionRequest> {
388 @Override
389 public OFBsnSetPktinSuppressionRequest readFrom(ChannelBuffer bb) throws OFParseError {
390 int start = bb.readerIndex();
391 // fixed value property version == 2
392 byte version = bb.readByte();
393 if(version != (byte) 0x2)
394 throw new OFParseError("Wrong version: Expected=OFVersion.OF_11(2), got="+version);
395 // fixed value property type == 4
396 byte type = bb.readByte();
397 if(type != (byte) 0x4)
398 throw new OFParseError("Wrong type: Expected=OFType.EXPERIMENTER(4), got="+type);
399 int length = U16.f(bb.readShort());
400 if(length != 32)
401 throw new OFParseError("Wrong length: Expected=32(32), got="+length);
402 if(bb.readableBytes() + (bb.readerIndex() - start) < length) {
403 // Buffer does not have all data yet
404 bb.readerIndex(start);
405 return null;
406 }
407 if(logger.isTraceEnabled())
408 logger.trace("readFrom - length={}", length);
409 long xid = U32.f(bb.readInt());
410 // fixed value property experimenter == 0x5c16c7L
411 int experimenter = bb.readInt();
412 if(experimenter != 0x5c16c7)
413 throw new OFParseError("Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got="+experimenter);
414 // fixed value property subtype == 0xbL
415 int subtype = bb.readInt();
416 if(subtype != 0xb)
417 throw new OFParseError("Wrong subtype: Expected=0xbL(0xbL), got="+subtype);
418 boolean enabled = (bb.readByte() != 0);
419 // pad: 1 bytes
420 bb.skipBytes(1);
421 int idleTimeout = U16.f(bb.readShort());
422 int hardTimeout = U16.f(bb.readShort());
423 int priority = U16.f(bb.readShort());
424 U64 cookie = U64.ofRaw(bb.readLong());
425
426 OFBsnSetPktinSuppressionRequestVer11 bsnSetPktinSuppressionRequestVer11 = new OFBsnSetPktinSuppressionRequestVer11(
427 xid,
428 enabled,
429 idleTimeout,
430 hardTimeout,
431 priority,
432 cookie
433 );
434 if(logger.isTraceEnabled())
435 logger.trace("readFrom - read={}", bsnSetPktinSuppressionRequestVer11);
436 return bsnSetPktinSuppressionRequestVer11;
437 }
438 }
439
440 public void putTo(PrimitiveSink sink) {
441 FUNNEL.funnel(this, sink);
442 }
443
444 final static OFBsnSetPktinSuppressionRequestVer11Funnel FUNNEL = new OFBsnSetPktinSuppressionRequestVer11Funnel();
445 static class OFBsnSetPktinSuppressionRequestVer11Funnel implements Funnel<OFBsnSetPktinSuppressionRequestVer11> {
446 private static final long serialVersionUID = 1L;
447 @Override
448 public void funnel(OFBsnSetPktinSuppressionRequestVer11 message, PrimitiveSink sink) {
449 // fixed value property version = 2
450 sink.putByte((byte) 0x2);
451 // fixed value property type = 4
452 sink.putByte((byte) 0x4);
453 // fixed value property length = 32
454 sink.putShort((short) 0x20);
455 sink.putLong(message.xid);
456 // fixed value property experimenter = 0x5c16c7L
457 sink.putInt(0x5c16c7);
458 // fixed value property subtype = 0xbL
459 sink.putInt(0xb);
460 sink.putBoolean(message.enabled);
461 // skip pad (1 bytes)
462 sink.putInt(message.idleTimeout);
463 sink.putInt(message.hardTimeout);
464 sink.putInt(message.priority);
465 message.cookie.putTo(sink);
466 }
467 }
468
469
470 public void writeTo(ChannelBuffer bb) {
471 WRITER.write(bb, this);
472 }
473
474 final static Writer WRITER = new Writer();
475 static class Writer implements OFMessageWriter<OFBsnSetPktinSuppressionRequestVer11> {
476 @Override
477 public void write(ChannelBuffer bb, OFBsnSetPktinSuppressionRequestVer11 message) {
478 // fixed value property version = 2
479 bb.writeByte((byte) 0x2);
480 // fixed value property type = 4
481 bb.writeByte((byte) 0x4);
482 // fixed value property length = 32
483 bb.writeShort((short) 0x20);
484 bb.writeInt(U32.t(message.xid));
485 // fixed value property experimenter = 0x5c16c7L
486 bb.writeInt(0x5c16c7);
487 // fixed value property subtype = 0xbL
488 bb.writeInt(0xb);
489 bb.writeByte(message.enabled ? 1 : 0);
490 // pad: 1 bytes
491 bb.writeZero(1);
492 bb.writeShort(U16.t(message.idleTimeout));
493 bb.writeShort(U16.t(message.hardTimeout));
494 bb.writeShort(U16.t(message.priority));
495 bb.writeLong(message.cookie.getValue());
496
497
498 }
499 }
500
501 @Override
502 public String toString() {
503 StringBuilder b = new StringBuilder("OFBsnSetPktinSuppressionRequestVer11(");
504 b.append("xid=").append(xid);
505 b.append(", ");
506 b.append("enabled=").append(enabled);
507 b.append(", ");
508 b.append("idleTimeout=").append(idleTimeout);
509 b.append(", ");
510 b.append("hardTimeout=").append(hardTimeout);
511 b.append(", ");
512 b.append("priority=").append(priority);
513 b.append(", ");
514 b.append("cookie=").append(cookie);
515 b.append(")");
516 return b.toString();
517 }
518
519 @Override
520 public boolean equals(Object obj) {
521 if (this == obj)
522 return true;
523 if (obj == null)
524 return false;
525 if (getClass() != obj.getClass())
526 return false;
527 OFBsnSetPktinSuppressionRequestVer11 other = (OFBsnSetPktinSuppressionRequestVer11) obj;
528
529 if( xid != other.xid)
530 return false;
531 if( enabled != other.enabled)
532 return false;
533 if( idleTimeout != other.idleTimeout)
534 return false;
535 if( hardTimeout != other.hardTimeout)
536 return false;
537 if( priority != other.priority)
538 return false;
539 if (cookie == null) {
540 if (other.cookie != null)
541 return false;
542 } else if (!cookie.equals(other.cookie))
543 return false;
544 return true;
545 }
546
547 @Override
548 public int hashCode() {
549 final int prime = 31;
550 int result = 1;
551
552 result = prime * (int) (xid ^ (xid >>> 32));
553 result = prime * result + (enabled ? 1231 : 1237);
554 result = prime * result + idleTimeout;
555 result = prime * result + hardTimeout;
556 result = prime * result + priority;
557 result = prime * result + ((cookie == null) ? 0 : cookie.hashCode());
558 return result;
559 }
560
561}