Wireshark 4.5.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 <[email protected]>
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
20extern "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
37typedef void (*build_label_func)(packet_info *pinfo, char* result);
38
40typedef void * (*build_valid_func)(packet_info *pinfo);
41
42typedef void (*decode_as_add_to_list_func)(const char *table_name, const char *proto_name, void *value, void *user_data);
43typedef void (*decode_as_populate_list_func)(const char *table_name, decode_as_add_to_list_func add_to_list, void *ui_element);
44typedef void (*decode_as_free_func)(void *value);
45
47typedef bool (*decode_as_reset_func)(const char *name, const void *pattern);
49typedef bool (*decode_as_change_func)(const char *name, const void *pattern, const void *handle, const char *list_name);
50
61
71typedef struct decode_as_s {
72 const char *name;
73 const char *table_name;
74 unsigned num_items;
77 const char* pre_value_str;
78 const char* post_value_str;
79 decode_as_populate_list_func populate_list;
82 decode_as_free_func free_func;
85
87WS_DLL_PUBLIC void register_decode_as(decode_as_t* reg);
88
89/* Forward declaration to prevent requiring packet.h */
90struct dissector_table;
91
106WS_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);
107
108/* Walk though the dissector table and provide dissector_handle_t for each item in the table */
109WS_DLL_PUBLIC void decode_as_default_populate_list(const char *table_name, decode_as_add_to_list_func add_to_list, void *ui_element);
110/* Clear a FT_UINT32 value from dissector table list */
111WS_DLL_PUBLIC bool decode_as_default_reset(const char *name, const void *pattern);
112/* Add a FT_UINT32 value to dissector table list */
113WS_DLL_PUBLIC bool decode_as_default_change(const char *name, const void *pattern, const void *handle, const char *list_name);
114
118WS_DLL_PUBLIC GList *decode_as_list;
119
120/* Some useful utilities for Decode As */
121
126extern void load_decode_as_entries(void);
127
130WS_DLL_PUBLIC int save_decode_as_entries(char** err);
131
134WS_DLL_PUBLIC void decode_clear_all(void);
135
138WS_DLL_PUBLIC void decode_cleanup(void);
139
162WS_DLL_PUBLIC void decode_build_reset_list (const char *table_name, ftenum_t selector_type,
163 void *key, void *value,
164 void *user_data);
165
166
167#ifdef __cplusplus
168}
169#endif /* __cplusplus */
170
171#endif /* decode_as.h */
WS_DLL_PUBLIC void decode_build_reset_list(const char *table_name, ftenum_t selector_type, void *key, void *value, void *user_data)
struct decode_as_s decode_as_t
WS_DLL_PUBLIC int save_decode_as_entries(char **err)
Definition decode_as.c:393
bool(* decode_as_change_func)(const char *name, const void *pattern, const void *handle, const char *list_name)
Definition decode_as.h:49
struct decode_as_value_s decode_as_value_t
WS_DLL_PUBLIC void register_decode_as(decode_as_t *reg)
Definition decode_as.c:29
WS_DLL_PUBLIC void decode_cleanup(void)
Definition decode_as.c:536
WS_DLL_PUBLIC void decode_clear_all(void)
Definition decode_as.c:490
void *(* build_valid_func)(packet_info *pinfo)
Definition decode_as.h:40
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:61
bool(* decode_as_reset_func)(const char *name, const void *pattern)
Definition decode_as.h:47
void(* build_label_func)(packet_info *pinfo, char *result)
Definition decode_as.h:37
void load_decode_as_entries(void)
Definition decode_as.c:288
WS_DLL_PUBLIC GList * decode_as_list
Definition decode_as.h:118
Definition packet_info.h:43
Definition decode_as.h:71
const char * post_value_str
Definition decode_as.h:78
unsigned num_items
Definition decode_as.h:74
const char * table_name
Definition decode_as.h:73
const char * name
Definition decode_as.h:72
decode_as_value_t * values
Definition decode_as.h:76
unsigned default_index_value
Definition decode_as.h:75
decode_as_populate_list_func populate_list
Definition decode_as.h:79
decode_as_change_func change_value
Definition decode_as.h:81
decode_as_free_func free_func
Definition decode_as.h:82
decode_as_reset_func reset_value
Definition decode_as.h:80
const char * pre_value_str
Definition decode_as.h:77
Definition decode_as.h:56
unsigned num_values
Definition decode_as.h:58
build_valid_func * build_values
Definition decode_as.h:59
build_label_func label_func
Definition decode_as.h:57
Definition packet.c:86