1{
2    "module": "network",
3    "depends": [
4        "core"
5    ],
6    "testDir": "../../config.tests",
7
8    "commandline": {
9        "assignments": {
10            "OPENSSL_PATH": "openssl.prefix"
11        },
12        "options": {
13            "libproxy": "boolean",
14            "openssl": { "type": "optionalString", "values": [ "no", "yes", "linked", "runtime" ] },
15            "openssl-linked": { "type": "void", "name": "openssl", "value": "linked" },
16            "openssl-runtime": { "type": "void", "name": "openssl", "value": "runtime" },
17            "dtls": "boolean",
18            "ocsp": "boolean",
19            "sctp": "boolean",
20            "securetransport": "boolean",
21            "schannel": "boolean",
22            "ssl": "boolean",
23            "system-proxies": "boolean"
24        }
25    },
26
27    "libraries": {
28        "corewlan": {
29            "label": "CoreWLan",
30            "export": "",
31            "test": {
32                "lang": "objc++",
33                "include": [ "CoreWLAN/CoreWLAN.h", "CoreWLAN/CWInterface.h" ],
34                "main": "[CWInterface interfaceWithName:@\"en2\"];"
35            },
36            "sources": [
37                "-framework CoreWLAN -framework Foundation"
38            ]
39        },
40        "network": {
41            "sources": [
42                { "type": "makeSpec", "spec": "NETWORK" }
43            ]
44        },
45        "libproxy": {
46            "label": "libproxy",
47            "test": {
48                "main": [
49                    "pxProxyFactory *factory = px_proxy_factory_new();",
50                    "px_proxy_factory_get_proxies(factory, \"http://qt-project.org\");",
51                    "px_proxy_factory_free(factory);"
52                ]
53            },
54            "headers": "proxy.h",
55            "sources": [
56                "-lproxy"
57            ]
58        },
59        "openssl_headers": {
60            "label": "OpenSSL Headers",
61            "export": "openssl",
62            "test": {
63                "tail": [
64                    "#if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER-0 < 0x10101000L",
65                    "#  error OpenSSL >= 1.1.1 is required",
66                    "#endif",
67                    "#if !defined(OPENSSL_NO_EC) && !defined(SSL_CTRL_SET_CURVES)",
68                    "#  error OpenSSL was reported as >= 1.1.1 but is missing required features, possibly it's libressl which is unsupported",
69                    "#endif"
70                ]
71            },
72            "headers": [ "openssl/ssl.h", "openssl/opensslv.h" ],
73            "sources": [
74                {
75                    "comment": "placeholder for OPENSSL_PATH",
76                    "libs": ""
77                }
78            ]
79        },
80        "openssl": {
81            "label": "OpenSSL",
82            "test": {
83                "inherit": "openssl_headers",
84                "main": "SSL_free(SSL_new(0));"
85            },
86            "sources": [
87                { "type": "openssl" },
88                {
89                    "libs": "-lssleay32 -llibeay32 -lUser32 -lWs2_32 -lAdvapi32 -lGdi32",
90                    "condition": "config.win32"
91                },
92                {
93                    "libs": "-llibssl -llibcrypto -lUser32 -lWs2_32 -lAdvapi32 -lCrypt32",
94                    "condition": "config.msvc"
95                },
96                {
97                    "libs": "-lssl_arm64-v8a -lcrypto_arm64-v8a",
98                    "condition": "config.android"
99                },
100                {
101                    "libs": "-lssl -lcrypto",
102                    "condition": "!config.msvc"
103                }
104            ]
105        },
106        "gssapi": {
107            "label": "KRB5 GSSAPI Support",
108            "test": {
109                "head": [
110                    "#if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__))",
111                    "#  include <TargetConditionals.h>",
112                    "#  if defined(TARGET_OS_MAC) && TARGET_OS_MAC",
113                    "#    include <GSS/GSS.h>",
114                    "#  endif",
115                    "#else",
116                    "#  include <gssapi/gssapi.h>",
117                    "#endif"
118                ],
119                "main": [
120                  "gss_ctx_id_t ctx;",
121                  "gss_context_time(nullptr, ctx, nullptr);"
122                ]
123            },
124            "sources": [
125                { "libs": "-framework GSS", "condition": "config.darwin" },
126                { "type": "pkgConfig", "args": "krb5-gssapi" },
127                "-lgssapi_krb5"
128            ]
129        }
130    },
131
132    "tests": {
133        "getifaddrs": {
134            "label": "getifaddrs()",
135            "type": "compile",
136            "test": {
137                "include": [ "sys/types.h", "sys/socket.h", "net/if.h", "ifaddrs.h" ],
138                "main": [
139                    "ifaddrs *list;",
140                    "getifaddrs(&list);",
141                    "freeifaddrs(list);"
142                ]
143            },
144            "use": "network"
145        },
146        "ipv6ifname": {
147            "label": "IPv6 ifname",
148            "type": "compile",
149            "test": {
150                "include": [ "sys/types.h", "sys/socket.h", "net/if.h" ],
151                "main": [
152                    "char buf[IFNAMSIZ];",
153                    "if_nametoindex(\"eth0\");",
154                    "if_indextoname(1, buf);",
155                    "if_freenameindex(if_nameindex());"
156                ]
157            },
158            "use": "network"
159        },
160        "linux-netlink": {
161            "label": "Linux AF_NETLINK sockets",
162            "type": "compile",
163            "test": {
164                "include": [ "asm/types.h", "linux/netlink.h", "linux/rtnetlink.h", "sys/socket.h" ],
165                "main": [
166                    "struct rtattr rta = { };",
167                    "struct ifinfomsg ifi = {};",
168                    "struct ifaddrmsg ifa = {};",
169                    "struct ifa_cacheinfo ci;",
170                    "ci.ifa_prefered = ci.ifa_valid = 0;",
171                    "(void)RTM_NEWLINK; (void)RTM_NEWADDR;",
172                    "(void)IFLA_ADDRESS; (void)IFLA_IFNAME;",
173                    "(void)IFA_ADDRESS; (void)IFA_LABEL; (void)IFA_CACHEINFO;",
174                    "(void)(IFA_F_SECONDARY | IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_MANAGETEMPADDR);"
175                ]
176            }
177        },
178        "sctp": {
179            "label": "SCTP support",
180            "type": "compile",
181            "test": {
182                "include": [ "sys/types.h", "sys/socket.h", "netinet/in.h", "netinet/sctp.h" ],
183                "main": [
184                    "sctp_initmsg sctpInitMsg;",
185                    "socklen_t sctpInitMsgSize = sizeof(sctpInitMsg);",
186                    "(void) socket(PF_INET, SOCK_STREAM, IPPROTO_SCTP);",
187                    "(void) getsockopt(-1, SOL_SCTP, SCTP_INITMSG, &sctpInitMsg, &sctpInitMsgSize);"
188                ]
189            },
190            "use": "network"
191        },
192        "dtls": {
193            "label": "DTLS support in OpenSSL",
194            "type": "compile",
195            "test": {
196                "include": "openssl/ssl.h",
197                "tail": [
198                    "#if defined(OPENSSL_NO_DTLS) || !defined(DTLS1_2_VERSION)",
199                    "#  error OpenSSL without DTLS support",
200                    "#endif"
201                ]
202            },
203            "use": "openssl"
204        },
205        "ocsp": {
206            "label": "OCSP stapling support in OpenSSL",
207            "type": "compile",
208            "test": {
209                "include": ["openssl/ssl.h", "openssl/ocsp.h"],
210                "tail": [
211                    "#if defined(OPENSSL_NO_OCSP) || defined(OPENSSL_NO_TLSEXT)",
212                    "#  error OpenSSL without OCSP stapling",
213                    "#endif"
214                ]
215            },
216            "use": "openssl"
217        },
218        "netlistmgr": {
219            "label": "Network List Manager",
220            "type": "compile",
221            "test": {
222                "include": [ "netlistmgr.h", "wrl/client.h" ],
223                "main": [
224                    "using namespace Microsoft::WRL;",
225                    "ComPtr<INetworkListManager> networkListManager;",
226                    "ComPtr<IConnectionPoint> connectionPoint;",
227                    "ComPtr<IConnectionPointContainer> connectionPointContainer;",
228                    "networkListManager.As(&connectionPointContainer);",
229                    "connectionPointContainer->FindConnectionPoint(IID_INetworkConnectionEvents, &connectionPoint);"
230                ],
231                "qmake": "LIBS += -lOle32"
232            }
233        }
234    },
235
236    "features": {
237        "corewlan": {
238            "label": "CoreWLan",
239            "condition": "libs.corewlan",
240            "emitIf": "config.darwin",
241            "output": [ "feature", "privateFeature" ]
242        },
243        "getifaddrs": {
244            "label": "getifaddrs()",
245            "condition": "tests.getifaddrs",
246            "output": [ "feature" ]
247        },
248        "ipv6ifname": {
249            "label": "IPv6 ifname",
250            "condition": "tests.ipv6ifname",
251            "output": [ "feature" ]
252        },
253        "libproxy": {
254            "label": "libproxy",
255            "autoDetect": false,
256            "condition": "libs.libproxy",
257            "output": [ "privateFeature" ]
258        },
259        "linux-netlink": {
260            "label": "Linux AF_NETLINK",
261            "condition": "config.linux && !config.android && tests.linux-netlink",
262            "output": [ "privateFeature" ]
263        },
264        "openssl": {
265            "label": "OpenSSL",
266            "enable": "false",
267            "condition": "features.openssl-runtime || features.openssl-linked",
268            "output": [
269                "privateFeature",
270                { "type": "publicQtConfig", "condition": "!features.openssl-linked" },
271                { "type": "define", "negative": true, "name": "QT_NO_OPENSSL" }
272            ]
273        },
274        "openssl-runtime": {
275            "autoDetect": "!config.winrt && !config.wasm",
276            "enable": "input.openssl == 'yes' || input.openssl == 'runtime'",
277            "disable": "input.openssl == 'no' || input.openssl == 'linked' || input.ssl == 'no'",
278            "condition": "!features.securetransport && !features.schannel && libs.openssl_headers"
279        },
280        "openssl-linked": {
281            "label": "  Qt directly linked to OpenSSL",
282            "autoDetect": false,
283            "enable": "input.openssl == 'linked'",
284            "condition": "!features.securetransport && !features.schannel && libs.openssl",
285            "output": [
286                "privateFeature",
287                { "type": "define", "name": "QT_LINKED_OPENSSL" }
288            ]
289        },
290        "securetransport": {
291            "label": "SecureTransport",
292            "disable": "input.securetransport == 'no' || input.ssl == 'no'",
293            "condition": "config.darwin && (input.openssl == '' || input.openssl == 'no')",
294            "output": [
295                "publicFeature",
296                { "type": "define", "name": "QT_SECURETRANSPORT" }
297            ]
298        },
299        "schannel": {
300            "label": "Schannel",
301            "disable": "input.schannel == 'no' || input.ssl == 'no'",
302            "condition": "input.schannel == 'yes' && config.win32 && !config.winrt && (input.openssl == '' || input.openssl == 'no')",
303            "output": [
304                "publicFeature",
305                { "type": "define", "name": "QT_SCHANNEL" }
306            ]
307        },
308        "ssl": {
309            "label": "SSL",
310            "condition": "config.winrt || features.securetransport || features.openssl || features.schannel",
311            "output": [ "publicFeature", "feature" ]
312        },
313        "dtls": {
314            "label": "DTLS",
315            "purpose": "Provides a DTLS implementation",
316            "section": "Networking",
317            "condition": "features.openssl && features.udpsocket && tests.dtls",
318            "output": [ "publicFeature" ]
319        },
320        "ocsp": {
321            "label": "OCSP-stapling",
322            "purpose": "Provides OCSP stapling support",
323            "section": "Networking",
324            "condition": "features.opensslv11 && tests.ocsp",
325            "output": [ "publicFeature" ]
326        },
327        "opensslv11": {
328            "label": "OpenSSL 1.1",
329            "condition": "features.openssl",
330            "output": [ "publicFeature" ]
331        },
332        "sctp": {
333            "label": "SCTP",
334            "autoDetect": false,
335            "condition": "tests.sctp",
336            "output": [ "publicFeature", "feature" ]
337        },
338        "system-proxies": {
339            "label": "Use system proxies",
340            "output": [ "privateFeature" ]
341        },
342        "ftp": {
343            "label": "FTP",
344            "purpose": "Provides support for the File Transfer Protocol in QNetworkAccessManager.",
345            "section": "Networking",
346            "condition": "features.textdate",
347            "output": [ "publicFeature", "feature" ]
348        },
349        "http": {
350            "label": "HTTP",
351            "purpose": "Provides support for the Hypertext Transfer Protocol in QNetworkAccessManager.",
352            "section": "Networking",
353            "condition": "features.thread",
354            "output": [ "publicFeature", "feature" ]
355        },
356        "udpsocket": {
357            "label": "QUdpSocket",
358            "purpose": "Provides access to UDP sockets.",
359            "section": "Networking",
360            "output": [ "publicFeature", "feature" ]
361        },
362        "networkproxy": {
363            "label": "QNetworkProxy",
364            "purpose": "Provides network proxy support.",
365            "section": "Networking",
366            "output": [ "publicFeature", "feature" ]
367        },
368        "socks5": {
369            "label": "SOCKS5",
370            "purpose": "Provides SOCKS5 support in QNetworkProxy.",
371            "section": "Networking",
372            "condition": "features.networkproxy",
373            "output": [ "publicFeature", "feature" ]
374        },
375        "networkinterface": {
376            "label": "QNetworkInterface",
377            "purpose": "Supports enumerating a host's IP addresses and network interfaces.",
378            "condition": "!config.wasm",
379            "section": "Networking",
380            "output": [ "publicFeature", "feature" ]
381        },
382        "networkdiskcache": {
383            "label": "QNetworkDiskCache",
384            "purpose": "Provides a disk cache for network resources.",
385            "section": "Networking",
386            "condition": "features.temporaryfile",
387            "output": [ "publicFeature", "feature" ]
388        },
389        "bearermanagement": {
390            "label": "Bearer management (deprecated)",
391            "purpose": "Provides bearer management for the network stack.",
392            "section": "Networking",
393            "condition": "features.thread && features.library && features.networkinterface && features.properties",
394            "output": [
395                "publicFeature",
396                "feature",
397                { "type": "define", "negative": true, "name": "QT_NO_BEARERMANAGEMENT" }
398            ]
399        },
400        "localserver": {
401            "label": "QLocalServer",
402            "purpose": "Provides a local socket based server.",
403            "section": "Networking",
404            "condition": "features.temporaryfile",
405            "output": [ "publicFeature", "feature" ]
406        },
407        "dnslookup": {
408            "label": "QDnsLookup",
409            "purpose": "Provides API for DNS lookups.",
410            "section": "Networking",
411            "output": [ "publicFeature" ]
412        },
413        "gssapi": {
414            "label": "GSSAPI",
415            "purpose": "Enable SPNEGO authentication through GSSAPI",
416            "section": "Networking",
417            "condition": "!config.win32 && libs.gssapi",
418            "output": [ "publicFeature", "feature" ]
419        },
420        "sspi": {
421            "label": "SSPI",
422            "purpose": "Enable NTLM/SPNEGO authentication through SSPI",
423            "section": "Networking",
424            "condition": "config.win32 && !config.winrt",
425            "output": [ "publicFeature", "feature" ]
426        },
427        "netlistmgr": {
428            "label": "Network List Manager",
429            "purpose": "Use Network List Manager to keep track of network connectivity",
430            "section": "Networking",
431            "condition": "config.win32 && tests.netlistmgr",
432            "output": [ "privateFeature" ]
433        }
434    },
435
436    "report": [
437        {
438            "type": "note",
439            "condition": "!config.android && features.openssl-linked && libs.openssl.source != 0
440                          && input.openssl.prefix == '' && input.openssl.libs == '' && input.openssl.libs.debug == ''",
441            "message": "When linking against OpenSSL, you can override the default
442library names through OPENSSL_LIBS.
443For example:
444    OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked"
445        },
446        {
447            "type": "warning",
448            "condition": "features.libproxy && input.qt_namespace == ''",
449            "message": "Some of libproxy's plugins may use incompatible Qt versions.
450
451    Some platforms and distributions ship libproxy with plugins, such
452    as config_kde4.so, that are linked against old versions of Qt; and
453    libproxy loads these plugins automatically when initialized. If Qt
454    is not in a namespace, that loading causes a crash. Even if the
455    systems on which you build and test have no such plugins, your
456    users' systems may have them. We therefore recommend that you
457    combine -libproxy with -qtnamespace when configuring Qt."
458        }
459    ],
460
461    "summary": [
462        {
463            "section": "Qt Network",
464            "entries": [
465                {
466                    "type": "feature",
467                    "args": "corewlan",
468                    "condition": "config.darwin"
469                },
470                "getifaddrs", "ipv6ifname", "libproxy",
471                {
472                    "type": "feature",
473                    "args": "linux-netlink",
474                    "condition": "config.linux"
475                },
476                {
477                    "type": "feature",
478                    "args": "securetransport",
479                    "condition": "config.darwin"
480                },
481                {
482                    "type": "feature",
483                    "args": "schannel",
484                    "condition": "config.win32 && !config.winrt"
485                },
486                "openssl",
487                "openssl-linked",
488                "opensslv11",
489                "dtls",
490                "ocsp",
491                "sctp",
492                "system-proxies",
493                "gssapi"
494            ]
495        }
496    ]
497}
498