Remove trailing whitespace
[metze/wireshark/wip.git] / epan / uat-int.h
1 /*
2  *  uat-int.h
3  *
4  *  $Id$
5  *
6  *  User Accessible Tables
7  *  Mantain an array of user accessible data strucures
8  *  Internal interface
9  *
10  * (c) 2007, Luis E. Garcia Ontanon <luis@ontanon.org>
11  *
12  * Wireshark - Network traffic analyzer
13  * By Gerald Combs <gerald@wireshark.org>
14  * Copyright 2001 Gerald Combs
15  *
16  * This program is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU General Public License
18  * as published by the Free Software Foundation; either version 2
19  * of the License, or (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, write to the Free Software
28  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29  *
30  */
31 #ifndef __UAT_INT_H__
32 #define __UAT_INT_H__
33
34 #include "uat.h"
35 #include "ws_symbol_export.h"
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif /* __cplusplus */
40
41 typedef struct _uat_fld_rep_t uat_fld_rep_t;
42 typedef struct _uat_rep_t uat_rep_t;
43
44 typedef void (*uat_rep_fld_free_cb_t)(uat_fld_rep_t*);
45 typedef void (*uat_rep_free_cb_t)(uat_rep_t*);
46
47 typedef struct _fld_data_t {
48     guint colnum;
49     uat_fld_rep_t* rep;
50     uat_rep_fld_free_cb_t free_rep;
51 } fld_data_t;
52
53 struct epan_uat {
54     const char* name;
55     size_t record_size;
56     const char* filename;
57     gboolean from_profile;
58     const char* help;
59     guint flags;
60     void** user_ptr;
61     guint* nrows_p;
62     uat_copy_cb_t copy_cb;
63     uat_update_cb_t update_cb;
64     uat_free_cb_t free_cb;
65     uat_post_update_cb_t post_update_cb;
66
67     uat_field_t* fields;
68     guint ncols;
69     GArray* user_data;
70     GArray* raw_data;
71     GArray* valid_data;
72     gboolean changed;
73     uat_rep_t* rep;
74     uat_rep_free_cb_t free_rep;
75     gboolean loaded;
76     gboolean from_global;
77 };
78
79 WS_DLL_PUBLIC
80 gchar* uat_get_actual_filename(uat_t* uat, gboolean for_writing);
81
82 void uat_init(void);
83
84 void uat_reset(void);
85
86 WS_DLL_PUBLIC
87 void* uat_add_record(uat_t*, const void* orig_rec_ptr, gboolean valid_rec);
88
89 WS_DLL_PUBLIC
90 void uat_swap(uat_t*, guint idx_a, guint idx_b);
91
92 WS_DLL_PUBLIC
93 void uat_remove_record_idx(uat_t*, guint rec_idx);
94
95 void uat_destroy(uat_t*);
96
97 WS_DLL_PUBLIC
98 void uat_clear(uat_t*);
99
100 WS_DLL_PUBLIC
101 gboolean uat_save(uat_t* , const char** );
102
103 void uat_load_all(void);
104
105 #define UAT_UPDATE(uat) do { *((uat)->user_ptr) = (void*)((uat)->user_data->data); *((uat)->nrows_p) = (uat)->user_data->len; } while(0)
106 #define UAT_INDEX_PTR(uat,idx) (uat->raw_data->data + (uat->record_size * (idx)))
107 #define UAT_USER_INDEX_PTR(uat,idx) (uat->user_data->data + (uat->record_size * (idx)))
108
109 #ifdef __cplusplus
110 }
111 #endif /* __cplusplus */
112
113 #endif /* __UAT_INT_H__ */
114
115 /*
116  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
117  *
118  * Local variables:
119  * c-basic-offset: 4
120  * tab-width: 8
121  * indent-tabs-mode: nil
122  * End:
123  *
124  * vi: set shiftwidth=4 tabstop=8 expandtab:
125  * :indentSize=4:tabSize=8:noTabs=true:
126  */