11cb0ef41Sopenharmony_ci/* Copyright libuv project contributors. All rights reserved.
21cb0ef41Sopenharmony_ci *
31cb0ef41Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a copy
41cb0ef41Sopenharmony_ci * of this software and associated documentation files (the "Software"), to
51cb0ef41Sopenharmony_ci * deal in the Software without restriction, including without limitation the
61cb0ef41Sopenharmony_ci * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
71cb0ef41Sopenharmony_ci * sell copies of the Software, and to permit persons to whom the Software is
81cb0ef41Sopenharmony_ci * furnished to do so, subject to the following conditions:
91cb0ef41Sopenharmony_ci *
101cb0ef41Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
111cb0ef41Sopenharmony_ci * all copies or substantial portions of the Software.
121cb0ef41Sopenharmony_ci *
131cb0ef41Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
141cb0ef41Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
151cb0ef41Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
161cb0ef41Sopenharmony_ci * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
171cb0ef41Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
181cb0ef41Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
191cb0ef41Sopenharmony_ci * IN THE SOFTWARE.
201cb0ef41Sopenharmony_ci */
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ci#include "uv.h"
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ciconst char* uv_handle_type_name(uv_handle_type type) {
251cb0ef41Sopenharmony_ci  switch (type) {
261cb0ef41Sopenharmony_ci#define XX(uc,lc) case UV_##uc: return #lc;
271cb0ef41Sopenharmony_ci  UV_HANDLE_TYPE_MAP(XX)
281cb0ef41Sopenharmony_ci#undef XX
291cb0ef41Sopenharmony_ci  case UV_FILE: return "file";
301cb0ef41Sopenharmony_ci  case UV_HANDLE_TYPE_MAX:
311cb0ef41Sopenharmony_ci  case UV_UNKNOWN_HANDLE: return NULL;
321cb0ef41Sopenharmony_ci  }
331cb0ef41Sopenharmony_ci  return NULL;
341cb0ef41Sopenharmony_ci}
351cb0ef41Sopenharmony_ci
361cb0ef41Sopenharmony_ciuv_handle_type uv_handle_get_type(const uv_handle_t* handle) {
371cb0ef41Sopenharmony_ci  return handle->type;
381cb0ef41Sopenharmony_ci}
391cb0ef41Sopenharmony_ci
401cb0ef41Sopenharmony_civoid* uv_handle_get_data(const uv_handle_t* handle) {
411cb0ef41Sopenharmony_ci  return handle->data;
421cb0ef41Sopenharmony_ci}
431cb0ef41Sopenharmony_ci
441cb0ef41Sopenharmony_ciuv_loop_t* uv_handle_get_loop(const uv_handle_t* handle) {
451cb0ef41Sopenharmony_ci  return handle->loop;
461cb0ef41Sopenharmony_ci}
471cb0ef41Sopenharmony_ci
481cb0ef41Sopenharmony_civoid uv_handle_set_data(uv_handle_t* handle, void* data) {
491cb0ef41Sopenharmony_ci  handle->data = data;
501cb0ef41Sopenharmony_ci}
511cb0ef41Sopenharmony_ci
521cb0ef41Sopenharmony_ciconst char* uv_req_type_name(uv_req_type type) {
531cb0ef41Sopenharmony_ci  switch (type) {
541cb0ef41Sopenharmony_ci#define XX(uc,lc) case UV_##uc: return #lc;
551cb0ef41Sopenharmony_ci  UV_REQ_TYPE_MAP(XX)
561cb0ef41Sopenharmony_ci#undef XX
571cb0ef41Sopenharmony_ci  case UV_REQ_TYPE_MAX:
581cb0ef41Sopenharmony_ci  case UV_UNKNOWN_REQ:
591cb0ef41Sopenharmony_ci  default: /* UV_REQ_TYPE_PRIVATE */
601cb0ef41Sopenharmony_ci    break;
611cb0ef41Sopenharmony_ci  }
621cb0ef41Sopenharmony_ci  return NULL;
631cb0ef41Sopenharmony_ci}
641cb0ef41Sopenharmony_ci
651cb0ef41Sopenharmony_ciuv_req_type uv_req_get_type(const uv_req_t* req) {
661cb0ef41Sopenharmony_ci  return req->type;
671cb0ef41Sopenharmony_ci}
681cb0ef41Sopenharmony_ci
691cb0ef41Sopenharmony_civoid* uv_req_get_data(const uv_req_t* req) {
701cb0ef41Sopenharmony_ci  return req->data;
711cb0ef41Sopenharmony_ci}
721cb0ef41Sopenharmony_ci
731cb0ef41Sopenharmony_civoid uv_req_set_data(uv_req_t* req, void* data) {
741cb0ef41Sopenharmony_ci  req->data = data;
751cb0ef41Sopenharmony_ci}
761cb0ef41Sopenharmony_ci
771cb0ef41Sopenharmony_cisize_t uv_stream_get_write_queue_size(const uv_stream_t* stream) {
781cb0ef41Sopenharmony_ci  return stream->write_queue_size;
791cb0ef41Sopenharmony_ci}
801cb0ef41Sopenharmony_ci
811cb0ef41Sopenharmony_cisize_t uv_udp_get_send_queue_size(const uv_udp_t* handle) {
821cb0ef41Sopenharmony_ci  return handle->send_queue_size;
831cb0ef41Sopenharmony_ci}
841cb0ef41Sopenharmony_ci
851cb0ef41Sopenharmony_cisize_t uv_udp_get_send_queue_count(const uv_udp_t* handle) {
861cb0ef41Sopenharmony_ci  return handle->send_queue_count;
871cb0ef41Sopenharmony_ci}
881cb0ef41Sopenharmony_ci
891cb0ef41Sopenharmony_ciuv_pid_t uv_process_get_pid(const uv_process_t* proc) {
901cb0ef41Sopenharmony_ci  return proc->pid;
911cb0ef41Sopenharmony_ci}
921cb0ef41Sopenharmony_ci
931cb0ef41Sopenharmony_ciuv_fs_type uv_fs_get_type(const uv_fs_t* req) {
941cb0ef41Sopenharmony_ci  return req->fs_type;
951cb0ef41Sopenharmony_ci}
961cb0ef41Sopenharmony_ci
971cb0ef41Sopenharmony_cissize_t uv_fs_get_result(const uv_fs_t* req) {
981cb0ef41Sopenharmony_ci  return req->result;
991cb0ef41Sopenharmony_ci}
1001cb0ef41Sopenharmony_ci
1011cb0ef41Sopenharmony_civoid* uv_fs_get_ptr(const uv_fs_t* req) {
1021cb0ef41Sopenharmony_ci  return req->ptr;
1031cb0ef41Sopenharmony_ci}
1041cb0ef41Sopenharmony_ci
1051cb0ef41Sopenharmony_ciconst char* uv_fs_get_path(const uv_fs_t* req) {
1061cb0ef41Sopenharmony_ci  return req->path;
1071cb0ef41Sopenharmony_ci}
1081cb0ef41Sopenharmony_ci
1091cb0ef41Sopenharmony_ciuv_stat_t* uv_fs_get_statbuf(uv_fs_t* req) {
1101cb0ef41Sopenharmony_ci  return &req->statbuf;
1111cb0ef41Sopenharmony_ci}
1121cb0ef41Sopenharmony_ci
1131cb0ef41Sopenharmony_civoid* uv_loop_get_data(const uv_loop_t* loop) {
1141cb0ef41Sopenharmony_ci  return loop->data;
1151cb0ef41Sopenharmony_ci}
1161cb0ef41Sopenharmony_ci
1171cb0ef41Sopenharmony_civoid uv_loop_set_data(uv_loop_t* loop, void* data) {
1181cb0ef41Sopenharmony_ci  loop->data = data;
1191cb0ef41Sopenharmony_ci}
120