rippled
ripple
app
misc
detail
WorkPlain.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_WORKPLAIN_H_INCLUDED
21
#define RIPPLE_APP_MISC_DETAIL_WORKPLAIN_H_INCLUDED
22
23
#include <ripple/app/misc/detail/WorkBase.h>
24
25
namespace
ripple
{
26
27
namespace
detail {
28
29
// Work over TCP/IP
30
class
WorkPlain
:
public
WorkBase
<WorkPlain>
31
,
public
std::enable_shared_from_this
<WorkPlain>
32
{
33
friend
class
WorkBase
<
WorkPlain
>;
34
35
public
:
36
WorkPlain
(
37
std::string
const
& host,
38
std::string
const
& path,
std::string
const
& port,
39
boost::asio::io_service& ios,
callback_type
cb);
40
~WorkPlain
() =
default
;
41
42
private
:
43
void
44
onConnect
(
error_code
const
& ec);
45
46
socket_type
&
47
stream
()
48
{
49
return
socket_
;
50
}
51
};
52
53
//------------------------------------------------------------------------------
54
55
WorkPlain::WorkPlain
(
56
std::string
const
& host,
57
std::string
const
& path,
std::string
const
& port,
58
boost::asio::io_service& ios, callback_type cb)
59
:
WorkBase
(host, path, port, ios, cb)
60
{
61
}
62
63
void
64
WorkPlain::onConnect
(error_code
const
& ec)
65
{
66
if
(ec)
67
return
fail
(ec);
68
69
onStart
();
70
}
71
72
}
// detail
73
74
}
// ripple
75
76
#endif
ripple::detail::WorkPlain
Definition:
WorkPlain.h:30
std::string
STL class.
ripple::detail::WorkPlain::WorkPlain
WorkPlain(std::string const &host, std::string const &path, std::string const &port, boost::asio::io_service &ios, callback_type cb)
Definition:
WorkPlain.h:55
ripple::detail::WorkBase< WorkPlain >::fail
void fail(error_code const &ec)
Definition:
WorkBase.h:155
ripple::detail::WorkBase< WorkPlain >::socket_
socket_type socket_
Definition:
WorkBase.h:60
ripple::detail::WorkBase< WorkPlain >::onStart
void onStart()
Definition:
WorkBase.h:178
ripple::detail::WorkPlain::~WorkPlain
~WorkPlain()=default
std::enable_shared_from_this
ripple::detail::WorkBase
Definition:
WorkBase.h:36
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition:
RCLCensorshipDetector.h:29
ripple::detail::WorkBase< WorkPlain >::callback_type
std::function< void(error_code const &, response_type &&)> callback_type
Definition:
WorkBase.h:44
ripple::detail::WorkPlain::onConnect
void onConnect(error_code const &ec)
Definition:
WorkPlain.h:64
ripple::detail::WorkBase< WorkPlain >::error_code
boost::system::error_code error_code
Definition:
WorkBase.h:40
ripple::detail::WorkBase< WorkPlain >::socket_type
boost::asio::ip::tcp::socket socket_type
Definition:
WorkBase.h:46
ripple::detail::WorkPlain::stream
socket_type & stream()
Definition:
WorkPlain.h:47
Generated by
1.8.17