Symbol: tube
regress/lib/libpthread/poll/poll.c
106
CHECKe(pipe(tube));
regress/lib/libpthread/poll/poll.c
107
CHECKe(fcntl(tube[0], F_SETFL, O_NONBLOCK));
regress/lib/libpthread/poll/poll.c
108
CHECKe(fcntl(tube[1], F_SETFL, O_NONBLOCK));
regress/lib/libpthread/poll/poll.c
110
p[0].fd = tube[0];
regress/lib/libpthread/poll/poll.c
112
p[1].fd = tube[1];
regress/lib/libpthread/poll/poll.c
122
CHECKr(pthread_create(&t, NULL, writer, (void *)&tube[1]));
regress/lib/libpthread/poll/poll.c
124
p[0].fd = tube[0];
regress/lib/libpthread/poll/poll.c
129
reader((void *)&tube[0]); /* consume */
regress/lib/libpthread/poll/poll.c
59
int tube[2];
sbin/unwind/libunbound/daemon/worker.h
100
struct tube* cmd;
sbin/unwind/libunbound/daemon/worker.h
62
struct tube;
sbin/unwind/libunbound/libunbound/context.h
51
struct tube;
sbin/unwind/libunbound/libunbound/context.h
70
struct tube* qq_pipe;
sbin/unwind/libunbound/libunbound/context.h
74
struct tube* rr_pipe;
sbin/unwind/libunbound/libunbound/libworker.c
312
libworker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
sbin/unwind/libunbound/libunbound/libworker.c
928
void worker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
sbin/unwind/libunbound/libunbound/libworker.h
59
struct tube;
sbin/unwind/libunbound/libunbound/worker.h
148
void worker_handle_control_cmd(struct tube* tube, uint8_t* msg, size_t len,
sbin/unwind/libunbound/libunbound/worker.h
50
struct tube;
sbin/unwind/libunbound/libunbound/worker.h
88
void libworker_handle_control_cmd(struct tube* tube, uint8_t* msg, size_t len,
sbin/unwind/libunbound/util/tube.c
100
free(tube);
sbin/unwind/libunbound/util/tube.c
103
void tube_close_read(struct tube* tube)
sbin/unwind/libunbound/util/tube.c
105
if(tube->sr != -1) {
sbin/unwind/libunbound/util/tube.c
106
close(tube->sr);
sbin/unwind/libunbound/util/tube.c
107
tube->sr = -1;
sbin/unwind/libunbound/util/tube.c
111
void tube_close_write(struct tube* tube)
sbin/unwind/libunbound/util/tube.c
113
if(tube->sw != -1) {
sbin/unwind/libunbound/util/tube.c
114
close(tube->sw);
sbin/unwind/libunbound/util/tube.c
115
tube->sw = -1;
sbin/unwind/libunbound/util/tube.c
119
void tube_remove_bg_listen(struct tube* tube)
sbin/unwind/libunbound/util/tube.c
121
if(tube->listen_com) {
sbin/unwind/libunbound/util/tube.c
122
comm_point_delete(tube->listen_com);
sbin/unwind/libunbound/util/tube.c
123
tube->listen_com = NULL;
sbin/unwind/libunbound/util/tube.c
125
free(tube->cmd_msg);
sbin/unwind/libunbound/util/tube.c
126
tube->cmd_msg = NULL;
sbin/unwind/libunbound/util/tube.c
129
void tube_remove_bg_write(struct tube* tube)
sbin/unwind/libunbound/util/tube.c
131
if(tube->res_com) {
sbin/unwind/libunbound/util/tube.c
132
comm_point_delete(tube->res_com);
sbin/unwind/libunbound/util/tube.c
133
tube->res_com = NULL;
sbin/unwind/libunbound/util/tube.c
135
if(tube->res_list) {
sbin/unwind/libunbound/util/tube.c
136
struct tube_res_list* np, *p = tube->res_list;
sbin/unwind/libunbound/util/tube.c
137
tube->res_list = NULL;
sbin/unwind/libunbound/util/tube.c
138
tube->res_last = NULL;
sbin/unwind/libunbound/util/tube.c
152
struct tube* tube = (struct tube*)arg;
sbin/unwind/libunbound/util/tube.c
155
fptr_ok(fptr_whitelist_tube_listen(tube->listen_cb));
sbin/unwind/libunbound/util/tube.c
156
(*tube->listen_cb)(tube, NULL, 0, error, tube->listen_arg);
sbin/unwind/libunbound/util/tube.c
160
if(tube->cmd_read < sizeof(tube->cmd_len)) {
sbin/unwind/libunbound/util/tube.c
162
r = read(c->fd, ((uint8_t*)&tube->cmd_len) + tube->cmd_read,
sbin/unwind/libunbound/util/tube.c
163
sizeof(tube->cmd_len) - tube->cmd_read);
sbin/unwind/libunbound/util/tube.c
167
fptr_ok(fptr_whitelist_tube_listen(tube->listen_cb));
sbin/unwind/libunbound/util/tube.c
168
(*tube->listen_cb)(tube, NULL, 0, NETEVENT_CLOSED,
sbin/unwind/libunbound/util/tube.c
169
tube->listen_arg);
sbin/unwind/libunbound/util/tube.c
179
tube->cmd_read += r;
sbin/unwind/libunbound/util/tube.c
180
if(tube->cmd_read < sizeof(tube->cmd_len)) {
sbin/unwind/libunbound/util/tube.c
184
tube->cmd_msg = (uint8_t*)calloc(1, tube->cmd_len);
sbin/unwind/libunbound/util/tube.c
185
if(!tube->cmd_msg) {
sbin/unwind/libunbound/util/tube.c
187
tube->cmd_read = 0;
sbin/unwind/libunbound/util/tube.c
192
r = read(c->fd, tube->cmd_msg+tube->cmd_read-sizeof(tube->cmd_len),
sbin/unwind/libunbound/util/tube.c
193
tube->cmd_len - (tube->cmd_read - sizeof(tube->cmd_len)));
sbin/unwind/libunbound/util/tube.c
197
fptr_ok(fptr_whitelist_tube_listen(tube->listen_cb));
sbin/unwind/libunbound/util/tube.c
198
(*tube->listen_cb)(tube, NULL, 0, NETEVENT_CLOSED,
sbin/unwind/libunbound/util/tube.c
199
tube->listen_arg);
sbin/unwind/libunbound/util/tube.c
209
tube->cmd_read += r;
sbin/unwind/libunbound/util/tube.c
210
if(tube->cmd_read < sizeof(tube->cmd_len) + tube->cmd_len) {
sbin/unwind/libunbound/util/tube.c
214
tube->cmd_read = 0;
sbin/unwind/libunbound/util/tube.c
216
fptr_ok(fptr_whitelist_tube_listen(tube->listen_cb));
sbin/unwind/libunbound/util/tube.c
217
(*tube->listen_cb)(tube, tube->cmd_msg, tube->cmd_len,
sbin/unwind/libunbound/util/tube.c
218
NETEVENT_NOERROR, tube->listen_arg);
sbin/unwind/libunbound/util/tube.c
220
tube->cmd_msg = NULL;
sbin/unwind/libunbound/util/tube.c
228
struct tube* tube = (struct tube*)arg;
sbin/unwind/libunbound/util/tube.c
229
struct tube_res_list* item = tube->res_list;
sbin/unwind/libunbound/util/tube.c
241
if(tube->res_write < sizeof(item->len)) {
sbin/unwind/libunbound/util/tube.c
242
r = write(c->fd, ((uint8_t*)&item->len) + tube->res_write,
sbin/unwind/libunbound/util/tube.c
243
sizeof(item->len) - tube->res_write);
sbin/unwind/libunbound/util/tube.c
255
tube->res_write += r;
sbin/unwind/libunbound/util/tube.c
256
if(tube->res_write < sizeof(item->len))
sbin/unwind/libunbound/util/tube.c
259
r = write(c->fd, item->buf + tube->res_write - sizeof(item->len),
sbin/unwind/libunbound/util/tube.c
260
item->len - (tube->res_write - sizeof(item->len)));
sbin/unwind/libunbound/util/tube.c
272
tube->res_write += r;
sbin/unwind/libunbound/util/tube.c
273
if(tube->res_write < sizeof(item->len) + item->len)
sbin/unwind/libunbound/util/tube.c
278
tube->res_list = tube->res_list->next;
sbin/unwind/libunbound/util/tube.c
280
if(!tube->res_list) {
sbin/unwind/libunbound/util/tube.c
281
tube->res_last = NULL;
sbin/unwind/libunbound/util/tube.c
284
tube->res_write = 0;
sbin/unwind/libunbound/util/tube.c
288
int tube_write_msg(struct tube* tube, uint8_t* buf, uint32_t len,
sbin/unwind/libunbound/util/tube.c
292
int fd = tube->sw;
sbin/unwind/libunbound/util/tube.c
334
int tube_read_msg(struct tube* tube, uint8_t** buf, uint32_t* len,
sbin/unwind/libunbound/util/tube.c
338
int fd = tube->sr;
sbin/unwind/libunbound/util/tube.c
426
int tube_poll(struct tube* tube)
sbin/unwind/libunbound/util/tube.c
430
return pollit(tube->sr, &t);
sbin/unwind/libunbound/util/tube.c
433
int tube_wait(struct tube* tube)
sbin/unwind/libunbound/util/tube.c
435
return pollit(tube->sr, NULL);
sbin/unwind/libunbound/util/tube.c
438
int tube_wait_timeout(struct tube* tube, int msec)
sbin/unwind/libunbound/util/tube.c
446
fds.fd = tube->sr;
sbin/unwind/libunbound/util/tube.c
463
int tube_read_fd(struct tube* tube)
sbin/unwind/libunbound/util/tube.c
465
return tube->sr;
sbin/unwind/libunbound/util/tube.c
468
int tube_setup_bg_listen(struct tube* tube, struct comm_base* base,
sbin/unwind/libunbound/util/tube.c
471
tube->listen_cb = cb;
sbin/unwind/libunbound/util/tube.c
472
tube->listen_arg = arg;
sbin/unwind/libunbound/util/tube.c
473
if(!(tube->listen_com = comm_point_create_raw(base, tube->sr,
sbin/unwind/libunbound/util/tube.c
474
0, tube_handle_listen, tube))) {
sbin/unwind/libunbound/util/tube.c
483
int tube_setup_bg_write(struct tube* tube, struct comm_base* base)
sbin/unwind/libunbound/util/tube.c
485
if(!(tube->res_com = comm_point_create_raw(base, tube->sw,
sbin/unwind/libunbound/util/tube.c
486
1, tube_handle_write, tube))) {
sbin/unwind/libunbound/util/tube.c
495
int tube_queue_item(struct tube* tube, uint8_t* msg, size_t len)
sbin/unwind/libunbound/util/tube.c
498
if(!tube || !tube->res_com) return 0;
sbin/unwind/libunbound/util/tube.c
509
if(tube->res_last)
sbin/unwind/libunbound/util/tube.c
510
tube->res_last->next = item;
sbin/unwind/libunbound/util/tube.c
511
else tube->res_list = item;
sbin/unwind/libunbound/util/tube.c
512
tube->res_last = item;
sbin/unwind/libunbound/util/tube.c
513
if(tube->res_list == tube->res_last) {
sbin/unwind/libunbound/util/tube.c
515
comm_point_start_listening(tube->res_com, -1, -1);
sbin/unwind/libunbound/util/tube.c
530
struct tube* tube_create(void)
sbin/unwind/libunbound/util/tube.c
535
struct tube* tube = (struct tube*)calloc(1, sizeof(*tube));
sbin/unwind/libunbound/util/tube.c
536
if(!tube) {
sbin/unwind/libunbound/util/tube.c
542
tube->event = WSACreateEvent();
sbin/unwind/libunbound/util/tube.c
543
if(tube->event == WSA_INVALID_EVENT) {
sbin/unwind/libunbound/util/tube.c
544
free(tube);
sbin/unwind/libunbound/util/tube.c
548
if(!WSAResetEvent(tube->event)) {
sbin/unwind/libunbound/util/tube.c
551
lock_basic_init(&tube->res_lock);
sbin/unwind/libunbound/util/tube.c
553
return tube;
sbin/unwind/libunbound/util/tube.c
556
void tube_delete(struct tube* tube)
sbin/unwind/libunbound/util/tube.c
558
if(!tube) return;
sbin/unwind/libunbound/util/tube.c
559
tube_remove_bg_listen(tube);
sbin/unwind/libunbound/util/tube.c
560
tube_remove_bg_write(tube);
sbin/unwind/libunbound/util/tube.c
561
tube_close_read(tube);
sbin/unwind/libunbound/util/tube.c
562
tube_close_write(tube);
sbin/unwind/libunbound/util/tube.c
563
if(!WSACloseEvent(tube->event))
sbin/unwind/libunbound/util/tube.c
565
lock_basic_destroy(&tube->res_lock);
sbin/unwind/libunbound/util/tube.c
567
free(tube);
sbin/unwind/libunbound/util/tube.c
570
void tube_close_read(struct tube* ATTR_UNUSED(tube))
sbin/unwind/libunbound/util/tube.c
575
void tube_close_write(struct tube* ATTR_UNUSED(tube))
sbin/unwind/libunbound/util/tube.c
579
if(!WSASetEvent(tube->event)) {
sbin/unwind/libunbound/util/tube.c
584
void tube_remove_bg_listen(struct tube* tube)
sbin/unwind/libunbound/util/tube.c
587
if (tube->ev_listen != NULL) {
sbin/unwind/libunbound/util/tube.c
588
ub_winsock_unregister_wsaevent(tube->ev_listen);
sbin/unwind/libunbound/util/tube.c
589
tube->ev_listen = NULL;
sbin/unwind/libunbound/util/tube.c
593
void tube_remove_bg_write(struct tube* tube)
sbin/unwind/libunbound/util/tube.c
596
if(tube->res_list) {
sbin/unwind/libunbound/util/tube.c
597
struct tube_res_list* np, *p = tube->res_list;
sbin/unwind/libunbound/util/tube.c
598
tube->res_list = NULL;
sbin/unwind/libunbound/util/tube.c
599
tube->res_last = NULL;
sbin/unwind/libunbound/util/tube.c
60
struct tube* tube_create(void)
sbin/unwind/libunbound/util/tube.c
609
int tube_write_msg(struct tube* tube, uint8_t* buf, uint32_t len,
sbin/unwind/libunbound/util/tube.c
62
struct tube* tube = (struct tube*)calloc(1, sizeof(*tube));
sbin/unwind/libunbound/util/tube.c
620
return tube_queue_item(tube, a, len);
sbin/unwind/libunbound/util/tube.c
623
int tube_read_msg(struct tube* tube, uint8_t** buf, uint32_t* len,
sbin/unwind/libunbound/util/tube.c
629
if(!tube_poll(tube)) {
sbin/unwind/libunbound/util/tube.c
634
if(!tube_wait(tube))
sbin/unwind/libunbound/util/tube.c
637
lock_basic_lock(&tube->res_lock);
sbin/unwind/libunbound/util/tube.c
638
if(tube->res_list) {
sbin/unwind/libunbound/util/tube.c
639
item = tube->res_list;
sbin/unwind/libunbound/util/tube.c
64
if(!tube) {
sbin/unwind/libunbound/util/tube.c
640
tube->res_list = item->next;
sbin/unwind/libunbound/util/tube.c
641
if(tube->res_last == item) {
sbin/unwind/libunbound/util/tube.c
643
tube->res_last = NULL;
sbin/unwind/libunbound/util/tube.c
645
if(!WSAResetEvent(tube->event)) {
sbin/unwind/libunbound/util/tube.c
651
lock_basic_unlock(&tube->res_lock);
sbin/unwind/libunbound/util/tube.c
661
int tube_poll(struct tube* tube)
sbin/unwind/libunbound/util/tube.c
664
lock_basic_lock(&tube->res_lock);
sbin/unwind/libunbound/util/tube.c
665
item = tube->res_list;
sbin/unwind/libunbound/util/tube.c
666
lock_basic_unlock(&tube->res_lock);
sbin/unwind/libunbound/util/tube.c
672
int tube_wait(struct tube* tube)
sbin/unwind/libunbound/util/tube.c
677
&tube->event /* the event to wait for, our pipe signal */,
sbin/unwind/libunbound/util/tube.c
692
int tube_wait_timeout(struct tube* tube, int msec)
sbin/unwind/libunbound/util/tube.c
697
&tube->event /* the event to wait for, our pipe signal */,
sbin/unwind/libunbound/util/tube.c
70
tube->sr = -1;
sbin/unwind/libunbound/util/tube.c
71
tube->sw = -1;
sbin/unwind/libunbound/util/tube.c
712
int tube_read_fd(struct tube* ATTR_UNUSED(tube))
sbin/unwind/libunbound/util/tube.c
734
int tube_setup_bg_listen(struct tube* tube, struct comm_base* base,
sbin/unwind/libunbound/util/tube.c
737
tube->listen_cb = cb;
sbin/unwind/libunbound/util/tube.c
738
tube->listen_arg = arg;
sbin/unwind/libunbound/util/tube.c
741
tube->ev_listen = ub_winsock_register_wsaevent(
sbin/unwind/libunbound/util/tube.c
742
comm_base_internal(base), tube->event, &tube_handle_signal, tube);
sbin/unwind/libunbound/util/tube.c
743
return tube->ev_listen ? 1 : 0;
sbin/unwind/libunbound/util/tube.c
746
int tube_setup_bg_write(struct tube* ATTR_UNUSED(tube),
sbin/unwind/libunbound/util/tube.c
75
free(tube);
sbin/unwind/libunbound/util/tube.c
753
int tube_queue_item(struct tube* tube, uint8_t* msg, size_t len)
sbin/unwind/libunbound/util/tube.c
756
if(!tube) return 0;
sbin/unwind/libunbound/util/tube.c
767
lock_basic_lock(&tube->res_lock);
sbin/unwind/libunbound/util/tube.c
769
if(tube->res_last)
sbin/unwind/libunbound/util/tube.c
770
tube->res_last->next = item;
sbin/unwind/libunbound/util/tube.c
771
else tube->res_list = item;
sbin/unwind/libunbound/util/tube.c
772
tube->res_last = item;
sbin/unwind/libunbound/util/tube.c
774
if(!WSASetEvent(tube->event)) {
sbin/unwind/libunbound/util/tube.c
777
lock_basic_unlock(&tube->res_lock);
sbin/unwind/libunbound/util/tube.c
784
struct tube* tube = (struct tube*)arg;
sbin/unwind/libunbound/util/tube.c
788
while(tube_poll(tube)) {
sbin/unwind/libunbound/util/tube.c
789
if(tube_read_msg(tube, &buf, &len, 1)) {
sbin/unwind/libunbound/util/tube.c
79
tube->sr = sv[0];
sbin/unwind/libunbound/util/tube.c
790
fptr_ok(fptr_whitelist_tube_listen(tube->listen_cb));
sbin/unwind/libunbound/util/tube.c
791
(*tube->listen_cb)(tube, buf, len, NETEVENT_NOERROR,
sbin/unwind/libunbound/util/tube.c
792
tube->listen_arg);
sbin/unwind/libunbound/util/tube.c
80
tube->sw = sv[1];
sbin/unwind/libunbound/util/tube.c
81
if(!fd_set_nonblock(tube->sr) || !fd_set_nonblock(tube->sw)) {
sbin/unwind/libunbound/util/tube.c
84
tube_delete(tube);
sbin/unwind/libunbound/util/tube.c
88
return tube;
sbin/unwind/libunbound/util/tube.c
91
void tube_delete(struct tube* tube)
sbin/unwind/libunbound/util/tube.c
93
if(!tube) return;
sbin/unwind/libunbound/util/tube.c
94
tube_remove_bg_listen(tube);
sbin/unwind/libunbound/util/tube.c
95
tube_remove_bg_write(tube);
sbin/unwind/libunbound/util/tube.c
98
tube_close_read(tube);
sbin/unwind/libunbound/util/tube.c
99
tube_close_write(tube);
sbin/unwind/libunbound/util/tube.h
128
struct tube* tube_create(void);
sbin/unwind/libunbound/util/tube.h
134
void tube_delete(struct tube* tube);
sbin/unwind/libunbound/util/tube.h
153
int tube_write_msg(struct tube* tube, uint8_t* buf, uint32_t len,
sbin/unwind/libunbound/util/tube.h
173
int tube_read_msg(struct tube* tube, uint8_t** buf, uint32_t* len,
sbin/unwind/libunbound/util/tube.h
181
void tube_close_read(struct tube* tube);
sbin/unwind/libunbound/util/tube.h
188
void tube_close_write(struct tube* tube);
sbin/unwind/libunbound/util/tube.h
196
int tube_poll(struct tube* tube);
sbin/unwind/libunbound/util/tube.h
205
int tube_wait(struct tube* tube);
sbin/unwind/libunbound/util/tube.h
213
int tube_wait_timeout(struct tube* tube, int msec);
sbin/unwind/libunbound/util/tube.h
220
int tube_read_fd(struct tube* tube);
sbin/unwind/libunbound/util/tube.h
232
int tube_setup_bg_listen(struct tube* tube, struct comm_base* base,
sbin/unwind/libunbound/util/tube.h
239
void tube_remove_bg_listen(struct tube* tube);
sbin/unwind/libunbound/util/tube.h
248
int tube_setup_bg_write(struct tube* tube, struct comm_base* base);
sbin/unwind/libunbound/util/tube.h
254
void tube_remove_bg_write(struct tube* tube);
sbin/unwind/libunbound/util/tube.h
267
int tube_queue_item(struct tube* tube, uint8_t* msg, size_t len);
sbin/unwind/libunbound/util/tube.h
47
struct tube;
sbin/unwind/libunbound/util/tube.h
58
typedef void tube_callback_type(struct tube*, uint8_t*, size_t, int, void*);
usr.sbin/unbound/daemon/worker.c
2535
void libworker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
usr.sbin/unbound/daemon/worker.c
453
worker_handle_control_cmd(struct tube* ATTR_UNUSED(tube), uint8_t* msg,
usr.sbin/unbound/daemon/worker.h
100
struct tube* cmd;
usr.sbin/unbound/daemon/worker.h
62
struct tube;
usr.sbin/unbound/dnstap/unbound-dnstap-socket.c
1592
struct tube;
usr.sbin/unbound/dnstap/unbound-dnstap-socket.c
1600
void worker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
usr.sbin/unbound/dnstap/unbound-dnstap-socket.c
1700
void libworker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
usr.sbin/unbound/libunbound/context.h
51
struct tube;
usr.sbin/unbound/libunbound/context.h
70
struct tube* qq_pipe;
usr.sbin/unbound/libunbound/context.h
74
struct tube* rr_pipe;
usr.sbin/unbound/libunbound/libworker.c
312
libworker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
usr.sbin/unbound/libunbound/libworker.c
928
void worker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
usr.sbin/unbound/libunbound/libworker.h
59
struct tube;
usr.sbin/unbound/libunbound/worker.h
148
void worker_handle_control_cmd(struct tube* tube, uint8_t* msg, size_t len,
usr.sbin/unbound/libunbound/worker.h
50
struct tube;
usr.sbin/unbound/libunbound/worker.h
88
void libworker_handle_control_cmd(struct tube* tube, uint8_t* msg, size_t len,
usr.sbin/unbound/smallapp/worker_cb.c
153
void libworker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
usr.sbin/unbound/smallapp/worker_cb.c
53
void worker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
usr.sbin/unbound/testcode/doqclient.c
2538
struct tube;
usr.sbin/unbound/testcode/doqclient.c
2546
void worker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
usr.sbin/unbound/testcode/doqclient.c
2646
void libworker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
usr.sbin/unbound/util/tube.c
100
free(tube);
usr.sbin/unbound/util/tube.c
103
void tube_close_read(struct tube* tube)
usr.sbin/unbound/util/tube.c
105
if(tube->sr != -1) {
usr.sbin/unbound/util/tube.c
106
close(tube->sr);
usr.sbin/unbound/util/tube.c
107
tube->sr = -1;
usr.sbin/unbound/util/tube.c
111
void tube_close_write(struct tube* tube)
usr.sbin/unbound/util/tube.c
113
if(tube->sw != -1) {
usr.sbin/unbound/util/tube.c
114
close(tube->sw);
usr.sbin/unbound/util/tube.c
115
tube->sw = -1;
usr.sbin/unbound/util/tube.c
119
void tube_remove_bg_listen(struct tube* tube)
usr.sbin/unbound/util/tube.c
121
if(tube->listen_com) {
usr.sbin/unbound/util/tube.c
122
comm_point_delete(tube->listen_com);
usr.sbin/unbound/util/tube.c
123
tube->listen_com = NULL;
usr.sbin/unbound/util/tube.c
125
free(tube->cmd_msg);
usr.sbin/unbound/util/tube.c
126
tube->cmd_msg = NULL;
usr.sbin/unbound/util/tube.c
129
void tube_remove_bg_write(struct tube* tube)
usr.sbin/unbound/util/tube.c
131
if(tube->res_com) {
usr.sbin/unbound/util/tube.c
132
comm_point_delete(tube->res_com);
usr.sbin/unbound/util/tube.c
133
tube->res_com = NULL;
usr.sbin/unbound/util/tube.c
135
if(tube->res_list) {
usr.sbin/unbound/util/tube.c
136
struct tube_res_list* np, *p = tube->res_list;
usr.sbin/unbound/util/tube.c
137
tube->res_list = NULL;
usr.sbin/unbound/util/tube.c
138
tube->res_last = NULL;
usr.sbin/unbound/util/tube.c
152
struct tube* tube = (struct tube*)arg;
usr.sbin/unbound/util/tube.c
155
fptr_ok(fptr_whitelist_tube_listen(tube->listen_cb));
usr.sbin/unbound/util/tube.c
156
(*tube->listen_cb)(tube, NULL, 0, error, tube->listen_arg);
usr.sbin/unbound/util/tube.c
160
if(tube->cmd_read < sizeof(tube->cmd_len)) {
usr.sbin/unbound/util/tube.c
162
r = read(c->fd, ((uint8_t*)&tube->cmd_len) + tube->cmd_read,
usr.sbin/unbound/util/tube.c
163
sizeof(tube->cmd_len) - tube->cmd_read);
usr.sbin/unbound/util/tube.c
167
fptr_ok(fptr_whitelist_tube_listen(tube->listen_cb));
usr.sbin/unbound/util/tube.c
168
(*tube->listen_cb)(tube, NULL, 0, NETEVENT_CLOSED,
usr.sbin/unbound/util/tube.c
169
tube->listen_arg);
usr.sbin/unbound/util/tube.c
179
tube->cmd_read += r;
usr.sbin/unbound/util/tube.c
180
if(tube->cmd_read < sizeof(tube->cmd_len)) {
usr.sbin/unbound/util/tube.c
184
tube->cmd_msg = (uint8_t*)calloc(1, tube->cmd_len);
usr.sbin/unbound/util/tube.c
185
if(!tube->cmd_msg) {
usr.sbin/unbound/util/tube.c
187
tube->cmd_read = 0;
usr.sbin/unbound/util/tube.c
192
r = read(c->fd, tube->cmd_msg+tube->cmd_read-sizeof(tube->cmd_len),
usr.sbin/unbound/util/tube.c
193
tube->cmd_len - (tube->cmd_read - sizeof(tube->cmd_len)));
usr.sbin/unbound/util/tube.c
197
fptr_ok(fptr_whitelist_tube_listen(tube->listen_cb));
usr.sbin/unbound/util/tube.c
198
(*tube->listen_cb)(tube, NULL, 0, NETEVENT_CLOSED,
usr.sbin/unbound/util/tube.c
199
tube->listen_arg);
usr.sbin/unbound/util/tube.c
209
tube->cmd_read += r;
usr.sbin/unbound/util/tube.c
210
if(tube->cmd_read < sizeof(tube->cmd_len) + tube->cmd_len) {
usr.sbin/unbound/util/tube.c
214
tube->cmd_read = 0;
usr.sbin/unbound/util/tube.c
216
fptr_ok(fptr_whitelist_tube_listen(tube->listen_cb));
usr.sbin/unbound/util/tube.c
217
(*tube->listen_cb)(tube, tube->cmd_msg, tube->cmd_len,
usr.sbin/unbound/util/tube.c
218
NETEVENT_NOERROR, tube->listen_arg);
usr.sbin/unbound/util/tube.c
220
tube->cmd_msg = NULL;
usr.sbin/unbound/util/tube.c
228
struct tube* tube = (struct tube*)arg;
usr.sbin/unbound/util/tube.c
229
struct tube_res_list* item = tube->res_list;
usr.sbin/unbound/util/tube.c
241
if(tube->res_write < sizeof(item->len)) {
usr.sbin/unbound/util/tube.c
242
r = write(c->fd, ((uint8_t*)&item->len) + tube->res_write,
usr.sbin/unbound/util/tube.c
243
sizeof(item->len) - tube->res_write);
usr.sbin/unbound/util/tube.c
255
tube->res_write += r;
usr.sbin/unbound/util/tube.c
256
if(tube->res_write < sizeof(item->len))
usr.sbin/unbound/util/tube.c
259
r = write(c->fd, item->buf + tube->res_write - sizeof(item->len),
usr.sbin/unbound/util/tube.c
260
item->len - (tube->res_write - sizeof(item->len)));
usr.sbin/unbound/util/tube.c
272
tube->res_write += r;
usr.sbin/unbound/util/tube.c
273
if(tube->res_write < sizeof(item->len) + item->len)
usr.sbin/unbound/util/tube.c
278
tube->res_list = tube->res_list->next;
usr.sbin/unbound/util/tube.c
280
if(!tube->res_list) {
usr.sbin/unbound/util/tube.c
281
tube->res_last = NULL;
usr.sbin/unbound/util/tube.c
284
tube->res_write = 0;
usr.sbin/unbound/util/tube.c
288
int tube_write_msg(struct tube* tube, uint8_t* buf, uint32_t len,
usr.sbin/unbound/util/tube.c
292
int fd = tube->sw;
usr.sbin/unbound/util/tube.c
334
int tube_read_msg(struct tube* tube, uint8_t** buf, uint32_t* len,
usr.sbin/unbound/util/tube.c
338
int fd = tube->sr;
usr.sbin/unbound/util/tube.c
426
int tube_poll(struct tube* tube)
usr.sbin/unbound/util/tube.c
430
return pollit(tube->sr, &t);
usr.sbin/unbound/util/tube.c
433
int tube_wait(struct tube* tube)
usr.sbin/unbound/util/tube.c
435
return pollit(tube->sr, NULL);
usr.sbin/unbound/util/tube.c
438
int tube_wait_timeout(struct tube* tube, int msec)
usr.sbin/unbound/util/tube.c
446
fds.fd = tube->sr;
usr.sbin/unbound/util/tube.c
463
int tube_read_fd(struct tube* tube)
usr.sbin/unbound/util/tube.c
465
return tube->sr;
usr.sbin/unbound/util/tube.c
468
int tube_setup_bg_listen(struct tube* tube, struct comm_base* base,
usr.sbin/unbound/util/tube.c
471
tube->listen_cb = cb;
usr.sbin/unbound/util/tube.c
472
tube->listen_arg = arg;
usr.sbin/unbound/util/tube.c
473
if(!(tube->listen_com = comm_point_create_raw(base, tube->sr,
usr.sbin/unbound/util/tube.c
474
0, tube_handle_listen, tube))) {
usr.sbin/unbound/util/tube.c
483
int tube_setup_bg_write(struct tube* tube, struct comm_base* base)
usr.sbin/unbound/util/tube.c
485
if(!(tube->res_com = comm_point_create_raw(base, tube->sw,
usr.sbin/unbound/util/tube.c
486
1, tube_handle_write, tube))) {
usr.sbin/unbound/util/tube.c
495
int tube_queue_item(struct tube* tube, uint8_t* msg, size_t len)
usr.sbin/unbound/util/tube.c
498
if(!tube || !tube->res_com) return 0;
usr.sbin/unbound/util/tube.c
509
if(tube->res_last)
usr.sbin/unbound/util/tube.c
510
tube->res_last->next = item;
usr.sbin/unbound/util/tube.c
511
else tube->res_list = item;
usr.sbin/unbound/util/tube.c
512
tube->res_last = item;
usr.sbin/unbound/util/tube.c
513
if(tube->res_list == tube->res_last) {
usr.sbin/unbound/util/tube.c
515
comm_point_start_listening(tube->res_com, -1, -1);
usr.sbin/unbound/util/tube.c
530
struct tube* tube_create(void)
usr.sbin/unbound/util/tube.c
535
struct tube* tube = (struct tube*)calloc(1, sizeof(*tube));
usr.sbin/unbound/util/tube.c
536
if(!tube) {
usr.sbin/unbound/util/tube.c
542
tube->event = WSACreateEvent();
usr.sbin/unbound/util/tube.c
543
if(tube->event == WSA_INVALID_EVENT) {
usr.sbin/unbound/util/tube.c
544
free(tube);
usr.sbin/unbound/util/tube.c
548
if(!WSAResetEvent(tube->event)) {
usr.sbin/unbound/util/tube.c
551
lock_basic_init(&tube->res_lock);
usr.sbin/unbound/util/tube.c
553
return tube;
usr.sbin/unbound/util/tube.c
556
void tube_delete(struct tube* tube)
usr.sbin/unbound/util/tube.c
558
if(!tube) return;
usr.sbin/unbound/util/tube.c
559
tube_remove_bg_listen(tube);
usr.sbin/unbound/util/tube.c
560
tube_remove_bg_write(tube);
usr.sbin/unbound/util/tube.c
561
tube_close_read(tube);
usr.sbin/unbound/util/tube.c
562
tube_close_write(tube);
usr.sbin/unbound/util/tube.c
563
if(!WSACloseEvent(tube->event))
usr.sbin/unbound/util/tube.c
565
lock_basic_destroy(&tube->res_lock);
usr.sbin/unbound/util/tube.c
567
free(tube);
usr.sbin/unbound/util/tube.c
570
void tube_close_read(struct tube* ATTR_UNUSED(tube))
usr.sbin/unbound/util/tube.c
575
void tube_close_write(struct tube* ATTR_UNUSED(tube))
usr.sbin/unbound/util/tube.c
579
if(!WSASetEvent(tube->event)) {
usr.sbin/unbound/util/tube.c
584
void tube_remove_bg_listen(struct tube* tube)
usr.sbin/unbound/util/tube.c
587
if (tube->ev_listen != NULL) {
usr.sbin/unbound/util/tube.c
588
ub_winsock_unregister_wsaevent(tube->ev_listen);
usr.sbin/unbound/util/tube.c
589
tube->ev_listen = NULL;
usr.sbin/unbound/util/tube.c
593
void tube_remove_bg_write(struct tube* tube)
usr.sbin/unbound/util/tube.c
596
if(tube->res_list) {
usr.sbin/unbound/util/tube.c
597
struct tube_res_list* np, *p = tube->res_list;
usr.sbin/unbound/util/tube.c
598
tube->res_list = NULL;
usr.sbin/unbound/util/tube.c
599
tube->res_last = NULL;
usr.sbin/unbound/util/tube.c
60
struct tube* tube_create(void)
usr.sbin/unbound/util/tube.c
609
int tube_write_msg(struct tube* tube, uint8_t* buf, uint32_t len,
usr.sbin/unbound/util/tube.c
62
struct tube* tube = (struct tube*)calloc(1, sizeof(*tube));
usr.sbin/unbound/util/tube.c
620
return tube_queue_item(tube, a, len);
usr.sbin/unbound/util/tube.c
623
int tube_read_msg(struct tube* tube, uint8_t** buf, uint32_t* len,
usr.sbin/unbound/util/tube.c
629
if(!tube_poll(tube)) {
usr.sbin/unbound/util/tube.c
634
if(!tube_wait(tube))
usr.sbin/unbound/util/tube.c
637
lock_basic_lock(&tube->res_lock);
usr.sbin/unbound/util/tube.c
638
if(tube->res_list) {
usr.sbin/unbound/util/tube.c
639
item = tube->res_list;
usr.sbin/unbound/util/tube.c
64
if(!tube) {
usr.sbin/unbound/util/tube.c
640
tube->res_list = item->next;
usr.sbin/unbound/util/tube.c
641
if(tube->res_last == item) {
usr.sbin/unbound/util/tube.c
643
tube->res_last = NULL;
usr.sbin/unbound/util/tube.c
645
if(!WSAResetEvent(tube->event)) {
usr.sbin/unbound/util/tube.c
651
lock_basic_unlock(&tube->res_lock);
usr.sbin/unbound/util/tube.c
661
int tube_poll(struct tube* tube)
usr.sbin/unbound/util/tube.c
664
lock_basic_lock(&tube->res_lock);
usr.sbin/unbound/util/tube.c
665
item = tube->res_list;
usr.sbin/unbound/util/tube.c
666
lock_basic_unlock(&tube->res_lock);
usr.sbin/unbound/util/tube.c
672
int tube_wait(struct tube* tube)
usr.sbin/unbound/util/tube.c
677
&tube->event /* the event to wait for, our pipe signal */,
usr.sbin/unbound/util/tube.c
692
int tube_wait_timeout(struct tube* tube, int msec)
usr.sbin/unbound/util/tube.c
697
&tube->event /* the event to wait for, our pipe signal */,
usr.sbin/unbound/util/tube.c
70
tube->sr = -1;
usr.sbin/unbound/util/tube.c
71
tube->sw = -1;
usr.sbin/unbound/util/tube.c
712
int tube_read_fd(struct tube* ATTR_UNUSED(tube))
usr.sbin/unbound/util/tube.c
734
int tube_setup_bg_listen(struct tube* tube, struct comm_base* base,
usr.sbin/unbound/util/tube.c
737
tube->listen_cb = cb;
usr.sbin/unbound/util/tube.c
738
tube->listen_arg = arg;
usr.sbin/unbound/util/tube.c
741
tube->ev_listen = ub_winsock_register_wsaevent(
usr.sbin/unbound/util/tube.c
742
comm_base_internal(base), tube->event, &tube_handle_signal, tube);
usr.sbin/unbound/util/tube.c
743
return tube->ev_listen ? 1 : 0;
usr.sbin/unbound/util/tube.c
746
int tube_setup_bg_write(struct tube* ATTR_UNUSED(tube),
usr.sbin/unbound/util/tube.c
75
free(tube);
usr.sbin/unbound/util/tube.c
753
int tube_queue_item(struct tube* tube, uint8_t* msg, size_t len)
usr.sbin/unbound/util/tube.c
756
if(!tube) return 0;
usr.sbin/unbound/util/tube.c
767
lock_basic_lock(&tube->res_lock);
usr.sbin/unbound/util/tube.c
769
if(tube->res_last)
usr.sbin/unbound/util/tube.c
770
tube->res_last->next = item;
usr.sbin/unbound/util/tube.c
771
else tube->res_list = item;
usr.sbin/unbound/util/tube.c
772
tube->res_last = item;
usr.sbin/unbound/util/tube.c
774
if(!WSASetEvent(tube->event)) {
usr.sbin/unbound/util/tube.c
777
lock_basic_unlock(&tube->res_lock);
usr.sbin/unbound/util/tube.c
784
struct tube* tube = (struct tube*)arg;
usr.sbin/unbound/util/tube.c
788
while(tube_poll(tube)) {
usr.sbin/unbound/util/tube.c
789
if(tube_read_msg(tube, &buf, &len, 1)) {
usr.sbin/unbound/util/tube.c
79
tube->sr = sv[0];
usr.sbin/unbound/util/tube.c
790
fptr_ok(fptr_whitelist_tube_listen(tube->listen_cb));
usr.sbin/unbound/util/tube.c
791
(*tube->listen_cb)(tube, buf, len, NETEVENT_NOERROR,
usr.sbin/unbound/util/tube.c
792
tube->listen_arg);
usr.sbin/unbound/util/tube.c
80
tube->sw = sv[1];
usr.sbin/unbound/util/tube.c
81
if(!fd_set_nonblock(tube->sr) || !fd_set_nonblock(tube->sw)) {
usr.sbin/unbound/util/tube.c
84
tube_delete(tube);
usr.sbin/unbound/util/tube.c
88
return tube;
usr.sbin/unbound/util/tube.c
91
void tube_delete(struct tube* tube)
usr.sbin/unbound/util/tube.c
93
if(!tube) return;
usr.sbin/unbound/util/tube.c
94
tube_remove_bg_listen(tube);
usr.sbin/unbound/util/tube.c
95
tube_remove_bg_write(tube);
usr.sbin/unbound/util/tube.c
98
tube_close_read(tube);
usr.sbin/unbound/util/tube.c
99
tube_close_write(tube);
usr.sbin/unbound/util/tube.h
128
struct tube* tube_create(void);
usr.sbin/unbound/util/tube.h
134
void tube_delete(struct tube* tube);
usr.sbin/unbound/util/tube.h
153
int tube_write_msg(struct tube* tube, uint8_t* buf, uint32_t len,
usr.sbin/unbound/util/tube.h
173
int tube_read_msg(struct tube* tube, uint8_t** buf, uint32_t* len,
usr.sbin/unbound/util/tube.h
181
void tube_close_read(struct tube* tube);
usr.sbin/unbound/util/tube.h
188
void tube_close_write(struct tube* tube);
usr.sbin/unbound/util/tube.h
196
int tube_poll(struct tube* tube);
usr.sbin/unbound/util/tube.h
205
int tube_wait(struct tube* tube);
usr.sbin/unbound/util/tube.h
213
int tube_wait_timeout(struct tube* tube, int msec);
usr.sbin/unbound/util/tube.h
220
int tube_read_fd(struct tube* tube);
usr.sbin/unbound/util/tube.h
232
int tube_setup_bg_listen(struct tube* tube, struct comm_base* base,
usr.sbin/unbound/util/tube.h
239
void tube_remove_bg_listen(struct tube* tube);
usr.sbin/unbound/util/tube.h
248
int tube_setup_bg_write(struct tube* tube, struct comm_base* base);
usr.sbin/unbound/util/tube.h
254
void tube_remove_bg_write(struct tube* tube);
usr.sbin/unbound/util/tube.h
267
int tube_queue_item(struct tube* tube, uint8_t* msg, size_t len);
usr.sbin/unbound/util/tube.h
47
struct tube;
usr.sbin/unbound/util/tube.h
58
typedef void tube_callback_type(struct tube*, uint8_t*, size_t, int, void*);