PdCom  5.3
Process data communication client
SecureProcess.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * vim:tw=78
3  *
4  * Copyright (C) 2021 Bjarne von Horn (vh at igh dot de).
5  *
6  * This file is part of the PdCom library.
7  *
8  * The PdCom library is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * The PdCom library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16  * License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with the PdCom library. If not, see <http://www.gnu.org/licenses/>.
20  *
21  *****************************************************************************/
22 
25 #ifndef PDCOM5_SECUREPROCESS_H
26 #define PDCOM5_SECUREPROCESS_H
27 
28 #include "pdcom5-gnutls_export.h"
29 
30 #include <memory>
31 #include <pdcom5/Process.h>
32 
33 namespace PdCom {
34 
45 class PDCOM5_GNUTLS_EXPORT SecureProcess : public Process
46 {
47  public:
48  struct PDCOM5_GNUTLS_EXPORT EncryptionDetails
49  {
50  enum Flags {
51  Default = 0,
52  } flags_;
53  std::string server_ca_, server_hostname_, client_cert_, client_key_;
54 
57  Flags flags,
58  std::string server_ca,
59  std::string hostname,
60  std::string client_cert = "",
61  std::string client_key = "") :
62  flags_(flags),
63  server_ca_(server_ca),
64  server_hostname_(hostname),
65  client_cert_(client_cert),
66  client_key_(client_key)
67  {}
69  std::string server_ca,
70  std::string hostname,
71  std::string client_cert = "",
72  std::string client_key = "") :
73  flags_(Default),
74  server_ca_(server_ca),
75  server_hostname_(hostname),
76  client_cert_(client_cert),
77  client_key_(client_key)
78  {}
79  };
80 
88  static void InitLibrary();
91  static void FinalizeLibrary();
92 
93  explicit SecureProcess(EncryptionDetails const &);
94 
98  void asyncData();
99 
105  bool handshake();
107  void bye();
108 
109  private:
110  struct PDCOM5_GNUTLS_NO_EXPORT Impl;
111 
115  void flush() override;
116 };
117 
118 } // namespace PdCom
119 
120 #endif // PDCOM5_SECUREPROCESS_H
Definition: SecureProcess.h:48
EncryptionDetails(Flags flags, std::string server_ca, std::string hostname, std::string client_cert="", std::string client_key="")
Struct which contains certificates and options.
Definition: SecureProcess.h:56
Definition: SecureProcess.h:45
Base class for PdCom protocol handler.
Definition: Process.h:86
Definition: ClientStatistics.h:31