source: vendor/python/2.5/Modules/socketmodule.h@ 3225

Last change on this file since 3225 was 3225, checked in by bird, 19 years ago

Python 2.5

File size: 6.2 KB
RevLine 
[3225]1/* Socket module header file */
2
3/* Includes needed for the sockaddr_* symbols below */
4#ifndef MS_WINDOWS
5#ifdef __VMS
6# include <socket.h>
7# else
8# include <sys/socket.h>
9# endif
10# include <netinet/in.h>
11# if !(defined(__BEOS__) || defined(__CYGWIN__) || (defined(PYOS_OS2) && defined(PYCC_VACPP)))
12# include <netinet/tcp.h>
13# endif
14
15#else /* MS_WINDOWS */
16#if _MSC_VER >= 1300
17# include <winsock2.h>
18# include <ws2tcpip.h>
19# define HAVE_ADDRINFO
20# define HAVE_SOCKADDR_STORAGE
21# define HAVE_GETADDRINFO
22# define HAVE_GETNAMEINFO
23# define ENABLE_IPV6
24#else
25# include <winsock.h>
26#endif
27#endif
28
29#ifdef HAVE_SYS_UN_H
30# include <sys/un.h>
31#else
32# undef AF_UNIX
33#endif
34
35#ifdef HAVE_LINUX_NETLINK_H
36# ifdef HAVE_ASM_TYPES_H
37# include <asm/types.h>
38# endif
39# include <linux/netlink.h>
40#else
41# undef AF_NETLINK
42#endif
43
44#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
45#include <bluetooth/bluetooth.h>
46#include <bluetooth/rfcomm.h>
47#include <bluetooth/l2cap.h>
48#include <bluetooth/sco.h>
49#endif
50
51#ifdef HAVE_BLUETOOTH_H
52#include <bluetooth.h>
53#endif
54
55#ifdef HAVE_NETPACKET_PACKET_H
56# include <sys/ioctl.h>
57# include <net/if.h>
58# include <netpacket/packet.h>
59#endif
60
61#ifndef Py__SOCKET_H
62#define Py__SOCKET_H
63#ifdef __cplusplus
64extern "C" {
65#endif
66
67/* Python module and C API name */
68#define PySocket_MODULE_NAME "_socket"
69#define PySocket_CAPI_NAME "CAPI"
70
71/* Abstract the socket file descriptor type */
72#ifdef MS_WINDOWS
73typedef SOCKET SOCKET_T;
74# ifdef MS_WIN64
75# define SIZEOF_SOCKET_T 8
76# else
77# define SIZEOF_SOCKET_T 4
78# endif
79#else
80typedef int SOCKET_T;
81# define SIZEOF_SOCKET_T SIZEOF_INT
82#endif
83
84/* Socket address */
85typedef union sock_addr {
86 struct sockaddr_in in;
87#ifdef AF_UNIX
88 struct sockaddr_un un;
89#endif
90#ifdef AF_NETLINK
91 struct sockaddr_nl nl;
92#endif