/src/curl_fuzzer/proto_fuzzer/incoming_data_observer.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (C) Max Dymond, <cmeister2@gmail.com>, et al. |
3 | | * |
4 | | * SPDX-License-Identifier: curl |
5 | | */ |
6 | | |
7 | | /// @file |
8 | | /// @brief Optional observer for application bytes consumed by mock peers. |
9 | | |
10 | | #ifndef PROTO_FUZZER_INCOMING_DATA_OBSERVER_H_ |
11 | | #define PROTO_FUZZER_INCOMING_DATA_OBSERVER_H_ |
12 | | |
13 | | #include <cstddef> |
14 | | |
15 | | namespace proto_fuzzer { |
16 | | |
17 | | /// Receives bytes after any transport decoding. Protocol peers use this to |
18 | | /// track client frame state without changing how MockConnection drains data. |
19 | | class IncomingDataObserver { |
20 | | public: |
21 | 68.8k | virtual ~IncomingDataObserver() = default; |
22 | | |
23 | | /// Observe one contiguous application-data fragment. |
24 | | /// @param data First byte of the fragment. |
25 | | /// @param size Number of bytes available at `data`. |
26 | | virtual void ObserveIncomingData(const unsigned char* data, std::size_t size) = 0; |
27 | | }; |
28 | | |
29 | | } // namespace proto_fuzzer |
30 | | |
31 | | #endif // PROTO_FUZZER_INCOMING_DATA_OBSERVER_H_ |