Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-quic.h
bloba98307e412e8ff58983cdd7379719a1935961e30
1 /* packet-quic.h
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
8 */
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>
18 #ifdef __cplusplus
19 extern "C" {
20 #endif /* __cplusplus */
23 /**
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. */
33 bool from_server;
34 } quic_stream_info;
37 * Although the QUIC SCID/DCID length field can store at most 255, v1 limits the
38 * CID length to 20.
40 #define QUIC_MAX_CID_LENGTH 20
42 typedef struct quic_cid {
43 uint8_t len;
44 uint8_t cid[QUIC_MAX_CID_LENGTH];
45 uint8_t reset_token[16];
46 bool reset_token_set;
47 uint64_t seq_num;
48 uint64_t path_id;
49 } quic_cid_t;
51 /**
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
62 * instead of path ID.
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 {
76 uint8_t version;
77 bool version_valid;
78 bool encoding;
79 uint16_t server_port;
80 } gquic_info_data_t;
82 int
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);
84 uint32_t
85 dissect_gquic_tags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ft_tree, unsigned offset);
87 void
88 quic_add_connection(packet_info *pinfo, quic_cid_t *cid);
89 void
90 quic_add_loss_bits(packet_info *pinfo, uint64_t value);
91 void
92 quic_add_stateless_reset_token(packet_info *pinfo, tvbuff_t *tvb, int offset, const quic_cid_t *cid);
93 void
94 quic_add_multipath(packet_info *pinfo, unsigned version);
95 void
96 quic_add_grease_quic_bit(packet_info *pinfo);
97 void
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.
104 WS_DLL_PUBLIC bool
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.
111 WS_DLL_PUBLIC bool
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
118 WS_DLL_PUBLIC bool
119 quic_conn_data_get_conn_client_dcid_initial(struct _packet_info *pinfo, quic_cid_t *dcid);
121 #ifdef __cplusplus
123 #endif /* __cplusplus */
125 #endif /* __PACKET_QUIC_H__ */