blob: b5bdd2a03e8dfcab6ce95b0a5f2aaeeb40790f0d [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 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 OFBsnGetInterfacesRequestVer11 implements OFBsnGetInterfacesRequest {
34 private static final Logger logger = LoggerFactory.getLogger(OFBsnGetInterfacesRequestVer11.class);
35 // version: 1.1
36 final static byte WIRE_VERSION = 2;
37 final static int LENGTH = 16;
38
39 private final static long DEFAULT_XID = 0x0L;
40
41 // OF message fields
42 private final long xid;
43//
44 // Immutable default instance
45 final static OFBsnGetInterfacesRequestVer11 DEFAULT = new OFBsnGetInterfacesRequestVer11(
46 DEFAULT_XID
47 );
48
49 // package private constructor - used by readers, builders, and factory
50 OFBsnGetInterfacesRequestVer11(long xid) {
51 this.xid = xid;
52 }
53
54 // Accessors for OF message fields
55 @Override
56 public OFVersion getVersion() {
57 return OFVersion.OF_11;
58 }
59
60 @Override
61 public OFType getType() {
62 return OFType.EXPERIMENTER;
63 }
64
65 @Override
66 public long getXid() {
67 return xid;
68 }
69
70 @Override
71 public long getExperimenter() {
72 return 0x5c16c7L;
73 }
74
75 @Override
76 public long getSubtype() {
77 return 0x9L;
78 }
79
80
81
82 public OFBsnGetInterfacesRequest.Builder createBuilder() {
83 return new BuilderWithParent(this);
84 }
85
86 static class BuilderWithParent implements OFBsnGetInterfacesRequest.Builder {
87 final OFBsnGetInterfacesRequestVer11 parentMessage;
88
89 // OF message fields
90 private boolean xidSet;
91 private long xid;
92
93 BuilderWithParent(OFBsnGetInterfacesRequestVer11 parentMessage) {
94 this.parentMessage = parentMessage;
95 }
96
97 @Override
98 public OFVersion getVersion() {
99 return OFVersion.OF_11;
100 }
101
102 @Override
103 public OFType getType() {
104 return OFType.EXPERIMENTER;
105 }
106
107 @Override
108 public long getXid() {
109 return xid;
110 }
111
112 @Override
113 public OFBsnGetInterfacesRequest.Builder setXid(long xid) {
114 this.xid = xid;
115 this.xidSet = true;
116 return this;
117 }
118 @Override
119 public long getExperimenter() {
120 return 0x5c16c7L;
121 }
122
123 @Override
124 public long getSubtype() {
125 return 0x9L;
126 }
127
128
129
130 @Override
131 public OFBsnGetInterfacesRequest build() {
132 long xid = this.xidSet ? this.xid : parentMessage.xid;
133
134 //
135 return new OFBsnGetInterfacesRequestVer11(
136 xid
137 );
138 }
139
140 }
141
142 static class Builder implements OFBsnGetInterfacesRequest.Builder {
143 // OF message fields
144 private boolean xidSet;
145 private long xid;
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 OFBsnGetInterfacesRequest.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 0x9L;
176 }
177
178//
179 @Override
180 public OFBsnGetInterfacesRequest build() {
181 long xid = this.xidSet ? this.xid : DEFAULT_XID;
182
183
184 return new OFBsnGetInterfacesRequestVer11(
185 xid
186 );
187 }
188
189 }
190
191
192 final static Reader READER = new Reader();
193 static class Reader implements OFMessageReader<OFBsnGetInterfacesRequest> {
194 @Override
195 public OFBsnGetInterfacesRequest readFrom(ChannelBuffer bb) throws OFParseError {
196 int start = bb.readerIndex();
197 // fixed value property version == 2
198 byte version = bb.readByte();
199 if(version != (byte) 0x2)
200 throw new OFParseError("Wrong version: Expected=OFVersion.OF_11(2), got="+version);
201 // fixed value property type == 4
202 byte type = bb.readByte();
203 if(type != (byte) 0x4)
204 throw new OFParseError("Wrong type: Expected=OFType.EXPERIMENTER(4), got="+type);
205 int length = U16.f(bb.readShort());
206 if(length != 16)
207 throw new OFParseError("Wrong length: Expected=16(16), got="+length);
208 if(bb.readableBytes() + (bb.readerIndex() - start) < length) {
209 // Buffer does not have all data yet
210 bb.readerIndex(start);
211 return null;
212 }
213 if(logger.isTraceEnabled())
214 logger.trace("readFrom - length={}", length);
215 long xid = U32.f(bb.readInt());
216 // fixed value property experimenter == 0x5c16c7L
217 int experimenter = bb.readInt();
218 if(experimenter != 0x5c16c7)
219 throw new OFParseError("Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got="+experimenter);
220 // fixed value property subtype == 0x9L
221 int subtype = bb.readInt();
222 if(subtype != 0x9)
223 throw new OFParseError("Wrong subtype: Expected=0x9L(0x9L), got="+subtype);
224
225 OFBsnGetInterfacesRequestVer11 bsnGetInterfacesRequestVer11 = new OFBsnGetInterfacesRequestVer11(
226 xid
227 );
228 if(logger.isTraceEnabled())
229 logger.trace("readFrom - read={}", bsnGetInterfacesRequestVer11);
230 return bsnGetInterfacesRequestVer11;
231 }
232 }
233
234 public void putTo(PrimitiveSink sink) {
235 FUNNEL.funnel(this, sink);
236 }
237
238 final static OFBsnGetInterfacesRequestVer11Funnel FUNNEL = new OFBsnGetInterfacesRequestVer11Funnel();
239 static class OFBsnGetInterfacesRequestVer11Funnel implements Funnel<OFBsnGetInterfacesRequestVer11> {
240 private static final long serialVersionUID = 1L;
241 @Override
242 public void funnel(OFBsnGetInterfacesRequestVer11 message, PrimitiveSink sink) {
243 // fixed value property version = 2
244 sink.putByte((byte) 0x2);
245 // fixed value property type = 4
246 sink.putByte((byte) 0x4);
247 // fixed value property length = 16
248 sink.putShort((short) 0x10);
249 sink.putLong(message.xid);
250 // fixed value property experimenter = 0x5c16c7L
251 sink.putInt(0x5c16c7);
252 // fixed value property subtype = 0x9L
253 sink.putInt(0x9);
254 }
255 }
256
257
258 public void writeTo(ChannelBuffer bb) {
259 WRITER.write(bb, this);
260 }
261
262 final static Writer WRITER = new Writer();
263 static class Writer implements OFMessageWriter<OFBsnGetInterfacesRequestVer11> {
264 @Override
265 public void write(ChannelBuffer bb, OFBsnGetInterfacesRequestVer11 message) {
266 // fixed value property version = 2
267 bb.writeByte((byte) 0x2);
268 // fixed value property type = 4
269 bb.writeByte((byte) 0x4);
270 // fixed value property length = 16
271 bb.writeShort((short) 0x10);
272 bb.writeInt(U32.t(message.xid));
273 // fixed value property experimenter = 0x5c16c7L
274 bb.writeInt(0x5c16c7);
275 // fixed value property subtype = 0x9L
276 bb.writeInt(0x9);
277
278
279 }
280 }
281
282 @Override
283 public String toString() {
284 StringBuilder b = new StringBuilder("OFBsnGetInterfacesRequestVer11(");
285 b.append("xid=").append(xid);
286 b.append(")");
287 return b.toString();
288 }
289
290 @Override
291 public boolean equals(Object obj) {
292 if (this == obj)
293 return true;
294 if (obj == null)
295 return false;
296 if (getClass() != obj.getClass())
297 return false;
298 OFBsnGetInterfacesRequestVer11 other = (OFBsnGetInterfacesRequestVer11) obj;
299
300 if( xid != other.xid)
301 return false;
302 return true;
303 }
304
305 @Override
306 public int hashCode() {
307 final int prime = 31;
308 int result = 1;
309
310 result = prime * (int) (xid ^ (xid >>> 32));
311 return result;
312 }
313
314}