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 <dev@ingo-kloecker.de>
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 <string>
17 #include <vector>
18 
19 namespace GpgME
20 {
21 class AssuanTransaction;
22 class Context;
23 class DefaultAssuanTransaction;
24 class Error;
25 }
26 
27 namespace Kleo
28 {
29 /** The Assuan namespace collects functions for communicating with the GnuPG
30  * agent via the Assuan protocol. */
31 namespace Assuan
32 {
33 
34 /** Checks if the GnuPG agent is running and accepts connections. */
35 KLEO_EXPORT bool agentIsRunning();
36 
37 /** Sends the Assuan @p command using the @p transaction and the @p assuanContext
38  * to the GnuPG agent and waits for the result. The returned transaction can be used
39  * to retrieve the result.
40  * If an error occurred, then @p err provides details. */
41 KLEO_EXPORT std::unique_ptr<GpgME::AssuanTransaction> sendCommand(std::shared_ptr<GpgME::Context> &assuanContext,
42  const std::string &command,
43  std::unique_ptr<GpgME::AssuanTransaction> transaction,
44  GpgME::Error &err);
45 
46 /** Sends the Assuan @p command using a default Assuan transaction and the @p assuanContext
47  * to the GnuPG agent and waits for the result. The returned transaction can be used
48  * to retrieve the result.
49  * If an error occurred, then @p err provides details. */
50 KLEO_EXPORT std::unique_ptr<GpgME::DefaultAssuanTransaction>
51 sendCommand(std::shared_ptr<GpgME::Context> &assuanContext, const std::string &command, GpgME::Error &err);
52 
53 /** Sends the Assuan @p command using a default Assuan transaction and the @p assuanContext
54  * to the GnuPG agent and waits for the result. Returns the data that was sent by
55  * GnuPG agent in response to the @p command.
56  * If an error occurred, then @p err provides details. */
57 KLEO_EXPORT std::string sendDataCommand(std::shared_ptr<GpgME::Context> assuanContext, const std::string &command, GpgME::Error &err);
58 
59 /** Sends the Assuan @p command using a default Assuan transaction and the @p assuanContext
60  * to the GnuPG agent and waits for the result. Returns the status lines that were sent by
61  * GnuPG agent in response to the @p command.
62  * If an error occurred, then @p err provides details. */
63 KLEO_EXPORT std::vector<std::pair<std::string, std::string>>
64 sendStatusLinesCommand(std::shared_ptr<GpgME::Context> assuanContext, const std::string &command, GpgME::Error &err);
65 
66 /** Sends the Assuan @p command using a default Assuan transaction and the @p assuanContext
67  * to the GnuPG agent and waits for the result. Returns the status that was sent by
68  * GnuPG agent in response to the @p command.
69  * If an error occurred, then @p err provides details. */
70 KLEO_EXPORT std::string sendStatusCommand(const std::shared_ptr<GpgME::Context> &assuanContext, const std::string &command, GpgME::Error &err);
71 
72 }
73 }
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:49
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:69
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Thu Feb 15 2024 03:56:13 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.