tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 1 | // 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 | |
| 10 | package org.projectfloodlight.openflow.protocol.ver13; |
| 11 | |
| 12 | import org.projectfloodlight.openflow.protocol.*; |
| 13 | import org.projectfloodlight.openflow.protocol.action.*; |
| 14 | import org.projectfloodlight.openflow.protocol.actionid.*; |
| 15 | import org.projectfloodlight.openflow.protocol.bsntlv.*; |
| 16 | import org.projectfloodlight.openflow.protocol.errormsg.*; |
| 17 | import org.projectfloodlight.openflow.protocol.meterband.*; |
| 18 | import org.projectfloodlight.openflow.protocol.instruction.*; |
| 19 | import org.projectfloodlight.openflow.protocol.instructionid.*; |
| 20 | import org.projectfloodlight.openflow.protocol.match.*; |
| 21 | import org.projectfloodlight.openflow.protocol.oxm.*; |
| 22 | import org.projectfloodlight.openflow.protocol.queueprop.*; |
| 23 | import org.projectfloodlight.openflow.types.*; |
| 24 | import org.projectfloodlight.openflow.util.*; |
| 25 | import org.projectfloodlight.openflow.exceptions.*; |
| 26 | import java.util.Set; |
| 27 | import org.slf4j.Logger; |
| 28 | import org.slf4j.LoggerFactory; |
| 29 | import org.jboss.netty.buffer.ChannelBuffer; |
| 30 | import com.google.common.hash.PrimitiveSink; |
| 31 | import com.google.common.hash.Funnel; |
| 32 | |
| 33 | class OFActionIdBsnSetTunnelDstVer13 implements OFActionIdBsnSetTunnelDst { |
| 34 | private static final Logger logger = LoggerFactory.getLogger(OFActionIdBsnSetTunnelDstVer13.class); |
| 35 | // version: 1.3 |
| 36 | final static byte WIRE_VERSION = 4; |
| 37 | final static int LENGTH = 12; |
| 38 | |
| 39 | |
| 40 | // OF message fields |
| 41 | // |
| 42 | // Immutable default instance |
| 43 | final static OFActionIdBsnSetTunnelDstVer13 DEFAULT = new OFActionIdBsnSetTunnelDstVer13( |
| 44 | |
| 45 | ); |
| 46 | |
| 47 | final static OFActionIdBsnSetTunnelDstVer13 INSTANCE = new OFActionIdBsnSetTunnelDstVer13(); |
| 48 | // private empty constructor - use shared instance! |
| 49 | private OFActionIdBsnSetTunnelDstVer13() { |
| 50 | } |
| 51 | |
| 52 | // Accessors for OF message fields |
| 53 | @Override |
| 54 | public OFActionType getType() { |
| 55 | return OFActionType.EXPERIMENTER; |
| 56 | } |
| 57 | |
| 58 | @Override |
| 59 | public long getExperimenter() { |
| 60 | return 0x5c16c7L; |
| 61 | } |
| 62 | |
| 63 | @Override |
| 64 | public long getSubtype() { |
| 65 | return 0x2L; |
| 66 | } |
| 67 | |
| 68 | @Override |
| 69 | public OFVersion getVersion() { |
| 70 | return OFVersion.OF_13; |
| 71 | } |
| 72 | |
| 73 | |
| 74 | |
| 75 | // no data members - do not support builder |
| 76 | public OFActionIdBsnSetTunnelDst.Builder createBuilder() { |
| 77 | throw new UnsupportedOperationException("OFActionIdBsnSetTunnelDstVer13 has no mutable properties -- builder unneeded"); |
| 78 | } |
| 79 | |
| 80 | |
| 81 | final static Reader READER = new Reader(); |
| 82 | static class Reader implements OFMessageReader<OFActionIdBsnSetTunnelDst> { |
| 83 | @Override |
| 84 | public OFActionIdBsnSetTunnelDst readFrom(ChannelBuffer bb) throws OFParseError { |
| 85 | int start = bb.readerIndex(); |
| 86 | // fixed value property type == 65535 |
| 87 | short type = bb.readShort(); |
| 88 | if(type != (short) 0xffff) |
| 89 | throw new OFParseError("Wrong type: Expected=OFActionType.EXPERIMENTER(65535), got="+type); |
| 90 | int length = U16.f(bb.readShort()); |
| 91 | if(length != 12) |
| 92 | throw new OFParseError("Wrong length: Expected=12(12), got="+length); |
| 93 | if(bb.readableBytes() + (bb.readerIndex() - start) < length) { |
| 94 | // Buffer does not have all data yet |
| 95 | bb.readerIndex(start); |
| 96 | return null; |
| 97 | } |
| 98 | if(logger.isTraceEnabled()) |
| 99 | logger.trace("readFrom - length={}", length); |
| 100 | // fixed value property experimenter == 0x5c16c7L |
| 101 | int experimenter = bb.readInt(); |
| 102 | if(experimenter != 0x5c16c7) |
| 103 | throw new OFParseError("Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got="+experimenter); |
| 104 | // fixed value property subtype == 0x2L |
| 105 | int subtype = bb.readInt(); |
| 106 | if(subtype != 0x2) |
| 107 | throw new OFParseError("Wrong subtype: Expected=0x2L(0x2L), got="+subtype); |
| 108 | |
| 109 | if(logger.isTraceEnabled()) |
| 110 | logger.trace("readFrom - returning shared instance={}", INSTANCE); |
| 111 | return INSTANCE; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | public void putTo(PrimitiveSink sink) { |
| 116 | FUNNEL.funnel(this, sink); |
| 117 | } |
| 118 | |
| 119 | final static OFActionIdBsnSetTunnelDstVer13Funnel FUNNEL = new OFActionIdBsnSetTunnelDstVer13Funnel(); |
| 120 | static class OFActionIdBsnSetTunnelDstVer13Funnel implements Funnel<OFActionIdBsnSetTunnelDstVer13> { |
| 121 | private static final long serialVersionUID = 1L; |
| 122 | @Override |
| 123 | public void funnel(OFActionIdBsnSetTunnelDstVer13 message, PrimitiveSink sink) { |
| 124 | // fixed value property type = 65535 |
| 125 | sink.putShort((short) 0xffff); |
| 126 | // fixed value property length = 12 |
| 127 | sink.putShort((short) 0xc); |
| 128 | // fixed value property experimenter = 0x5c16c7L |
| 129 | sink.putInt(0x5c16c7); |
| 130 | // fixed value property subtype = 0x2L |
| 131 | sink.putInt(0x2); |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | |
| 136 | public void writeTo(ChannelBuffer bb) { |
| 137 | WRITER.write(bb, this); |
| 138 | } |
| 139 | |
| 140 | final static Writer WRITER = new Writer(); |
| 141 | static class Writer implements OFMessageWriter<OFActionIdBsnSetTunnelDstVer13> { |
| 142 | @Override |
| 143 | public void write(ChannelBuffer bb, OFActionIdBsnSetTunnelDstVer13 message) { |
| 144 | // fixed value property type = 65535 |
| 145 | bb.writeShort((short) 0xffff); |
| 146 | // fixed value property length = 12 |
| 147 | bb.writeShort((short) 0xc); |
| 148 | // fixed value property experimenter = 0x5c16c7L |
| 149 | bb.writeInt(0x5c16c7); |
| 150 | // fixed value property subtype = 0x2L |
| 151 | bb.writeInt(0x2); |
| 152 | |
| 153 | |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | @Override |
| 158 | public String toString() { |
| 159 | StringBuilder b = new StringBuilder("OFActionIdBsnSetTunnelDstVer13("); |
| 160 | b.append(")"); |
| 161 | return b.toString(); |
| 162 | } |
| 163 | |
| 164 | @Override |
| 165 | public boolean equals(Object obj) { |
| 166 | if (this == obj) |
| 167 | return true; |
| 168 | if (obj == null) |
| 169 | return false; |
| 170 | if (getClass() != obj.getClass()) |
| 171 | return false; |
| 172 | |
| 173 | return true; |
| 174 | } |
| 175 | |
| 176 | @Override |
| 177 | public int hashCode() { |
| 178 | int result = 1; |
| 179 | |
| 180 | return result; |
| 181 | } |
| 182 | |
| 183 | } |