GpgFrontend-Doxygen/docs/html/GpgContext_8h_source.html

193 lines
19 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.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>GpgFrontend Project: src/core/GpgContext.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="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>
<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">GpgFrontend Project
</div>
<div id="projectbrief">A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<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','.html');
/* @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>
</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&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('GpgContext_8h_source.html',''); initResizable(); });
/* @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">GpgContext.h</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160; </div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;<span class="preprocessor">#ifndef __SGPGMEPP_CONTEXT_H__</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;<span class="preprocessor">#define __SGPGMEPP_CONTEXT_H__</span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; </div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;<span class="preprocessor">#include &lt;optional&gt;</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160; </div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;<span class="preprocessor">#include &quot;GpgConstants.h&quot;</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;<span class="preprocessor">#include &quot;GpgFunctionObject.h&quot;</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;<span class="preprocessor">#include &quot;GpgInfo.h&quot;</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;<span class="preprocessor">#include &quot;GpgModel.h&quot;</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="namespaceGpgFrontend.html">GpgFrontend</a> {</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; </div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="structGpgFrontend_1_1GpgContextInitArgs.html"> 46</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structGpgFrontend_1_1GpgContextInitArgs.html">GpgContextInitArgs</a> {</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; <span class="comment">// make no sense for gpg2</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; <span class="keywordtype">bool</span> independent_database = <span class="keyword">false</span>; </div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; std::string db_path = {};</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; <span class="keywordtype">bool</span> gpg_alone = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; std::string gpg_path = {};</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; <span class="keywordtype">bool</span> test_mode = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; <span class="keywordtype">bool</span> ascii = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; <span class="keywordtype">bool</span> offline_mode = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; <span class="keywordtype">bool</span> auto_import_missing_key = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; </div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; <a class="code" href="structGpgFrontend_1_1GpgContextInitArgs.html">GpgContextInitArgs</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;};</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; </div>
<div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1GpgContext.html"> 64</a></span>&#160;<span class="keyword">class </span>GPGFRONTEND_CORE_EXPORT <a class="code" href="classGpgFrontend_1_1GpgContext.html">GpgContext</a></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; : <span class="keyword">public</span> QObject,</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; <span class="keyword">public</span> <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html">SingletonFunctionObject</a>&lt;GpgContext&gt; {</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; Q_OBJECT</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; <span class="keyword">explicit</span> <a class="code" href="classGpgFrontend_1_1GpgContext.html">GpgContext</a>(<span class="keyword">const</span> <a class="code" href="structGpgFrontend_1_1GpgContextInitArgs.html">GpgContextInitArgs</a>&amp; args = {});</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; </div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; <span class="keyword">explicit</span> <a class="code" href="classGpgFrontend_1_1GpgContext.html">GpgContext</a>(<span class="keywordtype">int</span> channel);</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; </div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1GpgContext.html#ae89dee551354c1541337881898832725"> 87</a></span>&#160; <a class="code" href="classGpgFrontend_1_1GpgContext.html#ae89dee551354c1541337881898832725">~GpgContext</a>() <span class="keyword">override</span> = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; </div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; [[nodiscard]] <span class="keywordtype">bool</span> good() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; </div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; [[nodiscard]] <span class="keyword">const</span> <a class="code" href="classGpgFrontend_1_1GpgInfo.html">GpgInfo</a>&amp; GetInfo(<span class="keywordtype">bool</span> refresh = <span class="keyword">false</span>);</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; </div>
<div class="line"><a name="l00109"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1GpgContext.html#a5b419175bd9927f3d449637db8ba6524"> 109</a></span>&#160; <span class="keyword">operator</span> gpgme_ctx_t()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _ctx_ref.get(); }</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; </div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; <a class="code" href="classGpgFrontend_1_1GpgInfo.html">GpgInfo</a> info_{}; </div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; GpgContextInitArgs args_{}; </div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; <span class="keywordtype">bool</span> extend_info_loaded_ = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; std::shared_mutex preload_lock_{};</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; </div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; <span class="keywordtype">void</span> post_init_ctx();</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; </div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; std::string need_user_input_passphrase();</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; </div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160; std::optional&lt;std::string&gt; check_binary_chacksum(std::filesystem::path);</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160; </div>
<div class="line"><a name="l00140"></a><span class="lineno"><a class="line" href="structGpgFrontend_1_1GpgContext_1_1__ctx__ref__deleter.html"> 140</a></span>&#160; <span class="keyword">struct </span><a class="code" href="structGpgFrontend_1_1GpgContext_1_1__ctx__ref__deleter.html">_ctx_ref_deleter</a> {</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; <span class="keywordtype">void</span> operator()(gpgme_ctx_t _ctx);</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; };</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; </div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; <span class="keyword">using</span> CtxRefHandler =</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; std::unique_ptr&lt;struct gpgme_context, _ctx_ref_deleter&gt;; </div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; CtxRefHandler _ctx_ref = <span class="keyword">nullptr</span>; </div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; <span class="keywordtype">bool</span> good_ = <span class="keyword">true</span>; </div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; </div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; signals:</div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160; <span class="keywordtype">void</span> SignalNeedUserInputPassphrase();</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; </div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160; <span class="keyword">static</span> gpgme_error_t test_passphrase_cb(<span class="keywordtype">void</span>* opaque, <span class="keyword">const</span> <span class="keywordtype">char</span>* uid_hint,</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* passphrase_info,</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160; <span class="keywordtype">int</span> last_was_bad, <span class="keywordtype">int</span> fd);</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; </div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160; <span class="keyword">static</span> gpgme_error_t custom_passphrase_cb(<span class="keywordtype">void</span>* opaque, <span class="keyword">const</span> <span class="keywordtype">char</span>* uid_hint,</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* passphrase_info,</div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160; <span class="keywordtype">int</span> last_was_bad, <span class="keywordtype">int</span> fd);</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160; </div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160; <span class="keyword">static</span> gpgme_error_t test_status_cb(<span class="keywordtype">void</span>* hook, <span class="keyword">const</span> <span class="keywordtype">char</span>* keyword,</div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* args);</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160; </div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; <span class="keywordtype">void</span> SetPassphraseCb(gpgme_passphrase_cb_t func) <span class="keyword">const</span>;</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;} <span class="comment">// namespace GpgFrontend</span></div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160; </div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160;<span class="preprocessor">#endif </span><span class="comment">// __SGPGMEPP_CONTEXT_H__</span></div>
<div class="ttc" id="aclassGpgFrontend_1_1GpgContext_html"><div class="ttname"><a href="classGpgFrontend_1_1GpgContext.html">GpgFrontend::GpgContext</a></div><div class="ttdef"><b>Definition:</b> GpgContext.h:66</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1GpgContext_html_ae89dee551354c1541337881898832725"><div class="ttname"><a href="classGpgFrontend_1_1GpgContext.html#ae89dee551354c1541337881898832725">GpgFrontend::GpgContext::~GpgContext</a></div><div class="ttdeci">~GpgContext() override=default</div><div class="ttdoc">Destroy the Gpg Context object.</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1GpgInfo_html"><div class="ttname"><a href="classGpgFrontend_1_1GpgInfo.html">GpgFrontend::GpgInfo</a></div><div class="ttdoc">Use to record some info about gnupg.</div><div class="ttdef"><b>Definition:</b> GpgInfo.h:40</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonFunctionObject_html"><div class="ttname"><a href="classGpgFrontend_1_1SingletonFunctionObject.html">GpgFrontend::SingletonFunctionObject</a></div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.h:150</div></div>
<div class="ttc" id="anamespaceGpgFrontend_html"><div class="ttname"><a href="namespaceGpgFrontend.html">GpgFrontend</a></div><div class="ttdef"><b>Definition:</b> CoreCommonUtil.cpp:31</div></div>
<div class="ttc" id="astructGpgFrontend_1_1GpgContextInitArgs_html"><div class="ttname"><a href="structGpgFrontend_1_1GpgContextInitArgs.html">GpgFrontend::GpgContextInitArgs</a></div><div class="ttdef"><b>Definition:</b> GpgContext.h:46</div></div>
<div class="ttc" id="astructGpgFrontend_1_1GpgContext_1_1__ctx__ref__deleter_html"><div class="ttname"><a href="structGpgFrontend_1_1GpgContext_1_1__ctx__ref__deleter.html">GpgFrontend::GpgContext::_ctx_ref_deleter</a></div><div class="ttdef"><b>Definition:</b> GpgContext.h:140</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_aebb8dcc11953d78e620bbef0b9e2183.html">core</a></li><li class="navelem"><b>GpgContext.h</b></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
</ul>
</div>
</body>
</html>