aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Globals.cpp
blob: 8c26d2389dde7a8aba6f82b8bd6839427421499b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/**
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

#include <aws/crt/Api.h>
#include <aws/crt/io/TlsOptions.h>
#include <aws/crt/io/Bootstrap.h>
#include <aws/core/Globals.h>
#include <aws/core/utils/EnumParseOverflowContainer.h>
#include <aws/core/utils/memory/AWSMemory.h>
#include <aws/auth/auth.h>

namespace Aws
{
    static const char TAG[] = "GlobalEnumOverflowContainer";

    static Aws::Crt::ApiHandle* g_apiHandle;
    static std::shared_ptr<Aws::Crt::Io::ClientBootstrap> g_defaultClientBootstrap(nullptr);
    static std::shared_ptr<Aws::Crt::Io::TlsConnectionOptions> g_defaultTlsConnectionOptions(nullptr);

    Aws::Crt::ApiHandle* GetApiHandle()
    {
        return g_apiHandle;
    }

    void SetDefaultClientBootstrap(const std::shared_ptr<Aws::Crt::Io::ClientBootstrap>& clientBootstrap)
    {
        g_defaultClientBootstrap = clientBootstrap;
    }

    Aws::Crt::Io::ClientBootstrap* GetDefaultClientBootstrap()
    {
        return g_defaultClientBootstrap.get();
    }

    void SetDefaultTlsConnectionOptions(const std::shared_ptr<Aws::Crt::Io::TlsConnectionOptions>& tlsConnectionOptions)
    {
        g_defaultTlsConnectionOptions = tlsConnectionOptions;
    }

    Aws::Crt::Io::TlsConnectionOptions* GetDefaultTlsConnectionOptions()
    {
        return g_defaultTlsConnectionOptions.get();
    }

    void InitializeCrt()
    {
        g_apiHandle = Aws::New<Aws::Crt::ApiHandle>(TAG, Aws::get_aws_allocator());
    }

    void CleanupCrt()
    {
        Aws::SetDefaultClientBootstrap(nullptr);
        Aws::SetDefaultTlsConnectionOptions(nullptr);
        Aws::Delete(g_apiHandle);
        g_apiHandle = nullptr;
    }

    static Utils::EnumParseOverflowContainer* g_enumOverflow;

    Utils::EnumParseOverflowContainer* GetEnumOverflowContainer()
    {
        return g_enumOverflow;
    }

    void InitializeEnumOverflowContainer()
    {
        g_enumOverflow = Aws::New<Aws::Utils::EnumParseOverflowContainer>(TAG);
    }

    void CleanupEnumOverflowContainer()
    {
        Aws::Delete(g_enumOverflow);
    }
}