@encharm/cws 4.0.2 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (410) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/LICENSE +3 -2
  3. package/README.md +9 -2
  4. package/binding.gyp +2 -2
  5. package/dist/bindings/cws_darwin_arm64_node108.node +0 -0
  6. package/dist/bindings/cws_darwin_arm64_node64.node +0 -0
  7. package/dist/bindings/cws_darwin_arm64_node72.node +0 -0
  8. package/dist/bindings/cws_darwin_arm64_node79.node +0 -0
  9. package/dist/bindings/cws_darwin_arm64_node83.node +0 -0
  10. package/dist/bindings/cws_darwin_arm64_node93.node +0 -0
  11. package/dist/bindings/cws_darwin_x64_node108.node +0 -0
  12. package/dist/bindings/cws_darwin_x64_node64.node +0 -0
  13. package/dist/bindings/cws_darwin_x64_node72.node +0 -0
  14. package/dist/bindings/cws_darwin_x64_node79.node +0 -0
  15. package/dist/bindings/cws_darwin_x64_node83.node +0 -0
  16. package/dist/bindings/cws_darwin_x64_node93.node +0 -0
  17. package/dist/bindings/cws_linux_x64_node108.node +0 -0
  18. package/dist/bindings/cws_linux_x64_node64.node +0 -0
  19. package/dist/bindings/cws_linux_x64_node72.node +0 -0
  20. package/dist/bindings/cws_linux_x64_node79.node +0 -0
  21. package/dist/bindings/cws_linux_x64_node83.node +0 -0
  22. package/dist/bindings/cws_linux_x64_node93.node +0 -0
  23. package/dist/bindings/cws_win32_x64_node108.node +0 -0
  24. package/dist/bindings/cws_win32_x64_node64.node +0 -0
  25. package/dist/bindings/cws_win32_x64_node72.node +0 -0
  26. package/dist/bindings/cws_win32_x64_node79.node +0 -0
  27. package/dist/bindings/cws_win32_x64_node83.node +0 -0
  28. package/dist/bindings/cws_win32_x64_node93.node +0 -0
  29. package/dist/client.d.ts +1 -0
  30. package/dist/client.js +4 -0
  31. package/dist/index.js +3 -2
  32. package/dist/server.js +1 -0
  33. package/dist/shared.js +2 -1
  34. package/package.json +1 -1
  35. package/src/Addon.cpp +1 -0
  36. package/src/Addon.h +35 -2
  37. package/src/HTTPSocket.cpp +1 -1
  38. package/src/LICENSE +4 -0
  39. package/src/Socket.h +12 -3
  40. package/src/headers/{13 → 18}/aliased_buffer.h +61 -9
  41. package/src/headers/18/aliased_struct-inl.h +54 -0
  42. package/src/headers/18/aliased_struct.h +63 -0
  43. package/src/headers/{12 → 18}/async_wrap-inl.h +0 -0
  44. package/src/headers/{12 → 18}/async_wrap.h +26 -2
  45. package/src/headers/{12/base64.h → 18/base64-inl.h} +78 -86
  46. package/src/headers/18/base64.h +69 -0
  47. package/src/headers/{12 → 18}/base_object-inl.h +46 -25
  48. package/src/headers/{12 → 18}/base_object.h +82 -17
  49. package/src/headers/{12 → 18}/callback_queue-inl.h +9 -9
  50. package/src/headers/{12 → 18}/callback_queue.h +13 -5
  51. package/src/headers/18/cares_wrap.h +523 -0
  52. package/src/headers/{12 → 18}/connect_wrap.h +0 -0
  53. package/src/headers/{12 → 18}/connection_wrap.h +0 -0
  54. package/src/headers/18/crypto/crypto_aes.h +89 -0
  55. package/src/headers/{13/node_crypto_bio.h → 18/crypto/crypto_bio.h} +3 -4
  56. package/src/headers/18/crypto/crypto_cipher.h +291 -0
  57. package/src/headers/{13/node_crypto_clienthello-inl.h → 18/crypto/crypto_clienthello-inl.h} +4 -5
  58. package/src/headers/{13/node_crypto_clienthello.h → 18/crypto/crypto_clienthello.h} +3 -4
  59. package/src/headers/{12/node_crypto_common.h → 18/crypto/crypto_common.h} +49 -36
  60. package/src/headers/18/crypto/crypto_context.h +147 -0
  61. package/src/headers/18/crypto/crypto_dh.h +156 -0
  62. package/src/headers/18/crypto/crypto_dsa.h +77 -0
  63. package/src/headers/18/crypto/crypto_ec.h +170 -0
  64. package/src/headers/{12/node_crypto_groups.h → 18/crypto/crypto_groups.h} +3 -3
  65. package/src/headers/18/crypto/crypto_hash.h +89 -0
  66. package/src/headers/18/crypto/crypto_hkdf.h +65 -0
  67. package/src/headers/18/crypto/crypto_hmac.h +94 -0
  68. package/src/headers/18/crypto/crypto_keygen.h +305 -0
  69. package/src/headers/18/crypto/crypto_keys.h +420 -0
  70. package/src/headers/18/crypto/crypto_pbkdf2.h +76 -0
  71. package/src/headers/18/crypto/crypto_random.h +130 -0
  72. package/src/headers/18/crypto/crypto_rsa.h +141 -0
  73. package/src/headers/18/crypto/crypto_scrypt.h +87 -0
  74. package/src/headers/18/crypto/crypto_sig.h +168 -0
  75. package/src/headers/18/crypto/crypto_spkac.h +21 -0
  76. package/src/headers/18/crypto/crypto_timing.h +20 -0
  77. package/src/headers/{12/tls_wrap.h → 18/crypto/crypto_tls.h} +137 -66
  78. package/src/headers/18/crypto/crypto_util.h +791 -0
  79. package/src/headers/18/crypto/crypto_x509.h +143 -0
  80. package/src/headers/{12 → 18}/debug_utils-inl.h +0 -0
  81. package/src/headers/{13 → 18}/debug_utils.h +7 -4
  82. package/src/headers/{12 → 18}/diagnosticfilename-inl.h +0 -0
  83. package/src/headers/{12 → 18}/env-inl.h +397 -304
  84. package/src/headers/{12 → 18}/env.h +397 -172
  85. package/src/headers/{12 → 18}/handle_wrap.h +7 -3
  86. package/src/headers/18/histogram-inl.h +107 -0
  87. package/src/headers/18/histogram.h +239 -0
  88. package/src/headers/{13 → 18}/inspector_agent.h +4 -7
  89. package/src/headers/{12 → 18}/inspector_io.h +0 -0
  90. package/src/headers/{13 → 18}/inspector_profiler.h +17 -5
  91. package/src/headers/{12 → 18}/inspector_socket.h +0 -0
  92. package/src/headers/{12 → 18}/inspector_socket_server.h +0 -0
  93. package/src/headers/18/js_native_api.h +571 -0
  94. package/src/headers/{13 → 18}/js_native_api_types.h +30 -7
  95. package/src/headers/{12 → 18}/js_native_api_v8.h +220 -83
  96. package/src/headers/{12 → 18}/js_native_api_v8_internals.h +6 -5
  97. package/src/headers/{12 → 18}/js_stream.h +0 -0
  98. package/src/headers/{12 → 18}/json_utils.h +0 -0
  99. package/src/headers/{13 → 18}/memory_tracker-inl.h +6 -5
  100. package/src/headers/{13 → 18}/memory_tracker.h +0 -7
  101. package/src/headers/{13 → 18}/module_wrap.h +24 -7
  102. package/src/headers/{13 → 18}/node.h +329 -68
  103. package/src/headers/18/node_api.h +288 -0
  104. package/src/headers/18/node_api_internals.h +38 -0
  105. package/src/headers/{12 → 18}/node_api_types.h +12 -9
  106. package/src/headers/{12 → 18}/node_binding.h +0 -0
  107. package/src/headers/18/node_blob.h +191 -0
  108. package/src/headers/18/node_bob-inl.h +37 -0
  109. package/src/headers/18/node_bob.h +111 -0
  110. package/src/headers/{13 → 18}/node_buffer.h +0 -0
  111. package/src/headers/{13 → 18}/node_constants.h +5 -1
  112. package/src/headers/{12 → 18}/node_context_data.h +5 -0
  113. package/src/headers/{12 → 18}/node_contextify.h +37 -2
  114. package/src/headers/{10/node_javascript.h → 18/node_crypto.h} +30 -14
  115. package/src/headers/{12 → 18}/node_dir.h +0 -0
  116. package/src/headers/{12 → 18}/node_dtrace.h +0 -0
  117. package/src/headers/{12 → 18}/node_errors.h +90 -24
  118. package/src/headers/18/node_external_reference.h +145 -0
  119. package/src/headers/{13 → 18}/node_file-inl.h +38 -21
  120. package/src/headers/{12 → 18}/node_file.h +74 -13
  121. package/src/headers/{13 → 18}/node_http2.h +365 -269
  122. package/src/headers/{12 → 18}/node_http2_state.h +40 -50
  123. package/src/headers/{13 → 18}/node_http_common-inl.h +25 -5
  124. package/src/headers/{13 → 18}/node_http_common.h +24 -20
  125. package/src/headers/{13 → 18}/node_i18n.h +2 -1
  126. package/src/headers/{12 → 18}/node_internals.h +39 -41
  127. package/src/headers/{12 → 18}/node_main_instance.h +15 -18
  128. package/src/headers/{12 → 18}/node_mem-inl.h +0 -0
  129. package/src/headers/{12 → 18}/node_mem.h +1 -1
  130. package/src/headers/{13 → 18}/node_messaging.h +170 -23
  131. package/src/headers/{12 → 18}/node_metadata.h +17 -4
  132. package/src/headers/{12 → 18}/node_mutex.h +77 -1
  133. package/src/headers/{12 → 18}/node_native_module.h +11 -1
  134. package/src/headers/{12 → 18}/node_native_module_env.h +14 -8
  135. package/src/headers/{12 → 18}/node_object_wrap.h +0 -0
  136. package/src/headers/{13 → 18}/node_options-inl.h +51 -21
  137. package/src/headers/{13 → 18}/node_options.h +46 -14
  138. package/src/headers/18/node_perf.h +168 -0
  139. package/src/headers/{12 → 18}/node_perf_common.h +16 -22
  140. package/src/headers/{12 → 18}/node_platform.h +21 -16
  141. package/src/headers/18/node_process-inl.h +26 -0
  142. package/src/headers/18/node_process.h +97 -0
  143. package/src/headers/{13 → 18}/node_report.h +2 -2
  144. package/src/headers/{13 → 18}/node_revert.h +10 -0
  145. package/src/headers/{12 → 18}/node_root_certs.h +439 -651
  146. package/src/headers/18/node_snapshot_builder.h +43 -0
  147. package/src/headers/18/node_snapshotable.h +130 -0
  148. package/src/headers/{12 → 18}/node_sockaddr-inl.h +100 -4
  149. package/src/headers/18/node_sockaddr.h +405 -0
  150. package/src/headers/{13 → 18}/node_stat_watcher.h +7 -1
  151. package/src/headers/{12 → 18}/node_union_bytes.h +0 -0
  152. package/src/headers/{13 → 18}/node_url.h +18 -1
  153. package/src/headers/18/node_v8.h +41 -0
  154. package/src/headers/{12 → 18}/node_v8_platform-inl.h +10 -0
  155. package/src/headers/{13 → 18}/node_version.h +7 -7
  156. package/src/headers/{12 → 18}/node_wasi.h +0 -0
  157. package/src/headers/18/node_wasm_web_api.h +55 -0
  158. package/src/headers/{13 → 18}/node_watchdog.h +0 -0
  159. package/src/headers/{10 → 18}/node_win32_etw_provider-inl.h +7 -6
  160. package/src/headers/{10 → 18}/node_win32_etw_provider.h +0 -0
  161. package/src/headers/{13 → 18}/node_worker.h +24 -17
  162. package/src/headers/{12 → 18}/pipe_wrap.h +2 -0
  163. package/src/headers/{12 → 18}/req_wrap-inl.h +0 -0
  164. package/src/headers/{13 → 18}/req_wrap.h +1 -1
  165. package/src/headers/{12 → 18}/spawn_sync.h +0 -0
  166. package/src/headers/{13 → 18}/stream_base-inl.h +58 -22
  167. package/src/headers/{13 → 18}/stream_base.h +29 -3
  168. package/src/headers/{13 → 18}/stream_pipe.h +8 -3
  169. package/src/headers/{12 → 18}/stream_wrap.h +4 -1
  170. package/src/headers/{13 → 18}/string_bytes.h +0 -7
  171. package/src/headers/{12 → 18}/string_decoder-inl.h +0 -0
  172. package/src/headers/{10 → 18}/string_decoder.h +0 -0
  173. package/src/headers/{13 → 18}/string_search.h +2 -2
  174. package/src/headers/{12 → 18}/tcp_wrap.h +4 -0
  175. package/src/headers/{12 → 18}/threadpoolwork-inl.h +0 -0
  176. package/src/headers/18/timer_wrap-inl.h +32 -0
  177. package/src/headers/18/timer_wrap.h +85 -0
  178. package/src/headers/{13 → 18}/tracing/agent.h +1 -1
  179. package/src/headers/{12 → 18}/tracing/node_trace_buffer.h +0 -0
  180. package/src/headers/{12 → 18}/tracing/node_trace_writer.h +0 -0
  181. package/src/headers/{13 → 18}/tracing/trace_event.h +23 -13
  182. package/src/headers/{12 → 18}/tracing/trace_event_common.h +0 -0
  183. package/src/headers/{12 → 18}/tracing/traced_value.h +0 -0
  184. package/src/headers/{13 → 18}/tty_wrap.h +2 -1
  185. package/src/headers/{13 → 18}/udp_wrap.h +5 -0
  186. package/src/headers/{13 → 18}/util-inl.h +69 -15
  187. package/src/headers/{13 → 18}/util.h +93 -31
  188. package/src/headers/18/v8-fast-api-calls.h +939 -0
  189. package/src/headers/{12 → 18}/v8abbr.h +2 -2
  190. package/dist/bindings/cws_darwin_64.node +0 -0
  191. package/dist/bindings/cws_darwin_72.node +0 -0
  192. package/dist/bindings/cws_darwin_79.node +0 -0
  193. package/dist/bindings/cws_darwin_83.node +0 -0
  194. package/dist/bindings/cws_darwin_93.node +0 -0
  195. package/dist/bindings/cws_linux_64.node +0 -0
  196. package/dist/bindings/cws_linux_72.node +0 -0
  197. package/dist/bindings/cws_linux_79.node +0 -0
  198. package/dist/bindings/cws_linux_83.node +0 -0
  199. package/dist/bindings/cws_linux_93.node +0 -0
  200. package/dist/bindings/cws_win32_64.node +0 -0
  201. package/dist/bindings/cws_win32_72.node +0 -0
  202. package/dist/bindings/cws_win32_79.node +0 -0
  203. package/dist/bindings/cws_win32_83.node +0 -0
  204. package/dist/bindings/cws_win32_93.node +0 -0
  205. package/src/headers/10/aliased_buffer.h +0 -241
  206. package/src/headers/10/async_wrap-inl.h +0 -106
  207. package/src/headers/10/async_wrap.h +0 -218
  208. package/src/headers/10/base64.h +0 -197
  209. package/src/headers/10/base_object-inl.h +0 -132
  210. package/src/headers/10/base_object.h +0 -115
  211. package/src/headers/10/connect_wrap.h +0 -28
  212. package/src/headers/10/connection_wrap.h +0 -30
  213. package/src/headers/10/debug_utils.h +0 -128
  214. package/src/headers/10/env-inl.h +0 -906
  215. package/src/headers/10/env.h +0 -1046
  216. package/src/headers/10/handle_wrap.h +0 -114
  217. package/src/headers/10/inspector_agent.h +0 -137
  218. package/src/headers/10/inspector_io.h +0 -97
  219. package/src/headers/10/inspector_socket.h +0 -59
  220. package/src/headers/10/inspector_socket_server.h +0 -104
  221. package/src/headers/10/js_stream.h +0 -57
  222. package/src/headers/10/memory_tracker-inl.h +0 -318
  223. package/src/headers/10/memory_tracker.h +0 -246
  224. package/src/headers/10/module_wrap.h +0 -100
  225. package/src/headers/10/node.h +0 -863
  226. package/src/headers/10/node_api.h +0 -752
  227. package/src/headers/10/node_api_types.h +0 -171
  228. package/src/headers/10/node_buffer.h +0 -90
  229. package/src/headers/10/node_code_cache.h +0 -17
  230. package/src/headers/10/node_constants.h +0 -74
  231. package/src/headers/10/node_context_data.h +0 -39
  232. package/src/headers/10/node_contextify.h +0 -141
  233. package/src/headers/10/node_counters.h +0 -59
  234. package/src/headers/10/node_crypto.h +0 -699
  235. package/src/headers/10/node_crypto_bio.h +0 -177
  236. package/src/headers/10/node_crypto_clienthello-inl.h +0 -92
  237. package/src/headers/10/node_crypto_clienthello.h +0 -131
  238. package/src/headers/10/node_crypto_groups.h +0 -416
  239. package/src/headers/10/node_dtrace.h +0 -84
  240. package/src/headers/10/node_errors.h +0 -118
  241. package/src/headers/10/node_file.h +0 -373
  242. package/src/headers/10/node_http2.h +0 -1304
  243. package/src/headers/10/node_http2_state.h +0 -158
  244. package/src/headers/10/node_i18n.h +0 -69
  245. package/src/headers/10/node_internals.h +0 -952
  246. package/src/headers/10/node_messaging.h +0 -219
  247. package/src/headers/10/node_mutex.h +0 -191
  248. package/src/headers/10/node_object_wrap.h +0 -130
  249. package/src/headers/10/node_options-inl.h +0 -444
  250. package/src/headers/10/node_options.h +0 -397
  251. package/src/headers/10/node_perf.h +0 -134
  252. package/src/headers/10/node_perf_common.h +0 -96
  253. package/src/headers/10/node_persistent.h +0 -30
  254. package/src/headers/10/node_platform.h +0 -170
  255. package/src/headers/10/node_revert.h +0 -75
  256. package/src/headers/10/node_root_certs.h +0 -3393
  257. package/src/headers/10/node_stat_watcher.h +0 -65
  258. package/src/headers/10/node_url.h +0 -193
  259. package/src/headers/10/node_version.h +0 -120
  260. package/src/headers/10/node_watchdog.h +0 -114
  261. package/src/headers/10/node_win32_perfctr_provider.h +0 -58
  262. package/src/headers/10/node_worker.h +0 -94
  263. package/src/headers/10/pipe_wrap.h +0 -76
  264. package/src/headers/10/req_wrap-inl.h +0 -166
  265. package/src/headers/10/req_wrap.h +0 -61
  266. package/src/headers/10/sharedarraybuffer_metadata.h +0 -67
  267. package/src/headers/10/spawn_sync.h +0 -240
  268. package/src/headers/10/stream_base-inl.h +0 -458
  269. package/src/headers/10/stream_base.h +0 -378
  270. package/src/headers/10/stream_pipe.h +0 -72
  271. package/src/headers/10/stream_wrap.h +0 -130
  272. package/src/headers/10/string_bytes.h +0 -126
  273. package/src/headers/10/string_decoder-inl.h +0 -38
  274. package/src/headers/10/string_search.h +0 -620
  275. package/src/headers/10/tcp_wrap.h +0 -99
  276. package/src/headers/10/tls_wrap.h +0 -195
  277. package/src/headers/10/tracing/agent.h +0 -178
  278. package/src/headers/10/tracing/node_trace_buffer.h +0 -83
  279. package/src/headers/10/tracing/node_trace_writer.h +0 -75
  280. package/src/headers/10/tracing/trace_event.h +0 -706
  281. package/src/headers/10/tracing/trace_event_common.h +0 -1102
  282. package/src/headers/10/tracing/traced_value.h +0 -68
  283. package/src/headers/10/tty_wrap.h +0 -63
  284. package/src/headers/10/udp_wrap.h +0 -102
  285. package/src/headers/10/util-inl.h +0 -459
  286. package/src/headers/10/util.h +0 -508
  287. package/src/headers/10/v8abbr.h +0 -121
  288. package/src/headers/12/aliased_buffer.h +0 -263
  289. package/src/headers/12/debug_utils.h +0 -181
  290. package/src/headers/12/histogram-inl.h +0 -83
  291. package/src/headers/12/histogram.h +0 -98
  292. package/src/headers/12/http_parser_adaptor.h +0 -24
  293. package/src/headers/12/inspector_agent.h +0 -147
  294. package/src/headers/12/inspector_profiler.h +0 -137
  295. package/src/headers/12/js_native_api.h +0 -541
  296. package/src/headers/12/js_native_api_types.h +0 -139
  297. package/src/headers/12/memory_tracker-inl.h +0 -339
  298. package/src/headers/12/memory_tracker.h +0 -283
  299. package/src/headers/12/module_wrap.h +0 -99
  300. package/src/headers/12/node.h +0 -887
  301. package/src/headers/12/node_api.h +0 -239
  302. package/src/headers/12/node_buffer.h +0 -92
  303. package/src/headers/12/node_constants.h +0 -80
  304. package/src/headers/12/node_crypto.h +0 -800
  305. package/src/headers/12/node_crypto_bio.h +0 -195
  306. package/src/headers/12/node_crypto_clienthello-inl.h +0 -91
  307. package/src/headers/12/node_crypto_clienthello.h +0 -132
  308. package/src/headers/12/node_file-inl.h +0 -289
  309. package/src/headers/12/node_http2.h +0 -1311
  310. package/src/headers/12/node_http_parser_impl.h +0 -994
  311. package/src/headers/12/node_i18n.h +0 -144
  312. package/src/headers/12/node_messaging.h +0 -227
  313. package/src/headers/12/node_options-inl.h +0 -447
  314. package/src/headers/12/node_options.h +0 -479
  315. package/src/headers/12/node_perf.h +0 -181
  316. package/src/headers/12/node_process.h +0 -41
  317. package/src/headers/12/node_report.h +0 -47
  318. package/src/headers/12/node_revert.h +0 -78
  319. package/src/headers/12/node_sockaddr.h +0 -123
  320. package/src/headers/12/node_stat_watcher.h +0 -66
  321. package/src/headers/12/node_url.h +0 -188
  322. package/src/headers/12/node_version.h +0 -98
  323. package/src/headers/12/node_watchdog.h +0 -152
  324. package/src/headers/12/node_win32_etw_provider-inl.h +0 -287
  325. package/src/headers/12/node_win32_etw_provider.h +0 -99
  326. package/src/headers/12/node_worker.h +0 -142
  327. package/src/headers/12/req_wrap.h +0 -77
  328. package/src/headers/12/sharedarraybuffer_metadata.h +0 -72
  329. package/src/headers/12/stream_base-inl.h +0 -323
  330. package/src/headers/12/stream_base.h +0 -431
  331. package/src/headers/12/stream_pipe.h +0 -72
  332. package/src/headers/12/string_bytes.h +0 -142
  333. package/src/headers/12/string_decoder.h +0 -50
  334. package/src/headers/12/string_search.h +0 -638
  335. package/src/headers/12/tracing/agent.h +0 -195
  336. package/src/headers/12/tracing/trace_event.h +0 -710
  337. package/src/headers/12/tty_wrap.h +0 -64
  338. package/src/headers/12/udp_wrap.h +0 -222
  339. package/src/headers/12/util-inl.h +0 -529
  340. package/src/headers/12/util.h +0 -765
  341. package/src/headers/13/async_wrap-inl.h +0 -94
  342. package/src/headers/13/async_wrap.h +0 -224
  343. package/src/headers/13/base64.h +0 -197
  344. package/src/headers/13/base_object-inl.h +0 -353
  345. package/src/headers/13/base_object.h +0 -229
  346. package/src/headers/13/connect_wrap.h +0 -26
  347. package/src/headers/13/connection_wrap.h +0 -30
  348. package/src/headers/13/debug_utils-inl.h +0 -223
  349. package/src/headers/13/diagnosticfilename-inl.h +0 -33
  350. package/src/headers/13/env-inl.h +0 -1293
  351. package/src/headers/13/env.h +0 -1469
  352. package/src/headers/13/handle_wrap.h +0 -117
  353. package/src/headers/13/histogram-inl.h +0 -83
  354. package/src/headers/13/histogram.h +0 -98
  355. package/src/headers/13/inspector_io.h +0 -78
  356. package/src/headers/13/inspector_socket.h +0 -60
  357. package/src/headers/13/inspector_socket_server.h +0 -110
  358. package/src/headers/13/js_native_api.h +0 -541
  359. package/src/headers/13/js_native_api_v8.h +0 -303
  360. package/src/headers/13/js_native_api_v8_internals.h +0 -38
  361. package/src/headers/13/js_stream.h +0 -52
  362. package/src/headers/13/json_utils.h +0 -160
  363. package/src/headers/13/node_api.h +0 -239
  364. package/src/headers/13/node_api_types.h +0 -44
  365. package/src/headers/13/node_binding.h +0 -99
  366. package/src/headers/13/node_context_data.h +0 -39
  367. package/src/headers/13/node_contextify.h +0 -161
  368. package/src/headers/13/node_crypto.h +0 -800
  369. package/src/headers/13/node_crypto_common.h +0 -138
  370. package/src/headers/13/node_crypto_groups.h +0 -415
  371. package/src/headers/13/node_dir.h +0 -52
  372. package/src/headers/13/node_dtrace.h +0 -86
  373. package/src/headers/13/node_errors.h +0 -210
  374. package/src/headers/13/node_file.h +0 -364
  375. package/src/headers/13/node_http2_state.h +0 -144
  376. package/src/headers/13/node_internals.h +0 -405
  377. package/src/headers/13/node_main_instance.h +0 -97
  378. package/src/headers/13/node_mem-inl.h +0 -112
  379. package/src/headers/13/node_mem.h +0 -41
  380. package/src/headers/13/node_metadata.h +0 -109
  381. package/src/headers/13/node_mutex.h +0 -247
  382. package/src/headers/13/node_native_module.h +0 -99
  383. package/src/headers/13/node_native_module_env.h +0 -65
  384. package/src/headers/13/node_object_wrap.h +0 -132
  385. package/src/headers/13/node_perf.h +0 -181
  386. package/src/headers/13/node_perf_common.h +0 -97
  387. package/src/headers/13/node_platform.h +0 -190
  388. package/src/headers/13/node_process.h +0 -41
  389. package/src/headers/13/node_root_certs.h +0 -3424
  390. package/src/headers/13/node_sockaddr-inl.h +0 -170
  391. package/src/headers/13/node_sockaddr.h +0 -123
  392. package/src/headers/13/node_union_bytes.h +0 -103
  393. package/src/headers/13/node_v8_platform-inl.h +0 -184
  394. package/src/headers/13/node_wasi.h +0 -108
  395. package/src/headers/13/node_win32_etw_provider-inl.h +0 -287
  396. package/src/headers/13/node_win32_etw_provider.h +0 -99
  397. package/src/headers/13/pipe_wrap.h +0 -78
  398. package/src/headers/13/req_wrap-inl.h +0 -170
  399. package/src/headers/13/spawn_sync.h +0 -242
  400. package/src/headers/13/stream_wrap.h +0 -130
  401. package/src/headers/13/string_decoder-inl.h +0 -37
  402. package/src/headers/13/string_decoder.h +0 -50
  403. package/src/headers/13/tcp_wrap.h +0 -101
  404. package/src/headers/13/threadpoolwork-inl.h +0 -57
  405. package/src/headers/13/tls_wrap.h +0 -221
  406. package/src/headers/13/tracing/node_trace_buffer.h +0 -83
  407. package/src/headers/13/tracing/node_trace_writer.h +0 -75
  408. package/src/headers/13/tracing/trace_event_common.h +0 -1109
  409. package/src/headers/13/tracing/traced_value.h +0 -70
  410. package/src/headers/13/v8abbr.h +0 -124
@@ -1,952 +0,0 @@
1
- // Copyright Joyent, Inc. and other Node contributors.
2
- //
3
- // Permission is hereby granted, free of charge, to any person obtaining a
4
- // copy of this software and associated documentation files (the
5
- // "Software"), to deal in the Software without restriction, including
6
- // without limitation the rights to use, copy, modify, merge, publish,
7
- // distribute, sublicense, and/or sell copies of the Software, and to permit
8
- // persons to whom the Software is furnished to do so, subject to the
9
- // following conditions:
10
- //
11
- // The above copyright notice and this permission notice shall be included
12
- // in all copies or substantial portions of the Software.
13
- //
14
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
-
22
- #ifndef SRC_NODE_INTERNALS_H_
23
- #define SRC_NODE_INTERNALS_H_
24
-
25
- #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
26
-
27
- #include "node.h"
28
- #include "node_mutex.h"
29
- #include "node_persistent.h"
30
- #include "util-inl.h"
31
- #include "env-inl.h"
32
- #include "uv.h"
33
- #include "v8.h"
34
- #include "tracing/trace_event.h"
35
- #include "node_perf_common.h"
36
- #include "node_api.h"
37
-
38
- #include <stdint.h>
39
- #include <stdlib.h>
40
-
41
- #include <string>
42
- #include <vector>
43
-
44
- // Custom constants used by both node_constants.cc and node_zlib.cc
45
- #define Z_MIN_WINDOWBITS 8
46
- #define Z_MAX_WINDOWBITS 15
47
- #define Z_DEFAULT_WINDOWBITS 15
48
- // Fewer than 64 bytes per chunk is not recommended.
49
- // Technically it could work with as few as 8, but even 64 bytes
50
- // is low. Usually a MB or more is best.
51
- #define Z_MIN_CHUNK 64
52
- #define Z_MAX_CHUNK std::numeric_limits<double>::infinity()
53
- #define Z_DEFAULT_CHUNK (16 * 1024)
54
- #define Z_MIN_MEMLEVEL 1
55
- #define Z_MAX_MEMLEVEL 9
56
- #define Z_DEFAULT_MEMLEVEL 8
57
- #define Z_MIN_LEVEL -1
58
- #define Z_MAX_LEVEL 9
59
- #define Z_DEFAULT_LEVEL Z_DEFAULT_COMPRESSION
60
-
61
- enum {
62
- NM_F_BUILTIN = 1 << 0,
63
- NM_F_LINKED = 1 << 1,
64
- NM_F_INTERNAL = 1 << 2,
65
- };
66
-
67
- struct sockaddr;
68
-
69
- // Variation on NODE_DEFINE_CONSTANT that sets a String value.
70
- #define NODE_DEFINE_STRING_CONSTANT(target, name, constant) \
71
- do { \
72
- v8::Isolate* isolate = target->GetIsolate(); \
73
- v8::Local<v8::String> constant_name = \
74
- v8::String::NewFromUtf8(isolate, name, v8::NewStringType::kNormal) \
75
- .ToLocalChecked(); \
76
- v8::Local<v8::String> constant_value = \
77
- v8::String::NewFromUtf8(isolate, constant, v8::NewStringType::kNormal)\
78
- .ToLocalChecked(); \
79
- v8::PropertyAttribute constant_attributes = \
80
- static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); \
81
- target->DefineOwnProperty(isolate->GetCurrentContext(), \
82
- constant_name, \
83
- constant_value, \
84
- constant_attributes).FromJust(); \
85
- } while (0)
86
-
87
-
88
- #if HAVE_OPENSSL
89
- #define NODE_BUILTIN_OPENSSL_MODULES(V) V(crypto) V(tls_wrap)
90
- #else
91
- #define NODE_BUILTIN_OPENSSL_MODULES(V)
92
- #endif
93
-
94
- #if NODE_HAVE_I18N_SUPPORT
95
- #define NODE_BUILTIN_ICU_MODULES(V) V(icu)
96
- #else
97
- #define NODE_BUILTIN_ICU_MODULES(V)
98
- #endif
99
-
100
- // A list of built-in modules. In order to do module registration
101
- // in node::Init(), need to add built-in modules in the following list.
102
- // Then in node::RegisterBuiltinModules(), it calls modules' registration
103
- // function. This helps the built-in modules are loaded properly when
104
- // node is built as static library. No need to depend on the
105
- // __attribute__((constructor)) like mechanism in GCC.
106
- #define NODE_BUILTIN_STANDARD_MODULES(V) \
107
- V(async_wrap) \
108
- V(buffer) \
109
- V(cares_wrap) \
110
- V(config) \
111
- V(contextify) \
112
- V(domain) \
113
- V(fs) \
114
- V(fs_event_wrap) \
115
- V(heap_utils) \
116
- V(http2) \
117
- V(http_parser) \
118
- V(inspector) \
119
- V(js_stream) \
120
- V(messaging) \
121
- V(module_wrap) \
122
- V(options) \
123
- V(os) \
124
- V(performance) \
125
- V(pipe_wrap) \
126
- V(process_wrap) \
127
- V(serdes) \
128
- V(signal_wrap) \
129
- V(spawn_sync) \
130
- V(stream_pipe) \
131
- V(stream_wrap) \
132
- V(string_decoder) \
133
- V(symbols) \
134
- V(tcp_wrap) \
135
- V(timer_wrap) \
136
- V(trace_events) \
137
- V(tty_wrap) \
138
- V(types) \
139
- V(udp_wrap) \
140
- V(url) \
141
- V(util) \
142
- V(uv) \
143
- V(v8) \
144
- V(worker) \
145
- V(zlib)
146
-
147
- #define NODE_BUILTIN_MODULES(V) \
148
- NODE_BUILTIN_STANDARD_MODULES(V) \
149
- NODE_BUILTIN_OPENSSL_MODULES(V) \
150
- NODE_BUILTIN_ICU_MODULES(V)
151
-
152
- #define NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, priv, flags) \
153
- static node::node_module _module = { \
154
- NODE_MODULE_VERSION, \
155
- flags, \
156
- nullptr, \
157
- __FILE__, \
158
- nullptr, \
159
- (node::addon_context_register_func) (regfunc), \
160
- NODE_STRINGIFY(modname), \
161
- priv, \
162
- nullptr \
163
- }; \
164
- void _register_ ## modname() { \
165
- node_module_register(&_module); \
166
- }
167
-
168
-
169
- #define NODE_BUILTIN_MODULE_CONTEXT_AWARE(modname, regfunc) \
170
- NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, nullptr, NM_F_BUILTIN)
171
-
172
- namespace node {
173
-
174
- extern Mutex process_mutex;
175
- extern Mutex environ_mutex;
176
-
177
- // Tells whether it is safe to call v8::Isolate::GetCurrent().
178
- extern bool v8_initialized;
179
-
180
- extern Mutex per_process_opts_mutex;
181
- extern std::shared_ptr<PerProcessOptions> per_process_opts;
182
-
183
- // Forward declaration
184
- class Environment;
185
-
186
- // If persistent.IsWeak() == false, then do not call persistent.Reset()
187
- // while the returned Local<T> is still in scope, it will destroy the
188
- // reference to the object.
189
- template <class TypeName>
190
- inline v8::Local<TypeName> PersistentToLocal(
191
- v8::Isolate* isolate,
192
- const Persistent<TypeName>& persistent);
193
-
194
- // Convert a struct sockaddr to a { address: '1.2.3.4', port: 1234 } JS object.
195
- // Sets address and port properties on the info object and returns it.
196
- // If |info| is omitted, a new object is returned.
197
- v8::Local<v8::Object> AddressToJS(
198
- Environment* env,
199
- const sockaddr* addr,
200
- v8::Local<v8::Object> info = v8::Local<v8::Object>());
201
-
202
- template <typename T, int (*F)(const typename T::HandleType*, sockaddr*, int*)>
203
- void GetSockOrPeerName(const v8::FunctionCallbackInfo<v8::Value>& args) {
204
- T* wrap;
205
- ASSIGN_OR_RETURN_UNWRAP(&wrap,
206
- args.Holder(),
207
- args.GetReturnValue().Set(UV_EBADF));
208
- CHECK(args[0]->IsObject());
209
- sockaddr_storage storage;
210
- int addrlen = sizeof(storage);
211
- sockaddr* const addr = reinterpret_cast<sockaddr*>(&storage);
212
- const int err = F(&wrap->handle_, addr, &addrlen);
213
- if (err == 0)
214
- AddressToJS(wrap->env(), addr, args[0].As<v8::Object>());
215
- args.GetReturnValue().Set(err);
216
- }
217
-
218
- void FatalException(v8::Isolate* isolate,
219
- v8::Local<v8::Value> error,
220
- v8::Local<v8::Message> message);
221
-
222
-
223
- void SignalExit(int signo);
224
- #ifdef __POSIX__
225
- void RegisterSignalHandler(int signal,
226
- void (*handler)(int signal),
227
- bool reset_handler = false);
228
- #endif
229
-
230
- bool SafeGetenv(const char* key, std::string* text);
231
-
232
- std::string GetHumanReadableProcessName();
233
- void GetHumanReadableProcessName(char (*name)[1024]);
234
-
235
- template <typename T, size_t N>
236
- constexpr size_t arraysize(const T(&)[N]) { return N; }
237
-
238
- #ifndef ROUND_UP
239
- # define ROUND_UP(a, b) ((a) % (b) ? ((a) + (b)) - ((a) % (b)) : (a))
240
- #endif
241
-
242
- #ifdef __GNUC__
243
- # define MUST_USE_RESULT __attribute__((warn_unused_result))
244
- #else
245
- # define MUST_USE_RESULT
246
- #endif
247
-
248
- bool IsExceptionDecorated(Environment* env, v8::Local<v8::Value> er);
249
-
250
- enum ErrorHandlingMode { CONTEXTIFY_ERROR, FATAL_ERROR, MODULE_ERROR };
251
- void AppendExceptionLine(Environment* env,
252
- v8::Local<v8::Value> er,
253
- v8::Local<v8::Message> message,
254
- enum ErrorHandlingMode mode);
255
-
256
- [[noreturn]] void FatalError(const char* location, const char* message);
257
-
258
- // Like a `TryCatch` but exits the process if an exception was caught.
259
- class FatalTryCatch : public v8::TryCatch {
260
- public:
261
- explicit FatalTryCatch(Environment* env)
262
- : TryCatch(env->isolate()), env_(env) {}
263
- ~FatalTryCatch();
264
-
265
- private:
266
- Environment* env_;
267
- };
268
-
269
- class SlicedArguments {
270
- public:
271
- inline explicit SlicedArguments(
272
- const v8::FunctionCallbackInfo<v8::Value>& args,
273
- size_t start = 0);
274
- inline size_t size() const { return size_; }
275
- inline v8::Local<v8::Value>* data() { return data_; }
276
-
277
- private:
278
- size_t size_;
279
- v8::Local<v8::Value>* data_;
280
- v8::Local<v8::Value> fixed_[64];
281
- std::vector<v8::Local<v8::Value>> dynamic_;
282
- };
283
-
284
- SlicedArguments::SlicedArguments(
285
- const v8::FunctionCallbackInfo<v8::Value>& args,
286
- size_t start) : size_(0), data_(fixed_) {
287
- const size_t length = static_cast<size_t>(args.Length());
288
- if (start >= length) return;
289
- const size_t size = length - start;
290
-
291
- if (size > arraysize(fixed_)) {
292
- dynamic_.resize(size);
293
- data_ = dynamic_.data();
294
- }
295
-
296
- for (size_t i = 0; i < size; ++i)
297
- data_[i] = args[i + start];
298
-
299
- size_ = size;
300
- }
301
-
302
- void ReportException(Environment* env,
303
- v8::Local<v8::Value> er,
304
- v8::Local<v8::Message> message);
305
-
306
- v8::Maybe<bool> ProcessEmitWarning(Environment* env, const char* fmt, ...);
307
- v8::Maybe<bool> ProcessEmitDeprecationWarning(Environment* env,
308
- const char* warning,
309
- const char* deprecation_code);
310
-
311
- template <typename NativeT, typename V8T>
312
- v8::Local<v8::Value> FillStatsArray(AliasedBuffer<NativeT, V8T>* fields_ptr,
313
- const uv_stat_t* s, int offset = 0) {
314
- AliasedBuffer<NativeT, V8T>& fields = *fields_ptr;
315
- fields[offset + 0] = s->st_dev;
316
- fields[offset + 1] = s->st_mode;
317
- fields[offset + 2] = s->st_nlink;
318
- fields[offset + 3] = s->st_uid;
319
- fields[offset + 4] = s->st_gid;
320
- fields[offset + 5] = s->st_rdev;
321
- #if defined(__POSIX__)
322
- fields[offset + 6] = s->st_blksize;
323
- #else
324
- fields[offset + 6] = 0;
325
- #endif
326
- fields[offset + 7] = s->st_ino;
327
- fields[offset + 8] = s->st_size;
328
- #if defined(__POSIX__)
329
- fields[offset + 9] = s->st_blocks;
330
- #else
331
- fields[offset + 9] = 0;
332
- #endif
333
- // Dates.
334
- // NO-LINT because the fields are 'long' and we just want to cast to `unsigned`
335
- #define X(idx, name) \
336
- /* NOLINTNEXTLINE(runtime/int) */ \
337
- fields[offset + idx] = ((unsigned long)(s->st_##name.tv_sec) * 1e3) + \
338
- /* NOLINTNEXTLINE(runtime/int) */ \
339
- ((unsigned long)(s->st_##name.tv_nsec) / 1e6); \
340
-
341
- X(10, atim)
342
- X(11, mtim)
343
- X(12, ctim)
344
- X(13, birthtim)
345
- #undef X
346
-
347
- return fields_ptr->GetJSArray();
348
- }
349
-
350
- inline v8::Local<v8::Value> FillGlobalStatsArray(Environment* env,
351
- const uv_stat_t* s,
352
- bool use_bigint = false,
353
- int offset = 0) {
354
- if (use_bigint) {
355
- return node::FillStatsArray(
356
- env->fs_stats_field_bigint_array(), s, offset);
357
- } else {
358
- return node::FillStatsArray(env->fs_stats_field_array(), s, offset);
359
- }
360
- }
361
-
362
- void SetupBootstrapObject(Environment* env,
363
- v8::Local<v8::Object> bootstrapper);
364
- void SetupProcessObject(Environment* env,
365
- const std::vector<std::string>& args,
366
- const std::vector<std::string>& exec_args);
367
-
368
- // Call _register<module_name> functions for all of
369
- // the built-in modules. Because built-in modules don't
370
- // use the __attribute__((constructor)). Need to
371
- // explicitly call the _register* functions.
372
- void RegisterBuiltinModules();
373
-
374
- enum Endianness {
375
- kLittleEndian, // _Not_ LITTLE_ENDIAN, clashes with endian.h.
376
- kBigEndian
377
- };
378
-
379
- inline enum Endianness GetEndianness() {
380
- // Constant-folded by the compiler.
381
- const union {
382
- uint8_t u8[2];
383
- uint16_t u16;
384
- } u = {
385
- { 1, 0 }
386
- };
387
- return u.u16 == 1 ? kLittleEndian : kBigEndian;
388
- }
389
-
390
- inline bool IsLittleEndian() {
391
- return GetEndianness() == kLittleEndian;
392
- }
393
-
394
- inline bool IsBigEndian() {
395
- return GetEndianness() == kBigEndian;
396
- }
397
-
398
- class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
399
- public:
400
- inline uint32_t* zero_fill_field() { return &zero_fill_field_; }
401
-
402
- virtual void* Allocate(size_t size); // Defined in src/node.cc
403
- virtual void* AllocateUninitialized(size_t size)
404
- { return node::UncheckedMalloc(size); }
405
- virtual void Free(void* data, size_t) { free(data); }
406
-
407
- private:
408
- uint32_t zero_fill_field_ = 1; // Boolean but exposed as uint32 to JS land.
409
- };
410
-
411
- namespace Buffer {
412
- v8::MaybeLocal<v8::Object> Copy(Environment* env, const char* data, size_t len);
413
- v8::MaybeLocal<v8::Object> New(Environment* env, size_t size);
414
- // Takes ownership of |data|.
415
- v8::MaybeLocal<v8::Object> New(Environment* env,
416
- char* data,
417
- size_t length,
418
- void (*callback)(char* data, void* hint),
419
- void* hint);
420
- // Takes ownership of |data|. Must allocate |data| with malloc() or realloc()
421
- // because ArrayBufferAllocator::Free() deallocates it again with free().
422
- // Mixing operator new and free() is undefined behavior so don't do that.
423
- v8::MaybeLocal<v8::Object> New(Environment* env, char* data, size_t length);
424
-
425
- inline
426
- v8::MaybeLocal<v8::Uint8Array> New(Environment* env,
427
- v8::Local<v8::ArrayBuffer> ab,
428
- size_t byte_offset,
429
- size_t length) {
430
- v8::Local<v8::Uint8Array> ui = v8::Uint8Array::New(ab, byte_offset, length);
431
- v8::Maybe<bool> mb =
432
- ui->SetPrototype(env->context(), env->buffer_prototype_object());
433
- if (mb.IsNothing())
434
- return v8::MaybeLocal<v8::Uint8Array>();
435
- return ui;
436
- }
437
-
438
- // Construct a Buffer from a MaybeStackBuffer (and also its subclasses like
439
- // Utf8Value and TwoByteValue).
440
- // If |buf| is invalidated, an empty MaybeLocal is returned, and nothing is
441
- // changed.
442
- // If |buf| contains actual data, this method takes ownership of |buf|'s
443
- // underlying buffer. However, |buf| itself can be reused even after this call,
444
- // but its capacity, if increased through AllocateSufficientStorage, is not
445
- // guaranteed to stay the same.
446
- template <typename T>
447
- static v8::MaybeLocal<v8::Object> New(Environment* env,
448
- MaybeStackBuffer<T>* buf) {
449
- v8::MaybeLocal<v8::Object> ret;
450
- char* src = reinterpret_cast<char*>(buf->out());
451
- const size_t len_in_bytes = buf->length() * sizeof(buf->out()[0]);
452
-
453
- if (buf->IsAllocated())
454
- ret = New(env, src, len_in_bytes);
455
- else if (!buf->IsInvalidated())
456
- ret = Copy(env, src, len_in_bytes);
457
-
458
- if (ret.IsEmpty())
459
- return ret;
460
-
461
- if (buf->IsAllocated())
462
- buf->Release();
463
-
464
- return ret;
465
- }
466
- } // namespace Buffer
467
-
468
- v8::MaybeLocal<v8::Value> InternalMakeCallback(
469
- Environment* env,
470
- v8::Local<v8::Object> recv,
471
- const v8::Local<v8::Function> callback,
472
- int argc,
473
- v8::Local<v8::Value> argv[],
474
- async_context asyncContext);
475
-
476
- class InternalCallbackScope {
477
- public:
478
- // Tell the constructor whether its `object` parameter may be empty or not.
479
- enum ResourceExpectation { kRequireResource, kAllowEmptyResource };
480
- InternalCallbackScope(Environment* env,
481
- v8::Local<v8::Object> object,
482
- const async_context& asyncContext,
483
- ResourceExpectation expect = kRequireResource);
484
- // Utility that can be used by AsyncWrap classes.
485
- explicit InternalCallbackScope(AsyncWrap* async_wrap);
486
- ~InternalCallbackScope();
487
- void Close();
488
-
489
- inline bool Failed() const { return failed_; }
490
- inline void MarkAsFailed() { failed_ = true; }
491
-
492
- private:
493
- Environment* env_;
494
- async_context async_context_;
495
- v8::Local<v8::Object> object_;
496
- Environment::AsyncCallbackScope callback_scope_;
497
- bool failed_ = false;
498
- bool pushed_ids_ = false;
499
- bool closed_ = false;
500
- };
501
-
502
- class ThreadPoolWork {
503
- public:
504
- explicit inline ThreadPoolWork(Environment* env) : env_(env) {
505
- CHECK_NOT_NULL(env);
506
- }
507
- inline virtual ~ThreadPoolWork() = default;
508
-
509
- inline void ScheduleWork();
510
- inline int CancelWork();
511
-
512
- virtual void DoThreadPoolWork() = 0;
513
- virtual void AfterThreadPoolWork(int status) = 0;
514
-
515
- private:
516
- Environment* env_;
517
- uv_work_t work_req_;
518
- };
519
-
520
- void ThreadPoolWork::ScheduleWork() {
521
- env_->IncreaseWaitingRequestCounter();
522
- int status = uv_queue_work(
523
- env_->event_loop(),
524
- &work_req_,
525
- [](uv_work_t* req) {
526
- ThreadPoolWork* self = ContainerOf(&ThreadPoolWork::work_req_, req);
527
- self->DoThreadPoolWork();
528
- },
529
- [](uv_work_t* req, int status) {
530
- ThreadPoolWork* self = ContainerOf(&ThreadPoolWork::work_req_, req);
531
- self->env_->DecreaseWaitingRequestCounter();
532
- self->AfterThreadPoolWork(status);
533
- });
534
- CHECK_EQ(status, 0);
535
- }
536
-
537
- int ThreadPoolWork::CancelWork() {
538
- return uv_cancel(reinterpret_cast<uv_req_t*>(&work_req_));
539
- }
540
-
541
- void DisposePlatform();
542
-
543
- static inline const char* errno_string(int errorno) {
544
- #define ERRNO_CASE(e) case e: return #e;
545
- switch (errorno) {
546
- #ifdef EACCES
547
- ERRNO_CASE(EACCES);
548
- #endif
549
-
550
- #ifdef EADDRINUSE
551
- ERRNO_CASE(EADDRINUSE);
552
- #endif
553
-
554
- #ifdef EADDRNOTAVAIL
555
- ERRNO_CASE(EADDRNOTAVAIL);
556
- #endif
557
-
558
- #ifdef EAFNOSUPPORT
559
- ERRNO_CASE(EAFNOSUPPORT);
560
- #endif
561
-
562
- #ifdef EAGAIN
563
- ERRNO_CASE(EAGAIN);
564
- #endif
565
-
566
- #ifdef EWOULDBLOCK
567
- # if EAGAIN != EWOULDBLOCK
568
- ERRNO_CASE(EWOULDBLOCK);
569
- # endif
570
- #endif
571
-
572
- #ifdef EALREADY
573
- ERRNO_CASE(EALREADY);
574
- #endif
575
-
576
- #ifdef EBADF
577
- ERRNO_CASE(EBADF);
578
- #endif
579
-
580
- #ifdef EBADMSG
581
- ERRNO_CASE(EBADMSG);
582
- #endif
583
-
584
- #ifdef EBUSY
585
- ERRNO_CASE(EBUSY);
586
- #endif
587
-
588
- #ifdef ECANCELED
589
- ERRNO_CASE(ECANCELED);
590
- #endif
591
-
592
- #ifdef ECHILD
593
- ERRNO_CASE(ECHILD);
594
- #endif
595
-
596
- #ifdef ECONNABORTED
597
- ERRNO_CASE(ECONNABORTED);
598
- #endif
599
-
600
- #ifdef ECONNREFUSED
601
- ERRNO_CASE(ECONNREFUSED);
602
- #endif
603
-
604
- #ifdef ECONNRESET
605
- ERRNO_CASE(ECONNRESET);
606
- #endif
607
-
608
- #ifdef EDEADLK
609
- ERRNO_CASE(EDEADLK);
610
- #endif
611
-
612
- #ifdef EDESTADDRREQ
613
- ERRNO_CASE(EDESTADDRREQ);
614
- #endif
615
-
616
- #ifdef EDOM
617
- ERRNO_CASE(EDOM);
618
- #endif
619
-
620
- #ifdef EDQUOT
621
- ERRNO_CASE(EDQUOT);
622
- #endif
623
-
624
- #ifdef EEXIST
625
- ERRNO_CASE(EEXIST);
626
- #endif
627
-
628
- #ifdef EFAULT
629
- ERRNO_CASE(EFAULT);
630
- #endif
631
-
632
- #ifdef EFBIG
633
- ERRNO_CASE(EFBIG);
634
- #endif
635
-
636
- #ifdef EHOSTUNREACH
637
- ERRNO_CASE(EHOSTUNREACH);
638
- #endif
639
-
640
- #ifdef EIDRM
641
- ERRNO_CASE(EIDRM);
642
- #endif
643
-
644
- #ifdef EILSEQ
645
- ERRNO_CASE(EILSEQ);
646
- #endif
647
-
648
- #ifdef EINPROGRESS
649
- ERRNO_CASE(EINPROGRESS);
650
- #endif
651
-
652
- #ifdef EINTR
653
- ERRNO_CASE(EINTR);
654
- #endif
655
-
656
- #ifdef EINVAL
657
- ERRNO_CASE(EINVAL);
658
- #endif
659
-
660
- #ifdef EIO
661
- ERRNO_CASE(EIO);
662
- #endif
663
-
664
- #ifdef EISCONN
665
- ERRNO_CASE(EISCONN);
666
- #endif
667
-
668
- #ifdef EISDIR
669
- ERRNO_CASE(EISDIR);
670
- #endif
671
-
672
- #ifdef ELOOP
673
- ERRNO_CASE(ELOOP);
674
- #endif
675
-
676
- #ifdef EMFILE
677
- ERRNO_CASE(EMFILE);
678
- #endif
679
-
680
- #ifdef EMLINK
681
- ERRNO_CASE(EMLINK);
682
- #endif
683
-
684
- #ifdef EMSGSIZE
685
- ERRNO_CASE(EMSGSIZE);
686
- #endif
687
-
688
- #ifdef EMULTIHOP
689
- ERRNO_CASE(EMULTIHOP);
690
- #endif
691
-
692
- #ifdef ENAMETOOLONG
693
- ERRNO_CASE(ENAMETOOLONG);
694
- #endif
695
-
696
- #ifdef ENETDOWN
697
- ERRNO_CASE(ENETDOWN);
698
- #endif
699
-
700
- #ifdef ENETRESET
701
- ERRNO_CASE(ENETRESET);
702
- #endif
703
-
704
- #ifdef ENETUNREACH
705
- ERRNO_CASE(ENETUNREACH);
706
- #endif
707
-
708
- #ifdef ENFILE
709
- ERRNO_CASE(ENFILE);
710
- #endif
711
-
712
- #ifdef ENOBUFS
713
- ERRNO_CASE(ENOBUFS);
714
- #endif
715
-
716
- #ifdef ENODATA
717
- ERRNO_CASE(ENODATA);
718
- #endif
719
-
720
- #ifdef ENODEV
721
- ERRNO_CASE(ENODEV);
722
- #endif
723
-
724
- #ifdef ENOENT
725
- ERRNO_CASE(ENOENT);
726
- #endif
727
-
728
- #ifdef ENOEXEC
729
- ERRNO_CASE(ENOEXEC);
730
- #endif
731
-
732
- #ifdef ENOLINK
733
- ERRNO_CASE(ENOLINK);
734
- #endif
735
-
736
- #ifdef ENOLCK
737
- # if ENOLINK != ENOLCK
738
- ERRNO_CASE(ENOLCK);
739
- # endif
740
- #endif
741
-
742
- #ifdef ENOMEM
743
- ERRNO_CASE(ENOMEM);
744
- #endif
745
-
746
- #ifdef ENOMSG
747
- ERRNO_CASE(ENOMSG);
748
- #endif
749
-
750
- #ifdef ENOPROTOOPT
751
- ERRNO_CASE(ENOPROTOOPT);
752
- #endif
753
-
754
- #ifdef ENOSPC
755
- ERRNO_CASE(ENOSPC);
756
- #endif
757
-
758
- #ifdef ENOSR
759
- ERRNO_CASE(ENOSR);
760
- #endif
761
-
762
- #ifdef ENOSTR
763
- ERRNO_CASE(ENOSTR);
764
- #endif
765
-
766
- #ifdef ENOSYS
767
- ERRNO_CASE(ENOSYS);
768
- #endif
769
-
770
- #ifdef ENOTCONN
771
- ERRNO_CASE(ENOTCONN);
772
- #endif
773
-
774
- #ifdef ENOTDIR
775
- ERRNO_CASE(ENOTDIR);
776
- #endif
777
-
778
- #ifdef ENOTEMPTY
779
- # if ENOTEMPTY != EEXIST
780
- ERRNO_CASE(ENOTEMPTY);
781
- # endif
782
- #endif
783
-
784
- #ifdef ENOTSOCK
785
- ERRNO_CASE(ENOTSOCK);
786
- #endif
787
-
788
- #ifdef ENOTSUP
789
- ERRNO_CASE(ENOTSUP);
790
- #else
791
- # ifdef EOPNOTSUPP
792
- ERRNO_CASE(EOPNOTSUPP);
793
- # endif
794
- #endif
795
-
796
- #ifdef ENOTTY
797
- ERRNO_CASE(ENOTTY);
798
- #endif
799
-
800
- #ifdef ENXIO
801
- ERRNO_CASE(ENXIO);
802
- #endif
803
-
804
-
805
- #ifdef EOVERFLOW
806
- ERRNO_CASE(EOVERFLOW);
807
- #endif
808
-
809
- #ifdef EPERM
810
- ERRNO_CASE(EPERM);
811
- #endif
812
-
813
- #ifdef EPIPE
814
- ERRNO_CASE(EPIPE);
815
- #endif
816
-
817
- #ifdef EPROTO
818
- ERRNO_CASE(EPROTO);
819
- #endif
820
-
821
- #ifdef EPROTONOSUPPORT
822
- ERRNO_CASE(EPROTONOSUPPORT);
823
- #endif
824
-
825
- #ifdef EPROTOTYPE
826
- ERRNO_CASE(EPROTOTYPE);
827
- #endif
828
-
829
- #ifdef ERANGE
830
- ERRNO_CASE(ERANGE);
831
- #endif
832
-
833
- #ifdef EROFS
834
- ERRNO_CASE(EROFS);
835
- #endif
836
-
837
- #ifdef ESPIPE
838
- ERRNO_CASE(ESPIPE);
839
- #endif
840
-
841
- #ifdef ESRCH
842
- ERRNO_CASE(ESRCH);
843
- #endif
844
-
845
- #ifdef ESTALE
846
- ERRNO_CASE(ESTALE);
847
- #endif
848
-
849
- #ifdef ETIME
850
- ERRNO_CASE(ETIME);
851
- #endif
852
-
853
- #ifdef ETIMEDOUT
854
- ERRNO_CASE(ETIMEDOUT);
855
- #endif
856
-
857
- #ifdef ETXTBSY
858
- ERRNO_CASE(ETXTBSY);
859
- #endif
860
-
861
- #ifdef EXDEV
862
- ERRNO_CASE(EXDEV);
863
- #endif
864
-
865
- default: return "";
866
- }
867
- }
868
-
869
- #define NODE_MODULE_CONTEXT_AWARE_INTERNAL(modname, regfunc) \
870
- NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, nullptr, NM_F_INTERNAL)
871
-
872
- #define TRACING_CATEGORY_NODE "node"
873
- #define TRACING_CATEGORY_NODE1(one) \
874
- TRACING_CATEGORY_NODE "," \
875
- TRACING_CATEGORY_NODE "." #one
876
- #define TRACING_CATEGORY_NODE2(one, two) \
877
- TRACING_CATEGORY_NODE "," \
878
- TRACING_CATEGORY_NODE "." #one "," \
879
- TRACING_CATEGORY_NODE "." #one "." #two
880
-
881
- // Functions defined in node.cc that are exposed via the bootstrapper object
882
-
883
- extern double prog_start_time;
884
- void PrintErrorString(const char* format, ...);
885
-
886
- void Abort(const v8::FunctionCallbackInfo<v8::Value>& args);
887
- void Chdir(const v8::FunctionCallbackInfo<v8::Value>& args);
888
- void CPUUsage(const v8::FunctionCallbackInfo<v8::Value>& args);
889
- void Cwd(const v8::FunctionCallbackInfo<v8::Value>& args);
890
- void GetActiveHandles(const v8::FunctionCallbackInfo<v8::Value>& args);
891
- void GetActiveRequests(const v8::FunctionCallbackInfo<v8::Value>& args);
892
- void Hrtime(const v8::FunctionCallbackInfo<v8::Value>& args);
893
- void HrtimeBigInt(const v8::FunctionCallbackInfo<v8::Value>& args);
894
- void Kill(const v8::FunctionCallbackInfo<v8::Value>& args);
895
- void MemoryUsage(const v8::FunctionCallbackInfo<v8::Value>& args);
896
- void RawDebug(const v8::FunctionCallbackInfo<v8::Value>& args);
897
- void StartProfilerIdleNotifier(const v8::FunctionCallbackInfo<v8::Value>& args);
898
- void StopProfilerIdleNotifier(const v8::FunctionCallbackInfo<v8::Value>& args);
899
- void Umask(const v8::FunctionCallbackInfo<v8::Value>& args);
900
- void Uptime(const v8::FunctionCallbackInfo<v8::Value>& args);
901
-
902
- void EnvDeleter(v8::Local<v8::Name> property,
903
- const v8::PropertyCallbackInfo<v8::Boolean>& info);
904
- void EnvGetter(v8::Local<v8::Name> property,
905
- const v8::PropertyCallbackInfo<v8::Value>& info);
906
- void EnvSetter(v8::Local<v8::Name> property,
907
- v8::Local<v8::Value> value,
908
- const v8::PropertyCallbackInfo<v8::Value>& info);
909
- void EnvQuery(v8::Local<v8::Name> property,
910
- const v8::PropertyCallbackInfo<v8::Integer>& info);
911
- void EnvEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info);
912
- void DebugPortGetter(v8::Local<v8::Name> property,
913
- const v8::PropertyCallbackInfo<v8::Value>& info);
914
- void DebugPortSetter(v8::Local<v8::Name> property,
915
- v8::Local<v8::Value> value,
916
- const v8::PropertyCallbackInfo<void>& info);
917
-
918
- void GetParentProcessId(v8::Local<v8::Name> property,
919
- const v8::PropertyCallbackInfo<v8::Value>& info);
920
-
921
- void ProcessTitleGetter(v8::Local<v8::Name> property,
922
- const v8::PropertyCallbackInfo<v8::Value>& info);
923
- void ProcessTitleSetter(v8::Local<v8::Name> property,
924
- v8::Local<v8::Value> value,
925
- const v8::PropertyCallbackInfo<void>& info);
926
-
927
- #if defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__)
928
- void SetGid(const v8::FunctionCallbackInfo<v8::Value>& args);
929
- void SetEGid(const v8::FunctionCallbackInfo<v8::Value>& args);
930
- void SetUid(const v8::FunctionCallbackInfo<v8::Value>& args);
931
- void SetEUid(const v8::FunctionCallbackInfo<v8::Value>& args);
932
- void SetGroups(const v8::FunctionCallbackInfo<v8::Value>& args);
933
- void InitGroups(const v8::FunctionCallbackInfo<v8::Value>& args);
934
- void GetUid(const v8::FunctionCallbackInfo<v8::Value>& args);
935
- void GetGid(const v8::FunctionCallbackInfo<v8::Value>& args);
936
- void GetEUid(const v8::FunctionCallbackInfo<v8::Value>& args);
937
- void GetEGid(const v8::FunctionCallbackInfo<v8::Value>& args);
938
- void GetGroups(const v8::FunctionCallbackInfo<v8::Value>& args);
939
- #endif // __POSIX__ && !defined(__ANDROID__) && !defined(__CloudABI__)
940
-
941
- void DefineZlibConstants(v8::Local<v8::Object> target);
942
-
943
- } // namespace node
944
-
945
- void napi_module_register_by_symbol(v8::Local<v8::Object> exports,
946
- v8::Local<v8::Value> module,
947
- v8::Local<v8::Context> context,
948
- napi_addon_register_func init);
949
-
950
- #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
951
-
952
- #endif // SRC_NODE_INTERNALS_H_