1 /* 2 * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved. 3 * 4 * Licensed under the Apache License 2.0 (the "License"). You may not use 5 * this file except in compliance with the License. You can obtain a copy 6 * in the file LICENSE in the source distribution or at 7 * https://www.openssl.org/source/license.html 8 */ 9 10 #ifndef OSSL_E_WINSOCK_H 11 # define OSSL_E_WINSOCK_H 12 # pragma once 13 14 # ifdef WINDOWS 15 # if !defined(_WIN32_WCE) && !defined(_WIN32_WINNT) 16 /* 17 * Defining _WIN32_WINNT here in e_winsock.h implies certain "discipline." 18 * Most notably we ought to check for availability of each specific 19 * routine that was introduced after denoted _WIN32_WINNT with 20 * GetProcAddress(). Normally newer functions are masked with higher 21 * _WIN32_WINNT in SDK headers. So that if you wish to use them in 22 * some module, you'd need to override _WIN32_WINNT definition in 23 * the target module in order to "reach for" prototypes, but replace 24 * calls to new functions with indirect calls. Alternatively it 25 * might be possible to achieve the goal by /DELAYLOAD-ing .DLLs 26 * and check for current OS version instead. 27 */ 28 # define _WIN32_WINNT 0x0501 29 # endif 30 # if defined(_WIN32_WINNT) || defined(_WIN32_WCE) 31 /* 32 * Just like defining _WIN32_WINNT including winsock2.h implies 33 * certain "discipline" for maintaining [broad] binary compatibility. 34 * As long as structures are invariant among Winsock versions, 35 * it's sufficient to check for specific Winsock2 API availability 36 * at run-time [DSO_global_lookup is recommended]... 37 */ 38 # include <winsock2.h> 39 # include <ws2tcpip.h> 40 /* 41 * Clang-based C++Builder 10.3.3 toolchains cannot find C inline 42 * definitions at link-time. This header defines WspiapiLoad() as an 43 * __inline function. https://quality.embarcadero.com/browse/RSP-33806 44 */ 45 # if !defined(__BORLANDC__) || !defined(__clang__) 46 # include <wspiapi.h> 47 # endif 48 /* yes, they have to be #included prior to <windows.h> */ 49 # endif 50 # include <windows.h> 51 # endif 52 #endif /* !(OSSL_E_WINSOCK_H) */ 53