1 #ifndef SRC_NODE_METADATA_H_ 2 #define SRC_NODE_METADATA_H_ 3 4 #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 5 6 #include <string> 7 #include "node_version.h" 8 9 #if HAVE_OPENSSL 10 #include <openssl/crypto.h> 11 #if NODE_OPENSSL_HAS_QUIC 12 #include <openssl/quic.h> 13 #endif 14 #endif // HAVE_OPENSSL 15 16 namespace node { 17 18 // if this is a release build and no explicit base has been set 19 // substitute the standard release download URL 20 #ifndef NODE_RELEASE_URLBASE 21 #if NODE_VERSION_IS_RELEASE 22 #define NODE_RELEASE_URLBASE "https://nodejs.org/download/release/" 23 #endif // NODE_VERSION_IS_RELEASE 24 #endif // NODE_RELEASE_URLBASE 25 26 #if defined(NODE_RELEASE_URLBASE) 27 #define NODE_HAS_RELEASE_URLS 28 #endif 29 30 #ifndef NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH 31 #define NODE_VERSIONS_KEY_UNDICI(V) V(undici) 32 #else 33 #define NODE_VERSIONS_KEY_UNDICI(V) 34 #endif 35 36 #define NODE_VERSIONS_KEYS_BASE(V) \ 37 V(node) \ 38 V(v8) \ 39 V(uv) \ 40 V(zlib) \ 41 V(brotli) \ 42 V(ares) \ 43 V(modules) \ 44 V(nghttp2) \ 45 V(napi) \ 46 V(llhttp) \ 47 V(uvwasi) \ 48 V(acorn) \ 49 V(simdutf) \ 50 V(ada) \ 51 NODE_VERSIONS_KEY_UNDICI(V) 52 53 #if HAVE_OPENSSL 54 #define NODE_VERSIONS_KEY_CRYPTO(V) V(openssl) 55 #else 56 #define NODE_VERSIONS_KEY_CRYPTO(V) 57 #endif 58 59 #ifdef NODE_HAVE_I18N_SUPPORT 60 #define NODE_VERSIONS_KEY_INTL(V) \ 61 V(cldr) \ 62 V(icu) \ 63 V(tz) \ 64 V(unicode) 65 #else 66 #define NODE_VERSIONS_KEY_INTL(V) 67 #endif // NODE_HAVE_I18N_SUPPORT 68 69 #ifdef OPENSSL_INFO_QUIC 70 #define NODE_VERSIONS_KEY_QUIC(V) \ 71 V(ngtcp2) \ 72 V(nghttp3) 73 #else 74 #define NODE_VERSIONS_KEY_QUIC(V) 75 #endif 76 77 #define NODE_VERSIONS_KEYS(V) \ 78 NODE_VERSIONS_KEYS_BASE(V) \ 79 NODE_VERSIONS_KEY_CRYPTO(V) \ 80 NODE_VERSIONS_KEY_INTL(V) \ 81 NODE_VERSIONS_KEY_QUIC(V) 82 83 class Metadata { 84 public: 85 Metadata(); 86 Metadata(Metadata&) = delete; 87 Metadata(Metadata&&) = delete; 88 Metadata operator=(Metadata&) = delete; 89 Metadata operator=(Metadata&&) = delete; 90 91 struct Versions { 92 Versions(); 93 94 #ifdef NODE_HAVE_I18N_SUPPORT 95 // Must be called on the main thread after 96 // i18n::InitializeICUDirectory() 97 void InitializeIntlVersions(); 98 #endif // NODE_HAVE_I18N_SUPPORT 99 100 #define V(key) std::string key; 101 NODE_VERSIONS_KEYS(V) 102 #undef V 103 }; 104 105 struct Release { 106 Release(); 107 108 std::string name; 109 #if NODE_VERSION_IS_LTS 110 std::string lts; 111 #endif // NODE_VERSION_IS_LTS 112 113 #ifdef NODE_HAS_RELEASE_URLS 114 std::string source_url; 115 std::string headers_url; 116 #ifdef _WIN32 117 std::string lib_url; 118 #endif // _WIN32 119 #endif // NODE_HAS_RELEASE_URLS 120 }; 121 122 Versions versions; 123 const Release release; 124 const std::string arch; 125 const std::string platform; 126 }; 127 128 // Per-process global 129 namespace per_process { 130 extern Metadata metadata; 131 } 132 133 } // namespace node 134 135 #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 136 #endif // SRC_NODE_METADATA_H_ 137