rippled
IPAddressConversion.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of Beast: https://github.com/vinniefalco/Beast
4  Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #ifndef BEAST_NET_IPADDRESSCONVERSION_H_INCLUDED
21 #define BEAST_NET_IPADDRESSCONVERSION_H_INCLUDED
22 
23 #include <ripple/beast/net/IPEndpoint.h>
24 
25 #include <sstream>
26 
27 #include <boost/asio.hpp>
28 
29 namespace beast {
30 namespace IP {
31 
35 Endpoint
36 from_asio(boost::asio::ip::address const& address);
37 
39 Endpoint
40 from_asio(boost::asio::ip::tcp::endpoint const& endpoint);
41 
45 boost::asio::ip::address
46 to_asio_address(Endpoint const& endpoint);
47 
49 boost::asio::ip::tcp::endpoint
50 to_asio_endpoint(Endpoint const& endpoint);
51 
52 } // namespace IP
53 } // namespace beast
54 
55 namespace beast {
56 
57 // DEPRECATED
59 {
60  explicit IPAddressConversion() = default;
61 
62  static IP::Endpoint
63  from_asio(boost::asio::ip::address const& address)
64  {
65  return IP::from_asio(address);
66  }
67  static IP::Endpoint
68  from_asio(boost::asio::ip::tcp::endpoint const& endpoint)
69  {
70  return IP::from_asio(endpoint);
71  }
72  static boost::asio::ip::address
73  to_asio_address(IP::Endpoint const& address)
74  {
75  return IP::to_asio_address(address);
76  }
77  static boost::asio::ip::tcp::endpoint
79  {
80  return IP::to_asio_endpoint(address);
81  }
82 };
83 
84 } // namespace beast
85 
86 #endif
beast::IPAddressConversion::from_asio
static IP::Endpoint from_asio(boost::asio::ip::tcp::endpoint const &endpoint)
Definition: IPAddressConversion.h:68
sstream
beast::IPAddressConversion::to_asio_address
static boost::asio::ip::address to_asio_address(IP::Endpoint const &address)
Definition: IPAddressConversion.h:73
beast::IPAddressConversion::from_asio
static IP::Endpoint from_asio(boost::asio::ip::address const &address)
Definition: IPAddressConversion.h:63
beast::IP::to_asio_endpoint
boost::asio::ip::tcp::endpoint to_asio_endpoint(Endpoint const &endpoint)
Convert to asio::ip::tcp::endpoint.
Definition: IPAddressConversion.cpp:44
beast::IPAddressConversion
Definition: IPAddressConversion.h:58
beast::IP::from_asio
Endpoint from_asio(boost::asio::ip::address const &address)
Convert to Endpoint.
Definition: IPAddressConversion.cpp:26
beast::IP::to_asio_address
boost::asio::ip::address to_asio_address(Endpoint const &endpoint)
Convert to asio::ip::address.
Definition: IPAddressConversion.cpp:38
beast::IPAddressConversion::IPAddressConversion
IPAddressConversion()=default
beast::IP::Endpoint
A version-independent IP address and port combination.
Definition: IPEndpoint.h:38
beast::IPAddressConversion::to_asio_endpoint
static boost::asio::ip::tcp::endpoint to_asio_endpoint(IP::Endpoint const &address)
Definition: IPAddressConversion.h:78
beast
Definition: base_uint.h:641