Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions
conversation_table.h File Reference
#include "conv_id.h"
#include "tap.h"
#include "conversation.h"
#include <epan/wmem_scopes.h>

Go to the source code of this file.

Classes

struct  _conversation_hash_t
 
struct  _conversation_key_t
 
struct  endpoint_key_t
 
struct  _ct_dissector_info
 
struct  _et_dissector_info
 
struct  _conversation_extension_tcp_t
 
struct  _conversation_item_t
 
struct  _endpoint_item_t
 

Macros

#define CONV_FILTER_INVALID   "INVALID"
 
#define ENDPOINT_TAP_PREFIX   "endpoints"
 

Typedefs

typedef struct _conversation_hash_t conv_hash_t
 
typedef struct _conversation_key_t conv_key_t
 
typedef endpoint_key_t host_key_t
 
typedef const char *(* conv_get_filter_type) (struct _conversation_item_t *item, conv_filter_type_e filter)
 
typedef struct _ct_dissector_info ct_dissector_info_t
 
typedef const char *(* endpoint_get_filter_type) (struct _endpoint_item_t *item, conv_filter_type_e filter_type)
 
typedef struct _et_dissector_info et_dissector_info_t
 
typedef et_dissector_info_t hostlist_dissector_info_t
 
typedef void(* conv_gui_init_cb) (struct register_ct *ct, const char *filter)
 
typedef void(* endpoint_gui_init_cb) (struct register_ct *ct, const char *filter)
 
typedef struct register_ct register_ct_t
 
typedef struct _conversation_extension_tcp_t conv_extension_tcp_t
 
typedef struct _conversation_item_t conv_item_t
 
typedef struct _endpoint_item_t endpoint_item_t
 
typedef endpoint_item_t hostlist_talker_t
 

Enumerations

enum  conv_filter_type_e {
  CONV_FT_SRC_ADDRESS , CONV_FT_DST_ADDRESS , CONV_FT_ANY_ADDRESS , CONV_FT_SRC_PORT ,
  CONV_FT_DST_PORT , CONV_FT_ANY_PORT
}
 
enum  conv_direction_e {
  CONV_DIR_A_TO_FROM_B , CONV_DIR_A_TO_B , CONV_DIR_A_FROM_B , CONV_DIR_A_TO_FROM_ANY ,
  CONV_DIR_A_TO_ANY , CONV_DIR_A_FROM_ANY , CONV_DIR_ANY_TO_FROM_B , CONV_DIR_ANY_TO_B ,
  CONV_DIR_ANY_FROM_B
}
 

Functions

WS_DLL_PUBLIC void register_conversation_table (const int proto_id, bool hide_ports, tap_packet_cb conv_packet_func, tap_packet_cb endpoint_packet_func)
 
WS_DLL_PUBLIC bool get_conversation_hide_ports (register_ct_t *ct)
 
WS_DLL_PUBLIC int get_conversation_proto_id (register_ct_t *ct)
 
WS_DLL_PUBLIC tap_packet_cb get_conversation_packet_func (register_ct_t *ct)
 
WS_DLL_PUBLIC tap_packet_cb get_endpoint_packet_func (register_ct_t *ct)
 
WS_DLL_PUBLIC tap_packet_cb get_hostlist_packet_func (register_ct_t *ct)
 
WS_DLL_PUBLIC register_ct_tget_conversation_by_proto_id (int proto_id)
 
WS_DLL_PUBLIC void conversation_table_set_gui_info (conv_gui_init_cb init_cb)
 
WS_DLL_PUBLIC void endpoint_table_set_gui_info (endpoint_gui_init_cb init_cb)
 
WS_DLL_PUBLIC void hostlist_table_set_gui_info (endpoint_gui_init_cb init_cb)
 
WS_DLL_PUBLIC void conversation_table_iterate_tables (wmem_foreach_func func, void *user_data)
 
WS_DLL_PUBLIC unsigned conversation_table_get_num (void)
 
WS_DLL_PUBLIC void reset_conversation_table_data (conv_hash_t *ch)
 
WS_DLL_PUBLIC void reset_endpoint_table_data (conv_hash_t *ch)
 
WS_DLL_PUBLIC void reset_hostlist_table_data (conv_hash_t *ch)
 
WS_DLL_PUBLIC void dissector_conversation_init (const char *opt_arg, void *userdata)
 
WS_DLL_PUBLIC void dissector_endpoint_init (const char *opt_arg, void *userdata)
 
WS_DLL_PUBLIC void dissector_hostlist_init (const char *opt_arg, void *userdata)
 
WS_DLL_PUBLIC char * get_conversation_address (wmem_allocator_t *allocator, address *addr, bool resolve_names)
 
WS_DLL_PUBLIC char * get_conversation_port (wmem_allocator_t *allocator, uint32_t port, conversation_type ctype, bool resolve_names)
 
WS_DLL_PUBLIC char * get_endpoint_port (wmem_allocator_t *allocator, endpoint_item_t *item, bool resolve_names)
 
WS_DLL_PUBLIC char * get_conversation_filter (conv_item_t *conv_item, conv_direction_e direction)
 
WS_DLL_PUBLIC char * get_endpoint_filter (endpoint_item_t *endpoint_item)
 
WS_DLL_PUBLIC char * get_hostlist_filter (endpoint_item_t *endpoint_item)
 
WS_DLL_PUBLIC void add_conversation_table_data (conv_hash_t *ch, const address *src, const address *dst, uint32_t src_port, uint32_t dst_port, int num_frames, int num_bytes, nstime_t *ts, nstime_t *abs_ts, ct_dissector_info_t *ct_info, conversation_type ctype)
 
WS_DLL_PUBLIC conv_item_tadd_conversation_table_data_with_conv_id (conv_hash_t *ch, const address *src, const address *dst, uint32_t src_port, uint32_t dst_port, conv_id_t conv_id, int num_frames, int num_bytes, nstime_t *ts, nstime_t *abs_ts, ct_dissector_info_t *ct_info, conversation_type ctype)
 
WS_DLL_PUBLIC void add_conversation_table_data_extended (conv_hash_t *ch, const address *src, const address *dst, uint32_t src_port, uint32_t dst_port, conv_id_t conv_id, int num_frames, int num_bytes, nstime_t *ts, nstime_t *abs_ts, ct_dissector_info_t *ct_info, conversation_type ctype, uint32_t frameid, int(*proto_conv_cb)(conversation_t *))
 
WS_DLL_PUBLIC void add_conversation_table_data_ipv4_subnet (conv_hash_t *ch, const address *src, const address *dst, uint32_t src_port, uint32_t dst_port, conv_id_t conv_id, int num_frames, int num_bytes, nstime_t *ts, nstime_t *abs_ts, ct_dissector_info_t *ct_info, conversation_type ctype)
 
WS_DLL_PUBLIC void add_endpoint_table_data (conv_hash_t *ch, const address *addr, uint32_t port, bool sender, int num_frames, int num_bytes, et_dissector_info_t *et_info, endpoint_type etype)
 
WS_DLL_PUBLIC void add_endpoint_table_data_ipv4_subnet (conv_hash_t *ch, const address *addr, uint32_t port, bool sender, int num_frames, int num_bytes, et_dissector_info_t *et_info, endpoint_type etype)
 
WS_DLL_PUBLIC void add_hostlist_table_data (conv_hash_t *ch, const address *addr, uint32_t port, bool sender, int num_frames, int num_bytes, et_dissector_info_t *et_info, endpoint_type etype)
 

Detailed Description

Conversation definitions.

Typedef Documentation

◆ conv_extension_tcp_t

Conversation extension for TCP

◆ conv_hash_t

Conversation hash + value storage Hash table keys are conv_key_t. Hash table values are indexes into conv_array.

◆ conv_item_t

Conversation list information

◆ conv_key_t

Key for hash lookups

◆ endpoint_item_t

Endpoint information

◆ register_ct_t

typedef struct register_ct register_ct_t

Structure for information about a registered conversation table; this information is for both the conversation table and any endpoint table associated with it.

Function Documentation

◆ add_conversation_table_data()

WS_DLL_PUBLIC void add_conversation_table_data ( conv_hash_t ch,
const address src,
const address dst,
uint32_t  src_port,
uint32_t  dst_port,
int  num_frames,
int  num_bytes,
nstime_t ts,
nstime_t abs_ts,
ct_dissector_info_t ct_info,
conversation_type  ctype 
)

Add some data to the conversation table.

Parameters
chthe table to add the data to
srcsource address
dstdestination address
src_portsource port
dst_portdestination port
num_framesnumber of packets
num_bytesnumber of bytes
tstimestamp
abs_tsabsolute timestamp
ct_infocallback handlers from the dissector
ctypethe conversation type (e.g. CONVERSATION_TCP)

◆ add_conversation_table_data_extended()

WS_DLL_PUBLIC void add_conversation_table_data_extended ( conv_hash_t ch,
const address src,
const address dst,
uint32_t  src_port,
uint32_t  dst_port,
conv_id_t  conv_id,
int  num_frames,
int  num_bytes,
nstime_t ts,
nstime_t abs_ts,
ct_dissector_info_t ct_info,
conversation_type  ctype,
uint32_t  frameid,
int(*)(conversation_t *)  proto_conv_cb 
)

Decorates add_conversation_table_data_with_conv_id() in order to be able to add protocol dependent additional statistics.

◆ add_conversation_table_data_ipv4_subnet()

WS_DLL_PUBLIC void add_conversation_table_data_ipv4_subnet ( conv_hash_t ch,
const address src,
const address dst,
uint32_t  src_port,
uint32_t  dst_port,
conv_id_t  conv_id,
int  num_frames,
int  num_bytes,
nstime_t ts,
nstime_t abs_ts,
ct_dissector_info_t ct_info,
conversation_type  ctype 
)

Encapsulates add_conversation_table_data_with_conv_id() for the IPv4 specific case when the subnet aggregation user preference is true.

◆ add_conversation_table_data_with_conv_id()

WS_DLL_PUBLIC conv_item_t * add_conversation_table_data_with_conv_id ( conv_hash_t ch,
const address src,
const address dst,
uint32_t  src_port,
uint32_t  dst_port,
conv_id_t  conv_id,
int  num_frames,
int  num_bytes,
nstime_t ts,
nstime_t abs_ts,
ct_dissector_info_t ct_info,
conversation_type  ctype 
)

Add some data to the conversation table, passing a value to be used in addition to the address and port quadruple to uniquely identify the conversation.

Parameters
chthe table to add the data to
srcsource address
dstdestination address
src_portsource port
dst_portdestination port
num_framesnumber of packets
num_bytesnumber of bytes
tstimestamp
abs_tsabsolute timestamp
ct_infocallback handlers from the dissector
ctypethe conversation type (e.g. CONVERSATION_TCP)
conv_ida value to help differentiate the conversation in case the address and port quadruple is not sufficiently unique

◆ add_endpoint_table_data()

WS_DLL_PUBLIC void add_endpoint_table_data ( conv_hash_t ch,
const address addr,
uint32_t  port,
bool  sender,
int  num_frames,
int  num_bytes,
et_dissector_info_t et_info,
endpoint_type  etype 
)

Add some data to the endpoint table.

Parameters
chthe table hash to add the data to
addraddress
portport
sendertrue, if this is a sender
num_framesnumber of packets
num_bytesnumber of bytes
et_infoendpoint information provided by dissector
etypethe endpoint type (e.g. ENDPOINT_TCP)

◆ add_endpoint_table_data_ipv4_subnet()

WS_DLL_PUBLIC void add_endpoint_table_data_ipv4_subnet ( conv_hash_t ch,
const address addr,
uint32_t  port,
bool  sender,
int  num_frames,
int  num_bytes,
et_dissector_info_t et_info,
endpoint_type  etype 
)

Encapsulates add_endpoint_table_data() for the IPv4 specific case when the subnet aggregation user preference is true.

◆ conversation_table_get_num()

WS_DLL_PUBLIC unsigned conversation_table_get_num ( void  )

Total number of conversation tables

◆ conversation_table_iterate_tables()

WS_DLL_PUBLIC void conversation_table_iterate_tables ( wmem_foreach_func  func,
void *  user_data 
)

Iterator to walk conversation tables and execute func

Parameters
funcaction to be performed on all conversation tables
user_dataany data needed to help perform function

◆ conversation_table_set_gui_info()

WS_DLL_PUBLIC void conversation_table_set_gui_info ( conv_gui_init_cb  init_cb)

Register "initialization function" used by the GUI to create conversation table display in GUI

Parameters
init_cbcallback function that will be called when conversation table "display is instantiated in GUI

◆ dissector_conversation_init()

WS_DLL_PUBLIC void dissector_conversation_init ( const char *  opt_arg,
void *  userdata 
)

Initialize dissector conversation for stats and (possibly) GUI.

Parameters
opt_argfilter string to compare with dissector
userdataregister_ct_t* for dissector conversation table

◆ dissector_endpoint_init()

WS_DLL_PUBLIC void dissector_endpoint_init ( const char *  opt_arg,
void *  userdata 
)

Initialize dissector endpoint for stats and (possibly) GUI.

Parameters
opt_argfilter string to compare with dissector
userdataregister_ct_t* for dissector conversation table

◆ endpoint_table_set_gui_info()

WS_DLL_PUBLIC void endpoint_table_set_gui_info ( endpoint_gui_init_cb  init_cb)

Register "initialization function" used by the GUI to create endpoint table display in GUI

Parameters
init_cbcallback function that will be called when endpoint table "display" is instantiated in GUI

◆ get_conversation_address()

WS_DLL_PUBLIC char * get_conversation_address ( wmem_allocator_t allocator,
address addr,
bool  resolve_names 
)

Get the string representation of an address.

Parameters
allocatorThe wmem allocator to use when allocating the string
addrThe address.
resolve_namesEnable name resolution.
Returns
A string representing the address.

◆ get_conversation_by_proto_id()

WS_DLL_PUBLIC register_ct_t * get_conversation_by_proto_id ( int  proto_id)

get conversation table from protocol ID

Parameters
proto_idprotocol ID
Returns
conversation table for that protocol ID

get conversation from protocol ID

Parameters
proto_idprotocol ID
Returns
tap function handler of conversation

◆ get_conversation_filter()

WS_DLL_PUBLIC char * get_conversation_filter ( conv_item_t conv_item,
conv_direction_e  direction 
)

Get a display filter for the given conversation and direction.

Parameters
conv_itemThe conversation.
directionThe desired direction.
Returns
An g_allocated string representing the conversation that must be freed

◆ get_conversation_hide_ports()

WS_DLL_PUBLIC bool get_conversation_hide_ports ( register_ct_t ct)

Should port columns be hidden?

Parameters
ctRegistered conversation table
Returns
true if port columns should be hidden for this conversation table.

◆ get_conversation_packet_func()

WS_DLL_PUBLIC tap_packet_cb get_conversation_packet_func ( register_ct_t ct)

Get conversation tap function handler of a conversation table

Parameters
ctRegistered conversation table
Returns
conversation tap function handler of conversation table

◆ get_conversation_port()

WS_DLL_PUBLIC char * get_conversation_port ( wmem_allocator_t allocator,
uint32_t  port,
conversation_type  ctype,
bool  resolve_names 
)

Get the string representation of a port.

Parameters
allocatorThe wmem allocator to use when allocating the string
portThe port number.
ctypeThe conversation type.
resolve_namesEnable name resolution.
Returns
A string representing the port.

XXX - this should really be a port type, as we just supply a port.

◆ get_conversation_proto_id()

WS_DLL_PUBLIC int get_conversation_proto_id ( register_ct_t ct)

Get protocol ID of a conversation table

Parameters
ctRegistered conversation table
Returns
protocol id of conversation table

◆ get_endpoint_filter()

WS_DLL_PUBLIC char * get_endpoint_filter ( endpoint_item_t endpoint_item)

Get a display filter for the given endpoint.

Parameters
endpoint_itemThe endpoint.
Returns
A string, allocated using the wmem NULL allocator, representing the conversation.

◆ get_endpoint_packet_func()

WS_DLL_PUBLIC tap_packet_cb get_endpoint_packet_func ( register_ct_t ct)

Get endpoint tap function handler for a conversation table

Parameters
ctRegistered conversation table
Returns
endpoint tap function handler of conversation table

◆ get_endpoint_port()

WS_DLL_PUBLIC char * get_endpoint_port ( wmem_allocator_t allocator,
endpoint_item_t item,
bool  resolve_names 
)

Get the string representation of the port for an endpoint_item_t.

Parameters
allocatorThe wmem allocator to use when allocating the string
itemPointer to the endpoint_item_t
resolve_namesEnable name resolution.
Returns
A string representing the port.

XXX - this should really be a port type, as we just supply a port.

◆ register_conversation_table()

WS_DLL_PUBLIC void register_conversation_table ( const int  proto_id,
bool  hide_ports,
tap_packet_cb  conv_packet_func,
tap_packet_cb  endpoint_packet_func 
)

Register the conversation table for the conversation and endpoint windows.

Parameters
proto_idis the protocol with conversation
hide_portshide the port columns
conv_packet_functhe registered conversation tap name
endpoint_packet_functhe registered endpoint tap name

◆ reset_conversation_table_data()

WS_DLL_PUBLIC void reset_conversation_table_data ( conv_hash_t ch)

Remove all entries from the conversation table.

Parameters
chthe table to reset

◆ reset_endpoint_table_data()

WS_DLL_PUBLIC void reset_endpoint_table_data ( conv_hash_t ch)

Remove all entries from the endpoint table.

Parameters
chthe table to reset