1 package org.openflow.protocol.statistics;
3 import java.nio.ByteBuffer;
6 * Represents an ofp_queue_stats structure
7 * @author David Erickson (daviderickson@cs.stanford.edu)
9 public class OFQueueStatisticsReply implements OFStatistics {
10 protected short portNumber;
11 protected int queueId;
12 protected long transmitBytes;
13 protected long transmitPackets;
14 protected long transmitErrors;
17 * @return the portNumber
19 public short getPortNumber() {
24 * @param portNumber the portNumber to set
26 public void setPortNumber(short portNumber) {
27 this.portNumber = portNumber;
33 public int getQueueId() {
38 * @param queueId the queueId to set
40 public void setQueueId(int queueId) {
41 this.queueId = queueId;
45 * @return the transmitBytes
47 public long getTransmitBytes() {
52 * @param transmitBytes the transmitBytes to set
54 public void setTransmitBytes(long transmitBytes) {
55 this.transmitBytes = transmitBytes;
59 * @return the transmitPackets
61 public long getTransmitPackets() {
62 return transmitPackets;
66 * @param transmitPackets the transmitPackets to set
68 public void setTransmitPackets(long transmitPackets) {
69 this.transmitPackets = transmitPackets;
73 * @return the transmitErrors
75 public long getTransmitErrors() {
76 return transmitErrors;
80 * @param transmitErrors the transmitErrors to set
82 public void setTransmitErrors(long transmitErrors) {
83 this.transmitErrors = transmitErrors;
87 public int getLength() {
92 public void readFrom(ByteBuffer data) {
93 this.portNumber = data.getShort();
94 data.getShort(); // pad
95 this.queueId = data.getInt();
96 this.transmitBytes = data.getLong();
97 this.transmitPackets = data.getLong();
98 this.transmitErrors = data.getLong();
102 public void writeTo(ByteBuffer data) {
103 data.putShort(this.portNumber);
104 data.putShort((short) 0); // pad
105 data.putInt(this.queueId);
106 data.putLong(this.transmitBytes);
107 data.putLong(this.transmitPackets);
108 data.putLong(this.transmitErrors);
112 public int hashCode() {
113 final int prime = 439;
115 result = prime * result + portNumber;
116 result = prime * result + queueId;
117 result = prime * result
118 + (int) (transmitBytes ^ (transmitBytes >>> 32));
119 result = prime * result
120 + (int) (transmitErrors ^ (transmitErrors >>> 32));
121 result = prime * result
122 + (int) (transmitPackets ^ (transmitPackets >>> 32));
127 public boolean equals(Object obj) {
134 if (!(obj instanceof OFQueueStatisticsReply)) {
137 OFQueueStatisticsReply other = (OFQueueStatisticsReply) obj;
138 if (portNumber != other.portNumber) {
141 if (queueId != other.queueId) {
144 if (transmitBytes != other.transmitBytes) {
147 if (transmitErrors != other.transmitErrors) {
150 if (transmitPackets != other.transmitPackets) {