2 * @author David Erickson (daviderickson@cs.stanford.edu) - Mar 11, 2010
4 package org.openflow.protocol.action;
6 import java.nio.ByteBuffer;
8 import org.openflow.util.U16;
11 * @author David Erickson (daviderickson@cs.stanford.edu) - Mar 11, 2010
12 * @author Rob Sherwood (rob.sherwood@stanford.edu)
14 public class OFActionOutput extends OFAction implements Cloneable {
15 public static int MINIMUM_LENGTH = 8;
18 protected short maxLength;
20 public OFActionOutput() {
21 super.setType(OFActionType.OUTPUT);
22 super.setLength((short) MINIMUM_LENGTH);
25 public OFActionOutput(short port, short maxLength) {
27 super.setType(OFActionType.OUTPUT);
28 super.setLength((short) MINIMUM_LENGTH);
30 this.maxLength = maxLength;
37 public short getPort() {
45 public OFActionOutput setPort(short port) {
51 * Get the max length to send to the controller
54 public short getMaxLength() {
55 return this.maxLength;
59 * Set the max length to send to the controller
62 public OFActionOutput setMaxLength(short maxLength) {
63 this.maxLength = maxLength;
68 public void readFrom(ByteBuffer data) {
70 this.port = data.getShort();
71 this.maxLength = data.getShort();
75 public void writeTo(ByteBuffer data) {
78 data.putShort(maxLength);
82 public int hashCode() {
83 final int prime = 367;
84 int result = super.hashCode();
85 result = prime * result + maxLength;
86 result = prime * result + port;
91 public boolean equals(Object obj) {
95 if (!super.equals(obj)) {
98 if (!(obj instanceof OFActionOutput)) {
101 OFActionOutput other = (OFActionOutput) obj;
102 if (maxLength != other.maxLength) {
105 if (port != other.port) {
112 * @see java.lang.Object#toString()
115 public String toString() {
116 return "OFActionOutput [maxLength=" + maxLength + ", port=" + U16.f(port)
117 + ", length=" + length + ", type=" + type + "]";