Sangsik Yoon | f0b3ad8 | 2016-08-19 18:47:59 +0900 | [diff] [blame] | 1 | /* |
Thomas Vachuska | 52f2cd1 | 2018-11-08 21:20:04 -0800 | [diff] [blame] | 2 | * Copyright 2018-present Open Networking Foundation |
Sangsik Yoon | f0b3ad8 | 2016-08-19 18:47:59 +0900 | [diff] [blame] | 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 | |
| 17 | package org.onosproject.incubator.net.dpi; |
| 18 | |
| 19 | import static com.google.common.base.MoreObjects.toStringHelper; |
| 20 | |
| 21 | /** |
| 22 | * Protocol statistic information. |
| 23 | */ |
| 24 | public class ProtocolStatInfo { |
| 25 | String name; |
| 26 | String breed; |
| 27 | long packets; |
| 28 | long bytes; |
| 29 | int flows; |
| 30 | |
| 31 | /** |
| 32 | * Constructor for default ProtocolStatInfo class. |
| 33 | */ |
| 34 | public ProtocolStatInfo() { |
| 35 | name = ""; |
| 36 | breed = ""; |
| 37 | packets = 0; |
| 38 | bytes = 0; |
| 39 | flows = 0; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Constructor for ProtocolStatInfo class specified with protocol statistic parameters. |
| 44 | * |
| 45 | * @param name protocol name |
| 46 | * @param breed protocol breed |
| 47 | * @param packets protocol packets |
| 48 | * @param bytes protocol bytes |
| 49 | * @param flows protocol flows |
| 50 | */ |
| 51 | public ProtocolStatInfo(String name, String breed, long packets, long bytes, int flows) { |
| 52 | this.name = name; |
| 53 | this.breed = breed; |
| 54 | this.packets = packets; |
| 55 | this.bytes = bytes; |
| 56 | this.flows = flows; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Returns DPI protocol name. |
| 61 | * |
| 62 | * @return name |
| 63 | */ |
| 64 | public String name() { |
| 65 | return name; |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Returns DPI protocol breed. |
| 70 | * |
| 71 | * @return breed |
| 72 | */ |
| 73 | public String breed() { |
| 74 | return breed; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Returns DPI protocol packets. |
| 79 | * |
| 80 | * @return packets |
| 81 | */ |
| 82 | public long packets() { |
| 83 | return packets; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Returns DPI protocol bytes. |
| 88 | * |
| 89 | * @return bytes |
| 90 | */ |
| 91 | public long bytes() { |
| 92 | return bytes; |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Returns DPI protocol flows. |
| 97 | * |
| 98 | * @return flows |
| 99 | */ |
| 100 | public int flows() { |
| 101 | return flows; |
| 102 | } |
| 103 | |
| 104 | |
| 105 | public void setName(String name) { |
| 106 | this.name = name; |
| 107 | } |
| 108 | |
| 109 | public void setBreed(String breed) { |
| 110 | this.breed = breed; |
| 111 | } |
| 112 | |
| 113 | public void setPackets(long packets) { |
| 114 | this.packets = packets; |
| 115 | } |
| 116 | |
| 117 | public void setBytes(long bytes) { |
| 118 | this.bytes = bytes; |
| 119 | } |
| 120 | |
| 121 | public void setFlows(int flows) { |
| 122 | this.flows = flows; |
| 123 | } |
| 124 | |
| 125 | @Override |
| 126 | public String toString() { |
| 127 | return toStringHelper(this) |
| 128 | .add("name", name) |
| 129 | .add("breed", breed) |
| 130 | .add("packets", packets) |
| 131 | .add("bytes", bytes) |
| 132 | .add("flows", flows) |
| 133 | .toString(); |
| 134 | } |
| 135 | } |