blob: afe00bd44f6e7b843e3c58db5d83f94f3615b08d [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.ver10;
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 org.slf4j.Logger;
27import org.slf4j.LoggerFactory;
28import java.util.Set;
29import org.jboss.netty.buffer.ChannelBuffer;
30import com.google.common.hash.PrimitiveSink;
31import com.google.common.hash.Funnel;
32
33class OFBsnHybridGetReplyVer10 implements OFBsnHybridGetReply {
34 private static final Logger logger = LoggerFactory.getLogger(OFBsnHybridGetReplyVer10.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 short DEFAULT_HYBRID_ENABLE = (short) 0x0;
41 private final static int DEFAULT_HYBRID_VERSION = 0x0;
42
43 // OF message fields
44 private final long xid;
45 private final short hybridEnable;
46 private final int hybridVersion;
47//
48 // Immutable default instance
49 final static OFBsnHybridGetReplyVer10 DEFAULT = new OFBsnHybridGetReplyVer10(
50 DEFAULT_XID, DEFAULT_HYBRID_ENABLE, DEFAULT_HYBRID_VERSION
51 );
52
53 // package private constructor - used by readers, builders, and factory
54 OFBsnHybridGetReplyVer10(long xid, short hybridEnable, int hybridVersion) {
55 this.xid = xid;
56 this.hybridEnable = hybridEnable;
57 this.hybridVersion = hybridVersion;
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 0x1cL;
84 }
85
86 @Override
87 public short getHybridEnable() {
88 return hybridEnable;
89 }
90
91 @Override
92 public int getHybridVersion() {
93 return hybridVersion;
94 }
95
96
97
98 public OFBsnHybridGetReply.Builder createBuilder() {
99 return new BuilderWithParent(this);
100 }
101
102 static class BuilderWithParent implements OFBsnHybridGetReply.Builder {
103 final OFBsnHybridGetReplyVer10 parentMessage;
104
105 // OF message fields
106 private boolean xidSet;
107 private long xid;
108 private boolean hybridEnableSet;
109 private short hybridEnable;
110 private boolean hybridVersionSet;
111 private int hybridVersion;
112
113 BuilderWithParent(OFBsnHybridGetReplyVer10 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 OFBsnHybridGetReply.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 0x1cL;
146 }
147
148 @Override
149 public short getHybridEnable() {
150 return hybridEnable;
151 }
152
153 @Override
154 public OFBsnHybridGetReply.Builder setHybridEnable(short hybridEnable) {
155 this.hybridEnable = hybridEnable;
156 this.hybridEnableSet = true;
157 return this;
158 }
159 @Override
160 public int getHybridVersion() {
161 return hybridVersion;
162 }
163
164 @Override
165 public OFBsnHybridGetReply.Builder setHybridVersion(int hybridVersion) {
166 this.hybridVersion = hybridVersion;
167 this.hybridVersionSet = true;
168 return this;
169 }
170
171
172 @Override
173 public OFBsnHybridGetReply build() {
174 long xid = this.xidSet ? this.xid : parentMessage.xid;
175 short hybridEnable = this.hybridEnableSet ? this.hybridEnable : parentMessage.hybridEnable;
176 int hybridVersion = this.hybridVersionSet ? this.hybridVersion : parentMessage.hybridVersion;
177
178 //
179 return new OFBsnHybridGetReplyVer10(
180 xid,
181 hybridEnable,
182 hybridVersion
183 );
184 }
185
186 }
187
188 static class Builder implements OFBsnHybridGetReply.Builder {
189 // OF message fields
190 private boolean xidSet;
191 private long xid;
192 private boolean hybridEnableSet;
193 private short hybridEnable;
194 private boolean hybridVersionSet;
195 private int hybridVersion;
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 OFBsnHybridGetReply.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 0x1cL;
226 }
227
228 @Override
229 public short getHybridEnable() {
230 return hybridEnable;
231 }
232
233 @Override
234 public OFBsnHybridGetReply.Builder setHybridEnable(short hybridEnable) {
235 this.hybridEnable = hybridEnable;
236 this.hybridEnableSet = true;
237 return this;
238 }
239 @Override
240 public int getHybridVersion() {
241 return hybridVersion;
242 }
243
244 @Override
245 public OFBsnHybridGetReply.Builder setHybridVersion(int hybridVersion) {
246 this.hybridVersion = hybridVersion;
247 this.hybridVersionSet = true;
248 return this;
249 }
250//
251 @Override
252 public OFBsnHybridGetReply build() {
253 long xid = this.xidSet ? this.xid : DEFAULT_XID;
254 short hybridEnable = this.hybridEnableSet ? this.hybridEnable : DEFAULT_HYBRID_ENABLE;
255 int hybridVersion = this.hybridVersionSet ? this.hybridVersion : DEFAULT_HYBRID_VERSION;
256
257
258 return new OFBsnHybridGetReplyVer10(
259 xid,
260 hybridEnable,
261 hybridVersion
262 );
263 }
264
265 }
266
267
268 final static Reader READER = new Reader();
269 static class Reader implements OFMessageReader<OFBsnHybridGetReply> {
270 @Override
271 public OFBsnHybridGetReply 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 == 0x1cL
297 int subtype = bb.readInt();
298 if(subtype != 0x1c)
299 throw new OFParseError("Wrong subtype: Expected=0x1cL(0x1cL), got="+subtype);
300 short hybridEnable = U8.f(bb.readByte());
301 // pad: 1 bytes
302 bb.skipBytes(1);
303 int hybridVersion = U16.f(bb.readShort());
304 // pad: 4 bytes
305 bb.skipBytes(4);
306
307 OFBsnHybridGetReplyVer10 bsnHybridGetReplyVer10 = new OFBsnHybridGetReplyVer10(
308 xid,
309 hybridEnable,
310 hybridVersion
311 );
312 if(logger.isTraceEnabled())
313 logger.trace("readFrom - read={}", bsnHybridGetReplyVer10);
314 return bsnHybridGetReplyVer10;
315 }
316 }
317
318 public void putTo(PrimitiveSink sink) {
319 FUNNEL.funnel(this, sink);
320 }
321
322 final static OFBsnHybridGetReplyVer10Funnel FUNNEL = new OFBsnHybridGetReplyVer10Funnel();
323 static class OFBsnHybridGetReplyVer10Funnel implements Funnel<OFBsnHybridGetReplyVer10> {
324 private static final long serialVersionUID = 1L;
325 @Override
326 public void funnel(OFBsnHybridGetReplyVer10 message, PrimitiveSink sink) {
327 // fixed value property version = 1
328 sink.putByte((byte) 0x1);
329 // fixed value property type = 4
330 sink.putByte((byte) 0x4);
331 // fixed value property length = 24
332 sink.putShort((short) 0x18);
333 sink.putLong(message.xid);
334 // fixed value property experimenter = 0x5c16c7L
335 sink.putInt(0x5c16c7);
336 // fixed value property subtype = 0x1cL
337 sink.putInt(0x1c);
338 sink.putShort(message.hybridEnable);
339 // skip pad (1 bytes)
340 sink.putInt(message.hybridVersion);
341 // skip pad (4 bytes)
342 }
343 }
344
345
346 public void writeTo(ChannelBuffer bb) {
347 WRITER.write(bb, this);
348 }
349
350 final static Writer WRITER = new Writer();
351 static class Writer implements OFMessageWriter<OFBsnHybridGetReplyVer10> {
352 @Override
353 public void write(ChannelBuffer bb, OFBsnHybridGetReplyVer10 message) {
354 // fixed value property version = 1
355 bb.writeByte((byte) 0x1);
356 // fixed value property type = 4
357 bb.writeByte((byte) 0x4);
358 // fixed value property length = 24
359 bb.writeShort((short) 0x18);
360 bb.writeInt(U32.t(message.xid));
361 // fixed value property experimenter = 0x5c16c7L
362 bb.writeInt(0x5c16c7);
363 // fixed value property subtype = 0x1cL
364 bb.writeInt(0x1c);
365 bb.writeByte(U8.t(message.hybridEnable));
366 // pad: 1 bytes
367 bb.writeZero(1);
368 bb.writeShort(U16.t(message.hybridVersion));
369 // pad: 4 bytes
370 bb.writeZero(4);
371
372
373 }
374 }
375
376 @Override
377 public String toString() {
378 StringBuilder b = new StringBuilder("OFBsnHybridGetReplyVer10(");
379 b.append("xid=").append(xid);
380 b.append(", ");
381 b.append("hybridEnable=").append(hybridEnable);
382 b.append(", ");
383 b.append("hybridVersion=").append(hybridVersion);
384 b.append(")");
385 return b.toString();
386 }
387
388 @Override
389 public boolean equals(Object obj) {
390 if (this == obj)
391 return true;
392 if (obj == null)
393 return false;
394 if (getClass() != obj.getClass())
395 return false;
396 OFBsnHybridGetReplyVer10 other = (OFBsnHybridGetReplyVer10) obj;
397
398 if( xid != other.xid)
399 return false;
400 if( hybridEnable != other.hybridEnable)
401 return false;
402 if( hybridVersion != other.hybridVersion)
403 return false;
404 return true;
405 }
406
407 @Override
408 public int hashCode() {
409 final int prime = 31;
410 int result = 1;
411
412 result = prime * (int) (xid ^ (xid >>> 32));
413 result = prime * result + hybridEnable;
414 result = prime * result + hybridVersion;
415 return result;
416 }
417
418}