/src/nss/fuzz/targets/lib/tls/socket.h
Line | Count | Source |
1 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
2 | | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
3 | | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | | |
5 | | #ifndef TLS_SOCKET_H_ |
6 | | #define TLS_SOCKET_H_ |
7 | | |
8 | | #include <cstdint> |
9 | | |
10 | | #include "dummy_io.h" |
11 | | #include "prinrval.h" |
12 | | #include "prio.h" |
13 | | |
14 | | namespace TlsSocket { |
15 | | |
16 | | class DummyPrSocket : public DummyIOLayerMethods { |
17 | | public: |
18 | 59.5k | DummyPrSocket(const uint8_t *buf, size_t len) : buf_(buf), len_(len) {} |
19 | | |
20 | | int32_t Read(PRFileDesc *fd, void *data, int32_t len) override; |
21 | | int32_t Write(PRFileDesc *fd, const void *buf, int32_t length) override; |
22 | | int32_t Recv(PRFileDesc *fd, void *buf, int32_t buflen, int32_t flags, |
23 | | PRIntervalTime to) override; |
24 | | |
25 | | private: |
26 | | const uint8_t *buf_; |
27 | | size_t len_; |
28 | | }; |
29 | | |
30 | | } // namespace TlsSocket |
31 | | |
32 | | #endif // TLS_SOCKET_H_ |