/*
- * Copyright (c) 2019 Cisco and/or its affiliates.
+ * Copyright (c) 2021 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
#include <quicly.h>
+#include <vnet/crypto/crypto.h>
+#include <vppinfra/lock.h>
+
/* QUIC log levels
* 1 - errors
* 2 - connection/stream events
#define QUIC_SEND_PACKET_VEC_SIZE 16
#define QUIC_IV_LEN 17
-#define QUIC_SEND_MAX_BATCH_PACKETS 16
-#define QUIC_RCV_MAX_BATCH_PACKETS 16
+#define QUIC_MAX_COALESCED_PACKET 4
+
+#define QUIC_RCV_MAX_PACKETS 16
+
#define QUIC_DEFAULT_CONN_TIMEOUT (30 * 1000) /* 30 seconds */
/* Taken from quicly.c */
#define QUIC_APP_ACCEPT_NOTIFY_ERROR QUICLY_ERROR_FROM_APPLICATION_ERROR_CODE(0x2)
#define QUIC_APP_CONNECT_NOTIFY_ERROR QUICLY_ERROR_FROM_APPLICATION_ERROR_CODE(0x3)
+#define QUIC_DECRYPT_PACKET_OK 0
+#define QUIC_DECRYPT_PACKET_NOTOFFLOADED 1
+#define QUIC_DECRYPT_PACKET_ERROR 2
+
#if QUIC_DEBUG
#define QUIC_DBG(_lvl, _fmt, _args...) \
if (_lvl <= QUIC_DEBUG) \
QUIC_F_IS_LISTENER = (1 << 1),
} quic_ctx_flags_t;
+typedef enum quic_cc_type
+{
+ QUIC_CC_RENO,
+ QUIC_CC_CUBIC,
+} quic_cc_type_t;
+
/* This structure is used to implement the concept of VPP connection for QUIC.
* We create one per connection and one per stream. */
typedef struct quic_ctx_
struct
{ /** STREAM ctx case */
quicly_stream_t *stream;
+ u64 bytes_written;
u32 quic_connection_ctx_id;
u8 _sctx_end_marker; /* Leave this at the end */
};
u32 crypto_engine;
u32 crypto_context_index;
u8 flags;
+
+ struct
+ {
+ ptls_cipher_context_t *hp_ctx;
+ ptls_aead_context_t *aead_ctx;
+ } ingress_keys;
+ int key_phase_ingress;
+
} quic_ctx_t;
/* Make sure our custom fields don't overlap with the fields we use in
ptls_cipher_suite_t ***quic_ciphers; /**< available ciphers by crypto engine */
uword *available_crypto_engines; /**< Bitmap for registered engines */
u8 default_crypto_engine; /**< Used if you do connect with CRYPTO_ENGINE_NONE (0) */
+ u64 max_packets_per_key; /**< number of packets that can be sent without a key update */
+ u8 default_quic_cc;
ptls_handshake_properties_t hs_properties;
quic_session_cache_t session_cache;
u32 udp_fifo_size;
u32 udp_fifo_prealloc;
u32 connection_timeout;
+
+ u8 vnet_crypto_enabled;
+ u32 *per_thread_crypto_key_indices;
} quic_main_t;
#endif /* __included_quic_h__ */