Debian Codegraph @

contrib/socket-shim.h

raw symbols SCIP
1 /* librist. Copyright © 2019 SipRadius LLC. All right reserved.
2 * Author: Kuldeep Singh Dhaka <[email protected]>
3 * Author: Sergio Ammirata, Ph.D. <[email protected]>
4 */
5
6 #ifndef __SOCKET_SHIM_H
7 #define __SOCKET_SHIM_H
8
9 #ifndef SOL_IP
10 #define SOL_IP 0x0
11 #define SOL_IPV6 0x29
12 #endif
13
14 #ifdef _WIN32
15 /* librist uses WSAPoll/inet_pton/inet_ntop which mingw-w64 gates on
16 * _WIN32_WINNT >= 0x0600. Force a Vista minimum before <winsock2.h>
17 * is pulled in, so downstream consumers that set a lower baseline
18 * (e.g. VLC 3.0 contribs pin it to XP SP2 via 0x0502) still compile. */
19 #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600
20 # undef _WIN32_WINNT
21 # define _WIN32_WINNT 0x0600
22 #endif
23 #include <winsock2.h>
24 #define _WINSOCKAPI_
25 #include <windows.h>
26 #include <ws2tcpip.h>
27 #include <stdlib.h>
28 #define AF_LOCAL AF_UNSPEC
29 #define MSG_DONTWAIT (0)
30
31 typedef int socklen_t;
32 #ifndef __MINGW32__
33 #include <io.h>
34 #define dup(s) _dup(s)
35 #define write(fd, buf, size) _write(fd, buf, size)
36 #endif
37
38 #ifndef SHUT_RDWR
39 #define SHUT_RDWR SD_BOTH
40 #endif
41
42 #else /* Unix like OSes */
43
44 #include <sys/types.h>
45 #include <sys/socket.h>
46 #include <netdb.h>
47 #include <unistd.h>
48 #include <arpa/inet.h>
49 #include <netinet/in.h>
50 #include <netinet/ip.h>
51 #include <netinet/ip6.h>
52 #include <net/if.h>
53
54 #endif
55
56 #endif