summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2013-05-20 17:48:09 +0000
committerAnders Broman <anders.broman@ericsson.com>2013-05-20 17:48:09 +0000
commit6a3a3c228c3de3dc6227d4fb098875181894c13c (patch)
treedf939d7dfe73c3cd1efd2b4d8586dab7d5e501f4
parent771675cfa56edc0cc36a3bda4188c3df80bfb5b2 (diff)
downloadwireshark-6a3a3c228c3de3dc6227d4fb098875181894c13c.tar.gz
Make preparation to select which level tap is to be used.
svn path=/trunk/; revision=49446
-rw-r--r--epan/dissectors/packet-exported_pdu.c2
-rw-r--r--epan/dissectors/packet-sip.c2
-rw-r--r--epan/exported_pdu.h7
-rw-r--r--ui/gtk/export_pdu_dlg.c25
4 files changed, 28 insertions, 8 deletions
diff --git a/epan/dissectors/packet-exported_pdu.c b/epan/dissectors/packet-exported_pdu.c
index 2b74fc04c6..3a883f1975 100644
--- a/epan/dissectors/packet-exported_pdu.c
+++ b/epan/dissectors/packet-exported_pdu.c
@@ -274,7 +274,7 @@ proto_register_exported_pdu(void)
* The tap is registered here but it is to be used by dissectors that
* want to export their PDU:s, see packet-sip.c
*/
- exported_pdu_tap = register_tap("export_pdu");
+ exported_pdu_tap = register_tap(EXPORT_PDU_TAP_NAME_LAYER_7);
}
diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c
index ab2af62c01..d129ffcbc4 100644
--- a/epan/dissectors/packet-sip.c
+++ b/epan/dissectors/packet-sip.c
@@ -5312,5 +5312,5 @@ proto_reg_handoff_sip(void)
saved_sip_tls_port = sip_tls_port;
ssl_dissector_add(saved_sip_tls_port, "sip.tcp", TRUE);
- exported_pdu_tap = find_tap_id("export_pdu");
+ exported_pdu_tap = find_tap_id(EXPORT_PDU_TAP_NAME_LAYER_7);
}
diff --git a/epan/exported_pdu.h b/epan/exported_pdu.h
index 3747cc029e..a5bf05a99b 100644
--- a/epan/exported_pdu.h
+++ b/epan/exported_pdu.h
@@ -29,6 +29,13 @@
#include <glib.h>
/**
+ * Define different common tap names to extract PDU:s at different layers, otherwise one packet may
+ * be exported several times at diferent layers if all taps are run.
+ * NOTE if a new tap is added here it needs to be added to export_pdu_dlg.c and packet-exported_pdu.c
+ * TODO: Use an enum_val_t instead?
+ */
+#define EXPORT_PDU_TAP_NAME_LAYER_7 "export_pdu_layer_7_tap"
+/**
* This struct is used as the data part of tap_queue_packet() and contains a
* buffer with metadata of the protocol PDU included in the tvb in the struct.
* the meta data is in TLV form, at least one tag MUST indicate what protocol is
diff --git a/ui/gtk/export_pdu_dlg.c b/ui/gtk/export_pdu_dlg.c
index 8859fde6a5..5e345d5d72 100644
--- a/ui/gtk/export_pdu_dlg.c
+++ b/ui/gtk/export_pdu_dlg.c
@@ -50,6 +50,7 @@ static GtkWidget *export_pdu_dlg = NULL;
typedef struct _exp_pdu_t {
GtkWidget *filter_widget;
+ GtkWidget *tap_name_widget;
int pkt_encap;
wtap_dumper* wdh;
} exp_pdu_t;
@@ -234,16 +235,18 @@ export_pdu_ok_cb(GtkWidget *widget _U_, gpointer data)
const char *filter = NULL;
GString *error_string;
exp_pdu_t *exp_pdu_tap_data = (exp_pdu_t *)data;
+ gchar *tap_name = NULL;
filter = gtk_entry_get_text(GTK_ENTRY(exp_pdu_tap_data->filter_widget));
+ tap_name = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(exp_pdu_tap_data->tap_name_widget));
/* Register this tap listener now */
- error_string = register_tap_listener("export_pdu", /* The name of the tap we want to listen to */
- exp_pdu_tap_data, /* instance identifier/pointer to a struct holding
- * all state variables
- */
- filter, /* pointer to a filter string */
- TL_REQUIRES_NOTHING, /* flags for the tap listener */
+ error_string = register_tap_listener(tap_name, /* The name of the tap we want to listen to */
+ exp_pdu_tap_data, /* instance identifier/pointer to a struct holding
+ * all state variables
+ */
+ filter, /* pointer to a filter string */
+ TL_REQUIRES_NOTHING, /* flags for the tap listener */
export_pdu_reset,
export_pdu_packet,
export_pdu_draw);
@@ -331,6 +334,16 @@ export_pdu_show_cb(GtkWidget *w _U_, gpointer d _U_)
ws_gtk_grid_attach_defaults(GTK_GRID(grid), exp_pdu_tap_data->filter_widget, 1, row, 1, 1);
gtk_widget_show(exp_pdu_tap_data->filter_widget);
+ row++;
+
+ /* Select which tap to run */
+ /* Combo box */
+ exp_pdu_tap_data->tap_name_widget = gtk_combo_box_text_new();
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(exp_pdu_tap_data->tap_name_widget), EXPORT_PDU_TAP_NAME_LAYER_7);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(exp_pdu_tap_data->tap_name_widget), 0);
+
+ ws_gtk_grid_attach_defaults(GTK_GRID(grid), exp_pdu_tap_data->tap_name_widget, 0, row, 1, 1);
+ gtk_widget_show(exp_pdu_tap_data->tap_name_widget);
/* Setup the button row */