00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef DBUS_SOCKETS_H
00025 #define DBUS_SOCKETS_H
00026
00027 #if defined(DBUS_WIN) || defined(DBUS_WINCE)
00028
00029
00030
00031 #ifndef STRICT
00032 #define STRICT
00033 #include <winsock2.h>
00034 #undef STRICT
00035 #endif
00036 #include <winsock2.h>
00037
00038 #undef interface
00039
00040 #include <errno.h>
00041
00042
00043
00044
00045
00046 #if defined(EPROTONOSUPPORT) || \
00047 defined(EAFNOSUPPORT) || \
00048 defined(EWOULDBLOCK)
00049 #error This does not look like Win32 and the Microsoft C library
00050 #endif
00051
00052 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
00053 #define EAFNOSUPPORT WSAEAFNOSUPPORT
00054 #define EWOULDBLOCK WSAEWOULDBLOCK
00055
00056 #define DBUS_SOCKET_IS_INVALID(s) ((SOCKET)(s) == INVALID_SOCKET)
00057 #define DBUS_SOCKET_API_RETURNS_ERROR(n) ((n) == SOCKET_ERROR)
00058 #define DBUS_SOCKET_SET_ERRNO() errno = WSAGetLastError()
00059
00060 #define DBUS_CLOSE_SOCKET(s) closesocket(s)
00061
00062 #else
00063
00064 #include <sys/socket.h>
00065 #include <sys/un.h>
00066 #include <netinet/in.h>
00067 #include <netdb.h>
00068 #include <errno.h>
00069
00070 #define DBUS_SOCKET_IS_INVALID(s) ((s) < 0)
00071 #define DBUS_SOCKET_API_RETURNS_ERROR(n) ((n) < 0)
00072 #define DBUS_SOCKET_SET_ERRNO()
00073
00074 #define DBUS_CLOSE_SOCKET(s) close(s)
00075
00076 #endif
00077
00078 #endif