ysphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget)/translations/zh_CN/networking/iso15765-2modnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget)/translations/zh_TW/networking/iso15765-2modnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget)/translations/it_IT/networking/iso15765-2modnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget)/translations/ja_JP/networking/iso15765-2modnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget)/translations/ko_KR/networking/iso15765-2modnameN classnameN refexplicituh1hhh ubh)}(hhh]hPortuguese (Brazilian)}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget)/translations/pt_BR/networking/iso15765-2modnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget)/translations/sp_SP/networking/iso15765-2modnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h2SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)h]h2SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhC/var/lib/git/docbuild/linux/Documentation/networking/iso15765-2.rsthKubhsection)}(hhh](htitle)}(hISO 15765-2 (ISO-TP)h]hISO 15765-2 (ISO-TP)}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hOverviewh]hOverview}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hXISO 15765-2, also known as ISO-TP, is a transport protocol specifically defined for diagnostic communication on CAN. It is widely used in the automotive industry, for example as the transport protocol for UDSonCAN (ISO 14229-3) or emission-related diagnostic services (ISO 15031-5).h]hXISO 15765-2, also known as ISO-TP, is a transport protocol specifically defined for diagnostic communication on CAN. It is widely used in the automotive industry, for example as the transport protocol for UDSonCAN (ISO 14229-3) or emission-related diagnostic services (ISO 15031-5).}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hISO-TP can be used both on CAN CC (aka Classical CAN) and CAN FD (CAN with Flexible Datarate) based networks. It is also designed to be compatible with a CAN network using SAE J1939 as data link layer (however, this is not a requirement).h]hISO-TP can be used both on CAN CC (aka Classical CAN) and CAN FD (CAN with Flexible Datarate) based networks. It is also designed to be compatible with a CAN network using SAE J1939 as data link layer (however, this is not a requirement).}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(hSpecifications usedh]hSpecifications used}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh bullet_list)}(hhh]h list_item)}(hISO 15765-2:2024 : Road vehicles - Diagnostic communication over Controller Area Network (DoCAN). Part 2: Transport protocol and network layer services. h]h)}(hISO 15765-2:2024 : Road vehicles - Diagnostic communication over Controller Area Network (DoCAN). Part 2: Transport protocol and network layer services.h]hISO 15765-2:2024 : Road vehicles - Diagnostic communication over Controller Area Network (DoCAN). Part 2: Transport protocol and network layer services.}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj$ubah}(h]h ]h"]h$]h&]uh1j"hjhhhhhNubah}(h]h ]h"]h$]h&]bullet*uh1jhhhKhj hhubeh}(h]specifications-usedah ]h"]specifications usedah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Addressingh]h Addressing}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjLhhhhhKubh)}(hsIn its simplest form, ISO-TP is based on two kinds of addressing modes for the nodes connected to the same network:h]hsIn its simplest form, ISO-TP is based on two kinds of addressing modes for the nodes connected to the same network:}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjLhhubj)}(hhh](j#)}(hgphysical addressing is implemented by two node-specific addresses and is used in 1-to-1 communication. h]h)}(hfphysical addressing is implemented by two node-specific addresses and is used in 1-to-1 communication.h]hfphysical addressing is implemented by two node-specific addresses and is used in 1-to-1 communication.}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hjnubah}(h]h ]h"]h$]h&]uh1j"hjkhhhhhNubj#)}(hgfunctional addressing is implemented by one node-specific address and is used in 1-to-N communication. h]h)}(hffunctional addressing is implemented by one node-specific address and is used in 1-to-N communication.h]hffunctional addressing is implemented by one node-specific address and is used in 1-to-N communication.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK#hjubah}(h]h ]h"]h$]h&]uh1j"hjkhhhhhNubeh}(h]h ]h"]h$]h&]jBjCuh1jhhhK hjLhhubh)}(h3Three different addressing formats can be employed:h]h3Three different addressing formats can be employed:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK&hjLhhubj)}(hhh](j#)}(h;"normal" : each address is represented simply by a CAN ID. h]h)}(h:"normal" : each address is represented simply by a CAN ID.h]h>“normal” : each address is represented simply by a CAN ID.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK(hjubah}(h]h ]h"]h$]h&]uh1j"hjhhhhhNubj#)}(h"extended": each address is represented by a CAN ID plus the first byte of the CAN payload; both the CAN ID and the byte inside the payload shall be different between two addresses. h]h)}(h"extended": each address is represented by a CAN ID plus the first byte of the CAN payload; both the CAN ID and the byte inside the payload shall be different between two addresses.h]h“extended”: each address is represented by a CAN ID plus the first byte of the CAN payload; both the CAN ID and the byte inside the payload shall be different between two addresses.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK*hjubah}(h]h ]h"]h$]h&]uh1j"hjhhhhhNubj#)}(h"mixed": each address is represented by a CAN ID plus the first byte of the CAN payload; the CAN ID is different between two addresses, but the additional byte is the same. h]h)}(h"mixed": each address is represented by a CAN ID plus the first byte of the CAN payload; the CAN ID is different between two addresses, but the additional byte is the same.h]h“mixed”: each address is represented by a CAN ID plus the first byte of the CAN payload; the CAN ID is different between two addresses, but the additional byte is the same.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK.hjubah}(h]h ]h"]h$]h&]uh1j"hjhhhhhNubeh}(h]h ]h"]h$]h&]jBjCuh1jhhhK(hjLhhubeh}(h] addressingah ]h"] addressingah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h-Transport protocol and associated frame typesh]h-Transport protocol and associated frame types}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhK3ubh)}(hXWhen transmitting data using the ISO-TP protocol, the payload can either fit inside one single CAN message or not, also considering the overhead the protocol is generating and the optional extended addressing. In the first case, the data is transmitted at once using a so-called Single Frame (SF). In the second case, ISO-TP defines a multi-frame protocol, in which the sender provides (through a First Frame - FF) the PDU length which is to be transmitted and also asks for a Flow Control (FC) frame, which provides the maximum supported size of a macro data block (``blocksize``) and the minimum time between the single CAN messages composing such block (``stmin``). Once this information has been received, the sender starts to send frames containing fragments of the data payload (called Consecutive Frames - CF), stopping after every ``blocksize``-sized block to wait confirmation from the receiver which should then send another Flow Control frame to inform the sender about its availability to receive more data.h](hX7When transmitting data using the ISO-TP protocol, the payload can either fit inside one single CAN message or not, also considering the overhead the protocol is generating and the optional extended addressing. In the first case, the data is transmitted at once using a so-called Single Frame (SF). In the second case, ISO-TP defines a multi-frame protocol, in which the sender provides (through a First Frame - FF) the PDU length which is to be transmitted and also asks for a Flow Control (FC) frame, which provides the maximum supported size of a macro data block (}(hjhhhNhNubhliteral)}(h ``blocksize``h]h blocksize}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubhM) and the minimum time between the single CAN messages composing such block (}(hjhhhNhNubj%)}(h ``stmin``h]hstmin}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh). Once this information has been received, the sender starts to send frames containing fragments of the data payload (called Consecutive Frames - CF), stopping after every }(hjhhhNhNubj%)}(h ``blocksize``h]h blocksize}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh-sized block to wait confirmation from the receiver which should then send another Flow Control frame to inform the sender about its availability to receive more data.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK5hj hhubeh}(h]-transport-protocol-and-associated-frame-typesah ]h"]-transport protocol and associated frame typesah$]h&]uh1hhhhhhhhK3ubeh}(h]overviewah ]h"]overviewah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hHow to Use ISO-TPh]hHow to Use ISO-TP}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjrhhhhhKDubh)}(hAs with others CAN protocols, the ISO-TP stack support is built into the Linux network subsystem for the CAN bus, aka. Linux-CAN or SocketCAN, and thus follows the same socket API.h]hAs with others CAN protocols, the ISO-TP stack support is built into the Linux network subsystem for the CAN bus, aka. Linux-CAN or SocketCAN, and thus follows the same socket API.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKFhjrhhubh)}(hhh](h)}(h,Creation and basic usage of an ISO-TP socketh]h,Creation and basic usage of an ISO-TP socket}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKKubh)}(hTo use the ISO-TP stack, ``#include `` shall be used. A socket can then be created using the ``PF_CAN`` protocol family, the ``SOCK_DGRAM`` type (as the underlying protocol is datagram-based by design) and the ``CAN_ISOTP`` protocol:h](hTo use the ISO-TP stack, }(hjhhhNhNubj%)}(h ``#include ``h]h#include }(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh7 shall be used. A socket can then be created using the }(hjhhhNhNubj%)}(h ``PF_CAN``h]hPF_CAN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh protocol family, the }(hjhhhNhNubj%)}(h``SOCK_DGRAM``h]h SOCK_DGRAM}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubhG type (as the underlying protocol is datagram-based by design) and the }(hjhhhNhNubj%)}(h ``CAN_ISOTP``h]h CAN_ISOTP}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh protocol:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKMhjhhubh literal_block)}(h*s = socket(PF_CAN, SOCK_DGRAM, CAN_ISOTP);h]h*s = socket(PF_CAN, SOCK_DGRAM, CAN_ISOTP);}hjsbah}(h]h ]h"]h$]h&]hhƌforcelanguageChighlight_args}uh1jhhhKRhjhhubh)}(hAfter the socket has been successfully created, ``bind(2)`` shall be called to bind the socket to the desired CAN interface; to do so:h](h0After the socket has been successfully created, }(hj hhhNhNubj%)}(h ``bind(2)``h]hbind(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj ubhK shall be called to bind the socket to the desired CAN interface; to do so:}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKVhjhhubj)}(hhh](j#)}(hTa TX CAN ID shall be specified as part of the sockaddr supplied to the call itself. h]h)}(hSa TX CAN ID shall be specified as part of the sockaddr supplied to the call itself.h]hSa TX CAN ID shall be specified as part of the sockaddr supplied to the call itself.}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKYhj0ubah}(h]h ]h"]h$]h&]uh1j"hj-hhhhhNubj#)}(hsa RX CAN ID shall also be specified, unless broadcast flags have been set through socket option (explained below). h]h)}(hra RX CAN ID shall also be specified, unless broadcast flags have been set through socket option (explained below).h]hra RX CAN ID shall also be specified, unless broadcast flags have been set through socket option (explained below).}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK\hjHubah}(h]h ]h"]h$]h&]uh1j"hj-hhhhhNubeh}(h]h ]h"]h$]h&]jBjCuh1jhhhKYhjhhubh)}(hXOnce bound to an interface, the socket can be read from and written to using the usual ``read(2)`` and ``write(2)`` system calls, as well as ``send(2)``, ``sendmsg(2)``, ``recv(2)`` and ``recvmsg(2)``. Unlike the CAN_RAW socket API, only the ISO-TP data field (the actual payload) is sent and received by the userspace application using these calls. The address information and the protocol information are automatically filled by the ISO-TP stack using the configuration supplied during socket creation. In the same way, the stack will use the transport mechanism when required (i.e., when the size of the data payload exceeds the MTU of the underlying CAN bus).h](hWOnce bound to an interface, the socket can be read from and written to using the usual }(hjfhhhNhNubj%)}(h ``read(2)``h]hread(2)}(hjnhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjfubh and }(hjfhhhNhNubj%)}(h ``write(2)``h]hwrite(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjfubh system calls, as well as }(hjfhhhNhNubj%)}(h ``send(2)``h]hsend(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjfubh, }(hjfhhhNhNubj%)}(h``sendmsg(2)``h]h sendmsg(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjfubh, }(hjfhhhNhNubj%)}(h ``recv(2)``h]hrecv(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjfubh and }hjfsbj%)}(h``recvmsg(2)``h]h recvmsg(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjfubhX. Unlike the CAN_RAW socket API, only the ISO-TP data field (the actual payload) is sent and received by the userspace application using these calls. The address information and the protocol information are automatically filled by the ISO-TP stack using the configuration supplied during socket creation. In the same way, the stack will use the transport mechanism when required (i.e., when the size of the data payload exceeds the MTU of the underlying CAN bus).}(hjfhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK_hjhhubh)}(haThe sockaddr structure used for SocketCAN has extensions for use with ISO-TP, as specified below:h]haThe sockaddr structure used for SocketCAN has extensions for use with ISO-TP, as specified below:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKihjhhubj)}(hstruct sockaddr_can { sa_family_t can_family; int can_ifindex; union { struct { canid_t rx_id, tx_id; } tp; ... } can_addr; }h]hstruct sockaddr_can { sa_family_t can_family; int can_ifindex; union { struct { canid_t rx_id, tx_id; } tp; ... } can_addr; }}hjsbah}(h]h ]h"]h$]h&]hhjj j j }uh1jhhhKlhjhhubj)}(hhh](j#)}(hZ``can_family`` and ``can_ifindex`` serve the same purpose as for other SocketCAN sockets. h]h)}(hY``can_family`` and ``can_ifindex`` serve the same purpose as for other SocketCAN sockets.h](j%)}(h``can_family``h]h can_family}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh and }(hjhhhNhNubj%)}(h``can_ifindex``h]h can_ifindex}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh7 serve the same purpose as for other SocketCAN sockets.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKwhjubah}(h]h ]h"]h$]h&]uh1j"hjhhhhhNubj#)}(hY``can_addr.tp.rx_id`` specifies the receive (RX) CAN ID and will be used as a RX filter. h]h)}(hX``can_addr.tp.rx_id`` specifies the receive (RX) CAN ID and will be used as a RX filter.h](j%)}(h``can_addr.tp.rx_id``h]hcan_addr.tp.rx_id}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj<ubhC specifies the receive (RX) CAN ID and will be used as a RX filter.}(hj<hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKzhj8ubah}(h]h ]h"]h$]h&]uh1j"hjhhhhhNubj#)}(h9``can_addr.tp.tx_id`` specifies the transmit (TX) CAN ID h]h)}(h8``can_addr.tp.tx_id`` specifies the transmit (TX) CAN IDh](j%)}(h``can_addr.tp.tx_id``h]hcan_addr.tp.tx_id}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjbubh# specifies the transmit (TX) CAN ID}(hjbhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK}hj^ubah}(h]h ]h"]h$]h&]uh1j"hjhhhhhNubeh}(h]h ]h"]h$]h&]jBjCuh1jhhhKwhjhhubeh}(h],creation-and-basic-usage-of-an-iso-tp-socketah ]h"],creation and basic usage of an iso-tp socketah$]h&]uh1hhjrhhhhhKKubh)}(hhh](h)}(hISO-TP socket optionsh]hISO-TP socket options}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hWhen creating an ISO-TP socket, reasonable defaults are set. Some options can be modified with ``setsockopt(2)`` and/or read back with ``getsockopt(2)``.h](h_When creating an ISO-TP socket, reasonable defaults are set. Some options can be modified with }(hjhhhNhNubj%)}(h``setsockopt(2)``h]h setsockopt(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh and/or read back with }(hjhhhNhNubj%)}(h``getsockopt(2)``h]h getsockopt(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hhh](h)}(hGeneral optionsh]hGeneral options}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hJGeneral socket options can be passed using the ``CAN_ISOTP_OPTS`` optname:h](h/General socket options can be passed using the }(hjhhhNhNubj%)}(h``CAN_ISOTP_OPTS``h]hCAN_ISOTP_OPTS}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh optname:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hfstruct can_isotp_options opts; ret = setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_OPTS, &opts, sizeof(opts))h]hfstruct can_isotp_options opts; ret = setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_OPTS, &opts, sizeof(opts))}hjsbah}(h]h ]h"]h$]h&]hhjj j j }uh1jhhhKhjhhubh)}(hEwhere the ``can_isotp_options`` structure has the following contents:h](h where the }(hjhhhNhNubj%)}(h``can_isotp_options``h]hcan_isotp_options}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh& structure has the following contents:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hstruct can_isotp_options { u32 flags; u32 frame_txtime; u8 ext_address; u8 txpad_content; u8 rxpad_content; u8 rx_ext_address; };h]hstruct can_isotp_options { u32 flags; u32 frame_txtime; u8 ext_address; u8 txpad_content; u8 rxpad_content; u8 rx_ext_address; };}hj5sbah}(h]h ]h"]h$]h&]hhjj j j }uh1jhhhKhjhhubj)}(hhh](j#)}(hX``flags``: modifiers to be applied to the default behaviour of the ISO-TP stack. Following flags are available: * ``CAN_ISOTP_LISTEN_MODE``: listen only (do not send FC frames); normally used as a testing feature. * ``CAN_ISOTP_EXTEND_ADDR``: use the byte specified in ``ext_address`` as an additional address component. This enables the "mixed" addressing format if used alone, or the "extended" addressing format if used in conjunction with ``CAN_ISOTP_RX_EXT_ADDR``. * ``CAN_ISOTP_TX_PADDING``: enable padding for transmitted frames, using ``txpad_content`` as value for the padding bytes. * ``CAN_ISOTP_RX_PADDING``: enable padding for the received frames, using ``rxpad_content`` as value for the padding bytes. * ``CAN_ISOTP_CHK_PAD_LEN``: check for correct padding length on the received frames. * ``CAN_ISOTP_CHK_PAD_DATA``: check padding bytes on the received frames against ``rxpad_content``; if ``CAN_ISOTP_RX_PADDING`` is not specified, this flag is ignored. * ``CAN_ISOTP_HALF_DUPLEX``: force ISO-TP socket in half duplex mode (that is, transport mechanism can only be incoming or outgoing at the same time, not both). * ``CAN_ISOTP_FORCE_TXSTMIN``: ignore stmin from received FC; normally used as a testing feature. * ``CAN_ISOTP_FORCE_RXSTMIN``: ignore CFs depending on rx stmin; normally used as a testing feature. * ``CAN_ISOTP_RX_EXT_ADDR``: use ``rx_ext_address`` instead of ``ext_address`` as extended addressing byte on the reception path. If used in conjunction with ``CAN_ISOTP_EXTEND_ADDR``, this flag effectively enables the "extended" addressing format. * ``CAN_ISOTP_WAIT_TX_DONE``: wait until the frame is sent before returning from ``write(2)`` and ``send(2)`` calls (i.e., blocking write operations). * ``CAN_ISOTP_SF_BROADCAST``: use 1-to-N functional addressing (cannot be specified alongside ``CAN_ISOTP_CF_BROADCAST``). * ``CAN_ISOTP_CF_BROADCAST``: use 1-to-N transmission without flow control (cannot be specified alongside ``CAN_ISOTP_SF_BROADCAST``). NOTE: this is not covered by the ISO 15765-2 standard. * ``CAN_ISOTP_DYN_FC_PARMS``: enable dynamic update of flow control parameters. h](h)}(ho``flags``: modifiers to be applied to the default behaviour of the ISO-TP stack. Following flags are available:h](j%)}(h ``flags``h]hflags}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjKubhf: modifiers to be applied to the default behaviour of the ISO-TP stack. Following flags are available:}(hjKhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjGubj)}(hhh](j#)}(hd``CAN_ISOTP_LISTEN_MODE``: listen only (do not send FC frames); normally used as a testing feature. h]h)}(hc``CAN_ISOTP_LISTEN_MODE``: listen only (do not send FC frames); normally used as a testing feature.h](j%)}(h``CAN_ISOTP_LISTEN_MODE``h]hCAN_ISOTP_LISTEN_MODE}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjnubhJ: listen only (do not send FC frames); normally used as a testing feature.}(hjnhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjjubah}(h]h ]h"]h$]h&]uh1j"hjgubj#)}(h``CAN_ISOTP_EXTEND_ADDR``: use the byte specified in ``ext_address`` as an additional address component. This enables the "mixed" addressing format if used alone, or the "extended" addressing format if used in conjunction with ``CAN_ISOTP_RX_EXT_ADDR``. h]h)}(h``CAN_ISOTP_EXTEND_ADDR``: use the byte specified in ``ext_address`` as an additional address component. This enables the "mixed" addressing format if used alone, or the "extended" addressing format if used in conjunction with ``CAN_ISOTP_RX_EXT_ADDR``.h](j%)}(h``CAN_ISOTP_EXTEND_ADDR``h]hCAN_ISOTP_EXTEND_ADDR}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh: use the byte specified in }(hjhhhNhNubj%)}(h``ext_address``h]h ext_address}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh as an additional address component. This enables the “mixed” addressing format if used alone, or the “extended” addressing format if used in conjunction with }(hjhhhNhNubj%)}(h``CAN_ISOTP_RX_EXT_ADDR``h]hCAN_ISOTP_RX_EXT_ADDR}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j"hjgubj#)}(hy``CAN_ISOTP_TX_PADDING``: enable padding for transmitted frames, using ``txpad_content`` as value for the padding bytes. h]h)}(hx``CAN_ISOTP_TX_PADDING``: enable padding for transmitted frames, using ``txpad_content`` as value for the padding bytes.h](j%)}(h``CAN_ISOTP_TX_PADDING``h]hCAN_ISOTP_TX_PADDING}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh/: enable padding for transmitted frames, using }(hjhhhNhNubj%)}(h``txpad_content``h]h txpad_content}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh as value for the padding bytes.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j"hjgubj#)}(hz``CAN_ISOTP_RX_PADDING``: enable padding for the received frames, using ``rxpad_content`` as value for the padding bytes. h]h)}(hy``CAN_ISOTP_RX_PADDING``: enable padding for the received frames, using ``rxpad_content`` as value for the padding bytes.h](j%)}(h``CAN_ISOTP_RX_PADDING``h]hCAN_ISOTP_RX_PADDING}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh0: enable padding for the received frames, using }(hjhhhNhNubj%)}(h``rxpad_content``h]h rxpad_content}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh as value for the padding bytes.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j"hjgubj#)}(hT``CAN_ISOTP_CHK_PAD_LEN``: check for correct padding length on the received frames. h]h)}(hS``CAN_ISOTP_CHK_PAD_LEN``: check for correct padding length on the received frames.h](j%)}(h``CAN_ISOTP_CHK_PAD_LEN``h]hCAN_ISOTP_CHK_PAD_LEN}(hjRhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjNubh:: check for correct padding length on the received frames.}(hjNhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjJubah}(h]h ]h"]h$]h&]uh1j"hjgubj#)}(h``CAN_ISOTP_CHK_PAD_DATA``: check padding bytes on the received frames against ``rxpad_content``; if ``CAN_ISOTP_RX_PADDING`` is not specified, this flag is ignored. h]h)}(h``CAN_ISOTP_CHK_PAD_DATA``: check padding bytes on the received frames against ``rxpad_content``; if ``CAN_ISOTP_RX_PADDING`` is not specified, this flag is ignored.h](j%)}(h``CAN_ISOTP_CHK_PAD_DATA``h]hCAN_ISOTP_CHK_PAD_DATA}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjtubh5: check padding bytes on the received frames against }(hjthhhNhNubj%)}(h``rxpad_content``h]h rxpad_content}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjtubh; if }(hjthhhNhNubj%)}(h``CAN_ISOTP_RX_PADDING``h]hCAN_ISOTP_RX_PADDING}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjtubh( is not specified, this flag is ignored.}(hjthhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjpubah}(h]h ]h"]h$]h&]uh1j"hjgubj#)}(h``CAN_ISOTP_HALF_DUPLEX``: force ISO-TP socket in half duplex mode (that is, transport mechanism can only be incoming or outgoing at the same time, not both). h]h)}(h``CAN_ISOTP_HALF_DUPLEX``: force ISO-TP socket in half duplex mode (that is, transport mechanism can only be incoming or outgoing at the same time, not both).h](j%)}(h``CAN_ISOTP_HALF_DUPLEX``h]hCAN_ISOTP_HALF_DUPLEX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh: force ISO-TP socket in half duplex mode (that is, transport mechanism can only be incoming or outgoing at the same time, not both).}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j"hjgubj#)}(h```CAN_ISOTP_FORCE_TXSTMIN``: ignore stmin from received FC; normally used as a testing feature. h]h)}(h_``CAN_ISOTP_FORCE_TXSTMIN``: ignore stmin from received FC; normally used as a testing feature.h](j%)}(h``CAN_ISOTP_FORCE_TXSTMIN``h]hCAN_ISOTP_FORCE_TXSTMIN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubhD: ignore stmin from received FC; normally used as a testing feature.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j"hjgubj#)}(hc``CAN_ISOTP_FORCE_RXSTMIN``: ignore CFs depending on rx stmin; normally used as a testing feature. h]h)}(hb``CAN_ISOTP_FORCE_RXSTMIN``: ignore CFs depending on rx stmin; normally used as a testing feature.h](j%)}(h``CAN_ISOTP_FORCE_RXSTMIN``h]hCAN_ISOTP_FORCE_RXSTMIN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj ubhG: ignore CFs depending on rx stmin; normally used as a testing feature.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j"hjgubj#)}(h``CAN_ISOTP_RX_EXT_ADDR``: use ``rx_ext_address`` instead of ``ext_address`` as extended addressing byte on the reception path. If used in conjunction with ``CAN_ISOTP_EXTEND_ADDR``, this flag effectively enables the "extended" addressing format. h]h)}(h``CAN_ISOTP_RX_EXT_ADDR``: use ``rx_ext_address`` instead of ``ext_address`` as extended addressing byte on the reception path. If used in conjunction with ``CAN_ISOTP_EXTEND_ADDR``, this flag effectively enables the "extended" addressing format.h](j%)}(h``CAN_ISOTP_RX_EXT_ADDR``h]hCAN_ISOTP_RX_EXT_ADDR}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj0ubh: use }(hj0hhhNhNubj%)}(h``rx_ext_address``h]hrx_ext_address}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj0ubh instead of }(hj0hhhNhNubj%)}(h``ext_address``h]h ext_address}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj0ubhP as extended addressing byte on the reception path. If used in conjunction with }(hj0hhhNhNubj%)}(h``CAN_ISOTP_EXTEND_ADDR``h]hCAN_ISOTP_EXTEND_ADDR}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj0ubhE, this flag effectively enables the “extended” addressing format.}(hj0hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj,ubah}(h]h ]h"]h$]h&]uh1j"hjgubj#)}(h``CAN_ISOTP_WAIT_TX_DONE``: wait until the frame is sent before returning from ``write(2)`` and ``send(2)`` calls (i.e., blocking write operations). h]h)}(h``CAN_ISOTP_WAIT_TX_DONE``: wait until the frame is sent before returning from ``write(2)`` and ``send(2)`` calls (i.e., blocking write operations).h](j%)}(h``CAN_ISOTP_WAIT_TX_DONE``h]hCAN_ISOTP_WAIT_TX_DONE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh5: wait until the frame is sent before returning from }(hjhhhNhNubj%)}(h ``write(2)``h]hwrite(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh and }(hjhhhNhNubj%)}(h ``send(2)``h]hsend(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh) calls (i.e., blocking write operations).}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j"hjgubj#)}(hy``CAN_ISOTP_SF_BROADCAST``: use 1-to-N functional addressing (cannot be specified alongside ``CAN_ISOTP_CF_BROADCAST``). h]h)}(hx``CAN_ISOTP_SF_BROADCAST``: use 1-to-N functional addressing (cannot be specified alongside ``CAN_ISOTP_CF_BROADCAST``).h](j%)}(h``CAN_ISOTP_SF_BROADCAST``h]hCAN_ISOTP_SF_BROADCAST}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubhB: use 1-to-N functional addressing (cannot be specified alongside }(hjhhhNhNubj%)}(h``CAN_ISOTP_CF_BROADCAST``h]hCAN_ISOTP_CF_BROADCAST}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh).}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j"hjgubj#)}(h``CAN_ISOTP_CF_BROADCAST``: use 1-to-N transmission without flow control (cannot be specified alongside ``CAN_ISOTP_SF_BROADCAST``). NOTE: this is not covered by the ISO 15765-2 standard. h]h)}(h``CAN_ISOTP_CF_BROADCAST``: use 1-to-N transmission without flow control (cannot be specified alongside ``CAN_ISOTP_SF_BROADCAST``). NOTE: this is not covered by the ISO 15765-2 standard.h](j%)}(h``CAN_ISOTP_CF_BROADCAST``h]hCAN_ISOTP_CF_BROADCAST}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubhN: use 1-to-N transmission without flow control (cannot be specified alongside }(hjhhhNhNubj%)}(h``CAN_ISOTP_SF_BROADCAST``h]hCAN_ISOTP_SF_BROADCAST}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh9). NOTE: this is not covered by the ISO 15765-2 standard.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j"hjgubj#)}(hN``CAN_ISOTP_DYN_FC_PARMS``: enable dynamic update of flow control parameters. h]h)}(hM``CAN_ISOTP_DYN_FC_PARMS``: enable dynamic update of flow control parameters.h](j%)}(h``CAN_ISOTP_DYN_FC_PARMS``h]hCAN_ISOTP_DYN_FC_PARMS}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjFubh3: enable dynamic update of flow control parameters.}(hjFhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjBubah}(h]h ]h"]h$]h&]uh1j"hjgubeh}(h]h ]h"]h$]h&]jBjCuh1jhhhKhjGubeh}(h]h ]h"]h$]h&]uh1j"hjDhhhNhNubj#)}(hX``frame_txtime``: frame transmission time (defined as N_As/N_Ar inside the ISO standard); if ``0``, the default (or the last set value) is used. To set the transmission time to ``0``, the ``CAN_ISOTP_FRAME_TXTIME_ZERO`` macro (equal to 0xFFFFFFFF) shall be used. h]h)}(hX``frame_txtime``: frame transmission time (defined as N_As/N_Ar inside the ISO standard); if ``0``, the default (or the last set value) is used. To set the transmission time to ``0``, the ``CAN_ISOTP_FRAME_TXTIME_ZERO`` macro (equal to 0xFFFFFFFF) shall be used.h](j%)}(h``frame_txtime``h]h frame_txtime}(hj|hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjxubhM: frame transmission time (defined as N_As/N_Ar inside the ISO standard); if }(hjxhhhNhNubj%)}(h``0``h]h0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjxubhO, the default (or the last set value) is used. To set the transmission time to }(hjxhhhNhNubj%)}(h``0``h]h0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjxubh, the }(hjxhhhNhNubj%)}(h``CAN_ISOTP_FRAME_TXTIME_ZERO``h]hCAN_ISOTP_FRAME_TXTIME_ZERO}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjxubh+ macro (equal to 0xFFFFFFFF) shall be used.}(hjxhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjtubah}(h]h ]h"]h$]h&]uh1j"hjDhhhhhNubj#)}(hd``ext_address``: extended addressing byte, used if the ``CAN_ISOTP_EXTEND_ADDR`` flag is specified. h]h)}(hc``ext_address``: extended addressing byte, used if the ``CAN_ISOTP_EXTEND_ADDR`` flag is specified.h](j%)}(h``ext_address``h]h ext_address}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh(: extended addressing byte, used if the }(hjhhhNhNubj%)}(h``CAN_ISOTP_EXTEND_ADDR``h]hCAN_ISOTP_EXTEND_ADDR}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh flag is specified.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j"hjDhhhhhNubj#)}(hF``txpad_content``: byte used as padding value for transmitted frames. h]h)}(hE``txpad_content``: byte used as padding value for transmitted frames.h](j%)}(h``txpad_content``h]h txpad_content}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj ubh4: byte used as padding value for transmitted frames.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j"hjDhhhhhNubj#)}(hC``rxpad_content``: byte used as padding value for received frames. h]h)}(hB``rxpad_content``: byte used as padding value for received frames.h](j%)}(h``rxpad_content``h]h rxpad_content}(hj6 hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj2 ubh1: byte used as padding value for received frames.}(hj2 hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj. ubah}(h]h ]h"]h$]h&]uh1j"hjDhhhhhNubj#)}(h~``rx_ext_address``: extended addressing byte for the reception path, used if the ``CAN_ISOTP_RX_EXT_ADDR`` flag is specified. h]h)}(h}``rx_ext_address``: extended addressing byte for the reception path, used if the ``CAN_ISOTP_RX_EXT_ADDR`` flag is specified.h](j%)}(h``rx_ext_address``h]hrx_ext_address}(hj\ hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjX ubh?: extended addressing byte for the reception path, used if the }(hjX hhhNhNubj%)}(h``CAN_ISOTP_RX_EXT_ADDR``h]hCAN_ISOTP_RX_EXT_ADDR}(hjn hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjX ubh flag is specified.}(hjX hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjT ubah}(h]h ]h"]h$]h&]uh1j"hjDhhhhhNubeh}(h]h ]h"]h$]h&]jBjCuh1jhhhKhjhhubeh}(h]general-optionsah ]h"]general optionsah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(hFlow Control optionsh]hFlow Control options}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh)}(hFlow Control (FC) options can be passed using the ``CAN_ISOTP_RECV_FC`` optname to provide the communication parameters for receiving ISO-TP PDUs.h](h2Flow Control (FC) options can be passed using the }(hj hhhNhNubj%)}(h``CAN_ISOTP_RECV_FC``h]hCAN_ISOTP_RECV_FC}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj ubhK optname to provide the communication parameters for receiving ISO-TP PDUs.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubj)}(hvstruct can_isotp_fc_options fc_opts; ret = setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_RECV_FC, &fc_opts, sizeof(fc_opts));h]hvstruct can_isotp_fc_options fc_opts; ret = setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_RECV_FC, &fc_opts, sizeof(fc_opts));}hj sbah}(h]h ]h"]h$]h&]hhjj j j }uh1jhhhKhj hhubh)}(hHwhere the ``can_isotp_fc_options`` structure has the following contents:h](h where the }(hj hhhNhNubj%)}(h``can_isotp_fc_options``h]hcan_isotp_fc_options}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj ubh& structure has the following contents:}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubj)}(hEstruct can_isotp_options { u8 bs; u8 stmin; u8 wftmax; };h]hEstruct can_isotp_options { u8 bs; u8 stmin; u8 wftmax; };}hj sbah}(h]h ]h"]h$]h&]hhjj j j }uh1jhhhKhj hhubj)}(hhh](j#)}(h3``bs``: blocksize provided in flow control frames. h]h)}(h2``bs``: blocksize provided in flow control frames.h](j%)}(h``bs``h]hbs}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj ubh,: blocksize provided in flow control frames.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j"hj hhhhhNubj#)}(h``stmin``: minimum separation time provided in flow control frames; can have the following values (others are reserved): * 0x00 - 0x7F : 0 - 127 ms * 0xF1 - 0xF9 : 100 us - 900 us h](h)}(hx``stmin``: minimum separation time provided in flow control frames; can have the following values (others are reserved):h](j%)}(h ``stmin``h]hstmin}(hj: hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj6 ubho: minimum separation time provided in flow control frames; can have the following values (others are reserved):}(hj6 hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj2 ubj)}(hhh](j#)}(h0x00 - 0x7F : 0 - 127 ms h]h)}(h0x00 - 0x7F : 0 - 127 msh]h0x00 - 0x7F : 0 - 127 ms}(hjY hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjU ubah}(h]h ]h"]h$]h&]uh1j"hjR ubj#)}(h0xF1 - 0xF9 : 100 us - 900 us h]h)}(h0xF1 - 0xF9 : 100 us - 900 ush]h0xF1 - 0xF9 : 100 us - 900 us}(hjq hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjm ubah}(h]h ]h"]h$]h&]uh1j"hjR ubeh}(h]h ]h"]h$]h&]jBjCuh1jhhhKhj2 ubeh}(h]h ]h"]h$]h&]uh1j"hj hhhNhNubj#)}(hK``wftmax``: maximum number of wait frames provided in flow control frames. h]h)}(hJ``wftmax``: maximum number of wait frames provided in flow control frames.h](j%)}(h ``wftmax``h]hwftmax}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj ubh@: maximum number of wait frames provided in flow control frames.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j"hj hhhhhNubeh}(h]h ]h"]h$]h&]jBjCuh1jhhhKhj hhubeh}(h]flow-control-optionsah ]h"]flow control optionsah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(hLink Layer optionsh]hLink Layer options}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubh)}(hNLink Layer (LL) options can be passed using the ``CAN_ISOTP_LL_OPTS`` optname:h](h0Link Layer (LL) options can be passed using the }(hj hhhNhNubj%)}(h``CAN_ISOTP_LL_OPTS``h]hCAN_ISOTP_LL_OPTS}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj ubh optname:}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj)}(hvstruct can_isotp_ll_options ll_opts; ret = setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_LL_OPTS, &ll_opts, sizeof(ll_opts));h]hvstruct can_isotp_ll_options ll_opts; ret = setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_LL_OPTS, &ll_opts, sizeof(ll_opts));}hj sbah}(h]h ]h"]h$]h&]hhjj j j }uh1jhhhMhj hhubh)}(hHwhere the ``can_isotp_ll_options`` structure has the following contents:h](h where the }(hj hhhNhNubj%)}(h``can_isotp_ll_options``h]hcan_isotp_ll_options}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj ubh& structure has the following contents:}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hj hhubj)}(hKstruct can_isotp_ll_options { u8 mtu; u8 tx_dl; u8 tx_flags; };h]hKstruct can_isotp_ll_options { u8 mtu; u8 tx_dl; u8 tx_flags; };}hj% sbah}(h]h ]h"]h$]h&]hhjj j j }uh1jhhhM hj hhubj)}(hhh](j#)}(h``mtu``: generated and accepted CAN frame type, can be equal to ``CAN_MTU`` for classical CAN frames or ``CANFD_MTU`` for CAN FD frames. h]h)}(h``mtu``: generated and accepted CAN frame type, can be equal to ``CAN_MTU`` for classical CAN frames or ``CANFD_MTU`` for CAN FD frames.h](j%)}(h``mtu``h]hmtu}(hj? hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj; ubh9: generated and accepted CAN frame type, can be equal to }(hj; hhhNhNubj%)}(h ``CAN_MTU``h]hCAN_MTU}(hjQ hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj; ubh for classical CAN frames or }(hj; hhhNhNubj%)}(h ``CANFD_MTU``h]h CANFD_MTU}(hjc hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj; ubh for CAN FD frames.}(hj; hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj7 ubah}(h]h ]h"]h$]h&]uh1j"hj4 hhhhhNubj#)}(h``tx_dl``: maximum payload length for transmitted frames, can have one value among: 8, 12, 16, 20, 24, 32, 48, 64. Values above 8 only apply to CAN FD traffic (i.e.: ``mtu = CANFD_MTU``). h]h)}(h``tx_dl``: maximum payload length for transmitted frames, can have one value among: 8, 12, 16, 20, 24, 32, 48, 64. Values above 8 only apply to CAN FD traffic (i.e.: ``mtu = CANFD_MTU``).h](j%)}(h ``tx_dl``h]htx_dl}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj ubh: maximum payload length for transmitted frames, can have one value among: 8, 12, 16, 20, 24, 32, 48, 64. Values above 8 only apply to CAN FD traffic (i.e.: }(hj hhhNhNubj%)}(h``mtu = CANFD_MTU``h]hmtu = CANFD_MTU}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj ubh).}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1j"hj4 hhhhhNubj#)}(h``tx_flags``: flags set into ``struct canfd_frame.flags`` at frame creation. Only applies to CAN FD traffic (i.e.: ``mtu = CANFD_MTU``). h]h)}(h``tx_flags``: flags set into ``struct canfd_frame.flags`` at frame creation. Only applies to CAN FD traffic (i.e.: ``mtu = CANFD_MTU``).h](j%)}(h ``tx_flags``h]htx_flags}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj ubh: flags set into }(hj hhhNhNubj%)}(h``struct canfd_frame.flags``h]hstruct canfd_frame.flags}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj ubh: at frame creation. Only applies to CAN FD traffic (i.e.: }(hj hhhNhNubj%)}(h``mtu = CANFD_MTU``h]hmtu = CANFD_MTU}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj ubh).}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1j"hj4 hhhhhNubeh}(h]h ]h"]h$]h&]jBjCuh1jhhhMhj hhubeh}(h]link-layer-optionsah ]h"]link layer optionsah$]h&]uh1hhjhhhhhMubh)}(hhh](h)}(hTransmission stminh]hTransmission stmin}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubh)}(hThe transmission minimum separation time (stmin) can be forced using the ``CAN_ISOTP_TX_STMIN`` optname and providing an stmin value in microseconds as a 32bit unsigned integer; this will overwrite the value sent by the receiver in flow control frames:h](hIThe transmission minimum separation time (stmin) can be forced using the }(hj" hhhNhNubj%)}(h``CAN_ISOTP_TX_STMIN``h]hCAN_ISOTP_TX_STMIN}(hj* hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj" ubh optname and providing an stmin value in microseconds as a 32bit unsigned integer; this will overwrite the value sent by the receiver in flow control frames:}(hj" hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hj hhubj)}(h^uint32_t stmin; ret = setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_TX_STMIN, &stmin, sizeof(stmin));h]h^uint32_t stmin; ret = setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_TX_STMIN, &stmin, sizeof(stmin));}hjB sbah}(h]h ]h"]h$]h&]hhjj j j }uh1jhhhM%hj hhubeh}(h]transmission-stminah ]h"]transmission stminah$]h&]uh1hhjhhhhhMubh)}(hhh](h)}(hReception stminh]hReception stmin}(hj\ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjY hhhhhM+ubh)}(hX The reception minimum separation time (stmin) can be forced using the ``CAN_ISOTP_RX_STMIN`` optname and providing an stmin value in microseconds as a 32bit unsigned integer; received Consecutive Frames (CF) which timestamps differ less than this value will be ignored:h](hFThe reception minimum separation time (stmin) can be forced using the }(hjj hhhNhNubj%)}(h``CAN_ISOTP_RX_STMIN``h]hCAN_ISOTP_RX_STMIN}(hjr hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjj ubh optname and providing an stmin value in microseconds as a 32bit unsigned integer; received Consecutive Frames (CF) which timestamps differ less than this value will be ignored:}(hjj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM-hjY hhubj)}(h^uint32_t stmin; ret = setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_RX_STMIN, &stmin, sizeof(stmin));h]h^uint32_t stmin; ret = setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_RX_STMIN, &stmin, sizeof(stmin));}hj sbah}(h]h ]h"]h$]h&]hhjj j j }uh1jhhhM2hjY hhubeh}(h]reception-stminah ]h"]reception stminah$]h&]uh1hhjhhhhhM+ubeh}(h]iso-tp-socket-optionsah ]h"]iso-tp socket optionsah$]h&]uh1hhjrhhhhhKubh)}(hhh](h)}(hMulti-frame transport supporth]hMulti-frame transport support}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhM8ubh)}(hThe ISO-TP stack contained inside the Linux kernel supports the multi-frame transport mechanism defined by the standard, with the following constraints:h]hThe ISO-TP stack contained inside the Linux kernel supports the multi-frame transport mechanism defined by the standard, with the following constraints:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM:hj hhubj)}(hhh](j#)}(hfthe maximum size of a PDU is defined by a module parameter, with an hard limit imposed at build time. h]h)}(hethe maximum size of a PDU is defined by a module parameter, with an hard limit imposed at build time.h]hethe maximum size of a PDU is defined by a module parameter, with an hard limit imposed at build time.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM=hj ubah}(h]h ]h"]h$]h&]uh1j"hj hhhhhNubj#)}(hwhen a transmission is in progress, subsequent calls to ``write(2)`` will block, while calls to ``send(2)`` will either block or fail depending on the presence of the ``MSG_DONTWAIT`` flag. h]h)}(hwhen a transmission is in progress, subsequent calls to ``write(2)`` will block, while calls to ``send(2)`` will either block or fail depending on the presence of the ``MSG_DONTWAIT`` flag.h](h8when a transmission is in progress, subsequent calls to }(hj hhhNhNubj%)}(h ``write(2)``h]hwrite(2)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj ubh will block, while calls to }(hj hhhNhNubj%)}(h ``send(2)``h]hsend(2)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj ubh< will either block or fail depending on the presence of the }(hj hhhNhNubj%)}(h``MSG_DONTWAIT``h]h MSG_DONTWAIT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j$hj ubh flag.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM@hj ubah}(h]h ]h"]h$]h&]uh1j"hj hhhhhNubj#)}(hno support is present for sending "wait frames": whether a PDU can be fully received or not is decided when the First Frame is received. h]h)}(hno support is present for sending "wait frames": whether a PDU can be fully received or not is decided when the First Frame is received.h]hno support is present for sending “wait frames”: whether a PDU can be fully received or not is decided when the First Frame is received.}(hj5 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMDhj1 ubah}(h]h ]h"]h$]h&]uh1j"hj hhhhhNubeh}(h]h ]h"]h$]h&]jBjCuh1jhhhM=hj hhubeh}(h]multi-frame-transport-supportah ]h"]multi-frame transport supportah$]h&]uh1hhjrhhhhhM8ubh)}(hhh](h)}(hErrorsh]hErrors}(hjZ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjW hhhhhMHubh)}(h+Following errors are reported to userspace:h]h+Following errors are reported to userspace:}(hjh hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMJhjW hhubh)}(hhh](h)}(hRX path errorsh]hRX path errors}(hjy hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjv hhhhhMMubhtable)}(hhh]htgroup)}(hhh](hcolspec)}(hhh]h}(h]h ]h"]h$]h&]colwidthK uh1j hj ubj )}(hhh]h}(h]h ]h"]h$]h&]colwidthK?uh1j hj ubhtbody)}(hhh](hrow)}(hhh](hentry)}(hhh]h)}(h -ETIMEDOUTh]h -ETIMEDOUT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMPhj ubah}(h]h ]h"]h$]h&]uh1j hj ubj )}(hhh]h)}(htimeout of data receptionh]htimeout of data reception}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMPhj ubah}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]uh1j hj ubj )}(hhh](j )}(hhh]h)}(h-EILSEQh]h-EILSEQ}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMQhj ubah}(h]h ]h"]h$]h&]uh1j hj ubj )}(hhh]h)}(h7sequence number mismatch during a multi-frame receptionh]h7sequence number mismatch during a multi-frame reception}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMQhjubah}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]uh1j hj ubj )}(hhh](j )}(hhh]h)}(h-EBADMSGh]h-EBADMSG}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMRhj!ubah}(h]h ]h"]h$]h&]uh1j hjubj )}(hhh]h)}(h!data reception with wrong paddingh]h!data reception with wrong padding}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMRhj8ubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]colsKuh1j hj ubah}(h]h ]h"]h$]h&]uh1j hjv hhhhhNubeh}(h]rx-path-errorsah ]h"]rx path errorsah$]h&]uh1hhjW hhhhhMMubh)}(hhh](h)}(hTX path errorsh]hTX path errors}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1hhjphhhhhMVubj )}(hhh]j )}(hhh](j )}(hhh]h}(h]h ]h"]h$]h&]colwidthK uh1j hjubj )}(hhh]h}(h]h ]h"]h$]h&]colwidthKAuh1j hjubj )}(hhh](j )}(hhh](j )}(hhh]h)}(h-ECOMMh]h-ECOMM}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMYhjubah}(h]h ]h"]h$]h&]uh1j hjubj )}(hhh]h)}(hflow control reception timeouth]hflow control reception timeout}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMYhjubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1j hjubj )}(hhh](j )}(hhh]h)}(h -EMSGSIZEh]h -EMSGSIZE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMZhjubah}(h]h ]h"]h$]h&]uh1j hjubj )}(hhh]h)}(hflow control reception overflowh]hflow control reception overflow}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMZhjubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1j hjubj )}(hhh](j )}(hhh]h)}(h-EBADMSGh]h-EBADMSG}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM[hjubah}(h]h ]h"]h$]h&]uh1j hj ubj )}(hhh]h)}(h0flow control reception with wrong layout/paddingh]h0flow control reception with wrong layout/padding}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM[hj&ubah}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]colsKuh1j hjubah}(h]h ]h"]h$]h&]uh1j hjphhhhhNubeh}(h]tx-path-errorsah ]h"]tx path errorsah$]h&]uh1hhjW hhhhhMVubeh}(h]errorsah ]h"]errorsah$]h&]uh1hhjrhhhhhMHubeh}(h]how-to-use-iso-tpah ]h"]how to use iso-tpah$]h&]uh1hhhhhhhhKDubh)}(hhh](h)}(hExamplesh]hExamples}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjnhhhhhM_ubh)}(hhh](h)}(hBasic node exampleh]hBasic node example}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMbubh)}(hFollowing example implements a node using "normal" physical addressing, with RX ID equal to 0x18DAF142 and a TX ID equal to 0x18DA42F1. All options are left to their default.h]hFollowing example implements a node using “normal” physical addressing, with RX ID equal to 0x18DAF142 and a TX ID equal to 0x18DA42F1. All options are left to their default.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMdhjhhubj)}(hXint s; struct sockaddr_can addr; int ret; s = socket(PF_CAN, SOCK_DGRAM, CAN_ISOTP); if (s < 0) exit(1); addr.can_family = AF_CAN; addr.can_ifindex = if_nametoindex("can0"); addr.can_addr.tp.tx_id = 0x18DA42F1 | CAN_EFF_FLAG; addr.can_addr.tp.rx_id = 0x18DAF142 | CAN_EFF_FLAG; ret = bind(s, (struct sockaddr *)&addr, sizeof(addr)); if (ret < 0) exit(1); /* Data can now be received using read(s, ...) and sent using write(s, ...) */h]hXint s; struct sockaddr_can addr; int ret; s = socket(PF_CAN, SOCK_DGRAM, CAN_ISOTP); if (s < 0) exit(1); addr.can_family = AF_CAN; addr.can_ifindex = if_nametoindex("can0"); addr.can_addr.tp.tx_id = 0x18DA42F1 | CAN_EFF_FLAG; addr.can_addr.tp.rx_id = 0x18DAF142 | CAN_EFF_FLAG; ret = bind(s, (struct sockaddr *)&addr, sizeof(addr)); if (ret < 0) exit(1); /* Data can now be received using read(s, ...) and sent using write(s, ...) */}hjsbah}(h]h ]h"]h$]h&]hhjj j j }uh1jhhhMhhjhhubeh}(h]basic-node-exampleah ]h"]basic node exampleah$]h&]uh1hhjnhhhhhMbubh)}(hhh](h)}(hAdditional examplesh]hAdditional examples}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM~ubh)}(hMore complete (and complex) examples can be found inside the ``isotp*`` userland tools, distributed as part of the ``can-utils`` utilities at: https://github.com/linux-can/can-utilsh](h=More complete (and complex) examples can be found inside the }(hjhhhNhNubj%)}(h ``isotp*``h]hisotp*}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh, userland tools, distributed as part of the }(hjhhhNhNubj%)}(h ``can-utils``h]h can-utils}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j$hjubh utilities at: }(hjhhhNhNubh reference)}(h&https://github.com/linux-can/can-utilsh]h&https://github.com/linux-can/can-utils}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jhjubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubeh}(h]additional-examplesah ]h"]additional examplesah$]h&]uh1hhjnhhhhhM~ubeh}(h]examplesah ]h"]examplesah$]h&]uh1hhhhhhhhM_ubeh}(h]iso-15765-2-iso-tpah ]h"]iso 15765-2 (iso-tp)ah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksj footnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjCerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourcehnj _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jjjojljIjFjjjgjdjkjhjjj j j j j j j j jV jS j j jT jQ jcj`jmjjj[jXjjjjjj u nametypes}(jjojIjjgjkjj j j j jV j jT jcjmj[jjjuh}(jhjlhjFj jjLjdj jhjrjjj jj jj j j j jS j j jY jQ j j`jW jjjv jXjpjjnjjj ju footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.