alshabib | 86ac11c | 2014-08-14 16:14:41 -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.ver10; |
| 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 org.slf4j.Logger; |
| 27 | import org.slf4j.LoggerFactory; |
| 28 | import org.jboss.netty.buffer.ChannelBuffer; |
| 29 | import com.google.common.hash.PrimitiveSink; |
| 30 | import com.google.common.hash.Funnel; |
| 31 | |
| 32 | class OFActionStripVlanVer10 implements OFActionStripVlan { |
| 33 | private static final Logger logger = LoggerFactory.getLogger(OFActionStripVlanVer10.class); |
| 34 | // version: 1.0 |
| 35 | final static byte WIRE_VERSION = 1; |
| 36 | final static int LENGTH = 8; |
| 37 | |
| 38 | |
| 39 | // OF message fields |
| 40 | // |
| 41 | // Immutable default instance |
| 42 | final static OFActionStripVlanVer10 DEFAULT = new OFActionStripVlanVer10( |
| 43 | |
| 44 | ); |
| 45 | |
| 46 | final static OFActionStripVlanVer10 INSTANCE = new OFActionStripVlanVer10(); |
| 47 | // private empty constructor - use shared instance! |
| 48 | private OFActionStripVlanVer10() { |
| 49 | } |
| 50 | |
| 51 | // Accessors for OF message fields |
| 52 | @Override |
| 53 | public OFActionType getType() { |
| 54 | return OFActionType.STRIP_VLAN; |
| 55 | } |
| 56 | |
| 57 | @Override |
| 58 | public OFVersion getVersion() { |
| 59 | return OFVersion.OF_10; |
| 60 | } |
| 61 | |
| 62 | |
| 63 | |
| 64 | // no data members - do not support builder |
| 65 | public OFActionStripVlan.Builder createBuilder() { |
| 66 | throw new UnsupportedOperationException("OFActionStripVlanVer10 has no mutable properties -- builder unneeded"); |
| 67 | } |
| 68 | |
| 69 | |
| 70 | final static Reader READER = new Reader(); |
| 71 | static class Reader implements OFMessageReader<OFActionStripVlan> { |
| 72 | @Override |
| 73 | public OFActionStripVlan readFrom(ChannelBuffer bb) throws OFParseError { |
| 74 | int start = bb.readerIndex(); |
| 75 | // fixed value property type == 3 |
| 76 | short type = bb.readShort(); |
| 77 | if(type != (short) 0x3) |
| 78 | throw new OFParseError("Wrong type: Expected=OFActionType.STRIP_VLAN(3), 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 OFActionStripVlanVer10Funnel FUNNEL = new OFActionStripVlanVer10Funnel(); |
| 103 | static class OFActionStripVlanVer10Funnel implements Funnel<OFActionStripVlanVer10> { |
| 104 | private static final long serialVersionUID = 1L; |
| 105 | @Override |
| 106 | public void funnel(OFActionStripVlanVer10 message, PrimitiveSink sink) { |
| 107 | // fixed value property type = 3 |
| 108 | sink.putShort((short) 0x3); |
| 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<OFActionStripVlanVer10> { |
| 122 | @Override |
| 123 | public void write(ChannelBuffer bb, OFActionStripVlanVer10 message) { |
| 124 | // fixed value property type = 3 |
| 125 | bb.writeShort((short) 0x3); |
| 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("OFActionStripVlanVer10("); |
| 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 | } |