@@ -173,10 +173,25 @@ created. Socket addresses are represented as follows:
173173
174174 .. versionadded :: 3.7
175175
176- - Certain other address families (:const: `AF_PACKET `, :const: `AF_CAN `)
177- support specific representations.
178-
179- .. XXX document them!
176+ - :const: `AF_PACKET ` is a low-level interface directly to network devices.
177+ The packets are represented by the tuple
178+ ``(ifname, proto[, pkttype[, hatype[, addr]]]) `` where:
179+
180+ - *ifname * - String specifying the device name.
181+ - *proto * - An in network-byte-order integer specifying the Ethernet
182+ protocol number.
183+ - *pkttype * - Optional integer specifying the packet type:
184+
185+ - ``PACKET_HOST `` (the default) - Packet addressed to the local host.
186+ - ``PACKET_BROADCAST `` - Physical-layer broadcast packet.
187+ - ``PACKET_MULTIHOST `` - Packet sent to a physical-layer multicast address.
188+ - ``PACKET_OTHERHOST `` - Packet to some other host that has been caught by
189+ a device driver in promiscuous mode.
190+ - ``PACKET_OUTGOING `` - Packet originating from the local host that is
191+ looped back to a packet socket.
192+ - *hatype * - Optional integer specifying the ARP hardware address type.
193+ - *addr * - Optional bytes-like object specifying the hardware physical
194+ address, whose interpretation depends on the device.
180195
181196If you use a hostname in the *host * portion of IPv4/v6 socket address, the
182197program may show a nondeterministic behavior, as Python uses the first address
@@ -376,6 +391,16 @@ Constants
376391 .. versionadded :: 3.7
377392
378393
394+ .. data :: AF_PACKET
395+ PF_PACKET
396+ PACKET_*
397+
398+ Many constants of these forms, documented in the Linux documentation, are
399+ also defined in the socket module.
400+
401+ Availability: Linux >= 2.2.
402+
403+
379404.. data :: AF_RDS
380405 PF_RDS
381406 SOL_RDS
@@ -469,12 +494,12 @@ The following functions all create :ref:`socket objects <socket-objects>`.
469494
470495 Create a new socket using the given address family, socket type and protocol
471496 number. The address family should be :const: `AF_INET ` (the default),
472- :const: `AF_INET6 `, :const: `AF_UNIX `, :const: `AF_CAN ` or :const: `AF_RDS `. The
473- socket type should be :const: `SOCK_STREAM ` (the default),
474- :const: `SOCK_DGRAM `, :const: `SOCK_RAW ` or perhaps one of the other `` SOCK_ ``
475- constants. The protocol number is usually zero and may be omitted or in the
476- case where the address family is :const: `AF_CAN ` the protocol should be one
477- of :const: `CAN_RAW `, :const: `CAN_BCM ` or :const: `CAN_ISOTP `
497+ :const: `AF_INET6 `, :const: `AF_UNIX `, :const: `AF_CAN `, :const: `AF_PACKET `,
498+ or :const: ` AF_RDS `. The socket type should be :const: `SOCK_STREAM ` (the
499+ default), :const: `SOCK_DGRAM `, :const: `SOCK_RAW ` or perhaps one of the other
500+ `` SOCK_ `` constants. The protocol number is usually zero and may be omitted
501+ or in the case where the address family is :const: `AF_CAN ` the protocol
502+ should be one of :const: `CAN_RAW `, :const: `CAN_BCM ` or :const: `CAN_ISOTP `.
478503
479504 If *fileno * is specified, the values for *family *, *type *, and *proto * are
480505 auto-detected from the specified file descriptor. Auto-detection can be
0 commit comments