blob: 5f4bb3f2dca663eb87dc71ae96d9ecab0f1c500e [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 OFActionDecNwTtlVer13 implements OFActionDecNwTtl {
33 private static final Logger logger = LoggerFactory.getLogger(OFActionDecNwTtlVer13.class);
34 // version: 1.3
35 final static byte WIRE_VERSION = 4;
36 final static int LENGTH = 8;
37
38
39 // OF message fields
40//
41 // Immutable default instance
42 final static OFActionDecNwTtlVer13 DEFAULT = new OFActionDecNwTtlVer13(
43
44 );
45
46 final static OFActionDecNwTtlVer13 INSTANCE = new OFActionDecNwTtlVer13();
47 // private empty constructor - use shared instance!
48 private OFActionDecNwTtlVer13() {
49 }
50
51 // Accessors for OF message fields
52 @Override
53 public OFActionType getType() {
54 return OFActionType.DEC_NW_TTL;
55 }
56
57 @Override
58 public OFVersion getVersion() {
59 return OFVersion.OF_13;
60 }
61
62
63
64 // no data members - do not support builder
65 public OFActionDecNwTtl.Builder createBuilder() {
66 throw new UnsupportedOperationException("OFActionDecNwTtlVer13 has no mutable properties -- builder unneeded");
67 }
68
69
70 final static Reader READER = new Reader();
71 static class Reader implements OFMessageReader<OFActionDecNwTtl> {
72 @Override
73 public OFActionDecNwTtl readFrom(ChannelBuffer bb) throws OFParseError {
74 int start = bb.readerIndex();
75 // fixed value property type == 24
76 short type = bb.readShort();
77 if(type != (short) 0x18)
78 throw new OFParseError("Wrong type: Expected=OFActionType.DEC_NW_TTL(24), got="+type);
79 int length = U16.f(bb.readShort());
80 if(length != 8)
81 throw new OFParseError("Wrong length: Expected=8(8), got="+length);
82 if(bb.readableBytes() + (bb.readerIndex() - start) < length) {
83 // Buffer does not have all data yet
84 bb.readerIndex(start);
85 return null;
86 }
87 if(logger.isTraceEnabled())
88 logger.trace("readFrom - length={}", length);
89 // pad: 4 bytes
90 bb.skipBytes(4);
91
92 if(logger.isTraceEnabled())
93 logger.trace("readFrom - returning shared instance={}", INSTANCE);
94 return INSTANCE;
95 }
96 }
97
98 public void putTo(PrimitiveSink sink) {
99 FUNNEL.funnel(this, sink);
100 }
101
102 final static OFActionDecNwTtlVer13Funnel FUNNEL = new OFActionDecNwTtlVer13Funnel();
103 static class OFActionDecNwTtlVer13Funnel implements Funnel<OFActionDecNwTtlVer13> {
104 private static final long serialVersionUID = 1L;
105 @Override
106 public void funnel(OFActionDecNwTtlVer13 message, PrimitiveSink sink) {
107 // fixed value property type = 24
108 sink.putShort((short) 0x18);
109 // fixed value property length = 8
110 sink.putShort((short) 0x8);
111 // skip pad (4 bytes)
112 }
113 }
114
115
116 public void writeTo(ChannelBuffer bb) {
117 WRITER.write(bb, this);
118 }
119
120 final static Writer WRITER = new Writer();
121 static class Writer implements OFMessageWriter<OFActionDecNwTtlVer13> {
122 @Override
123 public void write(ChannelBuffer bb, OFActionDecNwTtlVer13 message) {
124 // fixed value property type = 24
125 bb.writeShort((short) 0x18);
126 // fixed value property length = 8
127 bb.writeShort((short) 0x8);
128 // pad: 4 bytes
129 bb.writeZero(4);
130
131
132 }
133 }
134
135 @Override
136 public String toString() {
137 StringBuilder b = new StringBuilder("OFActionDecNwTtlVer13(");
138 b.append(")");
139 return b.toString();
140 }
141
142 @Override
143 public boolean equals(Object obj) {
144 if (this == obj)
145 return true;
146 if (obj == null)
147 return false;
148 if (getClass() != obj.getClass())
149 return false;
150
151 return true;
152 }
153
154 @Override
155 public int hashCode() {
156 int result = 1;
157
158 return result;
159 }
160
161}