+static quicly_datagram_t *
+quic_alloc_packet (quicly_packet_allocator_t * self, size_t payloadsize)
+{
+ quicly_datagram_t *packet;
+ if ((packet =
+ clib_mem_alloc (sizeof (*packet) + payloadsize +
+ sizeof (quic_encrypt_cb_ctx))) == NULL)
+ return NULL;
+ packet->data.base =
+ (uint8_t *) packet + sizeof (*packet) + sizeof (quic_encrypt_cb_ctx);
+ quic_encrypt_cb_ctx *encrypt_cb_ctx =
+ (quic_encrypt_cb_ctx *) ((uint8_t *) packet + sizeof (*packet));
+
+ clib_memset (encrypt_cb_ctx, 0, sizeof (*encrypt_cb_ctx));
+ return packet;
+}
+
+static void
+quic_free_packet (quicly_packet_allocator_t * self,
+ quicly_datagram_t * packet)
+{
+ clib_mem_free (packet);
+}
+
+quicly_packet_allocator_t quic_packet_allocator =
+ { quic_alloc_packet, quic_free_packet };
+