blob: 533e4a2fe12bb300aef69b1eca6ca0ed3e2341f9 [file] [log] [blame]
Brian Silverman41cdd3e2019-01-19 19:48:58 -08001#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: return NULL;
38 }
39 return NULL;
40}
41
42uv_req_type uv_req_get_type(const uv_req_t* req) {
43 return req->type;
44}
45
46void* uv_req_get_data(const uv_req_t* req) {
47 return req->data;
48}
49
50void uv_req_set_data(uv_req_t* req, void* data) {
51 req->data = data;
52}
53
54size_t uv_stream_get_write_queue_size(const uv_stream_t* stream) {
55 return stream->write_queue_size;
56}
57
58size_t uv_udp_get_send_queue_size(const uv_udp_t* handle) {
59 return handle->send_queue_size;
60}
61
62size_t uv_udp_get_send_queue_count(const uv_udp_t* handle) {
63 return handle->send_queue_count;
64}
65
66uv_pid_t uv_process_get_pid(const uv_process_t* proc) {
67 return proc->pid;
68}
69
70uv_fs_type uv_fs_get_type(const uv_fs_t* req) {
71 return req->fs_type;
72}
73
74ssize_t uv_fs_get_result(const uv_fs_t* req) {
75 return req->result;
76}
77
78void* uv_fs_get_ptr(const uv_fs_t* req) {
79 return req->ptr;
80}
81
82const char* uv_fs_get_path(const uv_fs_t* req) {
83 return req->path;
84}
85
86uv_stat_t* uv_fs_get_statbuf(uv_fs_t* req) {
87 return &req->statbuf;
88}
89
90void* uv_loop_get_data(const uv_loop_t* loop) {
91 return loop->data;
92}
93
94void uv_loop_set_data(uv_loop_t* loop, void* data) {
95 loop->data = data;
96}