9011ad1030
Only CAN protocol is supported. Extra information available in J1939 entries is ignored since the J1939 wireshark dissector works with raw CAN frames and makes no use of this extra information. The log format may also encapsulate LIN messages which are not supported by wireshark and thus are ignored. The only limitation is that relative timestamp format is not supported. If a file defines relative format of timestamps, packets are extracted, but timestamps are omitted, since random access deems impossible without reparsing the whole file up to the packet of interest. In order to support relative timestamps we need to parse the whole file at once on open and either dump into a temporary PCAP file or keep messages in a private list and provide access to them on read()/seek_read(). The change also creates a separate header for CAN frame structure definitions which are used by several file readers (candump and busmaster for now). Bug: 15939 Change-Id: I87c5555e4e5e1b142b9984b24544b2591d494fbc Reviewed-on: https://code.wireshark.org/review/34083 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
73 lines
1.3 KiB
C
73 lines
1.3 KiB
C
/* candump-priv.h
|
|
*
|
|
* Wiretap Library
|
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
|
|
*
|
|
* Support for candump log file format
|
|
* Copyright (c) 2019 by Maksim Salau <maksim.salau@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#ifndef CANDUMP_PRIV_H__
|
|
#define CANDUMP_PRIV_H__
|
|
|
|
#include <gmodule.h>
|
|
#include <wiretap/wtap.h>
|
|
#include <wiretap/socketcan.h>
|
|
#include <epan/dissectors/packet-socketcan.h>
|
|
|
|
//#define CANDUMP_DEBUG
|
|
|
|
typedef struct {
|
|
guint8 length;
|
|
guint8 data[CANFD_MAX_DLEN];
|
|
} msg_data_t;
|
|
|
|
typedef struct {
|
|
nstime_t ts;
|
|
guint32 id;
|
|
gboolean is_fd;
|
|
guint8 flags;
|
|
msg_data_t data;
|
|
} msg_t;
|
|
|
|
typedef struct {
|
|
gint64 v0;
|
|
gint64 v1;
|
|
} token_t;
|
|
|
|
typedef struct {
|
|
wtap *tmp_file;
|
|
char *tmp_filename;
|
|
} candump_priv_t;
|
|
|
|
typedef struct {
|
|
gboolean is_msg_valid;
|
|
msg_t msg;
|
|
|
|
FILE_T fh;
|
|
guint64 file_bytes_read;
|
|
|
|
int err;
|
|
gchar *err_info;
|
|
gchar *parse_error;
|
|
|
|
token_t token;
|
|
} candump_state_t;
|
|
|
|
gboolean
|
|
run_candump_parser(candump_state_t *state, int *err, gchar **err_info);
|
|
|
|
#include <wsutil/ws_printf.h>
|
|
|
|
/* Uncomment the following line to make decoder verbose */
|
|
//#undef NDEBUG
|
|
|
|
#ifdef NDEBUG
|
|
#undef ws_debug_printf
|
|
#define ws_debug_printf(...) (void)0
|
|
#endif
|
|
|
|
#endif /* CANDUMP_PRIV_H__ */
|