Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
export_object.h File Reference
#include "tap.h"
#include <epan/wmem_scopes.h>

Go to the source code of this file.

Classes

struct  _export_object_entry_t
 Represents a single object extracted from a packet capture for export. More...
 
struct  _export_object_list_t
 Abstracts the GUI-specific operations needed to manage a list of exported objects during dissection. More...
 

Macros

#define EXPORT_OBJECT_MAXFILELEN   255
 

Typedefs

typedef struct _export_object_entry_t export_object_entry_t
 Represents a single object extracted from a packet capture for export.
 
typedef void(* export_object_object_list_add_entry_cb) (void *gui_data, struct _export_object_entry_t *entry)
 Callback invoked by a dissector to add a newly extracted object entry into the GUI list.
 
typedef export_object_entry_t *(* export_object_object_list_get_entry_cb) (void *gui_data, int row)
 Callback invoked to retrieve an existing object entry from the GUI list by row index.
 
typedef struct _export_object_list_t export_object_list_t
 Abstracts the GUI-specific operations needed to manage a list of exported objects during dissection.
 
typedef struct register_eo register_eo_t
 
typedef void(* export_object_gui_reset_cb) (void)
 

Functions

void export_object_init (void)
 
WS_DLL_PUBLIC int register_export_object (const int proto_id, tap_packet_cb export_packet_func, export_object_gui_reset_cb reset_cb)
 
WS_DLL_PUBLIC int get_eo_proto_id (register_eo_t *eo)
 
WS_DLL_PUBLIC const char * get_eo_tap_listener_name (register_eo_t *eo)
 
WS_DLL_PUBLIC tap_packet_cb get_eo_packet_func (register_eo_t *eo)
 
WS_DLL_PUBLIC export_object_gui_reset_cb get_eo_reset_func (register_eo_t *eo)
 
WS_DLL_PUBLIC register_eo_tget_eo_by_name (const char *name)
 
WS_DLL_PUBLIC void eo_iterate_tables (wmem_foreach_func func, void *user_data)
 
WS_DLL_PUBLIC GString * eo_massage_str (const char *in_str, size_t maxlen, int dup)
 
WS_DLL_PUBLIC const char * eo_ct2ext (const char *content_type)
 
WS_DLL_PUBLIC void eo_free_entry (export_object_entry_t *entry)
 
WS_DLL_PUBLIC unsigned eo_entry_hash (export_object_entry_t *entry)
 
WS_DLL_PUBLIC bool eo_entry_equal (export_object_entry_t *entry_a, export_object_entry_t *entry_b)
 

Detailed Description

GUI independent helper routines common to all export object taps.

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

Macro Definition Documentation

◆ EXPORT_OBJECT_MAXFILELEN

#define EXPORT_OBJECT_MAXFILELEN   255

Maximum file name size for the file to which we save an object. This is the file name size, not the path name size; we impose the limit so that the file doesn't have a ridiculously long name, e.g. an HTTP object where the URL has a long query part.

Typedef Documentation

◆ export_object_gui_reset_cb

typedef void(* export_object_gui_reset_cb) (void)

When a protocol needs intermediate data structures to construct the export objects, then it must specify a function that cleans up all those data structures. This function is passed to export_object_window and called when tap reset or windows closes occurs. If no function is needed a NULL value should be passed instead

◆ export_object_object_list_add_entry_cb

typedef void(* export_object_object_list_add_entry_cb) (void *gui_data, struct _export_object_entry_t *entry)

Callback invoked by a dissector to add a newly extracted object entry into the GUI list.

Parameters
gui_dataGUI-specific context data passed through from the export_object_list_t.
entryThe export object entry to be added to the list.

◆ export_object_object_list_get_entry_cb

typedef export_object_entry_t *(* export_object_object_list_get_entry_cb) (void *gui_data, int row)

Callback invoked to retrieve an existing object entry from the GUI list by row index.

Parameters
gui_dataGUI-specific context data passed through from the export_object_list_t.
rowZero-based row index of the entry to retrieve.
Returns
Pointer to the export_object_entry_t at the specified row, or NULL if not found.

◆ register_eo_t

typedef struct register_eo register_eo_t

Structure for information about a registered exported object

Function Documentation

◆ eo_ct2ext()

WS_DLL_PUBLIC const char * eo_ct2ext ( const char *  content_type)

Map the content type string to an extension string

Parameters
content_typecontent type to match with extension string
Returns
extension string for content type

◆ eo_entry_equal()

WS_DLL_PUBLIC bool eo_entry_equal ( export_object_entry_t entry_a,
export_object_entry_t entry_b 
)

Compare two export_object_entry_t for equality. This ignores the packet number, as a primary use case is ignoring objects which are sent more than once in the same capture.

Parameters
entry_aThe first export_object_entry_t to compare
entry_bThe second export_object_entry_t to compare
Returns
Whether the two entries are equal (ignoring pkt_num).

◆ eo_entry_hash()

WS_DLL_PUBLIC unsigned eo_entry_hash ( export_object_entry_t entry)

Produce a hash for an export_object_entry_t, ignoring the packet number.

Parameters
entryThe export_object_entry_t to hash
Returns
A hash

◆ eo_free_entry()

WS_DLL_PUBLIC void eo_free_entry ( export_object_entry_t entry)

Free the contents of export_object_entry_t structure

Parameters
entryexport_object_entry_t structure to be freed

◆ eo_iterate_tables()

WS_DLL_PUBLIC void eo_iterate_tables ( wmem_foreach_func  func,
void *  user_data 
)

Iterator to walk Export Object list and execute func

Parameters
funcaction to be performed on all Export Objects
user_dataany data needed to help perform function

◆ eo_massage_str()

WS_DLL_PUBLIC GString * eo_massage_str ( const char *  in_str,
size_t  maxlen,
int  dup 
)

Find all disallowed characters/bytes and replace them with xx

Parameters
in_strstring to massage
maxlenmaximum size a string can be post massage
dupreturn a copy of the massaged string (?)
Returns
massaged string

◆ export_object_init()

void export_object_init ( void  )
extern

Initialize the export object system.

◆ get_eo_by_name()

WS_DLL_PUBLIC register_eo_t * get_eo_by_name ( const char *  name)

Get Export Object by its protocol filter name

Parameters
nameprotocol filter name to fetch.
Returns
Export Object handler pointer or NULL.

◆ get_eo_packet_func()

WS_DLL_PUBLIC tap_packet_cb get_eo_packet_func ( register_eo_t eo)

Get tap function handler from Export Object

Parameters
eoRegistered Export Object
Returns
tap function handler of Export Object

◆ get_eo_proto_id()

WS_DLL_PUBLIC int get_eo_proto_id ( register_eo_t eo)

Get protocol ID from Export Object

Parameters
eoRegistered Export Object
Returns
protocol id of Export Object

◆ get_eo_reset_func()

WS_DLL_PUBLIC export_object_gui_reset_cb get_eo_reset_func ( register_eo_t eo)

Get tap reset function handler from Export Object

Parameters
eoRegistered Export Object
Returns
tap function handler of Export Object

◆ get_eo_tap_listener_name()

WS_DLL_PUBLIC const char * get_eo_tap_listener_name ( register_eo_t eo)

Get string for register_tap_listener call. Typically of the form <dissector_name>_eo

Parameters
eoRegistered Export Object
Returns
string for register_tap_listener call

◆ register_export_object()

WS_DLL_PUBLIC int register_export_object ( const int  proto_id,
tap_packet_cb  export_packet_func,
export_object_gui_reset_cb  reset_cb 
)

Register the export object handler for the Export Object windows.

Parameters
proto_idis the protocol with objects to export
export_packet_functhe tap processing function
reset_cbhandles clearing intermediate data structures constructed for exporting objects. If no function is needed a NULL value should be passed instead
Returns
Tap id registered for the Export Object