Lines Matching refs:buf

170     nxt_unit_port_t *port, const void *buf, size_t buf_size,
173 const void *buf, size_t buf_size, const nxt_send_oob_t *oob);
207 nxt_unit_buf_t buf; member
270 nxt_unit_mmap_buf_t *buf; member
283 char buf[16384]; member
997 port_msg = (nxt_port_msg_t *) rbuf->buf; in nxt_unit_process_msg()
1158 memset(rbuf->buf, 0xAC, rbuf->size); in nxt_unit_process_msg()
1310 req->request_buf = &b->buf; in nxt_unit_process_req_headers()
1416 l += b->buf.end - b->buf.free; in nxt_unit_process_req_body()
1420 b = nxt_container_of(req->content_buf, nxt_unit_mmap_buf_t, buf); in nxt_unit_process_req_body()
1638 ws_impl->buf = NULL; in nxt_unit_process_websocket()
1646 ws_impl->buf = recv_msg->incoming_buf; in nxt_unit_process_websocket()
1647 ws_impl->buf->prev = &ws_impl->buf; in nxt_unit_process_websocket()
1650 b = ws_impl->buf; in nxt_unit_process_websocket()
1664 b->buf.start = recv_msg->start; in nxt_unit_process_websocket()
1665 b->buf.free = b->buf.start; in nxt_unit_process_websocket()
1666 b->buf.end = b->buf.start + recv_msg->size; in nxt_unit_process_websocket()
1668 nxt_unit_mmap_buf_insert(&ws_impl->buf, b); in nxt_unit_process_websocket()
1671 ws_impl->ws.header = (void *) b->buf.start; in nxt_unit_process_websocket()
1678 ws_impl->ws.mask = (uint8_t *) b->buf.start + hsize - 4; in nxt_unit_process_websocket()
1684 b->buf.free += hsize; in nxt_unit_process_websocket()
1686 ws_impl->ws.content_buf = &b->buf; in nxt_unit_process_websocket()
1884 while (ws_impl->buf != NULL) { in nxt_unit_websocket_frame_release()
1885 nxt_unit_mmap_buf_free(ws_impl->buf); in nxt_unit_websocket_frame_release()
2017 nxt_unit_buf_t *buf; in nxt_unit_response_init() local
2044 buf = req->response_buf; in nxt_unit_response_init()
2046 if (nxt_fast_path(buf_size <= (uint32_t) (buf->end - buf->start))) { in nxt_unit_response_init()
2050 nxt_unit_buf_free(buf); in nxt_unit_response_init()
2059 buf = nxt_unit_response_buf_alloc(req, buf_size); in nxt_unit_response_init()
2060 if (nxt_slow_path(buf == NULL)) { in nxt_unit_response_init()
2066 memset(buf->start, 0, sizeof(nxt_unit_response_t)); in nxt_unit_response_init()
2068 req->response_buf = buf; in nxt_unit_response_init()
2070 req->response = (nxt_unit_response_t *) buf->start; in nxt_unit_response_init()
2073 buf->free = buf->start + sizeof(nxt_unit_response_t) in nxt_unit_response_init()
2089 nxt_unit_buf_t *buf; in nxt_unit_response_realloc() local
2124 buf = nxt_unit_response_buf_alloc(req, buf_size); in nxt_unit_response_realloc()
2125 if (nxt_slow_path(buf == NULL)) { in nxt_unit_response_realloc()
2130 resp = (nxt_unit_response_t *) buf->start; in nxt_unit_response_realloc()
2137 p = buf->start + max_fields_count * sizeof(nxt_unit_field_t); in nxt_unit_response_realloc()
2148 > (uint32_t) (buf->end - p))) in nxt_unit_response_realloc()
2176 > (uint32_t) (buf->end - p))) in nxt_unit_response_realloc()
2193 buf->free = p; in nxt_unit_response_realloc()
2198 req->response_buf = buf; in nxt_unit_response_realloc()
2205 nxt_unit_buf_free(buf); in nxt_unit_response_realloc()
2227 nxt_unit_buf_t *buf; in nxt_unit_response_add_field() local
2250 buf = req->response_buf; in nxt_unit_response_add_field()
2253 > (uint32_t) (buf->end - buf->free))) in nxt_unit_response_add_field()
2267 nxt_unit_sptr_set(&f->name, buf->free); in nxt_unit_response_add_field()
2268 buf->free = nxt_cpymem(buf->free, name, name_length); in nxt_unit_response_add_field()
2269 *buf->free++ = '\0'; in nxt_unit_response_add_field()
2271 nxt_unit_sptr_set(&f->value, buf->free); in nxt_unit_response_add_field()
2272 buf->free = nxt_cpymem(buf->free, value, value_length); in nxt_unit_response_add_field()
2273 *buf->free++ = '\0'; in nxt_unit_response_add_field()
2290 nxt_unit_buf_t *buf; in nxt_unit_response_add_content() local
2308 buf = req->response_buf; in nxt_unit_response_add_content()
2310 if (nxt_slow_path(size > (uint32_t) (buf->end - buf->free))) { in nxt_unit_response_add_content()
2319 nxt_unit_sptr_set(&resp->piggyback_content, buf->free); in nxt_unit_response_add_content()
2325 buf->free = nxt_cpymem(buf->free, src, size); in nxt_unit_response_add_content()
2361 mmap_buf = nxt_container_of(req->response_buf, nxt_unit_mmap_buf_t, buf); in nxt_unit_response_send()
2427 return &mmap_buf->buf; in nxt_unit_response_buf_alloc()
2550 nxt_unit_buf_send(nxt_unit_buf_t *buf) in nxt_unit_buf_send() argument
2557 mmap_buf = nxt_container_of(buf, nxt_unit_mmap_buf_t, buf); in nxt_unit_buf_send()
2563 (int) (buf->free - buf->start)); in nxt_unit_buf_send()
2577 if (nxt_fast_path(buf->free > buf->start)) { in nxt_unit_buf_send()
2591 nxt_unit_buf_send_done(nxt_unit_buf_t *buf) in nxt_unit_buf_send_done() argument
2597 mmap_buf = nxt_container_of(buf, nxt_unit_mmap_buf_t, buf); in nxt_unit_buf_send_done()
2626 nxt_unit_buf_t *buf; in nxt_unit_mmap_buf_send() local
2634 buf = &mmap_buf->buf; in nxt_unit_mmap_buf_send()
2637 m.mmap_msg.size = buf->free - buf->start; in nxt_unit_mmap_buf_send()
2653 (u_char *) buf->start); in nxt_unit_mmap_buf_send()
2667 last_used = (u_char *) buf->free - 1; in nxt_unit_mmap_buf_send()
2670 if (buf->end - buf->free >= PORT_MMAP_CHUNK_SIZE) { in nxt_unit_mmap_buf_send()
2673 buf->start = (char *) first_free; in nxt_unit_mmap_buf_send()
2674 buf->free = buf->start; in nxt_unit_mmap_buf_send()
2676 if (buf->end < buf->start) { in nxt_unit_mmap_buf_send()
2677 buf->end = buf->start; in nxt_unit_mmap_buf_send()
2681 buf->start = NULL; in nxt_unit_mmap_buf_send()
2682 buf->free = NULL; in nxt_unit_mmap_buf_send()
2683 buf->end = NULL; in nxt_unit_mmap_buf_send()
2696 || mmap_buf->plain_ptr > buf->start - sizeof(m.msg))) in nxt_unit_mmap_buf_send()
2706 memcpy(buf->start - sizeof(m.msg), &m.msg, sizeof(m.msg)); in nxt_unit_mmap_buf_send()
2713 buf->start - sizeof(m.msg), in nxt_unit_mmap_buf_send()
2732 nxt_unit_buf_free(nxt_unit_buf_t *buf) in nxt_unit_buf_free() argument
2734 nxt_unit_mmap_buf_free(nxt_container_of(buf, nxt_unit_mmap_buf_t, buf)); in nxt_unit_buf_free()
2752 mmap_buf->hdr, mmap_buf->buf.start, in nxt_unit_free_outgoing_buf()
2753 mmap_buf->buf.end - mmap_buf->buf.start); in nxt_unit_free_outgoing_buf()
2830 nxt_unit_buf_next(nxt_unit_buf_t *buf) in nxt_unit_buf_next() argument
2834 mmap_buf = nxt_container_of(buf, nxt_unit_mmap_buf_t, buf); in nxt_unit_buf_next()
2840 return &mmap_buf->next->buf; in nxt_unit_buf_next()
2928 buf_size = mmap_buf.buf.end - mmap_buf.buf.free; in nxt_unit_response_write_nb()
2934 mmap_buf.buf.free = nxt_cpymem(mmap_buf.buf.free, in nxt_unit_response_write_nb()
2960 nxt_unit_buf_t *buf; in nxt_unit_response_write_cb() local
2984 buf = req->response_buf; in nxt_unit_response_write_cb()
2986 while (buf->end - buf->free > 0) { in nxt_unit_response_write_cb()
2987 n = read_info->read(read_info, buf->free, buf->end - buf->free); in nxt_unit_response_write_cb()
2995 buf->free += n; in nxt_unit_response_write_cb()
3028 buf = &mmap_buf.buf; in nxt_unit_response_write_cb()
3030 while (!read_info->eof && buf->end > buf->free) { in nxt_unit_response_write_cb()
3031 n = read_info->read(read_info, buf->free, buf->end - buf->free); in nxt_unit_response_write_cb()
3040 buf->free += n; in nxt_unit_response_write_cb()
3122 mmap_buf = nxt_container_of(b, nxt_unit_mmap_buf_t, buf); in nxt_unit_request_readline_size()
3169 mmap_buf->buf.start = mmap_buf->free_ptr; in nxt_unit_request_preread()
3170 mmap_buf->buf.free = mmap_buf->buf.start; in nxt_unit_request_preread()
3171 mmap_buf->buf.end = mmap_buf->buf.start + size; in nxt_unit_request_preread()
3191 mmap_buf->buf.end = mmap_buf->buf.free + res; in nxt_unit_request_preread()
3202 nxt_unit_buf_t *buf, *last_buf; in nxt_unit_buf_read() local
3207 buf = *b; in nxt_unit_buf_read()
3208 last_buf = buf; in nxt_unit_buf_read()
3210 while (buf != NULL) { in nxt_unit_buf_read()
3211 last_buf = buf; in nxt_unit_buf_read()
3213 copy = buf->end - buf->free; in nxt_unit_buf_read()
3216 p = nxt_cpymem(p, buf->free, copy); in nxt_unit_buf_read()
3218 buf->free += copy; in nxt_unit_buf_read()
3222 if (buf->end == buf->free) { in nxt_unit_buf_read()
3223 buf = nxt_unit_buf_next(buf); in nxt_unit_buf_read()
3229 buf = nxt_unit_buf_next(buf); in nxt_unit_buf_read()
3323 nxt_unit_buf_t *buf; in nxt_unit_websocket_sendv() local
3344 buf = &mmap_buf.buf; in nxt_unit_websocket_sendv()
3346 buf->start[0] = 0; in nxt_unit_websocket_sendv()
3347 buf->start[1] = 0; in nxt_unit_websocket_sendv()
3349 buf_size -= buf->end - buf->start; in nxt_unit_websocket_sendv()
3351 wh = (void *) buf->free; in nxt_unit_websocket_sendv()
3353 buf->free = nxt_websocket_frame_init(wh, payload_len); in nxt_unit_websocket_sendv()
3362 copy = buf->end - buf->free; in nxt_unit_websocket_sendv()
3365 buf->free = nxt_cpymem(buf->free, b, copy); in nxt_unit_websocket_sendv()
3370 if (nxt_fast_path(buf->free > buf->start)) { in nxt_unit_websocket_sendv()
3387 buf_size -= buf->end - buf->start; in nxt_unit_websocket_sendv()
3392 if (buf->free > buf->start) { in nxt_unit_websocket_sendv()
3435 if (ws_impl->buf->free_ptr != NULL || ws_impl->buf->hdr != NULL) { in nxt_unit_websocket_retain()
3439 size = ws_impl->buf->buf.end - ws_impl->buf->buf.start; in nxt_unit_websocket_retain()
3446 memcpy(b, ws_impl->buf->buf.start, size); in nxt_unit_websocket_retain()
3450 ws_impl->buf->buf.start = b; in nxt_unit_websocket_retain()
3451 ws_impl->buf->buf.free = b + hsize; in nxt_unit_websocket_retain()
3452 ws_impl->buf->buf.end = b + size; in nxt_unit_websocket_retain()
3454 ws_impl->buf->free_ptr = b; in nxt_unit_websocket_retain()
3940 mmap_buf->buf.start = mmap_buf->plain_ptr + sizeof(nxt_port_msg_t); in nxt_unit_get_outgoing_buf()
3941 mmap_buf->buf.free = mmap_buf->buf.start; in nxt_unit_get_outgoing_buf()
3942 mmap_buf->buf.end = mmap_buf->buf.start + size; in nxt_unit_get_outgoing_buf()
3945 mmap_buf->buf.start, (int) size); in nxt_unit_get_outgoing_buf()
3957 mmap_buf->buf.start = NULL; in nxt_unit_get_outgoing_buf()
3958 mmap_buf->buf.free = NULL; in nxt_unit_get_outgoing_buf()
3959 mmap_buf->buf.end = NULL; in nxt_unit_get_outgoing_buf()
3969 mmap_buf->buf.start = (char *) nxt_port_mmap_chunk_start(hdr, c); in nxt_unit_get_outgoing_buf()
3970 mmap_buf->buf.free = mmap_buf->buf.start; in nxt_unit_get_outgoing_buf()
3971 mmap_buf->buf.end = mmap_buf->buf.start + nchunks * PORT_MMAP_CHUNK_SIZE; in nxt_unit_get_outgoing_buf()
4273 b->buf.start = start; in nxt_unit_mmap_read()
4274 b->buf.free = start; in nxt_unit_mmap_read()
4275 b->buf.end = b->buf.start + size; in nxt_unit_mmap_read()
4887 port_msg = (nxt_port_msg_t *) rbuf->buf; in nxt_unit_is_read_queue()
4900 return rbuf->buf[0] == _NXT_PORT_MSG_READ_SOCKET; in nxt_unit_is_read_socket()
4913 port_msg = (nxt_port_msg_t *) rbuf->buf; in nxt_unit_is_shm_ack()
4928 port_msg = (nxt_port_msg_t *) rbuf->buf; in nxt_unit_is_quit()
5889 const void *buf, size_t buf_size, const nxt_send_oob_t *oob) in nxt_unit_port_send() argument
5904 rc = nxt_port_queue_send(port_impl->queue, buf, buf_size, &notify); in nxt_unit_port_send()
5917 memcpy(&msg, buf, sizeof(nxt_port_msg_t)); in nxt_unit_port_send()
5959 ret = lib->callbacks.port_send(ctx, port, buf, buf_size, in nxt_unit_port_send()
5960 oob != NULL ? oob->buf : NULL, in nxt_unit_port_send()
5968 ret = nxt_unit_sendmsg(ctx, port->out_fd, buf, buf_size, oob); in nxt_unit_port_send()
5981 const void *buf, size_t buf_size, const nxt_send_oob_t *oob) in nxt_unit_sendmsg() argument
5987 iov[0].iov_base = (void *) buf; in nxt_unit_sendmsg()
6131 memcpy(dst->buf, src->buf, src->size); in nxt_unit_rbuf_cpy()
6134 memcpy(dst->oob.buf, src->oob.buf, src->oob.size); in nxt_unit_rbuf_cpy()
6187 oob_size = sizeof(rbuf->oob.buf); in nxt_unit_port_recv()
6190 rbuf->buf, sizeof(rbuf->buf), in nxt_unit_port_recv()
6191 rbuf->oob.buf, &oob_size); in nxt_unit_port_recv()
6204 iov[0].iov_base = rbuf->buf; in nxt_unit_port_recv()
6205 iov[0].iov_len = sizeof(rbuf->buf); in nxt_unit_port_recv()
6246 rbuf->size = nxt_port_queue_recv(port_impl->queue, rbuf->buf); in nxt_unit_port_queue_recv()
6272 rbuf->size = nxt_app_queue_recv(queue, rbuf->buf, &cookie); in nxt_unit_app_queue_recv()
6277 port_msg = (nxt_port_msg_t *) rbuf->buf; in nxt_unit_app_queue_recv()