2014-05-14 07:45:23 +00:00
|
|
|
/* packet-logcat-text.c
|
|
|
|
* Routines for Android Logcat text formats
|
|
|
|
*
|
|
|
|
* Copyright 2014, Michal Orynicz for Tieto Corporation
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-12 11:23:27 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2014-05-14 07:45:23 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2014-12-20 21:23:59 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2014-05-14 07:45:23 +00:00
|
|
|
#include "epan/packet.h"
|
|
|
|
#include "epan/expert.h"
|
2015-06-16 13:50:25 +00:00
|
|
|
#include "epan/exported_pdu.h"
|
|
|
|
#include "epan/tap.h"
|
2014-11-20 12:09:31 +00:00
|
|
|
#include "wiretap/logcat_text.h"
|
2014-05-14 07:45:23 +00:00
|
|
|
|
|
|
|
extern const value_string priority_vals[];
|
|
|
|
|
|
|
|
static int proto_logcat_text = -1;
|
|
|
|
|
|
|
|
static int hf_logcat_text_pid = -1;
|
|
|
|
static int hf_logcat_text_tid = -1;
|
|
|
|
static int hf_logcat_text_timestamp = -1;
|
|
|
|
static int hf_logcat_text_priority = -1;
|
|
|
|
static int hf_logcat_text_tag = -1;
|
|
|
|
static int hf_logcat_text_log = -1;
|
|
|
|
|
|
|
|
static gint ett_logcat = -1;
|
|
|
|
|
|
|
|
static expert_field ei_malformed_time = EI_INIT;
|
|
|
|
static expert_field ei_malformed_token = EI_INIT;
|
|
|
|
|
|
|
|
static dissector_handle_t logcat_text_brief_handle;
|
|
|
|
static dissector_handle_t logcat_text_tag_handle;
|
|
|
|
static dissector_handle_t logcat_text_process_handle;
|
|
|
|
static dissector_handle_t logcat_text_time_handle;
|
|
|
|
static dissector_handle_t logcat_text_thread_handle;
|
|
|
|
static dissector_handle_t logcat_text_threadtime_handle;
|
|
|
|
static dissector_handle_t logcat_text_long_handle;
|
|
|
|
|
2015-06-16 13:50:25 +00:00
|
|
|
static gint exported_pdu_tap = -1;
|
|
|
|
|
2014-05-14 07:45:23 +00:00
|
|
|
static GRegex *special_regex = NULL;
|
|
|
|
static GRegex *brief_regex = NULL;
|
|
|
|
static GRegex *tag_regex = NULL;
|
|
|
|
static GRegex *time_regex = NULL;
|
|
|
|
static GRegex *process_regex = NULL;
|
|
|
|
static GRegex *thread_regex = NULL;
|
|
|
|
static GRegex *threadtime_regex = NULL;
|
|
|
|
static GRegex *long_regex = NULL;
|
|
|
|
|
|
|
|
static const gchar dissector_name[] = "Logcat Text";
|
|
|
|
|
|
|
|
typedef int (*tGETTER) (const gchar *frame, const gchar *token, tvbuff_t *tvb,
|
|
|
|
proto_tree *maintree, gint start_offset, packet_info *pinfo);
|
|
|
|
|
|
|
|
typedef struct {
|
2014-07-23 10:26:05 +00:00
|
|
|
GRegex **regex;
|
2014-05-14 07:45:23 +00:00
|
|
|
const tGETTER *getters;
|
|
|
|
guint no_of_getters;
|
|
|
|
} dissect_info_t;
|
|
|
|
|
|
|
|
void proto_register_logcat_text(void);
|
|
|
|
void proto_reg_handoff_logcat_text(void);
|
|
|
|
|
|
|
|
static int get_priority(const gchar *frame, const gchar *token, tvbuff_t *tvb,
|
|
|
|
proto_tree *maintree, gint start_offset, packet_info *pinfo _U_) {
|
|
|
|
int prio;
|
|
|
|
gchar *p = g_strstr_len(frame + start_offset, -1, token);
|
2014-08-06 08:29:10 +00:00
|
|
|
int offset = (int)(p - frame);
|
2014-05-14 07:45:23 +00:00
|
|
|
|
|
|
|
switch (*p) {
|
|
|
|
case 'I':
|
|
|
|
prio = 4;
|
|
|
|
break;
|
|
|
|
case 'V':
|
|
|
|
prio = 2;
|
|
|
|
break;
|
|
|
|
case 'D':
|
|
|
|
prio = 3;
|
|
|
|
break;
|
|
|
|
case 'W':
|
|
|
|
prio = 5;
|
|
|
|
break;
|
|
|
|
case 'E':
|
|
|
|
prio = 6;
|
|
|
|
break;
|
|
|
|
case 'F':
|
|
|
|
prio = 7;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
prio = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
proto_tree_add_uint(maintree, hf_logcat_text_priority, tvb, offset, 1, prio);
|
|
|
|
return offset + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int get_tag(const gchar *frame, const gchar *token, tvbuff_t *tvb,
|
|
|
|
proto_tree *maintree, gint start_offset, packet_info *pinfo) {
|
|
|
|
gchar *p = g_strstr_len(frame + start_offset, -1, token);
|
2014-08-06 08:29:10 +00:00
|
|
|
int offset = (int)(p - frame);
|
2015-02-21 16:42:28 +00:00
|
|
|
guint8 *src_addr = wmem_strdup(pinfo->pool, token);
|
2014-08-06 08:29:10 +00:00
|
|
|
gint tok_len = (gint)strlen(token);
|
2014-05-14 07:45:23 +00:00
|
|
|
|
|
|
|
proto_tree_add_string(maintree, hf_logcat_text_tag, tvb, offset, tok_len,
|
|
|
|
token);
|
2015-10-21 19:04:16 +00:00
|
|
|
set_address(&pinfo->src, AT_STRINGZ, tok_len + 1, src_addr);
|
|
|
|
set_address(&pinfo->dst, AT_STRINGZ, sizeof(dissector_name), dissector_name);
|
2014-05-14 07:45:23 +00:00
|
|
|
return offset + tok_len;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int get_ptid(const gchar *frame, const gchar *token, tvbuff_t *tvb,
|
|
|
|
proto_tree *maintree, gint header_field, gint start_offset) {
|
|
|
|
gchar *p = g_strstr_len(frame + start_offset, -1, token);
|
2014-08-06 08:29:10 +00:00
|
|
|
int offset = (int)(p - frame);
|
2014-05-14 07:45:23 +00:00
|
|
|
|
2014-08-07 22:31:09 +00:00
|
|
|
proto_tree_add_uint(maintree, header_field, tvb, offset, (gint)strlen(token),
|
|
|
|
(guint32)g_ascii_strtoull(token, NULL, 10));
|
2014-08-06 08:29:10 +00:00
|
|
|
return offset + (int)strlen(token);
|
2014-05-14 07:45:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int get_pid(const gchar *frame, const gchar *token, tvbuff_t *tvb,
|
|
|
|
proto_tree *maintree, gint start_offset, packet_info *pinfo _U_) {
|
|
|
|
return get_ptid(frame, token, tvb, maintree, hf_logcat_text_pid, start_offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int get_tid(const gchar *frame, const gchar *token, tvbuff_t *tvb,
|
|
|
|
proto_tree *maintree, gint start_offset, packet_info *pinfo _U_) {
|
|
|
|
return get_ptid(frame, token, tvb, maintree, hf_logcat_text_tid, start_offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int get_log(const gchar *frame, const gchar *token, tvbuff_t *tvb,
|
|
|
|
proto_tree *maintree, gint start_offset, packet_info *pinfo) {
|
|
|
|
gchar *p = g_strstr_len(frame + start_offset, -1, token);
|
2014-08-06 08:29:10 +00:00
|
|
|
int offset = (int)(p - frame);
|
2014-05-14 07:45:23 +00:00
|
|
|
|
|
|
|
proto_tree_add_string(maintree, hf_logcat_text_log, tvb, offset,
|
2014-08-06 08:29:10 +00:00
|
|
|
(int)strlen(token), token);
|
2014-05-14 07:45:23 +00:00
|
|
|
col_add_str(pinfo->cinfo, COL_INFO, token);
|
2014-08-06 08:29:10 +00:00
|
|
|
return offset + (int)strlen(token);
|
2014-05-14 07:45:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int get_time(const gchar *frame, const gchar *token, tvbuff_t *tvb,
|
|
|
|
proto_tree *maintree, gint start_offset, packet_info *pinfo) {
|
|
|
|
gint offset;
|
|
|
|
gchar *p;
|
2014-08-07 22:02:16 +00:00
|
|
|
gint ms;
|
|
|
|
struct tm date;
|
|
|
|
time_t seconds;
|
2014-05-14 07:45:23 +00:00
|
|
|
nstime_t ts;
|
|
|
|
|
|
|
|
p = g_strstr_len(frame + start_offset, -1, token);
|
2014-08-06 08:29:10 +00:00
|
|
|
offset = (int)(p - frame);
|
2014-05-14 07:45:23 +00:00
|
|
|
|
2014-08-07 22:02:16 +00:00
|
|
|
if (6 == sscanf(token, "%d-%d %d:%d:%d.%d", &date.tm_mon, &date.tm_mday,
|
|
|
|
&date.tm_hour, &date.tm_min, &date.tm_sec, &ms)) {
|
|
|
|
date.tm_year = 70;
|
|
|
|
date.tm_mon -= 1;
|
2018-05-09 03:43:22 +00:00
|
|
|
date.tm_isdst = -1;
|
2014-08-07 22:02:16 +00:00
|
|
|
seconds = mktime(&date);
|
|
|
|
ts.secs = seconds;
|
2014-08-06 08:29:10 +00:00
|
|
|
ts.nsecs = (int) (ms * 1e6);
|
2014-05-14 07:45:23 +00:00
|
|
|
proto_tree_add_time(maintree, hf_logcat_text_timestamp, tvb, offset,
|
2014-08-06 08:29:10 +00:00
|
|
|
(int)strlen(token), &ts);
|
2014-05-14 07:45:23 +00:00
|
|
|
} else {
|
|
|
|
proto_tree_add_expert(maintree, pinfo, &ei_malformed_time, tvb, offset, -1);
|
|
|
|
}
|
2014-08-06 08:29:10 +00:00
|
|
|
return offset + (int)strlen(token);
|
2014-05-14 07:45:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int dissect_logcat_text(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
|
|
|
|
const dissect_info_t *dinfo) {
|
|
|
|
gchar **tokens;
|
|
|
|
guint i;
|
|
|
|
gchar *frame = tvb_get_string_enc(wmem_packet_scope(), tvb, 0, tvb_captured_length(tvb),
|
2016-05-29 09:10:24 +00:00
|
|
|
ENC_UTF_8);
|
2014-05-14 07:45:23 +00:00
|
|
|
proto_item *mainitem = proto_tree_add_item(tree, proto_logcat_text, tvb, 0, -1, ENC_NA);
|
|
|
|
proto_tree *maintree = proto_item_add_subtree(mainitem, ett_logcat);
|
|
|
|
gint offset = 0;
|
|
|
|
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, dissector_name);
|
|
|
|
|
|
|
|
if (!g_regex_match(special_regex, frame, G_REGEX_MATCH_NOTEMPTY, NULL)) {
|
|
|
|
|
2014-07-23 10:26:05 +00:00
|
|
|
tokens = g_regex_split(*dinfo->regex, frame, G_REGEX_MATCH_NOTEMPTY);
|
2014-05-14 07:45:23 +00:00
|
|
|
if (NULL == tokens) return 0;
|
|
|
|
if (g_strv_length(tokens) != dinfo->no_of_getters + 2) {
|
|
|
|
proto_tree_add_expert(maintree, pinfo, &ei_malformed_token, tvb, offset, -1);
|
|
|
|
g_strfreev(tokens);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < dinfo->no_of_getters; ++i) {
|
|
|
|
offset = ((*dinfo->getters[i])(frame, tokens[i + 1], tvb, maintree, offset, pinfo));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
tokens = g_regex_split(special_regex, frame, G_REGEX_MATCH_NOTEMPTY);
|
|
|
|
if (NULL == tokens) return 0;
|
2014-08-08 07:06:38 +00:00
|
|
|
offset = get_log(frame, tokens[1], tvb, maintree, 0, pinfo);
|
2014-05-14 07:45:23 +00:00
|
|
|
}
|
|
|
|
g_strfreev(tokens);
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
2015-06-16 13:50:25 +00:00
|
|
|
static void add_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, const char * subdissector_name){
|
|
|
|
if (have_tap_listener(exported_pdu_tap)) {
|
|
|
|
exp_pdu_data_t *exp_pdu_data;
|
|
|
|
|
2016-06-24 03:10:08 +00:00
|
|
|
exp_pdu_data = export_pdu_create_tags(pinfo, subdissector_name, EXP_PDU_TAG_PROTO_NAME, NULL);
|
|
|
|
|
2015-06-16 13:50:25 +00:00
|
|
|
exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
|
|
|
|
exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);
|
|
|
|
exp_pdu_data->pdu_tvb = tvb;
|
|
|
|
tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-14 07:45:23 +00:00
|
|
|
static int dissect_logcat_text_brief(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|
|
|
void *data _U_) {
|
|
|
|
static const tGETTER getters[] = { get_priority, get_tag, get_pid, get_log };
|
2014-07-23 10:26:05 +00:00
|
|
|
dissect_info_t dinfo = { &brief_regex, getters, array_length(getters) };
|
2014-05-14 07:45:23 +00:00
|
|
|
|
2015-06-16 13:50:25 +00:00
|
|
|
add_exported_pdu(tvb,pinfo,"logcat_text_brief");
|
2014-05-14 07:45:23 +00:00
|
|
|
return dissect_logcat_text(tvb, tree, pinfo, &dinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int dissect_logcat_text_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|
|
|
void *data _U_) {
|
|
|
|
static const tGETTER getters[] = { get_priority, get_tag, get_log };
|
2014-07-23 10:26:05 +00:00
|
|
|
dissect_info_t dinfo = { &tag_regex, getters, array_length(getters) };
|
2014-05-14 07:45:23 +00:00
|
|
|
|
2015-06-16 13:50:25 +00:00
|
|
|
add_exported_pdu(tvb,pinfo,"logcat_text_tag");
|
2014-05-14 07:45:23 +00:00
|
|
|
return dissect_logcat_text(tvb, tree, pinfo, &dinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int dissect_logcat_text_process(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|
|
|
void *data _U_) {
|
|
|
|
static const tGETTER getters[] = { get_priority, get_pid, get_log };
|
2014-07-23 10:26:05 +00:00
|
|
|
dissect_info_t dinfo = { &process_regex, getters, array_length(getters) };
|
2014-05-14 07:45:23 +00:00
|
|
|
|
2015-06-16 13:50:25 +00:00
|
|
|
add_exported_pdu(tvb,pinfo,"logcat_text_process");
|
2018-01-11 09:31:08 +00:00
|
|
|
set_address(&pinfo->dst, AT_STRINGZ, 1, "");
|
|
|
|
set_address(&pinfo->src, AT_STRINGZ, 1, "");
|
2014-05-14 07:45:23 +00:00
|
|
|
|
|
|
|
return dissect_logcat_text(tvb, tree, pinfo, &dinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int dissect_logcat_text_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|
|
|
void *data _U_) {
|
|
|
|
static const tGETTER getters[] = { get_time, get_priority, get_tag, get_pid, get_log };
|
2014-07-23 10:26:05 +00:00
|
|
|
dissect_info_t dinfo = { &time_regex, getters, array_length(getters) };
|
2014-05-14 07:45:23 +00:00
|
|
|
|
2015-06-16 13:50:25 +00:00
|
|
|
add_exported_pdu(tvb,pinfo,"logcat_text_time");
|
2014-05-14 07:45:23 +00:00
|
|
|
return dissect_logcat_text(tvb, tree, pinfo, &dinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int dissect_logcat_text_thread(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|
|
|
void *data _U_) {
|
|
|
|
static const tGETTER getters[] = { get_priority, get_pid, get_tid, get_log };
|
2014-07-23 10:26:05 +00:00
|
|
|
dissect_info_t dinfo = { &thread_regex, getters, array_length(getters) };
|
2014-05-14 07:45:23 +00:00
|
|
|
|
2015-06-16 13:50:25 +00:00
|
|
|
add_exported_pdu(tvb,pinfo,"logcat_text_brief");
|
2018-01-11 09:37:19 +00:00
|
|
|
set_address(&pinfo->dst, AT_STRINGZ, 1, "");
|
|
|
|
set_address(&pinfo->src, AT_STRINGZ, 1, "");
|
2014-05-14 07:45:23 +00:00
|
|
|
|
|
|
|
return dissect_logcat_text(tvb, tree, pinfo, &dinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int dissect_logcat_text_threadtime(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|
|
|
void *data _U_) {
|
|
|
|
static const tGETTER getters[] = { get_time, get_pid, get_tid, get_priority, get_tag, get_log };
|
2014-07-23 10:26:05 +00:00
|
|
|
dissect_info_t dinfo = { &threadtime_regex, getters, array_length(getters) };
|
2014-05-14 07:45:23 +00:00
|
|
|
|
2015-06-16 13:50:25 +00:00
|
|
|
add_exported_pdu(tvb,pinfo,"logcat_text_threadtime");
|
2014-05-14 07:45:23 +00:00
|
|
|
return dissect_logcat_text(tvb, tree, pinfo, &dinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int dissect_logcat_text_long(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|
|
|
void *data _U_) {
|
|
|
|
static const tGETTER getters[] = { get_time, get_pid, get_tid, get_priority, get_tag, get_log };
|
2014-07-23 10:26:05 +00:00
|
|
|
dissect_info_t dinfo = { &long_regex, getters, array_length(getters) };
|
2014-05-14 07:45:23 +00:00
|
|
|
|
2015-06-16 13:50:25 +00:00
|
|
|
add_exported_pdu(tvb,pinfo,"logcat_text_long");
|
2014-05-14 07:45:23 +00:00
|
|
|
return dissect_logcat_text(tvb, tree, pinfo, &dinfo);
|
|
|
|
}
|
|
|
|
|
2016-08-18 11:17:21 +00:00
|
|
|
static void logcat_text_init(void)
|
2016-08-04 12:55:59 +00:00
|
|
|
{
|
2017-01-29 18:03:51 +00:00
|
|
|
special_regex = g_regex_new(SPECIAL_STRING, (GRegexCompileFlags)(G_REGEX_ANCHORED | G_REGEX_OPTIMIZE), G_REGEX_MATCH_NOTEMPTY, NULL);
|
|
|
|
brief_regex = g_regex_new(BRIEF_STRING, (GRegexCompileFlags)(G_REGEX_ANCHORED | G_REGEX_OPTIMIZE), G_REGEX_MATCH_NOTEMPTY, NULL);
|
|
|
|
tag_regex = g_regex_new(TAG_STRING, (GRegexCompileFlags)(G_REGEX_ANCHORED | G_REGEX_OPTIMIZE), G_REGEX_MATCH_NOTEMPTY, NULL);
|
|
|
|
time_regex = g_regex_new(TIME_STRING, (GRegexCompileFlags)(G_REGEX_ANCHORED | G_REGEX_OPTIMIZE), G_REGEX_MATCH_NOTEMPTY, NULL);
|
|
|
|
thread_regex = g_regex_new(THREAD_STRING, (GRegexCompileFlags)(G_REGEX_ANCHORED | G_REGEX_OPTIMIZE), G_REGEX_MATCH_NOTEMPTY, NULL);
|
|
|
|
threadtime_regex = g_regex_new(THREADTIME_STRING, (GRegexCompileFlags)(G_REGEX_ANCHORED | G_REGEX_OPTIMIZE), G_REGEX_MATCH_NOTEMPTY, NULL);
|
|
|
|
process_regex = g_regex_new(PROCESS_STRING, (GRegexCompileFlags)(G_REGEX_ANCHORED | G_REGEX_OPTIMIZE), G_REGEX_MATCH_NOTEMPTY, NULL);
|
|
|
|
long_regex = g_regex_new(LONG_STRING, (GRegexCompileFlags)(G_REGEX_MULTILINE | G_REGEX_OPTIMIZE), G_REGEX_MATCH_NOTEMPTY, NULL);
|
2016-08-04 12:55:59 +00:00
|
|
|
}
|
|
|
|
|
2016-08-18 11:17:21 +00:00
|
|
|
static void logcat_text_cleanup(void)
|
2016-08-04 12:55:59 +00:00
|
|
|
{
|
|
|
|
g_regex_unref(special_regex);
|
|
|
|
g_regex_unref(brief_regex);
|
|
|
|
g_regex_unref(tag_regex);
|
|
|
|
g_regex_unref(time_regex);
|
|
|
|
g_regex_unref(thread_regex);
|
|
|
|
g_regex_unref(threadtime_regex);
|
|
|
|
g_regex_unref(process_regex);
|
|
|
|
g_regex_unref(long_regex);
|
|
|
|
}
|
|
|
|
|
2014-05-14 07:45:23 +00:00
|
|
|
void proto_register_logcat_text(void) {
|
|
|
|
expert_module_t *expert_module;
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_logcat_text_timestamp,
|
|
|
|
{ "Timestamp", "logcat_text.timestamp",
|
|
|
|
FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x00, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_logcat_text_tag,
|
|
|
|
{ "Tag", "logcat_text.tag",
|
2016-05-29 09:10:24 +00:00
|
|
|
FT_STRING, STR_UNICODE, NULL, 0x00, NULL, HFILL
|
2014-05-14 07:45:23 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_logcat_text_log,
|
|
|
|
{ "Log", "logcat_text.log",
|
2016-05-29 09:10:24 +00:00
|
|
|
FT_STRING, STR_UNICODE, NULL, 0x00, NULL, HFILL
|
2014-05-14 07:45:23 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_logcat_text_priority,
|
|
|
|
{ "Priority", "logcat_text.priority",
|
|
|
|
FT_UINT8, BASE_DEC, VALS(priority_vals), 0x00, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_logcat_text_pid,
|
|
|
|
{ "PID", "logcat_text.pid",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x00, "Process ID", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_logcat_text_tid,
|
|
|
|
{ "TID", "logcat_text.tid",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x00, "Thread ID", HFILL
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static ei_register_info ei[] = {
|
|
|
|
{ &ei_malformed_time, { "logcat_text.malformed_time", PI_PROTOCOL, PI_ERROR, "Malformed time data", EXPFILL }},
|
|
|
|
{ &ei_malformed_token, { "logcat_text.malformed_token", PI_PROTOCOL, PI_ERROR, "Failed to decode one or more tokens", EXPFILL }},
|
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] = { &ett_logcat};
|
|
|
|
|
|
|
|
proto_logcat_text = proto_register_protocol("Android Logcat Text", dissector_name,
|
|
|
|
"logcat_text");
|
|
|
|
proto_register_field_array(proto_logcat_text, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
2015-12-09 04:04:01 +00:00
|
|
|
logcat_text_brief_handle = register_dissector("logcat_text_brief",
|
2014-05-14 07:45:23 +00:00
|
|
|
dissect_logcat_text_brief, proto_logcat_text);
|
2015-12-09 04:04:01 +00:00
|
|
|
logcat_text_tag_handle = register_dissector("logcat_text_tag",
|
2014-05-14 07:45:23 +00:00
|
|
|
dissect_logcat_text_tag, proto_logcat_text);
|
2015-12-09 04:04:01 +00:00
|
|
|
logcat_text_time_handle = register_dissector("logcat_text_time",
|
2014-05-14 07:45:23 +00:00
|
|
|
dissect_logcat_text_time, proto_logcat_text);
|
2015-12-09 04:04:01 +00:00
|
|
|
logcat_text_process_handle = register_dissector("logcat_text_process",
|
2014-05-14 07:45:23 +00:00
|
|
|
dissect_logcat_text_process, proto_logcat_text);
|
2015-12-09 04:04:01 +00:00
|
|
|
logcat_text_thread_handle = register_dissector("logcat_text_thread",
|
2014-05-14 07:45:23 +00:00
|
|
|
dissect_logcat_text_thread, proto_logcat_text);
|
2015-12-09 04:04:01 +00:00
|
|
|
logcat_text_threadtime_handle = register_dissector("logcat_text_threadtime",
|
2014-05-14 07:45:23 +00:00
|
|
|
dissect_logcat_text_threadtime, proto_logcat_text);
|
2015-12-09 04:04:01 +00:00
|
|
|
logcat_text_long_handle = register_dissector("logcat_text_long",
|
2014-05-14 07:45:23 +00:00
|
|
|
dissect_logcat_text_long, proto_logcat_text);
|
|
|
|
|
2016-08-04 12:55:59 +00:00
|
|
|
register_init_routine(logcat_text_init);
|
|
|
|
register_cleanup_routine(logcat_text_cleanup);
|
2014-05-14 07:45:23 +00:00
|
|
|
|
|
|
|
expert_module = expert_register_protocol(proto_logcat_text);
|
|
|
|
expert_register_field_array(expert_module, ei, array_length(ei));
|
2015-06-16 13:50:25 +00:00
|
|
|
|
|
|
|
exported_pdu_tap = register_export_pdu_tap("Logcat Text");
|
2014-05-14 07:45:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void proto_reg_handoff_logcat_text(void) {
|
|
|
|
dissector_add_uint("wtap_encap", WTAP_ENCAP_LOGCAT_BRIEF,
|
|
|
|
logcat_text_brief_handle);
|
|
|
|
dissector_add_uint("wtap_encap", WTAP_ENCAP_LOGCAT_TAG,
|
|
|
|
logcat_text_tag_handle);
|
|
|
|
dissector_add_uint("wtap_encap", WTAP_ENCAP_LOGCAT_TIME,
|
|
|
|
logcat_text_time_handle);
|
|
|
|
dissector_add_uint("wtap_encap", WTAP_ENCAP_LOGCAT_THREAD,
|
|
|
|
logcat_text_thread_handle);
|
|
|
|
dissector_add_uint("wtap_encap", WTAP_ENCAP_LOGCAT_THREADTIME,
|
|
|
|
logcat_text_threadtime_handle);
|
|
|
|
dissector_add_uint("wtap_encap", WTAP_ENCAP_LOGCAT_PROCESS,
|
|
|
|
logcat_text_process_handle);
|
|
|
|
dissector_add_uint("wtap_encap", WTAP_ENCAP_LOGCAT_LONG,
|
|
|
|
logcat_text_long_handle);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|