summaryrefslogtreecommitdiffstats
path: root/Doc/library/socket.rst
diff options
context:
space:
mode:
authorkarl ding <karlding@users.noreply.github.com>2020-04-29 22:31:19 (GMT)
committerGitHub <noreply@github.com>2020-04-29 22:31:19 (GMT)
commit360371f79c48f15bbcee7aeecacf97a899913b25 (patch)
treecfccbf6ede96666eaafff463e4296c714da16d8b /Doc/library/socket.rst
parentfd33cdbd05d2fbe2443554a9b79155de07b0d056 (diff)
downloadcpython-360371f79c48f15bbcee7aeecacf97a899913b25.zip
cpython-360371f79c48f15bbcee7aeecacf97a899913b25.tar.gz
cpython-360371f79c48f15bbcee7aeecacf97a899913b25.tar.bz2
bpo-40291: Add support for CAN_J1939 sockets (GH-19538)
Add support for CAN_J1939 sockets that wrap SAE J1939 protocol functionality provided by Linux 5.4+ kernels.
Diffstat (limited to 'Doc/library/socket.rst')
-rwxr-xr-xDoc/library/socket.rst19
1 files changed, 18 insertions, 1 deletions
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index 87dee1a..d798c1a 100755
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -118,6 +118,10 @@ created. Socket addresses are represented as follows:
- :const:`CAN_ISOTP` protocol require a tuple ``(interface, rx_addr, tx_addr)``
where both additional parameters are unsigned long integer that represent a
CAN identifier (standard or extended).
+ - :const:`CAN_J1939` protocol require a tuple ``(interface, name, pgn, addr)``
+ where additional parameters are 64-bit unsigned integer representing the
+ ECU name, a 32-bit unsigned integer representing the Parameter Group Number
+ (PGN), and an 8-bit integer representing the address.
- A string or a tuple ``(id, unit)`` is used for the :const:`SYSPROTO_CONTROL`
protocol of the :const:`PF_SYSTEM` family. The string is the name of a
@@ -428,6 +432,15 @@ Constants
.. versionadded:: 3.7
+.. data:: CAN_J1939
+
+ CAN_J1939, in the CAN protocol family, is the SAE J1939 protocol.
+ J1939 constants, documented in the Linux documentation.
+
+ .. availability:: Linux >= 5.4.
+
+ .. versionadded:: 3.9
+
.. data:: AF_PACKET
PF_PACKET
@@ -544,7 +557,8 @@ The following functions all create :ref:`socket objects <socket-objects>`.
default), :const:`SOCK_DGRAM`, :const:`SOCK_RAW` or perhaps one of the other
``SOCK_`` constants. The protocol number is usually zero and may be omitted
or in the case where the address family is :const:`AF_CAN` the protocol
- should be one of :const:`CAN_RAW`, :const:`CAN_BCM` or :const:`CAN_ISOTP`.
+ should be one of :const:`CAN_RAW`, :const:`CAN_BCM`, :const:`CAN_ISOTP` or
+ :const:`CAN_J1939`.
If *fileno* is specified, the values for *family*, *type*, and *proto* are
auto-detected from the specified file descriptor. Auto-detection can be
@@ -588,6 +602,9 @@ The following functions all create :ref:`socket objects <socket-objects>`.
``SOCK_NONBLOCK``, but ``sock.type`` will be set to
``socket.SOCK_STREAM``.
+ .. versionchanged:: 3.9
+ The CAN_J1939 protocol was added.
+
.. function:: socketpair([family[, type[, proto]]])
Build a pair of connected socket objects using the given address family, socket