Add Logcat to Exported PDU

Logcat can be exported from ADB over USB or ADB over TCP where can occur
multiple Logcat PDUs in one frame.

Change-Id: I290fa131e5600c62357e5be4e76096ea5c35364b
Reviewed-on: https://code.wireshark.org/review/234
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
Michal Labedzki 2014-02-09 18:35:08 +01:00 committed by Alexis La Goutte
parent 4624d6d457
commit ff0468f6d3
4 changed files with 18 additions and 0 deletions

View File

@ -350,6 +350,7 @@ proto_register_exported_pdu(void)
register_tap(EXPORT_PDU_TAP_NAME_LAYER_3);
register_tap(EXPORT_PDU_TAP_NAME_LAYER_7);
register_tap(EXPORT_PDU_TAP_NAME_DVB_CI);
register_tap(EXPORT_PDU_TAP_NAME_LOGCAT);
}
void

View File

@ -26,6 +26,8 @@
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/exported_pdu.h>
#include <epan/tap.h>
static int proto_logcat = -1;
@ -48,6 +50,8 @@ static gint ett_logcat_timestamp = -1;
static dissector_handle_t logcat_handle;
static gint exported_pdu_tap = -1;
static expert_field ei_invalid_payload_length = EI_INIT;
static const value_string priority_vals[] = {
@ -171,6 +175,15 @@ dissect_logcat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
if (length != check_length)
proto_tree_add_expert(maintree, pinfo, &ei_invalid_payload_length, tvb, offset, tvb_length_remaining(tvb, offset));
if (have_tap_listener(exported_pdu_tap)) {
exp_pdu_data_t *exp_pdu_data;
exp_pdu_data = load_export_pdu_tags(pinfo, "logcat", -1, EXP_PDU_TAG_END_OF_OPT);
exp_pdu_data->tvb_length = tvb_length(tvb);
exp_pdu_data->pdu_tvb = tvb;
tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
}
return offset;
}
@ -269,6 +282,8 @@ void
proto_reg_handoff_logcat(void)
{
dissector_add_handle("tcp.port", logcat_handle);
exported_pdu_tap = find_tap_id(EXPORT_PDU_TAP_NAME_LOGCAT);
}
/*

View File

@ -40,6 +40,7 @@
#define EXPORT_PDU_TAP_NAME_LAYER_3 "OSI layer 3"
#define EXPORT_PDU_TAP_NAME_LAYER_7 "OSI layer 7"
#define EXPORT_PDU_TAP_NAME_DVB_CI "DVB-CI"
#define EXPORT_PDU_TAP_NAME_LOGCAT "Logcat"
/**
* This struct is used as the data part of tap_queue_packet() and contains a

View File

@ -154,6 +154,7 @@ export_pdu_show_cb(GtkWidget *w _U_, gpointer d _U_)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(exp_pdu_dlg_data->tap_name_widget), EXPORT_PDU_TAP_NAME_LAYER_7);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(exp_pdu_dlg_data->tap_name_widget), EXPORT_PDU_TAP_NAME_LAYER_3);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(exp_pdu_dlg_data->tap_name_widget), EXPORT_PDU_TAP_NAME_DVB_CI);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(exp_pdu_dlg_data->tap_name_widget), EXPORT_PDU_TAP_NAME_LOGCAT);
gtk_combo_box_set_active(GTK_COMBO_BOX(exp_pdu_dlg_data->tap_name_widget), 0);
ws_gtk_grid_attach_defaults(GTK_GRID(grid), exp_pdu_dlg_data->tap_name_widget, 0, row, 1, 1);