2011-11-22 01:07:52 +04:00
|
|
|
/*
|
2015-11-11 03:06:01 +03:00
|
|
|
* Copyright 2011-2015, Haiku, Inc. All Rights Reserved.
|
2011-11-22 01:07:52 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _SECURE_SOCKET_H
|
|
|
|
#define _SECURE_SOCKET_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <Socket.h>
|
|
|
|
|
|
|
|
|
2014-01-15 20:39:06 +04:00
|
|
|
class BCertificate;
|
|
|
|
|
|
|
|
|
2011-11-22 01:07:52 +04:00
|
|
|
class BSecureSocket : public BSocket {
|
|
|
|
public:
|
|
|
|
BSecureSocket();
|
|
|
|
BSecureSocket(const BNetworkAddress& peer,
|
|
|
|
bigtime_t timeout = B_INFINITE_TIMEOUT);
|
|
|
|
BSecureSocket(const BSecureSocket& other);
|
|
|
|
virtual ~BSecureSocket();
|
|
|
|
|
2014-02-22 17:49:57 +04:00
|
|
|
virtual bool CertificateVerificationFailed(BCertificate&
|
2014-11-04 17:34:19 +03:00
|
|
|
certificate, const char* message);
|
2014-01-15 20:39:06 +04:00
|
|
|
|
2015-11-11 03:06:01 +03:00
|
|
|
status_t InitCheck();
|
|
|
|
|
2014-01-15 20:39:06 +04:00
|
|
|
// BSocket implementation
|
|
|
|
|
2011-11-22 01:07:52 +04:00
|
|
|
virtual status_t Connect(const BNetworkAddress& peer,
|
|
|
|
bigtime_t timeout = B_INFINITE_TIMEOUT);
|
|
|
|
virtual void Disconnect();
|
|
|
|
|
|
|
|
virtual status_t WaitForReadable(bigtime_t timeout
|
|
|
|
= B_INFINITE_TIMEOUT) const;
|
|
|
|
|
|
|
|
// BDataIO implementation
|
|
|
|
|
|
|
|
virtual ssize_t Read(void* buffer, size_t size);
|
|
|
|
virtual ssize_t Write(const void* buffer, size_t size);
|
|
|
|
|
2015-11-11 03:06:01 +03:00
|
|
|
protected:
|
|
|
|
status_t _Setup();
|
|
|
|
|
2011-11-22 01:07:52 +04:00
|
|
|
private:
|
2014-01-15 20:39:06 +04:00
|
|
|
friend class BCertificate;
|
2011-11-22 01:07:52 +04:00
|
|
|
class Private;
|
|
|
|
Private* fPrivate;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _SECURE_SOCKET_H
|