blob: 591df78d413e40bd3a1f8048b62c3bcdfaf3424a [file] [log] [blame]
Sangsik Yoonf0b3ad82016-08-19 18:47:59 +09001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.incubator.net.dpi;
18
19import static com.google.common.base.MoreObjects.toStringHelper;
20
21/**
22 * Flow statistic information.
23 */
24public class FlowStatInfo {
25 String protocol;
26 String hostAName;
27 int hostAPort;
28 String hostBName;
29 int hostBPort;
30 int detectedProtocol;
31 String detectedProtocolName;
32 long packets;
33 long bytes;
34 String hostServerName;
35
36 /**
37 * Constructor for default FlowStatInfo class.
38 */
39 public FlowStatInfo() {
40 protocol = "";
41 hostAName = "::";
42 hostAPort = 0;
43 hostBName = "";
44 hostBPort = 0;
45 detectedProtocol = 0;
46 detectedProtocolName = "";
47 packets = 0;
48 bytes = 0;
49
50 hostServerName = "";
51 }
52
53 /**
54 * Constructor for FlowStatInfo class specified with flow statistic parameters.
55 */
56 public FlowStatInfo(String protocol, String hostAName, int hostAPort, String hostBName, int hostBPort,
57 int detectedProtocol, String detectedProtocolName, long packets, long bytes) {
58 this.protocol = protocol;
59 this.hostAName = hostAName;
60 this.hostAPort = hostAPort;
61 this.hostBName = hostBName;
62 this.hostBPort = hostBPort;
63 this.detectedProtocol = detectedProtocol;
64 this.detectedProtocolName = detectedProtocolName;
65 this.packets = packets;
66 this.bytes = bytes;
67
68 hostServerName = "";
69 }
70
71 /**
72 * Constructor for FlowStatInfo class specified with flow statistic parameters and hostServerName.
73 */
74 public FlowStatInfo(String protocol, String hostAName, int hostAPort, String hostBName, int hostBPort,
75 int detectedProtocol, String detectedProtocolName, long packets, long bytes,
76 String hostServerName) {
77 this(protocol, hostAName, hostAPort, hostBName, hostBPort, detectedProtocol, detectedProtocolName,
78 packets, bytes);
79
80 this.hostServerName = hostServerName;
81 }
82
83 /**
84 * Returns DPI flow protocol.
85 *
86 * @return protocol
87 */
88 public String protocol() {
89 return protocol;
90 }
91
92 /**
93 * Returns DPI flow host A name.
94 *
95 * @return hostAName
96 */
97 public String hostAName() {
98 return hostAName;
99 }
100
101 /**
102 * Returns DPI flow host A port.
103 *
104 * @return hostAPort
105 */
106 public int hostAPort() {
107 return hostAPort;
108 }
109
110
111 /**
112 * Returns DPI flow host B name.
113 *
114 * @return hostBName
115 */
116 public String hostBName() {
117 return hostBName;
118 }
119
120 /**
121 * Returns DPI flow host B Port.
122 *
123 * @return hostBPort
124 */
125 public int hostBPort() {
126 return hostBPort;
127 }
128
129 /**
130 * Returns DPI flow detected protocol.
131 *
132 * @return detectedProtocol
133 */
134 public int detectedProtocol() {
135 return detectedProtocol;
136 }
137
138 /**
139 * Returns DPI flow detected protocol name.
140 *
141 * @return detectedProtocolName
142 */
143 public String detectedProtocolName() {
144 return detectedProtocolName;
145 }
146
147 /**
148 * Returns DPI flow packets.
149 *
150 * @return packets
151 */
152 public long packets() {
153 return packets;
154 }
155
156 /**
157 * Returns DPI flow bytes.
158 *
159 * @return bytes
160 */
161 public long bytes() {
162 return bytes;
163 }
164
165 /**
166 * Returns DPI flow host server name.
167 *
168 * @return hostServerName
169 */
170 public String hostServerName() {
171 return hostServerName;
172 }
173
174
175 public void setProtocol(String protocol) {
176 this.protocol = protocol;
177 }
178
179 public void setHostAName(String hostAName) {
180 this.hostAName = hostAName;
181 }
182
183 public void setHostAPort(int hostAPort) {
184 this.hostAPort = hostAPort;
185 }
186
187 public void setHostBName(String hostBName) {
188 this.hostBName = hostBName;
189 }
190
191 public void setHostBPort(int hostBPort) {
192 this.hostBPort = hostBPort;
193 }
194
195 public void setDetectedProtocol(int detectedProtocol) {
196 this.detectedProtocol = detectedProtocol;
197 }
198
199 public void setDetectedProtocolName(String detectedProtocolName) {
200 this.detectedProtocolName = detectedProtocolName;
201 }
202
203 public void setPackets(long packets) {
204 this.packets = packets;
205 }
206
207 public void setBytes(long bytes) {
208 this.bytes = bytes;
209 }
210
211 public void setHostServerName(String hostServerName) {
212 this.hostServerName = hostServerName;
213 }
214
215 @Override
216 public String toString() {
217 return toStringHelper(this)
218 .add("protocol", protocol)
219 .add("hostAName", hostAName)
220 .add("hostAPort", hostAPort)
221 .add("hostBName", hostBName)
222 .add("hostBPort", hostBPort)
223 .add("detectedProtocol", detectedProtocol)
224 .add("detectedProtocolName", detectedProtocolName)
225 .add("packets", packets)
226 .add("bytes", bytes)
227 .add("hostServerName", hostServerName)
228 .toString();
229 }
230}