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-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
* @author Davide Pesavento <davide.pesavento@lip6.fr>
22
*/
23
24
#ifndef NDN_NET_NETWORK_ADDRESS_HPP
25
#define NDN_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
boost::asio::ip::address ip,
58
boost::asio::ip::address broadcast,
59
uint8_t prefixLength,
60
AddressScope
scope,
61
uint32_t flags);
62
65
AddressFamily
66
getFamily
()
const
67
{
68
return
m_family;
69
}
70
73
boost::asio::ip::address
74
getIp
()
const
75
{
76
return
m_ip;
77
}
78
81
boost::asio::ip::address
82
getBroadcast
()
const
83
{
84
return
m_broadcast;
85
}
86
89
uint8_t
90
getPrefixLength
()
const
91
{
92
return
m_prefixLength;
93
}
94
97
AddressScope
98
getScope
()
const
99
{
100
return
m_scope;
101
}
102
105
uint32_t
106
getFlags
()
const
107
{
108
return
m_flags;
109
}
110
111
friend
bool
112
operator<
(
const
NetworkAddress
& a,
const
NetworkAddress
& b)
113
{
114
return
a.m_ip < b.m_ip;
115
}
116
117
private
:
118
AddressFamily
m_family;
119
boost::asio::ip::address m_ip;
120
boost::asio::ip::address m_broadcast;
121
uint8_t m_prefixLength;
122
AddressScope
m_scope;
123
uint32_t m_flags;
// IFA_F_* in if_addr.h
124
};
125
126
std::ostream&
127
operator<<
(std::ostream& os,
const
NetworkAddress& address);
128
129
}
// namespace net
130
}
// namespace ndn
131
132
#endif // NDN_NET_NETWORK_ADDRESS_HPP
common.hpp
Common includes and macros used throughout the library.
ndn::net::NetworkAddress::operator<
friend bool operator<(const NetworkAddress &a, const NetworkAddress &b)
Definition:
network-address.hpp:112
ndn::net::NetworkAddress::getBroadcast
boost::asio::ip::address getBroadcast() const
Returns the IP broadcast address.
Definition:
network-address.hpp:82
ndn::net::NetworkAddress::getFlags
uint32_t getFlags() const
Returns a bitset of platform-specific flags enabled on the address.
Definition:
network-address.hpp:106
ndn::net::AddressScope::NOWHERE
@ NOWHERE
ndn::net::AddressFamily::UNSPECIFIED
@ UNSPECIFIED
ndn::net::NetworkAddress
Stores one IP address supported by a network interface.
Definition:
network-address.hpp:54
ndn::net::AddressScope::LINK
@ LINK
ndn::net::NetworkAddress::getScope
AddressScope getScope() const
Returns the address scope.
Definition:
network-address.hpp:98
ndn::net::AddressFamily::V6
@ V6
ndn::net::AddressScope::HOST
@ HOST
ndn::net::operator<<
std::ostream & operator<<(std::ostream &os, AddressScope scope)
Definition:
network-address.cpp:30
ndn::net::AddressScope::GLOBAL
@ GLOBAL
ndn::net::NetworkAddress::getIp
boost::asio::ip::address getIp() const
Returns the IP address (v4 or v6)
Definition:
network-address.hpp:74
ndn::net::AddressFamily
AddressFamily
Definition:
network-address.hpp:34
ndn::net::AddressFamily::V4
@ V4
ndn::net::AddressScope
AddressScope
Definition:
network-address.hpp:40
ndn::net
Definition:
link-type-helper.cpp:30
ndn::net::NetworkAddress::getPrefixLength
uint8_t getPrefixLength() const
Returns the prefix length.
Definition:
network-address.hpp:90
ndn::net::NetworkAddress::getFamily
AddressFamily getFamily() const
Returns the address family.
Definition:
network-address.hpp:66
ndn::net::NetworkAddress::NetworkAddress
NetworkAddress(AddressFamily family, boost::asio::ip::address ip, boost::asio::ip::address broadcast, uint8_t prefixLength, AddressScope scope, uint32_t flags)
Definition:
network-address.cpp:45
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndnSIM
ndn-cxx
ndn-cxx
net
network-address.hpp
Generated on Mon Jun 1 2020 22:32:14 for ndnSIM by
1.8.18