diff options
author | Julian Laubstein <julianlaubstein@yahoo.de> | 2016-02-06 11:37:34 +0100 |
---|---|---|
committer | Julian Laubstein <julianlaubstein@yahoo.de> | 2016-02-06 11:37:34 +0100 |
commit | 6fdd7194c81be7234a126bdc3b48f0291fce3567 (patch) | |
tree | 7d5ac74b7385ce4ebf77588d80549c884c2b993c /src/PolarSSL++/BlockingSslClientSocket.h | |
parent | Merge pull request #2958 from LogicParrot/fence (diff) | |
parent | Bulk clearing of whitespace (diff) | |
download | cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.gz cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.bz2 cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.lz cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.xz cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.zst cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.zip |
Diffstat (limited to 'src/PolarSSL++/BlockingSslClientSocket.h')
-rw-r--r-- | src/PolarSSL++/BlockingSslClientSocket.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/PolarSSL++/BlockingSslClientSocket.h b/src/PolarSSL++/BlockingSslClientSocket.h index 3c61f7f89..bc7cbe039 100644 --- a/src/PolarSSL++/BlockingSslClientSocket.h +++ b/src/PolarSSL++/BlockingSslClientSocket.h @@ -27,60 +27,60 @@ public: { Disconnect(); } - + /** Connects to the specified server and performs SSL handshake. Returns true if successful, false on failure. Sets internal error text on failure. */ bool Connect(const AString & a_ServerName, UInt16 a_Port); - + /** Sends the specified data over the connection. Returns true if successful, false on failure. Sets the internal error text on failure. */ bool Send(const void * a_Data, size_t a_NumBytes); - + /** Receives data from the connection. Blocks until there is any data available, then returns as much as possible. Returns the number of bytes actually received, negative number on failure. Sets the internal error text on failure. */ int Receive(void * a_Data, size_t a_MaxBytes); - + /** Disconnects the connection gracefully, if possible. Note that this also frees the internal SSL context, so all the certificates etc. are lost. */ void Disconnect(void); - + /** Sets the root certificates that are to be trusted. Forces the connection to use strict cert verification. Needs to be used before calling Connect(). a_ExpectedPeerName is the name that we expect to receive in the SSL peer's cert; verification will fail if the presented name is different (possible MITM). Returns true on success, false on failure. Sets internal error text on failure. */ bool SetTrustedRootCertsFromString(const AString & a_CACerts, const AString & a_ExpectedPeerName); - + /** Returns the text of the last error that has occurred in this instance. */ const AString & GetLastErrorText(void) const { return m_LastErrorText; } - + protected: friend class cBlockingSslClientSocketConnectCallbacks; friend class cBlockingSslClientSocketLinkCallbacks; /** The SSL context used for the socket */ cCallbackSslContext m_Ssl; - + /** The underlying socket to the SSL server */ cTCPLinkPtr m_Socket; /** The object used to signal state changes in the socket (the cause of the blocking). */ cEvent m_Event; - + /** The trusted CA root cert store, if we are to verify the cert strictly. Set by SetTrustedRootCertsFromString(). */ cX509CertPtr m_CACerts; - + /** The expected SSL peer's name, if we are to verify the cert strictly. Set by SetTrustedRootCertsFromString(). */ AString m_ExpectedPeerName; /** The hostname to which the socket is connecting (stored for error reporting). */ AString m_ServerName; - + /** Text of the last error that has occurred. */ AString m_LastErrorText; - + /** Set to true if the connection established successfully. */ std::atomic<bool> m_IsConnected; @@ -90,8 +90,8 @@ protected: /** Buffer for the data incoming on the network socket. Protected by m_CSIncomingData. */ AString m_IncomingData; - - + + /** Called when the connection is established successfully. */ void OnConnected(void); |