summaryrefslogtreecommitdiff
path: root/deps/uv/src/uv-data-getter-setters.c
blob: c3025662fa108b447a2d42f55a0e02d419d52bf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include "uv.h"

const char* uv_handle_type_name(uv_handle_type type) {
  switch (type) {
#define XX(uc,lc) case UV_##uc: return #lc;
  UV_HANDLE_TYPE_MAP(XX)
#undef XX
  case UV_FILE: return "file";
  case UV_HANDLE_TYPE_MAX:
  case UV_UNKNOWN_HANDLE: return NULL;
  }
  return NULL;
}

uv_handle_type uv_handle_get_type(const uv_handle_t* handle) {
  return handle->type;
}

void* uv_handle_get_data(const uv_handle_t* handle) {
  return handle->data;
}

uv_loop_t* uv_handle_get_loop(const uv_handle_t* handle) {
  return handle->loop;
}

void uv_handle_set_data(uv_handle_t* handle, void* data) {
  handle->data = data;
}

const char* uv_req_type_name(uv_req_type type) {
  switch (type) {
#define XX(uc,lc) case UV_##uc: return #lc;
  UV_REQ_TYPE_MAP(XX)
#undef XX
  case UV_REQ_TYPE_MAX:
  case UV_UNKNOWN_REQ:
  default: /* UV_REQ_TYPE_PRIVATE */
    break;
  }
  return NULL;
}

uv_req_type uv_req_get_type(const uv_req_t* req) {
  return req->type;
}

void* uv_req_get_data(const uv_req_t* req) {
  return req->data;
}

void uv_req_set_data(uv_req_t* req, void* data) {
  req->data = data;
}

size_t uv_stream_get_write_queue_size(const uv_stream_t* stream) {
  return stream->write_queue_size;
}

size_t uv_udp_get_send_queue_size(const uv_udp_t* handle) {
  return handle->send_queue_size;
}

size_t uv_udp_get_send_queue_count(const uv_udp_t* handle) {
  return handle->send_queue_count;
}

uv_pid_t uv_process_get_pid(const uv_process_t* proc) {
  return proc->pid;
}

uv_fs_type uv_fs_get_type(const uv_fs_t* req) {
  return req->fs_type;
}

ssize_t uv_fs_get_result(const uv_fs_t* req) {
  return req->result;
}

void* uv_fs_get_ptr(const uv_fs_t* req) {
  return req->ptr;
}

const char* uv_fs_get_path(const uv_fs_t* req) {
  return req->path;
}

uv_stat_t* uv_fs_get_statbuf(uv_fs_t* req) {
  return &req->statbuf;
}

void* uv_loop_get_data(const uv_loop_t* loop) {
  return loop->data;
}

void uv_loop_set_data(uv_loop_t* loop, void* data) {
  loop->data = data;
}