268 lines
37 KiB
HTML
268 lines
37 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.16"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>mastodonpp: include/curl_wrapper.hpp 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">mastodonpp
|
|
 <span id="projectnumber">0.4.0</span>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.16 -->
|
|
<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>
|
|
<!-- 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_d44c64559bbebec7f509842c48db8b23.html">include</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">curl_wrapper.hpp</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/* This file is part of mastodonpp.</span></div>
|
|
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * Copyright © 2020 tastytea <tastytea@tastytea.de></span></div>
|
|
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> *</span></div>
|
|
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * This program is free software: you can redistribute it and/or modify</span></div>
|
|
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * it under the terms of the GNU Affero General Public License as published by</span></div>
|
|
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * the Free Software Foundation, version 3.</span></div>
|
|
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> *</span></div>
|
|
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> * This program is distributed in the hope that it will be useful,</span></div>
|
|
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div>
|
|
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></div>
|
|
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> * GNU Affero General Public License for more details.</span></div>
|
|
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> *</span></div>
|
|
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> * You should have received a copy of the GNU Affero General Public License</span></div>
|
|
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> * along with this program. If not, see <http://www.gnu.org/licenses/>.</span></div>
|
|
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> */</span></div>
|
|
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>  </div>
|
|
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#ifndef MASTODONPP_CURL_WRAPPER_HPP</span></div>
|
|
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#define MASTODONPP_CURL_WRAPPER_HPP</span></div>
|
|
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  </div>
|
|
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="preprocessor">#include "types.hpp"</span></div>
|
|
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  </div>
|
|
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#include "curl/curl.h"</span></div>
|
|
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  </div>
|
|
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#include <mutex></span></div>
|
|
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include <string></span></div>
|
|
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#include <string_view></span></div>
|
|
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  </div>
|
|
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="keyword">namespace </span><a class="code" href="namespacemastodonpp.html">mastodonpp</a></div>
|
|
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span> {</div>
|
|
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  </div>
|
|
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="keyword">using</span> std::mutex;</div>
|
|
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="keyword">using</span> std::string;</div>
|
|
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="keyword">using</span> std::string_view;</div>
|
|
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  </div>
|
|
<div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="namespacemastodonpp.html#a7d60fc71ad0fb1fbd467b37fe1f1f100"> 40</a></span> <span class="keyword">enum class</span> <a class="code" href="namespacemastodonpp.html#a7d60fc71ad0fb1fbd467b37fe1f1f100">http_method</a></div>
|
|
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span> {</div>
|
|
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  GET,</div>
|
|
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  POST,</div>
|
|
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  PATCH,</div>
|
|
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  PUT,</div>
|
|
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  DELETE</div>
|
|
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span> };</div>
|
|
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  </div>
|
|
<div class="line"><a name="l00058"></a><span class="lineno"><a class="line" href="classmastodonpp_1_1CURLWrapper.html"> 58</a></span> <span class="keyword">class </span><a class="code" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a></div>
|
|
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span> {</div>
|
|
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span> <span class="keyword">public</span>:</div>
|
|
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <a class="code" href="classmastodonpp_1_1CURLWrapper.html#a736572303fbec7a307514e611e6a468c">CURLWrapper</a>();</div>
|
|
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  </div>
|
|
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <a class="code" href="classmastodonpp_1_1CURLWrapper.html#a736572303fbec7a307514e611e6a468c">CURLWrapper</a>(<span class="keyword">const</span> <a class="code" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &other) = <span class="keyword">delete</span>;</div>
|
|
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  </div>
|
|
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  <a class="code" href="classmastodonpp_1_1CURLWrapper.html#a736572303fbec7a307514e611e6a468c">CURLWrapper</a>(<a class="code" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &&other) noexcept = <span class="keyword">delete</span>;</div>
|
|
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  </div>
|
|
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keyword">virtual</span> <a class="code" href="classmastodonpp_1_1CURLWrapper.html#a350f7061c9cb54cb5992ae983db3fc19">~CURLWrapper</a>() noexcept;</div>
|
|
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  </div>
|
|
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <a class="code" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a>& <a class="code" href="classmastodonpp_1_1CURLWrapper.html#a5f29b7f4d0b58f70bc96f362cdaa4d0a">operator=</a>(<span class="keyword">const</span> <a class="code" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &other) = <span class="keyword">delete</span>;</div>
|
|
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  </div>
|
|
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <a class="code" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a>& <a class="code" href="classmastodonpp_1_1CURLWrapper.html#a5f29b7f4d0b58f70bc96f362cdaa4d0a">operator=</a>(<a class="code" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &&other) noexcept = <span class="keyword">delete</span>;</div>
|
|
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  </div>
|
|
<div class="line"><a name="l00105"></a><span class="lineno"><a class="line" href="classmastodonpp_1_1CURLWrapper.html#a2b7aaf03245a0730eeb464802168aded"> 105</a></span>  <span class="keyword">inline</span> CURL *<a class="code" href="classmastodonpp_1_1CURLWrapper.html#a2b7aaf03245a0730eeb464802168aded">get_curl_easy_handle</a>()</div>
|
|
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  {</div>
|
|
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <span class="keywordflow">return</span> _connection;</div>
|
|
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  }</div>
|
|
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  </div>
|
|
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  [[nodiscard]]</div>
|
|
<div class="line"><a name="l00123"></a><span class="lineno"><a class="line" href="classmastodonpp_1_1CURLWrapper.html#a11a543a0821a275dfce1ad7a0e68b17f"> 123</a></span>  <span class="keyword">inline</span> <span class="keywordtype">string</span> <a class="code" href="classmastodonpp_1_1CURLWrapper.html#a11a543a0821a275dfce1ad7a0e68b17f">escape_url</a>(<span class="keyword">const</span> string_view url)<span class="keyword"> const</span></div>
|
|
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span> <span class="keyword"> </span>{</div>
|
|
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  <span class="keywordtype">char</span> *cbuf{curl_easy_escape(_connection, url.data(),</div>
|
|
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  static_cast<int>(url.size()))};</div>
|
|
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="keywordtype">string</span> sbuf{cbuf};</div>
|
|
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  curl_free(cbuf);</div>
|
|
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <span class="keywordflow">return</span> sbuf;</div>
|
|
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  }</div>
|
|
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  </div>
|
|
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  [[nodiscard]]</div>
|
|
<div class="line"><a name="l00145"></a><span class="lineno"><a class="line" href="classmastodonpp_1_1CURLWrapper.html#aed6d09b5c32d71276a851ddf321b5891"> 145</a></span>  <span class="keyword">inline</span> <span class="keywordtype">string</span> <a class="code" href="classmastodonpp_1_1CURLWrapper.html#aed6d09b5c32d71276a851ddf321b5891">unescape_url</a>(<span class="keyword">const</span> string_view url)<span class="keyword"> const</span></div>
|
|
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span> <span class="keyword"> </span>{</div>
|
|
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  <span class="keywordtype">char</span> *cbuf{curl_easy_unescape(_connection, url.data(),</div>
|
|
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  static_cast<int>(url.size()), <span class="keyword">nullptr</span>)};</div>
|
|
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  <span class="keywordtype">string</span> sbuf{cbuf};</div>
|
|
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  curl_free(cbuf);</div>
|
|
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  <span class="keywordflow">return</span> sbuf;</div>
|
|
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  }</div>
|
|
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  </div>
|
|
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <span class="keywordtype">void</span> <a class="code" href="classmastodonpp_1_1CURLWrapper.html#a0059ecb78b53c4b3c941b19f8dc897f7">setup_connection_properties</a>(string_view proxy,</div>
|
|
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  string_view access_token,</div>
|
|
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  string_view cainfo,</div>
|
|
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  string_view useragent);</div>
|
|
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>  </div>
|
|
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span> <span class="keyword">protected</span>:</div>
|
|
<div class="line"><a name="l00175"></a><span class="lineno"><a class="line" href="classmastodonpp_1_1CURLWrapper.html#aeb3171d955832b8062dc02b4ac67d195"> 175</a></span>  mutex <a class="code" href="classmastodonpp_1_1CURLWrapper.html#aeb3171d955832b8062dc02b4ac67d195">buffer_mutex</a>;</div>
|
|
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  </div>
|
|
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>  [[nodiscard]]</div>
|
|
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  <a class="code" href="structmastodonpp_1_1answer__type.html">answer_type</a> <a class="code" href="classmastodonpp_1_1CURLWrapper.html#adc8808c3fad5397176f6755b09ee0be6">make_request</a>(<span class="keyword">const</span> <a class="code" href="namespacemastodonpp.html#a7d60fc71ad0fb1fbd467b37fe1f1f100">http_method</a> &method, <span class="keywordtype">string</span> uri,</div>
|
|
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  <span class="keyword">const</span> <a class="code" href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6">parametermap</a> &parameters);</div>
|
|
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  </div>
|
|
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  [[nodiscard]]</div>
|
|
<div class="line"><a name="l00196"></a><span class="lineno"><a class="line" href="classmastodonpp_1_1CURLWrapper.html#a04b3919cfb38716c5a032337e442db95"> 196</a></span>  <span class="keywordtype">string</span> &<a class="code" href="classmastodonpp_1_1CURLWrapper.html#a04b3919cfb38716c5a032337e442db95">get_buffer</a>()</div>
|
|
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  {</div>
|
|
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  <span class="keywordflow">return</span> _curl_buffer_body;</div>
|
|
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>  }</div>
|
|
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  </div>
|
|
<div class="line"><a name="l00210"></a><span class="lineno"><a class="line" href="classmastodonpp_1_1CURLWrapper.html#a892a4fc3d048798fa8e2584545b91861"> 210</a></span>  <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classmastodonpp_1_1CURLWrapper.html#a892a4fc3d048798fa8e2584545b91861">cancel_stream</a>()</div>
|
|
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  {</div>
|
|
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  _stream_cancelled = <span class="keyword">true</span>;</div>
|
|
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  }</div>
|
|
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  </div>
|
|
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>  <span class="keywordtype">void</span> <a class="code" href="classmastodonpp_1_1CURLWrapper.html#a1564a42794ef7a9d170b725063ef504d">set_proxy</a>(string_view proxy);</div>
|
|
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>  </div>
|
|
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  <span class="keywordtype">void</span> <a class="code" href="classmastodonpp_1_1CURLWrapper.html#a94aba6daedea376ccc20e5c983bd3358">set_access_token</a>(string_view access_token);</div>
|
|
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>  </div>
|
|
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  </div>
|
|
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  <span class="keywordtype">void</span> <a class="code" href="classmastodonpp_1_1CURLWrapper.html#af3f2bd4dea7c289d590fe19889360444">set_cainfo</a>(string_view path);</div>
|
|
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  </div>
|
|
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>  <span class="keywordtype">void</span> <a class="code" href="classmastodonpp_1_1CURLWrapper.html#ae3b1445f9b94b1f7677d3cac6d538612">set_useragent</a>(string_view useragent);</div>
|
|
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>  </div>
|
|
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span> <span class="keyword">private</span>:</div>
|
|
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>  CURL *_connection;</div>
|
|
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  <span class="keywordtype">char</span> _curl_buffer_error[CURL_ERROR_SIZE];</div>
|
|
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>  <span class="keywordtype">string</span> _curl_buffer_headers;</div>
|
|
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  <span class="keywordtype">string</span> _curl_buffer_body;</div>
|
|
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>  <span class="keywordtype">bool</span> _stream_cancelled;</div>
|
|
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  </div>
|
|
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  <span class="keywordtype">size_t</span> writer_body(<span class="keywordtype">char</span> *data, <span class="keywordtype">size_t</span> size, <span class="keywordtype">size_t</span> nmemb);</div>
|
|
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  </div>
|
|
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>  <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">size_t</span> writer_body_wrapper(<span class="keywordtype">char</span> *data, <span class="keywordtype">size_t</span> sz,</div>
|
|
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>  <span class="keywordtype">size_t</span> nmemb, <span class="keywordtype">void</span> *f)</div>
|
|
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>  {</div>
|
|
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>  <span class="keywordflow">return</span> static_cast<CURLWrapper*>(f)->writer_body(data, sz, nmemb);</div>
|
|
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>  }</div>
|
|
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  </div>
|
|
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>  <span class="keywordtype">size_t</span> writer_header(<span class="keywordtype">char</span> *data, <span class="keywordtype">size_t</span> size, <span class="keywordtype">size_t</span> nmemb);</div>
|
|
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>  </div>
|
|
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">size_t</span> writer_header_wrapper(<span class="keywordtype">char</span> *data, <span class="keywordtype">size_t</span> sz,</div>
|
|
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>  <span class="keywordtype">size_t</span> nmemb, <span class="keywordtype">void</span> *f)</div>
|
|
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  {</div>
|
|
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  <span class="keywordflow">return</span> static_cast<CURLWrapper*>(f)->writer_header(data, sz, nmemb);</div>
|
|
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  }</div>
|
|
<div class="line"><a name="l00286"></a><span class="lineno"> 286</span>  </div>
|
|
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>  <span class="keywordtype">int</span> progress(<span class="keywordtype">void</span> *clientp, curl_off_t dltotal, curl_off_t dlnow,</div>
|
|
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  curl_off_t ultotal, curl_off_t ulnow);</div>
|
|
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>  </div>
|
|
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>  <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> progress_wrapper(<span class="keywordtype">void</span> *f, <span class="keywordtype">void</span> *clientp,</div>
|
|
<div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  curl_off_t dltotal, curl_off_t dlnow,</div>
|
|
<div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  curl_off_t ultotal, curl_off_t ulnow)</div>
|
|
<div class="line"><a name="l00301"></a><span class="lineno"> 301</span>  {</div>
|
|
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  <span class="keywordflow">return</span> static_cast<CURLWrapper*>(f)->progress(clientp, dltotal, dlnow,</div>
|
|
<div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  ultotal, ulnow);</div>
|
|
<div class="line"><a name="l00304"></a><span class="lineno"> 304</span>  }</div>
|
|
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>  </div>
|
|
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>  <span class="keywordtype">void</span> setup_curl();</div>
|
|
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>  </div>
|
|
<div class="line"><a name="l00323"></a><span class="lineno"> 323</span>  <span class="keywordtype">bool</span> replace_parameter_in_uri(<span class="keywordtype">string</span> &uri, <span class="keyword">const</span> <a class="code" href="namespacemastodonpp.html#a63b360bdefd56276e903619eb6a76049">parameterpair</a> &parameter);</div>
|
|
<div class="line"><a name="l00324"></a><span class="lineno"> 324</span>  </div>
|
|
<div class="line"><a name="l00333"></a><span class="lineno"> 333</span>  <span class="keywordtype">void</span> add_parameters_to_uri(<span class="keywordtype">string</span> &uri, <span class="keyword">const</span> <a class="code" href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6">parametermap</a> &parameters);</div>
|
|
<div class="line"><a name="l00334"></a><span class="lineno"> 334</span>  </div>
|
|
<div class="line"><a name="l00344"></a><span class="lineno"> 344</span>  <span class="keywordtype">void</span> add_mime_part(curl_mime *mime,</div>
|
|
<div class="line"><a name="l00345"></a><span class="lineno"> 345</span>  string_view name, string_view data) <span class="keyword">const</span>;</div>
|
|
<div class="line"><a name="l00346"></a><span class="lineno"> 346</span>  </div>
|
|
<div class="line"><a name="l00361"></a><span class="lineno"> 361</span>  curl_mime *parameters_to_curl_mime(<span class="keywordtype">string</span> &uri,</div>
|
|
<div class="line"><a name="l00362"></a><span class="lineno"> 362</span>  <span class="keyword">const</span> <a class="code" href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6">parametermap</a> &parameters);</div>
|
|
<div class="line"><a name="l00363"></a><span class="lineno"> 363</span> };</div>
|
|
<div class="line"><a name="l00364"></a><span class="lineno"> 364</span>  </div>
|
|
<div class="line"><a name="l00365"></a><span class="lineno"> 365</span> } <span class="comment">// namespace mastodonpp</span></div>
|
|
<div class="line"><a name="l00366"></a><span class="lineno"> 366</span>  </div>
|
|
<div class="line"><a name="l00367"></a><span class="lineno"> 367</span> <span class="preprocessor">#endif // MASTODONPP_CURL_WRAPPER_HPP</span></div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
<div class="ttc" id="anamespacemastodonpp_html_a7d60fc71ad0fb1fbd467b37fe1f1f100"><div class="ttname"><a href="namespacemastodonpp.html#a7d60fc71ad0fb1fbd467b37fe1f1f100">mastodonpp::http_method</a></div><div class="ttdeci">http_method</div><div class="ttdoc">The HTTP method.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.hpp:40</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_a736572303fbec7a307514e611e6a468c"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#a736572303fbec7a307514e611e6a468c">mastodonpp::CURLWrapper::CURLWrapper</a></div><div class="ttdeci">CURLWrapper()</div><div class="ttdoc">Initializes curl and sets up connection.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.cpp:41</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_a2b7aaf03245a0730eeb464802168aded"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#a2b7aaf03245a0730eeb464802168aded">mastodonpp::CURLWrapper::get_curl_easy_handle</a></div><div class="ttdeci">CURL * get_curl_easy_handle()</div><div class="ttdoc">Returns pointer to the CURL easy handle.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.hpp:105</div></div>
|
|
<div class="ttc" id="anamespacemastodonpp_html_af8b3b89118adeccc71c54dfd36c987f6"><div class="ttname"><a href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6">mastodonpp::parametermap</a></div><div class="ttdeci">map< string_view, variant< string_view, vector< string_view > >> parametermap</div><div class="ttdoc">std::map of parameters for API calls.</div><div class="ttdef"><b>Definition:</b> types.hpp:64</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_aed6d09b5c32d71276a851ddf321b5891"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#aed6d09b5c32d71276a851ddf321b5891">mastodonpp::CURLWrapper::unescape_url</a></div><div class="ttdeci">string unescape_url(const string_view url) const</div><div class="ttdoc">URL decodes the given string .</div><div class="ttdef"><b>Definition:</b> curl_wrapper.hpp:145</div></div>
|
|
<div class="ttc" id="anamespacemastodonpp_html"><div class="ttname"><a href="namespacemastodonpp.html">mastodonpp</a></div><div class="ttdoc">C++ wrapper for the Mastodon API.</div><div class="ttdef"><b>Definition:</b> api.cpp:19</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_aeb3171d955832b8062dc02b4ac67d195"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#aeb3171d955832b8062dc02b4ac67d195">mastodonpp::CURLWrapper::buffer_mutex</a></div><div class="ttdeci">mutex buffer_mutex</div><div class="ttdoc">Mutex for get_buffer a.k.a. _curl_buffer_body.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.hpp:175</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_a04b3919cfb38716c5a032337e442db95"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#a04b3919cfb38716c5a032337e442db95">mastodonpp::CURLWrapper::get_buffer</a></div><div class="ttdeci">string & get_buffer()</div><div class="ttdoc">Returns a reference to the buffer libcurl writes into.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.hpp:196</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_a1564a42794ef7a9d170b725063ef504d"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#a1564a42794ef7a9d170b725063ef504d">mastodonpp::CURLWrapper::set_proxy</a></div><div class="ttdeci">void set_proxy(string_view proxy)</div><div class="ttdoc">Set the proxy to use.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.cpp:216</div></div>
|
|
<div class="ttc" id="astructmastodonpp_1_1answer__type_html"><div class="ttname"><a href="structmastodonpp_1_1answer__type.html">mastodonpp::answer_type</a></div><div class="ttdoc">Return type for Requests.</div><div class="ttdef"><b>Definition:</b> types.hpp:79</div></div>
|
|
<div class="ttc" id="anamespacemastodonpp_html_a63b360bdefd56276e903619eb6a76049"><div class="ttname"><a href="namespacemastodonpp.html#a63b360bdefd56276e903619eb6a76049">mastodonpp::parameterpair</a></div><div class="ttdeci">pair< string_view, variant< string_view, vector< string_view > >> parameterpair</div><div class="ttdoc">A single parameter of a parametermap.</div><div class="ttdef"><b>Definition:</b> types.hpp:72</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_af3f2bd4dea7c289d590fe19889360444"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#af3f2bd4dea7c289d590fe19889360444">mastodonpp::CURLWrapper::set_cainfo</a></div><div class="ttdeci">void set_cainfo(string_view path)</div><div class="ttdoc">Set path to Certificate Authority (CA) bundle.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.cpp:253</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_a5f29b7f4d0b58f70bc96f362cdaa4d0a"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#a5f29b7f4d0b58f70bc96f362cdaa4d0a">mastodonpp::CURLWrapper::operator=</a></div><div class="ttdeci">CURLWrapper & operator=(const CURLWrapper &other)=delete</div><div class="ttdoc">Copy assignment operator.</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_ae3b1445f9b94b1f7677d3cac6d538612"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#ae3b1445f9b94b1f7677d3cac6d538612">mastodonpp::CURLWrapper::set_useragent</a></div><div class="ttdeci">void set_useragent(string_view useragent)</div><div class="ttdoc">Sets the User-Agent.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.cpp:263</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html">mastodonpp::CURLWrapper</a></div><div class="ttdoc">Handles the details of network connections.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.hpp:58</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_adc8808c3fad5397176f6755b09ee0be6"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#adc8808c3fad5397176f6755b09ee0be6">mastodonpp::CURLWrapper::make_request</a></div><div class="ttdeci">answer_type make_request(const http_method &method, string uri, const parametermap &parameters)</div><div class="ttdoc">Make a HTTP request.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.cpp:67</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_a350f7061c9cb54cb5992ae983db3fc19"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#a350f7061c9cb54cb5992ae983db3fc19">mastodonpp::CURLWrapper::~CURLWrapper</a></div><div class="ttdeci">virtual ~CURLWrapper() noexcept</div><div class="ttdoc">Cleans up curl and connection.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.cpp:55</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_a892a4fc3d048798fa8e2584545b91861"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#a892a4fc3d048798fa8e2584545b91861">mastodonpp::CURLWrapper::cancel_stream</a></div><div class="ttdeci">void cancel_stream()</div><div class="ttdoc">Cancel the stream.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.hpp:210</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_a11a543a0821a275dfce1ad7a0e68b17f"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#a11a543a0821a275dfce1ad7a0e68b17f">mastodonpp::CURLWrapper::escape_url</a></div><div class="ttdeci">string escape_url(const string_view url) const</div><div class="ttdoc">URL encodes the given string.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.hpp:123</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_a94aba6daedea376ccc20e5c983bd3358"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#a94aba6daedea376ccc20e5c983bd3358">mastodonpp::CURLWrapper::set_access_token</a></div><div class="ttdeci">void set_access_token(string_view access_token)</div><div class="ttdoc">Set OAuth 2.0 Bearer Access Token.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.cpp:227</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_a0059ecb78b53c4b3c941b19f8dc897f7"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#a0059ecb78b53c4b3c941b19f8dc897f7">mastodonpp::CURLWrapper::setup_connection_properties</a></div><div class="ttdeci">void setup_connection_properties(string_view proxy, string_view access_token, string_view cainfo, string_view useragent)</div><div class="ttdoc">Set some properties of the connection.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.cpp:190</div></div>
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.16
|
|
</small></address>
|
|
</body>
|
|
</html>
|