diff options
Diffstat (limited to 'lib/vquic/vquic_int.h')
-rw-r--r-- | lib/vquic/vquic_int.h | 68 |
1 files changed, 42 insertions, 26 deletions
diff --git a/lib/vquic/vquic_int.h b/lib/vquic/vquic_int.h index 42aba39b0..f0129e19d 100644 --- a/lib/vquic/vquic_int.h +++ b/lib/vquic/vquic_int.h @@ -25,47 +25,63 @@ ***************************************************************************/ #include "curl_setup.h" +#include "bufq.h" #ifdef ENABLE_QUIC -struct vquic_blocked_pkt { - const uint8_t *pkt; - size_t pktlen; - size_t gsolen; -}; +#define MAX_PKT_BURST 10 +#define MAX_UDP_PAYLOAD_SIZE 1452 struct cf_quic_ctx { - curl_socket_t sockfd; - struct sockaddr_storage local_addr; - socklen_t local_addrlen; - struct vquic_blocked_pkt blocked_pkt[2]; - uint8_t *pktbuf; - /* the number of entries in blocked_pkt */ - size_t num_blocked_pkt; - size_t num_blocked_pkt_sent; - /* the packets blocked by sendmsg (EAGAIN or EWOULDBLOCK) */ - size_t pktbuflen; - /* the number of processed entries in blocked_pkt */ - bool no_gso; + curl_socket_t sockfd; /* connected UDP socket */ + struct sockaddr_storage local_addr; /* address socket is bound to */ + socklen_t local_addrlen; /* length of local address */ + + struct bufq sendbuf; /* buffer for sending one or more packets */ + size_t gsolen; /* length of individual packets in send buf */ + size_t split_len; /* if != 0, buffer length after which GSO differs */ + size_t split_gsolen; /* length of individual packets after split_len */ + bool no_gso; /* do not use gso on sending */ }; -CURLcode vquic_ctx_init(struct cf_quic_ctx *qctx, size_t pktbuflen); +CURLcode vquic_ctx_init(struct cf_quic_ctx *qctx); void vquic_ctx_free(struct cf_quic_ctx *qctx); -CURLcode vquic_send_packet(struct Curl_cfilter *cf, - struct Curl_easy *data, - struct cf_quic_ctx *qctx, - const uint8_t *pkt, size_t pktlen, size_t gsolen, - size_t *psent); +CURLcode vquic_send_packets(struct Curl_cfilter *cf, + struct Curl_easy *data, + struct cf_quic_ctx *qctx, + const uint8_t *pkt, size_t pktlen, size_t gsolen, + size_t *psent); void vquic_push_blocked_pkt(struct Curl_cfilter *cf, struct cf_quic_ctx *qctx, const uint8_t *pkt, size_t pktlen, size_t gsolen); -CURLcode vquic_send_blocked_pkt(struct Curl_cfilter *cf, - struct Curl_easy *data, - struct cf_quic_ctx *qctx); +CURLcode vquic_send_blocked_pkts(struct Curl_cfilter *cf, + struct Curl_easy *data, + struct cf_quic_ctx *qctx); + +CURLcode vquic_send(struct Curl_cfilter *cf, struct Curl_easy *data, + struct cf_quic_ctx *qctx, size_t gsolen); + +CURLcode vquic_send_tail_split(struct Curl_cfilter *cf, struct Curl_easy *data, + struct cf_quic_ctx *qctx, size_t gsolen, + size_t tail_len, size_t tail_gsolen); +CURLcode vquic_flush(struct Curl_cfilter *cf, struct Curl_easy *data, + struct cf_quic_ctx *qctx); + + +typedef CURLcode vquic_recv_pkt_cb(const unsigned char *pkt, size_t pktlen, + struct sockaddr_storage *remote_addr, + socklen_t remote_addrlen, int ecn, + void *userp); + +CURLcode vquic_recv_packets(struct Curl_cfilter *cf, + struct Curl_easy *data, + struct cf_quic_ctx *qctx, + size_t max_pkts, + vquic_recv_pkt_cb *recv_cb, void *userp); #endif /* !ENABLE_QUIC */ |