Wireshark  4.3.0
The Wireshark network protocol analyzer
busmaster_priv.h
Go to the documentation of this file.
1 
12 #ifndef BUSMASTER_PRIV_H__
13 #define BUSMASTER_PRIV_H__
14 
15 #include <gmodule.h>
16 #include <wiretap/wtap.h>
17 #include <wiretap/socketcan.h>
18 
19 //#define BUSMASTER_DEBUG
20 //#define BUSMASTER_PARSER_TRACE
21 
22 typedef enum {
23  LOG_ENTRY_ERROR = -1,
24  LOG_ENTRY_NONE = 0,
25  LOG_ENTRY_EMPTY,
26  LOG_ENTRY_HEADER,
27  LOG_ENTRY_FOOTER,
28  LOG_ENTRY_FOOTER_AND_HEADER,
29  LOG_ENTRY_MSG,
30  LOG_ENTRY_EOF,
31 } log_entry_type_t;
32 
33 typedef enum {
34  PROTOCOL_UNKNOWN = 0,
35  PROTOCOL_CAN,
36  PROTOCOL_LIN,
37  PROTOCOL_J1939,
38 } protocol_type_t;
39 
40 typedef enum {
41  DATA_MODE_UNKNOWN = 0,
42  DATA_MODE_HEX,
43  DATA_MODE_DEC,
44 } data_mode_t;
45 
46 typedef enum {
47  TIME_MODE_UNKNOWN = 0,
48  TIME_MODE_ABSOLUTE,
49  TIME_MODE_SYSTEM,
50  TIME_MODE_RELATIVE,
51 } time_mode_t;
52 
53 typedef enum {
54  MSG_TYPE_STD,
55  MSG_TYPE_EXT,
56  MSG_TYPE_STD_RTR,
57  MSG_TYPE_EXT_RTR,
58  MSG_TYPE_STD_FD,
59  MSG_TYPE_EXT_FD,
60  MSG_TYPE_ERR,
61 } msg_type_t;
62 
63 typedef struct {
64  unsigned year;
65  unsigned month;
66  unsigned day;
67 } msg_date_t;
68 
69 typedef struct {
70  unsigned hours;
71  unsigned minutes;
72  unsigned seconds;
73  unsigned micros;
74 } msg_time_t;
75 
76 typedef struct {
77  msg_date_t date;
78  msg_time_t time;
80 
81 typedef struct {
82  unsigned length;
83  uint8_t data[CANFD_MAX_DLEN];
84 } msg_data_t;
85 
86 typedef struct {
87  msg_time_t timestamp;
88  msg_type_t type;
89  uint32_t id;
90  msg_data_t data;
91 } msg_t;
92 
93 typedef struct {
94  int64_t v0;
95  int64_t v1;
96  int64_t v2;
97  int64_t v3;
98 } token_t;
99 
100 typedef struct {
101  int64_t file_start_offset;
102  int64_t file_end_offset;
103  protocol_type_t protocol;
104  data_mode_t data_mode;
105  time_mode_t time_mode;
106  msg_date_t start_date;
107  msg_time_t start_time;
109 
110 typedef struct {
111  FILE_T fh;
112  int64_t file_bytes_read;
113 
114  char *parse_error;
115  int err;
116  char *err_info;
117 
118  token_t token;
119 
120  log_entry_type_t entry_type;
121  busmaster_priv_t header;
122  msg_t msg;
124 
125 bool
126 run_busmaster_parser(busmaster_state_t *state,
127  int *err, char **err_info);
128 
129 #ifdef BUSMASTER_DEBUG
130 #include <stdio.h>
131 #define busmaster_debug_printf(...) printf(__VA_ARGS__)
132 #else
133 #define busmaster_debug_printf(...) (void)0
134 #endif
135 
136 #endif /* BUSMASTER_PRIV_H__ */
Definition: busmaster_priv.h:100
Definition: busmaster_priv.h:110
Definition: busmaster_priv.h:81
Definition: busmaster_priv.h:63
Definition: busmaster_priv.h:76
Definition: busmaster_priv.h:86
Definition: busmaster_priv.h:69
Definition: busmaster_priv.h:93
Definition: file_wrappers.c:177