rippled
Loading...
Searching...
No Matches
WorkSSL.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2016 Ripple Labs Inc.
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 RIPPLE_APP_MISC_DETAIL_WORKSSL_H_INCLUDED
21#define RIPPLE_APP_MISC_DETAIL_WORKSSL_H_INCLUDED
22
23#include <xrpld/app/misc/detail/WorkBase.h>
24#include <xrpld/core/Config.h>
25
26#include <xrpl/basics/contract.h>
27#include <xrpl/net/HTTPClientSSLContext.h>
28
29#include <boost/asio/ssl.hpp>
30#include <boost/format.hpp>
31
32#include <functional>
33
34namespace ripple {
35
36namespace detail {
37
38// Work over SSL
39class WorkSSL : public WorkBase<WorkSSL>,
40 public std::enable_shared_from_this<WorkSSL>
41{
42 friend class WorkBase<WorkSSL>;
43
44private:
45 using stream_type = boost::asio::ssl::stream<socket_type&>;
46
49
50public:
51 WorkSSL(
52 std::string const& host,
53 std::string const& path,
54 std::string const& port,
55 boost::asio::io_context& ios,
57 Config const& config,
58 endpoint_type const& lastEndpoint,
59 bool lastStatus,
60 callback_type cb);
61 ~WorkSSL() = default;
62
63private:
66 {
67 return stream_;
68 }
69
70 void
71 onConnect(error_code const& ec);
72
73 void
74 onHandshake(error_code const& ec);
75};
76
77} // namespace detail
78
79} // namespace ripple
80
81#endif
A generic endpoint for log messages.
Definition Journal.h:60
boost::asio::ip::tcp::endpoint endpoint_type
Definition WorkBase.h:44
boost::system::error_code error_code
Definition WorkBase.h:43
void onHandshake(error_code const &ec)
Definition WorkSSL.cpp:68
void onConnect(error_code const &ec)
Definition WorkSSL.cpp:51
HTTPClientSSLContext context_
Definition WorkSSL.h:47
stream_type & stream()
Definition WorkSSL.h:65
stream_type stream_
Definition WorkSSL.h:48
boost::asio::ssl::stream< socket_type & > stream_type
Definition WorkSSL.h:45
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25