blob: e0b5ff20fa959d2489fbdca26781f6e283174a10 [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 org.jboss.netty.buffer.ChannelBuffer;
29import com.google.common.hash.PrimitiveSink;
30import com.google.common.hash.Funnel;
31
32class OFActionNiciraDecTtlVer13 implements OFActionNiciraDecTtl {
33 private static final Logger logger = LoggerFactory.getLogger(OFActionNiciraDecTtlVer13.class);
34 // version: 1.3
35 final static byte WIRE_VERSION = 4;
36 final static int LENGTH = 16;
37
38
39 // OF message fields
40//
41 // Immutable default instance
42 final static OFActionNiciraDecTtlVer13 DEFAULT = new OFActionNiciraDecTtlVer13(
43
44 );
45
46 final static OFActionNiciraDecTtlVer13 INSTANCE = new OFActionNiciraDecTtlVer13();
47 // private empty constructor - use shared instance!
48 private OFActionNiciraDecTtlVer13() {
49 }
50
51 // Accessors for OF message fields
52 @Override
53 public OFActionType getType() {
54 return OFActionType.EXPERIMENTER;
55 }
56
57 @Override
58 public long getExperimenter() {
59 return 0x2320L;
60 }
61
62 @Override
63 public int getSubtype() {
64 return 0x12;
65 }
66
67 @Override
68 public OFVersion getVersion() {
69 return OFVersion.OF_13;
70 }
71
72
73
74 // no data members - do not support builder
75 public OFActionNiciraDecTtl.Builder createBuilder() {
76 throw new UnsupportedOperationException("OFActionNiciraDecTtlVer13 has no mutable properties -- builder unneeded");
77 }
78
79
80 final static Reader READER = new Reader();
81 static class Reader implements OFMessageReader<OFActionNiciraDecTtl> {
82 @Override
83 public OFActionNiciraDecTtl readFrom(ChannelBuffer bb) throws OFParseError {
84 int start = bb.readerIndex();
85 // fixed value property type == 65535
86 short type = bb.readShort();
87 if(type != (short) 0xffff)
88 throw new OFParseError("Wrong type: Expected=OFActionType.EXPERIMENTER(65535), got="+type);
89 int length = U16.f(bb.readShort());
90 if(length != 16)
91 throw new OFParseError("Wrong length: Expected=16(16), got="+length);
92 if(bb.readableBytes() + (bb.readerIndex() - start) < length) {
93 // Buffer does not have all data yet
94 bb.readerIndex(start);
95 return null;
96 }
97 if(logger.isTraceEnabled())
98 logger.trace("readFrom - length={}", length);
99 // fixed value property experimenter == 0x2320L
100 int experimenter = bb.readInt();
101 if(experimenter != 0x2320)
102 throw new OFParseError("Wrong experimenter: Expected=0x2320L(0x2320L), got="+experimenter);
103 // fixed value property subtype == 0x12
104 short subtype = bb.readShort();
105 if(subtype != (short) 0x12)
106 throw new OFParseError("Wrong subtype: Expected=0x12(0x12), got="+subtype);
107 // pad: 2 bytes
108 bb.skipBytes(2);
109 // pad: 4 bytes
110 bb.skipBytes(4);
111
112 if(logger.isTraceEnabled())
113 logger.trace("readFrom - returning shared instance={}", INSTANCE);
114 return INSTANCE;
115 }
116 }
117
118 public void putTo(PrimitiveSink sink) {
119 FUNNEL.funnel(this, sink);
120 }
121
122 final static OFActionNiciraDecTtlVer13Funnel FUNNEL = new OFActionNiciraDecTtlVer13Funnel();
123 static class OFActionNiciraDecTtlVer13Funnel implements Funnel<OFActionNiciraDecTtlVer13> {
124 private static final long serialVersionUID = 1L;
125 @Override
126 public void funnel(OFActionNiciraDecTtlVer13 message, PrimitiveSink sink) {
127 // fixed value property type = 65535
128 sink.putShort((short) 0xffff);
129 // fixed value property length = 16
130 sink.putShort((short) 0x10);
131 // fixed value property experimenter = 0x2320L
132 sink.putInt(0x2320);
133 // fixed value property subtype = 0x12
134 sink.putShort((short) 0x12);
135 // skip pad (2 bytes)
136 // skip pad (4 bytes)
137 }
138 }
139
140
141 public void writeTo(ChannelBuffer bb) {
142 WRITER.write(bb, this);
143 }
144
145 final static Writer WRITER = new Writer();
146 static class Writer implements OFMessageWriter<OFActionNiciraDecTtlVer13> {
147 @Override
148 public void write(ChannelBuffer bb, OFActionNiciraDecTtlVer13 message) {
149 // fixed value property type = 65535
150 bb.writeShort((short) 0xffff);
151 // fixed value property length = 16
152 bb.writeShort((short) 0x10);
153 // fixed value property experimenter = 0x2320L
154 bb.writeInt(0x2320);
155 // fixed value property subtype = 0x12
156 bb.writeShort((short) 0x12);
157 // pad: 2 bytes
158 bb.writeZero(2);
159 // pad: 4 bytes
160 bb.writeZero(4);
161
162
163 }
164 }
165
166 @Override
167 public String toString() {
168 StringBuilder b = new StringBuilder("OFActionNiciraDecTtlVer13(");
169 b.append(")");
170 return b.toString();
171 }
172
173 @Override
174 public boolean equals(Object obj) {
175 if (this == obj)
176 return true;
177 if (obj == null)
178 return false;
179 if (getClass() != obj.getClass())
180 return false;
181
182 return true;
183 }
184
185 @Override
186 public int hashCode() {
187 int result = 1;
188
189 return result;
190 }
191
192}