BLPAPI C++  3.24.10
blpapi_tlsoptions.h
Go to the documentation of this file.
1 /* Copyright 2016. Bloomberg Finance L.P.
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining a copy
4  * of this software and associated documentation files (the "Software"), to
5  * deal in the Software without restriction, including without limitation the
6  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7  * sell copies of the Software, and to permit persons to whom the Software is
8  * furnished to do so, subject to the following conditions: The above
9  * copyright notice and this permission notice shall be included in all copies
10  * or substantial portions of the Software.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
18  * IN THE SOFTWARE.
19  */
20 
28 #ifndef INCLUDED_BLPAPI_TLSOPTIONS
29 #define INCLUDED_BLPAPI_TLSOPTIONS
30 
101 #ifndef INCLUDED_BLPAPI_CALL
102 #include <blpapi_call.h>
103 #endif
104 
105 #ifndef INCLUDED_BLPAPI_DEFS
106 #include <blpapi_defs.h>
107 #endif
108 
109 #ifndef INCLUDED_BLPAPI_EXCEPTION
110 #include <blpapi_exception.h>
111 #endif
112 
113 #ifndef INCLUDED_BLPAPI_TYPES
114 #include <blpapi_types.h>
115 #endif
116 
117 #include <stddef.h>
118 
119 #ifdef __cplusplus
120 extern "C" {
121 #endif
122 
125 
128  const blpapi_TlsOptions_t *parameters);
129 
132  blpapi_TlsOptions_t *lhs, const blpapi_TlsOptions_t *rhs);
133 
136 
139  const char *clientCredentialsFileName,
140  const char *clientCredentialsPassword,
141  const char *trustedCertificatesFileName);
142 
145  const char *clientCredentialsRawData,
146  int clientCredentialsRawDataLength,
147  const char *clientCredentialsPassword,
148  const char *trustedCertificatesRawData,
149  int trustedCertificatesRawDataLength);
150 
153  blpapi_TlsOptions_t *paramaters, int tlsHandshakeTimeoutMs);
154 
157  blpapi_TlsOptions_t *paramaters, int crlFetchTimeoutMs);
158 
159 #ifdef __cplusplus
160 }
161 
162 #include <cassert>
163 
171 namespace BloombergLP {
172 namespace blpapi {
173 
174 // ================
175 // class TlsOptions
176 // ================
177 
188 class TlsOptions {
189 
190  private:
191  blpapi_TlsOptions_t *d_handle_p;
192 
198  public:
199  TlsOptions();
205  TlsOptions(const TlsOptions&);
210  ~TlsOptions();
215  // MANIPULATORS
216 
217  TlsOptions& operator=(const TlsOptions& rhs);
223  static TlsOptions createFromFiles(const char *clientCredentialsFileName,
224  const char *clientCredentialsPassword,
225  const char *trustedCertificatesFileName);
232  static TlsOptions createFromBlobs(const char *clientCredentialsRawData,
233  int clientCredentialsRawDataLength,
234  const char *clientCredentialsPassword,
235  const char *trustedCertificatesRawData,
236  int trustedCertificatesRawDataLength);
243  void setTlsHandshakeTimeoutMs(int tlsHandshakeTimeoutMs);
251  void setCrlFetchTimeoutMs(int crlFetchTimeoutMs);
259  // ACCESSORS
260 
261  blpapi_TlsOptions_t *handle() const;
265 };
266 
270 // ============================================================================
271 // INLINE FUNCTION DEFINITIONS
272 // ============================================================================
273 
274 // ----------------
275 // class TlsOptions
276 // ----------------
278  : d_handle_p(handle)
279 {
280  assert(d_handle_p);
281 }
282 
284 {
285  d_handle_p = BLPAPI_CALL(blpapi_TlsOptions_create)();
286 }
287 
288 inline TlsOptions::TlsOptions(const TlsOptions& options)
289 {
290  d_handle_p = BLPAPI_CALL(blpapi_TlsOptions_duplicate)(options.handle());
291 }
292 
294 {
296 }
297 
299 {
301  return *this;
302 }
303 
305  const char *clientCredentialsFileName,
306  const char *clientCredentialsPassword,
307  const char *trustedCertificatesFileName)
308 {
310  blpapi_TlsOptions_createFromFiles)(clientCredentialsFileName,
311  clientCredentialsPassword,
312  trustedCertificatesFileName);
313  return TlsOptions(handle);
314 }
315 
317  const char *clientCredentialsRawData,
318  int clientCredentialsRawDataLength,
319  const char *clientCredentialsPassword,
320  const char *trustedCertificatesRawData,
321  int trustedCertificatesRawDataLength)
322 {
324  blpapi_TlsOptions_createFromBlobs)(clientCredentialsRawData,
325  clientCredentialsRawDataLength,
326  clientCredentialsPassword,
327  trustedCertificatesRawData,
328  trustedCertificatesRawDataLength);
329  return TlsOptions(handle);
330 }
331 
332 inline void TlsOptions::setTlsHandshakeTimeoutMs(int tlsHandshakeTimeoutMs)
333 {
335  (d_handle_p, tlsHandshakeTimeoutMs);
336 }
337 
338 inline void TlsOptions::setCrlFetchTimeoutMs(int crlFetchTimeoutMs)
339 {
341  (d_handle_p, crlFetchTimeoutMs);
342 }
343 
344 inline blpapi_TlsOptions_t *TlsOptions::handle() const { return d_handle_p; }
345 
346 } // close namespace blpapi
347 } // close namespace BloombergLP
348 
349 #endif // #ifdef __cplusplus
350 #endif // #ifndef INCLUDED_BLPAPI_TLSOPTIONS
blpapi_TlsOptions_t * blpapi_TlsOptions_createFromBlobs(const char *clientCredentialsRawData, int clientCredentialsRawDataLength, const char *clientCredentialsPassword, const char *trustedCertificatesRawData, int trustedCertificatesRawDataLength)
void setTlsHandshakeTimeoutMs(int tlsHandshakeTimeoutMs)
Definition: blpapi_tlsoptions.h:332
Common definitions used by the library.
Definition: blpapi_tlsoptions.h:188
blpapi_TlsOptions_t * handle() const
Definition: blpapi_tlsoptions.h:344
Definition: blpapi_abstractsession.h:187
#define BLPAPI_CALL(FUNCNAME)
Definition: blpapi_call.h:353
TlsOptions()
Definition: blpapi_tlsoptions.h:283
void setCrlFetchTimeoutMs(int crlFetchTimeoutMs)
Definition: blpapi_tlsoptions.h:338
blpapi_TlsOptions_t * blpapi_TlsOptions_duplicate(const blpapi_TlsOptions_t *parameters)
static TlsOptions createFromBlobs(const char *clientCredentialsRawData, int clientCredentialsRawDataLength, const char *clientCredentialsPassword, const char *trustedCertificatesRawData, int trustedCertificatesRawDataLength)
Definition: blpapi_tlsoptions.h:316
void blpapi_TlsOptions_destroy(blpapi_TlsOptions_t *parameters)
blpapi_TlsOptions_t * blpapi_TlsOptions_createFromFiles(const char *clientCredentialsFileName, const char *clientCredentialsPassword, const char *trustedCertificatesFileName)
void blpapi_TlsOptions_setTlsHandshakeTimeoutMs(blpapi_TlsOptions_t *paramaters, int tlsHandshakeTimeoutMs)
TlsOptions & operator=(const TlsOptions &rhs)
Definition: blpapi_tlsoptions.h:298
void blpapi_TlsOptions_copy(blpapi_TlsOptions_t *lhs, const blpapi_TlsOptions_t *rhs)
struct blpapi_TlsOptions blpapi_TlsOptions_t
Definition: blpapi_types.h:178
~TlsOptions()
Definition: blpapi_tlsoptions.h:293
static TlsOptions createFromFiles(const char *clientCredentialsFileName, const char *clientCredentialsPassword, const char *trustedCertificatesFileName)
Definition: blpapi_tlsoptions.h:304
blpapi_TlsOptions_t * blpapi_TlsOptions_create(void)
void blpapi_TlsOptions_setCrlFetchTimeoutMs(blpapi_TlsOptions_t *paramaters, int crlFetchTimeoutMs)
Defines Exceptions that can be thrown by the blpapi library.
#define BLPAPI_CALL_UNCHECKED(FUNCNAME)
Definition: blpapi_call.h:354
#define BLPAPI_EXPORT
Definition: blpapi_defs.h:171
Provide functions for dispatchtbl.
Provide BLPAPI types.