1#include "uv.h"
2
3const char* uv_handle_type_name(uv_handle_type type) {
4 switch (type) {
5#define XX(uc,lc) case UV_##uc: return #lc;
6 UV_HANDLE_TYPE_MAP(XX)
7#undef XX
8 case UV_FILE: return "file";
9 case UV_HANDLE_TYPE_MAX:
10 case UV_UNKNOWN_HANDLE: return NULL;
11 }
12 return NULL;
13}
14
15uv_handle_type uv_handle_get_type(const uv_handle_t* handle) {
16 return handle->type;
17}
18
19void* uv_handle_get_data(const uv_handle_t* handle) {
20 return handle->data;
21}
22
23uv_loop_t* uv_handle_get_loop(const uv_handle_t* handle) {
24 return handle->loop;
25}
26
27void uv_handle_set_data(uv_handle_t* handle, void* data) {
28 handle->data = data;
29}
30
31const char* uv_req_type_name(uv_req_type type) {
32 switch (type) {
33#define XX(uc,lc) case UV_##uc: return #lc;
34 UV_REQ_TYPE_MAP(XX)
35#undef XX
36 case UV_REQ_TYPE_MAX:
37 case UV_UNKNOWN_REQ:
38 default: /* UV_REQ_TYPE_PRIVATE */
39 break;
40 }
41 return NULL;
42}
43
44uv_req_type uv_req_get_type(const uv_req_t* req) {
45 return req->type;
46}
47
48void* uv_req_get_data(const uv_req_t* req) {
49 return req->data;
50}
51
52void uv_req_set_data(uv_req_t* req, void* data) {
53 req->data = data;
54}
55
56size_t uv_stream_get_write_queue_size(const uv_stream_t* stream) {
57 return stream->write_queue_size;
58}
59
60size_t uv_udp_get_send_queue_size(const uv_udp_t* handle) {
61 return handle->send_queue_size;
62}
63
64size_t uv_udp_get_send_queue_count(const uv_udp_t* handle) {
65 return handle->send_queue_count;
66}
67
68uv_pid_t uv_process_get_pid(const uv_process_t* proc) {
69 return proc->pid;
70}
71
72uv_fs_type uv_fs_get_type(const uv_fs_t* req) {
73 return req->fs_type;
74}
75
76ssize_t uv_fs_get_result(const uv_fs_t* req) {
77 return req->result;
78}
79
80void* uv_fs_get_ptr(const uv_fs_t* req) {
81 return req->ptr;
82}
83
84const char* uv_fs_get_path(const uv_fs_t* req) {
85 return req->path;
86}
87
88uv_stat_t* uv_fs_get_statbuf(uv_fs_t* req) {
89 return &req->statbuf;
90}
91
92void* uv_loop_get_data(const uv_loop_t* loop) {
93 return loop->data;
94}
95
96void uv_loop_set_data(uv_loop_t* loop, void* data) {
97 loop->data = data;
98}
99