186 lines
20 KiB
HTML
186 lines
20 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.17"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>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.8.17 -->
|
|
<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('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>  </div>
|
|
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor">#ifndef __SGPGMEPP_CONTEXT_H__</span></div>
|
|
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor">#define __SGPGMEPP_CONTEXT_H__</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> <span class="preprocessor">#include "GpgConstants.h"</span></div>
|
|
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="preprocessor">#include "GpgFunctionObject.h"</span></div>
|
|
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="preprocessor">#include "GpgInfo.h"</span></div>
|
|
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span> <span class="preprocessor">#include "GpgModel.h"</span></div>
|
|
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  </div>
|
|
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span> <span class="keyword">namespace </span><a class="code" href="namespaceGpgFrontend.html">GpgFrontend</a> {</div>
|
|
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  </div>
|
|
<div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="structGpgFrontend_1_1GpgContextInitArgs.html"> 43</a></span> <span class="keyword">struct </span><a class="code" href="structGpgFrontend_1_1GpgContextInitArgs.html">GpgContextInitArgs</a> {</div>
|
|
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="comment">// make no sense for gpg2</span></div>
|
|
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <span class="keywordtype">bool</span> independent_database = <span class="keyword">false</span>; </div>
|
|
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  std::string db_path = {};</div>
|
|
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="keywordtype">bool</span> gpg_alone = <span class="keyword">false</span>;</div>
|
|
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  std::string gpg_path = {};</div>
|
|
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="keywordtype">bool</span> test_mode = <span class="keyword">false</span>;</div>
|
|
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="keywordtype">bool</span> ascii = <span class="keyword">true</span>;</div>
|
|
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  </div>
|
|
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <a class="code" href="structGpgFrontend_1_1GpgContextInitArgs.html">GpgContextInitArgs</a>() = <span class="keywordflow">default</span>;</div>
|
|
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span> };</div>
|
|
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  </div>
|
|
<div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1GpgContext.html"> 59</a></span> <span class="keyword">class </span>GPGFRONTEND_CORE_EXPORT <a class="code" href="classGpgFrontend_1_1GpgContext.html">GpgContext</a></div>
|
|
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  : <span class="keyword">public</span> <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html">SingletonFunctionObject</a><GpgContext> {</div>
|
|
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <span class="keyword">public</span>:</div>
|
|
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <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>& args = {});</div>
|
|
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  </div>
|
|
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <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="l00075"></a><span class="lineno"> 75</span>  </div>
|
|
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  ~<a class="code" href="classGpgFrontend_1_1GpgContext.html">GpgContext</a>() <span class="keyword">override</span> = <span class="keywordflow">default</span>;</div>
|
|
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  </div>
|
|
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  [[nodiscard]] <span class="keywordtype">bool</span> good() <span class="keyword">const</span>;</div>
|
|
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  </div>
|
|
<div class="line"><a name="l00095"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1GpgContext.html#ad9af3461de36f74ee85be2523f6038e2"> 95</a></span>  [[nodiscard]] <span class="keyword">const</span> <a class="code" href="classGpgFrontend_1_1GpgInfo.html">GpgInfo</a>& <a class="code" href="classGpgFrontend_1_1GpgContext.html#ad9af3461de36f74ee85be2523f6038e2">GetInfo</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> info_; }</div>
|
|
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  </div>
|
|
<div class="line"><a name="l00102"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1GpgContext.html#a5b419175bd9927f3d449637db8ba6524"> 102</a></span>  <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="l00103"></a><span class="lineno"> 103</span>  </div>
|
|
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  <span class="keyword">private</span>:</div>
|
|
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <a class="code" href="classGpgFrontend_1_1GpgInfo.html">GpgInfo</a> info_; </div>
|
|
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <a class="code" href="structGpgFrontend_1_1GpgContextInitArgs.html">GpgContextInitArgs</a> args_; </div>
|
|
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  </div>
|
|
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  <span class="keywordtype">void</span> init_ctx();</div>
|
|
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  </div>
|
|
<div class="line"><a name="l00118"></a><span class="lineno"><a class="line" href="structGpgFrontend_1_1GpgContext_1_1__ctx__ref__deleter.html"> 118</a></span>  <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="l00119"></a><span class="lineno"> 119</span>  <span class="keywordtype">void</span> operator()(gpgme_ctx_t _ctx) {</div>
|
|
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <span class="keywordflow">if</span> (_ctx != <span class="keyword">nullptr</span>) gpgme_release(_ctx);</div>
|
|
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  }</div>
|
|
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  };</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="keyword">using</span> CtxRefHandler =</div>
|
|
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  std::unique_ptr<struct gpgme_context, _ctx_ref_deleter>; </div>
|
|
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  CtxRefHandler _ctx_ref = <span class="keyword">nullptr</span>; </div>
|
|
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="keywordtype">bool</span> good_ = <span class="keyword">true</span>; </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>  <span class="keyword">public</span>:</div>
|
|
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  <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="l00141"></a><span class="lineno"> 141</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* passphrase_info,</div>
|
|
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  <span class="keywordtype">int</span> last_was_bad, <span class="keywordtype">int</span> fd);</div>
|
|
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  </div>
|
|
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <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="l00153"></a><span class="lineno"> 153</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* args);</div>
|
|
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  </div>
|
|
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  <span class="keywordtype">void</span> SetPassphraseCb(gpgme_passphrase_cb_t func) <span class="keyword">const</span>;</div>
|
|
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span> };</div>
|
|
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span> } <span class="comment">// namespace GpgFrontend</span></div>
|
|
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  </div>
|
|
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span> <span class="preprocessor">#endif // __SGPGMEPP_CONTEXT_H__</span></div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
<div class="ttc" id="aclassGpgFrontend_1_1GpgContext_html_a3377fd6a325aafc18c119431f602db9b"><div class="ttname"><a href="classGpgFrontend_1_1GpgContext.html#a3377fd6a325aafc18c119431f602db9b">GpgFrontend::GpgContext::init_ctx</a></div><div class="ttdeci">void init_ctx()</div><div class="ttdef"><b>Definition:</b> GpgContext.cpp:145</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:49</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:29</div></div>
|
|
<div class="ttc" id="aclassGpgFrontend_1_1GpgInfo_html_a2416ae0ab9bedc61782d16075750a9c0"><div class="ttname"><a href="classGpgFrontend_1_1GpgInfo.html#a2416ae0ab9bedc61782d16075750a9c0">GpgFrontend::GpgInfo::AppPath</a></div><div class="ttdeci">std::string AppPath</div><div class="ttdoc">executable binary path of gnupg</div><div class="ttdef"><b>Definition:</b> GpgInfo.h:41</div></div>
|
|
<div class="ttc" id="anamespaceGpgFrontend_html_afdad4e5f4c3ac891c09216e245c0f48e"><div class="ttname"><a href="namespaceGpgFrontend.html#afdad4e5f4c3ac891c09216e245c0f48e">GpgFrontend::check_gpg_error</a></div><div class="ttdeci">GPGFRONTEND_CORE_EXPORT GpgError check_gpg_error(GpgError err)</div><div class="ttdef"><b>Definition:</b> GpgConstants.cpp:55</div></div>
|
|
<div class="ttc" id="aclassGpgFrontend_1_1GpgContext_html_ad9af3461de36f74ee85be2523f6038e2"><div class="ttname"><a href="classGpgFrontend_1_1GpgContext.html#ad9af3461de36f74ee85be2523f6038e2">GpgFrontend::GpgContext::GetInfo</a></div><div class="ttdeci">const GpgInfo & GetInfo() const</div><div class="ttdoc">Get the Info object.</div><div class="ttdef"><b>Definition:</b> GpgContext.h:95</div></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:59</div></div>
|
|
<div class="ttc" id="aclassGpgFrontend_1_1GpgContext_html_a3399fc60086ff5010a089bff48bbc63c"><div class="ttname"><a href="classGpgFrontend_1_1GpgContext.html#a3399fc60086ff5010a089bff48bbc63c">GpgFrontend::GpgContext::SetPassphraseCb</a></div><div class="ttdeci">void SetPassphraseCb(gpgme_passphrase_cb_t func) const</div><div class="ttdoc">Set the Passphrase Cb object.</div><div class="ttdef"><b>Definition:</b> GpgContext.cpp:193</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:39</div></div>
|
|
<div class="ttc" id="aclassGpgFrontend_1_1GpgContext_html_a39882b323569987592231f722a2ef147"><div class="ttname"><a href="classGpgFrontend_1_1GpgContext.html#a39882b323569987592231f722a2ef147">GpgFrontend::GpgContext::GpgContext</a></div><div class="ttdeci">GpgContext(const GpgContextInitArgs &args={})</div><div class="ttdoc">Construct a new Gpg Context object.</div><div class="ttdef"><b>Definition:</b> GpgContext.cpp:53</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:118</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:43</div></div>
|
|
<div class="ttc" id="anamespaceGpgFrontend_html_a4edac6df92596ba8eea3a8cdc1173684"><div class="ttname"><a href="namespaceGpgFrontend.html#a4edac6df92596ba8eea3a8cdc1173684">GpgFrontend::check_gpg_error_2_err_code</a></div><div class="ttdeci">GPGFRONTEND_CORE_EXPORT gpg_err_code_t check_gpg_error_2_err_code(gpgme_error_t err, gpgme_error_t predict=GPG_ERR_NO_ERROR)</div><div class="ttdef"><b>Definition:</b> GpgConstants.cpp:64</div></div>
|
|
<div class="ttc" id="aclassGpgFrontend_1_1GpgContext_html_a3844cd0966134939e5c4be9a725e5271"><div class="ttname"><a href="classGpgFrontend_1_1GpgContext.html#a3844cd0966134939e5c4be9a725e5271">GpgFrontend::GpgContext::test_status_cb</a></div><div class="ttdeci">static gpgme_error_t test_status_cb(void *hook, const char *keyword, const char *args)</div><div class="ttdef"><b>Definition:</b> GpgContext.cpp:221</div></div>
|
|
<div class="ttc" id="aclassGpgFrontend_1_1GpgContext_html_acc4234054002065dfbc5d5261a4950d4"><div class="ttname"><a href="classGpgFrontend_1_1GpgContext.html#acc4234054002065dfbc5d5261a4950d4">GpgFrontend::GpgContext::test_passphrase_cb</a></div><div class="ttdeci">static gpgme_error_t test_passphrase_cb(void *opaque, const char *uid_hint, const char *passphrase_info, int last_was_bad, int fd)</div><div class="ttdef"><b>Definition:</b> GpgContext.cpp:204</div></div>
|
|
<div class="ttc" id="aclassGpgFrontend_1_1GpgContext_html_a73c505a2f3d39d1638dc4d9a3e13a913"><div class="ttname"><a href="classGpgFrontend_1_1GpgContext.html#a73c505a2f3d39d1638dc4d9a3e13a913">GpgFrontend::GpgContext::good</a></div><div class="ttdeci">bool good() const</div><div class="ttdef"><b>Definition:</b> GpgContext.cpp:191</div></div>
|
|
<!-- 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="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.17 </li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|