NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
network.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_CORE_NETWORK_HPP
27 #define NFD_CORE_NETWORK_HPP
28 
29 #include "common.hpp"
30 
31 namespace nfd {
32 
33 class Network
34 {
35 public:
37 
38  Network(const boost::asio::ip::address& minAddress,
39  const boost::asio::ip::address& maxAddress);
40 
41  bool
42  doesContain(const boost::asio::ip::address& address) const
43  {
44  return m_minAddress <= address && address <= m_maxAddress;
45  }
46 
47  static const Network&
48  getMaxRangeV4();
49 
50  static const Network&
51  getMaxRangeV6();
52 
53  static bool
54  isValidCidr(const std::string& cidr);
55 
56  bool
57  operator==(const Network& rhs) const
58  {
59  return m_minAddress == rhs.m_minAddress && m_maxAddress == rhs.m_maxAddress;
60  }
61 
62  bool
63  operator!=(const Network& rhs) const
64  {
65  return !(*this == rhs);
66  }
67 
68 private:
69  boost::asio::ip::address m_minAddress;
70  boost::asio::ip::address m_maxAddress;
71 
72  friend std::ostream&
73  operator<<(std::ostream& os, const Network& network);
74 
75  friend std::istream&
76  operator>>(std::istream& is, Network& network);
77 };
78 
79 std::ostream&
80 operator<<(std::ostream& os, const Network& network);
81 
82 std::istream&
83 operator>>(std::istream& is, Network& network);
84 
85 } // namespace nfd
86 
87 #endif // NFD_CORE_NETWORK_HPP
nfd::Network::operator<<
friend std::ostream & operator<<(std::ostream &os, const Network &network)
Definition: network.cpp:79
nfd::Network
Definition: network.hpp:34
nfd::Network::Network
Network()
nfd::Network::operator>>
friend std::istream & operator>>(std::istream &is, Network &network)
Definition: network.cpp:85
nfd::Network::isValidCidr
static bool isValidCidr(const std::string &cidr)
Definition: network.cpp:62
common.hpp
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
nfd::Network::operator==
bool operator==(const Network &rhs) const
Definition: network.hpp:57
nfd::Network::getMaxRangeV4
static const Network & getMaxRangeV4()
Definition: network.cpp:44
nfd::operator<<
std::ostream & operator<<(std::ostream &os, const Network &network)
Definition: network.cpp:79
nfd::Network::getMaxRangeV6
static const Network & getMaxRangeV6()
Definition: network.cpp:52
nfd::Network::doesContain
bool doesContain(const boost::asio::ip::address &address) const
Definition: network.hpp:42
nfd::Network::operator!=
bool operator!=(const Network &rhs) const
Definition: network.hpp:63
nfd::operator>>
std::istream & operator>>(std::istream &is, Network &network)
Definition: network.cpp:85