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