Files
rippled/Handshake_8h_source.html
2021-01-21 18:53:50 +00:00

255 lines
40 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>rippled: Handshake.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">rippled
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_df9c78dcf3f59a33b12284f95992a64b.html">ripple</a></li><li class="navelem"><a class="el" href="dir_b003f5a72efe503c7552f86021e0c4d2.html">overlay</a></li><li class="navelem"><a class="el" href="dir_3d31096116cb07f2d03f31d101bf2478.html">impl</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Handshake.h</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">//------------------------------------------------------------------------------</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment"> This file is part of rippled: https://github.com/ripple/rippled</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment"> Copyright (c) 2012, 2013 Ripple Labs Inc.</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment"> Permission to use, copy, modify, and/or distribute this software for any</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment"> purpose with or without fee is hereby granted, provided that the above</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment"> copyright notice and this permission notice appear in all copies.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment"> THE SOFTWARE IS PROVIDED &quot;AS IS&quot; AND THE AUTHOR DISCLAIMS ALL WARRANTIES</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment"> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment"> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="comment"> ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment"> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="comment"> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="comment"> OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="comment">//==============================================================================</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160; </div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor">#ifndef RIPPLE_OVERLAY_HANDSHAKE_H_INCLUDED</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="preprocessor">#define RIPPLE_OVERLAY_HANDSHAKE_H_INCLUDED</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160; </div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="preprocessor">#include &lt;ripple/app/main/Application.h&gt;</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="preprocessor">#include &lt;ripple/beast/utility/Journal.h&gt;</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;<span class="preprocessor">#include &lt;ripple/overlay/impl/ProtocolVersion.h&gt;</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;<span class="preprocessor">#include &lt;ripple/protocol/BuildInfo.h&gt;</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;<span class="preprocessor">#include &lt;boost/asio/ip/tcp.hpp&gt;</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;<span class="preprocessor">#include &lt;boost/asio/ssl/context.hpp&gt;</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;<span class="preprocessor">#include &lt;boost/asio/ssl/stream.hpp&gt;</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;<span class="preprocessor">#include &lt;boost/beast/core/tcp_stream.hpp&gt;</span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;<span class="preprocessor">#include &lt;boost/beast/ssl/ssl_stream.hpp&gt;</span></div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; </div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;<span class="preprocessor">#include &lt;boost/asio/ssl.hpp&gt;</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;<span class="preprocessor">#include &lt;boost/beast/http/dynamic_body.hpp&gt;</span></div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;<span class="preprocessor">#include &lt;boost/beast/http/empty_body.hpp&gt;</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;<span class="preprocessor">#include &lt;boost/beast/http/fields.hpp&gt;</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;<span class="preprocessor">#include &lt;<a class="codeRef" href="http://en.cppreference.com/w/cpp/header/optional.html">optional</a>&gt;</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;<span class="preprocessor">#include &lt;<a class="codeRef" href="http://en.cppreference.com/w/cpp/header/utility.html">utility</a>&gt;</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; </div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespaceripple.html">ripple</a> {</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; </div>
<div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="namespaceripple.html#acf6e0f2509512b9dac2b0daccafd75b9"> 42</a></span>&#160;<span class="keyword">using</span> <a class="code" href="namespaceripple.html#acf6e0f2509512b9dac2b0daccafd75b9">socket_type</a> = boost::beast::tcp_stream;</div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="namespaceripple.html#a0356489dd518b8dc89a1153048cb4aee"> 43</a></span>&#160;<span class="keyword">using</span> <a class="code" href="namespaceripple.html#a0356489dd518b8dc89a1153048cb4aee">stream_type</a> = boost::beast::ssl_stream&lt;socket_type&gt;;</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160;<span class="keyword">using</span> <a class="code" href="namespaceripple.html#aca9c2c7a74ddd4a436b5984f6a265621">request_type</a> =</div>
<div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="namespaceripple.html#aca9c2c7a74ddd4a436b5984f6a265621"> 45</a></span>&#160; boost::beast::http::request&lt;boost::beast::http::empty_body&gt;;</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160;<span class="keyword">using</span> <a class="code" href="namespaceripple.html#aa265217edeb8282e636c78b50049f4c0">http_request_type</a> =</div>
<div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="namespaceripple.html#aa265217edeb8282e636c78b50049f4c0"> 47</a></span>&#160; boost::beast::http::request&lt;boost::beast::http::dynamic_body&gt;;</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;<span class="keyword">using</span> <a class="code" href="namespaceripple.html#a2581fa85c4291f16bf9e17d78615d584">http_response_type</a> =</div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="namespaceripple.html#a2581fa85c4291f16bf9e17d78615d584"> 49</a></span>&#160; boost::beast::http::response&lt;boost::beast::http::dynamic_body&gt;;</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; </div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;<a class="codeRef" href="http://en.cppreference.com/w/cpp/utility/optional.html">std::optional&lt;uint256&gt;</a></div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160;<a class="code" href="namespaceripple.html#a7241d07322a0d8fa2e2effedd739a90f">makeSharedValue</a>(<a class="code" href="namespaceripple.html#a0356489dd518b8dc89a1153048cb4aee">stream_type</a>&amp; ssl, <a class="code" href="classbeast_1_1Journal.html">beast::Journal</a> journal);</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; </div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;<span class="keywordtype">void</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;<a class="code" href="namespaceripple.html#a2f6f4c48edfa4bab7857fc6d554d0bcf">buildHandshake</a>(</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; boost::beast::http::fields&amp; h,</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; <a class="code" href="classripple_1_1base__uint.html">uint256</a> <span class="keyword">const</span>&amp; sharedValue,</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; <a class="codeRef" href="http://en.cppreference.com/w/cpp/utility/optional.html">std::optional&lt;std::uint32_t&gt;</a> networkID,</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; <a class="code" href="namespacebeast_1_1IP.html#adbe597760cb20a7aa3f2ff92f7bed2cc">beast::IP::Address</a> public_ip,</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; <a class="code" href="namespacebeast_1_1IP.html#adbe597760cb20a7aa3f2ff92f7bed2cc">beast::IP::Address</a> remote_ip,</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; <a class="code" href="classripple_1_1Application.html">Application</a>&amp; app);</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; </div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160;<a class="code" href="classripple_1_1PublicKey.html">PublicKey</a></div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160;<a class="code" href="namespaceripple.html#acd7881ae39681c7d64a5904b367219ab">verifyHandshake</a>(</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; boost::beast::http::fields <span class="keyword">const</span>&amp; headers,</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; <a class="code" href="classripple_1_1base__uint.html">uint256</a> <span class="keyword">const</span>&amp; sharedValue,</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; <a class="codeRef" href="http://en.cppreference.com/w/cpp/utility/optional.html">std::optional&lt;std::uint32_t&gt;</a> networkID,</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; <a class="code" href="namespacebeast_1_1IP.html#adbe597760cb20a7aa3f2ff92f7bed2cc">beast::IP::Address</a> public_ip,</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; <a class="code" href="namespacebeast_1_1IP.html#adbe597760cb20a7aa3f2ff92f7bed2cc">beast::IP::Address</a> remote,</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; <a class="code" href="classripple_1_1Application.html">Application</a>&amp; app);</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160; </div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160;<a class="code" href="namespaceripple.html#aca9c2c7a74ddd4a436b5984f6a265621">request_type</a></div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160;<a class="code" href="namespaceripple.html#a0d6f9f46746fc6a0b185a124626b5f04">makeRequest</a>(<span class="keywordtype">bool</span> crawlPublic, <span class="keywordtype">bool</span> comprEnabled, <span class="keywordtype">bool</span> vpReduceRelayEnabled);</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; </div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160;<a class="code" href="namespaceripple.html#a2581fa85c4291f16bf9e17d78615d584">http_response_type</a></div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160;<a class="code" href="namespaceripple.html#a5590ae6006b178275628bde91fa03129">makeResponse</a>(</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; <span class="keywordtype">bool</span> crawlPublic,</div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; <a class="code" href="namespaceripple.html#aa265217edeb8282e636c78b50049f4c0">http_request_type</a> <span class="keyword">const</span>&amp; req,</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; <a class="code" href="namespacebeast_1_1IP.html#adbe597760cb20a7aa3f2ff92f7bed2cc">beast::IP::Address</a> public_ip,</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; <a class="code" href="namespacebeast_1_1IP.html#adbe597760cb20a7aa3f2ff92f7bed2cc">beast::IP::Address</a> remote_ip,</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; <a class="code" href="classripple_1_1base__uint.html">uint256</a> <span class="keyword">const</span>&amp; sharedValue,</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; <a class="codeRef" href="http://en.cppreference.com/w/cpp/utility/optional.html">std::optional&lt;std::uint32_t&gt;</a> networkID,</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; <a class="codeRef" href="http://en.cppreference.com/w/cpp/utility/pair.html">ProtocolVersion</a> version,</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; <a class="code" href="classripple_1_1Application.html">Application</a>&amp; app);</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; </div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160;<span class="comment">// Protocol features negotiated via HTTP handshake.</span></div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160;<span class="comment">// The format is:</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160;<span class="comment">// X-Protocol-Ctl: feature1=value1[,value2]*[\s*;\s*feature2=value1[,value2]*]*</span></div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160;<span class="comment">// value: \S+</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"><a class="line" href="namespaceripple.html#a329f20572687d73e31094b0717ea7424"> 131</a></span>&#160;<span class="keyword">static</span> constexpr <span class="keywordtype">char</span> <a class="code" href="namespaceripple.html#a329f20572687d73e31094b0717ea7424">FEATURE_COMPR</a>[] = <span class="stringliteral">&quot;compr&quot;</span>; <span class="comment">// compression</span></div>
<div class="line"><a name="l00132"></a><span class="lineno"><a class="line" href="namespaceripple.html#af8096ae8c38e0d57b54d62311a0ae0e3"> 132</a></span>&#160;<span class="keyword">static</span> constexpr <span class="keywordtype">char</span> <a class="code" href="namespaceripple.html#af8096ae8c38e0d57b54d62311a0ae0e3">FEATURE_VPRR</a>[] =</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; <span class="stringliteral">&quot;vprr&quot;</span>; <span class="comment">// validation/proposal reduce-relay</span></div>
<div class="line"><a name="l00134"></a><span class="lineno"><a class="line" href="namespaceripple.html#a201121472e8bff3b8d8eef7a2ef84b11"> 134</a></span>&#160;<span class="keyword">static</span> constexpr <span class="keywordtype">char</span> <a class="code" href="namespaceripple.html#a201121472e8bff3b8d8eef7a2ef84b11">DELIM_FEATURE</a>[] = <span class="stringliteral">&quot;;&quot;</span>;</div>
<div class="line"><a name="l00135"></a><span class="lineno"><a class="line" href="namespaceripple.html#a3626d08bac9baa6b3480e2e5ebe91682"> 135</a></span>&#160;<span class="keyword">static</span> constexpr <span class="keywordtype">char</span> <a class="code" href="namespaceripple.html#a3626d08bac9baa6b3480e2e5ebe91682">DELIM_VALUE</a>[] = <span class="stringliteral">&quot;,&quot;</span>;</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160; </div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160;<a class="codeRef" href="http://en.cppreference.com/w/cpp/utility/optional.html">std::optional&lt;std::string&gt;</a></div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160;<a class="code" href="namespaceripple.html#ab289776c60bd705e640136f8248adff9">getFeatureValue</a>(</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; boost::beast::http::fields <span class="keyword">const</span>&amp; headers,</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; <a class="codeRef" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> <span class="keyword">const</span>&amp; feature);</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; </div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160;<span class="keywordtype">bool</span></div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160;<a class="code" href="namespaceripple.html#a6d7b29582ed0ce64ee27f482ae5f96ba">isFeatureValue</a>(</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; boost::beast::http::fields <span class="keyword">const</span>&amp; headers,</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; <a class="codeRef" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> <span class="keyword">const</span>&amp; feature,</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; <a class="codeRef" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> <span class="keyword">const</span>&amp; value);</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; </div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160;<span class="keywordtype">bool</span></div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160;<a class="code" href="namespaceripple.html#aa479458839503ea9da8953313824886b">featureEnabled</a>(</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160; boost::beast::http::fields <span class="keyword">const</span>&amp; headers,</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; <a class="codeRef" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> <span class="keyword">const</span>&amp; feature);</div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; </div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> headers&gt;</div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160;<span class="keywordtype">bool</span></div>
<div class="line"><a name="l00184"></a><span class="lineno"><a class="line" href="namespaceripple.html#ab58cf24607744c98d521c3e97aca2a53"> 184</a></span>&#160;<a class="code" href="namespaceripple.html#ab58cf24607744c98d521c3e97aca2a53">peerFeatureEnabled</a>(</div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; headers <span class="keyword">const</span>&amp; request,</div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; <a class="codeRef" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> <span class="keyword">const</span>&amp; feature,</div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; <a class="codeRef" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> value,</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; <span class="keywordtype">bool</span> config)</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160;{</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; <span class="keywordflow">return</span> config &amp;&amp; <a class="code" href="namespaceripple.html#a6d7b29582ed0ce64ee27f482ae5f96ba">isFeatureValue</a>(request, feature, value);</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160;}</div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160; </div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> headers&gt;</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160;<span class="keywordtype">bool</span></div>
<div class="line"><a name="l00196"></a><span class="lineno"><a class="line" href="namespaceripple.html#afa68890c5d61f277f7e40b3e52a339c8"> 196</a></span>&#160;<a class="code" href="namespaceripple.html#ab58cf24607744c98d521c3e97aca2a53">peerFeatureEnabled</a>(</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; headers <span class="keyword">const</span>&amp; request,</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; <a class="codeRef" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> <span class="keyword">const</span>&amp; feature,</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160; <span class="keywordtype">bool</span> config)</div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160;{</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; <span class="keywordflow">return</span> config &amp;&amp; <a class="code" href="namespaceripple.html#ab58cf24607744c98d521c3e97aca2a53">peerFeatureEnabled</a>(request, feature, <span class="stringliteral">&quot;1&quot;</span>, config);</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160;}</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160; </div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160;<a class="codeRef" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a></div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160;<a class="code" href="namespaceripple.html#af5845555497d66bda2f7f765e88c2d71">makeFeaturesRequestHeader</a>(<span class="keywordtype">bool</span> comprEnabled, <span class="keywordtype">bool</span> vpReduceRelayEnabled);</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; </div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160;<a class="codeRef" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a></div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160;<a class="code" href="namespaceripple.html#a34a9ecd63804a8117fa73170592ab2cd">makeFeaturesResponseHeader</a>(</div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; <a class="code" href="namespaceripple.html#aa265217edeb8282e636c78b50049f4c0">http_request_type</a> <span class="keyword">const</span>&amp; headers,</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; <span class="keywordtype">bool</span> comprEnabled,</div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; <span class="keywordtype">bool</span> vpReduceRelayEnabled);</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; </div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160;} <span class="comment">// namespace ripple</span></div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; </div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclassripple_1_1Application_html"><div class="ttname"><a href="classripple_1_1Application.html">ripple::Application</a></div><div class="ttdef"><b>Definition:</b> <a href="Application_8h_source.html#l00101">Application.h:101</a></div></div>
<div class="ttc" id="abasic_string_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a></div><div class="ttdoc">STL class.</div></div>
<div class="ttc" id="anamespaceripple_html_a0d6f9f46746fc6a0b185a124626b5f04"><div class="ttname"><a href="namespaceripple.html#a0d6f9f46746fc6a0b185a124626b5f04">ripple::makeRequest</a></div><div class="ttdeci">auto makeRequest(bool crawlPublic, bool comprEnabled, bool vpReduceRelayEnabled) -&gt; request_type</div><div class="ttdoc">Make outbound http request.</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8cpp_source.html#l00356">Handshake.cpp:356</a></div></div>
<div class="ttc" id="autility_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/header/utility.html">utility</a></div></div>
<div class="ttc" id="apair_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/utility/pair.html">std::pair</a></div></div>
<div class="ttc" id="anamespaceripple_html_a34a9ecd63804a8117fa73170592ab2cd"><div class="ttname"><a href="namespaceripple.html#a34a9ecd63804a8117fa73170592ab2cd">ripple::makeFeaturesResponseHeader</a></div><div class="ttdeci">std::string makeFeaturesResponseHeader(http_request_type const &amp;headers, bool comprEnabled, bool vpReduceRelayEnabled)</div><div class="ttdoc">Make response header X-Protocol-Ctl value with supported features.</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8cpp_source.html#l00085">Handshake.cpp:85</a></div></div>
<div class="ttc" id="anamespaceripple_html_a201121472e8bff3b8d8eef7a2ef84b11"><div class="ttname"><a href="namespaceripple.html#a201121472e8bff3b8d8eef7a2ef84b11">ripple::DELIM_FEATURE</a></div><div class="ttdeci">static constexpr char DELIM_FEATURE[]</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8h_source.html#l00134">Handshake.h:134</a></div></div>
<div class="ttc" id="anamespaceripple_html_a7241d07322a0d8fa2e2effedd739a90f"><div class="ttname"><a href="namespaceripple.html#a7241d07322a0d8fa2e2effedd739a90f">ripple::makeSharedValue</a></div><div class="ttdeci">std::optional&lt; uint256 &gt; makeSharedValue(stream_type &amp;ssl, beast::Journal journal)</div><div class="ttdoc">Computes a shared value based on the SSL connection state.</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8cpp_source.html#l00131">Handshake.cpp:131</a></div></div>
<div class="ttc" id="anamespaceripple_html_af8096ae8c38e0d57b54d62311a0ae0e3"><div class="ttname"><a href="namespaceripple.html#af8096ae8c38e0d57b54d62311a0ae0e3">ripple::FEATURE_VPRR</a></div><div class="ttdeci">static constexpr char FEATURE_VPRR[]</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8h_source.html#l00132">Handshake.h:132</a></div></div>
<div class="ttc" id="anamespaceripple_html_a6d7b29582ed0ce64ee27f482ae5f96ba"><div class="ttname"><a href="namespaceripple.html#a6d7b29582ed0ce64ee27f482ae5f96ba">ripple::isFeatureValue</a></div><div class="ttdeci">bool isFeatureValue(boost::beast::http::fields const &amp;headers, std::string const &amp;feature, std::string const &amp;value)</div><div class="ttdoc">Check if a feature's value is equal to the specified value.</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8cpp_source.html#l00054">Handshake.cpp:54</a></div></div>
<div class="ttc" id="anamespaceripple_html_aa479458839503ea9da8953313824886b"><div class="ttname"><a href="namespaceripple.html#aa479458839503ea9da8953313824886b">ripple::featureEnabled</a></div><div class="ttdeci">bool featureEnabled(boost::beast::http::fields const &amp;headers, std::string const &amp;feature)</div><div class="ttdoc">Check if a feature is enabled.</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8cpp_source.html#l00066">Handshake.cpp:66</a></div></div>
<div class="ttc" id="aclassripple_1_1base__uint_html"><div class="ttname"><a href="classripple_1_1base__uint.html">ripple::base_uint</a></div><div class="ttdoc">Integers of any length that is a multiple of 32-bits.</div><div class="ttdef"><b>Definition:</b> <a href="base__uint_8h_source.html#l00073">base_uint.h:73</a></div></div>
<div class="ttc" id="anamespacebeast_1_1IP_html_adbe597760cb20a7aa3f2ff92f7bed2cc"><div class="ttname"><a href="namespacebeast_1_1IP.html#adbe597760cb20a7aa3f2ff92f7bed2cc">beast::IP::Address</a></div><div class="ttdeci">boost::asio::ip::address Address</div><div class="ttdef"><b>Definition:</b> <a href="IPAddress_8h_source.html#l00041">IPAddress.h:41</a></div></div>
<div class="ttc" id="aclassripple_1_1PublicKey_html"><div class="ttname"><a href="classripple_1_1PublicKey.html">ripple::PublicKey</a></div><div class="ttdoc">A public key.</div><div class="ttdef"><b>Definition:</b> <a href="PublicKey_8h_source.html#l00059">PublicKey.h:59</a></div></div>
<div class="ttc" id="anamespaceripple_html_a329f20572687d73e31094b0717ea7424"><div class="ttname"><a href="namespaceripple.html#a329f20572687d73e31094b0717ea7424">ripple::FEATURE_COMPR</a></div><div class="ttdeci">static constexpr char FEATURE_COMPR[]</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8h_source.html#l00131">Handshake.h:131</a></div></div>
<div class="ttc" id="anamespaceripple_html_a3626d08bac9baa6b3480e2e5ebe91682"><div class="ttname"><a href="namespaceripple.html#a3626d08bac9baa6b3480e2e5ebe91682">ripple::DELIM_VALUE</a></div><div class="ttdeci">static constexpr char DELIM_VALUE[]</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8h_source.html#l00135">Handshake.h:135</a></div></div>
<div class="ttc" id="aclassbeast_1_1Journal_html"><div class="ttname"><a href="classbeast_1_1Journal.html">beast::Journal</a></div><div class="ttdoc">A generic endpoint for log messages.</div><div class="ttdef"><b>Definition:</b> <a href="Journal_8h_source.html#l00058">Journal.h:58</a></div></div>
<div class="ttc" id="anamespaceripple_html_ab58cf24607744c98d521c3e97aca2a53"><div class="ttname"><a href="namespaceripple.html#ab58cf24607744c98d521c3e97aca2a53">ripple::peerFeatureEnabled</a></div><div class="ttdeci">bool peerFeatureEnabled(headers const &amp;request, std::string const &amp;feature, std::string value, bool config)</div><div class="ttdoc">Check if a feature should be enabled for a peer.</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8h_source.html#l00184">Handshake.h:184</a></div></div>
<div class="ttc" id="anamespaceripple_html_ab289776c60bd705e640136f8248adff9"><div class="ttname"><a href="namespaceripple.html#ab289776c60bd705e640136f8248adff9">ripple::getFeatureValue</a></div><div class="ttdeci">std::optional&lt; std::string &gt; getFeatureValue(boost::beast::http::fields const &amp;headers, std::string const &amp;feature)</div><div class="ttdoc">Get feature's header value.</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8cpp_source.html#l00038">Handshake.cpp:38</a></div></div>
<div class="ttc" id="anamespaceripple_html_a0356489dd518b8dc89a1153048cb4aee"><div class="ttname"><a href="namespaceripple.html#a0356489dd518b8dc89a1153048cb4aee">ripple::stream_type</a></div><div class="ttdeci">boost::beast::ssl_stream&lt; socket_type &gt; stream_type</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8h_source.html#l00043">Handshake.h:43</a></div></div>
<div class="ttc" id="anamespaceripple_html"><div class="ttname"><a href="namespaceripple.html">ripple</a></div><div class="ttdoc">Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.</div><div class="ttdef"><b>Definition:</b> <a href="RCLCensorshipDetector_8h_source.html#l00029">RCLCensorshipDetector.h:29</a></div></div>
<div class="ttc" id="anamespaceripple_html_acf6e0f2509512b9dac2b0daccafd75b9"><div class="ttname"><a href="namespaceripple.html#acf6e0f2509512b9dac2b0daccafd75b9">ripple::socket_type</a></div><div class="ttdeci">boost::beast::tcp_stream socket_type</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8h_source.html#l00042">Handshake.h:42</a></div></div>
<div class="ttc" id="anamespaceripple_html_aca9c2c7a74ddd4a436b5984f6a265621"><div class="ttname"><a href="namespaceripple.html#aca9c2c7a74ddd4a436b5984f6a265621">ripple::request_type</a></div><div class="ttdeci">boost::beast::http::request&lt; boost::beast::http::empty_body &gt; request_type</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8h_source.html#l00045">Handshake.h:45</a></div></div>
<div class="ttc" id="anamespaceripple_html_af5845555497d66bda2f7f765e88c2d71"><div class="ttname"><a href="namespaceripple.html#af5845555497d66bda2f7f765e88c2d71">ripple::makeFeaturesRequestHeader</a></div><div class="ttdeci">std::string makeFeaturesRequestHeader(bool comprEnabled, bool vpReduceRelayEnabled)</div><div class="ttdoc">Make request header X-Protocol-Ctl value with supported features.</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8cpp_source.html#l00074">Handshake.cpp:74</a></div></div>
<div class="ttc" id="aoptional_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/header/optional.html">optional</a></div></div>
<div class="ttc" id="anamespaceripple_html_acd7881ae39681c7d64a5904b367219ab"><div class="ttname"><a href="namespaceripple.html#acd7881ae39681c7d64a5904b367219ab">ripple::verifyHandshake</a></div><div class="ttdeci">PublicKey verifyHandshake(boost::beast::http::fields const &amp;headers, ripple::uint256 const &amp;sharedValue, std::optional&lt; std::uint32_t &gt; networkID, beast::IP::Address public_ip, beast::IP::Address remote, Application &amp;app)</div><div class="ttdoc">Validate header fields necessary for upgrading the link to the peer protocol.</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8cpp_source.html#l00216">Handshake.cpp:216</a></div></div>
<div class="ttc" id="anamespaceripple_html_a5590ae6006b178275628bde91fa03129"><div class="ttname"><a href="namespaceripple.html#a5590ae6006b178275628bde91fa03129">ripple::makeResponse</a></div><div class="ttdeci">http_response_type makeResponse(bool crawlPublic, http_request_type const &amp;req, beast::IP::Address public_ip, beast::IP::Address remote_ip, uint256 const &amp;sharedValue, std::optional&lt; std::uint32_t &gt; networkID, ProtocolVersion protocol, Application &amp;app)</div><div class="ttdoc">Make http response.</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8cpp_source.html#l00375">Handshake.cpp:375</a></div></div>
<div class="ttc" id="anamespaceripple_html_aa265217edeb8282e636c78b50049f4c0"><div class="ttname"><a href="namespaceripple.html#aa265217edeb8282e636c78b50049f4c0">ripple::http_request_type</a></div><div class="ttdeci">boost::beast::http::request&lt; boost::beast::http::dynamic_body &gt; http_request_type</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8h_source.html#l00047">Handshake.h:47</a></div></div>
<div class="ttc" id="anamespaceripple_html_a2581fa85c4291f16bf9e17d78615d584"><div class="ttname"><a href="namespaceripple.html#a2581fa85c4291f16bf9e17d78615d584">ripple::http_response_type</a></div><div class="ttdeci">boost::beast::http::response&lt; boost::beast::http::dynamic_body &gt; http_response_type</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8h_source.html#l00049">Handshake.h:49</a></div></div>
<div class="ttc" id="anamespaceripple_html_a2f6f4c48edfa4bab7857fc6d554d0bcf"><div class="ttname"><a href="namespaceripple.html#a2f6f4c48edfa4bab7857fc6d554d0bcf">ripple::buildHandshake</a></div><div class="ttdeci">void buildHandshake(boost::beast::http::fields &amp;h, ripple::uint256 const &amp;sharedValue, std::optional&lt; std::uint32_t &gt; networkID, beast::IP::Address public_ip, beast::IP::Address remote_ip, Application &amp;app)</div><div class="ttdoc">Insert fields headers necessary for upgrading the link to the peer protocol.</div><div class="ttdef"><b>Definition:</b> <a href="Handshake_8cpp_source.html#l00163">Handshake.cpp:163</a></div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>