FD.io VPP  v19.04.4-rc0-5-ge88582fac
Vector Packet Processing
quic.c File Reference
+ Include dependency graph for quic.c:

Go to the source code of this file.

Data Structures

struct  st_util_session_cache_t
 

Macros

#define QUIC_INT_MAX   0x3FFFFFFFFFFFFFFF
 
#define PTLS_MAX_CERTS_IN_CONTEXT   16
 

Functions

static void quic_update_timer (quic_ctx_t *ctx)
 
static int64_t quic_get_time (quicly_now_cb *self)
 
static void quic_connection_closed (u32 conn_index)
 
static void quic_disconnect (u32 ctx_index, u32 thread_index)
 
u32 quic_ctx_half_open_alloc (void)
 
void quic_ctx_half_open_free (u32 ho_index)
 
quic_ctx_tquic_ctx_half_open_get (u32 ctx_index)
 
void quic_ctx_half_open_reader_unlock ()
 
u32 quic_ctx_half_open_index (quic_ctx_t *ctx)
 
u32 quic_ctx_alloc ()
 
static void quic_ctx_free (quic_ctx_t *ctx)
 
static quic_ctx_tquic_ctx_get (u32 ctx_index)
 
static quic_ctx_tquic_ctx_get_w_thread (u32 ctx_index, u8 thread_index)
 
static void quic_disconnect_transport (quic_ctx_t *ctx)
 
static int quic_send_datagram (session_t *session, quicly_datagram_t *packet)
 
static int quic_send_packets (quic_ctx_t *ctx)
 
static int quic_on_stop_sending (quicly_stream_t *stream, int error_code)
 
static int quic_on_receive_reset (quicly_stream_t *stream, int error_code)
 
static int quic_on_receive (quicly_stream_t *stream, size_t off, const void *src, size_t len)
 
static int quic_on_stream_open (quicly_stream_open_cb *self, quicly_stream_t *stream)
 
static void quic_on_conn_close (quicly_closed_by_peer_cb *self, quicly_conn_t *conn, int code, uint64_t frame_type, const char *reason, size_t reason_len)
 
static int encrypt_ticket_cb (ptls_encrypt_ticket_t *_self, ptls_t *tls, int is_encrypt, ptls_buffer_t *dst, ptls_iovec_t src)
 
static int ptls_compare_separator_line (const char *line, const char *begin_or_end, const char *label)
 
static int ptls_get_bio_pem_object (BIO *bio, const char *label, ptls_buffer_t *buf)
 
int ptls_load_bio_pem_objects (BIO *bio, const char *label, ptls_iovec_t *list, size_t list_max, size_t *nb_objects)
 
int ptls_load_bio_certificates (ptls_context_t *ctx, BIO *bio)
 
static void load_bio_certificate_chain (ptls_context_t *ctx, const char *cert_data)
 
static void load_bio_private_key (ptls_context_t *ctx, const char *pk_data)
 
static void allocate_quicly_ctx (application_t *app, u8 is_client)
 
static u32 quic_set_time_now (u32 thread_index)
 
static void quic_timer_expired (u32 conn_index)
 
static void quic_expired_timers_dispatch (u32 *expired_timers)
 
int quic_connect (transport_endpoint_cfg_t *tep)
 
u32 quic_start_listen (u32 app_listen_session_index, transport_endpoint_t *tep)
 
u32 quic_stop_listen (u32 lctx_index)
 
transport_connection_tquic_connection_get (u32 ctx_index, u32 thread_index)
 
transport_connection_tquic_listener_get (u32 listener_index)
 
static void quic_update_time (f64 now, u8 thread_index)
 
static u8format_quic_connection (u8 *s, va_list *args)
 
static u8format_quic_half_open (u8 *s, va_list *args)
 
static u8format_quic_listener (u8 *s, va_list *args)
 
static void quic_build_sockaddr (struct sockaddr *sa, socklen_t *salen, ip46_address_t *addr, u16 port, u8 is_ip4)
 
static int quic_delayed_notify_app_connected (void *ctx_index)
 
int quic_session_connected_callback (u32 quic_app_index, u32 ho_ctx_idx, session_t *s, u8 is_fail)
 
void quic_session_disconnect_callback (session_t *s)
 
void quic_session_reset_callback (session_t *s)
 
int quic_session_accepted_callback (session_t *s)
 
static int quic_add_segment_callback (u32 client_index, u64 seg_handle)
 
static int quic_del_segment_callback (u32 client_index, u64 seg_handle)
 
int quic_add_vpp_q_builtin_tx_evt (session_t *s)
 
void quic_open_stream_if_ready (quic_ctx_t *ctx)
 
int quic_custom_tx_callback (void *session)
 
int quic_find_packet_ctx (quic_ctx_t **ctx, quicly_conn_t **conn, struct sockaddr *sa, socklen_t salen, quicly_decoded_packet_t packet)
 
static int quic_receive (quic_ctx_t *ctx, quicly_conn_t *conn, quicly_decoded_packet_t packet)
 
static int quic_delayed_create_app_session (void *ctx_index)
 
static int quic_create_connection (quicly_context_t *quicly_ctx, u64 quic_session_handle, u32 lctx_index, quicly_conn_t *conn, struct sockaddr *sa, socklen_t salen, quicly_decoded_packet_t packet)
 
static int quic_reset_connection (quicly_context_t *quicly_ctx, u64 quic_session_handle, struct sockaddr *sa, socklen_t salen, quicly_decoded_packet_t packet)
 
int quic_app_rx_callback (session_t *quic_session)
 
static clib_error_tquic_init (vlib_main_t *vm)
 
quic_main_tvnet_quic_get_main (void)
 
 VLIB_PLUGIN_REGISTER ()
 

Variables

static quic_main_t quic_main
 
static const quicly_stream_callbacks_t quic_stream_callbacks
 
static quicly_stream_open_cb on_stream_open = { &quic_on_stream_open }
 
static quicly_closed_by_peer_cb on_closed_by_peer = { &quic_on_conn_close }
 
static struct st_util_session_cache_t sc
 
static ptls_context_t quic_tlsctx
 
quicly_now_cb quicly_vpp_now_cb = { quic_get_time }
 
static session_cb_vft_t quic_app_cb_vft
 
static const transport_proto_vft_t quic_proto
 

Macro Definition Documentation

◆ PTLS_MAX_CERTS_IN_CONTEXT

#define PTLS_MAX_CERTS_IN_CONTEXT   16

Definition at line 552 of file quic.c.

◆ QUIC_INT_MAX

#define QUIC_INT_MAX   0x3FFFFFFFFFFFFFFF

Definition at line 40 of file quic.c.

Function Documentation

◆ allocate_quicly_ctx()

static void allocate_quicly_ctx ( application_t app,
u8  is_client 
)
static

Definition at line 643 of file quic.c.

+ Here is the caller graph for this function:

◆ encrypt_ticket_cb()

static int encrypt_ticket_cb ( ptls_encrypt_ticket_t *  _self,
ptls_t *  tls,
int  is_encrypt,
ptls_buffer_t *  dst,
ptls_iovec_t  src 
)
static

Definition at line 351 of file quic.c.

◆ format_quic_connection()

static u8* format_quic_connection ( u8 s,
va_list *  args 
)
static

Definition at line 952 of file quic.c.

+ Here is the call graph for this function:

◆ format_quic_half_open()

static u8* format_quic_half_open ( u8 s,
va_list *  args 
)
static

Definition at line 959 of file quic.c.

+ Here is the call graph for this function:

◆ format_quic_listener()

static u8* format_quic_listener ( u8 s,
va_list *  args 
)
static

Definition at line 970 of file quic.c.

+ Here is the call graph for this function:

◆ load_bio_certificate_chain()

static void load_bio_certificate_chain ( ptls_context_t *  ctx,
const char *  cert_data 
)
inlinestatic

Definition at line 579 of file quic.c.

+ Here is the call graph for this function:

◆ load_bio_private_key()

static void load_bio_private_key ( ptls_context_t *  ctx,
const char *  pk_data 
)
inlinestatic

Definition at line 593 of file quic.c.

◆ ptls_compare_separator_line()

static int ptls_compare_separator_line ( const char *  line,
const char *  begin_or_end,
const char *  label 
)
static

Definition at line 425 of file quic.c.

+ Here is the caller graph for this function:

◆ ptls_get_bio_pem_object()

static int ptls_get_bio_pem_object ( BIO *  bio,
const char *  label,
ptls_buffer_t *  buf 
)
static

Definition at line 460 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ptls_load_bio_certificates()

int ptls_load_bio_certificates ( ptls_context_t *  ctx,
BIO *  bio 
)

Definition at line 555 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ptls_load_bio_pem_objects()

int ptls_load_bio_pem_objects ( BIO *  bio,
const char *  label,
ptls_iovec_t *  list,
size_t  list_max,
size_t *  nb_objects 
)

Definition at line 503 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_add_segment_callback()

static int quic_add_segment_callback ( u32  client_index,
u64  seg_handle 
)
static

Definition at line 1154 of file quic.c.

◆ quic_add_vpp_q_builtin_tx_evt()

int quic_add_vpp_q_builtin_tx_evt ( session_t s)

Definition at line 1172 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_app_rx_callback()

int quic_app_rx_callback ( session_t quic_session)

Definition at line 1408 of file quic.c.

+ Here is the call graph for this function:

◆ quic_build_sockaddr()

static void quic_build_sockaddr ( struct sockaddr *  sa,
socklen_t *  salen,
ip46_address_t *  addr,
u16  port,
u8  is_ip4 
)
inlinestatic

Definition at line 984 of file quic.c.

+ Here is the caller graph for this function:

◆ quic_connect()

int quic_connect ( transport_endpoint_cfg_t tep)

Definition at line 777 of file quic.c.

+ Here is the call graph for this function:

◆ quic_connection_closed()

static void quic_connection_closed ( u32  conn_index)
static

Definition at line 616 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_connection_get()

transport_connection_t* quic_connection_get ( u32  ctx_index,
u32  thread_index 
)

Definition at line 924 of file quic.c.

+ Here is the call graph for this function:

◆ quic_create_connection()

static int quic_create_connection ( quicly_context_t *  quicly_ctx,
u64  quic_session_handle,
u32  lctx_index,
quicly_conn_t *  conn,
struct sockaddr *  sa,
socklen_t  salen,
quicly_decoded_packet_t  packet 
)
static

Definition at line 1338 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_ctx_alloc()

u32 quic_ctx_alloc ( )

Definition at line 100 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_ctx_free()

static void quic_ctx_free ( quic_ctx_t ctx)
static

Definition at line 114 of file quic.c.

+ Here is the caller graph for this function:

◆ quic_ctx_get()

static quic_ctx_t* quic_ctx_get ( u32  ctx_index)
static

Definition at line 124 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_ctx_get_w_thread()

static quic_ctx_t* quic_ctx_get_w_thread ( u32  ctx_index,
u8  thread_index 
)
static

Definition at line 131 of file quic.c.

+ Here is the caller graph for this function:

◆ quic_ctx_half_open_alloc()

u32 quic_ctx_half_open_alloc ( void  )

Definition at line 43 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_ctx_half_open_free()

void quic_ctx_half_open_free ( u32  ho_index)

Definition at line 71 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_ctx_half_open_get()

quic_ctx_t* quic_ctx_half_open_get ( u32  ctx_index)

Definition at line 80 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_ctx_half_open_index()

u32 quic_ctx_half_open_index ( quic_ctx_t ctx)

Definition at line 94 of file quic.c.

◆ quic_ctx_half_open_reader_unlock()

void quic_ctx_half_open_reader_unlock ( )

Definition at line 88 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_custom_tx_callback()

int quic_custom_tx_callback ( void *  session)

Definition at line 1199 of file quic.c.

+ Here is the call graph for this function:

◆ quic_del_segment_callback()

static int quic_del_segment_callback ( u32  client_index,
u64  seg_handle 
)
static

Definition at line 1163 of file quic.c.

◆ quic_delayed_create_app_session()

static int quic_delayed_create_app_session ( void *  ctx_index)
static

Definition at line 1292 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_delayed_notify_app_connected()

static int quic_delayed_notify_app_connected ( void *  ctx_index)
static

Definition at line 1006 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_disconnect()

static void quic_disconnect ( u32  ctx_index,
u32  thread_index 
)
static

Definition at line 832 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_disconnect_transport()

static void quic_disconnect_transport ( quic_ctx_t ctx)
static

Definition at line 137 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_expired_timers_dispatch()

static void quic_expired_timers_dispatch ( u32 expired_timers)
static

Definition at line 759 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_find_packet_ctx()

int quic_find_packet_ctx ( quic_ctx_t **  ctx,
quicly_conn_t **  conn,
struct sockaddr *  sa,
socklen_t  salen,
quicly_decoded_packet_t  packet 
)

Definition at line 1240 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_get_time()

static int64_t quic_get_time ( quicly_now_cb *  self)
static

Definition at line 632 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_init()

static clib_error_t* quic_init ( vlib_main_t vm)
static

Definition at line 1512 of file quic.c.

+ Here is the call graph for this function:

◆ quic_listener_get()

transport_connection_t* quic_listener_get ( u32  listener_index)

Definition at line 933 of file quic.c.

+ Here is the call graph for this function:

◆ quic_on_conn_close()

static void quic_on_conn_close ( quicly_closed_by_peer_cb *  self,
quicly_conn_t *  conn,
int  code,
uint64_t  frame_type,
const char *  reason,
size_t  reason_len 
)
static

Definition at line 326 of file quic.c.

+ Here is the call graph for this function:

◆ quic_on_receive()

static int quic_on_receive ( quicly_stream_t *  stream,
size_t  off,
const void *  src,
size_t  len 
)
static

Definition at line 272 of file quic.c.

+ Here is the call graph for this function:

◆ quic_on_receive_reset()

static int quic_on_receive_reset ( quicly_stream_t *  stream,
int  error_code 
)
static

Definition at line 265 of file quic.c.

◆ quic_on_stop_sending()

static int quic_on_stop_sending ( quicly_stream_t *  stream,
int  error_code 
)
static

Definition at line 258 of file quic.c.

◆ quic_on_stream_open()

static int quic_on_stream_open ( quicly_stream_open_cb *  self,
quicly_stream_t *  stream 
)
static

Definition at line 310 of file quic.c.

◆ quic_open_stream_if_ready()

void quic_open_stream_if_ready ( quic_ctx_t ctx)

Definition at line 1181 of file quic.c.

+ Here is the caller graph for this function:

◆ quic_receive()

static int quic_receive ( quic_ctx_t ctx,
quicly_conn_t *  conn,
quicly_decoded_packet_t  packet 
)
static

Definition at line 1266 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_reset_connection()

static int quic_reset_connection ( quicly_context_t *  quicly_ctx,
u64  quic_session_handle,
struct sockaddr *  sa,
socklen_t  salen,
quicly_decoded_packet_t  packet 
)
static

Definition at line 1385 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_send_datagram()

static int quic_send_datagram ( session_t session,
quicly_datagram_t *  packet 
)
static

Definition at line 150 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_send_packets()

static int quic_send_packets ( quic_ctx_t ctx)
static

Definition at line 204 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_session_accepted_callback()

int quic_session_accepted_callback ( session_t s)

Definition at line 1147 of file quic.c.

◆ quic_session_connected_callback()

int quic_session_connected_callback ( u32  quic_app_index,
u32  ho_ctx_idx,
session_t s,
u8  is_fail 
)

Definition at line 1053 of file quic.c.

+ Here is the call graph for this function:

◆ quic_session_disconnect_callback()

void quic_session_disconnect_callback ( session_t s)

Definition at line 1135 of file quic.c.

◆ quic_session_reset_callback()

void quic_session_reset_callback ( session_t s)

Definition at line 1141 of file quic.c.

◆ quic_set_time_now()

static u32 quic_set_time_now ( u32  thread_index)
static

Definition at line 704 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_start_listen()

u32 quic_start_listen ( u32  app_listen_session_index,
transport_endpoint_t tep 
)

Definition at line 853 of file quic.c.

+ Here is the call graph for this function:

◆ quic_stop_listen()

u32 quic_stop_listen ( u32  lctx_index)

Definition at line 903 of file quic.c.

+ Here is the call graph for this function:

◆ quic_timer_expired()

static void quic_timer_expired ( u32  conn_index)
static

Definition at line 711 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quic_update_time()

static void quic_update_time ( f64  now,
u8  thread_index 
)
static

Definition at line 942 of file quic.c.

+ Here is the call graph for this function:

◆ quic_update_timer()

static void quic_update_timer ( quic_ctx_t ctx)
static

Definition at line 725 of file quic.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ VLIB_PLUGIN_REGISTER()

VLIB_PLUGIN_REGISTER ( )

◆ vnet_quic_get_main()

quic_main_t* vnet_quic_get_main ( void  )

Definition at line 1577 of file quic.c.

Variable Documentation

◆ on_closed_by_peer

quicly_closed_by_peer_cb on_closed_by_peer = { &quic_on_conn_close }
static

Definition at line 335 of file quic.c.

◆ on_stream_open

quicly_stream_open_cb on_stream_open = { &quic_on_stream_open }
static

Definition at line 323 of file quic.c.

◆ quic_app_cb_vft

session_cb_vft_t quic_app_cb_vft
static
Initial value:
= {
.session_accept_callback = quic_session_accepted_callback,
.session_disconnect_callback = quic_session_disconnect_callback,
.session_connected_callback = quic_session_connected_callback,
.session_reset_callback = quic_session_reset_callback,
.add_segment_callback = quic_add_segment_callback,
.del_segment_callback = quic_del_segment_callback,
.builtin_app_rx_callback = quic_app_rx_callback,
}
int quic_session_accepted_callback(session_t *s)
Definition: quic.c:1147
int quic_session_connected_callback(u32 quic_app_index, u32 ho_ctx_idx, session_t *s, u8 is_fail)
Definition: quic.c:1053
int quic_app_rx_callback(session_t *quic_session)
Definition: quic.c:1408
static int quic_add_segment_callback(u32 client_index, u64 seg_handle)
Definition: quic.c:1154
static int quic_del_segment_callback(u32 client_index, u64 seg_handle)
Definition: quic.c:1163
void quic_session_disconnect_callback(session_t *s)
Definition: quic.c:1135
void quic_session_reset_callback(session_t *s)
Definition: quic.c:1141

Definition at line 1484 of file quic.c.

◆ quic_main

quic_main_t quic_main
static

Definition at line 33 of file quic.c.

◆ quic_proto

const transport_proto_vft_t quic_proto
static
Initial value:
= {
.connect = quic_connect,
.close = quic_disconnect,
.start_listen = quic_start_listen,
.stop_listen = quic_stop_listen,
.get_connection = quic_connection_get,
.get_listener = quic_listener_get,
.update_time = quic_update_time,
.service_type = TRANSPORT_SERVICE_APP,
.format_connection = format_quic_connection,
.format_half_open = format_quic_half_open,
.format_listener = format_quic_listener,
}
transport_connection_t * quic_listener_get(u32 listener_index)
Definition: quic.c:933
int quic_connect(transport_endpoint_cfg_t *tep)
Definition: quic.c:777
static u8 * format_quic_connection(u8 *s, va_list *args)
Definition: quic.c:952
static void quic_disconnect(u32 ctx_index, u32 thread_index)
Definition: quic.c:832
u32 quic_start_listen(u32 app_listen_session_index, transport_endpoint_t *tep)
Definition: quic.c:853
app transport service
transport_connection_t * quic_connection_get(u32 ctx_index, u32 thread_index)
Definition: quic.c:924
int quic_custom_tx_callback(void *session)
Definition: quic.c:1199
static void quic_update_time(f64 now, u8 thread_index)
Definition: quic.c:942
apps acting as transports
static u8 * format_quic_listener(u8 *s, va_list *args)
Definition: quic.c:970
u32 quic_stop_listen(u32 lctx_index)
Definition: quic.c:903
static u8 * format_quic_half_open(u8 *s, va_list *args)
Definition: quic.c:959

Definition at line 1494 of file quic.c.

◆ quic_stream_callbacks

const quicly_stream_callbacks_t quic_stream_callbacks
static
Initial value:
= {
.on_destroy = quicly_streambuf_destroy,
.on_send_shift = quicly_streambuf_egress_shift,
.on_send_emit = quicly_streambuf_egress_emit,
.on_send_stop = quic_on_stop_sending,
.on_receive = quic_on_receive,
.on_receive_reset = quic_on_receive_reset
}
static int quic_on_receive(quicly_stream_t *stream, size_t off, const void *src, size_t len)
Definition: quic.c:272
static int quic_on_stop_sending(quicly_stream_t *stream, int error_code)
Definition: quic.c:258
static int quic_on_receive_reset(quicly_stream_t *stream, int error_code)
Definition: quic.c:265

Definition at line 300 of file quic.c.

◆ quic_tlsctx

ptls_context_t quic_tlsctx
static
Initial value:
= {
.random_bytes = ptls_openssl_random_bytes,
.get_time = &ptls_get_time,
.key_exchanges = ptls_openssl_key_exchanges,
.cipher_suites = ptls_openssl_cipher_suites,
.certificates = {
.list = NULL,
.count = 0
},
.esni = NULL,
.on_client_hello = NULL,
.emit_certificate = NULL,
.sign_certificate = NULL,
.verify_certificate = NULL,
.ticket_lifetime = 86400,
.max_early_data_size = 8192,
.hkdf_label_prefix__obsolete = NULL,
.require_dhe_on_psk = 1,
.encrypt_ticket = &sc.super,
}
ptls_encrypt_ticket_t super
Definition: quic.c:345
#define NULL
Definition: clib.h:58
static struct st_util_session_cache_t sc
Definition: quic.c:395

Definition at line 402 of file quic.c.

◆ quicly_vpp_now_cb

quicly_now_cb quicly_vpp_now_cb = { quic_get_time }

Definition at line 640 of file quic.c.

◆ sc

struct st_util_session_cache_t sc
static
Initial value:
= {
.super = {
},
}
static int encrypt_ticket_cb(ptls_encrypt_ticket_t *_self, ptls_t *tls, int is_encrypt, ptls_buffer_t *dst, ptls_iovec_t src)
Definition: quic.c:351

Definition at line 395 of file quic.c.