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.ver11; |
| 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 OFInstructionClearActionsVer11 implements OFInstructionClearActions { |
| 33 | private static final Logger logger = LoggerFactory.getLogger(OFInstructionClearActionsVer11.class); |
| 34 | // version: 1.1 |
| 35 | final static byte WIRE_VERSION = 2; |
| 36 | final static int LENGTH = 8; |
| 37 | |
| 38 | |
| 39 | // OF message fields |
| 40 | // |
| 41 | // Immutable default instance |
| 42 | final static OFInstructionClearActionsVer11 DEFAULT = new OFInstructionClearActionsVer11( |
| 43 | |
| 44 | ); |
| 45 | |
| 46 | final static OFInstructionClearActionsVer11 INSTANCE = new OFInstructionClearActionsVer11(); |
| 47 | // private empty constructor - use shared instance! |
| 48 | private OFInstructionClearActionsVer11() { |
| 49 | } |
| 50 | |
| 51 | // Accessors for OF message fields |
| 52 | @Override |
| 53 | public OFInstructionType getType() { |
| 54 | return OFInstructionType.CLEAR_ACTIONS; |
| 55 | } |
| 56 | |
| 57 | @Override |
| 58 | public OFVersion getVersion() { |
| 59 | return OFVersion.OF_11; |
| 60 | } |
| 61 | |
| 62 | |
| 63 | |
| 64 | // no data members - do not support builder |
| 65 | public OFInstructionClearActions.Builder createBuilder() { |
| 66 | throw new UnsupportedOperationException("OFInstructionClearActionsVer11 has no mutable properties -- builder unneeded"); |
| 67 | } |
| 68 | |
| 69 | |
| 70 | final static Reader READER = new Reader(); |
| 71 | static class Reader implements OFMessageReader<OFInstructionClearActions> { |
| 72 | @Override |
| 73 | public OFInstructionClearActions readFrom(ChannelBuffer bb) throws OFParseError { |
| 74 | int start = bb.readerIndex(); |
| 75 | // fixed value property type == 5 |
| 76 | short type = bb.readShort(); |
| 77 | if(type != (short) 0x5) |
| 78 | throw new OFParseError("Wrong type: Expected=OFInstructionType.CLEAR_ACTIONS(5), 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 OFInstructionClearActionsVer11Funnel FUNNEL = new OFInstructionClearActionsVer11Funnel(); |
| 103 | static class OFInstructionClearActionsVer11Funnel implements Funnel<OFInstructionClearActionsVer11> { |
| 104 | private static final long serialVersionUID = 1L; |
| 105 | @Override |
| 106 | public void funnel(OFInstructionClearActionsVer11 message, PrimitiveSink sink) { |
| 107 | // fixed value property type = 5 |
| 108 | sink.putShort((short) 0x5); |
| 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<OFInstructionClearActionsVer11> { |
| 122 | @Override |
| 123 | public void write(ChannelBuffer bb, OFInstructionClearActionsVer11 message) { |
| 124 | // fixed value property type = 5 |
| 125 | bb.writeShort((short) 0x5); |
| 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("OFInstructionClearActionsVer11("); |
| 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 | } |