aboutsummaryrefslogtreecommitdiffstats
path: root/epan/uat-int.h
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2007-01-28 10:31:32 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2007-01-28 10:31:32 +0000
commit88e699977cb5cb01bea4b164da3f874e4e603241 (patch)
treeae539712f670c86df8c54b57dd2a6b5fe91f2ae5 /epan/uat-int.h
parentc4b562e9880a9e9d3ad1ef7ff357a5ae52225550 (diff)
Although yet untested (but it compiles and is still unused) add UAT to the repo.
UAT is an API to handle User Accessible Tables, an UAT is basically an array of arbitrary structs that has a file representation as a mean for mantaining things like: - the snmp_users_table - dfilter macros - ipsec/ssl key bindings - k12 configuration, - and many other table-like user modifiable preferences comming soon gtk's uat_window() and prefs_add_uat() uat.h is fairly doc[uo]m[m]?ented, a README with a simple example of how is to be used will be available as I write them svn path=/trunk/; revision=20586
Diffstat (limited to 'epan/uat-int.h')
-rw-r--r--epan/uat-int.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/epan/uat-int.h b/epan/uat-int.h
new file mode 100644
index 0000000000..e3eb29ce47
--- /dev/null
+++ b/epan/uat-int.h
@@ -0,0 +1,67 @@
+/*
+ * uat-int.h
+ *
+ * User Accessible Tables
+ * Mantain an array of user accessible data strucures
+ * Internal interface
+ *
+ * (c) 2007, Luis E. Garcia Ontanon
+ *
+ */
+#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 _uat_fld_t {
+ char* name;
+ uat_text_mode_t mode;
+ uat_fld_chk_cb_t chk_cb;
+ uat_fld_set_cb_t set_cb;
+ uat_fld_tostr_cb_t tostr_cb;
+
+ guint colnum;
+ uat_fld_rep_t* rep;
+ uat_rep_fld_free_cb_t free_rep;
+
+ struct _uat_fld_t* next;
+} uat_fld_t;
+
+struct _uat_t {
+ char* name;
+ size_t record_size;
+ char* filename;
+ 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_fld_t* fields;
+ guint ncols;
+ GArray* user_data;
+ gboolean finalized;
+ gboolean locked;
+
+ uat_rep_t* rep;
+ uat_rep_free_cb_t free_rep;
+};
+
+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_remove_record_idx(uat_t*, guint rec_idx);
+void uat_destroy(uat_t*);
+gboolean uat_save(uat_t* dt, char** error);
+gboolean uat_load(uat_t* dt, char** error);
+
+#define UAT_UPDATE(uat) do { *((uat)->user_ptr) = (void*)((uat)->user_data->data); *((uat)->nrows_p) = (uat)->user_data->len; } while(0)
+
+#endif