1 | /* |
2 | scdgetinfoassuantransaction.h - Assuan Transaction to get information from scdaemon |
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_SCDGETINFOASSUANTRANSACTION_H__ |
24 | #define __GPGMEPP_SCDGETINFOASSUANTRANSACTION_H__ |
25 | |
26 | #include <gpgme++/interfaces/assuantransaction.h> |
27 | |
28 | #include <string> |
29 | #include <vector> |
30 | |
31 | namespace GpgME { |
32 | |
33 | class GPGMEPP_EXPORT ScdGetInfoAssuanTransaction : public AssuanTransaction { |
34 | public: |
35 | enum InfoItem { |
36 | Version, // string |
37 | Pid, // unsigned long |
38 | SocketName, // string (path) |
39 | Status, // char (status) |
40 | ReaderList, // string list |
41 | DenyAdmin, // (none, returns GPG_ERR_GENERAL when admin commands are allowed) |
42 | ApplicationList, // string list |
43 | |
44 | LastInfoItem |
45 | }; |
46 | |
47 | explicit ScdGetInfoAssuanTransaction( InfoItem item ); |
48 | ~ScdGetInfoAssuanTransaction(); |
49 | |
50 | std::string version() const; |
51 | unsigned int pid() const; |
52 | std::string socketName() const; |
53 | char status() const; |
54 | std::vector<std::string> readerList() const; |
55 | std::vector<std::string> applicationList() const; |
56 | |
57 | private: |
58 | /* reimp */ const char * command() const; |
59 | /* reimp */ Error data( const char * data, size_t datalen ); |
60 | /* reimp */ Data inquire( const char * name, const char * args, Error & err ); |
61 | /* reimp */ Error status( const char * status, const char * args ); |
62 | |
63 | private: |
64 | void makeCommand() const; |
65 | |
66 | private: |
67 | InfoItem m_item; |
68 | mutable std::string m_command; |
69 | std::string m_data; |
70 | }; |
71 | |
72 | } // namespace GpgME |
73 | |
74 | #endif // __GPGMEPP_SCDGETINFOASSUANTRANSACTION_H__ |
75 | |