Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Typedefs | Functions
stream.h File Reference
#include <epan/tvbuff.h>
#include <epan/reassemble.h>
#include "ws_symbol_export.h"

Go to the source code of this file.

Typedefs

typedef struct stream stream_t
 
typedef struct stream_pdu_fragment stream_pdu_fragment_t
 

Functions

WS_DLL_PUBLIC stream_tstream_new (const struct conversation *conv, int p2p_dir)
 Initialise a new stream. Call this when you first identify a distinct stream. The conversation pointer is just used as a key to look up the stream.
 
WS_DLL_PUBLIC stream_tfind_stream (const struct conversation *conv, int p2p_dir)
 Retrieve a previously-created stream.
 
WS_DLL_PUBLIC stream_pdu_fragment_tstream_find_frag (stream_t *stream, uint32_t framenum, uint32_t offset)
 See if we've seen this fragment before.
 
WS_DLL_PUBLIC stream_pdu_fragment_tstream_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.
 
uint32_t stream_get_frag_length (const stream_pdu_fragment_t *frag)
 Get the length of a fragment previously found by stream_find_frag().
 
WS_DLL_PUBLIC fragment_headstream_get_frag_data (const stream_pdu_fragment_t *frag)
 Get a handle on the top of the chain of fragment_datas underlying this PDU.
 
WS_DLL_PUBLIC tvbuff_tstream_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 protocol tree, and construct a tvbuff with the reassembled data, otherwise just put a "reassembled in" item into the protocol tree.
 
uint32_t stream_get_pdu_no (const stream_pdu_fragment_t *frag)
 Get the PDU number. PDUs are numbered from zero within a stream.
 
void stream_init (void)
 Initializes stream-related data structures and reassembly tables.
 
void stream_cleanup (void)
 Cleans up stream-related data structures and reassembly tables.
 

Detailed Description

Definitions for handling circuit-switched protocols which are handled as streams, and don't have lengths and IDs such as are required for reassemble.h

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later

Function Documentation

◆ find_stream()

WS_DLL_PUBLIC stream_t * find_stream ( const struct conversation conv,
int  p2p_dir 
)

Retrieve a previously-created stream.

Parameters
convPointer to the conversation structure.
p2p_dirThe peer-to-peer direction.
Returns
Pointer to the retrieved stream, or NULL if not found.

◆ stream_add_frag()

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.

The framenum and offset are keys allowing future access with stream_find_frag(), tvb is the fragment to be added, and pinfo is the information for the frame containing this fragment. more_frags should be set if this is the final fragment in the PDU.

  • the fragment must be later in the stream than any previous fragment (ie, framenum.offset must be greater than those passed on the previous call)

This essentially means that you can only add fragments on the first pass through the stream.

Parameters
streamPointer to the stream structure.
framenumThe frame number of the fragment.
offsetThe byte offset within the frame.
tvbThe TVBuffer containing the fragment data.
pinfoPointer to the packet information structure for the frame containing this fragment.
more_fragsSet to true if this is the final fragment in the PDU, false otherwise.
Returns
Pointer to the newly added fragment, or NULL on failure.

◆ stream_find_frag()

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.

Parameters
streamPointer to the stream structure.
framenumThe frame number.
offsetThe byte offset within the frame.
Returns
Pointer to the found fragment, or NULL if not found.

◆ stream_get_frag_data()

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.

frag can be any fragment within a PDU, and it will always return the head of the chain

Returns NULL until the last fragment is added.

Parameters
fragA fragment within the PDU.
Returns
A pointer to the fragment list for the PDU, or NULL if not complete

◆ stream_get_frag_length()

uint32_t stream_get_frag_length ( const stream_pdu_fragment_t frag)
extern

Get the length of a fragment previously found by stream_find_frag().

Parameters
fragA fragment within the PDU.
Returns
The length of the fragment.

◆ stream_get_pdu_no()

uint32_t stream_get_pdu_no ( const stream_pdu_fragment_t frag)
extern

Get the PDU number. PDUs are numbered from zero within a stream.

Parameters
fragA fragment within the PDU.
Returns
The PDU number.

◆ stream_new()

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 pointer is just used as a key to look up the stream.

Parameters
convPointer to the conversation structure.
p2p_dirThe peer-to-peer direction.
Returns
Pointer to the newly created stream, or NULL on failure.

◆ stream_process_reassembled()

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 protocol tree, and construct a tvbuff with the reassembled data, otherwise just put a "reassembled in" item into the protocol tree.

Parameters
tvbThe original TVBuffer containing the fragment data.
offsetThe offset within the TVBuffer where the fragment starts.
pinfoPacket information structure.
nameName of the reassembled data source.
fragA fragment within the PDU.
fitPointer to the fragment items structure.
update_col_infopPointer to a boolean indicating whether to update column info.
treeProtocol tree for displaying fragment information.
Returns
A new TVBuffer containing the reassembled data, or NULL if not applicable.