HTTP2: allow subdissectors to query the Stream ID
authorPeter Wu <peter@lekensteyn.nl>
Thu, 27 Sep 2018 10:58:46 +0000 (12:58 +0200)
committerAnders Broman <a.broman58@gmail.com>
Thu, 27 Sep 2018 12:18:28 +0000 (12:18 +0000)
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>
epan/dissectors/packet-http2.c
epan/dissectors/packet-http2.h

index 2713060c836d073f10b56907c5a9800a0aa2a9df..654b286a6ea19289193253c7619976b76753885a 100644 (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)
index 774c41be8ba6d428ab1b16eba3c09a43750c5a85..8fb6c61b9121d69db3de6aa30c7530ce9aaf8c37 100644 (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
 
 /*