blob: 631b9b192d96c9cf4517515d9d09d3acdfba12b1 [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 OFOxmSctpSrcVer13 implements OFOxmSctpSrc {
34 private static final Logger logger = LoggerFactory.getLogger(OFOxmSctpSrcVer13.class);
35 // version: 1.3
36 final static byte WIRE_VERSION = 4;
37 final static int LENGTH = 6;
38
39 private final static TransportPort DEFAULT_VALUE = TransportPort.NONE;
40
41 // OF message fields
42 private final TransportPort value;
43//
44 // Immutable default instance
45 final static OFOxmSctpSrcVer13 DEFAULT = new OFOxmSctpSrcVer13(
46 DEFAULT_VALUE
47 );
48
49 // package private constructor - used by readers, builders, and factory
50 OFOxmSctpSrcVer13(TransportPort value) {
51 this.value = value;
52 }
53
54 // Accessors for OF message fields
55 @Override
56 public long getTypeLen() {
57 return 0x80002202L;
58 }
59
60 @Override
61 public TransportPort getValue() {
62 return value;
63 }
64
65 @Override
66 public MatchField<TransportPort> getMatchField() {
67 return MatchField.SCTP_SRC;
68 }
69
70 @Override
71 public boolean isMasked() {
72 return false;
73 }
74
75 public OFOxm<TransportPort> getCanonical() {
76 // exact match OXM is always canonical
77 return this;
78 }
79
80 @Override
81 public TransportPort getMask()throws UnsupportedOperationException {
82 throw new UnsupportedOperationException("Property mask not supported in version 1.3");
83 }
84
85 @Override
86 public OFVersion getVersion() {
87 return OFVersion.OF_13;
88 }
89
90
91
92 public OFOxmSctpSrc.Builder createBuilder() {
93 return new BuilderWithParent(this);
94 }
95
96 static class BuilderWithParent implements OFOxmSctpSrc.Builder {
97 final OFOxmSctpSrcVer13 parentMessage;
98
99 // OF message fields
100 private boolean valueSet;
101 private TransportPort value;
102
103 BuilderWithParent(OFOxmSctpSrcVer13 parentMessage) {
104 this.parentMessage = parentMessage;
105 }
106
107 @Override
108 public long getTypeLen() {
109 return 0x80002202L;
110 }
111
112 @Override
113 public TransportPort getValue() {
114 return value;
115 }
116
117 @Override
118 public OFOxmSctpSrc.Builder setValue(TransportPort value) {
119 this.value = value;
120 this.valueSet = true;
121 return this;
122 }
123 @Override
124 public MatchField<TransportPort> getMatchField() {
125 return MatchField.SCTP_SRC;
126 }
127
128 @Override
129 public boolean isMasked() {
130 return false;
131 }
132
133 @Override
134 public OFOxm<TransportPort> getCanonical()throws UnsupportedOperationException {
135 throw new UnsupportedOperationException("Property canonical not supported in version 1.3");
136 }
137
138 @Override
139 public TransportPort getMask()throws UnsupportedOperationException {
140 throw new UnsupportedOperationException("Property mask not supported in version 1.3");
141 }
142
143 @Override
144 public OFVersion getVersion() {
145 return OFVersion.OF_13;
146 }
147
148
149
150 @Override
151 public OFOxmSctpSrc build() {
152 TransportPort value = this.valueSet ? this.value : parentMessage.value;
153 if(value == null)
154 throw new NullPointerException("Property value must not be null");
155
156 //
157 return new OFOxmSctpSrcVer13(
158 value
159 );
160 }
161
162 }
163
164 static class Builder implements OFOxmSctpSrc.Builder {
165 // OF message fields
166 private boolean valueSet;
167 private TransportPort value;
168
169 @Override
170 public long getTypeLen() {
171 return 0x80002202L;
172 }
173
174 @Override
175 public TransportPort getValue() {
176 return value;
177 }
178
179 @Override
180 public OFOxmSctpSrc.Builder setValue(TransportPort value) {
181 this.value = value;
182 this.valueSet = true;
183 return this;
184 }
185 @Override
186 public MatchField<TransportPort> getMatchField() {
187 return MatchField.SCTP_SRC;
188 }
189
190 @Override
191 public boolean isMasked() {
192 return false;
193 }
194
195 @Override
196 public OFOxm<TransportPort> getCanonical()throws UnsupportedOperationException {
197 throw new UnsupportedOperationException("Property canonical not supported in version 1.3");
198 }
199
200 @Override
201 public TransportPort getMask()throws UnsupportedOperationException {
202 throw new UnsupportedOperationException("Property mask not supported in version 1.3");
203 }
204
205 @Override
206 public OFVersion getVersion() {
207 return OFVersion.OF_13;
208 }
209
210//
211 @Override
212 public OFOxmSctpSrc build() {
213 TransportPort value = this.valueSet ? this.value : DEFAULT_VALUE;
214 if(value == null)
215 throw new NullPointerException("Property value must not be null");
216
217
218 return new OFOxmSctpSrcVer13(
219 value
220 );
221 }
222
223 }
224
225
226 final static Reader READER = new Reader();
227 static class Reader implements OFMessageReader<OFOxmSctpSrc> {
228 @Override
229 public OFOxmSctpSrc readFrom(ChannelBuffer bb) throws OFParseError {
230 // fixed value property typeLen == 0x80002202L
231 int typeLen = bb.readInt();
232 if(typeLen != (int) 0x80002202)
233 throw new OFParseError("Wrong typeLen: Expected=0x80002202L(0x80002202L), got="+typeLen);
234 TransportPort value = TransportPort.read2Bytes(bb);
235
236 OFOxmSctpSrcVer13 oxmSctpSrcVer13 = new OFOxmSctpSrcVer13(
237 value
238 );
239 if(logger.isTraceEnabled())
240 logger.trace("readFrom - read={}", oxmSctpSrcVer13);
241 return oxmSctpSrcVer13;
242 }
243 }
244
245 public void putTo(PrimitiveSink sink) {
246 FUNNEL.funnel(this, sink);
247 }
248
249 final static OFOxmSctpSrcVer13Funnel FUNNEL = new OFOxmSctpSrcVer13Funnel();
250 static class OFOxmSctpSrcVer13Funnel implements Funnel<OFOxmSctpSrcVer13> {
251 private static final long serialVersionUID = 1L;
252 @Override
253 public void funnel(OFOxmSctpSrcVer13 message, PrimitiveSink sink) {
254 // fixed value property typeLen = 0x80002202L
255 sink.putInt((int) 0x80002202);
256 message.value.putTo(sink);
257 }
258 }
259
260
261 public void writeTo(ChannelBuffer bb) {
262 WRITER.write(bb, this);
263 }
264
265 final static Writer WRITER = new Writer();
266 static class Writer implements OFMessageWriter<OFOxmSctpSrcVer13> {
267 @Override
268 public void write(ChannelBuffer bb, OFOxmSctpSrcVer13 message) {
269 // fixed value property typeLen = 0x80002202L
270 bb.writeInt((int) 0x80002202);
271 message.value.write2Bytes(bb);
272
273
274 }
275 }
276
277 @Override
278 public String toString() {
279 StringBuilder b = new StringBuilder("OFOxmSctpSrcVer13(");
280 b.append("value=").append(value);
281 b.append(")");
282 return b.toString();
283 }
284
285 @Override
286 public boolean equals(Object obj) {
287 if (this == obj)
288 return true;
289 if (obj == null)
290 return false;
291 if (getClass() != obj.getClass())
292 return false;
293 OFOxmSctpSrcVer13 other = (OFOxmSctpSrcVer13) obj;
294
295 if (value == null) {
296 if (other.value != null)
297 return false;
298 } else if (!value.equals(other.value))
299 return false;
300 return true;
301 }
302
303 @Override
304 public int hashCode() {
305 final int prime = 31;
306 int result = 1;
307
308 result = prime * result + ((value == null) ? 0 : value.hashCode());
309 return result;
310 }
311
312}