1 package org.openflow.protocol;
3 import java.nio.ByteBuffer;
6 * Base class representing ofp_switch_config based messages
7 * @author David Erickson (daviderickson@cs.stanford.edu)
9 public abstract class OFSwitchConfig extends OFMessage {
10 public static int MINIMUM_LENGTH = 12;
12 public enum OFConfigFlags {
19 protected short flags;
20 protected short missSendLength;
22 public OFSwitchConfig() {
24 super.setLengthU(MINIMUM_LENGTH);
30 public short getFlags() {
35 * @param flags the flags to set
37 public OFSwitchConfig setFlags(short flags) {
43 * @return the missSendLength
45 public short getMissSendLength() {
46 return missSendLength;
50 * @param missSendLength the missSendLength to set
52 public OFSwitchConfig setMissSendLength(short missSendLength) {
53 this.missSendLength = missSendLength;
58 public void readFrom(ByteBuffer data) {
60 this.flags = data.getShort();
61 this.missSendLength = data.getShort();
65 public void writeTo(ByteBuffer data) {
67 data.putShort(this.flags);
68 data.putShort(this.missSendLength);
72 public int hashCode() {
73 final int prime = 331;
74 int result = super.hashCode();
75 result = prime * result + flags;
76 result = prime * result + missSendLength;
81 public boolean equals(Object obj) {
85 if (!super.equals(obj)) {
88 if (!(obj instanceof OFSwitchConfig)) {
91 OFSwitchConfig other = (OFSwitchConfig) obj;
92 if (flags != other.flags) {
95 if (missSendLength != other.missSendLength) {