blob: bb409dbc7757fd56708bdb47b97269a14d6e3383 [file] [log] [blame]
Sangsik Yoonf0b3ad82016-08-19 18:47:59 +09001/*
Thomas Vachuska52f2cd12018-11-08 21:20:04 -08002 * Copyright 2018-present Open Networking Foundation
Sangsik Yoonf0b3ad82016-08-19 18:47:59 +09003 *
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.
Ray Milkeyef794342016-11-09 16:20:29 -080055 *
56 * @param protocol protocol
57 * @param hostAName host A name
58 * @param hostAPort host A port
59 * @param hostBName host B name
60 * @param hostBPort host B port
61 * @param detectedProtocol detected protocol
62 * @param detectedProtocolName detected protocol name
63 * @param packets packet count
64 * @param bytes byte count
Sangsik Yoonf0b3ad82016-08-19 18:47:59 +090065 */
66 public FlowStatInfo(String protocol, String hostAName, int hostAPort, String hostBName, int hostBPort,
67 int detectedProtocol, String detectedProtocolName, long packets, long bytes) {
68 this.protocol = protocol;
69 this.hostAName = hostAName;
70 this.hostAPort = hostAPort;
71 this.hostBName = hostBName;
72 this.hostBPort = hostBPort;
73 this.detectedProtocol = detectedProtocol;
74 this.detectedProtocolName = detectedProtocolName;
75 this.packets = packets;
76 this.bytes = bytes;
77
78 hostServerName = "";
79 }
80
81 /**
82 * Constructor for FlowStatInfo class specified with flow statistic parameters and hostServerName.
Ray Milkeyef794342016-11-09 16:20:29 -080083 *
84 * @param protocol protocol
85 * @param hostAName host A name
86 * @param hostAPort host A port
87 * @param hostBName host B name
88 * @param hostBPort host B port
89 * @param detectedProtocol detected protocol
90 * @param detectedProtocolName detected protocol name
91 * @param packets packet count
92 * @param bytes byte count
93 * @param hostServerName host server name
Sangsik Yoonf0b3ad82016-08-19 18:47:59 +090094 */
95 public FlowStatInfo(String protocol, String hostAName, int hostAPort, String hostBName, int hostBPort,
96 int detectedProtocol, String detectedProtocolName, long packets, long bytes,
97 String hostServerName) {
98 this(protocol, hostAName, hostAPort, hostBName, hostBPort, detectedProtocol, detectedProtocolName,
99 packets, bytes);
100
101 this.hostServerName = hostServerName;
102 }
103
104 /**
105 * Returns DPI flow protocol.
106 *
107 * @return protocol
108 */
109 public String protocol() {
110 return protocol;
111 }
112
113 /**
114 * Returns DPI flow host A name.
115 *
116 * @return hostAName
117 */
118 public String hostAName() {
119 return hostAName;
120 }
121
122 /**
123 * Returns DPI flow host A port.
124 *
125 * @return hostAPort
126 */
127 public int hostAPort() {
128 return hostAPort;
129 }
130
131
132 /**
133 * Returns DPI flow host B name.
134 *
135 * @return hostBName
136 */
137 public String hostBName() {
138 return hostBName;
139 }
140
141 /**
142 * Returns DPI flow host B Port.
143 *
144 * @return hostBPort
145 */
146 public int hostBPort() {
147 return hostBPort;
148 }
149
150 /**
151 * Returns DPI flow detected protocol.
152 *
153 * @return detectedProtocol
154 */
155 public int detectedProtocol() {
156 return detectedProtocol;
157 }
158
159 /**
160 * Returns DPI flow detected protocol name.
161 *
162 * @return detectedProtocolName
163 */
164 public String detectedProtocolName() {
165 return detectedProtocolName;
166 }
167
168 /**
169 * Returns DPI flow packets.
170 *
171 * @return packets
172 */
173 public long packets() {
174 return packets;
175 }
176
177 /**
178 * Returns DPI flow bytes.
179 *
180 * @return bytes
181 */
182 public long bytes() {
183 return bytes;
184 }
185
186 /**
187 * Returns DPI flow host server name.
188 *
189 * @return hostServerName
190 */
191 public String hostServerName() {
192 return hostServerName;
193 }
194
195
196 public void setProtocol(String protocol) {
197 this.protocol = protocol;
198 }
199
200 public void setHostAName(String hostAName) {
201 this.hostAName = hostAName;
202 }
203
204 public void setHostAPort(int hostAPort) {
205 this.hostAPort = hostAPort;
206 }
207
208 public void setHostBName(String hostBName) {
209 this.hostBName = hostBName;
210 }
211
212 public void setHostBPort(int hostBPort) {
213 this.hostBPort = hostBPort;
214 }
215
216 public void setDetectedProtocol(int detectedProtocol) {
217 this.detectedProtocol = detectedProtocol;
218 }
219
220 public void setDetectedProtocolName(String detectedProtocolName) {
221 this.detectedProtocolName = detectedProtocolName;
222 }
223
224 public void setPackets(long packets) {
225 this.packets = packets;
226 }
227
228 public void setBytes(long bytes) {
229 this.bytes = bytes;
230 }
231
232 public void setHostServerName(String hostServerName) {
233 this.hostServerName = hostServerName;
234 }
235
236 @Override
237 public String toString() {
238 return toStringHelper(this)
239 .add("protocol", protocol)
240 .add("hostAName", hostAName)
241 .add("hostAPort", hostAPort)
242 .add("hostBName", hostBName)
243 .add("hostBPort", hostBPort)
244 .add("detectedProtocol", detectedProtocol)
245 .add("detectedProtocolName", detectedProtocolName)
246 .add("packets", packets)
247 .add("bytes", bytes)
248 .add("hostServerName", hostServerName)
249 .toString();
250 }
251}