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
25#include <boost/beast/http/dynamic_body.hpp>
26#include <boost/beast/http/message.hpp>
27
28#include <memory>
29
30namespace ripple {
31
33 boost::beast::http::request<boost::beast::http::dynamic_body>;
34
36 boost::beast::http::response<boost::beast::http::dynamic_body>;
37
39struct Handoff
40{
41 // When `true`, the Session will close the socket. The
42 // Handler may optionally take socket ownership using std::move
43 bool moved = false;
44
45 // If response is set, this determines the keep alive
46 bool keep_alive = false;
47
48 // When set, this will be sent back
50
51 bool
52 handled() const
53 {
54 return moved || response;
55 }
56};
57
58} // namespace ripple
59
60#endif
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:25
boost::beast::http::response< boost::beast::http::dynamic_body > http_response_type
Definition: Handoff.h:36
boost::beast::http::request< boost::beast::http::dynamic_body > http_request_type
Definition: Handoff.h:33
Used to indicate the result of a server connection handoff.
Definition: Handoff.h:40
bool keep_alive
Definition: Handoff.h:46
std::shared_ptr< Writer > response
Definition: Handoff.h:49
bool handled() const
Definition: Handoff.h:52