Wireshark 4.7.3
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
socketcan.c File Reference
#include "config.h"
#include "socketcan.h"
#include <epan/dissectors/packet-socketcan.h>

Classes

struct  can_frame
struct  canfd_frame
struct  can_priv_data

Typedefs

typedef struct can_frame can_frame_t
typedef struct canfd_frame canfd_frame_t
typedef struct can_priv_data can_priv_data_t

Functions

void * wtap_socketcan_get_private_data (wtap *wth)
 Retrieves private data associated with a socketCAN capture.
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.

Detailed Description

Common functionality for all wiretaps handling SocketCAN encapsulation

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

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

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 *) )

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 )

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 )

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)

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.