Yanbiao Li | ac8b4ca | 2017-07-10 02:27:50 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /* |
Davide Pesavento | 59e266a | 2018-05-27 05:20:20 -0400 | [diff] [blame^] | 3 | * Copyright (c) 2013-2018 Regents of the University of California, |
Yanbiao Li | ac8b4ca | 2017-07-10 02:27:50 -0700 | [diff] [blame] | 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 | |
| 39 | /** |
Yanbiao Li | ac8b4ca | 2017-07-10 02:27:50 -0700 | [diff] [blame] | 40 | * \brief parse and convert the input string into an IP address |
| 41 | * |
| 42 | * \param str the string to parse |
| 43 | * |
| 44 | * \return the converted IP address |
| 45 | * \throw boost::system::system_error in case of failure |
| 46 | */ |
Davide Pesavento | 59e266a | 2018-05-27 05:20:20 -0400 | [diff] [blame^] | 47 | [[deprecated("use boost::asio::ip::address::from_string")]] |
Yanbiao Li | ac8b4ca | 2017-07-10 02:27:50 -0700 | [diff] [blame] | 48 | boost::asio::ip::address |
| 49 | addressFromString(const std::string& str); |
| 50 | |
| 51 | /** |
| 52 | * \brief parse and convert the input string into an IP address |
| 53 | * |
| 54 | * \param str the string to parse |
| 55 | * \param ec the error code of failure in conversion |
| 56 | * |
| 57 | * \return the converted IP address, or a default-constructed |
| 58 | * `boost::asio::ip::address` in case of failure |
| 59 | */ |
Davide Pesavento | 59e266a | 2018-05-27 05:20:20 -0400 | [diff] [blame^] | 60 | [[deprecated("use boost::asio::ip::address::from_string")]] |
Yanbiao Li | ac8b4ca | 2017-07-10 02:27:50 -0700 | [diff] [blame] | 61 | boost::asio::ip::address |
| 62 | addressFromString(const std::string& str, boost::system::error_code& ec); |
| 63 | |
| 64 | /** |
| 65 | * \brief parse and convert the input string into an IPv6 address |
| 66 | * |
| 67 | * \param str the string to parse |
| 68 | * |
| 69 | * \return the converted IPv6 address |
| 70 | * \throw boost::system::system_error in case of failure |
| 71 | */ |
Davide Pesavento | 59e266a | 2018-05-27 05:20:20 -0400 | [diff] [blame^] | 72 | [[deprecated("use boost::asio::ip::address_v6::from_string")]] |
Yanbiao Li | ac8b4ca | 2017-07-10 02:27:50 -0700 | [diff] [blame] | 73 | boost::asio::ip::address_v6 |
| 74 | addressV6FromString(const std::string& str); |
| 75 | |
| 76 | /** |
| 77 | * \brief parse and convert the input string into an IPv6 address |
| 78 | * |
| 79 | * \param str the string to parse |
| 80 | * \param ec the error code of failure in conversion |
| 81 | * |
| 82 | * \return the converted IPv6 address, or a default-constructed |
| 83 | * `boost::asio::ip::address_v6` in case of failure |
| 84 | */ |
Davide Pesavento | 59e266a | 2018-05-27 05:20:20 -0400 | [diff] [blame^] | 85 | [[deprecated("use boost::asio::ip::address_v6::from_string")]] |
Yanbiao Li | ac8b4ca | 2017-07-10 02:27:50 -0700 | [diff] [blame] | 86 | boost::asio::ip::address_v6 |
| 87 | addressV6FromString(const std::string& str, boost::system::error_code& ec); |
| 88 | |
| 89 | } // namespace ip |
| 90 | } // namespace ndn |
| 91 | |
| 92 | #endif // NDN_NET_ADDRESS_CONVERTER_HPP |