blob: 58cd114ea02c17c4554018022c988115c5823412 [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 OFActionIdBsnChecksumVer13 implements OFActionIdBsnChecksum {
33 private static final Logger logger = LoggerFactory.getLogger(OFActionIdBsnChecksumVer13.class);
34 // version: 1.3
35 final static byte WIRE_VERSION = 4;
36 final static int LENGTH = 12;
37
38
39 // OF message fields
40//
41 // Immutable default instance
42 final static OFActionIdBsnChecksumVer13 DEFAULT = new OFActionIdBsnChecksumVer13(
43
44 );
45
46 final static OFActionIdBsnChecksumVer13 INSTANCE = new OFActionIdBsnChecksumVer13();
47 // private empty constructor - use shared instance!
48 private OFActionIdBsnChecksumVer13() {
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 0x5c16c7L;
60 }
61
62 @Override
63 public long getSubtype() {
64 return 0x4L;
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 OFActionIdBsnChecksum.Builder createBuilder() {
76 throw new UnsupportedOperationException("OFActionIdBsnChecksumVer13 has no mutable properties -- builder unneeded");
77 }
78
79
80 final static Reader READER = new Reader();
81 static class Reader implements OFMessageReader<OFActionIdBsnChecksum> {
82 @Override
83 public OFActionIdBsnChecksum 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 != 12)
91 throw new OFParseError("Wrong length: Expected=12(12), 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 == 0x5c16c7L
100 int experimenter = bb.readInt();
101 if(experimenter != 0x5c16c7)
102 throw new OFParseError("Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got="+experimenter);
103 // fixed value property subtype == 0x4L
104 int subtype = bb.readInt();
105 if(subtype != 0x4)
106 throw new OFParseError("Wrong subtype: Expected=0x4L(0x4L), got="+subtype);
107
108 if(logger.isTraceEnabled())
109 logger.trace("readFrom - returning shared instance={}", INSTANCE);
110 return INSTANCE;
111 }
112 }
113
114 public void putTo(PrimitiveSink sink) {
115 FUNNEL.funnel(this, sink);
116 }
117
118 final static OFActionIdBsnChecksumVer13Funnel FUNNEL = new OFActionIdBsnChecksumVer13Funnel();
119 static class OFActionIdBsnChecksumVer13Funnel implements Funnel<OFActionIdBsnChecksumVer13> {
120 private static final long serialVersionUID = 1L;
121 @Override
122 public void funnel(OFActionIdBsnChecksumVer13 message, PrimitiveSink sink) {
123 // fixed value property type = 65535
124 sink.putShort((short) 0xffff);
125 // fixed value property length = 12
126 sink.putShort((short) 0xc);
127 // fixed value property experimenter = 0x5c16c7L
128 sink.putInt(0x5c16c7);
129 // fixed value property subtype = 0x4L
130 sink.putInt(0x4);
131 }
132 }
133
134
135 public void writeTo(ChannelBuffer bb) {
136 WRITER.write(bb, this);
137 }
138
139 final static Writer WRITER = new Writer();
140 static class Writer implements OFMessageWriter<OFActionIdBsnChecksumVer13> {
141 @Override
142 public void write(ChannelBuffer bb, OFActionIdBsnChecksumVer13 message) {
143 // fixed value property type = 65535
144 bb.writeShort((short) 0xffff);
145 // fixed value property length = 12
146 bb.writeShort((short) 0xc);
147 // fixed value property experimenter = 0x5c16c7L
148 bb.writeInt(0x5c16c7);
149 // fixed value property subtype = 0x4L
150 bb.writeInt(0x4);
151
152
153 }
154 }
155
156 @Override
157 public String toString() {
158 StringBuilder b = new StringBuilder("OFActionIdBsnChecksumVer13(");
159 b.append(")");
160 return b.toString();
161 }
162
163 @Override
164 public boolean equals(Object obj) {
165 if (this == obj)
166 return true;
167 if (obj == null)
168 return false;
169 if (getClass() != obj.getClass())
170 return false;
171
172 return true;
173 }
174
175 @Override
176 public int hashCode() {
177 int result = 1;
178
179 return result;
180 }
181
182}