rippled
Loading...
Searching...
No Matches
Handoff.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2013 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_SERVER_HANDOFF_H_INCLUDED
21#define RIPPLE_SERVER_HANDOFF_H_INCLUDED
22
23#include <xrpl/server/Writer.h>
24#include <boost/beast/http/dynamic_body.hpp>
25#include <boost/beast/http/message.hpp>
26#include <memory>
27
28namespace ripple {
29
31 boost::beast::http::request<boost::beast::http::dynamic_body>;
32
34 boost::beast::http::response<boost::beast::http::dynamic_body>;
35
37struct Handoff
38{
39 // When `true`, the Session will close the socket. The
40 // Handler may optionally take socket ownership using std::move
41 bool moved = false;
42
43 // If response is set, this determines the keep alive
44 bool keep_alive = false;
45
46 // When set, this will be sent back
48
49 bool
50 handled() const
51 {
52 return moved || response;
53 }
54};
55
56} // namespace ripple
57
58#endif
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
boost::beast::http::response< boost::beast::http::dynamic_body > http_response_type
Definition: Handoff.h:34
boost::beast::http::request< boost::beast::http::dynamic_body > http_request_type
Definition: Handoff.h:31
Used to indicate the result of a server connection handoff.
Definition: Handoff.h:38
bool keep_alive
Definition: Handoff.h:44
std::shared_ptr< Writer > response
Definition: Handoff.h:47
bool handled() const
Definition: Handoff.h:50