OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_SOCKET_FUZZED_SOCKET_H_ | 5 #ifndef NET_SOCKET_FUZZED_SOCKET_H_ |
6 #define NET_SOCKET_FUZZED_SOCKET_H_ | 6 #define NET_SOCKET_FUZZED_SOCKET_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
13 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
14 #include "net/base/ip_endpoint.h" | 14 #include "net/base/ip_endpoint.h" |
15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
16 #include "net/log/net_log.h" | 16 #include "net/log/net_log_with_source.h" |
17 #include "net/socket/stream_socket.h" | 17 #include "net/socket/stream_socket.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class FuzzedDataProvider; | 20 class FuzzedDataProvider; |
21 } | 21 } |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 | 24 |
25 class IPEndPoint; | 25 class IPEndPoint; |
26 class IOBuffer; | 26 class IOBuffer; |
| 27 class NetLog; |
27 | 28 |
28 // A StreamSocket that uses a FuzzedDataProvider to generate responses. Writes | 29 // A StreamSocket that uses a FuzzedDataProvider to generate responses. Writes |
29 // can succeed synchronously or asynchronously, can write some or all of the | 30 // can succeed synchronously or asynchronously, can write some or all of the |
30 // provided data, and can fail with several different errors. Reads can do the | 31 // provided data, and can fail with several different errors. Reads can do the |
31 // same, but the read data is also generated from the FuzzedDataProvider. The | 32 // same, but the read data is also generated from the FuzzedDataProvider. The |
32 // number of bytes written/read from a single call is currently capped at 255 | 33 // number of bytes written/read from a single call is currently capped at 255 |
33 // bytes. | 34 // bytes. |
34 // | 35 // |
35 // Reads and writes are executed independently of one another, so to guarantee | 36 // Reads and writes are executed independently of one another, so to guarantee |
36 // the fuzzer behaves the same across repeated runs with the same input, the | 37 // the fuzzer behaves the same across repeated runs with the same input, the |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 IPEndPoint remote_address_; | 124 IPEndPoint remote_address_; |
124 | 125 |
125 base::WeakPtrFactory<FuzzedSocket> weak_factory_; | 126 base::WeakPtrFactory<FuzzedSocket> weak_factory_; |
126 | 127 |
127 DISALLOW_COPY_AND_ASSIGN(FuzzedSocket); | 128 DISALLOW_COPY_AND_ASSIGN(FuzzedSocket); |
128 }; | 129 }; |
129 | 130 |
130 } // namespace net | 131 } // namespace net |
131 | 132 |
132 #endif // NET_SOCKET_FUZZED_SOCKET_H_ | 133 #endif // NET_SOCKET_FUZZED_SOCKET_H_ |
OLD | NEW |