NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
cs-info.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2013-2018 Regents of the University of California.
4
*
5
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6
*
7
* ndn-cxx library is free software: you can redistribute it and/or modify it under the
8
* terms of the GNU Lesser General Public License as published by the Free Software
9
* Foundation, either version 3 of the License, or (at your option) any later version.
10
*
11
* ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14
*
15
* You should have received copies of the GNU General Public License and GNU Lesser
16
* General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17
* <http://www.gnu.org/licenses/>.
18
*
19
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20
*/
21
22
#ifndef NDN_MGMT_NFD_CS_INFO_HPP
23
#define NDN_MGMT_NFD_CS_INFO_HPP
24
25
#include "
ndn-cxx/encoding/block.hpp
"
26
#include "
ndn-cxx/encoding/nfd-constants.hpp
"
27
28
#include <bitset>
29
30
namespace
ndn
{
31
namespace
nfd
{
32
37
class
CsInfo
38
{
39
public
:
40
class
Error
:
public
tlv::Error
41
{
42
public
:
43
using
tlv::Error::Error;
44
};
45
46
CsInfo
();
47
48
explicit
49
CsInfo
(
const
Block
& block);
50
51
template
<encoding::Tag TAG>
52
size_t
53
wireEncode
(
EncodingImpl<TAG>
& encoder)
const
;
54
55
const
Block
&
56
wireEncode
()
const
;
57
58
void
59
wireDecode
(
const
Block
& wire);
60
63
uint64_t
64
getCapacity
()
const
65
{
66
return
m_capacity;
67
}
68
69
CsInfo
&
70
setCapacity
(uint64_t capacity);
71
74
bool
75
getEnableAdmit
()
const
76
{
77
return
m_flags.test(
BIT_CS_ENABLE_ADMIT
);
78
}
79
80
CsInfo
&
81
setEnableAdmit
(
bool
enableAdmit);
82
85
bool
86
getEnableServe
()
const
87
{
88
return
m_flags.test(
BIT_CS_ENABLE_SERVE
);
89
}
90
91
CsInfo
&
92
setEnableServe
(
bool
enableServe);
93
96
uint64_t
97
getNEntries
()
const
98
{
99
return
m_nEntries;
100
}
101
102
CsInfo
&
103
setNEntries
(uint64_t nEntries);
104
107
uint64_t
108
getNHits
()
const
109
{
110
return
m_nHits;
111
}
112
113
CsInfo
&
114
setNHits
(uint64_t nHits);
115
118
uint64_t
119
getNMisses
()
const
120
{
121
return
m_nMisses;
122
}
123
124
CsInfo
&
125
setNMisses
(uint64_t nMisses);
126
127
private
:
128
using
FlagsBitSet = std::bitset<2>;
129
130
uint64_t m_capacity;
131
FlagsBitSet m_flags;
132
uint64_t m_nEntries;
133
uint64_t m_nHits;
134
uint64_t m_nMisses;
135
mutable
Block
m_wire;
136
};
137
138
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
(
CsInfo
);
139
140
bool
141
operator==
(
const
CsInfo
& a,
const
CsInfo
& b);
142
143
inline
bool
144
operator!=
(
const
CsInfo
& a,
const
CsInfo
& b)
145
{
146
return
!(a == b);
147
}
148
149
std::ostream&
150
operator<<
(std::ostream& os,
const
CsInfo
& csi);
151
152
}
// namespace nfd
153
}
// namespace ndn
154
155
#endif // NDN_MGMT_NFD_CS_INFO_HPP
ndn::nfd::CsInfo::setNHits
CsInfo & setNHits(uint64_t nHits)
Definition:
cs-info.cpp:165
ndn::nfd::CsInfo::getNMisses
uint64_t getNMisses() const
get number of CS lookup misses since NFD starts
Definition:
cs-info.hpp:119
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::nfd::operator!=
bool operator!=(const ChannelStatus &a, const ChannelStatus &b)
Definition:
channel-status.hpp:81
ndn::nfd::CsInfo::getCapacity
uint64_t getCapacity() const
get CS capacity (in number of packets)
Definition:
cs-info.hpp:64
ndn::nfd::CsInfo::CsInfo
CsInfo()
Definition:
cs-info.cpp:33
ndn::nfd::CsInfo::wireEncode
const Block & wireEncode() const
Definition:
cs-info.cpp:66
ndn::nfd::CsInfo::getEnableAdmit
bool getEnableAdmit() const
get CS_ENABLE_ADMIT flag
Definition:
cs-info.hpp:75
ndn::nfd::CsInfo::Error
Definition:
cs-info.hpp:40
ndn::nfd::CsInfo::getEnableServe
bool getEnableServe() const
get CS_ENABLE_SERVE flag
Definition:
cs-info.hpp:86
ndn::Block
Represents a TLV element of NDN packet format.
Definition:
block.hpp:42
ndn::nfd::CsInfo::setNEntries
CsInfo & setNEntries(uint64_t nEntries)
Definition:
cs-info.cpp:157
ndn::nfd::CsInfo::setEnableAdmit
CsInfo & setEnableAdmit(bool enableAdmit)
Definition:
cs-info.cpp:141
nfd-constants.hpp
ndn::nfd::CsInfo::getNHits
uint64_t getNHits() const
get number of CS lookup hits since NFD starts
Definition:
cs-info.hpp:108
ndn::nfd::CsInfo::wireDecode
void wireDecode(const Block &wire)
Definition:
cs-info.cpp:82
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
ndn::nfd::CsInfo::setEnableServe
CsInfo & setEnableServe(bool enableServe)
Definition:
cs-info.cpp:149
ndn::nfd::operator==
bool operator==(const ChannelStatus &a, const ChannelStatus &b)
Definition:
channel-status.cpp:96
ndn::nfd::BIT_CS_ENABLE_SERVE
enables the CS to satisfy Interests using cached Data
Definition:
nfd-constants.hpp:94
ndn::nfd::BIT_CS_ENABLE_ADMIT
enables the CS to admit new Data
Definition:
nfd-constants.hpp:93
ndn::nfd::operator<<
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
Definition:
nfd-constants.cpp:35
ndn::nfd::CsInfo
represents the CS Information dataset
Definition:
cs-info.hpp:37
ndn::encoding::EncodingImpl
Definition:
encoding-buffer-fwd.hpp:36
ndn::nfd::CsInfo::setCapacity
CsInfo & setCapacity(uint64_t capacity)
Definition:
cs-info.cpp:133
block.hpp
ndn::nfd::NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ChannelStatus)
ndn::nfd::CsInfo::setNMisses
CsInfo & setNMisses(uint64_t nMisses)
Definition:
cs-info.cpp:173
ndn::tlv::nfd::CsInfo
Definition:
tlv-nfd.hpp:90
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition:
tlv.hpp:52
ndn::nfd::CsInfo::getNEntries
uint64_t getNEntries() const
get number of stored CS entries
Definition:
cs-info.hpp:97
ndnSIM
ndn-cxx
ndn-cxx
mgmt
nfd
cs-info.hpp
Generated on Sun Feb 24 2019 22:16:06 for ndnSIM by
1.8.15