address-converter.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013-2017 Regents of the University of California,
4  * Arizona Board of Regents,
5  * Colorado State University,
6  * University Pierre & Marie Curie, Sorbonne University,
7  * Washington University in St. Louis,
8  * Beijing Institute of Technology,
9  * The University of Memphis.
10  *
11  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
12  *
13  * ndn-cxx library is free software: you can redistribute it and/or modify it under the
14  * terms of the GNU Lesser General Public License as published by the Free Software
15  * Foundation, either version 3 of the License, or (at your option) any later version.
16  *
17  * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
18  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
19  * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
20  *
21  * You should have received copies of the GNU General Public License and GNU Lesser
22  * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
23  * <http://www.gnu.org/licenses/>.
24  *
25  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
26  */
27 
28 #ifndef NDN_NET_ADDRESS_CONVERTER_HPP
29 #define NDN_NET_ADDRESS_CONVERTER_HPP
30 
31 #include "../common.hpp"
32 
33 #include <boost/asio/ip/address.hpp>
34 #include <boost/system/error_code.hpp>
35 
36 namespace ndn {
37 namespace ip {
38 
44 optional<std::string>
45 scopeNameFromId(unsigned int scopeId);
46 
55 boost::asio::ip::address
56 addressFromString(const std::string& str);
57 
67 boost::asio::ip::address
68 addressFromString(const std::string& str, boost::system::error_code& ec);
69 
78 boost::asio::ip::address_v6
79 addressV6FromString(const std::string& str);
80 
90 boost::asio::ip::address_v6
91 addressV6FromString(const std::string& str, boost::system::error_code& ec);
92 
93 } // namespace ip
94 } // namespace ndn
95 
96 #endif // NDN_NET_ADDRESS_CONVERTER_HPP
Copyright (c) 2013-2017 Regents of the University of California.
Definition: common.hpp:66
boost::asio::ip::address addressFromString(const std::string &address, boost::system::error_code &ec)
parse and convert the input string into an IP address
boost::asio::ip::address_v6 addressV6FromString(const std::string &address, boost::system::error_code &ec)
parse and convert the input string into an IPv6 address
optional< std::string > scopeNameFromId(unsigned int scopeId)
Convert scope ID of IPv6 address into interface name.