sphinx.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]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}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh 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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhj hhhhhNubah}(h]h ]h"]h$]h&]bullet*uh1j hhhKhhhhubeh}(h]specifications-usedah ]h"]specifications usedah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Addressingh]h Addressing}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj8hhhhhKubh)}(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:}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj8hhubj )}(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.}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hjZubah}(h]h ]h"]h$]h&]uh1jhjWhhhhhNubj)}(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.}(hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK#hjrubah}(h]h ]h"]h$]h&]uh1jhjWhhhhhNubeh}(h]h ]h"]h$]h&]j.j/uh1j hhhK hj8hhubh)}(h3Three different addressing formats can be employed:h]h3Three different addressing formats can be employed:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK&hj8hhubj )}(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&]uh1jhjhhhhhNubj)}(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&]uh1jhjhhhhhNubj)}(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&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]j.j/uh1j hhhK(hj8hhubeh}(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&]uh1hhjhhhhhK3ubh)}(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}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhM) and the minimum time between the single CAN messages composing such block (}(hjhhhNhNubj)}(h ``stmin``h]hstmin}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh). 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}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh-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&]uh1hhhhK5hjhhubeh}(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}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhj^hhhhhKDubh)}(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.}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKFhj^hhubh)}(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&]uh1hhj}hhhhhKKubh)}(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&]uh1jhjubh7 shall be used. A socket can then be created using the }(hjhhhNhNubj)}(h ``PF_CAN``h]hPF_CAN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh protocol family, the }(hjhhhNhNubj)}(h``SOCK_DGRAM``h]h SOCK_DGRAM}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhG 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&]uh1jhjubh protocol:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKMhj}hhubh 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&]hhforcelanguageChighlight_args}uh1jhhhKRhj}hhubh)}(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, }(hjhhhNhNubj)}(h ``bind(2)``h]hbind(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhK shall be called to bind the socket to the desired CAN interface; to do so:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKVhj}hhubj )}(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.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKYhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(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).}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK\hj4ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]j.j/uh1j hhhKYhj}hhubh)}(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 }(hjRhhhNhNubj)}(h ``read(2)``h]hread(2)}(hjZhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjRubh and }(hjRhhhNhNubj)}(h ``write(2)``h]hwrite(2)}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjRubh system calls, as well as }(hjRhhhNhNubj)}(h ``send(2)``h]hsend(2)}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjRubh, }(hjRhhhNhNubj)}(h``sendmsg(2)``h]h sendmsg(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjRubh, }(hjRhhhNhNubj)}(h ``recv(2)``h]hrecv(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjRubh and }hjRsbj)}(h``recvmsg(2)``h]h recvmsg(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjRubhX. 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).}(hjRhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK_hj}hhubh)}(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&]uh1hhhhKihj}hhubj)}(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&]hhjjjj}uh1jhhhKlhj}hhubj )}(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&]uh1jhjubh and }(hjhhhNhNubj)}(h``can_ifindex``h]h can_ifindex}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh7 serve the same purpose as for other SocketCAN sockets.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKwhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(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&]uh1jhj(ubhC specifies the receive (RX) CAN ID and will be used as a RX filter.}(hj(hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKzhj$ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(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}(hjRhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjNubh# specifies the transmit (TX) CAN ID}(hjNhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK}hjJubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]j.j/uh1j hhhKwhj}hhubeh}(h],creation-and-basic-usage-of-an-iso-tp-socketah ]h"],creation and basic usage of an iso-tp socketah$]h&]uh1hhj^hhhhhKKubh)}(hhh](h)}(hISO-TP socket optionsh]hISO-TP socket options}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj~hhhhhKubh)}(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&]uh1jhjubh and/or read back with }(hjhhhNhNubj)}(h``getsockopt(2)``h]h getsockopt(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj~hhubh)}(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&]uh1jhjubh 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&]hhjjjj}uh1jhhhKhjhhubh)}(hEwhere the ``can_isotp_options`` structure has the following contents:h](h where the }(hjhhhNhNubj)}(h``can_isotp_options``h]hcan_isotp_options}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh& 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; };}hj!sbah}(h]h ]h"]h$]h&]hhjjjj}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}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj7ubhf: modifiers to be applied to the default behaviour of the ISO-TP stack. Following flags are available:}(hj7hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj3ubj )}(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}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjZubhJ: listen only (do not send FC frames); normally used as a testing feature.}(hjZhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjVubah}(h]h ]h"]h$]h&]uh1jhjSubj)}(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&]uh1jhjubh: use the byte specified in }(hjhhhNhNubj)}(h``ext_address``h]h ext_address}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh 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&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj|ubah}(h]h ]h"]h$]h&]uh1jhjSubj)}(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&]uh1jhjubh/: enable padding for transmitted frames, using }(hjhhhNhNubj)}(h``txpad_content``h]h txpad_content}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh as value for the padding bytes.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjSubj)}(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&]uh1jhjubh0: enable padding for the received frames, using }(hjhhhNhNubj)}(h``rxpad_content``h]h rxpad_content}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh as value for the padding bytes.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjSubj)}(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}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj:ubh:: check for correct padding length on the received frames.}(hj:hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj6ubah}(h]h ]h"]h$]h&]uh1jhjSubj)}(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}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj`ubh5: check padding bytes on the received frames against }(hj`hhhNhNubj)}(h``rxpad_content``h]h rxpad_content}(hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj`ubh; if }(hj`hhhNhNubj)}(h``CAN_ISOTP_RX_PADDING``h]hCAN_ISOTP_RX_PADDING}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj`ubh( is not specified, this flag is ignored.}(hj`hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj\ubah}(h]h ]h"]h$]h&]uh1jhjSubj)}(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&]uh1jhjubh: 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&]uh1jhjSubj)}(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&]uh1jhjubhD: ignore stmin from received FC; normally used as a testing feature.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjSubj)}(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&]uh1jhjubhG: ignore CFs depending on rx stmin; normally used as a testing feature.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjSubj)}(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}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh: use }(hjhhhNhNubj)}(h``rx_ext_address``h]hrx_ext_address}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh instead of }(hjhhhNhNubj)}(h``ext_address``h]h ext_address}(hjDhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhP as extended addressing byte on the reception path. If used in conjunction with }(hjhhhNhNubj)}(h``CAN_ISOTP_EXTEND_ADDR``h]hCAN_ISOTP_EXTEND_ADDR}(hjVhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhE, this flag effectively enables the “extended” addressing format.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjSubj)}(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}(hj|hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjxubh5: wait until the frame is sent before returning from }(hjxhhhNhNubj)}(h ``write(2)``h]hwrite(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjxubh and }(hjxhhhNhNubj)}(h ``send(2)``h]hsend(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjxubh) calls (i.e., blocking write operations).}(hjxhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjtubah}(h]h ]h"]h$]h&]uh1jhjSubj)}(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&]uh1jhjubhB: 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&]uh1jhjubh).}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjSubj)}(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&]uh1jhjubhN: use 1-to-N transmission without flow control (cannot be specified alongside }(hjhhhNhNubj)}(h``CAN_ISOTP_SF_BROADCAST``h]hCAN_ISOTP_SF_BROADCAST}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh9). NOTE: this is not covered by the ISO 15765-2 standard.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjSubj)}(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}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj2ubh3: enable dynamic update of flow control parameters.}(hj2hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj.ubah}(h]h ]h"]h$]h&]uh1jhjSubeh}(h]h ]h"]h$]h&]j.j/uh1j hhhKhj3ubeh}(h]h ]h"]h$]h&]uh1jhj0hhhNhNubj)}(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}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjdubhM: frame transmission time (defined as N_As/N_Ar inside the ISO standard); if }(hjdhhhNhNubj)}(h``0``h]h0}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjdubhO, the default (or the last set value) is used. To set the transmission time to }(hjdhhhNhNubj)}(h``0``h]h0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjdubh, the }(hjdhhhNhNubj)}(h``CAN_ISOTP_FRAME_TXTIME_ZERO``h]hCAN_ISOTP_FRAME_TXTIME_ZERO}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjdubh+ macro (equal to 0xFFFFFFFF) shall be used.}(hjdhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj`ubah}(h]h ]h"]h$]h&]uh1jhj0hhhhhNubj)}(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&]uh1jhjubh(: extended addressing byte, used if the }(hjhhhNhNubj)}(h``CAN_ISOTP_EXTEND_ADDR``h]hCAN_ISOTP_EXTEND_ADDR}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh flag is specified.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhj0hhhhhNubj)}(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}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh4: byte used as padding value for transmitted frames.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhj0hhhhhNubj)}(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}(hj" hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh1: byte used as padding value for received frames.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj0hhhhhNubj)}(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}(hjH hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjD ubh?: extended addressing byte for the reception path, used if the }(hjD hhhNhNubj)}(h``CAN_ISOTP_RX_EXT_ADDR``h]hCAN_ISOTP_RX_EXT_ADDR}(hjZ hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjD ubh flag is specified.}(hjD hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj@ ubah}(h]h ]h"]h$]h&]uh1jhj0hhhhhNubeh}(h]h ]h"]h$]h&]j.j/uh1j hhhKhjhhubeh}(h]general-optionsah ]h"]general optionsah$]h&]uh1hhj~hhhhhKubh)}(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&]uh1jhj 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&]hhjjjj}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&]uh1jhj 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&]hhjjjj}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&]uh1jhj ubh,: blocksize provided in flow control frames.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj 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&]uh1jhj" ubho: minimum separation time provided in flow control frames; can have the following values (others are reserved):}(hj" hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubj )}(hhh](j)}(h0x00 - 0x7F : 0 - 127 ms h]h)}(h0x00 - 0x7F : 0 - 127 msh]h0x00 - 0x7F : 0 - 127 ms}(hjE hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjA ubah}(h]h ]h"]h$]h&]uh1jhj> ubj)}(h0xF1 - 0xF9 : 100 us - 900 us h]h)}(h0xF1 - 0xF9 : 100 us - 900 ush]h0xF1 - 0xF9 : 100 us - 900 us}(hj] hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjY ubah}(h]h ]h"]h$]h&]uh1jhj> ubeh}(h]h ]h"]h$]h&]j.j/uh1j hhhKhj ubeh}(h]h ]h"]h$]h&]uh1jhj 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&]uh1jhj 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&]uh1jhj hhhhhNubeh}(h]h ]h"]h$]h&]j.j/uh1j hhhKhj hhubeh}(h]flow-control-optionsah ]h"]flow control optionsah$]h&]uh1hhj~hhhhhKubh)}(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&]uh1jhj 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&]hhjjjj}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&]uh1jhj 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&]hhjjjj}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&]uh1jhj' ubh9: generated and accepted CAN frame type, can be equal to }(hj' hhhNhNubj)}(h ``CAN_MTU``h]hCAN_MTU}(hj= hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj' ubh for classical CAN frames or }(hj' hhhNhNubj)}(h ``CANFD_MTU``h]h CANFD_MTU}(hjO hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj' ubh for CAN FD frames.}(hj' hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj# ubah}(h]h ]h"]h$]h&]uh1jhj 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}(hju hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjq 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.: }(hjq hhhNhNubj)}(h``mtu = CANFD_MTU``h]hmtu = CANFD_MTU}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjq ubh).}(hjq hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjm ubah}(h]h ]h"]h$]h&]uh1jhj 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&]uh1jhj ubh: flags set into }(hj hhhNhNubj)}(h``struct canfd_frame.flags``h]hstruct canfd_frame.flags}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj 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&]uh1jhj ubh).}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jhj hhhhhNubeh}(h]h ]h"]h$]h&]j.j/uh1j hhhMhj hhubeh}(h]link-layer-optionsah ]h"]link layer optionsah$]h&]uh1hhj~hhhhhMubh)}(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&]uh1jhj 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));}hj. sbah}(h]h ]h"]h$]h&]hhjjjj}uh1jhhhM%hj hhubeh}(h]transmission-stminah ]h"]transmission stminah$]h&]uh1hhj~hhhhhMubh)}(hhh](h)}(hReception stminh]hReception stmin}(hjH hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjE 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 }(hjV hhhNhNubj)}(h``CAN_ISOTP_RX_STMIN``h]hCAN_ISOTP_RX_STMIN}(hj^ hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjV 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:}(hjV hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM-hjE 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));}hjv sbah}(h]h ]h"]h$]h&]hhjjjj}uh1jhhhM2hjE hhubeh}(h]reception-stminah ]h"]reception stminah$]h&]uh1hhj~hhhhhM+ubeh}(h]iso-tp-socket-optionsah ]h"]iso-tp socket optionsah$]h&]uh1hhj^hhhhhKubh)}(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&]uh1jhj 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&]uh1jhj ubh will block, while calls to }(hj hhhNhNubj)}(h ``send(2)``h]hsend(2)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj 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&]uh1jhj ubh flag.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM@hj ubah}(h]h ]h"]h$]h&]uh1jhj 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.}(hj! hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMDhj ubah}(h]h ]h"]h$]h&]uh1jhj hhhhhNubeh}(h]h ]h"]h$]h&]j.j/uh1j hhhM=hj hhubeh}(h]multi-frame-transport-supportah ]h"]multi-frame transport supportah$]h&]uh1hhj^hhhhhM8ubh)}(hhh](h)}(hErrorsh]hErrors}(hjF hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjC hhhhhMHubh)}(h+Following errors are reported to userspace:h]h+Following errors are reported to userspace:}(hjT hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMJhjC hhubh)}(hhh](h)}(hRX path errorsh]hRX path errors}(hje hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjb hhhhhMMubhtable)}(hhh]htgroup)}(hhh](hcolspec)}(hhh]h}(h]h ]h"]h$]h&]colwidthK uh1j} hjz ubj~ )}(hhh]h}(h]h ]h"]h$]h&]colwidthK?uh1j} hjz 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}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMQhj ubah}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]uh1j hj ubj )}(hhh](j )}(hhh]h)}(h-EBADMSGh]h-EBADMSG}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMRhj ubah}(h]h ]h"]h$]h&]uh1j hj ubj )}(hhh]h)}(h!data reception with wrong paddingh]h!data reception with wrong padding}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMRhj$ubah}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]uh1j hjz ubeh}(h]h ]h"]h$]h&]colsKuh1jx hju ubah}(h]h ]h"]h$]h&]uh1js hjb hhhhhNubeh}(h]rx-path-errorsah ]h"]rx path errorsah$]h&]uh1hhjC hhhhhMMubh)}(hhh](h)}(hTX path errorsh]hTX path errors}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj\hhhhhMVubjt )}(hhh]jy )}(hhh](j~ )}(hhh]h}(h]h ]h"]h$]h&]colwidthK uh1j} hjpubj~ )}(hhh]h}(h]h ]h"]h$]h&]colwidthKAuh1j} hjpubj )}(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 hjubj )}(hhh]h)}(h0flow control reception with wrong layout/paddingh]h0flow control reception with wrong layout/padding}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM[hjubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1j hjpubeh}(h]h ]h"]h$]h&]colsKuh1jx hjmubah}(h]h ]h"]h$]h&]uh1js hj\hhhhhNubeh}(h]tx-path-errorsah ]h"]tx path errorsah$]h&]uh1hhjC hhhhhMVubeh}(h]errorsah ]h"]errorsah$]h&]uh1hhj^hhhhhMHubeh}(h]how-to-use-iso-tpah ]h"]how to use iso-tpah$]h&]uh1hhhhhhhhKDubh)}(hhh](h)}(hExamplesh]hExamples}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjZhhhhhM_ubh)}(hhh](h)}(hBasic node exampleh]hBasic node example}(hjnhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjkhhhhhMbubh)}(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.}(hj|hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMdhjkhhubj)}(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&]hhjjjj}uh1jhhhMhhjkhhubeh}(h]basic-node-exampleah ]h"]basic node exampleah$]h&]uh1hhjZhhhhhMbubh)}(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&]uh1jhjubh, userland tools, distributed as part of the }(hjhhhNhNubj)}(h ``can-utils``h]h can-utils}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh 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&]uh1hhjZhhhhhM~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_handlerj/error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _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}(j jj[jXj5j2jjjSjPjWjTj{jxj j j j j j j j jB j? j j j@ j= jOjLjYjVjGjDjjjjjju nametypes}(j j[j5jjSjWj{j j j j jB j j@ jOjYjGjjjuh}(jhjXhj2hjj8jPjjTj^jxj}j j~j jj j j j j? j j jE j= j jLjC jVjb jDj\jjZjjkjju 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.