2 * Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 * not use this file except in compliance with the License. You may obtain
7 * a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations
18 package org.openflow.protocol;
21 import org.jboss.netty.buffer.ChannelBuffer;
24 * Base class representing ofp_switch_config based messages
25 * @author David Erickson (daviderickson@cs.stanford.edu)
27 public abstract class OFSwitchConfig extends OFMessage {
28 public static int MINIMUM_LENGTH = 12;
30 public enum OFConfigFlags {
37 protected short flags;
38 protected short missSendLength;
40 public OFSwitchConfig() {
42 super.setLengthU(MINIMUM_LENGTH);
48 public short getFlags() {
53 * @param flags the flags to set
55 public OFSwitchConfig setFlags(short flags) {
61 * @return the missSendLength
63 public short getMissSendLength() {
64 return missSendLength;
68 * @param missSendLength the missSendLength to set
70 public OFSwitchConfig setMissSendLength(short missSendLength) {
71 this.missSendLength = missSendLength;
76 public void readFrom(ChannelBuffer data) {
78 this.flags = data.readShort();
79 this.missSendLength = data.readShort();
83 public void writeTo(ChannelBuffer data) {
85 data.writeShort(this.flags);
86 data.writeShort(this.missSendLength);
90 public int hashCode() {
91 final int prime = 331;
92 int result = super.hashCode();
93 result = prime * result + flags;
94 result = prime * result + missSendLength;
99 public boolean equals(Object obj) {
103 if (!super.equals(obj)) {
106 if (!(obj instanceof OFSwitchConfig)) {
109 OFSwitchConfig other = (OFSwitchConfig) obj;
110 if (flags != other.flags) {
113 if (missSendLength != other.missSendLength) {