Wireshark  4.3.0
The Wireshark network protocol analyzer
uat-int.h
Go to the documentation of this file.
1 
16 #ifndef __UAT_INT_H__
17 #define __UAT_INT_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 
32 typedef struct _fld_data_t {
33  unsigned colnum;
34  uat_fld_rep_t* rep;
35  uat_rep_fld_free_cb_t free_rep;
36 } fld_data_t;
37 
38 struct epan_uat {
39  char* name;
40  size_t record_size;
41  char* filename;
42  bool from_profile;
43  char* help;
44  unsigned flags;
45  void** user_ptr;
46  unsigned* nrows_p;
47  uat_copy_cb_t copy_cb;
48  uat_update_cb_t update_cb;
49  uat_free_cb_t free_cb;
50  uat_post_update_cb_t post_update_cb;
51  uat_reset_cb_t reset_cb;
52 
53  uat_field_t* fields;
54  const char** default_values;
55  unsigned ncols;
56  GArray* user_data;
57  GArray* raw_data;
58  GArray* valid_data;
59  bool changed;
60  uat_rep_t* rep;
61  uat_rep_free_cb_t free_rep;
62  bool loaded;
63  bool from_global;
64 };
65 
66 WS_DLL_PUBLIC
67 char* uat_get_actual_filename(uat_t* uat, bool for_writing);
68 
74 WS_DLL_PUBLIC
75 void* uat_add_record(uat_t *uat, const void *orig_rec_ptr, bool valid_rec);
76 
81 WS_DLL_PUBLIC
82 void uat_update_record(uat_t *uat, const void *record, bool valid_rec);
83 
87 WS_DLL_PUBLIC
88 void uat_swap(uat_t *uat, unsigned idx_a, unsigned idx_b);
89 
93 WS_DLL_PUBLIC
94 void uat_insert_record_idx(uat_t *uat, unsigned rec_idx, const void *src_record);
95 
99 WS_DLL_PUBLIC
100 void uat_remove_record_idx(uat_t *uat, unsigned rec_idx);
101 
105 WS_DLL_PUBLIC
106 void uat_move_index(uat_t *uat, unsigned old_idx, unsigned new_idx);
107 
111 WS_DLL_PUBLIC
112 void uat_clear(uat_t *uat);
113 
119 WS_DLL_PUBLIC
120 bool uat_save(uat_t *uat, char **error);
121 
125 void uat_load_all(void);
126 
130 WS_DLL_PUBLIC
131 char *uat_fld_tostr(void *rec, uat_field_t *f);
132 
137 #define UAT_UPDATE(uat) do { *((uat)->user_ptr) = (void*)((uat)->user_data->data); *((uat)->nrows_p) = (uat)->user_data->len; } while(0)
143 #define UAT_INDEX_PTR(uat,idx) (uat->raw_data->data + (uat->record_size * (idx)))
148 #define UAT_USER_INDEX_PTR(uat,idx) (uat->user_data->data + (uat->record_size * (idx)))
149 
150 #ifdef __cplusplus
151 }
152 #endif /* __cplusplus */
153 
154 #endif /* __UAT_INT_H__ */
155 
156 /*
157  * Editor modelines - https://www.wireshark.org/tools/modelines.html
158  *
159  * Local variables:
160  * c-basic-offset: 4
161  * tab-width: 8
162  * indent-tabs-mode: nil
163  * End:
164  *
165  * vi: set shiftwidth=4 tabstop=8 expandtab:
166  * :indentSize=4:tabSize=8:noTabs=true:
167  */
Definition: uat-int.h:32
Definition: uat.h:228
Definition: uat-int.h:38
void ** user_ptr
Definition: uat-int.h:45
GArray * raw_data
Definition: uat-int.h:57
unsigned * nrows_p
Definition: uat-int.h:46
GArray * valid_data
Definition: uat-int.h:58
GArray * user_data
Definition: uat-int.h:56
WS_DLL_PUBLIC bool uat_save(uat_t *uat, char **error)
Definition: uat.c:368
WS_DLL_PUBLIC void uat_update_record(uat_t *uat, const void *record, bool valid_rec)
Definition: uat.c:146
WS_DLL_PUBLIC void uat_move_index(uat_t *uat, unsigned old_idx, unsigned new_idx)
Definition: uat.c:218
WS_DLL_PUBLIC void uat_clear(uat_t *uat)
Definition: uat.c:462
WS_DLL_PUBLIC void uat_swap(uat_t *uat, unsigned idx_a, unsigned idx_b)
Definition: uat.c:165
void uat_load_all(void)
Definition: uat.c:532
WS_DLL_PUBLIC void uat_remove_record_idx(uat_t *uat, unsigned rec_idx)
Definition: uat.c:206
WS_DLL_PUBLIC void * uat_add_record(uat_t *uat, const void *orig_rec_ptr, bool valid_rec)
Definition: uat.c:118
WS_DLL_PUBLIC char * uat_fld_tostr(void *rec, uat_field_t *f)
Definition: uat.c:274
WS_DLL_PUBLIC void uat_insert_record_idx(uat_t *uat, unsigned rec_idx, const void *src_record)
Definition: uat.c:187
void *(* uat_copy_cb_t)(void *dest, const void *source, size_t len)
Definition: uat.h:87
void(* uat_free_cb_t)(void *record)
Definition: uat.h:97
bool(* uat_update_cb_t)(void *record, char **error)
Definition: uat.h:119
void(* uat_reset_cb_t)(void)
Definition: uat.h:105