Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

export_object.h
1 /* export_object.h
2 * GUI independent helper routines common to all export object taps.
3 *
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10
11 #ifndef __EXPORT_OBJECT_H__
12 #define __EXPORT_OBJECT_H__
13
14 #include "tap.h"
15 #include "wmem/wmem.h"
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif /* __cplusplus */
20
21 typedef struct _export_object_entry_t {
22 guint32 pkt_num;
23 gchar *hostname;
24 gchar *content_type;
25 gchar *filename;
26 /* We need to store a 64 bit integer to hold a file length
27 (was guint payload_len;)
28
29 XXX - we store the entire object in the program's address space,
30 so the *real* maximum object size is size_t; if we were to export
31 objects by going through all of the packets containing data from
32 the object, one packet at a time, and write the object incrementally,
33 we could support objects that don't fit into the address space. */
34 gint64 payload_len;
35 guint8 *payload_data;
36 } export_object_entry_t;
37
38 #define EXPORT_OBJECT_MAXFILELEN 255
39
40 typedef void (*export_object_object_list_add_entry_cb)(void* gui_data, struct _export_object_entry_t *entry);
41 typedef export_object_entry_t* (*export_object_object_list_get_entry_cb)(void* gui_data, int row);
42
43 typedef struct _export_object_list_t {
44 export_object_object_list_add_entry_cb add_entry; //GUI specific handler for adding an object entry
45 export_object_object_list_get_entry_cb get_entry; //GUI specific handler for retrieving an object entry
46 void* gui_data; //GUI specific data (for UI representation)
47 } export_object_list_t;
48
50 typedef struct register_eo register_eo_t;
51
52 /* When a protocol needs intermediate data structures to construct the
53 export objects, then it must specify a function that cleans up all
54 those data structures. This function is passed to export_object_window
55 and called when tap reset or windows closes occurs. If no function is needed
56 a NULL value should be passed instead */
57 typedef void (*export_object_gui_reset_cb)(void);
58
67 WS_DLL_PUBLIC int register_export_object(const int proto_id, tap_packet_cb export_packet_func, export_object_gui_reset_cb reset_cb);
68
74 WS_DLL_PUBLIC int get_eo_proto_id(register_eo_t* eo);
75
81 WS_DLL_PUBLIC const char* get_eo_tap_listener_name(register_eo_t* eo);
82
88 WS_DLL_PUBLIC tap_packet_cb get_eo_packet_func(register_eo_t* eo);
89
95 WS_DLL_PUBLIC export_object_gui_reset_cb get_eo_reset_func(register_eo_t* eo);
96
102 WS_DLL_PUBLIC register_eo_t* get_eo_by_name(const char* name);
103
109 WS_DLL_PUBLIC void eo_iterate_tables(wmem_foreach_func func, gpointer user_data);
110
118 WS_DLL_PUBLIC GString *eo_massage_str(const gchar *in_str, gsize maxlen, int dup);
119
125 WS_DLL_PUBLIC const char *eo_ct2ext(const char *content_type);
126
131 WS_DLL_PUBLIC void eo_free_entry(export_object_entry_t *entry);
132
133 #ifdef __cplusplus
134 }
135 #endif /* __cplusplus */
136
137 #endif /* __EXPORT_OBJECT_H__ */
138
139 /*
140 * Editor modelines
141 *
142 * Local Variables:
143 * c-basic-offset: 4
144 * tab-width: 8
145 * indent-tabs-mode: nil
146 * End:
147 *
148 * ex: set shiftwidth=4 tabstop=8 expandtab:
149 * :indentSize=4:tabSize=8:noTabs=true:
150 */
register_eo
Definition: export_object.c:19
wmem_foreach_func
gboolean(* wmem_foreach_func)(const void *key, void *value, void *userdata)
Definition: wmem_tree.h:213
_export_object_entry_t
Definition: export_object.h:21
_export_object_list_t
Definition: export_object.h:43