1 | /* |
2 | gpgagentgetinfoassuantransaction.h - Assuan Transaction to get information from gpg-agent |
3 | Copyright (C) 2009 Klarälvdalens Datakonsult AB |
4 | |
5 | This file is part of GPGME++. |
6 | |
7 | GPGME++ is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU Library General Public |
9 | License as published by the Free Software Foundation; either |
10 | version 2 of the License, or (at your option) any later version. |
11 | |
12 | GPGME++ is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU Library General Public License for more details. |
16 | |
17 | You should have received a copy of the GNU Library General Public License |
18 | along with GPGME++; see the file COPYING.LIB. If not, write to the |
19 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 | Boston, MA 02110-1301, USA. |
21 | */ |
22 | |
23 | #ifndef __GPGMEPP_GPGAGENTGETINFOASSUANTRANSACTION_H__ |
24 | #define __GPGMEPP_GPGAGENTGETINFOASSUANTRANSACTION_H__ |
25 | |
26 | #include <gpgme++/interfaces/assuantransaction.h> |
27 | |
28 | #include <string> |
29 | #include <vector> |
30 | |
31 | namespace GpgME { |
32 | |
33 | class GPGMEPP_EXPORT GpgAgentGetInfoAssuanTransaction : public AssuanTransaction { |
34 | public: |
35 | enum InfoItem { |
36 | Version, // string |
37 | Pid, // unsigned long |
38 | SocketName, // string (path) |
39 | SshSocketName, // string (path) |
40 | ScdRunning, // (none, returns GPG_ERR_GENERAL when scdaemon isn't running) |
41 | //CommandHasOption, // not supported |
42 | |
43 | LastInfoItem |
44 | }; |
45 | |
46 | explicit GpgAgentGetInfoAssuanTransaction( InfoItem item ); |
47 | ~GpgAgentGetInfoAssuanTransaction(); |
48 | |
49 | std::string version() const; |
50 | unsigned int pid() const; |
51 | std::string socketName() const; |
52 | std::string sshSocketName() const; |
53 | |
54 | private: |
55 | /* reimp */ const char * command() const; |
56 | /* reimp */ Error data( const char * data, size_t datalen ); |
57 | /* reimp */ Data inquire( const char * name, const char * args, Error & err ); |
58 | /* reimp */ Error status( const char * status, const char * args ); |
59 | |
60 | private: |
61 | void makeCommand() const; |
62 | |
63 | private: |
64 | InfoItem m_item; |
65 | mutable std::string m_command; |
66 | std::string m_data; |
67 | }; |
68 | |
69 | } // namespace GpgME |
70 | |
71 | #endif // __GPGMEPP_GPGAGENTGETINFOASSUANTRANSACTION_H__ |
72 | |