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