Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
stream.h
Go to the documentation of this file.
1
13#pragma once
14#include <epan/tvbuff.h>
15#include <epan/reassemble.h>
16#include "ws_symbol_export.h"
17
18struct _fragment_items;
19
20/* A stream represents the concept of an arbitrary stream of data,
21 divided up into frames for transmission, where the frames have
22 little or no correspondence to the PDUs of the protocol being
23 streamed, and those PDUs are just delineated by a magic number.
24
25 For example, we stream H.223 over IAX2. IAX2 has no concept of
26 H.223 PDUs and just divides the H.223 stream into 160-byte
27 frames. H.223 PDUs are delineated by two-byte magic numbers (which
28 may, of course, straddle an IAX2 frame boundary).
29
30 Essentially we act as a wrapper to reassemble.h, by making up
31 PDU ids and keeping some additional data on fragments to allow the
32 PDUs to be defragmented again.
33*/
34
35
36/* A stream_t represents a stream. There might be one or two streams
37 in a circuit, depending on whether that circuit is mono- or bi-directional.
38*/
39typedef struct stream stream_t;
40
41/* Fragments in a PDU are represented using a stream_pdu_fragment_t,
42 and placed in a linked-list with other fragments in the PDU.
43
44 (They're also placed in a hash so we can find them again later)
45*/
47
48
49struct conversation;
50
58WS_DLL_PUBLIC stream_t *stream_new ( const struct conversation *conv, int p2p_dir );
59
66WS_DLL_PUBLIC stream_t *find_stream ( const struct conversation *conv, int p2p_dir );
67
68
69
77WS_DLL_PUBLIC stream_pdu_fragment_t *stream_find_frag( stream_t *stream, uint32_t framenum, uint32_t offset );
78
103WS_DLL_PUBLIC stream_pdu_fragment_t *stream_add_frag( stream_t *stream, uint32_t framenum, uint32_t offset,
104 tvbuff_t *tvb, packet_info *pinfo, bool more_frags );
105
111extern uint32_t stream_get_frag_length( const stream_pdu_fragment_t *frag);
112
124WS_DLL_PUBLIC fragment_head *stream_get_frag_data( const stream_pdu_fragment_t *frag);
125
143 tvbuff_t *tvb, int offset, packet_info *pinfo,
144 const char *name, const stream_pdu_fragment_t *frag,
145 const struct _fragment_items *fit,
146 bool *update_col_infop, proto_tree *tree);
147
153extern uint32_t stream_get_pdu_no( const stream_pdu_fragment_t *frag);
154
158void stream_init( void );
159
163void stream_cleanup( void );
void stream_init(void)
Initializes stream-related data structures and reassembly tables.
Definition stream.c:311
WS_DLL_PUBLIC fragment_head * stream_get_frag_data(const stream_pdu_fragment_t *frag)
Get a handle on the top of the chain of fragment_datas underlying this PDU.
Definition stream.c:406
WS_DLL_PUBLIC tvbuff_t * stream_process_reassembled(tvbuff_t *tvb, int offset, packet_info *pinfo, const char *name, const stream_pdu_fragment_t *frag, const struct _fragment_items *fit, bool *update_col_infop, proto_tree *tree)
Process reassembled data; if this is the last fragment, put the fragment information into the protoco...
Definition stream.c:375
WS_DLL_PUBLIC stream_t * stream_new(const struct conversation *conv, int p2p_dir)
Initialise a new stream. Call this when you first identify a distinct stream. The conversation pointe...
Definition stream.c:274
WS_DLL_PUBLIC stream_t * find_stream(const struct conversation *conv, int p2p_dir)
Retrieve a previously-created stream.
Definition stream.c:292
WS_DLL_PUBLIC stream_pdu_fragment_t * stream_add_frag(stream_t *stream, uint32_t framenum, uint32_t offset, tvbuff_t *tvb, packet_info *pinfo, bool more_frags)
Add a new fragment to the fragment tables for the stream.
Definition stream.c:328
uint32_t stream_get_frag_length(const stream_pdu_fragment_t *frag)
Get the length of a fragment previously found by stream_find_frag().
Definition stream.c:400
void stream_cleanup(void)
Cleans up stream-related data structures and reassembly tables.
Definition stream.c:302
uint32_t stream_get_pdu_no(const stream_pdu_fragment_t *frag)
Get the PDU number. PDUs are numbered from zero within a stream.
Definition stream.c:412
WS_DLL_PUBLIC stream_pdu_fragment_t * stream_find_frag(stream_t *stream, uint32_t framenum, uint32_t offset)
See if we've seen this fragment before.
Definition stream.c:323
Represents the head of a fragment reassembly chain, tracking overall reassembly state across all cont...
Definition reassemble.h:77
Bundles all protocol tree and header field handles needed to display a reassembled fragment tree in t...
Definition reassemble.h:811
Represents the metadata and indexing information for a single captured frame.
Definition packet_info.h:43
Definition proto.h:909
Definition conversation.h:229
Definition stream.c:35
Definition stream.c:41
Core tvbuff (testy virtual buffer) structure representing a region of packet data,...
Definition tvbuff-int.h:95