1e66f31c5Sopenharmony_ci/* Copyright libuv project contributors. All rights reserved.
2e66f31c5Sopenharmony_ci *
3e66f31c5Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a copy
4e66f31c5Sopenharmony_ci * of this software and associated documentation files (the "Software"), to
5e66f31c5Sopenharmony_ci * deal in the Software without restriction, including without limitation the
6e66f31c5Sopenharmony_ci * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7e66f31c5Sopenharmony_ci * sell copies of the Software, and to permit persons to whom the Software is
8e66f31c5Sopenharmony_ci * furnished to do so, subject to the following conditions:
9e66f31c5Sopenharmony_ci *
10e66f31c5Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
11e66f31c5Sopenharmony_ci * all copies or substantial portions of the Software.
12e66f31c5Sopenharmony_ci *
13e66f31c5Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14e66f31c5Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15e66f31c5Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16e66f31c5Sopenharmony_ci * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17e66f31c5Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18e66f31c5Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19e66f31c5Sopenharmony_ci * IN THE SOFTWARE.
20e66f31c5Sopenharmony_ci */
21e66f31c5Sopenharmony_ci
22e66f31c5Sopenharmony_ci#include "uv.h"
23e66f31c5Sopenharmony_ci
24e66f31c5Sopenharmony_ciconst char* uv_handle_type_name(uv_handle_type type) {
25e66f31c5Sopenharmony_ci  switch (type) {
26e66f31c5Sopenharmony_ci#define XX(uc,lc) case UV_##uc: return #lc;
27e66f31c5Sopenharmony_ci  UV_HANDLE_TYPE_MAP(XX)
28e66f31c5Sopenharmony_ci#undef XX
29e66f31c5Sopenharmony_ci  case UV_FILE: return "file";
30e66f31c5Sopenharmony_ci  case UV_HANDLE_TYPE_MAX:
31e66f31c5Sopenharmony_ci  case UV_UNKNOWN_HANDLE: return NULL;
32e66f31c5Sopenharmony_ci  }
33e66f31c5Sopenharmony_ci  return NULL;
34e66f31c5Sopenharmony_ci}
35e66f31c5Sopenharmony_ci
36e66f31c5Sopenharmony_ciuv_handle_type uv_handle_get_type(const uv_handle_t* handle) {
37e66f31c5Sopenharmony_ci  return handle->type;
38e66f31c5Sopenharmony_ci}
39e66f31c5Sopenharmony_ci
40e66f31c5Sopenharmony_civoid* uv_handle_get_data(const uv_handle_t* handle) {
41e66f31c5Sopenharmony_ci  return handle->data;
42e66f31c5Sopenharmony_ci}
43e66f31c5Sopenharmony_ci
44e66f31c5Sopenharmony_ciuv_loop_t* uv_handle_get_loop(const uv_handle_t* handle) {
45e66f31c5Sopenharmony_ci  return handle->loop;
46e66f31c5Sopenharmony_ci}
47e66f31c5Sopenharmony_ci
48e66f31c5Sopenharmony_civoid uv_handle_set_data(uv_handle_t* handle, void* data) {
49e66f31c5Sopenharmony_ci  handle->data = data;
50e66f31c5Sopenharmony_ci}
51e66f31c5Sopenharmony_ci
52e66f31c5Sopenharmony_ciconst char* uv_req_type_name(uv_req_type type) {
53e66f31c5Sopenharmony_ci  switch (type) {
54e66f31c5Sopenharmony_ci#define XX(uc,lc) case UV_##uc: return #lc;
55e66f31c5Sopenharmony_ci  UV_REQ_TYPE_MAP(XX)
56e66f31c5Sopenharmony_ci#undef XX
57e66f31c5Sopenharmony_ci  case UV_REQ_TYPE_MAX:
58e66f31c5Sopenharmony_ci  case UV_UNKNOWN_REQ:
59e66f31c5Sopenharmony_ci  default: /* UV_REQ_TYPE_PRIVATE */
60e66f31c5Sopenharmony_ci    break;
61e66f31c5Sopenharmony_ci  }
62e66f31c5Sopenharmony_ci  return NULL;
63e66f31c5Sopenharmony_ci}
64e66f31c5Sopenharmony_ci
65e66f31c5Sopenharmony_ciuv_req_type uv_req_get_type(const uv_req_t* req) {
66e66f31c5Sopenharmony_ci  return req->type;
67e66f31c5Sopenharmony_ci}
68e66f31c5Sopenharmony_ci
69e66f31c5Sopenharmony_civoid* uv_req_get_data(const uv_req_t* req) {
70e66f31c5Sopenharmony_ci  return req->data;
71e66f31c5Sopenharmony_ci}
72e66f31c5Sopenharmony_ci
73e66f31c5Sopenharmony_civoid uv_req_set_data(uv_req_t* req, void* data) {
74e66f31c5Sopenharmony_ci  req->data = data;
75e66f31c5Sopenharmony_ci}
76e66f31c5Sopenharmony_ci
77e66f31c5Sopenharmony_cisize_t uv_stream_get_write_queue_size(const uv_stream_t* stream) {
78e66f31c5Sopenharmony_ci  return stream->write_queue_size;
79e66f31c5Sopenharmony_ci}
80e66f31c5Sopenharmony_ci
81e66f31c5Sopenharmony_cisize_t uv_udp_get_send_queue_size(const uv_udp_t* handle) {
82e66f31c5Sopenharmony_ci  return handle->send_queue_size;
83e66f31c5Sopenharmony_ci}
84e66f31c5Sopenharmony_ci
85e66f31c5Sopenharmony_cisize_t uv_udp_get_send_queue_count(const uv_udp_t* handle) {
86e66f31c5Sopenharmony_ci  return handle->send_queue_count;
87e66f31c5Sopenharmony_ci}
88e66f31c5Sopenharmony_ci
89e66f31c5Sopenharmony_ciuv_pid_t uv_process_get_pid(const uv_process_t* proc) {
90e66f31c5Sopenharmony_ci  return proc->pid;
91e66f31c5Sopenharmony_ci}
92e66f31c5Sopenharmony_ci
93e66f31c5Sopenharmony_ciuv_fs_type uv_fs_get_type(const uv_fs_t* req) {
94e66f31c5Sopenharmony_ci  return req->fs_type;
95e66f31c5Sopenharmony_ci}
96e66f31c5Sopenharmony_ci
97e66f31c5Sopenharmony_cissize_t uv_fs_get_result(const uv_fs_t* req) {
98e66f31c5Sopenharmony_ci  return req->result;
99e66f31c5Sopenharmony_ci}
100e66f31c5Sopenharmony_ci
101e66f31c5Sopenharmony_civoid* uv_fs_get_ptr(const uv_fs_t* req) {
102e66f31c5Sopenharmony_ci  return req->ptr;
103e66f31c5Sopenharmony_ci}
104e66f31c5Sopenharmony_ci
105e66f31c5Sopenharmony_ciconst char* uv_fs_get_path(const uv_fs_t* req) {
106e66f31c5Sopenharmony_ci  return req->path;
107e66f31c5Sopenharmony_ci}
108e66f31c5Sopenharmony_ci
109e66f31c5Sopenharmony_ciuv_stat_t* uv_fs_get_statbuf(uv_fs_t* req) {
110e66f31c5Sopenharmony_ci  return &req->statbuf;
111e66f31c5Sopenharmony_ci}
112e66f31c5Sopenharmony_ci
113e66f31c5Sopenharmony_civoid* uv_loop_get_data(const uv_loop_t* loop) {
114e66f31c5Sopenharmony_ci  return loop->data;
115e66f31c5Sopenharmony_ci}
116e66f31c5Sopenharmony_ci
117e66f31c5Sopenharmony_civoid uv_loop_set_data(uv_loop_t* loop, void* data) {
118e66f31c5Sopenharmony_ci  loop->data = data;
119e66f31c5Sopenharmony_ci}
120