#include <folly/io/async/AsyncSocket.h>
#include <folly/io/async/SSLContext.h>
#include <folly/io/async/AsyncTimeout.h>
+#include <folly/io/async/OpenSSLPtrTypes.h>
#include <folly/io/async/TimeoutManager.h>
#include <folly/Bits.h>
virtual bool connecting() const override;
virtual std::string getApplicationProtocol() noexcept override;
+ virtual std::string getSecurityProtocol() const override { return "TLS"; }
+
bool isEorTrackingEnabled() const override;
virtual void setEorTracking(bool track) override;
virtual size_t getRawBytesWritten() const override;
/**
* Get the name of the protocol selected by the client during
- * Next Protocol Negotiation (NPN)
+ * Next Protocol Negotiation (NPN) or Application Layer Protocol Negotiation
+ * (ALPN)
*
* Throw an exception if openssl does not support NPN
*
* Note: the AsyncSSLSocket retains ownership
* of this string.
* @param protoNameLen Length of the name.
+ * @param protoType Whether this was an NPN or ALPN negotiation
*/
- virtual void getSelectedNextProtocol(const unsigned char** protoName,
- unsigned* protoLen) const;
+ virtual void getSelectedNextProtocol(
+ const unsigned char** protoName,
+ unsigned* protoLen,
+ SSLContext::NextProtocolType* protoType = nullptr) const;
/**
* Get the name of the protocol selected by the client during
- * Next Protocol Negotiation (NPN)
+ * Next Protocol Negotiation (NPN) or Application Layer Protocol Negotiation
+ * (ALPN)
*
* @param protoName Name of the protocol (not guaranteed to be
* null terminated); will be set to nullptr if
* Note: the AsyncSSLSocket retains ownership
* of this string.
* @param protoNameLen Length of the name.
+ * @param protoType Whether this was an NPN or ALPN negotiation
* @return false if openssl does not support NPN
*/
- virtual bool getSelectedNextProtocolNoThrow(const unsigned char** protoName,
- unsigned* protoLen) const;
+ virtual bool getSelectedNextProtocolNoThrow(
+ const unsigned char** protoName,
+ unsigned* protoLen,
+ SSLContext::NextProtocolType* protoType = nullptr) const;
/**
* Determine if the session specified during setSSLSession was reused
* or if the server rejected it and issued a new session.
*/
- bool getSSLSessionReused() const;
+ virtual bool getSSLSessionReused() const;
/**
* true if the session was resumed using session ID
* Returns the cipher used or the constant value "NONE" when no SSL session
* has been established.
*/
- const char *getNegotiatedCipherName() const;
+ virtual const char* getNegotiatedCipherName() const;
/**
* Get the server name for this SSL connection.
/**
* Returns the time taken to complete a handshake.
*/
- std::chrono::nanoseconds getHandshakeTime() const {
+ virtual std::chrono::nanoseconds getHandshakeTime() const {
return handshakeEndTime_ - handshakeStartTime_;
}
/**
* Returns the peer certificate, or nullptr if no peer certificate received.
*/
- std::unique_ptr<X509, X509_deleter> getPeerCert() const {
+ virtual X509_UniquePtr getPeerCert() const {
if (!ssl_) {
return nullptr;
}
X509* cert = SSL_get_peer_certificate(ssl_);
- return std::unique_ptr<X509, X509_deleter>(cert);
+ return X509_UniquePtr(cert);
}
private: