mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 09:46:12 +00:00
138 lines
37 KiB
HTML
138 lines
37 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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.14"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>Dash Core: src/rpc/protocol.cpp 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="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="resize.js"></script>
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(document).ready(initResizable);
|
|
/* @license-end */</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="projectlogo"><img alt="Logo" src="bitcoin_logo_doxygen.png"/></td>
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">Dash Core
|
|
 <span id="projectnumber">0.12.2.1</span>
|
|
</div>
|
|
<div id="projectbrief">P2P Digital Currency</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.14 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&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&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>
|
|
</div><!-- top -->
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
<div id="nav-sync" class="sync"></div>
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(document).ready(function(){initNavTree('rpc_2protocol_8cpp_source.html','');});
|
|
/* @license-end */
|
|
</script>
|
|
<div id="doc-content">
|
|
<!-- 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 class="header">
|
|
<div class="headertitle">
|
|
<div class="title">protocol.cpp</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<a href="rpc_2protocol_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">// Copyright (c) 2010 Satoshi Nakamoto</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">// Copyright (c) 2009-2015 The Bitcoin Core developers</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// Copyright (c) 2014-2017 The Dash Core developers</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">// Distributed under the MIT software license, see the accompanying</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">// file COPYING or http://www.opensource.org/licenses/mit-license.php.</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> </div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="preprocessor">#include "<a class="code" href="rpc_2protocol_8h.html">rpc/protocol.h</a>"</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> </div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#include "<a class="code" href="random_8h.html">random.h</a>"</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#include "<a class="code" href="tinyformat_8h.html">tinyformat.h</a>"</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor">#include "util.h"</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="preprocessor">#include "<a class="code" href="utilstrencodings_8h.html">utilstrencodings.h</a>"</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor">#include "<a class="code" href="utiltime_8h.html">utiltime.h</a>"</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor">#include "<a class="code" href="version_8h.html">version.h</a>"</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> </div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#include <stdint.h></span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#include <fstream></span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> </div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="keyword">using namespace </span><a class="code" href="namespacestd.html">std</a>;</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="rpc_2protocol_8cpp.html#a4507c5758f0ce7dc1a2e8740879459da"> 30</a></span> <span class="keywordtype">string</span> <a class="code" href="rpc_2protocol_8cpp.html#a4507c5758f0ce7dc1a2e8740879459da">JSONRPCRequest</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>& strMethod, <span class="keyword">const</span> <a class="code" href="classUniValue.html">UniValue</a>& params, <span class="keyword">const</span> <a class="code" href="classUniValue.html">UniValue</a>& <span class="keywordtype">id</span>)</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> {</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  <a class="code" href="classUniValue.html">UniValue</a> request(<a class="code" href="classUniValue.html#a2f9803e567ede73e88302b01e394cc63a4d17ac56db012de25e26ac62daf3f475">UniValue::VOBJ</a>);</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  request.<a class="code" href="classUniValue.html#a944cd1b59b040cd24c9f46b55a68d49a">push_back</a>(<a class="code" href="univalue_8h.html#a884f0e316157c5d85f6cff80c442bf1a">Pair</a>(<span class="stringliteral">"method"</span>, strMethod));</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  request.<a class="code" href="classUniValue.html#a944cd1b59b040cd24c9f46b55a68d49a">push_back</a>(<a class="code" href="univalue_8h.html#a884f0e316157c5d85f6cff80c442bf1a">Pair</a>(<span class="stringliteral">"params"</span>, params));</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  request.<a class="code" href="classUniValue.html#a944cd1b59b040cd24c9f46b55a68d49a">push_back</a>(<a class="code" href="univalue_8h.html#a884f0e316157c5d85f6cff80c442bf1a">Pair</a>(<span class="stringliteral">"id"</span>, <span class="keywordtype">id</span>));</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keywordflow">return</span> request.<a class="code" href="classUniValue.html#a8055f724aa8d0d33fa0467128922a75d">write</a>() + <span class="stringliteral">"\n"</span>;</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> }</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> </div><div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="rpc_2protocol_8h.html#ac3b7dd20357d54461794da1213448ed8"> 39</a></span> <a class="code" href="classUniValue.html">UniValue</a> <a class="code" href="rpc_2protocol_8cpp.html#ac3b7dd20357d54461794da1213448ed8">JSONRPCReplyObj</a>(<span class="keyword">const</span> <a class="code" href="classUniValue.html">UniValue</a>& <a class="code" href="namespacerpcuser.html#a637791b4450c02d511291cd297ce12df">result</a>, <span class="keyword">const</span> <a class="code" href="classUniValue.html">UniValue</a>& <a class="code" href="util_8h.html#af8985880cf4ef26df0a5aa2ffcb76662">error</a>, <span class="keyword">const</span> <a class="code" href="classUniValue.html">UniValue</a>& <span class="keywordtype">id</span>)</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span> {</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <a class="code" href="classUniValue.html">UniValue</a> reply(<a class="code" href="classUniValue.html#a2f9803e567ede73e88302b01e394cc63a4d17ac56db012de25e26ac62daf3f475">UniValue::VOBJ</a>);</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <span class="keywordflow">if</span> (!<a class="code" href="util_8h.html#af8985880cf4ef26df0a5aa2ffcb76662">error</a>.isNull())</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  reply.<a class="code" href="classUniValue.html#a944cd1b59b040cd24c9f46b55a68d49a">push_back</a>(<a class="code" href="univalue_8h.html#a884f0e316157c5d85f6cff80c442bf1a">Pair</a>(<span class="stringliteral">"result"</span>, <a class="code" href="univalue_8h.html#ab1cbd3b775dba07c37095e995b57e91e">NullUniValue</a>));</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  reply.<a class="code" href="classUniValue.html#a944cd1b59b040cd24c9f46b55a68d49a">push_back</a>(<a class="code" href="univalue_8h.html#a884f0e316157c5d85f6cff80c442bf1a">Pair</a>(<span class="stringliteral">"result"</span>, <a class="code" href="namespacerpcuser.html#a637791b4450c02d511291cd297ce12df">result</a>));</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  reply.<a class="code" href="classUniValue.html#a944cd1b59b040cd24c9f46b55a68d49a">push_back</a>(<a class="code" href="univalue_8h.html#a884f0e316157c5d85f6cff80c442bf1a">Pair</a>(<span class="stringliteral">"error"</span>, <a class="code" href="util_8h.html#af8985880cf4ef26df0a5aa2ffcb76662">error</a>));</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  reply.<a class="code" href="classUniValue.html#a944cd1b59b040cd24c9f46b55a68d49a">push_back</a>(<a class="code" href="univalue_8h.html#a884f0e316157c5d85f6cff80c442bf1a">Pair</a>(<span class="stringliteral">"id"</span>, <span class="keywordtype">id</span>));</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="keywordflow">return</span> reply;</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span> }</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span> </div><div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="rpc_2protocol_8h.html#a2fdb4c40b8481244f300c15abe90c6bd"> 51</a></span> <span class="keywordtype">string</span> <a class="code" href="rpc_2protocol_8cpp.html#ac35624d5dc8c92a05cc19c575f53548b">JSONRPCReply</a>(<span class="keyword">const</span> <a class="code" href="classUniValue.html">UniValue</a>& <a class="code" href="namespacerpcuser.html#a637791b4450c02d511291cd297ce12df">result</a>, <span class="keyword">const</span> <a class="code" href="classUniValue.html">UniValue</a>& <a class="code" href="util_8h.html#af8985880cf4ef26df0a5aa2ffcb76662">error</a>, <span class="keyword">const</span> <a class="code" href="classUniValue.html">UniValue</a>& <span class="keywordtype">id</span>)</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span> {</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <a class="code" href="classUniValue.html">UniValue</a> reply = <a class="code" href="rpc_2protocol_8cpp.html#ac3b7dd20357d54461794da1213448ed8">JSONRPCReplyObj</a>(<a class="code" href="namespacerpcuser.html#a637791b4450c02d511291cd297ce12df">result</a>, <a class="code" href="util_8h.html#af8985880cf4ef26df0a5aa2ffcb76662">error</a>, <span class="keywordtype">id</span>);</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="keywordflow">return</span> reply.<a class="code" href="classUniValue.html#a8055f724aa8d0d33fa0467128922a75d">write</a>() + <span class="stringliteral">"\n"</span>;</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span> }</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span> </div><div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="rpc_2protocol_8cpp.html#a41a2234c99900304357a44796b2259d5"> 57</a></span> <a class="code" href="classUniValue.html">UniValue</a> <a class="code" href="rpc_2protocol_8cpp.html#a41a2234c99900304357a44796b2259d5">JSONRPCError</a>(<span class="keywordtype">int</span> code, <span class="keyword">const</span> <span class="keywordtype">string</span>& message)</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span> {</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <a class="code" href="classUniValue.html">UniValue</a> <a class="code" href="util_8h.html#af8985880cf4ef26df0a5aa2ffcb76662">error</a>(<a class="code" href="classUniValue.html#a2f9803e567ede73e88302b01e394cc63a4d17ac56db012de25e26ac62daf3f475">UniValue::VOBJ</a>);</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <a class="code" href="util_8h.html#af8985880cf4ef26df0a5aa2ffcb76662">error</a>.push_back(<a class="code" href="univalue_8h.html#a884f0e316157c5d85f6cff80c442bf1a">Pair</a>(<span class="stringliteral">"code"</span>, code));</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <a class="code" href="util_8h.html#af8985880cf4ef26df0a5aa2ffcb76662">error</a>.push_back(<a class="code" href="univalue_8h.html#a884f0e316157c5d85f6cff80c442bf1a">Pair</a>(<span class="stringliteral">"message"</span>, message));</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="keywordflow">return</span> <a class="code" href="util_8h.html#af8985880cf4ef26df0a5aa2ffcb76662">error</a>;</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span> }</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> </div><div class="line"><a name="l00068"></a><span class="lineno"><a class="line" href="rpc_2protocol_8cpp.html#aefb20e620a9883ec151225fd88e5217d"> 68</a></span> <span class="keyword">static</span> <span class="keyword">const</span> std::string <a class="code" href="rpc_2protocol_8cpp.html#aefb20e620a9883ec151225fd88e5217d">COOKIEAUTH_USER</a> = <span class="stringliteral">"__cookie__"</span>;</div><div class="line"><a name="l00070"></a><span class="lineno"><a class="line" href="rpc_2protocol_8cpp.html#aab682dd2b4f63d1156c783d1a2edf0f5"> 70</a></span> <span class="keyword">static</span> <span class="keyword">const</span> std::string <a class="code" href="rpc_2protocol_8cpp.html#aab682dd2b4f63d1156c783d1a2edf0f5">COOKIEAUTH_FILE</a> = <span class="stringliteral">".cookie"</span>;</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span> </div><div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="rpc_2protocol_8h.html#aae8ad79d1767e2f4b1207c1af53af7c3"> 72</a></span> boost::filesystem::path <a class="code" href="rpc_2protocol_8cpp.html#aae8ad79d1767e2f4b1207c1af53af7c3">GetAuthCookieFile</a>()</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span> {</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  boost::filesystem::path path(<a class="code" href="util_8cpp.html#a24f685720bf40370e5bd2a192ad50cd8">GetArg</a>(<span class="stringliteral">"-rpccookiefile"</span>, <a class="code" href="rpc_2protocol_8cpp.html#aab682dd2b4f63d1156c783d1a2edf0f5">COOKIEAUTH_FILE</a>));</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="keywordflow">if</span> (!path.is_complete()) path = <a class="code" href="util_8cpp.html#ab83866a054745d4b30a3948a1b44beba">GetDataDir</a>() / path;</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="keywordflow">return</span> path;</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> }</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span> </div><div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="rpc_2protocol_8h.html#aba0ca0057b433bdfcb881fcd6af4b577"> 79</a></span> <span class="keywordtype">bool</span> <a class="code" href="rpc_2protocol_8cpp.html#aba0ca0057b433bdfcb881fcd6af4b577">GenerateAuthCookie</a>(std::string *cookie_out)</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span> {</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <span class="keyword">const</span> <span class="keywordtype">size_t</span> COOKIE_SIZE = 32;</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> rand_pwd[COOKIE_SIZE];</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <a class="code" href="random_8cpp.html#ada0c29949c4d1ac0cc027d93c4771423">GetRandBytes</a>(rand_pwd, COOKIE_SIZE);</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span> </div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  std::string cookie = <a class="code" href="rpc_2protocol_8cpp.html#aefb20e620a9883ec151225fd88e5217d">COOKIEAUTH_USER</a> + <span class="stringliteral">":"</span> + <a class="code" href="utilstrencodings_8h.html#ace13a819ca4e98c22847d26b3b357e75">HexStr</a>(rand_pwd, rand_pwd+COOKIE_SIZE);</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span> </div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  std::ofstream <a class="code" href="namespacelinearize-hashes.html#afd70e9fbab8a06b49534d0ae39afb23b">file</a>;</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  boost::filesystem::path filepath = <a class="code" href="rpc_2protocol_8cpp.html#aae8ad79d1767e2f4b1207c1af53af7c3">GetAuthCookieFile</a>();</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <a class="code" href="namespacelinearize-hashes.html#afd70e9fbab8a06b49534d0ae39afb23b">file</a>.open(filepath.string().c_str());</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="keywordflow">if</span> (!<a class="code" href="namespacelinearize-hashes.html#afd70e9fbab8a06b49534d0ae39afb23b">file</a>.is_open()) {</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <a class="code" href="util_8h.html#afc02c0a4258fedfb316be612bb659ba8">LogPrintf</a>(<span class="stringliteral">"Unable to open cookie authentication file %s for writing\n"</span>, filepath.string());</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  }</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <a class="code" href="namespacelinearize-hashes.html#afd70e9fbab8a06b49534d0ae39afb23b">file</a> << cookie;</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <a class="code" href="namespacelinearize-hashes.html#afd70e9fbab8a06b49534d0ae39afb23b">file</a>.close();</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <a class="code" href="util_8h.html#afc02c0a4258fedfb316be612bb659ba8">LogPrintf</a>(<span class="stringliteral">"Generated RPC authentication cookie %s\n"</span>, filepath.string());</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span> </div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <span class="keywordflow">if</span> (cookie_out)</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  *cookie_out = cookie;</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span> }</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span> </div><div class="line"><a name="l00106"></a><span class="lineno"><a class="line" href="rpc_2protocol_8h.html#a25c502e3691e714e8a130c2325d40d63"> 106</a></span> <span class="keywordtype">bool</span> <a class="code" href="rpc_2protocol_8cpp.html#a25c502e3691e714e8a130c2325d40d63">GetAuthCookie</a>(std::string *cookie_out)</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> {</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  std::ifstream <a class="code" href="namespacelinearize-hashes.html#afd70e9fbab8a06b49534d0ae39afb23b">file</a>;</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  std::string cookie;</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  boost::filesystem::path filepath = <a class="code" href="rpc_2protocol_8cpp.html#aae8ad79d1767e2f4b1207c1af53af7c3">GetAuthCookieFile</a>();</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <a class="code" href="namespacelinearize-hashes.html#afd70e9fbab8a06b49534d0ae39afb23b">file</a>.open(filepath.string().c_str());</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  <span class="keywordflow">if</span> (!<a class="code" href="namespacelinearize-hashes.html#afd70e9fbab8a06b49534d0ae39afb23b">file</a>.is_open())</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  std::getline(<a class="code" href="namespacelinearize-hashes.html#afd70e9fbab8a06b49534d0ae39afb23b">file</a>, cookie);</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <a class="code" href="namespacelinearize-hashes.html#afd70e9fbab8a06b49534d0ae39afb23b">file</a>.close();</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span> </div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keywordflow">if</span> (cookie_out)</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  *cookie_out = cookie;</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span> }</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span> </div><div class="line"><a name="l00122"></a><span class="lineno"><a class="line" href="rpc_2protocol_8h.html#a9807259ee7b7c4f5445cf54fd23589cb"> 122</a></span> <span class="keywordtype">void</span> <a class="code" href="rpc_2protocol_8cpp.html#a9807259ee7b7c4f5445cf54fd23589cb">DeleteAuthCookie</a>()</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span> {</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  <span class="keywordflow">try</span> {</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  boost::filesystem::remove(<a class="code" href="rpc_2protocol_8cpp.html#aae8ad79d1767e2f4b1207c1af53af7c3">GetAuthCookieFile</a>());</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  } <span class="keywordflow">catch</span> (<span class="keyword">const</span> boost::filesystem::filesystem_error& e) {</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <a class="code" href="util_8h.html#afc02c0a4258fedfb316be612bb659ba8">LogPrintf</a>(<span class="stringliteral">"%s: Unable to remove random auth cookie file: %s\n"</span>, __func__, e.what());</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  }</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span> }</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span> </div><div class="ttc" id="util_8cpp_html_ab83866a054745d4b30a3948a1b44beba"><div class="ttname"><a href="util_8cpp.html#ab83866a054745d4b30a3948a1b44beba">GetDataDir</a></div><div class="ttdeci">const boost::filesystem::path & GetDataDir(bool fNetSpecific)</div><div class="ttdef"><b>Definition:</b> <a href="util_8cpp_source.html#l00547">util.cpp:547</a></div></div>
|
|
<div class="ttc" id="rpc_2protocol_8cpp_html_aae8ad79d1767e2f4b1207c1af53af7c3"><div class="ttname"><a href="rpc_2protocol_8cpp.html#aae8ad79d1767e2f4b1207c1af53af7c3">GetAuthCookieFile</a></div><div class="ttdeci">boost::filesystem::path GetAuthCookieFile()</div><div class="ttdef"><b>Definition:</b> <a href="rpc_2protocol_8cpp_source.html#l00072">protocol.cpp:72</a></div></div>
|
|
<div class="ttc" id="utilstrencodings_8h_html_ace13a819ca4e98c22847d26b3b357e75"><div class="ttname"><a href="utilstrencodings_8h.html#ace13a819ca4e98c22847d26b3b357e75">HexStr</a></div><div class="ttdeci">std::string HexStr(const T itbegin, const T itend, bool fSpaces=false)</div><div class="ttdef"><b>Definition:</b> <a href="utilstrencodings_8h_source.html#l00081">utilstrencodings.h:81</a></div></div>
|
|
<div class="ttc" id="utiltime_8h_html"><div class="ttname"><a href="utiltime_8h.html">utiltime.h</a></div></div>
|
|
<div class="ttc" id="rpc_2protocol_8cpp_html_a9807259ee7b7c4f5445cf54fd23589cb"><div class="ttname"><a href="rpc_2protocol_8cpp.html#a9807259ee7b7c4f5445cf54fd23589cb">DeleteAuthCookie</a></div><div class="ttdeci">void DeleteAuthCookie()</div><div class="ttdef"><b>Definition:</b> <a href="rpc_2protocol_8cpp_source.html#l00122">protocol.cpp:122</a></div></div>
|
|
<div class="ttc" id="namespacestd_html"><div class="ttname"><a href="namespacestd.html">std</a></div></div>
|
|
<div class="ttc" id="classUniValue_html"><div class="ttname"><a href="classUniValue.html">UniValue</a></div><div class="ttdef"><b>Definition:</b> <a href="univalue_8h_source.html#l00019">univalue.h:19</a></div></div>
|
|
<div class="ttc" id="rpc_2protocol_8cpp_html_a4507c5758f0ce7dc1a2e8740879459da"><div class="ttname"><a href="rpc_2protocol_8cpp.html#a4507c5758f0ce7dc1a2e8740879459da">JSONRPCRequest</a></div><div class="ttdeci">string JSONRPCRequest(const string &strMethod, const UniValue &params, const UniValue &id)</div><div class="ttdef"><b>Definition:</b> <a href="rpc_2protocol_8cpp_source.html#l00030">protocol.cpp:30</a></div></div>
|
|
<div class="ttc" id="classUniValue_html_a944cd1b59b040cd24c9f46b55a68d49a"><div class="ttname"><a href="classUniValue.html#a944cd1b59b040cd24c9f46b55a68d49a">UniValue::push_back</a></div><div class="ttdeci">bool push_back(const UniValue &val)</div><div class="ttdef"><b>Definition:</b> <a href="univalue_8cpp_source.html#l00176">univalue.cpp:176</a></div></div>
|
|
<div class="ttc" id="rpc_2protocol_8h_html"><div class="ttname"><a href="rpc_2protocol_8h.html">protocol.h</a></div></div>
|
|
<div class="ttc" id="rpc_2protocol_8cpp_html_a25c502e3691e714e8a130c2325d40d63"><div class="ttname"><a href="rpc_2protocol_8cpp.html#a25c502e3691e714e8a130c2325d40d63">GetAuthCookie</a></div><div class="ttdeci">bool GetAuthCookie(std::string *cookie_out)</div><div class="ttdef"><b>Definition:</b> <a href="rpc_2protocol_8cpp_source.html#l00106">protocol.cpp:106</a></div></div>
|
|
<div class="ttc" id="utilstrencodings_8h_html"><div class="ttname"><a href="utilstrencodings_8h.html">utilstrencodings.h</a></div></div>
|
|
<div class="ttc" id="util_8h_html_afc02c0a4258fedfb316be612bb659ba8"><div class="ttname"><a href="util_8h.html#afc02c0a4258fedfb316be612bb659ba8">LogPrintf</a></div><div class="ttdeci">#define LogPrintf(...)</div><div class="ttdef"><b>Definition:</b> <a href="util_8h_source.html#l00098">util.h:98</a></div></div>
|
|
<div class="ttc" id="util_8h_html_af8985880cf4ef26df0a5aa2ffcb76662"><div class="ttname"><a href="util_8h.html#af8985880cf4ef26df0a5aa2ffcb76662">error</a></div><div class="ttdeci">static bool error(const char *format)</div><div class="ttdef"><b>Definition:</b> <a href="util_8h_source.html#l00131">util.h:131</a></div></div>
|
|
<div class="ttc" id="tinyformat_8h_html"><div class="ttname"><a href="tinyformat_8h.html">tinyformat.h</a></div></div>
|
|
<div class="ttc" id="univalue_8h_html_a884f0e316157c5d85f6cff80c442bf1a"><div class="ttname"><a href="univalue_8h.html#a884f0e316157c5d85f6cff80c442bf1a">Pair</a></div><div class="ttdeci">static std::pair< std::string, UniValue > Pair(const char *cKey, const char *cVal)</div><div class="ttdef"><b>Definition:</b> <a href="univalue_8h_source.html#l00166">univalue.h:166</a></div></div>
|
|
<div class="ttc" id="version_8h_html"><div class="ttname"><a href="version_8h.html">version.h</a></div></div>
|
|
<div class="ttc" id="classUniValue_html_a2f9803e567ede73e88302b01e394cc63a4d17ac56db012de25e26ac62daf3f475"><div class="ttname"><a href="classUniValue.html#a2f9803e567ede73e88302b01e394cc63a4d17ac56db012de25e26ac62daf3f475">UniValue::VOBJ</a></div><div class="ttdef"><b>Definition:</b> <a href="univalue_8h_source.html#l00021">univalue.h:21</a></div></div>
|
|
<div class="ttc" id="namespacelinearize-hashes_html_afd70e9fbab8a06b49534d0ae39afb23b"><div class="ttname"><a href="namespacelinearize-hashes.html#afd70e9fbab8a06b49534d0ae39afb23b">linearize-hashes.file</a></div><div class="ttdeci">file</div><div class="ttdef"><b>Definition:</b> <a href="linearize-hashes_8py_source.html#l00105">linearize-hashes.py:105</a></div></div>
|
|
<div class="ttc" id="rpc_2protocol_8cpp_html_aba0ca0057b433bdfcb881fcd6af4b577"><div class="ttname"><a href="rpc_2protocol_8cpp.html#aba0ca0057b433bdfcb881fcd6af4b577">GenerateAuthCookie</a></div><div class="ttdeci">bool GenerateAuthCookie(std::string *cookie_out)</div><div class="ttdef"><b>Definition:</b> <a href="rpc_2protocol_8cpp_source.html#l00079">protocol.cpp:79</a></div></div>
|
|
<div class="ttc" id="rpc_2protocol_8cpp_html_aefb20e620a9883ec151225fd88e5217d"><div class="ttname"><a href="rpc_2protocol_8cpp.html#aefb20e620a9883ec151225fd88e5217d">COOKIEAUTH_USER</a></div><div class="ttdeci">static const std::string COOKIEAUTH_USER</div><div class="ttdef"><b>Definition:</b> <a href="rpc_2protocol_8cpp_source.html#l00068">protocol.cpp:68</a></div></div>
|
|
<div class="ttc" id="classUniValue_html_a8055f724aa8d0d33fa0467128922a75d"><div class="ttname"><a href="classUniValue.html#a8055f724aa8d0d33fa0467128922a75d">UniValue::write</a></div><div class="ttdeci">std::string write(unsigned int prettyIndent=0, unsigned int indentLevel=0) const</div><div class="ttdef"><b>Definition:</b> <a href="univalue__write_8cpp_source.html#l00031">univalue_write.cpp:31</a></div></div>
|
|
<div class="ttc" id="rpc_2protocol_8cpp_html_aab682dd2b4f63d1156c783d1a2edf0f5"><div class="ttname"><a href="rpc_2protocol_8cpp.html#aab682dd2b4f63d1156c783d1a2edf0f5">COOKIEAUTH_FILE</a></div><div class="ttdeci">static const std::string COOKIEAUTH_FILE</div><div class="ttdef"><b>Definition:</b> <a href="rpc_2protocol_8cpp_source.html#l00070">protocol.cpp:70</a></div></div>
|
|
<div class="ttc" id="univalue_8h_html_ab1cbd3b775dba07c37095e995b57e91e"><div class="ttname"><a href="univalue_8h.html#ab1cbd3b775dba07c37095e995b57e91e">NullUniValue</a></div><div class="ttdeci">const UniValue NullUniValue</div><div class="ttdef"><b>Definition:</b> <a href="univalue_8cpp_source.html#l00078">univalue.cpp:78</a></div></div>
|
|
<div class="ttc" id="random_8cpp_html_ada0c29949c4d1ac0cc027d93c4771423"><div class="ttname"><a href="random_8cpp.html#ada0c29949c4d1ac0cc027d93c4771423">GetRandBytes</a></div><div class="ttdeci">void GetRandBytes(unsigned char *buf, int num)</div><div class="ttdef"><b>Definition:</b> <a href="random_8cpp_source.html#l00086">random.cpp:86</a></div></div>
|
|
<div class="ttc" id="util_8cpp_html_a24f685720bf40370e5bd2a192ad50cd8"><div class="ttname"><a href="util_8cpp.html#a24f685720bf40370e5bd2a192ad50cd8">GetArg</a></div><div class="ttdeci">std::string GetArg(const std::string &strArg, const std::string &strDefault)</div><div class="ttdef"><b>Definition:</b> <a href="util_8cpp_source.html#l00441">util.cpp:441</a></div></div>
|
|
<div class="ttc" id="random_8h_html"><div class="ttname"><a href="random_8h.html">random.h</a></div></div>
|
|
<div class="ttc" id="rpc_2protocol_8cpp_html_ac35624d5dc8c92a05cc19c575f53548b"><div class="ttname"><a href="rpc_2protocol_8cpp.html#ac35624d5dc8c92a05cc19c575f53548b">JSONRPCReply</a></div><div class="ttdeci">string JSONRPCReply(const UniValue &result, const UniValue &error, const UniValue &id)</div><div class="ttdef"><b>Definition:</b> <a href="rpc_2protocol_8cpp_source.html#l00051">protocol.cpp:51</a></div></div>
|
|
<div class="ttc" id="rpc_2protocol_8cpp_html_ac3b7dd20357d54461794da1213448ed8"><div class="ttname"><a href="rpc_2protocol_8cpp.html#ac3b7dd20357d54461794da1213448ed8">JSONRPCReplyObj</a></div><div class="ttdeci">UniValue JSONRPCReplyObj(const UniValue &result, const UniValue &error, const UniValue &id)</div><div class="ttdef"><b>Definition:</b> <a href="rpc_2protocol_8cpp_source.html#l00039">protocol.cpp:39</a></div></div>
|
|
<div class="ttc" id="rpc_2protocol_8cpp_html_a41a2234c99900304357a44796b2259d5"><div class="ttname"><a href="rpc_2protocol_8cpp.html#a41a2234c99900304357a44796b2259d5">JSONRPCError</a></div><div class="ttdeci">UniValue JSONRPCError(int code, const string &message)</div><div class="ttdef"><b>Definition:</b> <a href="rpc_2protocol_8cpp_source.html#l00057">protocol.cpp:57</a></div></div>
|
|
<div class="ttc" id="namespacerpcuser_html_a637791b4450c02d511291cd297ce12df"><div class="ttname"><a href="namespacerpcuser.html#a637791b4450c02d511291cd297ce12df">rpcuser.result</a></div><div class="ttdeci">result</div><div class="ttdef"><b>Definition:</b> <a href="rpcuser_8py_source.html#l00037">rpcuser.py:37</a></div></div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
<!-- start footer part -->
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
<ul>
|
|
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_1d8fd1f10602b1b3ec6e7b702d4ec182.html">rpc</a></li><li class="navelem"><a class="el" href="rpc_2protocol_8cpp.html">protocol.cpp</a></li>
|
|
<li class="footer">Generated on Thu Dec 14 2017 13:15:04 for Dash Core by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|