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.statistics;
21 import org.jboss.netty.buffer.ChannelBuffer;
24 * Represents an ofp_queue_stats structure
25 * @author David Erickson (daviderickson@cs.stanford.edu)
27 public class OFQueueStatisticsReply implements OFStatistics {
28 protected short portNumber;
29 protected int queueId;
30 protected long transmitBytes;
31 protected long transmitPackets;
32 protected long transmitErrors;
35 * @return the portNumber
37 public short getPortNumber() {
42 * @param portNumber the portNumber to set
44 public void setPortNumber(short portNumber) {
45 this.portNumber = portNumber;
51 public int getQueueId() {
56 * @param queueId the queueId to set
58 public void setQueueId(int queueId) {
59 this.queueId = queueId;
63 * @return the transmitBytes
65 public long getTransmitBytes() {
70 * @param transmitBytes the transmitBytes to set
72 public void setTransmitBytes(long transmitBytes) {
73 this.transmitBytes = transmitBytes;
77 * @return the transmitPackets
79 public long getTransmitPackets() {
80 return transmitPackets;
84 * @param transmitPackets the transmitPackets to set
86 public void setTransmitPackets(long transmitPackets) {
87 this.transmitPackets = transmitPackets;
91 * @return the transmitErrors
93 public long getTransmitErrors() {
94 return transmitErrors;
98 * @param transmitErrors the transmitErrors to set
100 public void setTransmitErrors(long transmitErrors) {
101 this.transmitErrors = transmitErrors;
105 public int getLength() {
110 public void readFrom(ChannelBuffer data) {
111 this.portNumber = data.readShort();
112 data.readShort(); // pad
113 this.queueId = data.readInt();
114 this.transmitBytes = data.readLong();
115 this.transmitPackets = data.readLong();
116 this.transmitErrors = data.readLong();
120 public void writeTo(ChannelBuffer data) {
121 data.writeShort(this.portNumber);
122 data.writeShort((short) 0); // pad
123 data.writeInt(this.queueId);
124 data.writeLong(this.transmitBytes);
125 data.writeLong(this.transmitPackets);
126 data.writeLong(this.transmitErrors);
130 public int hashCode() {
131 final int prime = 439;
133 result = prime * result + portNumber;
134 result = prime * result + queueId;
135 result = prime * result
136 + (int) (transmitBytes ^ (transmitBytes >>> 32));
137 result = prime * result
138 + (int) (transmitErrors ^ (transmitErrors >>> 32));
139 result = prime * result
140 + (int) (transmitPackets ^ (transmitPackets >>> 32));
145 public boolean equals(Object obj) {
152 if (!(obj instanceof OFQueueStatisticsReply)) {
155 OFQueueStatisticsReply other = (OFQueueStatisticsReply) obj;
156 if (portNumber != other.portNumber) {
159 if (queueId != other.queueId) {
162 if (transmitBytes != other.transmitBytes) {
165 if (transmitErrors != other.transmitErrors) {
168 if (transmitPackets != other.transmitPackets) {