blob: 152c5a1a74d93a8a46e63cb2d1fa00b730438394 [file] [log] [blame]
Junxiao Shi7860d482014-02-21 23:57:20 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Alexander Afanasyev9bcbc7c2014-04-06 19:37:37 -07003 * Copyright (c) 2014 Regents of the University of California,
4 * Arizona Board of Regents,
5 * Colorado State University,
6 * University Pierre & Marie Curie, Sorbonne University,
7 * Washington University in St. Louis,
8 * Beijing Institute of Technology
9 *
10 * This file is part of NFD (Named Data Networking Forwarding Daemon).
11 * See AUTHORS.md for complete list of NFD authors and contributors.
12 *
13 * NFD is free software: you can redistribute it and/or modify it under the terms
14 * of the GNU General Public License as published by the Free Software Foundation,
15 * either version 3 of the License, or (at your option) any later version.
16 *
17 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
18 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 * PURPOSE. See the GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License along with
22 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
23 **/
Junxiao Shi7860d482014-02-21 23:57:20 -070024
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070025#ifndef NFD_DAEMON_FACE_FACE_COUNTER_HPP
26#define NFD_DAEMON_FACE_FACE_COUNTER_HPP
Junxiao Shi7860d482014-02-21 23:57:20 -070027
28#include "common.hpp"
29
30namespace nfd {
31
32/** \class FaceCounter
33 * \brief represents a counter on face
Alexander Afanasyev7e698e62014-03-07 16:48:35 +000034 *
35 * \todo This class should be noncopyable
Junxiao Shi7860d482014-02-21 23:57:20 -070036 */
37typedef uint64_t FaceCounter;
38
39
40/** \brief contains counters on face
41 */
Alexander Afanasyev7e698e62014-03-07 16:48:35 +000042class FaceCounters : noncopyable
Junxiao Shi7860d482014-02-21 23:57:20 -070043{
44public:
45 FaceCounters();
46
47 /// incoming Interest (total packets since Face establishment)
48 const FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070049 getNInInterests() const;
Junxiao Shi7860d482014-02-21 23:57:20 -070050
51 FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070052 getNInInterests();
Junxiao Shi7860d482014-02-21 23:57:20 -070053
54 /// incoming Data (total packets since Face establishment)
55 const FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070056 getNInDatas() const;
Junxiao Shi7860d482014-02-21 23:57:20 -070057
58 FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070059 getNInDatas();
Junxiao Shi7860d482014-02-21 23:57:20 -070060
61 /// outgoing Interest (total packets since Face establishment)
62 const FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070063 getNOutInterests() const;
Junxiao Shi7860d482014-02-21 23:57:20 -070064
65 FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070066 getNOutInterests();
Junxiao Shi7860d482014-02-21 23:57:20 -070067
68 /// outgoing Data (total packets since Face establishment)
69 const FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070070 getNOutDatas() const;
Junxiao Shi7860d482014-02-21 23:57:20 -070071
72 FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070073 getNOutDatas();
Junxiao Shi7860d482014-02-21 23:57:20 -070074
75private:
Junxiao Shi6e694322014-04-03 10:27:13 -070076 FaceCounter m_nInInterests;
77 FaceCounter m_nInDatas;
78 FaceCounter m_outInterests;
79 FaceCounter m_outDatas;
Junxiao Shi7860d482014-02-21 23:57:20 -070080};
81
Alexander Afanasyev7e698e62014-03-07 16:48:35 +000082inline
83FaceCounters::FaceCounters()
Junxiao Shi6e694322014-04-03 10:27:13 -070084 : m_nInInterests(0)
85 , m_nInDatas(0)
86 , m_outInterests(0)
87 , m_outDatas(0)
Alexander Afanasyev7e698e62014-03-07 16:48:35 +000088{
89}
Junxiao Shi7860d482014-02-21 23:57:20 -070090
91inline const FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070092FaceCounters::getNInInterests() const
Junxiao Shi7860d482014-02-21 23:57:20 -070093{
Junxiao Shi6e694322014-04-03 10:27:13 -070094 return m_nInInterests;
Junxiao Shi7860d482014-02-21 23:57:20 -070095}
96
97inline FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070098FaceCounters::getNInInterests()
Junxiao Shi7860d482014-02-21 23:57:20 -070099{
Junxiao Shi6e694322014-04-03 10:27:13 -0700100 return m_nInInterests;
Junxiao Shi7860d482014-02-21 23:57:20 -0700101}
102
103inline const FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -0700104FaceCounters::getNInDatas() const
Junxiao Shi7860d482014-02-21 23:57:20 -0700105{
Junxiao Shi6e694322014-04-03 10:27:13 -0700106 return m_nInDatas;
Junxiao Shi7860d482014-02-21 23:57:20 -0700107}
108
109inline FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -0700110FaceCounters::getNInDatas()
Junxiao Shi7860d482014-02-21 23:57:20 -0700111{
Junxiao Shi6e694322014-04-03 10:27:13 -0700112 return m_nInDatas;
Junxiao Shi7860d482014-02-21 23:57:20 -0700113}
114
115inline const FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -0700116FaceCounters::getNOutInterests() const
Junxiao Shi7860d482014-02-21 23:57:20 -0700117{
Junxiao Shi6e694322014-04-03 10:27:13 -0700118 return m_outInterests;
Junxiao Shi7860d482014-02-21 23:57:20 -0700119}
120
121inline FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -0700122FaceCounters::getNOutInterests()
Junxiao Shi7860d482014-02-21 23:57:20 -0700123{
Junxiao Shi6e694322014-04-03 10:27:13 -0700124 return m_outInterests;
Junxiao Shi7860d482014-02-21 23:57:20 -0700125}
126
127inline const FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -0700128FaceCounters::getNOutDatas() const
Junxiao Shi7860d482014-02-21 23:57:20 -0700129{
Junxiao Shi6e694322014-04-03 10:27:13 -0700130 return m_outDatas;
Junxiao Shi7860d482014-02-21 23:57:20 -0700131}
132
133inline FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -0700134FaceCounters::getNOutDatas()
Junxiao Shi7860d482014-02-21 23:57:20 -0700135{
Junxiao Shi6e694322014-04-03 10:27:13 -0700136 return m_outDatas;
Junxiao Shi7860d482014-02-21 23:57:20 -0700137}
138
139
140} // namespace nfd
141
Alexander Afanasyev613e2a92014-04-15 13:36:58 -0700142#endif // NFD_DAEMON_FACE_FACE_COUNTER_HPP