mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
gh-95389: expose popular ETHERTYPE_* constants in the socket module (#95390)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com> Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
This commit is contained in:
parent
6168e714be
commit
80c08d1cd6
6 changed files with 65 additions and 4 deletions
|
@ -247,6 +247,10 @@ shutdown(how) -- shut down traffic in one or both directions\n\
|
|||
#include <net/if.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NET_ETHERNET_H
|
||||
#include <net/ethernet.h>
|
||||
#endif
|
||||
|
||||
/* Generic socket object definitions and includes */
|
||||
#define PySocket_BUILDING_SOCKET
|
||||
#include "socketmodule.h"
|
||||
|
@ -7711,6 +7715,25 @@ PyInit__socket(void)
|
|||
PyModule_AddIntMacro(m, ALG_OP_VERIFY);
|
||||
#endif
|
||||
|
||||
/* IEEE 802.3 protocol numbers required for a standard TCP/IP network stack */
|
||||
#ifdef ETHERTYPE_ARP
|
||||
PyModule_AddIntMacro(m, ETHERTYPE_ARP);
|
||||
#endif
|
||||
#ifdef ETHERTYPE_IP
|
||||
PyModule_AddIntMacro(m, ETHERTYPE_IP);
|
||||
#endif
|
||||
#ifdef ETHERTYPE_IPV6
|
||||
PyModule_AddIntMacro(m, ETHERTYPE_IPV6);
|
||||
#endif
|
||||
#ifdef ETHERTYPE_VLAN
|
||||
PyModule_AddIntMacro(m, ETHERTYPE_VLAN);
|
||||
#endif
|
||||
|
||||
/* Linux pseudo-protocol for sniffing every packet */
|
||||
#ifdef ETH_P_ALL
|
||||
PyModule_AddIntMacro(m, ETH_P_ALL);
|
||||
#endif
|
||||
|
||||
/* Socket types */
|
||||
PyModule_AddIntMacro(m, SOCK_STREAM);
|
||||
PyModule_AddIntMacro(m, SOCK_DGRAM);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue