GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: node_metadata.h Lines: 3 3 100.0 %
Date: 2022-10-14 05:16:24 Branches: 0 0 - %

Line Branch Exec Source
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
#define NODE_VERSIONS_KEYS_BASE(V)                                             \
31
  V(node)                                                                      \
32
  V(v8)                                                                        \
33
  V(uv)                                                                        \
34
  V(zlib)                                                                      \
35
  V(brotli)                                                                    \
36
  V(ares)                                                                      \
37
  V(modules)                                                                   \
38
  V(nghttp2)                                                                   \
39
  V(napi)                                                                      \
40
  V(llhttp)                                                                    \
41
42
#if HAVE_OPENSSL
43
#define NODE_VERSIONS_KEY_CRYPTO(V) V(openssl)
44
#else
45
#define NODE_VERSIONS_KEY_CRYPTO(V)
46
#endif
47
48
#ifdef NODE_HAVE_I18N_SUPPORT
49
#define NODE_VERSIONS_KEY_INTL(V)                                              \
50
  V(cldr)                                                                      \
51
  V(icu)                                                                       \
52
  V(tz)                                                                        \
53
  V(unicode)
54
#else
55
#define NODE_VERSIONS_KEY_INTL(V)
56
#endif  // NODE_HAVE_I18N_SUPPORT
57
58
#ifdef OPENSSL_INFO_QUIC
59
#define NODE_VERSIONS_KEY_QUIC(V)                                             \
60
  V(ngtcp2)                                                                   \
61
  V(nghttp3)
62
#else
63
#define NODE_VERSIONS_KEY_QUIC(V)
64
#endif
65
66
#define NODE_VERSIONS_KEYS(V)                                                  \
67
  NODE_VERSIONS_KEYS_BASE(V)                                                   \
68
  NODE_VERSIONS_KEY_CRYPTO(V)                                                  \
69
  NODE_VERSIONS_KEY_INTL(V)                                                    \
70
  NODE_VERSIONS_KEY_QUIC(V)
71
72
5622
class Metadata {
73
 public:
74
  Metadata();
75
  Metadata(Metadata&) = delete;
76
  Metadata(Metadata&&) = delete;
77
  Metadata operator=(Metadata&) = delete;
78
  Metadata operator=(Metadata&&) = delete;
79
80
5622
  struct Versions {
81
    Versions();
82
83
#ifdef NODE_HAVE_I18N_SUPPORT
84
    // Must be called on the main thread after
85
    // i18n::InitializeICUDirectory()
86
    void InitializeIntlVersions();
87
#endif  // NODE_HAVE_I18N_SUPPORT
88
89
#define V(key) std::string key;
90
    NODE_VERSIONS_KEYS(V)
91
#undef V
92
  };
93
94
5622
  struct Release {
95
    Release();
96
97
    std::string name;
98
#if NODE_VERSION_IS_LTS
99
    std::string lts;
100
#endif  // NODE_VERSION_IS_LTS
101
102
#ifdef NODE_HAS_RELEASE_URLS
103
    std::string source_url;
104
    std::string headers_url;
105
#ifdef _WIN32
106
    std::string lib_url;
107
#endif  // _WIN32
108
#endif  // NODE_HAS_RELEASE_URLS
109
  };
110
111
  Versions versions;
112
  const Release release;
113
  const std::string arch;
114
  const std::string platform;
115
};
116
117
// Per-process global
118
namespace per_process {
119
extern Metadata metadata;
120
}
121
122
}  // namespace node
123
124
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
125
#endif  // SRC_NODE_METADATA_H_