NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
nfd-constants.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#include "
nfd-constants.hpp
"
23
#include <iostream>
24
#include <map>
25
26
namespace
ndn
{
27
namespace
nfd
{
28
29
std::ostream&
30
operator<<
(std::ostream& os,
FaceScope
faceScope)
31
{
32
switch
(faceScope) {
33
case
FACE_SCOPE_NONE
:
34
return
os <<
"none"
;
35
case
FACE_SCOPE_NON_LOCAL
:
36
return
os <<
"non-local"
;
37
case
FACE_SCOPE_LOCAL
:
38
return
os <<
"local"
;
39
default
:
40
return
os << static_cast<unsigned>(faceScope);
41
}
42
}
43
44
std::ostream&
45
operator<<
(std::ostream& os,
FacePersistency
facePersistency)
46
{
47
switch
(facePersistency) {
48
case
FACE_PERSISTENCY_NONE
:
49
return
os <<
"none"
;
50
case
FACE_PERSISTENCY_PERSISTENT
:
51
return
os <<
"persistent"
;
52
case
FACE_PERSISTENCY_ON_DEMAND
:
53
return
os <<
"on-demand"
;
54
case
FACE_PERSISTENCY_PERMANENT
:
55
return
os <<
"permanent"
;
56
default
:
57
return
os << static_cast<unsigned>(facePersistency);
58
}
59
}
60
61
std::ostream&
62
operator<<
(std::ostream& os,
LinkType
linkType)
63
{
64
switch
(linkType) {
65
case
LINK_TYPE_NONE
:
66
return
os <<
"none"
;
67
case
LINK_TYPE_POINT_TO_POINT
:
68
return
os <<
"point-to-point"
;
69
case
LINK_TYPE_MULTI_ACCESS
:
70
return
os <<
"multi-access"
;
71
default
:
72
return
os << static_cast<unsigned>(linkType);
73
}
74
}
75
76
std::ostream&
77
operator<<
(std::ostream& os,
RouteOrigin
routeOrigin)
78
{
79
switch
(routeOrigin) {
80
case
ROUTE_ORIGIN_NONE
:
81
return
os <<
"none"
;
82
case
ROUTE_ORIGIN_APP
:
83
return
os <<
"app"
;
84
case
ROUTE_ORIGIN_AUTOREG
:
85
return
os <<
"autoreg"
;
86
case
ROUTE_ORIGIN_CLIENT
:
87
return
os <<
"client"
;
88
case
ROUTE_ORIGIN_AUTOCONF
:
89
return
os <<
"autoconf"
;
90
case
ROUTE_ORIGIN_NLSR
:
91
return
os <<
"nlsr"
;
92
case
ROUTE_ORIGIN_STATIC
:
93
return
os <<
"static"
;
94
default
:
95
return
os << static_cast<unsigned>(routeOrigin);
96
}
97
}
98
99
std::ostream&
100
operator<<
(std::ostream& os,
RouteFlags
routeFlags)
101
{
102
if
(routeFlags ==
ROUTE_FLAGS_NONE
) {
103
return
os <<
"none"
;
104
}
105
106
bool
isFirst =
true
;
107
auto
printToken = [&os, &isFirst] (
const
std::string& token) {
108
if
(isFirst) {
109
isFirst =
false
;
110
}
111
else
{
112
os <<
'|'
;
113
}
114
os << token;
115
};
116
117
static
const
std::map<RouteFlags, std::string> knownBits = {
118
{
ROUTE_FLAG_CHILD_INHERIT
,
"child-inherit"
},
119
{
ROUTE_FLAG_CAPTURE
,
"capture"
}};
120
for
(
const
auto
& pair : knownBits) {
121
RouteFlags
bit =
ROUTE_FLAGS_NONE
;
122
std::string token;
123
std::tie(bit, token) = pair;
124
125
if
((routeFlags & bit) == 0) {
126
continue
;
127
}
128
129
printToken(token);
130
routeFlags =
static_cast<
RouteFlags
>
(routeFlags & ~bit);
131
}
132
133
if
(routeFlags != 0) {
134
printToken(
"0x"
);
135
std::ios_base::fmtflags oldFmt = os.flags();
136
os << std::hex << std::nouppercase
137
<<
static_cast<
unsigned
>
(routeFlags);
138
os.flags(oldFmt);
139
}
140
141
return
os;
142
}
143
144
}
// namespace nfd
145
}
// namespace ndn
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::nfd::LinkType
LinkType
Definition:
nfd-constants.hpp:75
ndn::nfd::FACE_PERSISTENCY_PERMANENT
face is permanent
Definition:
nfd-constants.hpp:59
ndn::nfd::ROUTE_ORIGIN_NLSR
Definition:
nfd-constants.hpp:96
ndn::nfd::LINK_TYPE_NONE
Definition:
nfd-constants.hpp:76
ndn::nfd::FACE_SCOPE_NON_LOCAL
face is non-local
Definition:
nfd-constants.hpp:38
ndn::nfd::ROUTE_ORIGIN_APP
Definition:
nfd-constants.hpp:92
ndn::nfd::LINK_TYPE_POINT_TO_POINT
link is point-to-point
Definition:
nfd-constants.hpp:79
ndn::nfd::ROUTE_ORIGIN_STATIC
Definition:
nfd-constants.hpp:97
ndn::nfd::RouteFlags
RouteFlags
Definition:
nfd-constants.hpp:105
ndn::nfd::LINK_TYPE_MULTI_ACCESS
link is multi-access
Definition:
nfd-constants.hpp:82
nfd-constants.hpp
ndn::nfd::ROUTE_ORIGIN_AUTOREG
Definition:
nfd-constants.hpp:93
ndn::nfd::FacePersistency
FacePersistency
Definition:
nfd-constants.hpp:49
ndn::nfd::FaceScope
FaceScope
Definition:
nfd-constants.hpp:34
ndn::nfd::FACE_PERSISTENCY_NONE
Definition:
nfd-constants.hpp:50
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
ndn::nfd::ROUTE_FLAG_CAPTURE
Definition:
nfd-constants.hpp:108
ndn::nfd::FACE_SCOPE_NONE
Definition:
nfd-constants.hpp:35
ndn::nfd::ROUTE_ORIGIN_CLIENT
Definition:
nfd-constants.hpp:94
ndn::nfd::operator<<
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
Definition:
nfd-constants.cpp:30
ndn::nfd::FACE_PERSISTENCY_ON_DEMAND
face is on-demand
Definition:
nfd-constants.hpp:56
ndn::nfd::FACE_SCOPE_LOCAL
face is local
Definition:
nfd-constants.hpp:41
ndn::nfd::ROUTE_ORIGIN_AUTOCONF
Definition:
nfd-constants.hpp:95
ndn::nfd::RouteOrigin
RouteOrigin
Definition:
nfd-constants.hpp:90
ndn::nfd::ROUTE_FLAGS_NONE
Definition:
nfd-constants.hpp:106
ndn::nfd::ROUTE_ORIGIN_NONE
Definition:
nfd-constants.hpp:91
ndn::nfd::FACE_PERSISTENCY_PERSISTENT
face is persistent
Definition:
nfd-constants.hpp:53
ndn::nfd::ROUTE_FLAG_CHILD_INHERIT
Definition:
nfd-constants.hpp:107
ndnSIM
ndn-cxx
src
encoding
nfd-constants.cpp
Generated on Wed Jan 11 2017 18:17:13 for ndnSIM by
1.8.13