OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #ifndef NATIVE_CLIENT_SRC_INCLUDE_PORTABILITY_SOCKETS_H_ | 7 #ifndef NATIVE_CLIENT_SRC_INCLUDE_PORTABILITY_SOCKETS_H_ |
8 #define NATIVE_CLIENT_SRC_INCLUDE_PORTABILITY_SOCKETS_H_ 1 | 8 #define NATIVE_CLIENT_SRC_INCLUDE_PORTABILITY_SOCKETS_H_ 1 |
9 | 9 |
| 10 #include "native_client/src/include/build_config.h" |
| 11 |
10 #if NACL_WINDOWS | 12 #if NACL_WINDOWS |
11 # include <winsock2.h> | 13 # include <winsock2.h> |
12 # include <windows.h> | 14 # include <windows.h> |
13 | 15 |
14 typedef SOCKET NaClSocketHandle; | 16 typedef SOCKET NaClSocketHandle; |
15 | 17 |
16 # define NaClCloseSocket closesocket | 18 # define NaClCloseSocket closesocket |
17 # define NACL_INVALID_SOCKET INVALID_SOCKET | 19 # define NACL_INVALID_SOCKET INVALID_SOCKET |
18 # define NaClSocketGetLastError() WSAGetLastError() | 20 # define NaClSocketGetLastError() WSAGetLastError() |
19 #else | 21 #else |
20 | 22 |
21 # include <arpa/inet.h> | 23 # include <arpa/inet.h> |
22 # include <netdb.h> | 24 # include <netdb.h> |
23 # include <netinet/tcp.h> | 25 # include <netinet/tcp.h> |
24 # include <sys/select.h> | 26 # include <sys/select.h> |
25 # include <sys/socket.h> | 27 # include <sys/socket.h> |
26 | 28 |
27 typedef int NaClSocketHandle; | 29 typedef int NaClSocketHandle; |
28 | 30 |
29 # define NaClCloseSocket close | 31 # define NaClCloseSocket close |
30 # define NACL_INVALID_SOCKET (-1) | 32 # define NACL_INVALID_SOCKET (-1) |
31 # define NaClSocketGetLastError() errno | 33 # define NaClSocketGetLastError() errno |
32 | 34 |
33 #endif | 35 #endif |
34 | 36 |
35 #endif // NATIVE_CLIENT_SRC_INCLUDE_PORTABILITY_SOCKETS_H_ | 37 #endif // NATIVE_CLIENT_SRC_INCLUDE_PORTABILITY_SOCKETS_H_ |
OLD | NEW |