Remote Call Framework 3.4
Globals.hpp
Go to the documentation of this file.
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2023, Delta V Software. All rights reserved.
6 // https://www.deltavsoft.com
7 //
8 // RCF is distributed under dual licenses - closed source or GPL.
9 // Consult your particular license for conditions of use.
10 //
11 // If you have not purchased a commercial license, you are using RCF under GPL terms.
12 //
13 // Version: 3.4
14 // Contact: support <at> deltavsoft.com
15 //
16 //******************************************************************************
17 
19 
20 #ifndef INCLUDE_RCF_GLOBALS_HPP
21 #define INCLUDE_RCF_GLOBALS_HPP
22 
23 #include <functional>
24 #include <string>
25 
26 #include <RCF/Enums.hpp>
27 #include <RCF/Export.hpp>
28 
29 namespace RCF {
30 
31  class ZlibDll;
32  class OpenSslDll;
33  class OpenSslCryptoDll;
34  class RcfSession;
35  class Exception;
36 
37  enum SslImplementation;
38 
40  class RCF_EXPORT Globals
41  {
42 
43  public:
44  Globals();
45  ~Globals();
46 
48  void setDefaultSslImplementation(SslImplementation sslImplementation);
49 
51  SslImplementation getDefaultSslImplementation();
52 
54  void setDefaultConnectTimeoutMs(unsigned int connectTimeoutMs);
55 
57  unsigned int getDefaultConnectTimeoutMs();
58 
60  void setDefaultRemoteCallTimeoutMs(unsigned int remoteCallTimeoutMs);
61 
63  unsigned int getDefaultRemoteCallTimeoutMs();
64 
66  void setZlibDllName(const std::string & dllName);
67 
69  std::string getZlibDllName() const;
70 
72  void setOpenSslDllName(const std::string & dllName);
73 
75  std::string getOpenSslDllName() const;
76 
78  void setOpenSslCryptoDllName(const std::string & dllName);
79 
81  std::string getOpenSslCryptoDllName() const;
82 
83  // Sets the simultaneous publish limit.
84  // The publishing service issues messages asynchronously across all subscriber connections, and this setting controls how many asynchronous writes it can perform concurrently.
85  void setSimultaneousPublishLimit(std::size_t simultaneousPublishLimit);
86 
87  // Gets the simultaneous publish limit.
88  std::size_t getSimultaneousPublishLimit() const;
89 
90  // Default download directory for FileStream objects (deprecated).
91  void setFileStreamDefaultDownloadDirectory(const std::string & downloadDirectory);
92  std::string getFileStreamDefaultDownloadDirectory();
93 
94 
95  ZlibDll & getZlibDll();
96  OpenSslDll & getOpenSslDll();
97  OpenSslCryptoDll & getOpenSslCryptoDll();
98 
99  typedef std::function<
100  void(
101  const char * szFile,
102  int line,
103  const char * szFunc,
104  const Exception & e)> OnExceptionCallback;
105 
106  void setOnExceptionCallback(OnExceptionCallback cb);
107  OnExceptionCallback getOnExceptionCallback();
108 
109  private:
110 
111  void releaseZlibDll();
112  void releaseOpenSslDll();
113  void releaseOpenSslCryptoDll();
114 
115  ZlibDll * mpZlibDll;
116  OpenSslDll * mpOpenSslDll;
117  OpenSslCryptoDll * mpOpenSslCryptoDll;
118 
119  std::string mZlibDllName;
120  std::string mOpenSslDllName;
121  std::string mOpenSslCryptoDllName;
122 
123  std::size_t mSimultaneousPublishLimit;
124 
125  std::string mFileStreamDefaultDownloadDirectory;
126 
127 #if defined(RCF_WINDOWS) && RCF_FEATURE_OPENSSL==0
128  // Windows builds without OpenSSL.
129  SslImplementation mDefaultSslImplementation = Si_Schannel;
130 #else
131  // All other builds.
132  SslImplementation mDefaultSslImplementation = Si_OpenSsl;
133 #endif
134 
135  unsigned int mClientConnectTimeoutMs = 1000 * 2;
136  unsigned int mClientRemoteCallTimeoutMs = 1000 * 10;
137 
138  OnExceptionCallback mOnExceptionCallback;
139  };
140 
143 
145  RCF_EXPORT Globals & globals();
146 
148 
149 } // namespace RCF
150 
151 #endif // ! INCLUDE_RCF_GLOBALS_HPP
RCF_EXPORT Globals & globals()
Exposes RCF global settings.
OpenSSL.
Definition: Enums.hpp:90
Base class for all RCF exceptions.
Definition: Exception.hpp:67
SslImplementation
Describes which SSL implementation to use.
Definition: Enums.hpp:84
Contains global RCF settings.
Definition: Globals.hpp:40
Definition: AmiIoHandler.hpp:23
Schannel.
Definition: Enums.hpp:87