Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
uat-int.h
1 /*
2  * uat-int.h
3  *
4  * User Accessible Tables
5  * Maintain an array of user accessible data structures
6  * Internal interface
7  *
8  * (c) 2007, Luis E. Garcia Ontanon <luis@ontanon.org>
9  *
10  * Wireshark - Network traffic analyzer
11  * By Gerald Combs <gerald@wireshark.org>
12  * Copyright 2001 Gerald Combs
13  *
14  * SPDX-License-Identifier: GPL-2.0-or-later
15  *
16  */
17 #ifndef __UAT_INT_H__
18 #define __UAT_INT_H__
19 
20 #include "uat.h"
21 #include "ws_symbol_export.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif /* __cplusplus */
26 
27 typedef struct _uat_fld_rep_t uat_fld_rep_t;
28 typedef struct _uat_rep_t uat_rep_t;
29 
30 typedef void (*uat_rep_fld_free_cb_t)(uat_fld_rep_t*);
31 typedef void (*uat_rep_free_cb_t)(uat_rep_t*);
32 
33 typedef struct _fld_data_t {
34  guint colnum;
35  uat_fld_rep_t* rep;
36  uat_rep_fld_free_cb_t free_rep;
37 } fld_data_t;
38 
39 struct epan_uat {
40  char* name;
41  size_t record_size;
42  char* filename;
43  gboolean from_profile;
44  char* help;
45  guint flags;
46  void** user_ptr;
47  guint* nrows_p;
48  uat_copy_cb_t copy_cb;
49  uat_update_cb_t update_cb;
50  uat_free_cb_t free_cb;
51  uat_post_update_cb_t post_update_cb;
52  uat_reset_cb_t reset_cb;
53 
54  uat_field_t* fields;
55  guint ncols;
56  GArray* user_data;
57  GArray* raw_data;
58  GArray* valid_data;
59  gboolean changed;
60  uat_rep_t* rep;
61  uat_rep_free_cb_t free_rep;
62  gboolean loaded;
63  gboolean from_global;
64 };
65 
66 WS_DLL_PUBLIC
67 gchar* uat_get_actual_filename(uat_t* uat, gboolean for_writing);
68 
74 WS_DLL_PUBLIC
75 void* uat_add_record(uat_t *uat, const void *orig_rec_ptr, gboolean valid_rec);
76 
81 WS_DLL_PUBLIC
82 void uat_update_record(uat_t *uat, const void *record, gboolean valid_rec);
83 
87 WS_DLL_PUBLIC
88 void uat_swap(uat_t *uat, guint idx_a, guint idx_b);
89 
93 WS_DLL_PUBLIC
94 void uat_insert_record_idx(uat_t *uat, guint rec_idx, const void *src_record);
95 
99 WS_DLL_PUBLIC
100 void uat_remove_record_idx(uat_t *uat, guint rec_idx);
101 
105 WS_DLL_PUBLIC
106 void uat_move_index(uat_t *uat, guint old_idx, guint new_idx);
107 
111 WS_DLL_PUBLIC
112 void uat_clear(uat_t *uat);
113 
119 WS_DLL_PUBLIC
120 gboolean 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)
138 
143 #define UAT_INDEX_PTR(uat,idx) (uat->raw_data->data + (uat->record_size * (idx)))
144 
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 - http://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  */
void ** user_ptr
Definition: uat-int.h:46
GArray * raw_data
Definition: uat-int.h:57
GArray * user_data
Definition: uat-int.h:56
GArray * valid_data
Definition: uat-int.h:58
Definition: uat.h:226
guint * nrows_p
Definition: uat-int.h:47
Definition: uat-int.h:33
Definition: uat-int.h:39