2 * Copyright 2015 Open Networking Laboratory
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org.onosproject.bgp.controller.impl;
18 import org.onosproject.bgp.controller.BGPPacketStats;
21 * A representation of a packet context which allows any provider
22 * to view a packet in event, but may block the response to the
23 * event if blocked has been called. This packet context can be used
24 * to react to the packet in event with a packet out.
26 public class BGPPacketStatsImpl implements BGPPacketStats {
28 private int inPacketCount;
29 private int outPacketCount;
30 private int wrongPacketCount;
36 public BGPPacketStatsImpl() {
37 this.inPacketCount = 0;
38 this.outPacketCount = 0;
39 this.wrongPacketCount = 0;
44 * Get the outgoing packet count number.
49 public int outPacketCount() {
50 return outPacketCount;
54 * Get the incoming packet count number.
59 public int inPacketCount() {
64 * Get the wrong packet count number.
69 public int wrongPacketCount() {
70 return wrongPacketCount;
74 * Increments the received packet counter.
76 public void addInPacket() {
81 * Increments the sent packet counter.
83 public void addOutPacket() {
84 this.outPacketCount++;
88 * Increments the sent packet counter by specified value.
90 * @param value of no of packets sent
92 public void addOutPacket(int value) {
93 this.outPacketCount = this.outPacketCount + value;
97 * Increments the wrong packet counter.
99 public void addWrongPacket() {
100 this.wrongPacketCount++;
104 * Resets wrong packet count.
106 public void resetWrongPacket() {
107 this.wrongPacketCount = 0;
116 public long getTime() {
123 * @param time value to set
125 public void setTime(long time) {