wireshark/epan/uat-int.h
Guy Harris 659cf0527a UATs could be put into "categories". The categories were defined only
implicitly by the #define name and string they were defined to; not all
UATs neatly fit into any of the categories, so some of them were put
into categories that weren't obviously correct for them, and one - the
display filter macro UAT - wasn't put into any category at all (which
caused crashes when editing them, as the GUI code that handled UAT
changes from a dialog assumed the category field was non-null).

The category was, in practice, used only to decide, in the
aforementioned GUI code, whether the packet summary pane needed to be
updated or not.  It also offered no option of "don't update the packet
summary pane *and* don't redissect anything", which is what would be
appropriate for the display filter macro UAT.

Replace the category with a set of fields indicating what the UAT
affects; we currently offer "dissection", which applies to most UATs
(any UAT in libwireshark presumably affects dissection at a minimum) and
"the set of named fields that exist".  Changing any UAT that affects
dissection requires a redissection; changing any UAT that affects the
set of named fields that exist requires a redissection *and* rebuilding
the packet summary pane.

Perhaps we also need "filtering", so that if you change a display filter
macro, we re-filter, in case the display is currently filtered with a
display filter that uses a macro that changed.

svn path=/trunk/; revision=43603
2012-07-08 01:00:46 +00:00

95 lines
2.4 KiB
C

/*
* uat-int.h
*
* $Id$
*
* User Accessible Tables
* Mantain an array of user accessible data strucures
* Internal interface
*
* (c) 2007, Luis E. Garcia Ontanon <luis@ontanon.org>
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 2001 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef _UAT_INT_H_
#define _UAT_INT_H_
#include "uat.h"
typedef struct _uat_fld_rep_t uat_fld_rep_t;
typedef struct _uat_rep_t uat_rep_t;
typedef void (*uat_rep_fld_free_cb_t)(uat_fld_rep_t*);
typedef void (*uat_rep_free_cb_t)(uat_rep_t*);
typedef struct _fld_data_t {
guint colnum;
uat_fld_rep_t* rep;
uat_rep_fld_free_cb_t free_rep;
} fld_data_t;
struct _uat_t {
const char* name;
size_t record_size;
const char* filename;
gboolean from_profile;
const char* help;
guint flags;
void** user_ptr;
guint* nrows_p;
uat_copy_cb_t copy_cb;
uat_update_cb_t update_cb;
uat_free_cb_t free_cb;
uat_post_update_cb_t post_update_cb;
uat_field_t* fields;
guint ncols;
GArray* user_data;
gboolean changed;
uat_rep_t* rep;
uat_rep_free_cb_t free_rep;
gboolean loaded;
gboolean from_global;
};
gchar* uat_get_actual_filename(uat_t* uat, gboolean for_writing);
void uat_init(void);
void uat_reset(void);
void* uat_add_record(uat_t*, const void* orig_rec_ptr);
void uat_swap(uat_t*, guint idx_a, guint idx_b);
void uat_remove_record_idx(uat_t*, guint rec_idx);
void uat_destroy(uat_t*);
void uat_clear(uat_t*);
gboolean uat_save(uat_t* , char** );
void uat_load_all(void);
#define UAT_UPDATE(uat) do { *((uat)->user_ptr) = (void*)((uat)->user_data->data); *((uat)->nrows_p) = (uat)->user_data->len; } while(0)
#define UAT_INDEX_PTR(uat,idx) (uat->user_data->data + (uat->record_size * (idx)))
#endif