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 */
47
57extern void
58wtap_set_as_socketcan(wtap* wth, int file_type_subtype, int tsprec, void* tap_priv, void (*tap_close)(void*));
59
60/* Helper function to generate a SOCKETCAN packet from provided CAN data */
72extern bool
73wtap_socketcan_gen_packet(wtap* wth, wtap_rec* rec, const wtap_can_msg_t* msg, char* module_name, int* err, char** err_info);
74
81extern uint32_t
83
84/* Access to a wiretap's individual private data */
85
92extern void*
94
95#endif /* SOCKETCAN_H__ */
void * wtap_socketcan_get_private_data(wtap *wth)
Retrieves private data associated with a socketCAN capture.
Definition socketcan.c:85
void wtap_set_as_socketcan(wtap *wth, int file_type_subtype, int tsprec, void *tap_priv, void(*tap_close)(void *))
Set up a wiretap session for SOCKETCAN capture.
Definition socketcan.c:92
uint32_t wtap_socketcan_find_or_create_new_interface(wtap *wth, const char *name)
Find or create a PCAPNG interface block.
Definition socketcan.c:214
bool wtap_socketcan_gen_packet(wtap *wth, wtap_rec *rec, const wtap_can_msg_t *msg, char *module_name, int *err, char **err_info)
Generate a packet for SocketCAN.
Definition socketcan.c:109
Definition nstime.h:26
Definition socketcan.h:30
Definition socketcan.h:35
Definition wtap.h:1512
Definition wtap_module.h:58