mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 23:27:04 +02:00
REORG: quic: Move ncbuf related function from quic_rx to quic_conn
Move quic_get_ncbuf() and quic_free_ncbuf() from quic_rx.c to quic_conn.h as static inlined functions.
This commit is contained in:
parent
e0d3eb496b
commit
43fbea0f38
@ -30,9 +30,9 @@
|
|||||||
#include <import/eb64tree.h>
|
#include <import/eb64tree.h>
|
||||||
#include <import/ebmbtree.h>
|
#include <import/ebmbtree.h>
|
||||||
|
|
||||||
#include <haproxy/buf.h>
|
|
||||||
#include <haproxy/chunk.h>
|
#include <haproxy/chunk.h>
|
||||||
#include <haproxy/ncbuf-t.h>
|
#include <haproxy/dynbuf.h>
|
||||||
|
#include <haproxy/ncbuf.h>
|
||||||
#include <haproxy/net_helper.h>
|
#include <haproxy/net_helper.h>
|
||||||
#include <haproxy/openssl-compat.h>
|
#include <haproxy/openssl-compat.h>
|
||||||
#include <haproxy/ticks.h>
|
#include <haproxy/ticks.h>
|
||||||
@ -130,6 +130,38 @@ static inline void quic_conn_mv_cids_to_cc_conn(struct quic_conn_closed *cc_conn
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Allocate the underlying required memory for <ncbuf> non-contiguous buffer */
|
||||||
|
static inline struct ncbuf *quic_get_ncbuf(struct ncbuf *ncbuf)
|
||||||
|
{
|
||||||
|
struct buffer buf = BUF_NULL;
|
||||||
|
|
||||||
|
if (!ncb_is_null(ncbuf))
|
||||||
|
return ncbuf;
|
||||||
|
|
||||||
|
b_alloc(&buf);
|
||||||
|
BUG_ON(b_is_null(&buf));
|
||||||
|
|
||||||
|
*ncbuf = ncb_make(buf.area, buf.size, 0);
|
||||||
|
ncb_init(ncbuf, 0);
|
||||||
|
|
||||||
|
return ncbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Release the underlying memory use by <ncbuf> non-contiguous buffer */
|
||||||
|
static inline void quic_free_ncbuf(struct ncbuf *ncbuf)
|
||||||
|
{
|
||||||
|
struct buffer buf;
|
||||||
|
|
||||||
|
if (ncb_is_null(ncbuf))
|
||||||
|
return;
|
||||||
|
|
||||||
|
buf = b_make(ncbuf->area, ncbuf->size, 0, 0);
|
||||||
|
b_free(&buf);
|
||||||
|
offer_buffers(NULL, 1);
|
||||||
|
|
||||||
|
*ncbuf = NCBUF_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void chunk_frm_appendf(struct buffer *buf, const struct quic_frame *frm);
|
void chunk_frm_appendf(struct buffer *buf, const struct quic_frame *frm);
|
||||||
void quic_set_connection_close(struct quic_conn *qc, const struct quic_err err);
|
void quic_set_connection_close(struct quic_conn *qc, const struct quic_err err);
|
||||||
void quic_set_tls_alert(struct quic_conn *qc, int alert);
|
void quic_set_tls_alert(struct quic_conn *qc, int alert);
|
||||||
|
@ -30,7 +30,6 @@ int quic_dgram_parse(struct quic_dgram *dgram, struct quic_conn *from_qc,
|
|||||||
int qc_treat_rx_pkts(struct quic_conn *qc);
|
int qc_treat_rx_pkts(struct quic_conn *qc);
|
||||||
int qc_parse_hd_form(struct quic_rx_packet *pkt,
|
int qc_parse_hd_form(struct quic_rx_packet *pkt,
|
||||||
unsigned char **pos, const unsigned char *end);
|
unsigned char **pos, const unsigned char *end);
|
||||||
void quic_free_ncbuf(struct ncbuf *ncbuf);
|
|
||||||
int qc_treat_rx_crypto_frms(struct quic_conn *qc, struct quic_enc_level *el,
|
int qc_treat_rx_crypto_frms(struct quic_conn *qc, struct quic_enc_level *el,
|
||||||
struct ssl_sock_ctx *ctx);
|
struct ssl_sock_ctx *ctx);
|
||||||
int qc_handle_frms_of_lost_pkt(struct quic_conn *qc,
|
int qc_handle_frms_of_lost_pkt(struct quic_conn *qc,
|
||||||
|
@ -674,38 +674,6 @@ static int qc_handle_strm_frm(struct quic_rx_packet *pkt,
|
|||||||
return !ret;
|
return !ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release the underlying memory use by <ncbuf> non-contiguous buffer */
|
|
||||||
void quic_free_ncbuf(struct ncbuf *ncbuf)
|
|
||||||
{
|
|
||||||
struct buffer buf;
|
|
||||||
|
|
||||||
if (ncb_is_null(ncbuf))
|
|
||||||
return;
|
|
||||||
|
|
||||||
buf = b_make(ncbuf->area, ncbuf->size, 0, 0);
|
|
||||||
b_free(&buf);
|
|
||||||
offer_buffers(NULL, 1);
|
|
||||||
|
|
||||||
*ncbuf = NCBUF_NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate the underlying required memory for <ncbuf> non-contiguous buffer */
|
|
||||||
static struct ncbuf *quic_get_ncbuf(struct ncbuf *ncbuf)
|
|
||||||
{
|
|
||||||
struct buffer buf = BUF_NULL;
|
|
||||||
|
|
||||||
if (!ncb_is_null(ncbuf))
|
|
||||||
return ncbuf;
|
|
||||||
|
|
||||||
b_alloc(&buf);
|
|
||||||
BUG_ON(b_is_null(&buf));
|
|
||||||
|
|
||||||
*ncbuf = ncb_make(buf.area, buf.size, 0);
|
|
||||||
ncb_init(ncbuf, 0);
|
|
||||||
|
|
||||||
return ncbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Parse <frm> CRYPTO frame coming with <pkt> packet at <qel> <qc> connectionn.
|
/* Parse <frm> CRYPTO frame coming with <pkt> packet at <qel> <qc> connectionn.
|
||||||
* Returns 1 if succeeded, 0 if not. Also set <*fast_retrans> to 1 if the
|
* Returns 1 if succeeded, 0 if not. Also set <*fast_retrans> to 1 if the
|
||||||
* speed up handshake completion may be run after having received duplicated
|
* speed up handshake completion may be run after having received duplicated
|
||||||
|
Loading…
Reference in New Issue
Block a user