X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=third-party%2Fopenflow-codec%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fcodec%2Fprotocol%2FOFPFlowRemoved.java;fp=third-party%2Fopenflow-codec%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fcodec%2Fprotocol%2FOFPFlowRemoved.java;h=0000000000000000000000000000000000000000;hb=64fe0fbca1a6c2b77ad25f568d73a7eb64236d16;hp=68baeedca0a57da65225639f849e735c17e4f278;hpb=8b9a3ff2bbc83941254b46b818cbbae5cc1a3a5b;p=openflowjava.git diff --git a/third-party/openflow-codec/src/main/java/org/openflow/codec/protocol/OFPFlowRemoved.java b/third-party/openflow-codec/src/main/java/org/openflow/codec/protocol/OFPFlowRemoved.java deleted file mode 100644 index 68baeedc..00000000 --- a/third-party/openflow-codec/src/main/java/org/openflow/codec/protocol/OFPFlowRemoved.java +++ /dev/null @@ -1,344 +0,0 @@ -package org.openflow.codec.protocol; - -import org.openflow.codec.io.IDataBuffer; -import org.openflow.codec.util.U16; - -/** - * Represents an ofp_flow_removed message - * - * @author David Erickson (daviderickson@cs.stanford.edu) - * @author AnilGujele - * - */ -public class OFPFlowRemoved extends OFPMessage { - public static final int MINIMUM_LENGTH = 56; - public static final int MATCH_DEFAULT_LENGTH = 8; - public static final int MINIMUM_LENGTH_WITHOUT_MATCH = MINIMUM_LENGTH - MATCH_DEFAULT_LENGTH; - - /** - * correspond to enum ofp_flow_removed_reason - * - * @author AnilGujele - * - */ - public enum OFFlowRemovedReason { - OFPRR_IDLE_TIMEOUT, OFPRR_HARD_TIMEOUT, OFPRR_DELETE, OFPRR_GROUP_DELETE - } - - protected long cookie; - protected short priority; - protected OFFlowRemovedReason reason; - protected byte tableId; - protected int durationSeconds; - protected int durationNanoseconds; - protected short idleTimeout; - protected short hardTimeout; - protected long packetCount; - protected long byteCount; - protected OFPMatch match; - - public OFPFlowRemoved() { - super(); - this.type = OFPType.FLOW_REMOVED; - this.length = U16.t(MINIMUM_LENGTH); - } - - /** - * Get cookie - * - * @return - */ - public long getCookie() { - return this.cookie; - } - - /** - * Set cookie - * - * @param cookie - */ - public void setCookie(long cookie) { - this.cookie = cookie; - } - - /** - * Get idle_timeout - * - * @return - */ - public short getIdleTimeout() { - return this.idleTimeout; - } - - /** - * Set idle_timeout - * - * @param idleTimeout - */ - public void setIdleTimeout(short idleTimeout) { - this.idleTimeout = idleTimeout; - } - - /** - * get hard timeout - * - * @return - */ - public short getHardTimeout() { - return hardTimeout; - } - - /** - * set hard timeout - * - * @param hardTimeout - */ - public void setHardTimeout(short hardTimeout) { - this.hardTimeout = hardTimeout; - } - - /** - * Gets a copy of the OFPMatch object for this FlowMod, changes to this - * object do not modify the FlowMod - * - * @return - */ - public OFPMatch getMatch() { - return this.match; - } - - /** - * Set match - * - * @param match - */ - public void setMatch(OFPMatch match) { - this.match = match; - updateLength(); - } - - private void updateLength() { - int matchLength = (null == this.match) ? MATCH_DEFAULT_LENGTH : this.match.getLengthWithPadding(); - this.length = (short) (OFPFlowRemoved.MINIMUM_LENGTH_WITHOUT_MATCH + matchLength); - } - - /** - * Get priority - * - * @return - */ - public short getPriority() { - return this.priority; - } - - /** - * Set priority - * - * @param priority - */ - public void setPriority(short priority) { - this.priority = priority; - } - - /** - * @return the reason - */ - public OFFlowRemovedReason getReason() { - return reason; - } - - /** - * @param reason - * the reason to set - */ - public void setReason(OFFlowRemovedReason reason) { - this.reason = reason; - } - - /** - * get table id - * - * @return - */ - public byte getTableId() { - return tableId; - } - - /** - * set table id - * - * @param tableId - */ - public void setTableId(byte tableId) { - this.tableId = tableId; - } - - /** - * @return the durationSeconds - */ - public int getDurationSeconds() { - return durationSeconds; - } - - /** - * @param durationSeconds - * the durationSeconds to set - */ - public void setDurationSeconds(int durationSeconds) { - this.durationSeconds = durationSeconds; - } - - /** - * @return the durationNanoseconds - */ - public int getDurationNanoseconds() { - return durationNanoseconds; - } - - /** - * @param durationNanoseconds - * the durationNanoseconds to set - */ - public void setDurationNanoseconds(int durationNanoseconds) { - this.durationNanoseconds = durationNanoseconds; - } - - /** - * @return the packetCount - */ - public long getPacketCount() { - return packetCount; - } - - /** - * @param packetCount - * the packetCount to set - */ - public void setPacketCount(long packetCount) { - this.packetCount = packetCount; - } - - /** - * @return the byteCount - */ - public long getByteCount() { - return byteCount; - } - - /** - * @param byteCount - * the byteCount to set - */ - public void setByteCount(long byteCount) { - this.byteCount = byteCount; - } - - @Override - public void readFrom(IDataBuffer data) { - super.readFrom(data); - this.cookie = data.getLong(); - this.priority = data.getShort(); - this.reason = OFFlowRemovedReason.values()[(0xff & data.get())]; - this.tableId = data.get(); - this.durationSeconds = data.getInt(); - this.durationNanoseconds = data.getInt(); - this.idleTimeout = data.getShort(); - this.hardTimeout = data.getShort(); - this.packetCount = data.getLong(); - this.byteCount = data.getLong(); - if (this.match == null) - this.match = new OFPMatch(); - this.match.readFrom(data); - } - - @Override - public void writeTo(IDataBuffer data) { - super.writeTo(data); - data.putLong(cookie); - data.putShort(priority); - data.put((byte) this.reason.ordinal()); - data.put((byte) tableId); - data.putInt(this.durationSeconds); - data.putInt(this.durationNanoseconds); - data.putShort(idleTimeout); - data.putShort(hardTimeout); - data.putLong(this.packetCount); - data.putLong(this.byteCount); - this.match.writeTo(data); - } - - @Override - public int hashCode() { - final int prime = 271; - int result = super.hashCode(); - result = prime * result + (int) (byteCount ^ (byteCount >>> 32)); - result = prime * result + (int) (cookie ^ (cookie >>> 32)); - result = prime * result + durationNanoseconds; - result = prime * result + durationSeconds; - result = prime * result + idleTimeout; - result = prime * result + hardTimeout; - result = prime * result + ((match == null) ? 0 : match.hashCode()); - result = prime * result + (int) (packetCount ^ (packetCount >>> 32)); - result = prime * result + priority; - result = prime * result + tableId; - result = prime * result + ((reason == null) ? 0 : reason.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!super.equals(obj)) { - return false; - } - if (!(obj instanceof OFPFlowRemoved)) { - return false; - } - OFPFlowRemoved other = (OFPFlowRemoved) obj; - if (byteCount != other.byteCount) { - return false; - } - if (cookie != other.cookie) { - return false; - } - if (durationNanoseconds != other.durationNanoseconds) { - return false; - } - if (durationSeconds != other.durationSeconds) { - return false; - } - if (idleTimeout != other.idleTimeout) { - return false; - } - if (hardTimeout != other.hardTimeout) { - return false; - } - - if (match == null) { - if (other.match != null) { - return false; - } - } else if (!match.equals(other.match)) { - return false; - } - if (packetCount != other.packetCount) { - return false; - } - if (priority != other.priority) { - return false; - } - if (tableId != other.tableId) { - return false; - } - if (reason == null) { - if (other.reason != null) { - return false; - } - } else if (!reason.equals(other.reason)) { - return false; - } - return true; - } -}