blob: 5ee53c737921069c3f3e11d2a13befb82f4b98d8 [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.ver13;
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 OFBsnGetMirroringReplyVer13 implements OFBsnGetMirroringReply {
34 private static final Logger logger = LoggerFactory.getLogger(OFBsnGetMirroringReplyVer13.class);
35 // version: 1.3
36 final static byte WIRE_VERSION = 4;
37 final static int LENGTH = 20;
38
39 private final static long DEFAULT_XID = 0x0L;
40 private final static short DEFAULT_REPORT_MIRROR_PORTS = (short) 0x0;
41
42 // OF message fields
43 private final long xid;
44 private final short reportMirrorPorts;
45//
46 // Immutable default instance
47 final static OFBsnGetMirroringReplyVer13 DEFAULT = new OFBsnGetMirroringReplyVer13(
48 DEFAULT_XID, DEFAULT_REPORT_MIRROR_PORTS
49 );
50
51 // package private constructor - used by readers, builders, and factory
52 OFBsnGetMirroringReplyVer13(long xid, short reportMirrorPorts) {
53 this.xid = xid;
54 this.reportMirrorPorts = reportMirrorPorts;
55 }
56
57 // Accessors for OF message fields
58 @Override
59 public OFVersion getVersion() {
60 return OFVersion.OF_13;
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 0x5L;
81 }
82
83 @Override
84 public short getReportMirrorPorts() {
85 return reportMirrorPorts;
86 }
87
88
89
90 public OFBsnGetMirroringReply.Builder createBuilder() {
91 return new BuilderWithParent(this);
92 }
93
94 static class BuilderWithParent implements OFBsnGetMirroringReply.Builder {
95 final OFBsnGetMirroringReplyVer13 parentMessage;
96
97 // OF message fields
98 private boolean xidSet;
99 private long xid;
100 private boolean reportMirrorPortsSet;
101 private short reportMirrorPorts;
102
103 BuilderWithParent(OFBsnGetMirroringReplyVer13 parentMessage) {
104 this.parentMessage = parentMessage;
105 }
106
107 @Override
108 public OFVersion getVersion() {
109 return OFVersion.OF_13;
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 OFBsnGetMirroringReply.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 0x5L;
136 }
137
138 @Override
139 public short getReportMirrorPorts() {
140 return reportMirrorPorts;
141 }
142
143 @Override
144 public OFBsnGetMirroringReply.Builder setReportMirrorPorts(short reportMirrorPorts) {
145 this.reportMirrorPorts = reportMirrorPorts;
146 this.reportMirrorPortsSet = true;
147 return this;
148 }
149
150
151 @Override
152 public OFBsnGetMirroringReply build() {
153 long xid = this.xidSet ? this.xid : parentMessage.xid;
154 short reportMirrorPorts = this.reportMirrorPortsSet ? this.reportMirrorPorts : parentMessage.reportMirrorPorts;
155
156 //
157 return new OFBsnGetMirroringReplyVer13(
158 xid,
159 reportMirrorPorts
160 );
161 }
162
163 }
164
165 static class Builder implements OFBsnGetMirroringReply.Builder {
166 // OF message fields
167 private boolean xidSet;
168 private long xid;
169 private boolean reportMirrorPortsSet;
170 private short reportMirrorPorts;
171
172 @Override
173 public OFVersion getVersion() {
174 return OFVersion.OF_13;
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 OFBsnGetMirroringReply.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 0x5L;
201 }
202
203 @Override
204 public short getReportMirrorPorts() {
205 return reportMirrorPorts;
206 }
207
208 @Override
209 public OFBsnGetMirroringReply.Builder setReportMirrorPorts(short reportMirrorPorts) {
210 this.reportMirrorPorts = reportMirrorPorts;
211 this.reportMirrorPortsSet = true;
212 return this;
213 }
214//
215 @Override
216 public OFBsnGetMirroringReply build() {
217 long xid = this.xidSet ? this.xid : DEFAULT_XID;
218 short reportMirrorPorts = this.reportMirrorPortsSet ? this.reportMirrorPorts : DEFAULT_REPORT_MIRROR_PORTS;
219
220
221 return new OFBsnGetMirroringReplyVer13(
222 xid,
223 reportMirrorPorts
224 );
225 }
226
227 }
228
229
230 final static Reader READER = new Reader();
231 static class Reader implements OFMessageReader<OFBsnGetMirroringReply> {
232 @Override
233 public OFBsnGetMirroringReply readFrom(ChannelBuffer bb) throws OFParseError {
234 int start = bb.readerIndex();
235 // fixed value property version == 4
236 byte version = bb.readByte();
237 if(version != (byte) 0x4)
238 throw new OFParseError("Wrong version: Expected=OFVersion.OF_13(4), 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 == 0x5L
259 int subtype = bb.readInt();
260 if(subtype != 0x5)
261 throw new OFParseError("Wrong subtype: Expected=0x5L(0x5L), got="+subtype);
262 short reportMirrorPorts = U8.f(bb.readByte());
263 // pad: 3 bytes
264 bb.skipBytes(3);
265
266 OFBsnGetMirroringReplyVer13 bsnGetMirroringReplyVer13 = new OFBsnGetMirroringReplyVer13(
267 xid,
268 reportMirrorPorts
269 );
270 if(logger.isTraceEnabled())
271 logger.trace("readFrom - read={}", bsnGetMirroringReplyVer13);
272 return bsnGetMirroringReplyVer13;
273 }
274 }
275
276 public void putTo(PrimitiveSink sink) {
277 FUNNEL.funnel(this, sink);
278 }
279
280 final static OFBsnGetMirroringReplyVer13Funnel FUNNEL = new OFBsnGetMirroringReplyVer13Funnel();
281 static class OFBsnGetMirroringReplyVer13Funnel implements Funnel<OFBsnGetMirroringReplyVer13> {
282 private static final long serialVersionUID = 1L;
283 @Override
284 public void funnel(OFBsnGetMirroringReplyVer13 message, PrimitiveSink sink) {
285 // fixed value property version = 4
286 sink.putByte((byte) 0x4);
287 // fixed value property type = 4
288 sink.putByte((byte) 0x4);
289 // fixed value property length = 20
290 sink.putShort((short) 0x14);
291 sink.putLong(message.xid);
292 // fixed value property experimenter = 0x5c16c7L
293 sink.putInt(0x5c16c7);
294 // fixed value property subtype = 0x5L
295 sink.putInt(0x5);
296 sink.putShort(message.reportMirrorPorts);
297 // skip pad (3 bytes)
298 }
299 }
300
301
302 public void writeTo(ChannelBuffer bb) {
303 WRITER.write(bb, this);
304 }
305
306 final static Writer WRITER = new Writer();
307 static class Writer implements OFMessageWriter<OFBsnGetMirroringReplyVer13> {
308 @Override
309 public void write(ChannelBuffer bb, OFBsnGetMirroringReplyVer13 message) {
310 // fixed value property version = 4
311 bb.writeByte((byte) 0x4);
312 // fixed value property type = 4
313 bb.writeByte((byte) 0x4);
314 // fixed value property length = 20
315 bb.writeShort((short) 0x14);
316 bb.writeInt(U32.t(message.xid));
317 // fixed value property experimenter = 0x5c16c7L
318 bb.writeInt(0x5c16c7);
319 // fixed value property subtype = 0x5L
320 bb.writeInt(0x5);
321 bb.writeByte(U8.t(message.reportMirrorPorts));
322 // pad: 3 bytes
323 bb.writeZero(3);
324
325
326 }
327 }
328
329 @Override
330 public String toString() {
331 StringBuilder b = new StringBuilder("OFBsnGetMirroringReplyVer13(");
332 b.append("xid=").append(xid);
333 b.append(", ");
334 b.append("reportMirrorPorts=").append(reportMirrorPorts);
335 b.append(")");
336 return b.toString();
337 }
338
339 @Override
340 public boolean equals(Object obj) {
341 if (this == obj)
342 return true;
343 if (obj == null)
344 return false;
345 if (getClass() != obj.getClass())
346 return false;
347 OFBsnGetMirroringReplyVer13 other = (OFBsnGetMirroringReplyVer13) obj;
348
349 if( xid != other.xid)
350 return false;
351 if( reportMirrorPorts != other.reportMirrorPorts)
352 return false;
353 return true;
354 }
355
356 @Override
357 public int hashCode() {
358 final int prime = 31;
359 int result = 1;
360
361 result = prime * (int) (xid ^ (xid >>> 32));
362 result = prime * result + reportMirrorPorts;
363 return result;
364 }
365
366}