Wireshark 4.7.3
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
socketcan.h File Reference

Go to the source code of this file.

Classes

struct  wtap_can_msg_data_t
 Holds the raw payload of a CAN or CAN FD message. More...
struct  wtap_can_msg_t
 Represents a single captured CAN or CAN FD message with full metadata. More...

Macros

#define CAN_MAX_DLEN   8
#define CANFD_MAX_DLEN   64
#define WTAP_SOCKETCAN_INVALID_INTERFACE_ID   0xFFFFFFFF

Enumerations

enum  wtap_can_msg_type_t {
  MSG_TYPE_STD , MSG_TYPE_EXT , MSG_TYPE_STD_RTR , MSG_TYPE_EXT_RTR ,
  MSG_TYPE_STD_FD , MSG_TYPE_EXT_FD , MSG_TYPE_ERR
}
 Identifies the frame type and addressing mode of a CAN or CAN FD message. More...

Functions

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.
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.
uint32_t wtap_socketcan_find_or_create_new_interface (wtap *wth, const char *name)
 Find or create a PCAPNG interface block.
void * wtap_socketcan_get_private_data (wtap *wth)
 Retrieves private data associated with a socketCAN capture.

Detailed Description

Wiretap Library Copyright (c) 1998 by Gilbert Ramirez gram@.nosp@m.alum.nosp@m.ni.ri.nosp@m.ce.e.nosp@m.du

Support for Busmaster log file format Copyright (c) 2019 by Maksim Salau maksi.nosp@m.m.sa.nosp@m.lau@g.nosp@m.mail.nosp@m..com

SPDX-License-Identifier: GPL-2.0-or-later

Enumeration Type Documentation

◆ wtap_can_msg_type_t

Identifies the frame type and addressing mode of a CAN or CAN FD message.

Enumerator
MSG_TYPE_STD 

Standard (11-bit ID) CAN data frame

MSG_TYPE_EXT 

Extended (29-bit ID) CAN data frame

MSG_TYPE_STD_RTR 

Standard (11-bit ID) CAN Remote Transmission Request (RTR) frame

MSG_TYPE_EXT_RTR 

Extended (29-bit ID) CAN Remote Transmission Request (RTR) frame

MSG_TYPE_STD_FD 

Standard (11-bit ID) CAN FD data frame

MSG_TYPE_EXT_FD 

Extended (29-bit ID) CAN FD data frame

MSG_TYPE_ERR 

CAN error frame

Function Documentation

◆ wtap_set_as_socketcan()

void wtap_set_as_socketcan ( wtap * wth,
int file_type_subtype,
int tsprec,
void * tap_priv,
void(* tap_close )(void *) )
extern

Set up a wiretap session for SOCKETCAN capture.

Parameters
wthPointer to the wiretap handle.
file_type_subtypeSubtype of the file type.
tsprecPrecision of the timestamp.
tap_privPrivate data for the tap.
tap_closeFunction to close the tap.

◆ wtap_socketcan_find_or_create_new_interface()

uint32_t wtap_socketcan_find_or_create_new_interface ( wtap * wth,
const char * name )
extern

Find or create a PCAPNG interface block.

Parameters
wthPointer to the wtap structure.
nameName of the interface.
Returns
uint32_t The interface ID used for the packet.

◆ wtap_socketcan_gen_packet()

bool wtap_socketcan_gen_packet ( wtap * wth,
wtap_rec * rec,
const wtap_can_msg_t * msg,
char * module_name,
int * err,
char ** err_info )
extern

Generate a packet for SocketCAN.

Parameters
wthPointer to the wtap structure.
recPointer to the wtap_rec structure.
msgPointer to the wtap_can_msg_t structure containing the CAN message.
module_nameName of the module generating the packet.
errPointer to an integer for error reporting.
err_infoPointer to a string for additional error information.
Returns
void

◆ wtap_socketcan_get_private_data()

void * wtap_socketcan_get_private_data ( wtap * wth)
extern

Retrieves private data associated with a socketCAN capture.

Parameters
wthPointer to the wtap structure containing the capture information.
Returns
void* Pointer to the private data set for the socketCAN capture, or NULL if not set.