| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
decode_as.h
Go to the documentation of this file.
1/* decode_as.h
2 * Routines for dissector Decode As handlers
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 __DECODE_AS_H__
12#define __DECODE_AS_H__
13
14#include "ws_symbol_export.h"
15
16#include "ftypes/ftypes.h"
17#include "packet_info.h"
18
19#ifdef __cplusplus
20 extern "C" {
21#endif /* __cplusplus */
22
26#define MAX_DECODE_AS_PROMPT_LEN 200
27#define DECODE_AS_ENTRY "decode_as_entry"
28#define DECODE_AS_NONE "(none)"
29
30/*
31 * Filename of the "decode as" entry preferences
32 */
33#define DECODE_AS_ENTRIES_FILE_NAME "decode_as_entries"
34
35
37 typedef void (*build_label_func)(packet_info *pinfo, char* result);
38
40 typedef void * (*build_valid_func)(packet_info *pinfo);
41
42 typedef void (*decode_as_add_to_list_func)(const char *table_name, const char *proto_name, void *value, void *user_data);
43 typedef void (*decode_as_populate_list_func)(const char *table_name, decode_as_add_to_list_func add_to_list, void *ui_element);
44 typedef void (*decode_as_free_func)(void *value);
45 typedef void (*decode_as_add_changed_list_func)(void* data, void* user_data);
46
48 typedef bool (*decode_as_reset_func)(const char *name, const void *pattern);
50 typedef bool (*decode_as_change_func)(const char *name, const void *pattern, const void *handle, const char *list_name);
52 typedef void (*decode_as_reset_all_func)(void);
54 typedef void (*decode_as_build_changed_list_func)(decode_as_add_changed_list_func func, void* user_data);
55
61 typedef struct decode_as_value_s {
62 build_label_func label_func;
63 unsigned num_values;
64 build_valid_func* build_values;
65} decode_as_value_t;
66
76 typedef struct decode_as_s {
77 const char *name;
78 const char *table_name;
79 unsigned num_items;
80 unsigned default_index_value;
81 decode_as_value_t* values;
82 const char* pre_value_str;
83 const char* post_value_str;
84 decode_as_populate_list_func populate_list;
85 decode_as_reset_func reset_value;
86 decode_as_change_func change_value;
87 decode_as_free_func free_func;
88 decode_as_reset_all_func reset_all;
89 decode_as_build_changed_list_func build_changed_list;
91} decode_as_t;
92
94WS_DLL_PUBLIC void register_decode_as(decode_as_t* reg);
95
96/* Forward declaration to prevent requiring packet.h */
97 struct dissector_table;
98
113WS_DLL_PUBLIC struct dissector_table* register_decode_as_next_proto(int proto, const char *table_name, const char *ui_name, build_label_func label_func);
114
115/* Walk though the dissector table and provide dissector_handle_t for each item in the table */
116WS_DLL_PUBLIC void decode_as_default_populate_list(const char *table_name, decode_as_add_to_list_func add_to_list, void *ui_element);
117/* Clear a FT_UINT32 value from dissector table list */
118WS_DLL_PUBLIC bool decode_as_default_reset(const char *name, const void *pattern);
119/* Add a FT_UINT32 value to dissector table list */
120WS_DLL_PUBLIC bool decode_as_default_change(const char *name, const void *pattern, const void *handle, const char *list_name);
121
125WS_DLL_PUBLIC GList *decode_as_list;
126
127/* Some useful utilities for Decode As */
128
133 extern void load_decode_as_entries(const char* app_env_var_prefix);
134
137WS_DLL_PUBLIC int save_decode_as_entries(const char* app_name, const char* app_env_var_prefix, char** err);
138
141WS_DLL_PUBLIC void decode_clear_all(void);
142
145WS_DLL_PUBLIC void decode_cleanup(void);
146
169WS_DLL_PUBLIC void decode_build_reset_list (const char *table_name, ftenum_t selector_type,
170 void *key, void *value,
171 void *user_data);
172
173
174#ifdef __cplusplus
175}
176#endif /* __cplusplus */
177
178#endif /* decode_as.h */
decode_build_reset_list
WS_DLL_PUBLIC void decode_build_reset_list(const char *table_name, ftenum_t selector_type, void *key, void *value, void *user_data)
decode_as_t
struct decode_as_s decode_as_t
decode_as_change_func
bool(* decode_as_change_func)(const char *name, const void *pattern, const void *handle, const char *list_name)
Definition decode_as.h:50
decode_as_value_t
struct decode_as_value_s decode_as_value_t
register_decode_as
WS_DLL_PUBLIC void register_decode_as(decode_as_t *reg)
Definition decode_as.c:28
decode_cleanup
WS_DLL_PUBLIC void decode_cleanup(void)
Definition decode_as.c:540
decode_clear_all
WS_DLL_PUBLIC void decode_clear_all(void)
Definition decode_as.c:489
build_valid_func
void *(* build_valid_func)(packet_info *pinfo)
Definition decode_as.h:40
save_decode_as_entries
WS_DLL_PUBLIC int save_decode_as_entries(const char *app_name, const char *app_env_var_prefix, char **err)
Definition decode_as.c:392
load_decode_as_entries
void load_decode_as_entries(const char *app_env_var_prefix)
Definition decode_as.c:287
decode_as_reset_all_func
void(* decode_as_reset_all_func)(void)
Definition decode_as.h:52
register_decode_as_next_proto
WS_DLL_PUBLIC struct dissector_table * register_decode_as_next_proto(int proto, const char *table_name, const char *ui_name, build_label_func label_func)
Definition decode_as.c:60
decode_as_reset_func
bool(* decode_as_reset_func)(const char *name, const void *pattern)
Definition decode_as.h:48
decode_as_build_changed_list_func
void(* decode_as_build_changed_list_func)(decode_as_add_changed_list_func func, void *user_data)
Definition decode_as.h:54
build_label_func
void(* build_label_func)(packet_info *pinfo, char *result)
Definition decode_as.h:37
decode_as_list
WS_DLL_PUBLIC GList * decode_as_list
Definition decode_as.h:125
ftypes.h
packet_info.h
_packet_info
Definition packet_info.h:43
decode_as_s
Definition decode_as.h:76
decode_as_s::post_value_str
const char * post_value_str
Definition decode_as.h:83
decode_as_s::num_items
unsigned num_items
Definition decode_as.h:79
decode_as_s::table_name
const char * table_name
Definition decode_as.h:78
decode_as_s::build_changed_list
decode_as_build_changed_list_func build_changed_list
Definition decode_as.h:89
decode_as_s::name
const char * name
Definition decode_as.h:77
decode_as_s::reset_all
decode_as_reset_all_func reset_all
Definition decode_as.h:88
decode_as_s::values
decode_as_value_t * values
Definition decode_as.h:81
decode_as_s::default_index_value
unsigned default_index_value
Definition decode_as.h:80
decode_as_s::populate_list
decode_as_populate_list_func populate_list
Definition decode_as.h:84
decode_as_s::change_value
decode_as_change_func change_value
Definition decode_as.h:86
decode_as_s::free_func
decode_as_free_func free_func
Definition decode_as.h:87
decode_as_s::reset_value
decode_as_reset_func reset_value
Definition decode_as.h:85
decode_as_s::pre_value_str
const char * pre_value_str
Definition decode_as.h:82
decode_as_value_s
Definition decode_as.h:61
decode_as_value_s::num_values
unsigned num_values
Definition decode_as.h:63
decode_as_value_s::build_values
build_valid_func * build_values
Definition decode_as.h:64
decode_as_value_s::label_func
build_label_func label_func
Definition decode_as.h:62
dissector_table
Definition packet.c:97