HTTP2: allow subdissectors to query the Stream ID

This will be used by the DNS dissector to distinguish different
request/response pairs over the same connection (for DoH).

Change-Id: I53721904b007847861807faa1a2137e696639428
Reviewed-on: https://code.wireshark.org/review/29888
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Peter Wu 2018-09-27 12:58:46 +02:00 committed by Anders Broman
parent 776b4d5646
commit cc69e09981
2 changed files with 26 additions and 0 deletions

View File

@ -1105,6 +1105,25 @@ get_http2_session(packet_info *pinfo)
return h2session;
}
guint32
http2_get_stream_id(packet_info *pinfo)
{
conversation_t *conversation;
http2_session_t *h2session;
conversation = find_conversation_pinfo(pinfo, 0);
if (!conversation) {
return 0;
}
h2session = (http2_session_t*)conversation_get_proto_data(conversation, proto_http2);
if (!h2session) {
return 0;
}
return h2session->current_stream_id;
}
#ifdef HAVE_NGHTTP2
static guint32
select_http2_flow_index(packet_info *pinfo, http2_session_t *h2session)

View File

@ -25,6 +25,13 @@ int dissect_http2_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
*/
const gchar* http2_get_header_value(packet_info *pinfo, const gchar* name, gboolean the_other_direction);
/**
* Get the HTTP2 Stream ID for the current PDU (typically the DATA frame).
* Only valid when called from a HTTP/2 subdissector.
* Returns 0 if no HTTP/2 session was found.
*/
guint32 http2_get_stream_id(packet_info *pinfo);
#endif
/*