Add an additional "title" attribute for UAT fields; that's what's
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 16 Feb 2009 04:10:06 +0000 (04:10 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 16 Feb 2009 04:10:06 +0000 (04:10 +0000)
displayed to the user.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27462 f5534014-38df-0310-8fa8-9805f1628bb7

12 files changed:
asn1/snmp/packet-snmp-template.c
epan/dfilter/dfilter-macro.c
epan/dissectors/packet-k12.c
epan/dissectors/packet-sccp.c
epan/dissectors/packet-snmp.c
epan/dissectors/packet-user_encap.c
epan/geoip_db.c
epan/oids.c
epan/uat.c
epan/uat.h
epan/uat_load.l
gtk/uat_gui.c

index e769111a0038eafc46c774788ab81d5a56a452c1..e6be09d1f761fb3998e6fe883a5a8b01622b47aa 100644 (file)
@@ -1935,12 +1935,12 @@ void proto_register_snmp(void) {
   };
   module_t *snmp_module;
   static uat_field_t users_fields[] = {
-         UAT_FLD_BUFFER(snmp_users,engine_id,"Engine-id for this entry (empty = any)"),
-         UAT_FLD_LSTRING(snmp_users,userName,"The username"),
-         UAT_FLD_VS(snmp_users,auth_model,auth_types,"Algorithm to be used for authentication."),
-         UAT_FLD_LSTRING(snmp_users,authPassword,"The password used for authenticating packets for this entry"),
-         UAT_FLD_VS(snmp_users,priv_proto,priv_types,"Algorithm to be used for privacy."),
-         UAT_FLD_LSTRING(snmp_users,privPassword,"The password used for encrypting packets for this entry"),
+         UAT_FLD_BUFFER(snmp_users,engine_id,"Engine ID","Engine-id for this entry (empty = any)"),
+         UAT_FLD_LSTRING(snmp_users,userName,"Username","The username"),
+         UAT_FLD_VS(snmp_users,auth_model,"Authentication model",auth_types,"Algorithm to be used for authentication."),
+         UAT_FLD_LSTRING(snmp_users,authPassword,"Password","The password used for authenticating packets for this entry"),
+         UAT_FLD_VS(snmp_users,priv_proto,"Privacy protocol",priv_types,"Algorithm to be used for privacy."),
+         UAT_FLD_LSTRING(snmp_users,privPassword,"Privacy password","The password used for encrypting packets for this entry"),
          UAT_END_FIELDS
   };
 
index 319754c187b72edf4bb7b5188156be2dd89bfd3c..a6601c4ce49709cdcba7fa504915da8ce56362b8 100644 (file)
@@ -595,8 +595,8 @@ UAT_CSTRING_CB_DEF(macro,text,dfilter_macro_t)
 
 void dfilter_macro_init(void) {
        static uat_field_t uat_fields[] =  {
-               UAT_FLD_CSTRING_OTHER(macro,name,macro_name_chk,"The name of the macro."),
-               UAT_FLD_CSTRING_ISPRINT(macro,text,"The text this macro resolves to."),
+               UAT_FLD_CSTRING_OTHER(macro,name,"Name",macro_name_chk,"The name of the macro."),
+               UAT_FLD_CSTRING_ISPRINT(macro,text,"Text","The text this macro resolves to."),
                UAT_END_FIELDS
        };
 
index 3ec02582c55308576ceb58ace23677b4eb8886d6..58982518a1f2f56ffdae6643930776f2460f8b90 100644 (file)
@@ -435,10 +435,10 @@ proto_register_k12(void)
   };
 
   static uat_field_t uat_k12_flds[] = {
-      UAT_FLD_CSTRING_ISPRINT(k12,match,
+      UAT_FLD_CSTRING_ISPRINT(k12,match,"Match string",
                              "A string that will be matched (a=A) against an .stk filename or the name of a port.\n"
                              "The first match wins, the order of entries in the table is important!."),
-      UAT_FLD_CSTRING_OTHER(k12,protos,protos_chk_cb,
+      UAT_FLD_CSTRING_OTHER(k12,protos,"Protocol",protos_chk_cb,
                            "The lowest layer protocol described by this .stk file (eg: mtp2).\n"
                            "Use (sscop:sscf-nni) for sscf-nni (MTP3b) with sscop"),
       UAT_END_FIELDS
index cfb1d8334f05f6a98d8328b79ba81c413d06b514..5be1116337e2c86d32186e47c9744f3d29930904 100644 (file)
@@ -3208,10 +3208,10 @@ proto_register_sccp(void)
 
 
   static uat_field_t users_flds[] = {
-               UAT_FLD_DEC(sccp_users,ni,"Network Indicator"),
-               UAT_FLD_RANGE(sccp_users,called_pc,65535,"DPCs for which this protocol is to be used"),
-               UAT_FLD_RANGE(sccp_users,called_ssn,65535,"Called SSNs for which this protocol is to be used"),
-               UAT_FLD_VS(sccp_users,user,sccp_users_vals,"The User Protocol"),
+               UAT_FLD_DEC(sccp_users,ni,"Network Indicator","Network Indicator"),
+               UAT_FLD_RANGE(sccp_users,called_pc,"Called DPCs",65535,"DPCs for which this protocol is to be used"),
+               UAT_FLD_RANGE(sccp_users,called_ssn,"Called SSNs",65535,"Called SSNs for which this protocol is to be used"),
+               UAT_FLD_VS(sccp_users,user,"User protocol",sccp_users_vals,"The User Protocol"),
                UAT_END_FIELDS
   };
 
index a22aba361ff552ca4267ce2bdc1f328aff1b0046..d56019f9ae128a9bf3cb3e307c15f6dbe7d0db2e 100644 (file)
@@ -1,7 +1,7 @@
 /* Do not modify this file.                                                   */
 /* It is created automatically by the ASN.1 to Wireshark dissector compiler   */
 /* packet-snmp.c                                                              */
-/* ../../tools/asn2wrs.py -b -p snmp -c snmp.cnf -s packet-snmp-template snmp.asn */
+/* ../../tools/asn2wrs.py -b -p snmp -c ./snmp.cnf -s ./packet-snmp-template -D . snmp.asn */
 
 /* Input file: packet-snmp-template.c */
 
@@ -3417,12 +3417,12 @@ void proto_register_snmp(void) {
   };
   module_t *snmp_module;
   static uat_field_t users_fields[] = {
-         UAT_FLD_BUFFER(snmp_users,engine_id,"Engine-id for this entry (empty = any)"),
-         UAT_FLD_LSTRING(snmp_users,userName,"The username"),
-         UAT_FLD_VS(snmp_users,auth_model,auth_types,"Algorithm to be used for authentication."),
-         UAT_FLD_LSTRING(snmp_users,authPassword,"The password used for authenticating packets for this entry"),
-         UAT_FLD_VS(snmp_users,priv_proto,priv_types,"Algorithm to be used for privacy."),
-         UAT_FLD_LSTRING(snmp_users,privPassword,"The password used for encrypting packets for this entry"),
+         UAT_FLD_BUFFER(snmp_users,engine_id,"Engine ID","Engine-id for this entry (empty = any)"),
+         UAT_FLD_LSTRING(snmp_users,userName,"Username","The username"),
+         UAT_FLD_VS(snmp_users,auth_model,"Authentication model",auth_types,"Algorithm to be used for authentication."),
+         UAT_FLD_LSTRING(snmp_users,authPassword,"Password","The password used for authenticating packets for this entry"),
+         UAT_FLD_VS(snmp_users,priv_proto,"Privacy protocol",priv_types,"Algorithm to be used for privacy."),
+         UAT_FLD_LSTRING(snmp_users,privPassword,"Privacy password","The password used for encrypting packets for this entry"),
          UAT_END_FIELDS
   };
 
index 7979c46fe32f8d0128527bd1bd4ac193a4106f9b..76fd633a82d9ebd334581f418cf9df08c81a1ad4 100644 (file)
@@ -155,12 +155,12 @@ void proto_register_user_encap(void)
        module_t *module;
 
        static uat_field_t user_flds[] = {
-               UAT_FLD_VS(user_encap,encap,user_dlts,"The DLT"),
-               UAT_FLD_PROTO(user_encap,payload_proto,"Protocol to be used for the payload of this DLT"),
-               UAT_FLD_DEC(user_encap,header_size,"Size of an eventual header that precedes the actual payload, 0 means none"),
-               UAT_FLD_PROTO(user_encap,header_proto,"Protocol to be used for the header (empty = data)"),
-               UAT_FLD_DEC(user_encap,trailer_size,"Size of an eventual trailer that follows the actual payload, 0 means none"),
-               UAT_FLD_PROTO(user_encap,trailer_proto,"Protocol to be used for the trailer (empty = data)"),
+               UAT_FLD_VS(user_encap,encap,"DLT",user_dlts,"The DLT"),
+               UAT_FLD_PROTO(user_encap,payload_proto,"Payload protocol","Protocol to be used for the payload of this DLT"),
+               UAT_FLD_DEC(user_encap,header_size,"Header size","Size of an eventual header that precedes the actual payload, 0 means none"),
+               UAT_FLD_PROTO(user_encap,header_proto,"Header protocol","Protocol to be used for the header (empty = data)"),
+               UAT_FLD_DEC(user_encap,trailer_size,"Trailer size","Size of an eventual trailer that follows the actual payload, 0 means none"),
+               UAT_FLD_PROTO(user_encap,trailer_proto,"Trailer protocol","Protocol to be used for the trailer (empty = data)"),
                UAT_END_FIELDS
        };
        
index 4038982844f7d5e56de797edde863b6df2b72588..8becf3e2327ef0c700032772cca7e5ea4c958053 100644 (file)
@@ -128,7 +128,7 @@ void
 geoip_db_init(void) {
        guint i;
        static uat_field_t geoip_db_paths_fields[] = {
-               UAT_FLD_CSTRING(geoip_mod, path, "The database path"),
+               UAT_FLD_PATHNAME(geoip_mod, path, "Database pathname", "The database path"),
                UAT_END_FIELDS
        };
        char* geoip_load_error = NULL;
index a49f201017c6eaeb66fab5740f966ac91c0526be..fb03d3303c624311da7200b87cdb1dada253d512 100644 (file)
@@ -494,11 +494,11 @@ void register_mibs(void) {
        GArray* hfa = g_array_new(FALSE,TRUE,sizeof(hf_register_info));
        GArray* etta = g_array_new(FALSE,TRUE,sizeof(gint*));
        static uat_field_t smi_fields[] = {
-               UAT_FLD_CSTRING(smi_mod,name,"The module's name"),
+               UAT_FLD_CSTRING(smi_mod,name,"Module name","The module's name"),
                UAT_END_FIELDS
        };
        static uat_field_t smi_paths_fields[] = {
-               UAT_FLD_CSTRING(smi_mod,name,"The directory name"),
+               UAT_FLD_CSTRING(smi_mod,name,"Directory path","The directory name"),
                UAT_END_FIELDS
        };
        char* smi_load_error = NULL;
index bcb3558db3d873cab28b3fa234dfa7d1623d9b81..5f2016cbf18ca3092a9787652c3638ffd4faf60f 100644 (file)
@@ -100,7 +100,7 @@ uat_t* uat_new(const char* name,
        uat->help = help;
        uat->category = category;
 
-       for (i=0;flds_array[i].name;i++) {
+       for (i=0;flds_array[i].title;i++) {
                fld_data_t* f = g_malloc(sizeof(fld_data_t));
 
                f->colnum = i+1;
index 5127aec945834fcf39b3925438a91caf7840e41a..728e13f453ba84f8479461475fb13c5ded009996 100644 (file)
@@ -178,6 +178,7 @@ typedef enum _uat_text_mode_t {
  */
 typedef struct _uat_field_t {
        const char* name;
+       const char* title;
        uat_text_mode_t mode;
 
        struct {
@@ -199,7 +200,7 @@ typedef struct _uat_field_t {
 } uat_field_t;
 
 #define FLDFILL NULL
-#define UAT_END_FIELDS {0,PT_TXTMOD_NONE,{0,0,0},{0,0,0},0,0,FLDFILL}
+#define UAT_END_FIELDS {NULL,NULL,PT_TXTMOD_NONE,{0,0,0},{0,0,0},0,0,FLDFILL}
 
 
 #define UAT_CAT_GENERAL "General"
@@ -331,14 +332,21 @@ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out
                } else { \
                        *out_ptr = ""; *out_len = 0; } }
 
-#define UAT_FLD_CSTRING(basename,field_name,desc) \
-       {#field_name, PT_TXTMOD_STRING,{uat_fld_chk_str,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
+#define UAT_FLD_CSTRING(basename,field_name,title,desc) \
+       {#field_name, title, PT_TXTMOD_STRING,{uat_fld_chk_str,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
 
-#define UAT_FLD_CSTRING_ISPRINT(basename,field_name,desc) \
-       {#field_name, PT_TXTMOD_STRING,{uat_fld_chk_str_isprint,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
+#define UAT_FLD_CSTRING_ISPRINT(basename,field_name,title,desc) \
+       {#field_name, title, PT_TXTMOD_STRING,{uat_fld_chk_str_isprint,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
 
-#define UAT_FLD_CSTRING_OTHER(basename,field_name,chk,desc) \
-       {#field_name, PT_TXTMOD_STRING,{ chk ,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
+#define UAT_FLD_CSTRING_OTHER(basename,field_name,title,chk,desc) \
+       {#field_name, title, PT_TXTMOD_STRING,{ chk ,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
+
+/*
+ * PATHNAME - for now, just a CSTRING, but we might want to have a
+ * way to pop up a dialog to let you browse for a file name.
+ */
+#define UAT_FLD_PATHNAME(basename,field_name,title,desc) \
+       {#field_name, title, PT_TXTMOD_STRING,{uat_fld_chk_str,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
 
 /*
  * LSTRING MACROS
@@ -355,8 +363,8 @@ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out
        } else { \
                *out_ptr = ""; *out_len = 0; } }
 
-#define UAT_FLD_LSTRING(basename,field_name,desc) \
-{#field_name, PT_TXTMOD_STRING,{0,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
+#define UAT_FLD_LSTRING(basename,field_name,title, desc) \
+{#field_name, title, PT_TXTMOD_STRING,{0,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
 
 
 /*
@@ -375,8 +383,8 @@ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out
        *out_ptr = ((rec_t*)rec)->ptr_element ? ep_memdup(((rec_t*)rec)->ptr_element,((rec_t*)rec)->len_element) : ""; \
        *out_len = ((rec_t*)rec)->len_element; }
 
-#define UAT_FLD_BUFFER(basename,field_name,desc) \
-       {#field_name, PT_TXTMOD_HEXBYTES,{0,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
+#define UAT_FLD_BUFFER(basename,field_name,title,desc) \
+       {#field_name, title, PT_TXTMOD_HEXBYTES,{0,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
 
 
 /*
@@ -390,8 +398,8 @@ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out
        *out_ptr = ep_strdup_printf("%d",((rec_t*)rec)->field_name); \
        *out_len = strlen(*out_ptr); }
 
-#define UAT_FLD_DEC(basename,field_name,desc) \
-       {#field_name, PT_TXTMOD_STRING,{uat_fld_chk_num_dec,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
+#define UAT_FLD_DEC(basename,field_name,title,desc) \
+       {#field_name, title, PT_TXTMOD_STRING,{uat_fld_chk_num_dec,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
 
 
 /*
@@ -405,8 +413,8 @@ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out
        *out_ptr = ep_strdup_printf("%x",((rec_t*)rec)->field_name); \
        *out_len = strlen(*out_ptr); }
 
-#define UAT_FLD_HEX(basename,field_name,desc) \
-{#field_name, PT_TXTMOD_STRING,{uat_fld_chk_num_hex,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
+#define UAT_FLD_HEX(basename,field_name,title,desc) \
+{#field_name, title, PT_TXTMOD_STRING,{uat_fld_chk_num_hex,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
 
 
 /*
@@ -433,8 +441,8 @@ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out
                        *out_len = strlen(*out_ptr); return; } } }
 
 
-#define UAT_FLD_VS(basename,field_name,enum,desc) \
-       {#field_name, PT_TXTMOD_ENUM,{uat_fld_chk_enum,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{&(enum),&(enum),&(enum)},&(enum),desc,FLDFILL}
+#define UAT_FLD_VS(basename,field_name,title,enum,desc) \
+       {#field_name, title, PT_TXTMOD_ENUM,{uat_fld_chk_enum,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{&(enum),&(enum),&(enum)},&(enum),desc,FLDFILL}
 
 
 /*
@@ -458,8 +466,8 @@ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out
                *out_ptr = ""; *out_len = 0; } }
 
 
-#define UAT_FLD_PROTO(basename,field_name,desc) \
-       {#field_name, PT_TXTMOD_STRING,{uat_fld_chk_proto,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
+#define UAT_FLD_PROTO(basename,field_name,title,desc) \
+       {#field_name, title, PT_TXTMOD_STRING,{uat_fld_chk_proto,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
 
 /*
  * RANGE macros
@@ -477,13 +485,8 @@ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out
                *out_ptr = ""; *out_len = 0; } }
 
 
-#define UAT_FLD_RANGE(basename,field_name,max,desc) \
-       {#field_name, PT_TXTMOD_STRING,{uat_fld_chk_range,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},\
+#define UAT_FLD_RANGE(basename,field_name,title,max,desc) \
+       {#field_name, title, PT_TXTMOD_STRING,{uat_fld_chk_range,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},\
          {GUINT_TO_POINTER(max),GUINT_TO_POINTER(max),GUINT_TO_POINTER(max)},0,desc,FLDFILL}
 
-
-
-
-
 #endif
-
index fb76d83cb587e4809ca61df3bf37088fec39e037..4920c474904bde547932e2e30352629a081aec30 100644 (file)
@@ -219,7 +219,7 @@ comment #[^\n]*\n
 
 <SEPARATOR>{newline} {
        linenum++;
-       ERROR(("expecting field %s in previuos line",uat->fields[colnum].name));
+       ERROR(("expecting field %s in previous line",uat->fields[colnum].name));
        BEGIN START_OF_LINE;
 }
 
index 05f34be6fe1ebd22c6478345908666cf81f78b20..98e9fcf441cdcfaa60e63480b058718958c586f7 100644 (file)
@@ -291,7 +291,7 @@ static gboolean uat_dlg_cb(GtkWidget *win _U_, gpointer user_data) {
                                text = (void*) unhexbytes(text, strlen(text), &len, &err);
 
                                if (err) {
-                                       err = ep_strdup_printf("error in field '%s': %s",f[colnum].name,err);
+                                       err = ep_strdup_printf("error in field '%s': %s",f[colnum].title,err);
                                        goto on_failure;
                                }
 
@@ -311,7 +311,7 @@ static gboolean uat_dlg_cb(GtkWidget *win _U_, gpointer user_data) {
 
                if (f[colnum].cb.chk) {
                        if (! f[colnum].cb.chk(dd->rec, text, len, f[colnum].cbdata.chk, f[colnum].fld_data, &err)) {
-                               err = ep_strdup_printf("error in field '%s': %s",f[colnum].name,err);
+                               err = ep_strdup_printf("error in column '%s': %s",f[colnum].title,err);
                                goto on_failure;
                        }
                }
@@ -435,7 +435,7 @@ static void uat_edit_dialog(uat_t* uat, gint row) {
 
                event_box = gtk_event_box_new();
 
-               label = gtk_label_new(f[colnum].name);
+               label = gtk_label_new(f[colnum].title);
                if (f[colnum].desc != NULL)
                        gtk_tooltips_set_tip(tooltips, event_box, f[colnum].desc, NULL);
 
@@ -576,7 +576,7 @@ static void uat_del_dlg(uat_t* uat, int idx) {
                GtkWidget *label;
                char* text = fld_tostr(rec,&(f[colnum]));
 
-               label = gtk_label_new(f[colnum].name);
+               label = gtk_label_new(f[colnum].title);
                gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
                gtk_table_attach_defaults(GTK_TABLE(main_tb), label, 0, 1, colnum+1, colnum + 2);
                
@@ -856,7 +856,7 @@ static GtkWidget* uat_window(void* u) {
        gtk_box_pack_start(GTK_BOX(hbox), rep->scrolledwindow, TRUE, TRUE, 0);
 
        for ( colnum = 0; colnum < uat->ncols; colnum++ ) {
-               gtk_clist_set_column_title(GTK_CLIST(rep->clist), colnum, f[colnum].name);
+               gtk_clist_set_column_title(GTK_CLIST(rep->clist), colnum, f[colnum].title);
                gtk_clist_set_column_auto_resize(GTK_CLIST(rep->clist), colnum, TRUE);
        }