| Wireshark 4.7.3 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
23 extern "C" {
24#endif /* __cplusplus */
25
26 typedef struct _uat_fld_rep_t uat_fld_rep_t;
27 typedef struct _uat_rep_t uat_rep_t;
28
29 typedef void (*uat_rep_fld_free_cb_t)(uat_fld_rep_t*);
30 typedef void (*uat_rep_free_cb_t)(uat_rep_t*);
31
35 typedef struct _fld_data_t {
36 unsigned colnum;
37 uat_fld_rep_t* rep;
38 uat_rep_fld_free_cb_t free_rep;
39} fld_data_t;
40
44 struct epan_uat {
45 char* name;
46 size_t record_size;
47 char* filename;
48 bool from_profile;
49 char* help;
50 unsigned flags;
51 void** user_ptr;
52 unsigned* nrows_p;
53 uat_copy_cb_t copy_cb;
54 uat_update_cb_t update_cb;
55 uat_free_cb_t free_cb;
56 uat_post_update_cb_t post_update_cb;
57 uat_reset_cb_t reset_cb;
58
59 uat_field_t* fields;
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
79 char* uat_get_actual_filename(uat_t* uat, bool for_writing, const char* app_env_var_prefix);
80
90WS_DLL_PUBLIC
91 void* uat_add_record(uat_t *uat, const void *orig_rec_ptr, bool valid_rec);
92
100WS_DLL_PUBLIC
101 void uat_update_record(uat_t *uat, const void *record, bool valid_rec);
102
109WS_DLL_PUBLIC
110 void uat_swap(uat_t *uat, unsigned idx_a, unsigned idx_b);
111
118WS_DLL_PUBLIC
119 void uat_insert_record_idx(uat_t *uat, unsigned rec_idx, const void *src_record);
120
126WS_DLL_PUBLIC
127 void uat_remove_record_idx(uat_t *uat, unsigned rec_idx);
128
137WS_DLL_PUBLIC
138 void uat_remove_record_range(uat_t *uat, unsigned rec_idx, unsigned count);
139
146WS_DLL_PUBLIC
147 void uat_move_index(uat_t *uat, unsigned old_idx, unsigned new_idx);
148
153WS_DLL_PUBLIC
154 void uat_clear(uat_t *uat);
155
165WS_DLL_PUBLIC
166 bool uat_save(uat_t *uat, const char* app_env_var_prefix, char **error);
167
172 void uat_load_all(const char* app_env_var_prefix);
173
186WS_DLL_PUBLIC
187 char *uat_fld_tostr(void *rec, uat_field_t *f);
188
197WS_DLL_PUBLIC
198 char *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 */
_fld_data_t
Holds per-field display and cleanup state for a single column in a UAT record's GUI representation.
Definition uat-int.h:35
_fld_data_t::colnum
unsigned colnum
Definition uat-int.h:36
_fld_data_t::free_rep
uat_rep_fld_free_cb_t free_rep
Definition uat-int.h:38
_fld_data_t::rep
uat_fld_rep_t * rep
Definition uat-int.h:37
epan_uat
Represents a User Accessible Table (UAT), managing a set of user-editable records exposed to a dissec...
Definition uat-int.h:44
epan_uat::record_size
size_t record_size
Definition uat-int.h:46
epan_uat::post_update_cb
uat_post_update_cb_t post_update_cb
Definition uat-int.h:56
epan_uat::changed
bool changed
Definition uat-int.h:65
epan_uat::user_ptr
void ** user_ptr
Definition uat-int.h:51
epan_uat::raw_data
GArray * raw_data
Definition uat-int.h:63
epan_uat::ncols
unsigned ncols
Definition uat-int.h:61
epan_uat::from_profile
bool from_profile
Definition uat-int.h:48
epan_uat::help
char * help
Definition uat-int.h:49
epan_uat::filename
char * filename
Definition uat-int.h:47
epan_uat::default_values
const char ** default_values
Definition uat-int.h:60
epan_uat::reset_cb
uat_reset_cb_t reset_cb
Definition uat-int.h:57
epan_uat::rep
uat_rep_t * rep
Definition uat-int.h:66
epan_uat::update_cb
uat_update_cb_t update_cb
Definition uat-int.h:54
epan_uat::fields
uat_field_t * fields
Definition uat-int.h:59
epan_uat::free_rep
uat_rep_free_cb_t free_rep
Definition uat-int.h:67
epan_uat::flags
unsigned flags
Definition uat-int.h:50
epan_uat::nrows_p
unsigned * nrows_p
Definition uat-int.h:52
epan_uat::copy_cb
uat_copy_cb_t copy_cb
Definition uat-int.h:53
epan_uat::loaded
bool loaded
Definition uat-int.h:68
epan_uat::valid_data
GArray * valid_data
Definition uat-int.h:64
epan_uat::name
char * name
Definition uat-int.h:45
epan_uat::free_cb
uat_free_cb_t free_cb
Definition uat-int.h:55
epan_uat::user_data
GArray * user_data
Definition uat-int.h:62
uat_load_all
void uat_load_all(const char *app_env_var_prefix)
Loads the records for all registered UATs from file.
Definition uat.c:615
uat_get_actual_filename
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
uat_update_record
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
uat_remove_record_range
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
uat_move_index
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
uat_clear
WS_DLL_PUBLIC void uat_clear(uat_t *uat)
Removes and destroys all records from the UAT.
Definition uat.c:533
uat_save
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
uat_swap
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
uat_record_tostr
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
uat_add_record
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
uat_fld_tostr
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
uat_remove_record_idx
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
fld_data_t
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.
uat_insert_record_idx
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
uat.h
uat_copy_cb_t
void *(* uat_copy_cb_t)(void *dest, const void *source, size_t len)
Definition uat.h:85
uat_field_t
struct _uat_field_t uat_field_t
Describes a single editable field within a UAT (User Accessible Table).
uat_free_cb_t
void(* uat_free_cb_t)(void *record)
Definition uat.h:95
uat_update_cb_t
bool(* uat_update_cb_t)(void *record, char **error)
Definition uat.h:123
uat_reset_cb_t
void(* uat_reset_cb_t)(void)
Definition uat.h:103