simple-multicast  0.2.1
 All Files Functions Typedefs Macros Pages
compatibility.h
Go to the documentation of this file.
1 
44 #ifndef __COMPATIBILITY_H__
45 #define __COMPATIBILITY_H__
46 
50 typedef int bool;
51 
55 #define SOURCE_PORT 0
56 
57 #ifdef _WIN32
58 #ifndef _WIN32_WINNT
59 
62 #define _WIN32_WINNT 0x0501
63 #endif // _WIN32_WINNT
64 #include <windows.h>
65 #include <winsock2.h>
66 #include <Ws2tcpip.h>
67 
74 void sleep(int delay_s);
75 
76 /* wrapper for windows */
77 const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt);
78 int inet_pton(int af, const char *src, void *dst);
79 
80 #else
81 
82 #include <sys/types.h>
83 #include <sys/socket.h>
84 #include <arpa/inet.h>
85 #include <netinet/in.h>
86 #include <netdb.h>
87 
91 typedef int SOCKET;
92 
93 #ifndef SOCKET_ERROR
94 
97 #define SOCKET_ERROR (-1)
98 #endif // SOCKET_ERROR
99 
100 #ifndef INVALID_SOCKET
101 
104 #define INVALID_SOCKET (SOCKET)(~0)
105 #endif // INVALID_SOCKET
106 
110 typedef struct sockaddr_in SOCKADDR_IN;
111 
115 typedef struct sockaddr_in6 SOCKADDR_IN6;
116 
120 #ifndef FALSE
121 #define FALSE (0)
122 #endif // FALSE
123 
127 #ifndef TRUE
128 #define TRUE !FALSE
129 #endif // TRUE
130 
131 void closesocket(SOCKET sock);
132 
133 #endif // _WIN32
134 
135 #endif