Hybrid ICN (hICN) plugin
v21.06-rc0-4-g18fa668
lib
includes
hicn
util
windows
windows_utils.h
1
/*
2
* Copyright (c) 2019 Cisco and/or its affiliates.
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at:
6
*
7
* http://www.apache.org/licenses/LICENSE-2.0
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
*/
15
16
#ifndef WINDOWS_UTILS_H
17
#define WINDOWS_UTILS_H
18
#define WIN32_LEAN_AND_MEAN
19
#define HAVE_STRUCT_TIMESPEC
20
#ifndef NOMINMAX
21
#define NOMINMAX
22
#endif
23
#include <Windows.h>
24
#include <stdint.h>
25
#include <io.h>
26
#include <stdlib.h>
27
#include <winsock2.h>
28
#include <WS2tcpip.h>
29
#include "dlfcn.h"
30
31
#ifndef IOVEC
32
#define IOVEC
33
struct
iovec
{
34
void
* iov_base;
35
size_t
iov_len;
36
};
37
#endif
38
39
typedef
uint16_t in_port_t;
40
41
#ifndef SLEEP
42
#define SLEEP
43
#define sleep Sleep
44
#endif
45
46
#ifndef USLEEP
47
#define USLEEP
48
void
usleep(__int64 usec);
49
#endif
50
51
#ifndef S_ISDIR
52
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
53
#endif
54
55
#define PARCLibrary_DISABLE_ATOMICS
56
#include <BaseTsd.h>
57
typedef
SSIZE_T ssize_t;
58
59
#ifndef __ATTRIBUTE__
60
#define __ATTRIBUTE__
61
#define __attribute__(A)
62
#endif
63
64
#ifndef RESTRICT
65
#define RESTRICT
66
#define restrict __restrict
67
#endif
68
69
#ifndef GETTIMEOFDAY
70
#define GETTIMEOFDAY
71
int
gettimeofday(
struct
timeval * tp,
struct
timezone * tzp);
72
#endif
73
74
#ifndef timersub
75
#define timersub(a, b, result) \
76
do { \
77
(result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
78
(result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
79
if ((result)->tv_usec < 0) { \
80
--(result)->tv_sec; \
81
(result)->tv_usec += 1000000; \
82
} \
83
} while (0)
84
#endif // timersub
85
86
#ifndef dup
87
#define dup _dup
88
#endif
89
90
#ifndef access
91
#define access _access
92
#endif
93
94
#ifndef __cplusplus
95
96
#ifndef read
97
#define read _read
98
#endif
99
100
#ifndef close
101
#define close _close
102
#endif
103
104
#ifndef write
105
#define write _write
106
#endif
107
108
#ifndef open
109
#define open _open
110
#endif
111
112
#endif
113
114
#ifndef unlink
115
#define unlink _unlink
116
#endif
117
118
#ifndef strcasecmp
119
#define strncasecmp _strnicmp
120
#endif
121
122
#ifndef strcasecmp
123
124
#define strcasecmp _stricmp
125
#endif
126
127
#ifndef S_ISREG
128
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
129
#endif
130
#ifndef R_OK
131
#define R_OK 4
/* Test for read permission. */
132
#endif
133
#ifndef W_OK
134
#define W_OK 2
/* Test for write permission. */
135
#endif
136
#ifndef F_OK
137
#define F_OK 0
138
#endif
139
140
#ifndef STDIN_FILENO
141
#define STDIN_FILENO _fileno(stdin)
142
#endif
143
144
#ifndef STDOUT_FILENO
145
#define STDOUT_FILENO _fileno(stdout)
146
#endif
147
148
#ifndef STDERR_FILENO
149
#define STDERR_FILENO _fileno(stderr)
150
#endif
151
152
#endif
153
154
#ifndef __bswap_constant_32
155
#define __bswap_constant_32(x) \
156
((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) \
157
| (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24))
158
#endif
159
160
#ifndef bzero
161
#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
162
#endif
iovec
Definition:
windows_utils.h:33
Generated by
1.8.17