2 * Routines for HTTP/2 dissection
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
10 #ifndef __PACKET_HTTP2_H__
11 #define __PACKET_HTTP2_H__
15 #endif /* __cplusplus */
17 /* http2 standard headers */
18 #define HTTP2_HEADER_CONTENT_ENCODING "content-encoding"
19 #define HTTP2_HEADER_STATUS ":status"
20 #define HTTP2_HEADER_STATUS_PARTIAL_CONTENT "206"
21 #define HTTP2_HEADER_METHOD ":method"
22 #define HTTP2_HEADER_METHOD_CONNECT "CONNECT"
23 #define HTTP2_HEADER_TRANSFER_ENCODING "transfer-encoding"
24 #define HTTP2_HEADER_PATH ":path"
25 #define HTTP2_HEADER_AUTHORITY ":authority"
26 #define HTTP2_HEADER_SCHEME ":scheme"
27 #define HTTP2_HEADER_CONTENT_TYPE "content-type"
28 #define HTTP2_HEADER_UNKNOWN "<unknown>"
30 #define HTTP2_HEADER_GRPC_ENCODING "grpc-encoding"
32 int dissect_http2_pdu(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
);
34 /** Get header value from current or the other direction stream.
35 * Return the value of a header if it appear in previous HEADERS or PROMISE frames in
36 * current or the other direction stream. Subdissector may invoke this function to get http2
38 * @param pinfo packet info pointer. Http2 dissector passes it to subdissector
39 * when dissecting http2.data.data.
40 * @param name the name of header.
41 * @param the_other_direction false means from current direction stream, true from the other.
42 * @return NULL if header was not found. Or header value. Note: the value is allocated
44 * @note The returned field value is decoded from US-ASCII and characters outside
45 * that range, i.e. obs-text, are replaced with UTF-8 REPLACEMENT CHARACTERS.
46 * Dissectors may need to perform additional decoding (e.g., percent decoding or
47 * the more robust decoding per RFC 8187.)
48 * @warning Don't call this if HTTP but not HTTP/2 is present in the packet
49 * (e.g. test with proto_is_frame_protocol() first). This ultimately calls
50 * get_http2_session, creating a HTTP/2 session on the current conversation,
51 * which can confuse the HTTP dissector. (This should be fixed.)
53 const char* http2_get_header_value(packet_info
*pinfo
, const char* name
, bool the_other_direction
);
56 * Get the HTTP/2 Stream ID for the current PDU (typically the DATA frame).
57 * Only valid when called from a HTTP/2 subdissector.
58 * Returns 0 if no HTTP/2 session was found.
60 uint32_t http2_get_stream_id(packet_info
*pinfo
);
63 * Retrieves the HTTP/2 Stream ID which is smaller than or equal to the provided
64 * ID. If available, sub_stream_id_out will be set and true is returned.
67 http2_get_stream_id_le(unsigned streamid
, unsigned sub_stream_id
, unsigned *sub_stream_id_out
);
70 * Retrieves the HTTP/2 Stream ID which is greater than or equal to the provided
71 * ID. If available, sub_stream_id_out will be set and true is returned.
74 http2_get_stream_id_ge(unsigned streamid
, unsigned sub_stream_id
, unsigned *sub_stream_id_out
);
77 dissect_http2_settings_ext(tvbuff_t
* tvb
, packet_info
* pinfo _U_
, proto_tree
* http2_tree
, unsigned offset
);
81 #endif /* __cplusplus */
86 * Editor modelines - https://www.wireshark.org/tools/modelines.html
91 * indent-tabs-mode: nil
94 * vi: set shiftwidth=4 tabstop=8 expandtab:
95 * :indentSize=4:tabSize=8:noTabs=true: