curl-fuzzer C++ reference
Loading...
Searching...
No Matches
curl_global_lifecycle.h
Go to the documentation of this file.
1/*
2 * Copyright (C) Max Dymond, <cmeister2@gmail.com>, et al.
3 *
4 * SPDX-License-Identifier: curl
5 */
6
9
10#ifndef PROTO_FUZZER_CURL_GLOBAL_LIFECYCLE_H_
11#define PROTO_FUZZER_CURL_GLOBAL_LIFECYCLE_H_
12
13namespace proto_fuzzer {
14
17 public:
19 using CleanupFunction = void (*)();
20
21 explicit CurlGlobalLifecycle(CleanupFunction cleanup = nullptr) noexcept;
23
25 CurlGlobalLifecycle& operator=(const CurlGlobalLifecycle&) = delete;
27 CurlGlobalLifecycle& operator=(CurlGlobalLifecycle&&) = delete;
28
30 bool initialized() const noexcept { return initialized_; }
31
32 void FinalizeForProcessExit() noexcept;
33
34 private:
35 friend void FinalizeRegisteredCurlGlobalLifecyclesForExit() noexcept;
36
37 CleanupFunction cleanup_;
38 CurlGlobalLifecycle* next_registered_ = nullptr;
39 unsigned int initialization_count_ = 0;
40 bool initialized_ = false;
41};
42
43void FinalizeRegisteredCurlGlobalLifecyclesForExit() noexcept;
44
45} // namespace proto_fuzzer
46
47#endif // PROTO_FUZZER_CURL_GLOBAL_LIFECYCLE_H_
Own the proto runtime's one curl global initialization.
void(*)() CleanupFunction
Process-exit cleanup callback, injectable for lifecycle regression tests.
CurlGlobalLifecycle(CleanupFunction cleanup=nullptr) noexcept
Initialize curl and its allocation hooks for this process.
void FinalizeForProcessExit() noexcept
Release this object's references after the fuzz engine has stopped.