diff options
author | MichaĆ Orynicz <michal.orynicz@tieto.com> | 2014-05-14 09:45:23 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-08-06 06:46:50 +0000 |
commit | 1a02ca0150e434d9ddc7c023267c9097a059b6be (patch) | |
tree | 4d7f3812bc71e659ff792355d12028137e06232a /wiretap/logcat.h | |
parent | 71d07bcbbf08eac22432203c2c464fdce13b9467 (diff) | |
download | wireshark-1a02ca0150e434d9ddc7c023267c9097a059b6be.tar.gz |
Add support for android logcat text files
Wireshark already supports reading and writing logcat
logs saved in binary files. Binary format, although
better, is used less often than saving those logs to
text files.
This patch extends wireshark's support for android logcat
logs to reading and writing logcat logs in text files.
Features:
* support for tag, brief, process, thread, time, threadtime
and long formats
* saving in original format
* it's generally awesome
Change-Id: I013d6ac2da876d9a2b39b740219eb398d03830f6
Reviewed-on: https://code.wireshark.org/review/1802
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'wiretap/logcat.h')
-rw-r--r-- | wiretap/logcat.h | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/wiretap/logcat.h b/wiretap/logcat.h index 4167bc21fb..9b2ea5cc25 100644 --- a/wiretap/logcat.h +++ b/wiretap/logcat.h @@ -25,19 +25,45 @@ #include "wtap.h" +/* The log format can be found on: + * https://android.googlesource.com/platform/system/core/+/master/include/log/logger.h + * Log format is assumed to be little-endian (Android platform). + */ +/* maximum size of a message payload in a log entry */ +#define LOGGER_ENTRY_MAX_PAYLOAD 4076 + +struct logger_entry { + guint16 len; /* length of the payload */ + guint16 __pad; /* no matter what, we get 2 bytes of padding */ + gint32 pid; /* generating process's pid */ + gint32 tid; /* generating process's tid */ + gint32 sec; /* seconds since Epoch */ + gint32 nsec; /* nanoseconds */ + char msg[0]; /* the entry's payload */ +}; + +struct logger_entry_v2 { + guint16 len; /* length of the payload */ + guint16 hdr_size; /* sizeof(struct logger_entry_v2) */ + gint32 pid; /* generating process's pid */ + gint32 tid; /* generating process's tid */ + gint32 sec; /* seconds since Epoch */ + gint32 nsec; /* nanoseconds */ + union { + /* v1: not present */ + guint32 euid; /* v2: effective UID of logger */ + guint32 lid; /* v3: log id of the payload */ + }; + char msg[0]; /* the entry's payload */ +}; + int logcat_open(wtap *wth, int *err, gchar **err_info); gboolean logcat_binary_dump_open(wtap_dumper *wdh, int *err); -gboolean logcat_text_brief_dump_open(wtap_dumper *wdh, int *err); -gboolean logcat_text_process_dump_open(wtap_dumper *wdh, int *err); -gboolean logcat_text_tag_dump_open(wtap_dumper *wdh, int *err); -gboolean logcat_text_time_dump_open(wtap_dumper *wdh, int *err); -gboolean logcat_text_thread_dump_open(wtap_dumper *wdh, int *err); -gboolean logcat_text_threadtime_dump_open(wtap_dumper *wdh, int *err); -gboolean logcat_text_long_dump_open(wtap_dumper *wdh, int *err); int logcat_dump_can_write_encap(int encap); +gint logcat_exported_pdu_length(const guint8 *pd); #endif /* |