Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
socketcan.h
Go to the documentation of this file.
1
12#ifndef SOCKETCAN_H__
13#define SOCKETCAN_H__
14
15#include <wiretap/wtap_module.h>
16
17#define CAN_MAX_DLEN 8
18#define CANFD_MAX_DLEN 64
19
20typedef enum {
21 MSG_TYPE_STD,
22 MSG_TYPE_EXT,
23 MSG_TYPE_STD_RTR,
24 MSG_TYPE_EXT_RTR,
25 MSG_TYPE_STD_FD,
26 MSG_TYPE_EXT_FD,
27 MSG_TYPE_ERR,
28} wtap_can_msg_type_t;
29
30typedef struct {
31 uint8_t length;
32 uint8_t data[CANFD_MAX_DLEN];
34
35typedef struct {
36 nstime_t ts;
37 uint32_t id;
38 wtap_can_msg_type_t type;
39 uint8_t flags;
41 unsigned int interface_id;
43
44#define WTAP_SOCKETCAN_INVALID_INTERFACE_ID 0xFFFFFFFF
45
46/* Setup a wiretap to use SOCKETCAN encapsulation format */
47extern void
48wtap_set_as_socketcan(wtap* wth, int file_type_subtype, int tsprec, void* tap_priv, void (*tap_close)(void*));
49
50/* Helper function to generate a SOCKETCAN packet from provided CAN data */
51extern bool
52wtap_socketcan_gen_packet(wtap* wth, wtap_rec* rec, const wtap_can_msg_t* msg, char* module_name, int* err, char** err_info);
53
54/* Find or create a PCAPNG interface block
55 * Return value is the interface ID used for the packet
56 */
57extern uint32_t
58wtap_socketcan_find_or_create_new_interface(wtap* wth, const char* name);
59
60/* Access to a wiretap's individual private data */
61extern void*
62wtap_socketcan_get_private_data(wtap* wth);
63
64#endif /* SOCKETCAN_H__ */
Definition nstime.h:26
Definition socketcan.h:30
Definition socketcan.h:35
Definition wtap.h:1507
Definition wtap_module.h:58