drsuapi_SupportedExtensionsExt
[wireshark-sm.git] / epan / export_object.h
blobecec151be073c9767c2f189056523675d14b01fd
1 /** @file
2 * GUI independent helper routines common to all export object taps.
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
11 #ifndef __EXPORT_OBJECT_H__
12 #define __EXPORT_OBJECT_H__
14 #include "tap.h"
15 #include <epan/wmem_scopes.h>
17 #ifdef __cplusplus
18 extern "C" {
19 #endif /* __cplusplus */
21 typedef struct _export_object_entry_t {
22 uint32_t pkt_num;
23 char *hostname;
24 char *content_type;
25 char *filename;
26 size_t payload_len;
27 uint8_t *payload_data;
28 } export_object_entry_t;
30 /** Maximum file name size for the file to which we save an object.
31 This is the file name size, not the path name size; we impose
32 the limit so that the file doesn't have a ridiculously long
33 name, e.g. an HTTP object where the URL has a long query part. */
34 #define EXPORT_OBJECT_MAXFILELEN 255
36 typedef void (*export_object_object_list_add_entry_cb)(void* gui_data, struct _export_object_entry_t *entry);
37 typedef export_object_entry_t* (*export_object_object_list_get_entry_cb)(void* gui_data, int row);
39 typedef struct _export_object_list_t {
40 export_object_object_list_add_entry_cb add_entry; //GUI specific handler for adding an object entry
41 export_object_object_list_get_entry_cb get_entry; //GUI specific handler for retrieving an object entry
42 void* gui_data; //GUI specific data (for UI representation)
43 } export_object_list_t;
45 /** Structure for information about a registered exported object */
46 typedef struct register_eo register_eo_t;
48 /* When a protocol needs intermediate data structures to construct the
49 export objects, then it must specify a function that cleans up all
50 those data structures. This function is passed to export_object_window
51 and called when tap reset or windows closes occurs. If no function is needed
52 a NULL value should be passed instead */
53 typedef void (*export_object_gui_reset_cb)(void);
55 /** Register the export object handler for the Export Object windows.
57 * @param proto_id is the protocol with objects to export
58 * @param export_packet_func the tap processing function
59 * @param reset_cb handles clearing intermediate data structures constructed
60 * for exporting objects. If no function is needed a NULL value should be passed instead
61 * @return Tap id registered for the Export Object
63 WS_DLL_PUBLIC int register_export_object(const int proto_id, tap_packet_cb export_packet_func, export_object_gui_reset_cb reset_cb);
65 /** Get protocol ID from Export Object
67 * @param eo Registered Export Object
68 * @return protocol id of Export Object
70 WS_DLL_PUBLIC int get_eo_proto_id(register_eo_t* eo);
72 /** Get string for register_tap_listener call. Typically of the form <dissector_name>_eo
74 * @param eo Registered Export Object
75 * @return string for register_tap_listener call
77 WS_DLL_PUBLIC const char* get_eo_tap_listener_name(register_eo_t* eo);
79 /** Get tap function handler from Export Object
81 * @param eo Registered Export Object
82 * @return tap function handler of Export Object
84 WS_DLL_PUBLIC tap_packet_cb get_eo_packet_func(register_eo_t* eo);
86 /** Get tap reset function handler from Export Object
88 * @param eo Registered Export Object
89 * @return tap function handler of Export Object
91 WS_DLL_PUBLIC export_object_gui_reset_cb get_eo_reset_func(register_eo_t* eo);
93 /** Get Export Object by its protocol filter name
95 * @param name protocol filter name to fetch.
96 * @return Export Object handler pointer or NULL.
98 WS_DLL_PUBLIC register_eo_t* get_eo_by_name(const char* name);
100 /** Iterator to walk Export Object list and execute func
102 * @param func action to be performed on all Export Objects
103 * @param user_data any data needed to help perform function
105 WS_DLL_PUBLIC void eo_iterate_tables(wmem_foreach_func func, void *user_data);
107 /** Find all disallowed characters/bytes and replace them with %xx
109 * @param in_str string to massage
110 * @param maxlen maximum size a string can be post massage
111 * @param dup return a copy of the massaged string (?)
112 * @return massaged string
114 WS_DLL_PUBLIC GString *eo_massage_str(const char *in_str, size_t maxlen, int dup);
116 /** Map the content type string to an extension string
118 * @param content_type content type to match with extension string
119 * @return extension string for content type
121 WS_DLL_PUBLIC const char *eo_ct2ext(const char *content_type);
123 /** Free the contents of export_object_entry_t structure
125 * @param entry export_object_entry_t structure to be freed
127 WS_DLL_PUBLIC void eo_free_entry(export_object_entry_t *entry);
129 #ifdef __cplusplus
131 #endif /* __cplusplus */
133 #endif /* __EXPORT_OBJECT_H__ */
136 * Editor modelines
138 * Local Variables:
139 * c-basic-offset: 4
140 * tab-width: 8
141 * indent-tabs-mode: nil
142 * End:
144 * ex: set shiftwidth=4 tabstop=8 expandtab:
145 * :indentSize=4:tabSize=8:noTabs=true: