aboutsummaryrefslogtreecommitdiff
path: root/pcap/can_socketcan.h
diff options
context:
space:
mode:
Diffstat (limited to 'pcap/can_socketcan.h')
-rw-r--r--pcap/can_socketcan.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/pcap/can_socketcan.h b/pcap/can_socketcan.h
index 0cb3584a8497..662bfe22cc93 100644
--- a/pcap/can_socketcan.h
+++ b/pcap/can_socketcan.h
@@ -42,8 +42,8 @@
#include <pcap/pcap-inttypes.h>
/*
- * SocketCAN header, as per Documentation/networking/can.txt in the
- * Linux source.
+ * SocketCAN header for CAN and CAN FD frames, as per
+ * Documentation/networking/can.rst in the Linux source.
*/
typedef struct {
uint32_t can_id;
@@ -58,4 +58,25 @@ typedef struct {
#define CANFD_ESI 0x02 /* error state indicator of the transmitting node */
#define CANFD_FDF 0x04 /* mark CAN FD for dual use of CAN format */
+/*
+ * SocketCAN header for CAN XL frames, as per Linux's can.h header.
+ * This is different from pcap_can_socketcan_hdr; the flags field
+ * overlaps with the payload_length field in pcap_can_socketcan_hdr -
+ * the payload_length field in a CAN or CAN FD frame never has the
+ * 0x80 bit set, and the flags field in a CAN XL frame always has
+ * it set, allowing code reading the frame to determine whether
+ * it's CAN XL or not.
+ */
+typedef struct {
+ uint32_t priority_vcid;
+ uint8_t flags;
+ uint8_t sdu_type;
+ uint16_t payload_length;
+ uint32_t acceptance_field;
+} pcap_can_socketcan_xl_hdr;
+
+/* Bits in the flags field */
+#define CANXL_SEC 0x01 /* Simple Extended Context */
+#define CANXL_XLF 0x80 /* mark to distinguish CAN XL from CAN/CAN FD frames */
+
#endif