NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
network-address.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2013-2021 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
* @author Davide Pesavento <davide.pesavento@lip6.fr>
22
*/
23
24
#ifndef NDN_CXX_NET_NETWORK_ADDRESS_HPP
25
#define NDN_CXX_NET_NETWORK_ADDRESS_HPP
26
27
#include "
ndn-cxx/detail/common.hpp
"
28
29
#include <boost/asio/ip/address.hpp>
30
31
namespace
ndn
{
32
namespace
net
{
33
34
enum class
AddressFamily
{
35
UNSPECIFIED
,
36
V4
,
37
V6
,
38
};
39
40
enum class
AddressScope
{
41
NOWHERE
,
42
HOST
,
43
LINK
,
44
GLOBAL
,
45
};
46
47
std::ostream&
48
operator<<
(std::ostream& os,
AddressScope
scope);
49
53
class
NetworkAddress
54
{
55
public
:
56
NetworkAddress
(
AddressFamily
family,
57
const
boost::asio::ip::address& ip,
58
const
boost::asio::ip::address& broadcast,
59
uint8_t prefixLength,
60
AddressScope
scope,
61
uint32_t flags);
62
66
AddressFamily
67
getFamily
()
const
68
{
69
return
m_family;
70
}
71
75
boost::asio::ip::address
76
getIp
()
const
77
{
78
return
m_ip;
79
}
80
84
boost::asio::ip::address
85
getBroadcast
()
const
86
{
87
return
m_broadcast;
88
}
89
93
uint8_t
94
getPrefixLength
()
const
95
{
96
return
m_prefixLength;
97
}
98
102
AddressScope
103
getScope
()
const
104
{
105
return
m_scope;
106
}
107
111
uint32_t
112
getFlags
()
const
113
{
114
return
m_flags;
115
}
116
122
bool
123
isDeprecated()
const
;
124
125
friend
bool
126
operator<
(
const
NetworkAddress
& a,
const
NetworkAddress
& b)
127
{
128
return
a.m_ip < b.m_ip;
129
}
130
131
private
:
132
AddressFamily
m_family;
133
boost::asio::ip::address m_ip;
134
boost::asio::ip::address m_broadcast;
135
uint8_t m_prefixLength;
136
AddressScope
m_scope;
137
uint32_t m_flags;
// IFA_F_* (linux/if_addr.h) on Linux; zero on other platforms
138
};
139
140
std::ostream&
141
operator<<
(std::ostream& os,
const
NetworkAddress
& address);
142
143
}
// namespace net
144
}
// namespace ndn
145
146
#endif // NDN_CXX_NET_NETWORK_ADDRESS_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::net::NetworkAddress::getScope
AddressScope getScope() const
Returns the address scope.
Definition:
network-address.hpp:103
ndn::net::AddressScope
AddressScope
Definition:
network-address.hpp:40
ndn::net::NetworkAddress::getIp
boost::asio::ip::address getIp() const
Returns the IP address (v4 or v6)
Definition:
network-address.hpp:76
ndn::net::AddressScope::LINK
ndn::net::AddressFamily::UNSPECIFIED
ndn::net::AddressFamily
AddressFamily
Definition:
network-address.hpp:34
ndn::net::NetworkAddress::getFamily
AddressFamily getFamily() const
Returns the address family.
Definition:
network-address.hpp:67
ndn::net::AddressScope::GLOBAL
ndn::net::AddressScope::NOWHERE
ndn::net::AddressFamily::V6
ndn::net::NetworkAddress::getFlags
uint32_t getFlags() const
Returns a bitset of platform-specific flags enabled on the address.
Definition:
network-address.hpp:112
ndn::net::NetworkAddress
Stores one IP address supported by a network interface.
Definition:
network-address.hpp:53
ndn::net::NetworkAddress::getBroadcast
boost::asio::ip::address getBroadcast() const
Returns the IP broadcast address.
Definition:
network-address.hpp:85
common.hpp
Common includes and macros used throughout the library.
ndn::net::NetworkAddress::getPrefixLength
uint8_t getPrefixLength() const
Returns the prefix length.
Definition:
network-address.hpp:94
ndn::net::AddressScope::HOST
ndn::net::AddressFamily::V4
ndn::net::operator<<
std::ostream & operator<<(std::ostream &os, AddressScope scope)
Definition:
network-address.cpp:34
nfd::rib::operator<
bool operator<(const ReadvertisedRoute &lhs, const ReadvertisedRoute &rhs)
Definition:
readvertised-route.hpp:59
ndn::net
Definition:
link-type-helper.cpp:30
ndnSIM
ndn-cxx
ndn-cxx
net
network-address.hpp
Generated on Fri May 6 2022 12:34:12 for ndnSIM by
1.8.13