summaryrefslogtreecommitdiff
path: root/cpp/include/IceSSL/Plugin.h
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2016-08-05 17:02:33 -0400
committerBernard Normier <bernard@zeroc.com>2016-08-05 17:02:33 -0400
commit69608388dc1e21b5bd39c61c0e1e723e138de997 (patch)
tree0afa4c18f01ab1363c272649052ef77e9cb19dd2 /cpp/include/IceSSL/Plugin.h
parentReduced string converter caching (diff)
downloadice-69608388dc1e21b5bd39c61c0e1e723e138de997.tar.bz2
ice-69608388dc1e21b5bd39c61c0e1e723e138de997.tar.xz
ice-69608388dc1e21b5bd39c61c0e1e723e138de997.zip
Improved DistinguishedName ctors and comparison operators
Diffstat (limited to 'cpp/include/IceSSL/Plugin.h')
-rw-r--r--cpp/include/IceSSL/Plugin.h42
1 files changed, 33 insertions, 9 deletions
diff --git a/cpp/include/IceSSL/Plugin.h b/cpp/include/IceSSL/Plugin.h
index 0fa64c4de8b..9d4e2f894a4 100644
--- a/cpp/include/IceSSL/Plugin.h
+++ b/cpp/include/IceSSL/Plugin.h
@@ -208,11 +208,11 @@ public:
//
// Create a DistinguishedName using an OpenSSL value.
//
- DistinguishedName(X509NAME*);
+ explicit DistinguishedName(X509NAME*);
#endif
#if defined(__APPLE__) && TARGET_OS_IPHONE != 0
- DistinguishedName(CFDataRef);
+ explicit DistinguishedName(CFDataRef);
#endif
//
@@ -221,7 +221,7 @@ public:
//
// Throws ParseException if parsing fails.
//
- DistinguishedName(const std::string&);
+ explicit DistinguishedName(const std::string&);
//
// Create a DistinguishedName from a list of RDN pairs,
@@ -229,15 +229,14 @@ public:
// For example, the RDN "O=ZeroC" is represented by the
// pair ("O", "ZeroC").
//
- DistinguishedName(const std::list<std::pair<std::string, std::string> >&);
+ explicit DistinguishedName(const std::list<std::pair<std::string, std::string> >&);
//
// This is an exact match. The order of the RDN components is
// important.
//
- bool operator==(const DistinguishedName&) const;
- bool operator!=(const DistinguishedName&) const;
- bool operator<(const DistinguishedName&) const;
+ friend ICE_SSL_API bool operator==(const DistinguishedName&, const DistinguishedName&);
+ friend ICE_SSL_API bool operator<(const DistinguishedName&, const DistinguishedName&);
//
// Perform a partial match with another DistinguishedName. The function
@@ -245,6 +244,7 @@ public:
// DistinguishedName and they have the same values.
//
bool match(const DistinguishedName&) const;
+ bool match(const std::string&) const;
//
// Encode the DN in RFC2253 format.
@@ -259,6 +259,30 @@ private:
std::list<std::pair<std::string, std::string> > _unescaped;
};
+inline bool
+operator>(const DistinguishedName& lhs, const DistinguishedName& rhs)
+{
+ return rhs < lhs;
+}
+
+inline bool
+operator<=(const DistinguishedName& lhs, const DistinguishedName& rhs)
+{
+ return !(lhs > rhs);
+}
+
+inline bool
+operator>=(const DistinguishedName& lhs, const DistinguishedName& rhs)
+{
+ return !(lhs < rhs);
+}
+
+inline bool
+operator!=(const DistinguishedName& lhs, const DistinguishedName& rhs)
+{
+ return !(lhs == rhs);
+}
+
//
// This convenience class is a wrapper around a native certificate.
// The interface is inspired by java.security.cert.X509Certificate.
@@ -278,7 +302,7 @@ public:
// The Certificate class assumes ownership of the given native
//
// certificate.
- Certificate(X509CertificateRef);
+ explicit Certificate(X509CertificateRef);
~Certificate();
//
@@ -296,7 +320,7 @@ public:
static CertificatePtr decode(const std::string&);
//
- // Those operators compare the certificates for equality using the
+ // Compare the certificates for equality using the
// native certificate comparison method.
//
bool operator==(const Certificate&) const;