forked from Haivision/srt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplatform_sys.h
More file actions
133 lines (110 loc) · 3.12 KB
/
platform_sys.h
File metadata and controls
133 lines (110 loc) · 3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
* SRT - Secure, Reliable, Transport
* Copyright (c) 2018 Haivision Systems Inc.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
#ifndef INC_SRT_PLATFORM_SYS_H
#define INC_SRT_PLATFORM_SYS_H
// INFORMATION
//
// This file collects all required platform-specific declarations
// required to provide everything that the SRT library needs from system.
//
// There's also semi-modular system implemented using SRT_IMPORT_* macros.
// To require a module to be imported, #define SRT_IMPORT_* where * is
// the module name. Currently handled module macros:
//
// SRT_IMPORT_TIME (mach time on Mac, portability gettimeofday on WIN32)
// SRT_IMPORT_EVENT (includes kevent on Mac)
#ifdef _WIN32
#ifndef __MINGW32__
// Explicitly define 32-bit and 64-bit numbers
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int32 uint32_t;
#ifndef LEGACY_WIN32
typedef unsigned __int64 uint64_t;
#else
// VC 6.0 does not support unsigned __int64: may cause potential problems.
typedef __int64 uint64_t;
#endif
#endif
#include <stdint.h>
#include <inttypes.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <ws2ipdef.h>
#include <windows.h>
#ifndef __MINGW32__
#include <intrin.h>
#endif
#ifdef SRT_IMPORT_TIME
#include <win/wintime.h>
#endif
#else
#if defined(__APPLE__) && __APPLE__
// Warning: please keep this test as it is, do not make it
// "#if __APPLE__" or "#ifdef __APPLE__". In applications with
// a strict "no warning policy", "#if __APPLE__" triggers an "undef"
// error. With GCC, an old & never fixed bug prevents muting this
// warning (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431).
// Before this fix, the solution was to "#define __APPLE__ 0" before
// including srt.h. So, don't use "#ifdef __APPLE__" either.
// XXX Check if this condition doesn't require checking of
// also other macros, like TARGET_OS_IOS etc.
#include "TargetConditionals.h"
#ifndef __APPLE_USE_RFC_3542
#define __APPLE_USE_RFC_3542 /* IPV6_PKTINFO */
#endif
#ifdef SRT_IMPORT_TIME
#include <mach/mach_time.h>
#endif
#ifdef SRT_IMPORT_EVENT
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
#include <unistd.h>
#endif
#endif
#ifdef BSD
#ifdef SRT_IMPORT_EVENT
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
#include <unistd.h>
#endif
#endif
#ifdef LINUX
#ifdef SRT_IMPORT_EVENT
#include <sys/epoll.h>
#include <unistd.h>
#endif
#endif
#ifdef __ANDROID__
#ifdef SRT_IMPORT_EVENT
#include <sys/select.h>
#endif
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <fcntl.h>
#ifdef __cplusplus
// Headers for errno, string and stdlib are
// included indirectly correct C++ way.
#else
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#endif
#endif
#endif