3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
10 #ifndef __PACKET_QUIC_H__
11 #define __PACKET_QUIC_H__
13 #include "ws_symbol_export.h"
15 #include <glibconfig.h>
16 #include <wsutil/wsgcrypt.h>
20 #endif /* __cplusplus */
24 * Metadata for a STREAM frame.
25 * https://tools.ietf.org/html/draft-ietf-quic-transport-23#section-19.8
27 typedef struct _quic_stream_info
{
28 uint64_t stream_id
; /**< 62-bit Stream ID. */
29 uint64_t stream_offset
; /**< 62-bit stream offset. */
30 uint32_t offset
; /**< Offset within the stream (different for reassembled data). */
31 uint32_t inorder_offset
; /**< Offset of the inorder data. */
32 struct quic_info_data
*quic_info
; /**< Opaque data structure to find the QUIC session. */
37 * Although the QUIC SCID/DCID length field can store at most 255, v1 limits the
40 #define QUIC_MAX_CID_LENGTH 20
42 typedef struct quic_cid
{
44 uint8_t cid
[QUIC_MAX_CID_LENGTH
];
45 uint8_t reset_token
[16];
52 * Obtain Stream Type from a Stream ID.
53 * https://tools.ietf.org/html/draft-ietf-quic-transport-23#section-2.1
55 #define QUIC_STREAM_TYPE(stream_id) ((stream_id) & 3U)
56 #define QUIC_STREAM_CLIENT_BIDI 0
57 #define QUIC_STREAM_SERVER_BIDI 1
58 #define QUIC_STREAM_CLIENT_UNI 2
59 #define QUIC_STREAM_SERVER_UNI 3
61 /** QUIC Multipath versions; pre draft-07 uses sequence number
64 #define QUIC_MP_NO_PATH_ID 1
65 #define QUIC_MP_PATH_ID 2
67 /** Set/Get protocol-specific data for the QUIC STREAM. */
69 void quic_stream_add_proto_data(struct _packet_info
*pinfo
, quic_stream_info
*stream_info
, void *proto_data
);
70 void *quic_stream_get_proto_data(struct _packet_info
*pinfo
, quic_stream_info
*stream_info
);
72 /** Returns the number of items for quic.connection.number. */
73 WS_DLL_PUBLIC
uint32_t get_quic_connections_count(void);
75 typedef struct gquic_info_data
{
83 dissect_gquic_frame_type(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*gquic_tree
, unsigned offset
, uint8_t len_pkn
, gquic_info_data_t
*gquic_info
);
85 dissect_gquic_tags(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*ft_tree
, unsigned offset
);
88 quic_add_connection(packet_info
*pinfo
, quic_cid_t
*cid
);
90 quic_add_loss_bits(packet_info
*pinfo
, uint64_t value
);
92 quic_add_stateless_reset_token(packet_info
*pinfo
, tvbuff_t
*tvb
, int offset
, const quic_cid_t
*cid
);
94 quic_add_multipath(packet_info
*pinfo
, unsigned version
);
96 quic_add_grease_quic_bit(packet_info
*pinfo
);
98 quic_proto_tree_add_version(tvbuff_t
*tvb
, proto_tree
*tree
, int hfindex
, unsigned offset
);
101 * Retrieves the QUIC Stream ID which is smaller than or equal to the provided
102 * ID. If available, sub_stream_id_out will be set and true is returned.
105 quic_get_stream_id_le(unsigned streamid
, unsigned sub_stream_id
, unsigned *sub_stream_id_out
);
108 * Retrieves the QUIC Stream ID which is greater than or equal to the provided
109 * ID. If available, sub_stream_id_out will be set and true is returned.
112 quic_get_stream_id_ge(unsigned streamid
, unsigned sub_stream_id
, unsigned *sub_stream_id_out
);
116 * Retrieves the initial client DCID from the packet info, if available
119 quic_conn_data_get_conn_client_dcid_initial(struct _packet_info
*pinfo
, quic_cid_t
*dcid
);
123 #endif /* __cplusplus */
125 #endif /* __PACKET_QUIC_H__ */