vfs: check userland buffers before reading them.
[haiku.git] / headers / os / net / SecureSocket.h
blobfe55cc66fd351d694a25097c774b2b76d0f95174
1 /*
2 * Copyright 2011-2016, 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
9 #include <Socket.h>
12 class BCertificate;
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();
23 virtual bool CertificateVerificationFailed(BCertificate&
24 certificate, const char* message);
26 status_t InitCheck();
28 // BSocket implementation
30 virtual status_t Accept(BAbstractSocket*& _socket);
32 virtual status_t Connect(const BNetworkAddress& peer,
33 bigtime_t timeout = B_INFINITE_TIMEOUT);
34 virtual void Disconnect();
36 virtual status_t WaitForReadable(bigtime_t timeout
37 = B_INFINITE_TIMEOUT) const;
39 // BDataIO implementation
41 virtual ssize_t Read(void* buffer, size_t size);
42 virtual ssize_t Write(const void* buffer, size_t size);
44 protected:
45 status_t _SetupCommon(const char* host = NULL);
46 status_t _SetupConnect(const char* host = NULL);
47 status_t _SetupAccept();
49 private:
50 friend class BCertificate;
51 class Private;
52 Private* fPrivate;
56 #endif // _SECURE_SOCKET_H