X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=third-party%2Fopenflow-codec%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fcodec%2Fprotocol%2FOFPPortMod.java;fp=third-party%2Fopenflow-codec%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fcodec%2Fprotocol%2FOFPPortMod.java;h=0000000000000000000000000000000000000000;hb=64fe0fbca1a6c2b77ad25f568d73a7eb64236d16;hp=4c2298d31539c5432d2d64173649f5027faefa0c;hpb=8b9a3ff2bbc83941254b46b818cbbae5cc1a3a5b;p=openflowjava.git diff --git a/third-party/openflow-codec/src/main/java/org/openflow/codec/protocol/OFPPortMod.java b/third-party/openflow-codec/src/main/java/org/openflow/codec/protocol/OFPPortMod.java deleted file mode 100644 index 4c2298d3..00000000 --- a/third-party/openflow-codec/src/main/java/org/openflow/codec/protocol/OFPPortMod.java +++ /dev/null @@ -1,176 +0,0 @@ -package org.openflow.codec.protocol; - -import java.util.Arrays; - -import org.openflow.codec.io.IDataBuffer; -import org.openflow.codec.util.U16; - -/** - * Represents an ofp_port_mod message - * - * @author David Erickson (daviderickson@cs.stanford.edu) - */ -public class OFPPortMod extends OFPMessage { - public static int MINIMUM_LENGTH = 40; - - protected int portNumber; - protected byte[] hardwareAddress; - protected int config; - protected int mask; - protected int advertise; - - public OFPPortMod() { - super(); - this.type = OFPType.PORT_MOD; - this.length = U16.t(MINIMUM_LENGTH); - } - - /** - * @return the portNumber - */ - public int getPortNumber() { - return portNumber; - } - - /** - * @param portNumber - * the portNumber to set - */ - public void setPortNumber(int portNumber) { - this.portNumber = portNumber; - } - - /** - * @return the hardwareAddress - */ - public byte[] getHardwareAddress() { - return hardwareAddress; - } - - /** - * @param hardwareAddress - * the hardwareAddress to set - */ - public void setHardwareAddress(byte[] hardwareAddress) { - if (hardwareAddress.length != OFPPort.OFP_ETH_ALEN) - throw new RuntimeException("Hardware address must have length " + OFPPort.OFP_ETH_ALEN); - this.hardwareAddress = hardwareAddress; - } - - /** - * @return the config - */ - public int getConfig() { - return config; - } - - /** - * @param config - * the config to set - */ - public void setConfig(int config) { - this.config = config; - } - - /** - * @return the mask - */ - public int getMask() { - return mask; - } - - /** - * @param mask - * the mask to set - */ - public void setMask(int mask) { - this.mask = mask; - } - - /** - * @return the advertise - */ - public int getAdvertise() { - return advertise; - } - - /** - * @param advertise - * the advertise to set - */ - public void setAdvertise(int advertise) { - this.advertise = advertise; - } - - @Override - public void readFrom(IDataBuffer data) { - super.readFrom(data); - this.portNumber = data.getInt(); - data.getInt(); // pad - if (this.hardwareAddress == null) - this.hardwareAddress = new byte[OFPPort.OFP_ETH_ALEN]; - data.get(this.hardwareAddress); - data.getShort(); // pad - this.config = data.getInt(); - this.mask = data.getInt(); - this.advertise = data.getInt(); - data.getShort(); // pad - data.get(); // pad - } - - @Override - public void writeTo(IDataBuffer data) { - super.writeTo(data); - data.putInt(this.portNumber); - data.putInt(0); // pad - data.put(this.hardwareAddress); - data.putShort((short) 0); // pad - data.putInt(this.config); - data.putInt(this.mask); - data.putInt(this.advertise); - data.putShort((short) 0); // pad - data.put((byte) 0); // pad - } - - @Override - public int hashCode() { - final int prime = 311; - int result = super.hashCode(); - result = prime * result + advertise; - result = prime * result + config; - result = prime * result + Arrays.hashCode(hardwareAddress); - result = prime * result + mask; - result = prime * result + portNumber; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!super.equals(obj)) { - return false; - } - if (!(obj instanceof OFPPortMod)) { - return false; - } - OFPPortMod other = (OFPPortMod) obj; - if (advertise != other.advertise) { - return false; - } - if (config != other.config) { - return false; - } - if (!Arrays.equals(hardwareAddress, other.hardwareAddress)) { - return false; - } - if (mask != other.mask) { - return false; - } - if (portNumber != other.portNumber) { - return false; - } - return true; - } -}