alias of NativeCANSocket

class scapy.contrib.cansocket_native.NativeCANSocket(channel: str | None = None, receive_own_messages: bool = False, can_filters: ~typing.List[~typing.Dict[str, int]] | None = None, fd: bool = False, basecls: ~typing.Type[~scapy.packet.Packet] = <class 'scapy.layers.can.CAN'>, **kwargs: ~typing.Dict[str, ~typing.Any])[source]

Bases: SuperSocket

Initializes a Linux PF_CAN socket object.


>>> socket = NativeCANSocket(channel="vcan0", can_filters=[{'can_id': 0x200, 'can_mask': 0x7FF}])
  • channel – Network interface name

  • receive_own_messages – Messages, sent by this socket are will also be received.

  • can_filters – A list of can filter dictionaries.

  • basecls – Packet type in which received data gets interpreted.

  • kwargs – Various keyword arguments for compatibility with PythonCANSockets

desc = 'read/write packets at a given CAN interface using PF_CAN sockets'
recv_raw(x: int = 16) Tuple[Type[Packet] | None, bytes | None, float | None][source]

Returns a tuple containing (cls, pkt_data, time)

send(x: Packet) int[source]