1 /* 2 * Copyright 2011, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _SECURE_SOCKET_H 6 #define _SECURE_SOCKET_H 7 8 9 #include <Socket.h> 10 11 12 class BCertificate; 13 14 15 class BSecureSocket : public BSocket { 16 public: 17 BSecureSocket(); 18 BSecureSocket(const BNetworkAddress& peer, 19 bigtime_t timeout = B_INFINITE_TIMEOUT); 20 BSecureSocket(const BSecureSocket& other); 21 virtual ~BSecureSocket(); 22 23 virtual bool CertificateVerificationFailed(BCertificate& 24 certificate, const char* message); 25 26 // BSocket implementation 27 28 virtual status_t Connect(const BNetworkAddress& peer, 29 bigtime_t timeout = B_INFINITE_TIMEOUT); 30 virtual void Disconnect(); 31 32 virtual status_t WaitForReadable(bigtime_t timeout 33 = B_INFINITE_TIMEOUT) const; 34 35 // BDataIO implementation 36 37 virtual ssize_t Read(void* buffer, size_t size); 38 virtual ssize_t Write(const void* buffer, size_t size); 39 40 private: 41 friend class BCertificate; 42 class Private; 43 Private* fPrivate; 44 }; 45 46 47 #endif // _SECURE_SOCKET_H 48