Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
uat-int.h
Go to the documentation of this file.
1
16#pragma once
17#include <glib.h>
18
19#include "uat.h"
20#include "ws_symbol_export.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif /* __cplusplus */
25
26typedef struct _uat_fld_rep_t uat_fld_rep_t;
27typedef struct _uat_rep_t uat_rep_t;
28
29typedef void (*uat_rep_fld_free_cb_t)(uat_fld_rep_t*);
30typedef void (*uat_rep_free_cb_t)(uat_rep_t*);
31
35typedef struct _fld_data_t {
36 unsigned colnum;
37 uat_fld_rep_t* rep;
38 uat_rep_fld_free_cb_t free_rep;
40
44struct epan_uat {
45 char* name;
46 size_t record_size;
47 char* filename;
49 char* help;
50 unsigned flags;
51 void** user_ptr;
52 unsigned* nrows_p;
56 uat_post_update_cb_t post_update_cb;
60 const char** default_values;
61 unsigned ncols;
62 GArray* user_data;
63 GArray* raw_data;
64 GArray* valid_data;
65 bool changed;
66 uat_rep_t* rep;
67 uat_rep_free_cb_t free_rep;
68 bool loaded;
69};
70
78WS_DLL_PUBLIC
79char* uat_get_actual_filename(uat_t* uat, bool for_writing, const char* app_env_var_prefix);
80
90WS_DLL_PUBLIC
91void* uat_add_record(uat_t *uat, const void *orig_rec_ptr, bool valid_rec);
92
100WS_DLL_PUBLIC
101void uat_update_record(uat_t *uat, const void *record, bool valid_rec);
102
109WS_DLL_PUBLIC
110void uat_swap(uat_t *uat, unsigned idx_a, unsigned idx_b);
111
118WS_DLL_PUBLIC
119void uat_insert_record_idx(uat_t *uat, unsigned rec_idx, const void *src_record);
120
126WS_DLL_PUBLIC
127void uat_remove_record_idx(uat_t *uat, unsigned rec_idx);
128
137WS_DLL_PUBLIC
138void uat_remove_record_range(uat_t *uat, unsigned rec_idx, unsigned count);
139
146WS_DLL_PUBLIC
147void uat_move_index(uat_t *uat, unsigned old_idx, unsigned new_idx);
148
153WS_DLL_PUBLIC
154void uat_clear(uat_t *uat);
155
165WS_DLL_PUBLIC
166bool uat_save(uat_t *uat, const char* app_env_var_prefix, char **error);
167
172void uat_load_all(const char* app_env_var_prefix);
173
186WS_DLL_PUBLIC
187char *uat_fld_tostr(void *rec, uat_field_t *f);
188
197WS_DLL_PUBLIC
198char *uat_record_tostr(const uat_t *uat, void *rec);
199
204#define UAT_UPDATE(uat) do { *((uat)->user_ptr) = (void*)((uat)->user_data->data); *((uat)->nrows_p) = (uat)->user_data->len; } while(0)
210#define UAT_INDEX_PTR(uat,idx) (uat->raw_data->data + (uat->record_size * (idx)))
215#define UAT_USER_INDEX_PTR(uat,idx) (uat->user_data->data + (uat->record_size * (idx)))
216
217#ifdef __cplusplus
218}
219#endif /* __cplusplus */
220
221/*
222 * Editor modelines - https://www.wireshark.org/tools/modelines.html
223 *
224 * Local variables:
225 * c-basic-offset: 4
226 * tab-width: 8
227 * indent-tabs-mode: nil
228 * End:
229 *
230 * vi: set shiftwidth=4 tabstop=8 expandtab:
231 * :indentSize=4:tabSize=8:noTabs=true:
232 */
Holds per-field display and cleanup state for a single column in a UAT record's GUI representation.
Definition uat-int.h:35
unsigned colnum
Definition uat-int.h:36
uat_rep_fld_free_cb_t free_rep
Definition uat-int.h:38
uat_fld_rep_t * rep
Definition uat-int.h:37
Describes a single editable field within a UAT (User Accessible Table).
Definition uat.h:234
Represents a User Accessible Table (UAT), managing a set of user-editable records exposed to a dissec...
Definition uat-int.h:44
size_t record_size
Definition uat-int.h:46
uat_post_update_cb_t post_update_cb
Definition uat-int.h:56
bool changed
Definition uat-int.h:65
void ** user_ptr
Definition uat-int.h:51
GArray * raw_data
Definition uat-int.h:63
unsigned ncols
Definition uat-int.h:61
bool from_profile
Definition uat-int.h:48
char * help
Definition uat-int.h:49
char * filename
Definition uat-int.h:47
const char ** default_values
Definition uat-int.h:60
uat_reset_cb_t reset_cb
Definition uat-int.h:57
uat_rep_t * rep
Definition uat-int.h:66
uat_update_cb_t update_cb
Definition uat-int.h:54
uat_field_t * fields
Definition uat-int.h:59
uat_rep_free_cb_t free_rep
Definition uat-int.h:67
unsigned flags
Definition uat-int.h:50
unsigned * nrows_p
Definition uat-int.h:52
uat_copy_cb_t copy_cb
Definition uat-int.h:53
bool loaded
Definition uat-int.h:68
GArray * valid_data
Definition uat-int.h:64
char * name
Definition uat-int.h:45
uat_free_cb_t free_cb
Definition uat-int.h:55
GArray * user_data
Definition uat-int.h:62
void uat_load_all(const char *app_env_var_prefix)
Loads the records for all registered UATs from file.
Definition uat.c:615
WS_DLL_PUBLIC char * uat_get_actual_filename(uat_t *uat, bool for_writing, const char *app_env_var_prefix)
Get the actual filename for the UAT.
Definition uat.c:250
WS_DLL_PUBLIC void uat_update_record(uat_t *uat, const void *record, bool valid_rec)
Marks the internal record in the UAT as valid or invalid. The record must exist in the UAT.
Definition uat.c:145
WS_DLL_PUBLIC void uat_remove_record_range(uat_t *uat, unsigned rec_idx, unsigned count)
Removes the given number of records starting with the given index from the internal record list....
Definition uat.c:217
WS_DLL_PUBLIC void uat_move_index(uat_t *uat, unsigned old_idx, unsigned new_idx)
Moves the entry from the old position to the new one.
Definition uat.c:235
WS_DLL_PUBLIC void uat_clear(uat_t *uat)
Removes and destroys all records from the UAT.
Definition uat.c:533
WS_DLL_PUBLIC bool uat_save(uat_t *uat, const char *app_env_var_prefix, char **error)
Saves the records from an UAT to file. Returns true on success and false on failure,...
Definition uat.c:396
WS_DLL_PUBLIC void uat_swap(uat_t *uat, unsigned idx_a, unsigned idx_b)
Changes the order of two internal UAT records.
Definition uat.c:164
WS_DLL_PUBLIC char * uat_record_tostr(const uat_t *uat, void *rec)
Dump UAT record entries to string in form which can be later loaded with uat_load_str()....
Definition uat.c:327
WS_DLL_PUBLIC void * uat_add_record(uat_t *uat, const void *orig_rec_ptr, bool valid_rec)
Clones the given record and stores it internally in the UAT. If it is considered a valid record,...
Definition uat.c:117
WS_DLL_PUBLIC char * uat_fld_tostr(void *rec, uat_field_t *f)
Dump given UAT record to string in form which can be later loaded with uat_load_str().
Definition uat.c:288
WS_DLL_PUBLIC void uat_remove_record_idx(uat_t *uat, unsigned rec_idx)
Removes the record with the given index from the internal record list.
Definition uat.c:205
struct _fld_data_t fld_data_t
Holds per-field display and cleanup state for a single column in a UAT record's GUI representation.
WS_DLL_PUBLIC void uat_insert_record_idx(uat_t *uat, unsigned rec_idx, const void *src_record)
Inserts the record at the given index in the internal record list.
Definition uat.c:186
void *(* uat_copy_cb_t)(void *dest, const void *source, size_t len)
Definition uat.h:85
void(* uat_free_cb_t)(void *record)
Definition uat.h:95
bool(* uat_update_cb_t)(void *record, char **error)
Definition uat.h:123
void(* uat_reset_cb_t)(void)
Definition uat.h:103