diff options
-rw-r--r-- | epan/Makefile.common | 1 | ||||
-rw-r--r-- | epan/dissectors/Makefile.common | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-sip.c | 39 | ||||
-rw-r--r-- | ui/gtk/Makefile.common | 2 | ||||
-rw-r--r-- | ui/gtk/main_menubar.c | 5 |
5 files changed, 48 insertions, 0 deletions
diff --git a/epan/Makefile.common b/epan/Makefile.common index 16b0adb129..db1e52a8ff 100644 --- a/epan/Makefile.common +++ b/epan/Makefile.common @@ -177,6 +177,7 @@ LIBWIRESHARK_INCLUDES = \ except.h \ exceptions.h \ expert.h \ + exported_pdu.h \ filter_expressions.h \ filesystem.h \ follow.h \ diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common index 29d7ca3579..e1fac9ec58 100644 --- a/epan/dissectors/Makefile.common +++ b/epan/dissectors/Makefile.common @@ -534,6 +534,7 @@ DISSECTOR_SRC = \ packet-evrc.c \ packet-exec.c \ packet-extreme.c \ + packet-exported_pdu.c \ packet-fc.c \ packet-fcct.c \ packet-fcdns.c \ diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c index b1d08b2cf7..862a423b64 100644 --- a/epan/dissectors/packet-sip.c +++ b/epan/dissectors/packet-sip.c @@ -45,6 +45,7 @@ #include <epan/emem.h> #include <epan/strutil.h> #include <epan/tap.h> +#include <epan/exported_pdu.h> #include <epan/expert.h> #include <wsutil/str_util.h> @@ -66,6 +67,7 @@ static dissector_handle_t sip_tcp_handle; static gint sip_tap = -1; +static gint exported_pdu_tap = -1; static dissector_handle_t sigcomp_handle; static dissector_handle_t sip_diag_handle; @@ -962,6 +964,39 @@ sip_init_protocol(void) } } } +/* Call the export PDU tap with relevant data */ +static void +export_sip_pdu(packet_info *pinfo, tvbuff_t *tvb) +{ + exp_pdu_data_t *exp_pdu_data; + + exp_pdu_data = (exp_pdu_data_t *)g_malloc(sizeof(exp_pdu_data_t)); + + exp_pdu_data->tvb_length = tvb_length(tvb); + exp_pdu_data->pdu_tvb = tvb; + + /* For now just put end of options */ + exp_pdu_data->tlv_buffer_len = 12; + exp_pdu_data->tlv_buffer = (guint8 *)g_malloc(12); + + exp_pdu_data->tlv_buffer[0] = 0; + exp_pdu_data->tlv_buffer[1] = EXP_PDU_TAG_PROTO_NAME; + exp_pdu_data->tlv_buffer[2] = 0; + exp_pdu_data->tlv_buffer[3] = 4; /* tag length */ + exp_pdu_data->tlv_buffer[4] = 's'; + exp_pdu_data->tlv_buffer[5] = 'i'; + exp_pdu_data->tlv_buffer[6] = 'p'; + exp_pdu_data->tlv_buffer[7] = 0; + + /* End of options */ + exp_pdu_data->tlv_buffer[8] = 0; + exp_pdu_data->tlv_buffer[9] = 0; + exp_pdu_data->tlv_buffer[10] = 0; + exp_pdu_data->tlv_buffer[11] = 0; + + tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data); + +} /* Structure to collect info about a sip uri */ typedef struct _uri_offset_info @@ -3267,6 +3302,9 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr if (!pinfo->flags.in_error_pkt) { tap_queue_packet(sip_tap, pinfo, stat_info); + if(have_tap_listener(exported_pdu_tap)){ + export_sip_pdu(pinfo,tvb); + } } /* Append a brief summary to the SIP root item */ @@ -5259,4 +5297,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"); } diff --git a/ui/gtk/Makefile.common b/ui/gtk/Makefile.common index 48e9cd2705..aeb90ec099 100644 --- a/ui/gtk/Makefile.common +++ b/ui/gtk/Makefile.common @@ -177,6 +177,7 @@ WIRESHARK_TAP_SRC = \ dcerpc_stat.c \ diameter_stat.c \ expert_comp_dlg.c \ + export_pdu_dlg.c \ fc_stat.c \ flow_graph.c \ funnel_stat.c \ @@ -260,6 +261,7 @@ noinst_HEADERS = \ expert_comp_table.h \ expert_indicators.h \ export_object_dlg.h \ + export_pdu_dlg.h \ export_sslkeys.h \ file_dlg.h \ file_import_dlg.h \ diff --git a/ui/gtk/main_menubar.c b/ui/gtk/main_menubar.c index c4b4760c57..e90f11cb3b 100644 --- a/ui/gtk/main_menubar.c +++ b/ui/gtk/main_menubar.c @@ -112,6 +112,7 @@ #include "ui/gtk/time_shift_dlg.h" #include "ui/gtk/edit_packet_comment_dlg.h" #include "ui/gtk/addr_resolution_dlg.h" +#include "ui/gtk/export_pdu_dlg.h" #include "ui/gtk/packet_list.h" @@ -974,6 +975,7 @@ static const char *ui_desc_menubar = " <separator/>\n" " </menu>\n" " <menuitem name='ExportSelectedPacketBytes' action='/File/ExportSelectedPacketBytes'/>\n" +" <menuitem name='ExportPDUs' action='/File/ExportPDUs'/>\n" " <menuitem name='ExportSSLSessionKeys' action='/File/ExportSSLSessionKeys'/>\n" " <menu name= 'ExportObjects' action='/File/ExportObjects'>\n" " <menuitem name='HTTP' action='/File/ExportObjects/HTTP'/>\n" @@ -1433,6 +1435,7 @@ static const GtkActionEntry main_menu_bar_entries[] = { { "/File/ExportSpecifiedPackets", NULL, "Export Specified Packets...", NULL, NULL, G_CALLBACK(file_export_specified_packets_cmd_cb) }, { "/File/ExportPacketDissections", NULL, "Export Packet Dissections", NULL, NULL, NULL }, { "/File/ExportSelectedPacketBytes", NULL, "Export Selected Packet _Bytes...", "<control>H", NULL, G_CALLBACK(savehex_cb) }, + { "/File/ExportPDUs", NULL, "Export PDUs to file", NULL, NULL, G_CALLBACK(export_pdu_show_cb) }, { "/File/ExportSSLSessionKeys", NULL, "Export SSL Session Keys...", NULL, NULL, G_CALLBACK(savesslkeys_cb) }, { "/File/ExportObjects", NULL, "Export Objects", NULL, NULL, NULL }, { "/File/Print", GTK_STOCK_PRINT, "_Print...", "<control>P", NULL, G_CALLBACK(file_print_cmd_cb) }, @@ -4767,6 +4770,7 @@ set_menus_for_capture_file(capture_file *cf) set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSelectedPacketBytes", FALSE); set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSSLSessionKeys", FALSE); set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportObjects", FALSE); + set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportPDUs", FALSE); set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/Reload", FALSE); } else { set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Merge", cf_can_write_with_wiretap(cf)); @@ -4785,6 +4789,7 @@ set_menus_for_capture_file(capture_file *cf) set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSelectedPacketBytes", TRUE); set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSSLSessionKeys", TRUE); set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportObjects", TRUE); + set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportPDUs", TRUE); set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/Reload", TRUE); } } |