summaryrefslogtreecommitdiff
path: root/src/mongo/util/net/SConscript
blob: ea81c6d254c8606ea82ecf2c655d8226b6468909 (plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# -*- mode: python; -*-

Import('env')
Import("get_option")
Import('http_client')
Import('ssl_provider')

env = env.Clone()

env.Library(
    target='network',
    source=[
        "cidr.cpp",
        "hostandport.cpp",
        "hostname_canonicalization.cpp",
        "sockaddr.cpp",
        "socket_exception.cpp",
        "socket_utils.cpp",
        'hostandport.idl',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/server_options_core',
        '$BUILD_DIR/mongo/util/concurrency/spin_lock',
        '$BUILD_DIR/mongo/util/winutil',
    ],
)

env.Library(
    target='ssl_options',
    source=[
        "ssl_options.cpp",
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/server_options_core',
        '$BUILD_DIR/mongo/util/options_parser/options_parser',
    ]
)

env.Library(
    target='ssl_options_client',
    source=[
        'ssl_options_client.cpp',
        'ssl_options_client.idl',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        'ssl_options',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/util/options_parser/options_parser',
    ]
)

env.Library(
    target='ssl_options_server',
    source=[
        'ssl_options_server.cpp',
        'ssl_options_server.idl',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        'ssl_options',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/server_options_core',
        '$BUILD_DIR/mongo/util/options_parser/options_parser',
    ]
)

env.Library(
    target='ssl_types',
    source=[
        "ssl_types.cpp",
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
    ],
    LIBDEPS_PRIVATE=[
        'ssl_options',
    ]
)

if not get_option('ssl') == 'off':
    if ssl_provider == 'openssl':
        env.Library(
            target='openssl_init',
            source=[
                'openssl_init.cpp',
            ],
            LIBDEPS=[
                '$BUILD_DIR/mongo/base',
                'ssl_options',
            ],
        );

    env.Library(
        target='ssl_manager',
        source=[
            "sock.cpp",
            "private/ssl_expiration.cpp",
            "ssl_manager.cpp",
            "ssl_parameters.cpp",
            "ssl_manager_%s.cpp" % (ssl_provider),
            "ssl_stream.cpp",
            "ssl_peer_info.cpp",
            'ssl_parameters.idl',
            "ocsp/ocsp_manager.cpp",
        ],
        LIBDEPS=[
            '$BUILD_DIR/mongo/base',
            '$BUILD_DIR/mongo/client/internal_auth',
            '$BUILD_DIR/mongo/db/auth/auth',
            '$BUILD_DIR/mongo/util/caching',
            '$BUILD_DIR/mongo/util/concurrency/thread_pool',
            '$BUILD_DIR/third_party/shim_asio',
            'network',
            'openssl_init' if ssl_provider == 'openssl' else '',
            'ssl_options',
            'ssl_types',
        ],
        LIBDEPS_PRIVATE=[
            '$BUILD_DIR/mongo/base/secure_allocator',
            '$BUILD_DIR/mongo/crypto/sha_block_${MONGO_CRYPTO}',
            '$BUILD_DIR/mongo/db/server_options_core',
            '$BUILD_DIR/mongo/db/service_context',
            '$BUILD_DIR/mongo/idl/server_parameter',
            '$BUILD_DIR/mongo/util/background_job',
            '$BUILD_DIR/mongo/util/icu',
            '$BUILD_DIR/mongo/util/winutil',
            'http_client',
        ],
    )

    env.Library(
        target='ssl_parameters_auth',
        source=[
            'ssl_parameters_auth.cpp',
            'ssl_parameters_auth.idl',
        ],
        LIBDEPS_PRIVATE=[
            '$BUILD_DIR/mongo/client/authentication',
            '$BUILD_DIR/mongo/db/server_options_core',
            '$BUILD_DIR/mongo/idl/server_parameter',
            'ssl_options',
        ],
    )
else:
    env.Library(
        target='ssl_manager',
        source=[
            "sock.cpp",
            "ssl_manager_none.cpp",
        ],
        LIBDEPS=[
            '$BUILD_DIR/mongo/base',
            '$BUILD_DIR/mongo/util/fail_point',
            'network',
            'ssl_options',
        ],
    )

    env.Library(
        target='ssl_parameters_auth',
        source=[
            "ssl_parameters_auth_none.cpp",
        ],
        LIBDEPS=[
            '$BUILD_DIR/mongo/base',
        ],
    )

if http_client == "off":
    env.Library(
        target='http_client',
        source=[
            'http_client_none.cpp',
        ],
        LIBDEPS=[
            '$BUILD_DIR/mongo/base',
        ],
    )
else:
    env.Library(
        target='http_client',
        source=[
            'http_client_winhttp.cpp' if env.TargetOSIs('windows') else 'http_client_curl.cpp',
        ],
        LIBDEPS=[
            '$BUILD_DIR/mongo/base',
        ],
        SYSLIBDEPS=[
            'winhttp' if env.TargetOSIs('windows') else 'curl',
        ],
    )

env.CppUnitTest(
    target='util_net_test',
    source=[
        'cidr_test.cpp',
        'hostandport_test.cpp',
    ],
    LIBDEPS=[
        'network',
    ],
)

env.CppLibfuzzerTest(
    target='asn1_parser_fuzzer',
    source=[
        'asn1_parser_fuzzer.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/util/net/ssl_manager',
    ],
)

if get_option('ssl') == 'on':
    env.CppUnitTest(
        target='util_net_ssl_test',
        source=[
            'ssl_manager_test.cpp',
            'ssl_options_test.cpp',
            'sock_test.cpp',
        ],
        LIBDEPS=[
            '$BUILD_DIR/mongo/db/server_options_servers',
            '$BUILD_DIR/mongo/util/cmdline_utils/cmdline_utils',
            '$BUILD_DIR/mongo/util/fail_point',
            'network',
            'ssl_manager',
            'ssl_options_server',
        ],
    )