11cb0ef41Sopenharmony_ci#ifndef SRC_NODE_URL_H_
21cb0ef41Sopenharmony_ci#define SRC_NODE_URL_H_
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_ci#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ci#include <cinttypes>
71cb0ef41Sopenharmony_ci#include "ada.h"
81cb0ef41Sopenharmony_ci#include "aliased_buffer.h"
91cb0ef41Sopenharmony_ci#include "node.h"
101cb0ef41Sopenharmony_ci#include "node_snapshotable.h"
111cb0ef41Sopenharmony_ci#include "util.h"
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ci#include <string>
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_cinamespace node {
161cb0ef41Sopenharmony_ciclass ExternalReferenceRegistry;
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_cinamespace url {
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_cienum url_update_action {
211cb0ef41Sopenharmony_ci  kProtocol = 0,
221cb0ef41Sopenharmony_ci  kHost = 1,
231cb0ef41Sopenharmony_ci  kHostname = 2,
241cb0ef41Sopenharmony_ci  kPort = 3,
251cb0ef41Sopenharmony_ci  kUsername = 4,
261cb0ef41Sopenharmony_ci  kPassword = 5,
271cb0ef41Sopenharmony_ci  kPathname = 6,
281cb0ef41Sopenharmony_ci  kSearch = 7,
291cb0ef41Sopenharmony_ci  kHash = 8,
301cb0ef41Sopenharmony_ci  kHref = 9,
311cb0ef41Sopenharmony_ci};
321cb0ef41Sopenharmony_ci
331cb0ef41Sopenharmony_ciclass BindingData : public SnapshotableObject {
341cb0ef41Sopenharmony_ci public:
351cb0ef41Sopenharmony_ci  explicit BindingData(Realm* realm, v8::Local<v8::Object> obj);
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ci  using InternalFieldInfo = InternalFieldInfoBase;
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_ci  SERIALIZABLE_OBJECT_METHODS()
401cb0ef41Sopenharmony_ci  SET_BINDING_ID(url_binding_data)
411cb0ef41Sopenharmony_ci
421cb0ef41Sopenharmony_ci  void MemoryInfo(MemoryTracker* tracker) const override;
431cb0ef41Sopenharmony_ci  SET_SELF_SIZE(BindingData)
441cb0ef41Sopenharmony_ci  SET_MEMORY_INFO_NAME(BindingData)
451cb0ef41Sopenharmony_ci
461cb0ef41Sopenharmony_ci  static void ToASCII(const v8::FunctionCallbackInfo<v8::Value>& args);
471cb0ef41Sopenharmony_ci  static void ToUnicode(const v8::FunctionCallbackInfo<v8::Value>& args);
481cb0ef41Sopenharmony_ci
491cb0ef41Sopenharmony_ci  static void DomainToASCII(const v8::FunctionCallbackInfo<v8::Value>& args);
501cb0ef41Sopenharmony_ci  static void DomainToUnicode(const v8::FunctionCallbackInfo<v8::Value>& args);
511cb0ef41Sopenharmony_ci
521cb0ef41Sopenharmony_ci  static void CanParse(const v8::FunctionCallbackInfo<v8::Value>& args);
531cb0ef41Sopenharmony_ci  static void Format(const v8::FunctionCallbackInfo<v8::Value>& args);
541cb0ef41Sopenharmony_ci  static void Parse(const v8::FunctionCallbackInfo<v8::Value>& args);
551cb0ef41Sopenharmony_ci  static void Update(const v8::FunctionCallbackInfo<v8::Value>& args);
561cb0ef41Sopenharmony_ci
571cb0ef41Sopenharmony_ci  static void Initialize(v8::Local<v8::Object> target,
581cb0ef41Sopenharmony_ci                         v8::Local<v8::Value> unused,
591cb0ef41Sopenharmony_ci                         v8::Local<v8::Context> context,
601cb0ef41Sopenharmony_ci                         void* priv);
611cb0ef41Sopenharmony_ci  static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
621cb0ef41Sopenharmony_ci
631cb0ef41Sopenharmony_ci private:
641cb0ef41Sopenharmony_ci  static constexpr size_t kURLComponentsLength = 9;
651cb0ef41Sopenharmony_ci  AliasedUint32Array url_components_buffer_;
661cb0ef41Sopenharmony_ci
671cb0ef41Sopenharmony_ci  void UpdateComponents(const ada::url_components& components,
681cb0ef41Sopenharmony_ci                        const ada::scheme::type type);
691cb0ef41Sopenharmony_ci};
701cb0ef41Sopenharmony_ci
711cb0ef41Sopenharmony_cistd::string FromFilePath(const std::string_view file_path);
721cb0ef41Sopenharmony_ci
731cb0ef41Sopenharmony_ci}  // namespace url
741cb0ef41Sopenharmony_ci
751cb0ef41Sopenharmony_ci}  // namespace node
761cb0ef41Sopenharmony_ci
771cb0ef41Sopenharmony_ci#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
781cb0ef41Sopenharmony_ci
791cb0ef41Sopenharmony_ci#endif  // SRC_NODE_URL_H_
80