Ice 3.8
C++ API Reference
Loading...
Searching...
No Matches
ConnectionInfo.h
1// Copyright (c) ZeroC, Inc.
2
3#ifndef ICE_SSL_CONNECTION_INFO_H
4#define ICE_SSL_CONNECTION_INFO_H
5
6#include "Config.h"
7#include "ConnectionInfoF.h"
8#include "Ice/Connection.h"
9
10#if defined(__clang__)
11# pragma clang diagnostic push
12# pragma clang diagnostic ignored "-Wshadow-field-in-constructor"
13#elif defined(__GNUC__)
14# pragma GCC diagnostic push
15# pragma GCC diagnostic ignored "-Wshadow"
16#endif
17
18// This file defines the `XxxConnectionInfo` class for each platform-specific SSL implementation. The
19// `#if defined(ICE_USE_XXX)/#endif` directives are used to include the appropriate structure based on the platform. We
20// avoid using `#elif` directives because we want to define all the classes when building the doxygen documentation.
21
22/// Secure connections with SSL/TLS.
23namespace Ice::SSL
24{
25#if defined(ICE_USE_SCHANNEL) || defined(ICE_DOXYGEN)
26 /// Provides access to the connection details of an SSL connection.
27 ///
28 /// The SchannelConnectionInfo class is only available when the Ice library is built on Windows. For Linux,
29 /// refer to OpenSSLConnectionInfo, and for macOS and iOS, refer to SecureTransportConnectionInfo.
30 /// @see ::Ice::SSL::ConnectionInfo
31 class ICE_API SchannelConnectionInfo final : public Ice::ConnectionInfo
32 {
33 public:
34 ~SchannelConnectionInfo() final;
35 SchannelConnectionInfo(const SchannelConnectionInfo&) = delete;
36 SchannelConnectionInfo& operator=(const SchannelConnectionInfo&) = delete;
37
38 /// The peer certificate.
39 const PCCERT_CONTEXT peerCertificate;
40
41 /// @private
42 SchannelConnectionInfo(Ice::ConnectionInfoPtr underlying, PCCERT_CONTEXT peerCertificate)
43 : ConnectionInfo{std::move(underlying)},
45 {
46 }
47 };
48#endif
49
50#if defined(ICE_USE_SECURE_TRANSPORT) || defined(ICE_DOXYGEN)
51 /// Provides access to the connection details of an SSL connection.
52 ///
53 /// The SecureTransportConnectionInfo class is only available when the Ice library is built on macOS or iOS. For
54 /// Linux, refer to OpenSSLConnectionInfo, and for Windows, refer to SchannelConnectionInfo.
55 /// @see ::Ice::SSL::ConnectionInfo
56 class ICE_API SecureTransportConnectionInfo final : public Ice::ConnectionInfo
57 {
58 public:
59 ~SecureTransportConnectionInfo() final;
60 SecureTransportConnectionInfo(const SecureTransportConnectionInfo&) = delete;
61 SecureTransportConnectionInfo& operator=(const SecureTransportConnectionInfo&) = delete;
62
63 /// The peer certificate.
64 const SecCertificateRef peerCertificate;
65
66 /// @private
67 SecureTransportConnectionInfo(Ice::ConnectionInfoPtr underlying, SecCertificateRef peerCertificate)
68 : ConnectionInfo{std::move(underlying)},
70 {
71 }
72 };
73#endif
74
75#if defined(ICE_USE_OPENSSL) || defined(ICE_DOXYGEN)
76 /// Provides access to the connection details of an SSL connection.
77 ///
78 /// The OpenSSLConnectionInfo class is only available when the Ice library is built on Linux. For Windows,
79 /// refer to SchannelConnectionInfo, and for macOS and iOS, refer to SecureTransportConnectionInfo.
80 /// @see ::Ice::SSL::ConnectionInfo
81 class ICE_API OpenSSLConnectionInfo final : public Ice::ConnectionInfo
82 {
83 public:
84 ~OpenSSLConnectionInfo() final;
85 OpenSSLConnectionInfo(const OpenSSLConnectionInfo&) = delete;
86 OpenSSLConnectionInfo& operator=(const OpenSSLConnectionInfo&) = delete;
87
88 /// The peer certificate.
89 X509* const peerCertificate;
90
91 /// @private
92 OpenSSLConnectionInfo(Ice::ConnectionInfoPtr underlying, X509* peerCertificate)
93 : ConnectionInfo{std::move(underlying)},
95 {
96 }
97 };
98#endif
99}
100
101#if defined(__clang__)
102# pragma clang diagnostic pop
103#elif defined(__GNUC__)
104# pragma GCC diagnostic pop
105#endif
106
107#endif
const ConnectionInfoPtr underlying
The information of the underlying transport or nullptr if there's no underlying transport.
Definition Connection.h:173
Base class for all connection info classes.
Definition Connection.h:164
X509 *const peerCertificate
The peer certificate.
const PCCERT_CONTEXT peerCertificate
The peer certificate.
const SecCertificateRef peerCertificate
The peer certificate.
Secure connections with SSL/TLS.
std::shared_ptr< ConnectionInfo > ConnectionInfoPtr
A shared pointer to a ConnectionInfo.
Definition ConnectionF.h:21