Libkleo

assuan.h
1 /*
2  utils/assuan.h
3 
4  This file is part of libkleopatra
5  SPDX-FileCopyrightText: 2021, 2022 g10 Code GmbH
6  SPDX-FileContributor: Ingo Klöcker <[email protected]>
7 
8  SPDX-License-Identifier: GPL-2.0-or-later
9 */
10 
11 #pragma once
12 
13 #include "kleo_export.h"
14 
15 #include <memory>
16 #include <vector>
17 
18 namespace GpgME
19 {
20 class AssuanTransaction;
21 class Context;
22 class DefaultAssuanTransaction;
23 class Error;
24 }
25 
26 namespace Kleo
27 {
28 /** The Assuan namespace collects functions for communicating with the GnuPG
29  * agent via the Assuan protocol. */
30 namespace Assuan
31 {
32 
33 /** Checks if the GnuPG agent is running and accepts connections. */
34 KLEO_EXPORT bool agentIsRunning();
35 
36 /** Sends the Assuan @p command using the @p transaction and the @p assuanContext
37  * to the GnuPG agent and waits for the result. The returned transaction can be used
38  * to retrieve the result.
39  * If an error occurred, then @p err provides details. */
40 KLEO_EXPORT std::unique_ptr<GpgME::AssuanTransaction> sendCommand(std::shared_ptr<GpgME::Context> &assuanContext,
41  const std::string &command,
42  std::unique_ptr<GpgME::AssuanTransaction> transaction,
43  GpgME::Error &err);
44 
45 /** Sends the Assuan @p command using a default Assuan transaction and the @p assuanContext
46  * to the GnuPG agent and waits for the result. The returned transaction can be used
47  * to retrieve the result.
48  * If an error occurred, then @p err provides details. */
49 KLEO_EXPORT std::unique_ptr<GpgME::DefaultAssuanTransaction>
50 sendCommand(std::shared_ptr<GpgME::Context> &assuanContext, const std::string &command, GpgME::Error &err);
51 
52 /** Sends the Assuan @p command using a default Assuan transaction and the @p assuanContext
53  * to the GnuPG agent and waits for the result. Returns the data that was sent by
54  * GnuPG agent in response to the @p command.
55  * If an error occurred, then @p err provides details. */
56 KLEO_EXPORT std::string sendDataCommand(std::shared_ptr<GpgME::Context> assuanContext, const std::string &command, GpgME::Error &err);
57 
58 /** Sends the Assuan @p command using a default Assuan transaction and the @p assuanContext
59  * to the GnuPG agent and waits for the result. Returns the status lines that were sent by
60  * GnuPG agent in response to the @p command.
61  * If an error occurred, then @p err provides details. */
62 KLEO_EXPORT std::vector<std::pair<std::string, std::string>>
63 sendStatusLinesCommand(std::shared_ptr<GpgME::Context> assuanContext, const std::string &command, GpgME::Error &err);
64 
65 /** Sends the Assuan @p command using a default Assuan transaction and the @p assuanContext
66  * to the GnuPG agent and waits for the result. Returns the status that was sent by
67  * GnuPG agent in response to the @p command.
68  * If an error occurred, then @p err provides details. */
69 KLEO_EXPORT std::string sendStatusCommand(const std::shared_ptr<GpgME::Context> &assuanContext, const std::string &command, GpgME::Error &err);
70 
71 }
72 }
KLEO_EXPORT std::string sendStatusCommand(const std::shared_ptr< GpgME::Context > &assuanContext, const std::string &command, GpgME::Error &err)
Sends the Assuan command using a default Assuan transaction and the assuanContext to the GnuPG agent ...
KLEO_EXPORT std::string sendDataCommand(std::shared_ptr< GpgME::Context > assuanContext, const std::string &command, GpgME::Error &err)
Sends the Assuan command using a default Assuan transaction and the assuanContext to the GnuPG agent ...
KLEO_EXPORT std::vector< std::pair< std::string, std::string > > sendStatusLinesCommand(std::shared_ptr< GpgME::Context > assuanContext, const std::string &command, GpgME::Error &err)
Sends the Assuan command using a default Assuan transaction and the assuanContext to the GnuPG agent ...
KLEO_EXPORT bool agentIsRunning()
Checks if the GnuPG agent is running and accepts connections.
Definition: assuan.cpp:56
KLEO_EXPORT std::unique_ptr< GpgME::AssuanTransaction > sendCommand(std::shared_ptr< GpgME::Context > &assuanContext, const std::string &command, std::unique_ptr< GpgME::AssuanTransaction > transaction, GpgME::Error &err)
Sends the Assuan command using the transaction and the assuanContext to the GnuPG agent and waits for...
Definition: assuan.cpp:76
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Mar 26 2023 04:16:24 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.