Eryk Sun added the comment:

Unless someone has a better (more automated) way to handle the Winsock IPPROTO 
enum, I suggest we either special-case the individual tests for MS_WINDOWS when 
we know that Winsock defines the value; or just define macros for the values in 
the enum:

    #ifdef MS_WINDOWS /* Macros based on the IPPROTO enum. */
    #define IPPROTO_ICMP IPPROTO_ICMP
    #define IPPROTO_IGMP IPPROTO_IGMP
    #define IPPROTO_GGP IPPROTO_GGP
    #define IPPROTO_TCP IPPROTO_TCP
    #define IPPROTO_PUP IPPROTO_PUP
    #define IPPROTO_UDP IPPROTO_UDP
    #define IPPROTO_IDP IPPROTO_IDP
    #define IPPROTO_ND IPPROTO_ND 
    #define IPPROTO_RAW IPPROTO_RAW
    #define IPPROTO_MAX IPPROTO_MAX
    #if (_WIN32_WINNT >= 0x0501)
    #define IPPROTO_HOPOPTS IPPROTO_HOPOPTS
    #define IPPROTO_IPV4 IPPROTO_IPV4
    #define IPPROTO_IPV6 IPPROTO_IPV6
    #define IPPROTO_ROUTING IPPROTO_ROUTING
    #define IPPROTO_FRAGMENT IPPROTO_FRAGMENT
    #define IPPROTO_ESP IPPROTO_ESP
    #define IPPROTO_AH IPPROTO_AH
    #define IPPROTO_ICMPV6 IPPROTO_ICMPV6
    #define IPPROTO_NONE IPPROTO_NONE
    #define IPPROTO_DSTOPTS IPPROTO_DSTOPTS
    #define IPPROTO_ICLFXBM IPPROTO_ICLFXBM
    #endif /* (_WIN32_WINNT >= 0x0501) */
    #if (_WIN32_WINNT >= 0x0600)
    #define IPPROTO_ST IPPROTO_ST
    #define IPPROTO_CBT IPPROTO_CBT
    #define IPPROTO_EGP IPPROTO_EGP
    #define IPPROTO_IGP IPPROTO_IGP
    #define IPPROTO_RDP IPPROTO_RDP
    #define IPPROTO_PIM IPPROTO_PIM
    #define IPPROTO_PGM IPPROTO_PGM
    #define IPPROTO_L2TP IPPROTO_L2TP
    #define IPPROTO_SCTP IPPROTO_SCTP
    #endif /* (_WIN32_WINNT >= 0x0600) */
    #endif /* MS_WINDOWS */

or call PyModule_AddIntConstant(m, "IPPROTO_ICMP", IPPROTO_ICMP) and so on for 
each enum value.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29515>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to