annotate src/event/quic/ngx_event_quic_frames.h @ 8947:6ccf3867959a quic

QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs(). They are replaced with ngx_quic_write_chain() and ngx_quic_read_chain(). These functions represent the API to data buffering. The first function adds data of given size at given offset to the buffer. Now it returns the unwritten part of the chain similar to c->send_chain(). The second function returns data of given size from the beginning of the buffer. Its second argument and return value are swapped compared to ngx_quic_split_bufs() to better match ngx_quic_write_chain(). Added, returned and stored data are regular ngx_chain_t/ngx_buf_t chains. Missing data is marked with b->sync flag. The functions are now used in both send and recv data chains in QUIC streams.
author Roman Arutyunyan <arut@nginx.com>
date Fri, 24 Dec 2021 18:17:23 +0300
parents 56dec0d4e5b1
children 19e063e955bf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8749
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
1
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
2 /*
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
3 * Copyright (C) Nginx, Inc.
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
4 */
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
5
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
6
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
7 #ifndef _NGX_EVENT_QUIC_FRAMES_H_INCLUDED_
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
8 #define _NGX_EVENT_QUIC_FRAMES_H_INCLUDED_
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
9
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
10
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
11 #include <ngx_config.h>
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
12 #include <ngx_core.h>
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
13
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
14
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
15 typedef ngx_int_t (*ngx_quic_frame_handler_pt)(ngx_connection_t *c,
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
16 ngx_quic_frame_t *frame, void *data);
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
17
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
18
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
19 ngx_quic_frame_t *ngx_quic_alloc_frame(ngx_connection_t *c);
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
20 void ngx_quic_free_frame(ngx_connection_t *c, ngx_quic_frame_t *frame);
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
21 void ngx_quic_free_frames(ngx_connection_t *c, ngx_queue_t *frames);
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
22 void ngx_quic_queue_frame(ngx_quic_connection_t *qc, ngx_quic_frame_t *frame);
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
23 ngx_int_t ngx_quic_split_frame(ngx_connection_t *c, ngx_quic_frame_t *f,
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
24 size_t len);
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
25
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
26 ngx_chain_t *ngx_quic_alloc_buf(ngx_connection_t *c);
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
27 ngx_chain_t *ngx_quic_copy_buf(ngx_connection_t *c, u_char *data,
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
28 size_t len);
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
29 ngx_chain_t *ngx_quic_copy_chain(ngx_connection_t *c, ngx_chain_t *in,
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
30 size_t limit);
8782
b3f6ad181df4 QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents: 8779
diff changeset
31 void ngx_quic_trim_bufs(ngx_chain_t *in, size_t size);
8779
f52a2b77d406 QUIC: generic buffering for stream input.
Roman Arutyunyan <arut@nginx.com>
parents: 8749
diff changeset
32 void ngx_quic_free_bufs(ngx_connection_t *c, ngx_chain_t *in);
8947
6ccf3867959a QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents: 8946
diff changeset
33 ngx_chain_t *ngx_quic_read_chain(ngx_connection_t *c, ngx_chain_t **chain,
6ccf3867959a QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents: 8946
diff changeset
34 off_t limit);
6ccf3867959a QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents: 8946
diff changeset
35 ngx_chain_t *ngx_quic_write_chain(ngx_connection_t *c, ngx_chain_t **chain,
8946
56dec0d4e5b1 QUIC: avoid excessive buffer allocations in stream output.
Roman Arutyunyan <arut@nginx.com>
parents: 8782
diff changeset
36 ngx_chain_t *in, off_t limit, off_t offset);
8749
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
37
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
38 #if (NGX_DEBUG)
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
39 void ngx_quic_log_frame(ngx_log_t *log, ngx_quic_frame_t *f, ngx_uint_t tx);
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
40 #else
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
41 #define ngx_quic_log_frame(log, f, tx)
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
42 #endif
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
43
660c4a2f95f3 QUIC: separate files for frames related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff changeset
44 #endif /* _NGX_EVENT_QUIC_FRAMES_H_INCLUDED_ */